Application Parser InterfaceApplication Interface
Description
Application interface for the bootloader image parser.
The Parser Interface can be used to parse upgrade images from the context of the application.
Data Structures |
|
| struct | BootloaderParserCallbacks_t |
|
Function pointers to parser callbacks.
|
|
Typedefs |
|
| typedef void(* | BootloaderParserCallback_t ) (uint32_t address, uint8_t *data, size_t length, void *context) |
| typedef struct BootloaderParserContext | BootloaderParserContext_t |
|
Context for the bootloader image parser routine.
|
|
Functions |
|
| int32_t | bootloader_initParser ( BootloaderParserContext_t *context, size_t contextSize) |
| int32_t | bootloader_parseBuffer ( BootloaderParserContext_t *context, BootloaderParserCallbacks_t *callbacks, uint8_t data[], size_t numBytes) |
| int32_t | bootloader_parseImageInfo ( BootloaderParserContext_t *context, uint8_t data[], size_t numBytes, ApplicationData_t *appInfo, uint32_t *bootloaderVersion) |
| uint32_t | bootloader_parserContextSize (void) |
Typedef Documentation
| typedef void(* BootloaderParserCallback_t) (uint32_t address, uint8_t *data, size_t length, void *context) |
Bootloader parser callback
- Parameters
-
addressAddress of the data dataRaw data lengthSize in bytes of raw data. contextA context variable defined by the implementation that is implementing this callback.
Definition at line
48
of file
btl_interface_parser.h
.
Function Documentation
| int32_t bootloader_initParser | ( | BootloaderParserContext_t * |
context,
|
| size_t |
contextSize
|
||
| ) |
Initialize the image parser.
- Parameters
-
[in] contextPointer to the parser context struct. [in] contextSizeSize of the context struct.
- Returns
- BOOTLOADER_OK if success, BOOTLOADER_ERROR_PARSE_CONTEXT if context struct is too small.
| int32_t bootloader_parseBuffer | ( | BootloaderParserContext_t * |
context,
|
| BootloaderParserCallbacks_t * |
callbacks,
|
||
| uint8_t |
data[],
|
||
| size_t |
numBytes
|
||
| ) |
Parse a buffer.
- Parameters
-
[in] contextPointer to the parser context struct. [in] callbacksCallbacks to be called by the parser. [in] dataData to be parsed. [in] numBytesSize of the data buffer.
- Returns
- BOOTLOADER_ERROR_PARSE_CONTINUE if the chunk was parsed correctly, and a new chunk is expected. BOOTLOADER_ERROR_PARSE_ERROR if something went wrong while parsing. BOOTLOADER_ERROR_PARSE_SUCCESS if the entire file was successfully parsed.
| int32_t bootloader_parseImageInfo | ( | BootloaderParserContext_t * |
context,
|
| uint8_t |
data[],
|
||
| size_t |
numBytes,
|
||
| ApplicationData_t * |
appInfo,
|
||
| uint32_t * |
bootloaderVersion
|
||
| ) |
Parse a buffer and get application and bootloader upgrade metadata from the buffer.
- Note
-
appInfoandbootloaderVersionwill default to zeros.
- Parameters
-
[in] contextPointer to the parser context struct. [in] dataData to be parsed. [in] numBytesSize of the data buffer. [out] appInfoPointer to ApplicationData_t struct. [out] bootloaderVersionPointer to an integer representing bootloader version.
- Returns
- BOOTLOADER_OK if metadata was filled successfully.
| uint32_t bootloader_parserContextSize | ( | void |
|
) |
Find the size of the context struct BootloaderParserContext used by the bootloader image parser to store parser state.
- Returns
- size of BootloaderParserContext , returns 0 if something went wrong.