XBee Firmware Library  1.6.0
Files | Data Structures | Typedefs | Enumerations | Enumerator | Functions | Variables
Firmware Updates

Files

file  firmware.h
 
file  xbee_firmware.c
 

Data Structures

struct  xbee_fw_buffer_t
 
struct  xbee_fw_oem_state_t
 
struct  xbee_fw_source_t
 

Typedefs

typedef PACKED_STRUCT _xbee_oem_header
 
typedef XBEE_BEGIN_DECLS struct xbee_fw_oem_state_t xbee_fw_oem_state_t
 
typedef struct xbee_fw_source_t xbee_fw_source_t
 

Enumerations

enum  {
  XBEE_FW_STATE_INIT, XBEE_FW_STATE_RESET, XBEE_FW_STATE_TOGGLE, XBEE_FW_STATE_BREAK,
  XBEE_FW_STATE_PROMPT, XBEE_FW_STATE_XMODEM_WAIT, XBEE_FW_STATE_XMODEM_SEND, XBEE_FW_STATE_XMODEM_DONE,
  XBEE_FW_STATE_FINAL_PROMPT, XBEE_FW_STATE_CMD_PENDING, XBEE_FW_STATE_CMD, XBEE_FW_STATE_PARSE_RESPONSE,
  XBEE_FW_STATE_CMD_HV, XBEE_FW_STATE_CMD_COMPAT, XBEE_FW_STATE_CMD_VR, XBEE_FW_STATE_CMD_CF1,
  XBEE_FW_STATE_CMD_SL, XBEE_FW_STATE_CMD_PROG, XBEE_FW_STATE_CMD_FR, XBEE_FW_STATE_BOOTLOADER,
  XBEE_FW_STATE_TX_START, XBEE_FW_STATE_TX_BLOCK, XBEE_FW_STATE_SENDING, XBEE_FW_STATE_RX_BLOCK,
  XBEE_FW_STATE_RX_FAIL, XBEE_FW_STATE_DONE, XBEE_FW_STATE_FAILURE, XBEE_FW_STATE_SUCCESS
}
 

Functions

_xbee_firmware_debug int _xbee_fw_buffer_read (void FAR *context, void FAR *buffer, int16_t bytes)
 
_xbee_firmware_debug int _xbee_fw_buffer_seek (void FAR *context, uint32_t offset)
 
_xbee_firmware_debug int _xbee_fw_send_request (xbee_fw_source_t *source, const FAR char *request, int next_state)
 
_xbee_firmware_debug int _xbee_oem_verify (xbee_fw_source_t *source)
 
int xbee_fw_buffer_init (xbee_fw_buffer_t *fw, uint32_t length, const char FAR *address)
 Helper function for setting up an xbee_fw_buffer_t for use with a source firmware image held entirely in a buffer. More...
 
_xbee_firmware_debug uint16_t xbee_fw_hex2word (const char *pString)
 
unsigned int xbee_fw_install_ebl_state (xbee_fw_source_t *source)
 Returns a unique value indicating the state of the .EBL install process. More...
 
int xbee_fw_install_ebl_tick (xbee_fw_source_t *source)
 Drive the firmware update process for boards that use .EBL files to store their firmware. More...
 
int xbee_fw_install_hcs08_tick (xbee_fw_source_t *source)
 Drive the firmware update process for the HCS08 application on Programmable XBee modules. More...
 
int xbee_fw_install_init (xbee_dev_t *xbee, const wpan_address_t FAR *target, xbee_fw_source_t *source)
 Prepare to install new firmware on an attached XBee module. More...
 
int xbee_fw_install_oem_tick (xbee_fw_source_t *source)
 Install the firmware image stored in source. More...
 
_xbee_firmware_debug int xbee_fw_read_byte (xbee_fw_source_t *source)
 check return value of source->read here and in _uint16 and _uint32? More...
 
_xbee_firmware_debug uint16_t xbee_fw_read_uint16 (xbee_fw_source_t *source)
 
_xbee_firmware_debug uint32_t xbee_fw_read_uint32 (xbee_fw_source_t *source)
 
char FAR * xbee_fw_status_ebl (xbee_fw_source_t *source, char FAR *buffer)
 Update buffer with the current install status of source. Note that this string will only change if the return value of xbee_fw_install_ebl_state() has changed. More...
 
char FAR * xbee_fw_status_oem (xbee_fw_source_t *source, char FAR *buffer)
 Update buffer with the current install status of source. More...
 

Variables

const char FAR * address
 
uint16_t block_length
 
uint32_t block_offset
 
char bootloader_cmd
 
char buffer [128+5]
 
uint16_t checksum
 
void FAR * context
 
uint32_t cur_offset
 
uint32_t firmware_length
 
uint16_t header_len
 
uint32_t image_len
 
uint32_t length
 
uint8_t module_id
 
int next_state
 
xbee_fw_oem_state_t   oem
 
uint32_t offset
 
int(* read )(void FAR *context, void FAR *buffer, int16_t bytes)
 
int(* seek )(void FAR *context, uint32_t offset)
 
uint8_t software_id
 
xbee_fw_source_t source
 
int state
 
uint32_t timer
 
int tries
 
union {
   xbee_fw_oem_state_t   oem
 
   xbee_xmodem_state_t   xbxm
 
u
 
xbee_dev_txbee
 
 xbee_oem_header_t
 
xbee_xmodem_state_t   xbxm
 

Detailed Description

This layer makes use of lower layers to perform updates on XBee modules. Both file formats are supported – .ebl (ZNet, ZigBee, Smart Energy) and .oem (DigiMesh).

Typedef Documentation

Initial value:
{
uint16_t magic
unsigned int uint16_t
An unsigned integer variable 16 bits.
Definition: types.h:46
typedef XBEE_BEGIN_DECLS struct xbee_fw_oem_state_t xbee_fw_oem_state_t

Enumeration Type Documentation

anonymous enum
Enumerator
XBEE_FW_STATE_INIT 
XBEE_FW_STATE_RESET 
XBEE_FW_STATE_TOGGLE 
XBEE_FW_STATE_BREAK 
XBEE_FW_STATE_PROMPT 
XBEE_FW_STATE_XMODEM_WAIT 
XBEE_FW_STATE_XMODEM_SEND 
XBEE_FW_STATE_XMODEM_DONE 
XBEE_FW_STATE_FINAL_PROMPT 
XBEE_FW_STATE_CMD_PENDING 
XBEE_FW_STATE_CMD 
XBEE_FW_STATE_PARSE_RESPONSE 
XBEE_FW_STATE_CMD_HV 
XBEE_FW_STATE_CMD_COMPAT 
XBEE_FW_STATE_CMD_VR 
XBEE_FW_STATE_CMD_CF1 
XBEE_FW_STATE_CMD_SL 
XBEE_FW_STATE_CMD_PROG 
XBEE_FW_STATE_CMD_FR 
XBEE_FW_STATE_BOOTLOADER 
XBEE_FW_STATE_TX_START 
XBEE_FW_STATE_TX_BLOCK 
XBEE_FW_STATE_SENDING 
XBEE_FW_STATE_RX_BLOCK 
XBEE_FW_STATE_RX_FAIL 
XBEE_FW_STATE_DONE 
XBEE_FW_STATE_FAILURE 
XBEE_FW_STATE_SUCCESS 

Function Documentation

_xbee_firmware_debug int _xbee_fw_buffer_read ( void FAR *  context,
void FAR *  buffer,
int16_t  bytes 
)
_xbee_firmware_debug int _xbee_fw_buffer_seek ( void FAR *  context,
uint32_t  offset 
)
_xbee_firmware_debug int _xbee_fw_send_request ( xbee_fw_source_t source,
const FAR char *  request,
int  next_state 
)
_xbee_firmware_debug int _xbee_oem_verify ( xbee_fw_source_t source)
_xbee_firmware_debug int xbee_fw_buffer_init ( xbee_fw_buffer_t fw,
uint32_t  length,
const char FAR *  address 
)

Helper function for setting up an xbee_fw_buffer_t for use with a source firmware image held entirely in a buffer.

Parameters
[out]fwstructure to configure for reading firmware from a buffer
[in]lengthnumber of bytes in firmware image
[in]addressaddress of buffer containing firmware
Return values
0success
-EINVALinvalid parameter
_xbee_firmware_debug uint16_t xbee_fw_hex2word ( const char *  pString)
_xbee_firmware_debug unsigned int xbee_fw_install_ebl_state ( xbee_fw_source_t source)

Returns a unique value indicating the state of the .EBL install process.

Parameters
[in]sourceobject used to track state of transfer
Returns
unique value that changes whenever the transfer state changes
See also
xbee_fw_status_ebl
_xbee_firmware_debug int xbee_fw_install_ebl_tick ( xbee_fw_source_t source)

Drive the firmware update process for boards that use .EBL files to store their firmware.

Parameters
[in,out]sourceobject used to track state of transfer
Return values
0update is in progress
1update completed successfully
-EINVALsource is invalid
-EIOgeneral failure
-ETIMEDOUTconnection timed out waiting for data from target
See also
xbee_fw_install_init, xbee_fw_install_ebl_state, xbee_fw_status_ebl
_xbee_firmware_debug int xbee_fw_install_hcs08_tick ( xbee_fw_source_t source)

Drive the firmware update process for the HCS08 application on Programmable XBee modules.

Parameters
[in,out]sourceobject used to track state of transfer
Return values
0update is in progress
1update completed successfully
-EINVALsource is invalid
-EIOgeneral failure
-ETIMEDOUTconnection timed out waiting for data from target
See also
xbee_fw_install_init, xbee_fw_install_ebl_state, xbee_fw_status_ebl
_xbee_firmware_debug int xbee_fw_install_init ( xbee_dev_t xbee,
const wpan_address_t FAR *  target,
xbee_fw_source_t source 
)

Prepare to install new firmware on an attached XBee module.

The host must be able to control the reset pin of the XBee module.

Parameters
[in]xbeeXBee device to install firmware on. Must have been set up with xbee_dev_init().
[in]targetThe current version of this library can only update the local XBee module, so this parameter should always be NULL. When over-the-air (OTA) updating is supported, this paramter will be the address of a remote module to update.
[in]sourceStructure with function pointers for seeking and reading from the new firmware image.
1 // Function prototypes for functions that will provide firmware
2 // bytes when called by xbee_fw_install_tick().
3 int my_firmware_seek( uint32_t offset);
4 int my_firmware_read( void FAR *buffer, int16_t bytes);
5 
6 xbee_fw_source_t fw;
7 xbee_dev_t xbee;
8 
9 fw.seek = &my_firmware_seek;
10 fw.read = &my_firmware_read;
11 
12 xbee_dev_init( &xbee, ...);
13 xbee_fw_install_init( &xbee, &fw);
    @retval 0                       success
    @retval -EINVAL NULL parameter passed to function
    @retval -EIO            XBee device passed to function doesn't have a
                                                            callback for controlling the reset pin on the XBee
                                                            module.
_xbee_firmware_debug int xbee_fw_install_oem_tick ( xbee_fw_source_t source)

Install the firmware image stored in source.

You must call xbee_fw_install_init() on the source before calling this tick function.

If successful, XBee will be running the new firmware at 115,200 baud.

Parameters
[in]sourceFirmware source initialized with seek and read functions.
Return values
1Successfully installed new firmware.
0Firmware installation in progress (incomplete).
-EILSEQfirmware does not contain a valid firmware image.
-EBADMSGFirmware checksum failed, image is bad.
-EIOCouldn't establish communications with XBee module.
-ENOTSUPFirmware is not compatible with this hardware.
_xbee_firmware_debug int xbee_fw_read_byte ( xbee_fw_source_t source)

check return value of source->read here and in _uint16 and _uint32?

_xbee_firmware_debug uint16_t xbee_fw_read_uint16 ( xbee_fw_source_t source)
_xbee_firmware_debug uint32_t xbee_fw_read_uint32 ( xbee_fw_source_t source)
_xbee_firmware_debug char FAR * xbee_fw_status_ebl ( xbee_fw_source_t source,
char FAR *  buffer 
)

Update buffer with the current install status of source. Note that this string will only change if the return value of xbee_fw_install_ebl_state() has changed.

Parameters
[in]sourceState variable to generate status string for.
[out]bufferBuffer (at least 80 bytes) to receive dynamic status string.
Returns
Returns parameter 2 or a pointer to a fixed status string.
See also
xbee_fw_install_ebl_state
_xbee_firmware_debug char FAR * xbee_fw_status_oem ( xbee_fw_source_t source,
char FAR *  buffer 
)

Update buffer with the current install status of source.

Parameters
[in]sourceState variable to generate status string for.
[out]bufferBuffer (at least 80 bytes) to receive dynamic status string.
Returns
Returns parameter 2 or a pointer to a fixed status string.

Variable Documentation

const char FAR* address
uint16_t block_length
uint32_t block_offset
char bootloader_cmd
char buffer[128+5]
uint16_t checksum
void FAR* context
uint32_t cur_offset
uint32_t firmware_length
uint16_t header_len
uint32_t image_len
uint32_t length
uint8_t module_id
int next_state
uint32_t offset
int(* read) (void FAR *context, void FAR *buffer, int16_t bytes)
int(* seek) (void FAR *context, uint32_t offset)
uint8_t software_id
int state
uint32_t timer
int tries
union { ... } u
xbee_dev_t* xbee
xbee_oem_header_t