Digi XBee(R) ANSI C Host Library
Functions | Variables
xbee_ebl_file.c File Reference

Code for decoding headers from Ember firmware images (.EBL files). More...

#include <stdio.h>
#include <time.h>
#include "xbee/byteorder.h"
#include "xbee/ebl_file.h"

Functions

const char * ebl_target_desc (uint8_t plat_info, uint8_t micro_info)
 Returns a description of the platform based on the plat_info and micro_info fields in the em3xx_header_t structure. More...
 
const char * ebl_phy_desc (uint8_t phy_info)
 Returns a description of the PHY based on the phy_info field in the em3xx_header_t structure. More...
 
void ebl_header_dump_em2xx (const em2xx_header_t *ebl, uint16_t flags)
 
void ebl_header_dump_em3xx (const em3xx_header_t *ebl, uint16_t flags)
 
int ebl_header_dump (const void *buffer, uint16_t flags)
 Prints a description of the .EBL file header. More...
 

Variables

const micro_info_t platform_avr []
 
const micro_info_t platform_xap2b []
 
const micro_info_t platform_cortex_m3 []
 
const platform_info_t platform_info []
 Table of tables used to decode plat_info and micro_info fields from .EBL file header. More...
 

Detailed Description

Code for decoding headers from Ember firmware images (.EBL files).

Documented in xbee/ebl_file.h.

Function Documentation

int ebl_header_dump ( const void *  buffer,
uint16_t  flags 
)

Prints a description of the .EBL file header.

Parameters
[in]bufferbuffer with first 128 bytes of .EBL file
[in]flagscombination of the following macros:
  • #EBL_HEADER_DUMP_TARGET_DESC - target description (EM3XX only)
  • #EBL_HEADER_DUMP_PHY_DESC - PHY description (EM3XX only)
  • #EBL_HEADER_DUMP_EMBER_VER - Ember stack version (EM3XX only)
  • #EBL_HEADER_DUMP_TIMESTAMP - build date/timestamp
  • #EBL_HEADER_DUMP_IMAGE_INFO - "image info" string
  • #EBL_HEADER_DUMP_EVERYTHING - information on all possible fields
Return values
-EINVALinvalid parameter passed to function
-EILSEQnot a valid EBL file header
0parsed header and printed info

References be16toh, ebl_file_header_t::common, ebl_file_header_t::ebltag_be, EILSEQ, EINVAL, IMAGE_SIGNATURE_EM250, IMAGE_SIGNATURE_EM260, IMAGE_SIGNATURE_EM350, and ebl_file_header_t::signature_be.

const char* ebl_phy_desc ( uint8_t  phy_info)

Returns a description of the PHY based on the phy_info field in the em3xx_header_t structure.

Parameters
[in]phy_infophy_info field from EM3xx file header
Returns
String describing PHY or, for uknown values, "PHY XX" where XX is phy_info in hex.

References be32toh, ebl_target_desc(), em3xx_header_t::image_info, em2xx_header_t::image_info, le32toh, em3xx_header_t::micro_info, em3xx_header_t::phy_info, em3xx_header_t::plat_info, em2xx_header_t::timestamp_be, em3xx_header_t::timestamp_le, ZCL_TIME_EPOCH_DELTA_1970, em3xx_header_t::znet_build, and em3xx_header_t::znet_release.

const char* ebl_target_desc ( uint8_t  plat_info,
uint8_t  micro_info 
)

Returns a description of the platform based on the plat_info and micro_info fields in the em3xx_header_t structure.

Parameters
[in]plat_infoplat_info field from EM3xx file header
[in]micro_infomicro_info field from EM3xx file header
Returns
String describing platform or, for unknown combinations, "P:XX M:YY" where XX is plat_info in hex and YY is micro_info in hex.

Referenced by ebl_phy_desc().

Variable Documentation

const micro_info_t platform_avr[]
Initial value:
= {
{ 1, "AVR ATMega 64" },
{ 2, "AVR ATMega 128" },
{ 3, "AVR ATMega 32" },
MICRO_INFO_END
}
const micro_info_t platform_cortex_m3[]
Initial value:
= {
{ 1, "EM350" },
{ 2, "EM360" },
{ 3, "EM357" },
{ 4, "EM367" },
{ 5, "EM351" },
{ 6, "EM35x" },
{ 7, "STM32W108" },
MICRO_INFO_END
}
const platform_info_t platform_info[]
Initial value:
= {
{ 1, platform_avr },
{ 2, platform_xap2b },
{ 4, platform_cortex_m3 },
PLATFORM_INFO_END
}

Table of tables used to decode plat_info and micro_info fields from .EBL file header.

See ebl_target_desc()

const micro_info_t platform_xap2b[]
Initial value:
= {
{ 1, "EM250" },
{ 2, "EM260" },
MICRO_INFO_END
}