AM261x MCU+ SDK: FOTAAgent_BufferManager.h File Reference

| AM261x MCU+ SDK 26.00.00 |

Macros | Functions
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

  fotaAgentHandle | pointer 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

  fotaAgentHandle | pointer to fotaAgent handle.
  newData | new data.
  flashOffset | offset 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

  fotaAgentHandle | pointer 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

  fotaAgentHandle | pointer to fotaAgent handle.
  address | SOC address space of new data
  newData | new data byte

Returns
  SystemP_FAILURE
  SystemP_SUCCESS