File lt_ota.c
Go to the source code of this file.
#include "lt_ota.h"
#include <uf2ota/uf2ota.h>
Public Functions
Type | Name |
---|---|
__attribute__ ((weak)) |
|
void | lt_ota_begin (lt_ota_ctx_t * ctx, size_t size) Initialize the update context to begin OTA process. |
bool | lt_ota_can_rollback () Check if OTA rollback is possible (switching the stored index to another partition). |
bool | lt_ota_end (lt_ota_ctx_t * ctx) Finish the update process. If the update has been written completely, try to activate the target image. Free allocated internal structures, regardless of the activation result. |
uf2_ota_scheme_t | lt_ota_get_uf2_scheme () Check which UF2 OTA scheme should be used for applying firmware updates. |
size_t | lt_ota_write (lt_ota_ctx_t * ctx, const uint8_t * data, size_t len) Process a chunk of data. |
bool | lt_ota_write_block (lt_ota_ctx_t * ctx, uf2_block_t * block) Try to write the block. In case of UF2 errors, error code is set in the context. Note: use lt_ota_write() instead. This is for internal usage only. |
Public Static Functions
Type | Name |
---|---|
size_t | lt_ota_buf_left (lt_ota_ctx_t * ctx) |
size_t | lt_ota_buf_size (lt_ota_ctx_t * ctx) |
Public Functions Documentation
function __attribute__
function lt_ota_begin
Initialize the update context to begin OTA process.
Parameters:
ctx
OTA contextsize
length of the update file; 0 if unknown
function lt_ota_can_rollback
Check if OTA rollback is possible (switching the stored index to another partition).
Note that this is not the same as "switching" OTA with revert=true.
Returns:
true if 2nd image is valid and the chip is dual-OTA; false otherwise
function lt_ota_end
Finish the update process. If the update has been written completely, try to activate the target image. Free allocated internal structures, regardless of the activation result.
Parameters:
ctx
OTA context
Returns:
false if activation was attempted and not successful; true otherwise
function lt_ota_get_uf2_scheme
Check which UF2 OTA scheme should be used for applying firmware updates.
Returns:
OTA scheme of the target partition
function lt_ota_write
Process a chunk of data.
Data is written to the buffer, unless a full UF2 block is already available, in which case it's also processed by UF2OTA and written to flash.
It's advised to write in 512-byte chunks (or its multiples).
Parameters:
ctx
OTA contextdata
chunk of bytes to processlen
size of the chunk
Returns:
number of bytes correctly processed; should equal 'len' in case of no errors
function lt_ota_write_block
Try to write the block. In case of UF2 errors, error code is set in the context. Note: use lt_ota_write() instead. This is for internal usage only.
Parameters:
block
UF2 block to check and write; cannot be NULL
Returns:
whether no error has occurred
Public Static Functions Documentation
function lt_ota_buf_left
function lt_ota_buf_size
The documentation for this class was generated from the following file cores/common/base/api/lt_ota.c