![]() |
M480 BSP
V3.05.001
The Board Support Package for M480 Series
|
Functions | |
| __STATIC_INLINE uint32_t | FMC_ReadCID (void) |
| Read company ID. More... | |
| __STATIC_INLINE uint32_t | FMC_ReadPID (void) |
| Read product ID. More... | |
| __STATIC_INLINE uint32_t | FMC_ReadUID (uint8_t u8Index) |
| Read Unique ID. More... | |
| __STATIC_INLINE uint32_t | FMC_ReadUCID (uint32_t u32Index) |
| To read UCID. More... | |
| __STATIC_INLINE void | FMC_SetVectorPageAddr (uint32_t u32PageAddr) |
| Set vector mapping address. More... | |
| __STATIC_INLINE uint32_t | FMC_GetVECMAP (void) |
| Get current vector mapping address. More... | |
| void | FMC_Close (void) |
| Disable FMC ISP function. More... | |
| int32_t | FMC_ConfigXOM (uint32_t u32XomNum, uint32_t u32XomBase, uint8_t u8XomPage) |
| Config XOM Region. More... | |
| int32_t | FMC_Erase (uint32_t u32PageAddr) |
| Execute FMC_ISPCMD_PAGE_ERASE command to erase a flash page. The page size is 4096 bytes. More... | |
| int32_t | FMC_Erase_SPROM (void) |
| Execute FMC_ISPCMD_PAGE_ERASE command to erase SPROM. The page size is 4096 bytes. More... | |
| int32_t | FMC_Erase_Block (uint32_t u32BlockAddr) |
| Execute FMC_ISPCMD_BLOCK_ERASE command to erase a flash block. The block size is 4 pages. More... | |
| int32_t | FMC_Erase_Bank (uint32_t u32BankAddr) |
| Execute FMC_ISPCMD_BANK_ERASE command to erase a flash block. More... | |
| int32_t | FMC_EraseXOM (uint32_t u32XomNum) |
| Execute Erase XOM Region. More... | |
| int32_t | FMC_GetXOMState (uint32_t u32XomNum) |
| Check the XOM is actived or not. More... | |
| int32_t | FMC_GetBootSource (void) |
| Get the current boot source. More... | |
| void | FMC_Open (void) |
| Enable FMC ISP function. More... | |
| uint32_t | FMC_Read (uint32_t u32Addr) |
| Execute FMC_ISPCMD_READ command to read a word from flash. More... | |
| int32_t | FMC_Read_64 (uint32_t u32addr, uint32_t *u32data0, uint32_t *u32data1) |
| Execute FMC_ISPCMD_READ_64 command to read a double-word from flash. More... | |
| uint32_t | FMC_ReadDataFlashBaseAddr (void) |
| Get the base address of Data Flash if enabled. More... | |
| void | FMC_SetBootSource (int32_t i32BootSrc) |
| Set boot source from LDROM or APROM after next software reset. More... | |
| void | FMC_Write (uint32_t u32Addr, uint32_t u32Data) |
| Execute ISP FMC_ISPCMD_PROGRAM to program a word to flash. More... | |
| int32_t | FMC_Write8Bytes (uint32_t u32addr, uint32_t u32data0, uint32_t u32data1) |
| Execute ISP FMC_ISPCMD_PROGRAM_64 to program a double-word to flash. More... | |
| int32_t | FMC_WriteMultiple (uint32_t u32Addr, uint32_t pu32Buf[], uint32_t u32Len) |
| Program Multi-Word data into specified address of flash. More... | |
| int32_t | FMC_Write_OTP (uint32_t otp_num, uint32_t low_word, uint32_t high_word) |
| Program a 64-bits data to the specified OTP. More... | |
| int32_t | FMC_Read_OTP (uint32_t otp_num, uint32_t *low_word, uint32_t *high_word) |
| Read the 64-bits data from the specified OTP. More... | |
| int32_t | FMC_Lock_OTP (uint32_t otp_num) |
| Lock the specified OTP. More... | |
| int32_t | FMC_Is_OTP_Locked (uint32_t otp_num) |
| Check the OTP is locked or not. More... | |
| int32_t | FMC_ReadConfig (uint32_t u32Config[], uint32_t u32Count) |
| Execute FMC_ISPCMD_READ command to read User Configuration. More... | |
| int32_t | FMC_WriteConfig (uint32_t u32Config[], uint32_t u32Count) |
| Execute ISP commands to erase then write User Configuration. More... | |
| uint32_t | FMC_GetChkSum (uint32_t u32addr, uint32_t u32count) |
| Run CRC32 checksum calculation and get result. More... | |
| uint32_t | FMC_CheckAllOne (uint32_t u32addr, uint32_t u32count) |
| Run flash all one verification and get result. More... | |
| int32_t | FMC_SetSPKey (uint32_t key[3], uint32_t kpmax, uint32_t kemax, const int32_t lock_CONFIG, const int32_t lock_SPROM) |
| Setup security key. More... | |
| int32_t | FMC_CompareSPKey (uint32_t key[3]) |
| Execute security key comparison. More... | |
| uint32_t FMC_CheckAllOne | ( | uint32_t | u32addr, |
| uint32_t | u32count | ||
| ) |
Run flash all one verification and get result.
| [in] | u32addr | Starting flash address. It must be a page aligned address. |
| [in] | u32count | Byte count of flash to be calculated. It must be multiple of 512 bytes. |
| READ_ALLONE_YES | The contents of verified flash area are 0xFFFFFFFF. |
| READ_ALLONE_NOT | Some contents of verified flash area are not 0xFFFFFFFF. |
| READ_ALLONE_CMD_FAIL | Unexpected error occurred. |
| int32_t FMC_CompareSPKey | ( | uint32_t | key[3] | ) |
| int32_t FMC_ConfigXOM | ( | uint32_t | u32XomNum, |
| uint32_t | u32XomBase, | ||
| uint8_t | u8XomPage | ||
| ) |
Config XOM Region.
| [in] | u32XomNum | The XOM number(0~3) |
| [in] | u32XomBase | The XOM region base address. |
| [in] | u8XomPage | The XOM page number of region size. |
| 0 | Success |
| 1 | XOM is has already actived. |
| -1 | Program failed. |
| -2 | Invalid XOM number. |
Program XOM base address and XOM size(page)
| int32_t FMC_Erase | ( | uint32_t | u32PageAddr | ) |
Execute FMC_ISPCMD_PAGE_ERASE command to erase a flash page. The page size is 4096 bytes.
| [in] | u32PageAddr | Address of the flash page to be erased. It must be a 4096 bytes aligned address. |
| 0 | Success |
| -1 | Erase failed |
| int32_t FMC_Erase_Bank | ( | uint32_t | u32BankAddr | ) |
| int32_t FMC_Erase_Block | ( | uint32_t | u32BlockAddr | ) |
Execute FMC_ISPCMD_BLOCK_ERASE command to erase a flash block. The block size is 4 pages.
| [in] | u32BlockAddr | Address of the flash block to be erased. It must be a 4 pages aligned address. |
| 0 | Success |
| -1 | Erase failed |
| int32_t FMC_Erase_SPROM | ( | void | ) |
| int32_t FMC_EraseXOM | ( | uint32_t | u32XomNum | ) |
| int32_t FMC_GetBootSource | ( | void | ) |
| uint32_t FMC_GetChkSum | ( | uint32_t | u32addr, |
| uint32_t | u32count | ||
| ) |
Run CRC32 checksum calculation and get result.
| [in] | u32addr | Starting flash address. It must be a page aligned address. |
| [in] | u32count | Byte count of flash to be calculated. It must be multiple of 512 bytes. |
| 0 | Success. |
| 0xFFFFFFFF | Invalid parameter. |
| __STATIC_INLINE uint32_t FMC_GetVECMAP | ( | void | ) |
| int32_t FMC_GetXOMState | ( | uint32_t | u32XomNum | ) |
| int32_t FMC_Is_OTP_Locked | ( | uint32_t | otp_num | ) |
| int32_t FMC_Lock_OTP | ( | uint32_t | otp_num | ) |
| uint32_t FMC_Read | ( | uint32_t | u32Addr | ) |
| int32_t FMC_Read_64 | ( | uint32_t | u32addr, |
| uint32_t * | u32data0, | ||
| uint32_t * | u32data1 | ||
| ) |
Execute FMC_ISPCMD_READ_64 command to read a double-word from flash.
| [in] | u32addr | Address of the flash location to be read. It must be a double-word aligned address. |
| [out] | u32data0 | Place holder of word 0 read from flash address u32addr. |
| [out] | u32data1 | Place holder of word 0 read from flash address u32addr+4. |
| int32_t FMC_Read_OTP | ( | uint32_t | otp_num, |
| uint32_t * | low_word, | ||
| uint32_t * | high_word | ||
| ) |
| __STATIC_INLINE uint32_t FMC_ReadCID | ( | void | ) |
| int32_t FMC_ReadConfig | ( | uint32_t | u32Config[], |
| uint32_t | u32Count | ||
| ) |
Execute FMC_ISPCMD_READ command to read User Configuration.
| [out] | u32Config | A two-word array. u32Config[0] holds CONFIG0, while u32Config[1] holds CONFIG1. |
| [in] | u32Count | Available word count in u32Config. |
| 0 | Success. |
| -1 | Invalid parameter. |
| uint32_t FMC_ReadDataFlashBaseAddr | ( | void | ) |
| __STATIC_INLINE uint32_t FMC_ReadPID | ( | void | ) |
| __STATIC_INLINE uint32_t FMC_ReadUCID | ( | uint32_t | u32Index | ) |
| __STATIC_INLINE uint32_t FMC_ReadUID | ( | uint8_t | u8Index | ) |
| void FMC_SetBootSource | ( | int32_t | i32BootSrc | ) |
Set boot source from LDROM or APROM after next software reset.
| [in] | i32BootSrc | 1: Boot from LDROM 0: Boot from APROM |
This function is used to switch APROM boot or LDROM boot. User need to call FMC_SetBootSource to select boot source first, then use CPU reset or System Reset Request to reset system.
| int32_t FMC_SetSPKey | ( | uint32_t | key[3], |
| uint32_t | kpmax, | ||
| uint32_t | kemax, | ||
| const int32_t | lock_CONFIG, | ||
| const int32_t | lock_SPROM | ||
| ) |
Setup security key.
| [in] | key | Key 0~2 to be setup. |
| [in] | kpmax | Maximum unmatched power-on counting number. |
| [in] | kemax | Maximum unmatched counting number. |
| [in] | lock_CONFIG | 1: Security key lock CONFIG to write-protect. 0: Don't lock CONFIG. |
| [in] | lock_SPROM | 1: Security key lock SPROM to write-protect. 0: Don't lock SPROM. |
| 0 | Success. |
| -1 | Key is locked. Cannot overwrite the current key. |
| -2 | Failed to erase flash. |
| -3 | Failed to program key. |
| -4 | Key lock function failed. |
| -5 | CONFIG lock function failed. |
| -6 | SPROM lock function failed. |
| -7 | KPMAX function failed. |
| -8 | KEMAX function failed. |
| __STATIC_INLINE void FMC_SetVectorPageAddr | ( | uint32_t | u32PageAddr | ) |
Set vector mapping address.
| [in] | u32PageAddr | The page address to remap to address 0x0. The address must be page alignment. |
This function is used to set VECMAP to map specified page to vector page (0x0).
| void FMC_Write | ( | uint32_t | u32Addr, |
| uint32_t | u32Data | ||
| ) |
| int32_t FMC_Write8Bytes | ( | uint32_t | u32addr, |
| uint32_t | u32data0, | ||
| uint32_t | u32data1 | ||
| ) |
Execute ISP FMC_ISPCMD_PROGRAM_64 to program a double-word to flash.
| [in] | u32addr | Address of the flash location to be programmed. It must be a double-word aligned address. |
| [in] | u32data0 | The word data to be programmed to flash address u32addr. |
| [in] | u32data1 | The word data to be programmed to flash address u32addr+4. |
| int32_t FMC_Write_OTP | ( | uint32_t | otp_num, |
| uint32_t | low_word, | ||
| uint32_t | high_word | ||
| ) |
| int32_t FMC_WriteConfig | ( | uint32_t | u32Config[], |
| uint32_t | u32Count | ||
| ) |
Execute ISP commands to erase then write User Configuration.
| [in] | u32Config | A two-word array. u32Config[0] holds CONFIG0, while u32Config[1] holds CONFIG1. |
| [in] | u32Count | The number of User Configuration words to be written. |
| 0 | Success |
| -1 | Failed |
| int32_t FMC_WriteMultiple | ( | uint32_t | u32Addr, |
| uint32_t | pu32Buf[], | ||
| uint32_t | u32Len | ||
| ) |
Program Multi-Word data into specified address of flash.
| [in] | u32Addr | Start flash address in APROM where the data chunk to be programmed into. This address must be 8-bytes aligned to flash address. |
| [in] | pu32Buf | Buffer that carry the data chunk. |
| [in] | u32Len | Length of the data chunk in bytes. |
| >=0 | Number of data bytes were programmed. |
1.8.15