| 
    PAN1080 Peripheral API
    
   | 
 
Fmc Interface. More...

Modules | |
| Fmc erase command | |
| Fmc erase command definition.  | |
| Fmc status reg w/r command | |
| Fmc status register write and read command definition.  | |
| Fmc status reg operation command | |
| Fmc status register operation command definition.  | |
| Fmc read command | |
| Fmc read command definition.  | |
| Fmc burst read command | |
| Fmc burst read command definition.  | |
| Fmc work type select | |
| Fmc work type select definition.  | |
Data Structures | |
| struct | _flash_ids | 
| Structure with flash id.  More... | |
Macros | |
| #define | CMD_TRIG (0x01) | 
| #define | CMD_WRITE_ENABLE (0x06) | 
| #define | QUAD_ENABLE_Pos (9) | 
| #define | QUAD_ENABLE_Msk (0x1ul << QUAD_ENABLE_Pos) | 
| #define | Write_Enable_Latch_Pos (1) | 
| #define | Write_Enable_Latch_Msk (0x1ul << Write_Enable_Latch_Pos) | 
| #define | Write_In_Process_Pos (0) | 
| #define | Write_In_Process_Msk (0x1ul << Write_In_Process_Pos) | 
| #define | Long_Time_Op_Pos (17) | 
| #define | PAGE_SIZE (256) | 
| #define | SECTOR_SIZE (4096) | 
Typedefs | |
| typedef struct _flash_ids | FLASH_IDS_T | 
| Structure with flash id.  More... | |
Functions | |
| __STATIC_FORCEINLINE void | FMC_EnterDeepPowerDownMode (FLCTL_T *fmc) | 
| Enter flash deep power down mode.  More... | |
| __STATIC_FORCEINLINE void | FMC_ExitDeepPowerDownMode (FLCTL_T *fmc) | 
| Exit flash deep power down mode.  More... | |
| void | FMC_GetFlashUniqueId (FLCTL_T *fmc) | 
| This function is used to get flash unique id,.  More... | |
| void | FMC_GetFlashJedecId (FLCTL_T *fmc) | 
| This function is used to get flash jedec id,.  More... | |
| uint32_t | FMC_GetFlashCodeAreaSize (FLCTL_T *fmc) | 
| Get Size of Flash in Bytes.  More... | |
| int | FMC_EraseSector (FLCTL_T *fmc, unsigned long adr) | 
| Erase a 4KB Sector in Flash Memory.  More... | |
| int | FMC_EraseBlock32k (FLCTL_T *fmc, unsigned long addr) | 
| Erase a 32KB Block in Flash Memory.  More... | |
| int | FMC_EraseBlock64k (FLCTL_T *fmc, unsigned long addr) | 
| Erase a 64KB Block in Flash Memory.  More... | |
| int | FMC_EraseChip (FLCTL_T *fmc) | 
| Erase the whole flash memory.  More... | |
| int | FMC_EraseCodeArea (FLCTL_T *fmc, uint32_t addr, uint32_t len) | 
| Erase specific data in flash code area.  More... | |
| void | InitIcache (FLCTL_T *fmc, uint32_t mode) | 
| This function is used to init Icache,.  More... | |
| int32_t | FMC_GetCrc32Sum (FLCTL_T *fmc, uint32_t addr, uint32_t count, uint32_t *chksum) | 
| Calculate and read the CRC32 checksum of a specified flash area.  More... | |
| int | BlankCheck (FLCTL_T *fmc, unsigned long adr, unsigned long sz) | 
| Blank check checks if memory is blank.  More... | |
| unsigned long | Verify (FLCTL_T *fmc, unsigned long adr, unsigned long sz, unsigned char *buf) | 
| Verify in flash memory.  More... | |
| int | ProgramPage (FLCTL_T *fmc, unsigned long adr, unsigned long sz, unsigned char *buf) | 
| Program page in flash memory.  More... | |
| unsigned char | FMC_ReadStatusReg (FLCTL_T *fmc, unsigned char cmd) | 
| This function is used to read status, The Read Status Register can be read at any time.  More... | |
| unsigned char | FMC_WriteEnable (FLCTL_T *fmc) | 
| This function is used to enable write function,.  More... | |
| void | FMC_WriteStatusReg (FLCTL_T *fmc, unsigned char ops, unsigned int buf) | 
| This function is used to write status, The Read Status Register can be read at any time.  More... | |
| unsigned char | FMC_ReadByte (FLCTL_T *fmc, unsigned int Addr, unsigned char cmd) | 
| This function is used to read flash,.  More... | |
| void | FMC_WriteByte (FLCTL_T *fmc, unsigned int addr, unsigned char data) | 
| This function is used to write one byte to flash memory.  More... | |
| void | FMC_WriteHalfWord (FLCTL_T *fmc, unsigned int addr, unsigned short data) | 
| This function is used to write halfword to flash memory.  More... | |
| unsigned int | FMC_ReadWord (FLCTL_T *fmc, unsigned int Addr, unsigned char cmd) | 
| This function is used to read flash.  More... | |
| unsigned char * | FMC_ReadPage (FLCTL_T *fmc, unsigned int Addr, unsigned char cmd) | 
| This function is used to read a page size (256 bytes) of data from flash.  More... | |
| int | FMC_ReadStream (FLCTL_T *fmc, unsigned int Addr, unsigned char cmd, unsigned char *buf, unsigned int len) | 
| This function is used to read data stream from flash.  More... | |
| int | FMC_WriteStream (FLCTL_T *fmc, unsigned int Addr, unsigned char *buf, unsigned int len) | 
| This function is used to write data stream to flash.  More... | |
| int | FMC_ReadInfoArea (FLCTL_T *fmc, unsigned int Addr, unsigned char cmd, unsigned char *buf, unsigned int len) | 
| This function is used to read data from the flash 4KB INFO area.  More... | |
| int | FMC_WriteInfoArea (FLCTL_T *fmc, unsigned int Addr, unsigned char *buf, unsigned int len) | 
| This function is used to write data to the flash 4KB INFO area.  More... | |
| int | FMC_EraseInfoArea (FLCTL_T *fmc) | 
| This function is used to erase the flash 4KB INFO area.  More... | |
| void | FMC_SetFlashMode (FLCTL_T *fmc, uint32_t mode, bool enhance) | 
| This function is used to set flash work mode.  More... | |
| void | FMC_ExitEnhanceMode (FLCTL_T *fmc) | 
| This function is used to exit flash enhanced read mode.  More... | |
| void | FMC_EnterEnhanceMode (FLCTL_T *fmc, uint32_t mode) | 
| This function is used to enter flash enhanced read mode.  More... | |
| void | FMC_EnableAutoDp (FLCTL_T *fmc) | 
| This function is used to enable auto enter deep power down function.  More... | |
| void | FMC_DisableAutoDp (FLCTL_T *fmc) | 
| This function is used to disable auto enter deep power down function.  More... | |
| void | FMC_SetRdpWaitCount (FLCTL_T *fmc, uint32_t cnt) | 
| This function is used to set wait count for release from Deep Power-down mode.  More... | |
Fmc Interface.
| #define CMD_TRIG (0x01) | 
Command to triger start operate
| #define CMD_WRITE_ENABLE (0x06) | 
Command to write enable operate
| #define Long_Time_Op_Pos (17) | 
Flash mode reg long time operate bit position
| #define PAGE_SIZE (256) | 
Flash one page size
| #define QUAD_ENABLE_Msk (0x1ul << QUAD_ENABLE_Pos) | 
Flash status reg quad enable value
| #define QUAD_ENABLE_Pos (9) | 
Flash status reg quad enable bit position
| #define SECTOR_SIZE (4096) | 
Flash one sector size
| #define Write_Enable_Latch_Msk (0x1ul << Write_Enable_Latch_Pos) | 
Flash write enable value
| #define Write_Enable_Latch_Pos (1) | 
Flash write enable bit position
| #define Write_In_Process_Msk (0x1ul << Write_In_Process_Pos) | 
Flash status reg WIP bit value,this bit indicates whether the memory is busy
| #define Write_In_Process_Pos (0) | 
Flash status reg WIP bit position
| typedef struct _flash_ids FLASH_IDS_T | 
Structure with flash id.
| manufacturer_id | Specifies the flash manufacturer id | 
| memory_type_id | Specifies the flash memory type id | 
| memory_density_id | Specifies the flash memory density id  | 
| uid | Specifies the flash unique id | 
| int BlankCheck | ( | FLCTL_T * | fmc, | 
| unsigned long | adr, | ||
| unsigned long | sz | ||
| ) | 
Blank check checks if memory is blank.
| fmc | Where fmc is a flash peripheral. | 
| adr | Block start address | 
| sz | Block Size (in bytes) | 
| 0 | Success | 
| 1 | Fail | 
| void FMC_DisableAutoDp | ( | FLCTL_T * | fmc | ) | 
This function is used to disable auto enter deep power down function.
| fmc | Where fmc is a flash peripheral. | 
| void FMC_EnableAutoDp | ( | FLCTL_T * | fmc | ) | 
This function is used to enable auto enter deep power down function.
| fmc | Where fmc is a flash peripheral. | 
| __STATIC_FORCEINLINE void FMC_EnterDeepPowerDownMode | ( | FLCTL_T * | fmc | ) | 
Enter flash deep power down mode.
| fmc | Where fmc is the base address of fmc peripheral | 
| void FMC_EnterEnhanceMode | ( | FLCTL_T * | fmc, | 
| uint32_t | mode | ||
| ) | 
This function is used to enter flash enhanced read mode.
| fmc | Where fmc is a flash peripheral. | 
| mode | Where mode is line mode select. Fmc work type select | 
| int FMC_EraseBlock32k | ( | FLCTL_T * | fmc, | 
| unsigned long | addr | ||
| ) | 
Erase a 32KB Block in Flash Memory.
This function is used to erase a 32KB flash block in flash code area.
| fmc | where fmc is a flash peripheral. | 
| adr | where addr is a erase start address. | 
| 0 | Success. | 
| -1 | Fail. | 
| int FMC_EraseBlock64k | ( | FLCTL_T * | fmc, | 
| unsigned long | addr | ||
| ) | 
Erase a 64KB Block in Flash Memory.
This function is used to erase a 64KB flash block in flash code area.
| fmc | where fmc is a flash peripheral. | 
| adr | where addr is a erase start address. | 
| 0 | Success. | 
| -1 | Fail. | 
| int FMC_EraseChip | ( | FLCTL_T * | fmc | ) | 
Erase the whole flash memory.
This function is used to erase all data in flash, include Code Area and Info Area.
| fmc | where fmc is a flash peripheral. | 
| 0 | Success. | 
| -1 | Fail. | 
| int FMC_EraseCodeArea | ( | FLCTL_T * | fmc, | 
| uint32_t | addr, | ||
| uint32_t | len | ||
| ) | 
Erase specific data in flash code area.
This function is used to erase specific data in flash Code Area.
| fmc | where fmc is a flash peripheral. | 
| addr | start address to erase, should be 4KB aligned. | 
| len | length to erase in bytes. | 
| 0 | Success. | 
| -1 | Fail. | 
| int FMC_EraseInfoArea | ( | FLCTL_T * | fmc | ) | 
This function is used to erase the flash 4KB INFO area.
| fmc | where fmc is a flash peripheral | 
| 0 | erase success | 
| -1 | erase fail | 
| int FMC_EraseSector | ( | FLCTL_T * | fmc, | 
| unsigned long | adr | ||
| ) | 
Erase a 4KB Sector in Flash Memory.
This function is used to erase a 4KB flash sector in flash code area.
| fmc | where fmc is a flash peripheral. | 
| adr | where addr is a erase start address. | 
| 0 | Success. | 
| -1 | Fail. | 
| __STATIC_FORCEINLINE void FMC_ExitDeepPowerDownMode | ( | FLCTL_T * | fmc | ) | 
Exit flash deep power down mode.
| fmc | Where fmc is the base address of fmc peripheral | 
| void FMC_ExitEnhanceMode | ( | FLCTL_T * | fmc | ) | 
This function is used to exit flash enhanced read mode.
| fmc | Where fmc is a flash peripheral. | 
| int32_t FMC_GetCrc32Sum | ( | FLCTL_T * | fmc, | 
| uint32_t | addr, | ||
| uint32_t | count, | ||
| uint32_t * | chksum | ||
| ) | 
Calculate and read the CRC32 checksum of a specified flash area.
| [in] | fmc | Where fmc is a flash peripheral. | 
| [in] | addr | Start address of the flash area to be executed CRC32 checksum calculation. | 
| [in] | count | Number of bytes to be calculated. | 
| [out] | chksum | If success, it will contain the result of CRC32 checksum calculation. | 
| 0 | Success | 
| -1 | Invalid parameter. | 
| uint32_t FMC_GetFlashCodeAreaSize | ( | FLCTL_T * | fmc | ) | 
Get Size of Flash in Bytes.
| fmc | Flash memory controller base | 
| void FMC_GetFlashJedecId | ( | FLCTL_T * | fmc | ) | 
This function is used to get flash jedec id,.
| fmc | where fmc is a flash peripheral. | 
| void FMC_GetFlashUniqueId | ( | FLCTL_T * | fmc | ) | 
This function is used to get flash unique id,.
| fmc | where fmc is a flash peripheral. | 
| unsigned char FMC_ReadByte | ( | FLCTL_T * | fmc, | 
| unsigned int | Addr, | ||
| unsigned char | cmd | ||
| ) | 
This function is used to read flash,.
| fmc | where fmc is a flash peripheral. | 
| Addr | where Addr is start address to read | 
| cmd | where cmd can be CMD_FAST_READ or CMD_NORM_READ | 
| int FMC_ReadInfoArea | ( | FLCTL_T * | fmc, | 
| unsigned int | Addr, | ||
| unsigned char | cmd, | ||
| unsigned char * | buf, | ||
| unsigned int | len | ||
| ) | 
This function is used to read data from the flash 4KB INFO area.
| fmc | where fmc is a flash peripheral. | 
| Addr | where Addr is start address to read, can be 0 ~ 4095 | 
| cmd | where cmd can be CMD_FAST_READ or CMD_NORM_READ | 
| buf | where buf is a buffer to store read data | 
| len | where len is data length of bytes to read | 
| 0 | read success | 
| -1 | read fail | 
| unsigned char * FMC_ReadPage | ( | FLCTL_T * | fmc, | 
| unsigned int | Addr, | ||
| unsigned char | cmd | ||
| ) | 
This function is used to read a page size (256 bytes) of data from flash.
| fmc | where fmc is a flash peripheral. | 
| Addr | where Addr is start address to read | 
| cmd | where cmd can be CMD_FAST_READ or CMD_NORM_READ | 
| unsigned char FMC_ReadStatusReg | ( | FLCTL_T * | fmc, | 
| unsigned char | cmd | ||
| ) | 
This function is used to read status, The Read Status Register can be read at any time.
| fmc | where fmc is a flash peripheral. | 
| cmd | where cmd can be CMD_READ_STATUS_L(return register bit[7:0]) CMD_READ_STATUS_H(return register bit[15:8]) | 
| int FMC_ReadStream | ( | FLCTL_T * | fmc, | 
| unsigned int | Addr, | ||
| unsigned char | cmd, | ||
| unsigned char * | buf, | ||
| unsigned int | len | ||
| ) | 
This function is used to read data stream from flash.
| fmc | where fmc is a flash peripheral. | 
| Addr | where Addr is start address to read | 
| cmd | where cmd can be CMD_FAST_READ or CMD_NORM_READ | 
| buf | where buf is a buffer to store read data | 
| len | where len is data length of bytes to read | 
| unsigned int FMC_ReadWord | ( | FLCTL_T * | fmc, | 
| unsigned int | Addr, | ||
| unsigned char | cmd | ||
| ) | 
This function is used to read flash.
| fmc | where fmc is a flash peripheral. | 
| Addr | where Addr is start address to read | 
| cmd | where cmd can be CMD_FAST_READ or CMD_NOR_READ | 
| void FMC_SetFlashMode | ( | FLCTL_T * | fmc, | 
| uint32_t | mode, | ||
| bool | enhance | ||
| ) | 
This function is used to set flash work mode.
| fmc | Where fmc is a flash peripheral. | 
| mode | Where mode is line mode select. Fmc work type select | 
| enhance | Whether enhanced mode is supported | 
| void FMC_SetRdpWaitCount | ( | FLCTL_T * | fmc, | 
| uint32_t | cnt | ||
| ) | 
This function is used to set wait count for release from Deep Power-down mode.
| fmc | Where fmc is a flash peripheral. | 
| cnt | Where cnt is a flash clk count value. | 
| void FMC_WriteByte | ( | FLCTL_T * | fmc, | 
| unsigned int | addr, | ||
| unsigned char | data | ||
| ) | 
This function is used to write one byte to flash memory.
| fmc | Where fmc is a flash peripheral. | 
| addr | Where Addr is start address to write | 
| data | Where data is data need to program | 
| unsigned char FMC_WriteEnable | ( | FLCTL_T * | fmc | ) | 
This function is used to enable write function,.
| fmc | where fmc is a flash peripheral. | 
| void FMC_WriteHalfWord | ( | FLCTL_T * | fmc, | 
| unsigned int | addr, | ||
| unsigned short | data | ||
| ) | 
This function is used to write halfword to flash memory.
| fmc | Where fmc is a flash peripheral. | 
| addr | Where Addr is start address to write | 
| data | Where data is data need to program | 
| int FMC_WriteInfoArea | ( | FLCTL_T * | fmc, | 
| unsigned int | Addr, | ||
| unsigned char * | buf, | ||
| unsigned int | len | ||
| ) | 
This function is used to write data to the flash 4KB INFO area.
| fmc | where fmc is a flash peripheral | 
| Addr | where Addr is start address to write, can be 0 ~ 4095 | 
| buf | where buf is a buffer to store data to write | 
| len | where len is data length of bytes to write | 
| 0 | write success | 
| -1 | write fail | 
| void FMC_WriteStatusReg | ( | FLCTL_T * | fmc, | 
| unsigned char | ops, | ||
| unsigned int | buf | ||
| ) | 
This function is used to write status, The Read Status Register can be read at any time.
| fmc | where fmc is a flash peripheral. | 
| ops | where ops can be OPS_WR_STU_REG_ALL OPS_WR_STU_REG_NOR | 
| buf | where buf is write value | 
| int FMC_WriteStream | ( | FLCTL_T * | fmc, | 
| unsigned int | Addr, | ||
| unsigned char * | buf, | ||
| unsigned int | len | ||
| ) | 
This function is used to write data stream to flash.
| fmc | where fmc is a flash peripheral | 
| Addr | where Addr is start address to write, can be any valid address | 
| buf | where buf is a buffer to store data to write | 
| len | where len is data length of bytes to write | 
| void InitIcache | ( | FLCTL_T * | fmc, | 
| uint32_t | mode | ||
| ) | 
This function is used to init Icache,.
| fmc | Where fmc is a flash peripheral. | 
| mode | Where mode can be FLASH_X1_MODE FLASH_X2_MODE FLASH_X4_MODE | 
| int ProgramPage | ( | FLCTL_T * | fmc, | 
| unsigned long | adr, | ||
| unsigned long | sz, | ||
| unsigned char * | buf | ||
| ) | 
Program page in flash memory.
| fmc | Where fmc is a flash peripheral. | 
| adr | Block start address | 
| sz | Page size | 
| buf | Page data | 
| 0 | Success | 
| 1 | Fail | 
| unsigned long Verify | ( | FLCTL_T * | fmc, | 
| unsigned long | adr, | ||
| unsigned long | sz, | ||
| unsigned char * | buf | ||
| ) | 
Verify in flash memory.
| fmc | Where fmc is a flash peripheral. | 
| adr | Block start address | 
| sz | Data lenth need to verify | 
| buf | Programed data |