![]() |
WL865E4-P
36.07.001
|
This section describes M2MB APIs to perform various firmware upgrade module operations. More...
This section describes M2MB APIs to perform various firmware upgrade module operations.
FWUP module APIs provide the feature of updating firmware. There are two locations of firmware preset. One is Current location and the other is TRIAL location. When firmware upgrade happens the new firmware will be written in TRIAL location. Upon validation, that firmware moves to Current location. While a firmware is being present in TRIAL location, new firmware upgradation can not take place until the firmware present in TRIAL location is either accepted or rejected.
m2mb_fwup_init API should be used to initialize the FWUP module, this will create an internal thread and waits for m2mb_fwup_start API to get called. This API cannot be called when active firmware is running in TRIAL location.
m2mb_fwup_start API should be called when the actual data for FWUP is about to be received.
m2mb_fwup_process_recv_data API is used to send the received data to FWUP. Considering the usual size of firmware, FWUP can only process 2048 bytes at a given time. So, the firmware should be processed as fragments. The type of fragment should be given as the input, M2MB_FWUP_DATA_FRAGMENT should be set as the flag for initial or subsequent fragment. M2MB_FWUP_DATA_FRAGMENT_LAST should be set as the flag for last fragment of firmware. M2MB_FWUP_DATA_FRAGMENT_ERROR should be set as the flag in case of receive failure.
m2mb_fwup_get_active_fwd API can be used to find out the boot type of active firmware.
m2mb_fwup_done API can be used to validate the firmware in TRIAL image location.
typedef enum M2MB_FWUP_DATA_FLAG M2MB_FWUP_DATA_FLAG_T |
FWUP Data event enumeration.
This enum defines macros for DATA event of FWUP data processing. This event signify the type/portion of the data for processing.
typedef enum M2MB_FWUP_FWD_BOOT_TYPE M2MB_FWUP_FWD_BOOT_TYPE_T |
FWUP Firmware Boot Type enumeration.
This enum defines macros for type of the firmware currently active.
typedef enum M2MB_FWUP_STATUS_CODE M2MB_FWUP_STATUS_CODE_T |
FWUP operation status enumeration.
This enum defines macros for FWUP operation status. This status signify the result of various operations on FWUP module.
typedef VOID(* M2MB_FWUP_USER_CB_T) (M2MB_FWUP_STATUS_CODE_T resp_code) |
Firmware Upgrade user call back prototype.
Type definition of the user callback to receive asynchronous events from FWUP module. It is registered with m2mb_fwup_start API, and it will be called by FWUP module thread context internally incase of success or failure.
[in] | resp_code | resp_code provides the response status code of the operation. |
Example
Definition at line 201 of file m2mb_fwup.h.
enum M2MB_FWUP_DATA_FLAG |
FWUP Data event enumeration.
This enum defines macros for DATA event of FWUP data processing. This event signify the type/portion of the data for processing.
Enumerator | |
---|---|
M2MB_FWUP_DATA_FRAGMENT | Part of request body received |
M2MB_FWUP_DATA_FRAGMENT_LAST | Entire request is received |
M2MB_FWUP_DATA_FRAGMENT_ERROR | Error in receiving |
Definition at line 91 of file m2mb_fwup.h.
FWUP Firmware Boot Type enumeration.
This enum defines macros for type of the firmware currently active.
Definition at line 78 of file m2mb_fwup.h.
FWUP operation status enumeration.
This enum defines macros for FWUP operation status. This status signify the result of various operations on FWUP module.
Definition at line 104 of file m2mb_fwup.h.
M2MB_FWUP_STATUS_CODE_T m2mb_fwup_done | ( | UINT32 | accept, |
UINT32 | reboot | ||
) |
FWUP module validate TRIAL image.
This API validates the firmware present in TRIAL image location. If the firmware is accepted, it will be moved to current image location upon reboot.
[in] | accept | 1 - To accept the TRIAL image. 0 - To discard the TRIAL image. |
[in] | reboot | 1 - To reboot after validation. 0 - Not to reboot after validation. |
m2mb_fwup_done(UINT32 accept, UINT32 reboot);
FWUP module active firmware information.
This API provides active firmware descriptor of FWUP module.
[out] | fwd_boot_type | Boot type of active firmware descriptor. |
[out] | valid_fwd | Validity of active firmware descriptor. |
m2mb_fwup_get_active_fwd(UINT32 *fwd_boot_type, UINT32 *valid_fwd);
M2MB_STATUS_T m2mb_fwup_init | ( | UINT32 | flags | ) |
FWUP module initialization.
This API initializes FWUP module. FWUP module can't be initialized of active firmware's boot type is not M2MB_FWUP_FWD_BOOT_TYPE_TRIAL.
[in] | flags | User should pass the flags, this defines the auto-reboot feature. |
m2mb_fwup_init( UINT32 flags );
M2MB_STATUS_T m2mb_fwup_process_recv_data | ( | UINT32 | data_len, |
UINT8 * | data_ptr, | ||
M2MB_FWUP_DATA_FLAG_T | flag | ||
) |
FWUP module process data.
This API sends the data to be processed to FWUP module.
[in] | data_len | Length of the data to be processed by FWUP module. |
[in] | data_ptr | Pointer containing location of the data to be processed by FWUP module. |
[in] | flag | Flag of type M2MB_FWUP_DATA_FLAG_T defining the type/portion of the data to be processed. |
m2mb_fwup_process_recv_data( UINT32 data_len, UINT8 *data_ptr, M2MB_FWUP_DATA_FLAG_T event );
M2MB_STATUS_T m2mb_fwup_start | ( | M2MB_FWUP_USER_CB_T | user_cb | ) |
FWUP module start.
This API starts FWUP module.
[in] | user_cb | User should pass a callback of type M2MB_FWUP_USER_CB_T to receive status of FWUP operations. |
m2mb_fwup_start( M2MB_FWUP_USER_CB_T user_cb );