![]() |
WE310F5
39.00.000
|
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.
Firmware Upgrade module APIs provide the feature of updating firmware. There are two locations of firmware, FWS1 and FWS2 (Firmware Set). The running firmware i.e, the current firmware will be present in one of this location. When firmware upgrade happens, the new firmware will be written to the other location. Upon validation, if the user accepts it, that firmware becomes active and from next boot the active firmware runs. If the user rejects the newly loaded firmware, the old firmware becomes active. For the next firmware upgrade user must validate (either accept or reject) the old upgraded firmware, else, firmware upgrade procedure fails. The firmware set contains multiple firmware bundled into one binary, that is given to firmware update module. Each FW has its own file system, and on firmware upgrade procedure the file system is copied from one location the other. For the Firmware upgrade, user must call the APIs in below sequence:
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) (void *user_ctx, 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 195 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 85 of file m2mb_fwup.h.
FWUP Firmware Boot Type enumeration.
This enum defines macros for type of the firmware currently active.
Enumerator | |
---|---|
M2MB_FWUP_FWD_BOOT_TYPE_CURRENT | FirmWare being in Current image location |
M2MB_FWUP_FWD_BOOT_TYPE_TRIAL | FirmWare being in TRIAL image location |
Definition at line 73 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 98 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, |
void * | user_cb_ctx | ||
) |
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 );