Fork for workshops

Embed: (wiki syntax)

« Back to documentation index

pal_plat_update.h File Reference

pal_plat_update.h File Reference

PAL update - platform. This file contains the firmware update APIs that need to be implemented in the platform layer. More...

Go to the source code of this file.

Functions

palStatus_t pal_plat_imageInitAPI (palImageSignalEvent_t CBfunction)
palStatus_t pal_plat_imageDeInit (void)
palStatus_t pal_plat_imageGetMaxNumberOfImages (uint8_t *imageNumber)
palStatus_t pal_plat_imageReserveSpace (palImageId_t imageId, size_t imageSize)
palStatus_t pal_plat_imageSetHeader (palImageId_t imageId, palImageHeaderDeails_t *details)
palStatus_t pal_plat_imageWrite (palImageId_t imageId, size_t offset, palConstBuffer_t *chunk)
palStatus_t pal_plat_imageSetVersion (palImageId_t imageId, const palConstBuffer_t *version)
palStatus_t pal_plat_imageFlush (palImageId_t imageId)
palStatus_t pal_plat_imageGetDirectMemAccess (palImageId_t imageId, void **imagePtr, size_t *imageSizeInBytes)
palStatus_t pal_plat_imageReadToBuffer (palImageId_t imageId, size_t offset, palBuffer_t *chunk)
palStatus_t pal_plat_imageActivate (palImageId_t imageId)
palStatus_t pal_plat_imageGetActiveHash (palBuffer_t *hash)
palStatus_t pal_plat_imageGetActiveVersion (palBuffer_t *version)
palStatus_t pal_plat_imageWriteHashToMemory (const palConstBuffer_t *const hashValue)

Detailed Description

PAL update - platform. This file contains the firmware update APIs that need to be implemented in the platform layer.

Definition in file pal_plat_update.h.


Function Documentation

palStatus_t pal_plat_imageActivate ( palImageId_t  imageId )

Set the `imageId` to be the active image (after device reset).

Parameters:
[in]imageIdThe image ID.

Definition at line 95 of file FreeRTOS/Update/pal_plat_update.c.

palStatus_t pal_plat_imageDeInit ( void   )

Clear all the resources used by the `pal_update` APIs.

Returns:
PAL_SUCCESS(0) in case of success. A negative value indicating a specific error code in case of failure.

Definition at line 73 of file FreeRTOS/Update/pal_plat_update.c.

palStatus_t pal_plat_imageFlush ( palImageId_t  imageId )

Flush the entire image data after writing ends for `imageId`.

Parameters:
[in]imageIdThe image ID.
Returns:
PAL_SUCCESS(0) in case of success. A negative value indicating a specific error code in case of failure.

Definition at line 274 of file FreeRTOS/Update/pal_plat_update.c.

palStatus_t pal_plat_imageGetActiveHash ( palBuffer_t *  hash )

Retrieve the hash value of the active image to the hash buffer with the max size hash `maxBufferLength` and set the hash `bufferLength` to the hash size.

Parameters:
[out]hashThe hash and actual size of hash read.

Definition at line 101 of file FreeRTOS/Update/pal_plat_update.c.

palStatus_t pal_plat_imageGetActiveVersion ( palBuffer_t *  version )

Retrieve the version of the active image to the version buffer with the size set to version `bufferLength`.

Parameters:
[out]versionThe version and actual size of version read.

Definition at line 108 of file FreeRTOS/Update/pal_plat_update.c.

palStatus_t pal_plat_imageGetDirectMemAccess ( palImageId_t  imageId,
void **  imagePtr,
size_t *  imageSizeInBytes 
)

Verify whether the `imageId` is readable and set `imagePtr` to point to the beginning of the image in the memory and `imageSizeInBytes` to the image size.

Parameters:
[in]imageIdThe image ID.
[out]imagePtrA pointer to the start of the image.
[out]imageSizeInBytesThe size of the image.
Returns:
PAL_SUCCESS(0) in case of success. A negative value indicating a specific error code in case of failure and sets `imagePtr` to NULL.

Definition at line 90 of file FreeRTOS/Update/pal_plat_update.c.

palStatus_t pal_plat_imageGetMaxNumberOfImages ( uint8_t *  imageNumber )

Set the `imageNumber` to the number of available images. You can do this through the hard coded define inside the linker script.

Parameters:
[out]imageNumberThe total number of images the system supports.
Returns:
PAL_SUCCESS(0) in case of success. A negative value indicating a specific error code in case of failure.

Definition at line 80 of file FreeRTOS/Update/pal_plat_update.c.

palStatus_t pal_plat_imageInitAPI ( palImageSignalEvent_t  CBfunction )

Set the callback function that is called before the end of each API (except `imageGetDirectMemAccess`).

Parameters:
[in]CBfunctionA pointer to the callback function.
Returns:
PAL_SUCCESS(0) in case of success. A negative value indicating a specific error code in case of failure.

Definition at line 61 of file FreeRTOS/Update/pal_plat_update.c.

palStatus_t pal_plat_imageReadToBuffer ( palImageId_t  imageId,
size_t  offset,
palBuffer_t *  chunk 
)

Read the max of chunk `maxBufferLength` bytes from the `imageId` with relative offset and store it in chunk buffer.
Set the chunk `bufferLength` value to the actual number of bytes read.

Note:
Please use this API in case the image is not directly accessible via the `imageGetDirectMemAccess` function.
Parameters:
[in]imageIdThe image ID.
[in]offsetThe offset to start reading from.
[out]chunkThe data and actual bytes read.

Definition at line 250 of file FreeRTOS/Update/pal_plat_update.c.

palStatus_t pal_plat_imageReserveSpace ( palImageId_t  imageId,
size_t  imageSize 
)

Claim space in the relevant storage region for `imageId` with the size of the image.

Parameters:
[in]imageIdThe image ID.
[in]imageSizeThe size of the images.
Returns:
PAL_SUCCESS(0) in case of success. A negative value indicating a specific error code in case of failure.

Definition at line 150 of file FreeRTOS/Update/pal_plat_update.c.

palStatus_t pal_plat_imageSetHeader ( palImageId_t  imageId,
palImageHeaderDeails_t *  details 
)

Set up the details for the image header. The data is written when the image write is called for the first time.

Parameters:
[in]imageIdThe image ID.
[in]detailsThe data needed to build the image header.
Returns:
PAL_SUCCESS(0) in case of success. A negative value indicating a specific error code in case of failure.

Definition at line 127 of file FreeRTOS/Update/pal_plat_update.c.

palStatus_t pal_plat_imageSetVersion ( palImageId_t  imageId,
const palConstBuffer_t *  version 
)

Update the image version of `imageId` to the version written in version buffer with version `bufferLength`.

Parameters:
[in]imageIdThe image ID.
[in]versionThe image version and its length.
Returns:
PAL_SUCCESS(0) in case of success. A negative value indicating a specific error code in case of failure.

Definition at line 85 of file FreeRTOS/Update/pal_plat_update.c.

palStatus_t pal_plat_imageWrite ( palImageId_t  imageId,
size_t  offset,
palConstBuffer_t *  chunk 
)

Write the data in the chunk buffer with the size written in chunk `bufferLength` in the location of `imageId` adding the relative offset.

Parameters:
[in]imageIdThe image ID.
[in]offsetThe relative offset to write the data into.
[in]chunkA pointer to the struct containing the data and the data length to write.
Returns:
PAL_SUCCESS(0) in case of success. A negative value indicating a specific error code in case of failure.

Definition at line 191 of file FreeRTOS/Update/pal_plat_update.c.

palStatus_t pal_plat_imageWriteHashToMemory ( const palConstBuffer_t *const   hashValue )

Write the `dataId` stored in `dataBuffer` to the memory accessible to the bootloader. Currently, only HASH is available.

Parameters:
[in]hashValueThe data and size of the HASH.

Definition at line 114 of file FreeRTOS/Update/pal_plat_update.c.