40 lines
1004 B
C

/**
* @file app_ota.h
* @brief BLE OTA receiver: writes an incoming image into the opposite flash
* bank via a 4KB sector buffer, verifies CRC32 and updates the
* bootloader's bootsetting record, then resets.
*
* Runs in the BLE schedule task context (invoked from app_ble_proto.c).
*/
#ifndef __APP_OTA_H__
#define __APP_OTA_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
/**
* @brief Handle one OTA frame (BLE_FRAME_OTA_BEGIN / OTA_DATA / OTA_END).
* Sends OTA_RSP frames through app_ble_proto_send_frame().
*/
void app_ota_handle_frame(uint8_t type, uint8_t seq, const uint8_t* payload, uint16_t len);
/**
* @brief Abort any on-going OTA session (on BLE disconnect or fatal error).
*/
void app_ota_abort(void);
/**
* @brief Flash base of the bank this firmware is running from
* (CAIIC_APP1_BASE / CAIIC_APP2_BASE), or 0 when unknown.
*/
uint32_t app_ota_current_bank_base(void);
#ifdef __cplusplus
}
#endif
#endif /* __APP_OTA_H__ */