Mistake on this page? Email us
pal_internalFlash.h File Reference

Go to the source code of this file.

Macros

#define PAL_INT_FLASH_BLANK_VAL   0xFF
 

Functions

palStatus_t pal_internalFlashInit (void)
 This function initializes the flash API module, and must be called prior to any flash API calls. More...
 
palStatus_t pal_internalFlashDeInit (void)
 This function deinitializes the flash API module. More...
 
palStatus_t pal_internalFlashWrite (const size_t size, const uint32_t address, const uint32_t *buffer)
 This function writes to the internal flash. More...
 
palStatus_t pal_internalFlashRead (const size_t size, const uint32_t address, uint32_t *buffer)
 This function copies the memory data into the user-given buffer. More...
 
palStatus_t pal_internalFlashErase (uint32_t address, size_t size)
 This function Erase the sector. More...
 
size_t pal_internalFlashGetPageSize (void)
 This function returns the minimum writing unit to the flash. More...
 
size_t pal_internalFlashGetSectorSize (uint32_t address)
 This function returns the sector size for the given address. More...
 
palStatus_t pal_internalFlashGetAreaInfo (uint8_t section, palSotpAreaData_t *data)
 This function return the SOTP section data. More...
 

Macro Definition Documentation

#define PAL_INT_FLASH_BLANK_VAL   0xFF

Function Documentation

palStatus_t pal_internalFlashDeInit ( void  )

This function deinitializes the flash API module.

Returns
PAL_SUCCESS upon successful operation.
PAL_ERR_INTERNAL_FLASH_ERROR - see error code palError_t.
Note
Should be called only after pal_internalFlashInit() is called.
Flash APIs will not work after calling this function.
This function is blocking till completion.
palStatus_t pal_internalFlashErase ( uint32_t  address,
size_t  size 
)

This function Erase the sector.

Parameters
[in]size- the size to be erased
[in]address- sector start address to be erased, must be align to sector.
Returns
PAL_SUCCESS upon successful operation.
PAL_ERR_INTERNAL_FLASH_ERROR - see error code palError_t.
Note
Any sector can be erased. There is no protection given to bootloader, program or other component.
This function is blocking till completion.
Only one sector can be erased in each function call.
This function is thread safe.
palStatus_t pal_internalFlashGetAreaInfo ( uint8_t  section,
palSotpAreaData_t data 
)

This function return the SOTP section data.

Parameters
[in]section- the section number (either 0 or 1)
[out]data- the information about the section
Returns
PAL_SUCCESS upon successful operation.
PAL_ERR_INTERNAL_FLASH_ERROR - see error code palError_t.
size_t pal_internalFlashGetPageSize ( void  )

This function returns the minimum writing unit to the flash.

Returns
size_t the 2, 4, 8....
size_t pal_internalFlashGetSectorSize ( uint32_t  address)

This function returns the sector size for the given address.

Parameters
[in]address- the starting address of the sector in question
Returns
size of the sector, or 0 in case of an error.
palStatus_t pal_internalFlashInit ( void  )

This function initializes the flash API module, and must be called prior to any flash API calls.

Returns
PAL_SUCCESS upon successful operation.
PAL_FILE_SYSTEM_ERROR - see error code palError_t.
Note
Should be called only once unless pal_internalFlashDeInit function is called.
This function is blocking till completion.
palStatus_t pal_internalFlashRead ( const size_t  size,
const uint32_t  address,
uint32_t *  buffer 
)

This function copies the memory data into the user-given buffer.

Parameters
[in]size- the size of the buffer in bytes.
[in]address- the address of the internal flash.
[out]buffer- pointer to the buffer to write to
Returns
PAL_SUCCESS upon successful operation.
PAL_ERR_INTERNAL_FLASH_ERROR - see error code palError_t.
Note
This function is blocking till completion.
This function is thread safe.
palStatus_t pal_internalFlashWrite ( const size_t  size,
const uint32_t  address,
const uint32_t *  buffer 
)

This function writes to the internal flash.

Parameters
[in]buffer- pointer to the buffer to be written
[in]size- the size of the buffer in bytes.
[in]address- the address of the internal flash. Must be aligned to minimum writing unit (page size).
Returns
PAL_SUCCESS upon successful operation.
PAL_ERR_INTERNAL_FLASH_ERROR - see error code palError_t.
Note
Every address can be written to, including boot loader, program and other components.
This function is blocking till completion.
This function is thread safe.