FLASHAPI (AM13E232X)

Flash API for AM13E232X device. More…

Structures

Name

struct

FLASHAPI_EraseProgramParams
Flash API initialisation parameters.

Functions

Name

uint32_t

FLASHAPI_eraseProgramParamsSetDefault(FLASHAPI_EraseProgramParams * paramsPtr)
Initialises the FLASHAPI_EraseProgramParams structure to default values.

uint32_t

FLASHAPI_eraseBank(uint32_t flashAddr, const FLASHAPI_EraseProgramParams * paramsPtr)
Performs bank erase of the given bank address.

uint32_t

FLASHAPI_eraseSector(uint32_t flashAddr, const FLASHAPI_EraseProgramParams * paramsPtr)
Performs sector erase of the given sector address.

uint32_t

FLASHAPI_program(uint32_t flashAddr, uint8_t * buffer, uint32_t sizeInBytes, const FLASHAPI_EraseProgramParams * paramsPtr)
Programs the given buffer at the supplied address with automatic ECC generation.

Defines

Name

FLASHAPI_BANK_SIZE
Size of Flash Bank in bytes.

FLASHAPI_SECTOR_SIZE
Size of Flash Sector in bytes.

FLASHAPI_NONMAIN_BANK_SIZE
Size of Non-Main Flash Bank in bytes.

FLASHAPI_SUCCESS
The Flash API operation completed successfully.

FLASHAPI_ADDR_INVALID_ALIGN
The Flash address is not 128-bit aligned.

FLASHAPI_ADDR_INVALID_SECTOR
The Flash address is not sector aligned.

FLASHAPI_ADDR_INVALID_BANK
The Flash address is not bank aligned.

FLASHAPI_COMMAND_FAIL_PROGRAM
Failure in execution of Flash Program command.

FLASHAPI_COMMAND_FAIL_ERASE
Failure in execution of Flash Erase command.

FLASHAPI_COMMAND_FAIL_READ_VERIFY
Failure in execution of Flash Read Verify command.

FLASHAPI_COMMAND_FAIL_BLANK_VERIFY
Failure in execution of Blank Verify command.

FLASHAPI_INVALID_BUFFER
The programming buffer is a NULL pointer.

FLASHAPI_INVALID_NUMBYTES
The number of bytes to be programmed is either zero or exceeds bank boundaries.

FLASHAPI_INVALID_PARAMS
The params pointer is a NULL pointer.

FLASHAPI_ADDR_INVALID
The Flash address is not in Flash memory region.

FLASHAPI_ADDR_NONMAIN
The Flash address is in non main Flash memory region.

FLASHAPI_SEM_ACQ_FAIL
The acquire flash semaphore failed.

FLASHAPI_SEM_REL_FAIL
The release flash semaphore failed.

Detailed Description

Flash API for AM13E232X device.

The module gives APIs to erase and program flash banks and sectors in the AM13E232X Non-Volatile memory system.

Recommend users to use this API vs the low-level DL_FlashCTL driver

Functions Documentation

function FLASHAPI_eraseProgramParamsSetDefault

uint32_t FLASHAPI_eraseProgramParamsSetDefault(
    FLASHAPI_EraseProgramParams * paramsPtr
)

Initialises the FLASHAPI_EraseProgramParams structure to default values.

Parameters:

  • paramsPtr Pointer to the flash initialisation parameters structure

Return: uint32_t indicating the operation status:

  • FLASHAPI_SUCCESS: Parameters initialised successfully

  • FLASHAPI_INVALID_PARAMS: paramsPtr is NULL

function FLASHAPI_eraseBank

uint32_t FLASHAPI_eraseBank(
    uint32_t flashAddr,
    const FLASHAPI_EraseProgramParams * paramsPtr
)

Performs bank erase of the given bank address.

Parameters:

  • flashAddr The flash bank memory address (must be bank-aligned)

  • paramsPtr Pointer to initialisation parameters

Return: uint32_t indicating the operation status:

  • FLASHAPI_SUCCESS: Operation completed successfully

  • FLASHAPI_ADDR_INVALID: Address is not in Flash

  • FLASHAPI_ADDR_INVALID_BANK: Address is not bank-aligned

  • FLASHAPI_COMMAND_FAIL_ERASE: Erase command failed

  • FLASHAPI_COMMAND_FAIL_BLANK_VERIFY: Blank verify failed after erase (only when doVerify != 0)

Note: The FRI cache is automatically flushed after operation

function FLASHAPI_eraseSector

uint32_t FLASHAPI_eraseSector(
    uint32_t flashAddr,
    const FLASHAPI_EraseProgramParams * paramsPtr
)

Performs sector erase of the given sector address.

Parameters:

  • flashAddr The flash sector memory address (must be sector-aligned)

  • paramsPtr Pointer to initialisation parameters

Return: uint32_t indicating the operation status:

  • FLASHAPI_SUCCESS: Operation completed successfully

  • FLASHAPI_ADDR_INVALID: Address is not in Flash

  • FLASHAPI_ADDR_INVALID_SECTOR: Address is not sector-aligned

  • FLASHAPI_COMMAND_FAIL_ERASE: Erase command failed

  • FLASHAPI_COMMAND_FAIL_BLANK_VERIFY: Blank verify failed after erase (only when doVerify != 0)

Note: The FRI cache is automatically flushed after operation

function FLASHAPI_program

uint32_t FLASHAPI_program(
    uint32_t flashAddr,
    uint8_t * buffer,
    uint32_t sizeInBytes,
    const FLASHAPI_EraseProgramParams * paramsPtr
)

Programs the given buffer at the supplied address with automatic ECC generation.

Parameters:

  • flashAddr The starting flash address for the program operation (must be 8-byte aligned)

  • buffer Pointer to the data buffer to be programmed

  • sizeInBytes The number of bytes to be programmed

  • paramsPtr Pointer to initialisation parameters

Return: uint32_t indicating the operation status:

  • FLASHAPI_SUCCESS: Operation completed successfully

  • FLASHAPI_ADDR_INVALID: Address is not in Flash

  • FLASHAPI_ADDR_INVALID_ALIGN: Address is not 8-byte aligned

  • FLASHAPI_INVALID_BUFFER: Buffer pointer is NULL

  • FLASHAPI_INVALID_NUMBYTES: Invalid byte count (zero or exceeds bank boundary)

  • FLASHAPI_COMMAND_FAIL_PROGRAM: Program command failed

  • FLASHAPI_COMMAND_FAIL_READ_VERIFY: Read verify command failed (only when doVerify != 0)

Note:

  • The address must be 8-byte aligned for ECC generation

  • Data less than 8 bytes will be padded with 0xFF to complete the 8-byte write

  • The FRI cache is automatically disabled before programming and re-enabled afterwards

Macros Documentation

define FLASHAPI_BANK_SIZE

#define FLASHAPI_BANK_SIZE (0x40000U)

Size of Flash Bank in bytes.

define FLASHAPI_SECTOR_SIZE

#define FLASHAPI_SECTOR_SIZE (0x800U)

Size of Flash Sector in bytes.

define FLASHAPI_NONMAIN_BANK_SIZE

#define FLASHAPI_NONMAIN_BANK_SIZE (0x1000U)

Size of Non-Main Flash Bank in bytes.

define FLASHAPI_SUCCESS

#define FLASHAPI_SUCCESS (0x0U)

The Flash API operation completed successfully.

define FLASHAPI_ADDR_INVALID_ALIGN

#define FLASHAPI_ADDR_INVALID_ALIGN (0x1U)

The Flash address is not 128-bit aligned.

define FLASHAPI_ADDR_INVALID_SECTOR

#define FLASHAPI_ADDR_INVALID_SECTOR (0x2U)

The Flash address is not sector aligned.

define FLASHAPI_ADDR_INVALID_BANK

#define FLASHAPI_ADDR_INVALID_BANK (0x3U)

The Flash address is not bank aligned.

define FLASHAPI_COMMAND_FAIL_PROGRAM

#define FLASHAPI_COMMAND_FAIL_PROGRAM (0x4U)

Failure in execution of Flash Program command.

define FLASHAPI_COMMAND_FAIL_ERASE

#define FLASHAPI_COMMAND_FAIL_ERASE (0x5U)

Failure in execution of Flash Erase command.

define FLASHAPI_COMMAND_FAIL_READ_VERIFY

#define FLASHAPI_COMMAND_FAIL_READ_VERIFY (0x6U)

Failure in execution of Flash Read Verify command.

define FLASHAPI_COMMAND_FAIL_BLANK_VERIFY

#define FLASHAPI_COMMAND_FAIL_BLANK_VERIFY (0x7U)

Failure in execution of Blank Verify command.

define FLASHAPI_INVALID_BUFFER

#define FLASHAPI_INVALID_BUFFER (0x8U)

The programming buffer is a NULL pointer.

define FLASHAPI_INVALID_NUMBYTES

#define FLASHAPI_INVALID_NUMBYTES (0x9U)

The number of bytes to be programmed is either zero or exceeds bank boundaries.

define FLASHAPI_INVALID_PARAMS

#define FLASHAPI_INVALID_PARAMS (0xEU)

The params pointer is a NULL pointer.

define FLASHAPI_ADDR_INVALID

#define FLASHAPI_ADDR_INVALID (0xAU)

The Flash address is not in Flash memory region.

define FLASHAPI_ADDR_NONMAIN

#define FLASHAPI_ADDR_NONMAIN (0xBU)

The Flash address is in non main Flash memory region.

define FLASHAPI_SEM_ACQ_FAIL

#define FLASHAPI_SEM_ACQ_FAIL (0xCU)

The acquire flash semaphore failed.

define FLASHAPI_SEM_REL_FAIL

#define FLASHAPI_SEM_REL_FAIL (0xDU)

The release flash semaphore failed.