![]() |
NANO103 BSP V3.01.004
The Board Support Package for Nano103 Series
|
Macros | |
#define | FMC_SET_APROM_BOOT() (FMC->ISPCTL &= ~FMC_ISPCTL_BS_Msk) |
#define | FMC_SET_LDROM_BOOT() (FMC->ISPCTL |= FMC_ISPCTL_BS_Msk) |
#define | FMC_ENABLE_AP_UPDATE() (FMC->ISPCTL |= FMC_ISPCTL_APUEN_Msk) |
#define | FMC_DISABLE_AP_UPDATE() (FMC->ISPCTL &= ~FMC_ISPCTL_APUEN_Msk) |
#define | FMC_ENABLE_CFG_UPDATE() (FMC->ISPCTL |= FMC_ISPCTL_CFGUEN_Msk) |
#define | FMC_DISABLE_CFG_UPDATE() (FMC->ISPCTL &= ~FMC_ISPCTL_CFGUEN_Msk) |
#define | FMC_ENABLE_LD_UPDATE() (FMC->ISPCTL |= FMC_ISPCTL_LDUEN_Msk) |
#define | FMC_DISABLE_LD_UPDATE() (FMC->ISPCTL &= ~FMC_ISPCTL_LDUEN_Msk) |
#define | FMC_DISABLE_ISP() (FMC->ISPCTL &= ~FMC_ISPCTL_ISPEN_Msk) |
#define | FMC_ENABLE_ISP() (FMC->ISPCTL |= FMC_ISPCTL_ISPEN_Msk) |
#define | FMC_GET_FAIL_FLAG() ((FMC->ISPCTL & FMC_ISPCTL_ISPFF_Msk) ? 1 : 0) |
#define | FMC_CLR_FAIL_FLAG() (FMC->ISPCTL |= FMC_ISPCTL_ISPFF_Msk) |
Functions | |
void | FMC_Close (void) |
Disable FMC ISP function. More... | |
int32_t | FMC_Erase (uint32_t u32PageAddr) |
Execute FMC_ISPCMD_PAGE_ERASE command to erase a flash page. The page size is 512 bytes. 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 ISP command to read a word from flash. More... | |
uint32_t | FMC_ReadCID (void) |
Read company ID. More... | |
uint32_t | FMC_ReadPID (void) |
Read product ID. More... | |
uint32_t | FMC_ReadUCID (uint32_t u32Index) |
This function reads one of the four UCID. More... | |
uint32_t | FMC_ReadUID (uint32_t u32Index) |
This function reads one of the three UID. More... | |
uint32_t | FMC_ReadDataFlashBaseAddr (void) |
Get the base address of Data Flash if enabled. More... | |
void | FMC_SetVectorPageAddr (uint32_t u32PageAddr) |
This function will force re-map assigned flash page to CPU address 0x0. More... | |
uint32_t | FMC_GetVectorPageAddr (void) |
Obtain the current vector page address setting. More... | |
int32_t | FMC_Write (uint32_t u32Addr, uint32_t u32Data) |
Execute ISP command to program a word to flash. More... | |
int32_t | FMC_ReadConfig (uint32_t *u32Config, uint32_t u32Count) |
Execute ISP command to read User Configuration. More... | |
int32_t | FMC_WriteConfig (uint32_t *u32Config, uint32_t u32Count) |
Execute ISP command to write User Configuration. More... | |
int32_t | FMC_GetChkSum (uint32_t u32Addr, uint32_t u32Count, uint32_t *u32ChkSum) |
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_SKey_Setup (uint32_t key[3], uint32_t kpmax, uint32_t kemax, int lock_CONFIG) |
Setup security key. More... | |
int32_t | FMC_SKey_Compare (uint32_t key[3]) |
Execute security key comparison. More... | |
#define FMC_CLR_FAIL_FLAG | ( | ) | (FMC->ISPCTL |= FMC_ISPCTL_ISPFF_Msk) |
#define FMC_DISABLE_AP_UPDATE | ( | ) | (FMC->ISPCTL &= ~FMC_ISPCTL_APUEN_Msk) |
#define FMC_DISABLE_CFG_UPDATE | ( | ) | (FMC->ISPCTL &= ~FMC_ISPCTL_CFGUEN_Msk) |
#define FMC_DISABLE_ISP | ( | ) | (FMC->ISPCTL &= ~FMC_ISPCTL_ISPEN_Msk) |
#define FMC_DISABLE_LD_UPDATE | ( | ) | (FMC->ISPCTL &= ~FMC_ISPCTL_LDUEN_Msk) |
#define FMC_ENABLE_AP_UPDATE | ( | ) | (FMC->ISPCTL |= FMC_ISPCTL_APUEN_Msk) |
#define FMC_ENABLE_CFG_UPDATE | ( | ) | (FMC->ISPCTL |= FMC_ISPCTL_CFGUEN_Msk) |
#define FMC_ENABLE_ISP | ( | ) | (FMC->ISPCTL |= FMC_ISPCTL_ISPEN_Msk) |
#define FMC_ENABLE_LD_UPDATE | ( | ) | (FMC->ISPCTL |= FMC_ISPCTL_LDUEN_Msk) |
#define FMC_GET_FAIL_FLAG | ( | ) | ((FMC->ISPCTL & FMC_ISPCTL_ISPFF_Msk) ? 1 : 0) |
#define FMC_SET_APROM_BOOT | ( | ) | (FMC->ISPCTL &= ~FMC_ISPCTL_BS_Msk) |
#define FMC_SET_LDROM_BOOT | ( | ) | (FMC->ISPCTL |= FMC_ISPCTL_BS_Msk) |
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_Erase | ( | uint32_t | u32PageAddr | ) |
Execute FMC_ISPCMD_PAGE_ERASE command to erase a flash page. The page size is 512 bytes.
[in] | u32PageAddr | Address of the flash page to be erased. It must be a 512-byte aligned address. |
0 | Success |
-1 | Erase failed |
Definition at line 51 of file fmc.c.
int32_t FMC_GetBootSource | ( | void | ) |
int32_t FMC_GetChkSum | ( | uint32_t | u32Addr, |
uint32_t | u32Count, | ||
uint32_t * | u32ChkSum | ||
) |
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. |
[out] | u32ChkSum | The CRC32 checksum if caculation is successful. |
0 | Success |
-1 | Failed |
-2 | Invalid parameter. |
uint32_t FMC_GetVectorPageAddr | ( | void | ) |
uint32_t FMC_Read | ( | uint32_t | u32Addr | ) |
Execute ISP command to read a word from flash.
[in] | u32Addr | Address of the flash location to be read. It must be a word aligned address. |
Definition at line 116 of file fmc.c.
uint32_t FMC_ReadCID | ( | void | ) |
int32_t FMC_ReadConfig | ( | uint32_t * | u32Config, |
uint32_t | u32Count | ||
) |
Execute ISP 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. |
Definition at line 343 of file fmc.c.
uint32_t FMC_ReadDataFlashBaseAddr | ( | void | ) |
uint32_t FMC_ReadPID | ( | void | ) |
uint32_t FMC_ReadUCID | ( | uint32_t | u32Index | ) |
uint32_t FMC_ReadUID | ( | uint32_t | u32Index | ) |
void FMC_SetVectorPageAddr | ( | uint32_t | u32PageAddr | ) |
int32_t FMC_SKey_Compare | ( | uint32_t | key[3] | ) |
Execute security key comparison.
[in] | key | Key0~2 to be compared. |
0 | Key matched. |
-1 | Forbidden. Times of key comparison mismatch has reached the maximum count. |
-2 | Key mismatched. |
-3 | No security key lock. Key comparison is not required. |
int32_t FMC_SKey_Setup | ( | uint32_t | key[3], |
uint32_t | kpmax, | ||
uint32_t | kemax, | ||
int | lock_CONFIG | ||
) |
Setup security key.
[in] | key | Key0~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. |
0 | Success. |
-1 | Key has been setup, It's not allowed to setup key again. |
-2 | Failed to erase flash. |
-3 | Failed to program key. |
-4 | Key lock function failed. |
-5 | CONFIG lock function failed. |
-7 | KPMAX function failed. |
-8 | KEMAX function failed. |
Definition at line 523 of file fmc.c.
int32_t FMC_Write | ( | uint32_t | u32Addr, |
uint32_t | u32Data | ||
) |
Execute ISP command to program a word to flash.
[in] | u32Addr | Address of the flash location to be programmed. It must be a word aligned address. |
[in] | u32Data | The word data to be programmed. |
Definition at line 311 of file fmc.c.
int32_t FMC_WriteConfig | ( | uint32_t * | u32Config, |
uint32_t | u32Count | ||
) |
Execute ISP command to write User Configuration.
[in] | 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. |
Definition at line 362 of file fmc.c.