AM261x MCU+ SDK  10.02.00
FOTAAgent_BufferManager.h File Reference

Go to the source code of this file.

Macros

#define FotaAgentP_BufferManager_BUFFERFULL   ((int32_t)-3)
 
#define FotaAgentP_BufferManager_ADDRESS_DISCONT   ((int32_t)-4)
 
#define FotaAgentP_BufferManager_ADDRESS_UNALIGNED   ((int32_t)-5)
 

Functions

int32_t FOTAAgent_BufferManager_init (FOTAAgent_Handle *fotaAgentHandle)
 Initilize buffer manager state machine. More...
 
int32_t FOTAAgent_BufferManager_update (FOTAAgent_Handle *fotaAgentHandle, uint8_t newData, uint32_t flashOffset)
 Update internal buffer with new data. More...
 
int32_t FOTAAgent_BufferManager_calculateFlushAddress (FOTAAgent_Handle *fotaAgentHandle, uint32_t *addr)
 Calculate Address at which internal buffer to be flushed at.abort. More...
 
int32_t FOTAAgent_BufferManager_flush (FOTAAgent_Handle *fotaAgentHandle)
 Flush internal buffer to flash. More...
 
int32_t FOTAAgent_BufferManager_checkAddressDiscontinuity (FOTAAgent_Handle *fotaAgentHandle, uint32_t address, uint8_t newData)
 Check if the new data's address is discontinuous or not. More...
 

Macro Definition Documentation

◆ FotaAgentP_BufferManager_BUFFERFULL

#define FotaAgentP_BufferManager_BUFFERFULL   ((int32_t)-3)

◆ FotaAgentP_BufferManager_ADDRESS_DISCONT

#define FotaAgentP_BufferManager_ADDRESS_DISCONT   ((int32_t)-4)

◆ FotaAgentP_BufferManager_ADDRESS_UNALIGNED

#define FotaAgentP_BufferManager_ADDRESS_UNALIGNED   ((int32_t)-5)

Function Documentation

◆ FOTAAgent_BufferManager_init()

int32_t FOTAAgent_BufferManager_init ( FOTAAgent_Handle fotaAgentHandle)

Initilize buffer manager state machine.

The role of this function is to init all the initial varaibles with some default varaibles and also the state machine to its initial state, if any.

Parameters
fotaAgentHandlepointer to fotaAgent handle
Returns
SystemP_FAILURE
SystemP_SUCCESS

◆ FOTAAgent_BufferManager_update()

int32_t FOTAAgent_BufferManager_update ( FOTAAgent_Handle fotaAgentHandle,
uint8_t  newData,
uint32_t  flashOffset 
)

Update internal buffer with new data.

Udpate the internal buffer with new information. At any point of time, after calling this function with newData and flashOffset, this API will have the following information:

  1. size of internal buffer filled
  2. last address at which data is supposed to be written

In case, internal buffer is 4K, then, when internal buffer is full, at that time, this API will have data to be written and the address where it is be written.

Parameters
fotaAgentHandlepointer to fotaAgent handle.
newDatanew data.
flashOffsetoffset in flash at which it is supposed to be written.
Returns
SystemP_FAILURE
SystemP_SUCCESS

◆ FOTAAgent_BufferManager_calculateFlushAddress()

int32_t FOTAAgent_BufferManager_calculateFlushAddress ( FOTAAgent_Handle fotaAgentHandle,
uint32_t *  addr 
)

Calculate Address at which internal buffer to be flushed at.abort.

Before flush function is called, this function is called internally, to calculate the address at which internal buffer is to be flushed.

This address is that this function calculate aligns with erase size.

Parameters
fotaAgentHandle
addr
Returns
int32_t

◆ FOTAAgent_BufferManager_flush()

int32_t FOTAAgent_BufferManager_flush ( FOTAAgent_Handle fotaAgentHandle)

Flush internal buffer to flash.

When this function is called, doesn't matter if the internal buffer is full or not, it will calculate the address aligned to erase size and write the interal buffer.

Parameters
fotaAgentHandlepointer to fotaAgent handle.
Returns
SystemP_FAILURE
SystemP_SUCCESS

◆ FOTAAgent_BufferManager_checkAddressDiscontinuity()

int32_t FOTAAgent_BufferManager_checkAddressDiscontinuity ( FOTAAgent_Handle fotaAgentHandle,
uint32_t  address,
uint8_t  newData 
)

Check if the new data's address is discontinuous or not.

essentially this function returns (last_address - address) == sizeof(uint8_t).

Parameters
fotaAgentHandlepointer to fotaAgent handle.
addressSOC address space of new data
newDatanew data byte
Returns
SystemP_FAILURE
SystemP_SUCCESS