PDK API Guide for J721E
Application Interfaces

Introduction

Functions

Board_flashHandle Board_flashOpen (uint32_t deviceId, uint32_t portNum, void *params)
 Opens a flash device for use. More...
 
Board_flash_STATUS Board_flashClose (Board_flashHandle handle)
 Closes the device. More...
 
Board_flash_STATUS Board_flashRead (Board_flashHandle handle, uint32_t offset, uint8_t *buf, uint32_t len, void *params)
 Reads a page from the device. More...
 
Board_flash_STATUS Board_flashWrite (Board_flashHandle handle, uint32_t offset, uint8_t *buf, uint32_t len, void *params)
 Write the data to the device. More...
 
Board_flash_STATUS Board_flashBlkPageToOffset (Board_flashHandle handle, uint32_t *offset, uint32_t block, uint32_t page)
 Convert the block and page number to offset. More...
 
Board_flash_STATUS Board_flashOffsetToBlkPage (Board_flashHandle handle, uint32_t offset, uint32_t *block, uint32_t *page)
 Convert the offset to block and page number. More...
 
Board_flash_STATUS Board_flashOffsetToSectorPage (Board_flashHandle handle, uint32_t offset, uint32_t *sector, uint32_t *page, bool hybridSector_flag)
 Convert the offset to sector and page number. More...
 
Board_flash_STATUS Board_flashEraseBlk (Board_flashHandle handle, uint32_t block_number)
 erase a block on the flash block More...
 

Function Documentation

Board_flashHandle Board_flashOpen ( uint32_t  deviceId,
uint32_t  portNum,
void *  params 
)

Opens a flash device for use.

Parameters
[in]deviceIdFlash device ID to open
[in]portNumPeripheral port number attached to the flash device
[in]paramsconfiguration parameters for the peripheral interface
Return values
NULLor Board_flashHandle.
Remarks
On success a handle is returned in which should be used in all subsequent calls. As of now, the devices are not virtualized and only one open may exist at a time for a particular device.
Board_flash_STATUS Board_flashClose ( Board_flashHandle  handle)

Closes the device.

Parameters
[in]handleHandle to the device as returned in the open call.
Return values
BOARD_FLASH_EOKon Success
Board_flash_STATUS Board_flashRead ( Board_flashHandle  handle,
uint32_t  offset,
uint8_t *  buf,
uint32_t  len,
void *  params 
)

Reads a page from the device.

Parameters
[in]handleFlash device handle from the open
[in]offsetOffset to start the read from
[in]bufPointer to a buffer to read the data into
[in]lenAmount of data to read
[in]paramsPointer to read configuration parameters for QSPI NOR, *params is used to set the Board_flashQspiIoMode
Return values
BOARD_FLASH_EOKon Success
Remarks
The buffer size should be page_size + spare_size The application should not write into the spare area
Board_flash_STATUS Board_flashWrite ( Board_flashHandle  handle,
uint32_t  offset,
uint8_t *  buf,
uint32_t  len,
void *  params 
)

Write the data to the device.

Parameters
[in]handleHandle to the device as returned by open
[in]offsetOffset to start writing the data at.
[in]bufPointer to data to write
[in]lenLength of the data pointed to by buf
[in]paramsPointer to write configuration parameters for QSPI NOR, *params is used to set the Board_flashQspiIoMode
Return values
BOARD_FLASH_EOKon Success
Board_flash_STATUS Board_flashBlkPageToOffset ( Board_flashHandle  handle,
uint32_t *  offset,
uint32_t  block,
uint32_t  page 
)

Convert the block and page number to offset.

Parameters
[in]handleHandle to the device as returned by open
[in]offsetOffset to start writing the data at.
[in]blockBlock number
[in]pagePage number
Return values
BOARD_FLASH_EOKon Success
Board_flash_STATUS Board_flashOffsetToBlkPage ( Board_flashHandle  handle,
uint32_t  offset,
uint32_t *  block,
uint32_t *  page 
)

Convert the offset to block and page number.

Parameters
[in]handleHandle to the device as returned by open
[in]offsetOffset to start writing the data at.
[in]blockPointer to the block number
[in]pagePointer to the Page number
Return values
BOARD_FLASH_EOKon Success
Board_flash_STATUS Board_flashOffsetToSectorPage ( Board_flashHandle  handle,
uint32_t  offset,
uint32_t *  sector,
uint32_t *  page,
bool  hybridSector_flag 
)

Convert the offset to sector and page number.

Parameters
[in]handleHandle to the device as returned by open
[in]offsetOffset to start writing the data at.
[in]sectorPointer to the sector number
[in]pagePointer to the Page number
[in]hybridSector_flagFlag to enable Hybrid Sector Erase
Return values
BOARD_FLASH_EOKon Success
Board_flash_STATUS Board_flashEraseBlk ( Board_flashHandle  handle,
uint32_t  block_number 
)

erase a block on the flash block

Parameters
[in]handleFlash device handle from the open
[in]block_numberBlock ID to erase
Return values
BOARD_FLASH_EOKon Success