38 #define FMC_APROM_BASE 0x00000000UL 39 #define FMC_APROM_END 0x00008000UL 40 #define FMC_LDROM_BASE 0x00100000UL 41 #define FMC_LDROM_END 0x00101000UL 42 #define FMC_SPROM_BASE 0x00200000UL 43 #define FMC_SPROM_END 0x00200200UL 44 #define FMC_CONFIG_BASE 0x00300000UL 46 #define FMC_FLASH_PAGE_SIZE 0x200 47 #define FMC_LDROM_SIZE 0x1000 52 #define FMC_ISPCMD_READ 0x00 53 #define FMC_ISPCMD_PROGRAM 0x21 54 #define FMC_ISPCMD_PAGE_ERASE 0x22 55 #define FMC_ISPCMD_READ_CID 0x0B 56 #define FMC_ISPCMD_READ_PID 0x0C 57 #define FMC_ISPCMD_READ_UID 0x04 58 #define FMC_ISPCMD_VECMAP 0x2E 60 #define IS_BOOT_FROM_APROM 0 61 #define IS_BOOT_FROM_LDROM 1 75 #define FMC_SET_APROM_BOOT() (FMC->ISPCON &= ~FMC_ISPCON_BS_Msk) 76 #define FMC_SET_LDROM_BOOT() (FMC->ISPCON |= FMC_ISPCON_BS_Msk) 77 #define FMC_ENABLE_AP_UPDATE() (FMC->ISPCON |= FMC_ISPCON_APUEN_Msk) 78 #define FMC_DISABLE_AP_UPDATE() (FMC->ISPCON &= ~FMC_ISPCON_APUEN_Msk) 79 #define FMC_ENABLE_CFG_UPDATE() (FMC->ISPCON |= FMC_ISPCON_CFGUEN_Msk) 80 #define FMC_DISABLE_CFG_UPDATE() (FMC->ISPCON &= ~FMC_ISPCON_CFGUEN_Msk) 81 #define FMC_ENABLE_LD_UPDATE() (FMC->ISPCON |= FMC_ISPCON_LDUEN_Msk) 82 #define FMC_DISABLE_LD_UPDATE() (FMC->ISPCON &= ~FMC_ISPCON_LDUEN_Msk) 83 #define FMC_DISABLE_ISP() (FMC->ISPCON &= ~FMC_ISPCON_ISPEN_Msk) 84 #define FMC_ENABLE_ISP() (FMC->ISPCON |= FMC_ISPCON_ISPEN_Msk) 85 #define FMC_GET_FAIL_FLAG() ((FMC->ISPCON & FMC_ISPCON_ISPFF_Msk) ? 1 : 0) 86 #define FMC_CLR_FAIL_FLAG() (FMC->ISPCON |= FMC_ISPCON_ISPFF_Msk) 93 extern int32_t
FMC_Erase(uint32_t u32PageAddr);
96 extern uint32_t
FMC_Read(uint32_t u32Addr);
104 extern void FMC_Write(uint32_t u32Addr, uint32_t u32Data);
105 extern int32_t
FMC_ReadConfig(uint32_t *u32Config, uint32_t u32Count);
106 extern int32_t
FMC_WriteConfig(uint32_t *u32Config, uint32_t u32Count);
void FMC_SetVectorPageAddr(uint32_t u32PageAddr)
This function will force re-map assigned flash page to CPU address 0x0.
uint32_t FMC_ReadUCID(uint32_t u32Index)
This function reads one of the four UCID.
uint32_t FMC_ReadCID(void)
Read company ID.
int32_t FMC_ReadConfig(uint32_t *u32Config, uint32_t u32Count)
Execute ISP command to read User Configuration.
void FMC_Open(void)
Enable FMC ISP function.
uint32_t FMC_ReadUID(uint32_t u32Index)
This function reads one of the three UID.
void FMC_Close(void)
Disable FMC ISP function.
int32_t FMC_GetBootSource(void)
Get the current boot source.
uint32_t FMC_ReadPID(void)
Read product ID.
void FMC_Write(uint32_t u32Addr, uint32_t u32Data)
Execute ISP command to program a word to flash.
uint32_t FMC_GetVectorPageAddr(void)
Obtain the current vector page address setting.
int32_t FMC_Erase(uint32_t u32PageAddr)
Execute ISP command to erase a flash page. The page size is 512 bytes.
uint32_t FMC_Read(uint32_t u32Addr)
Execute ISP command to read a word from flash.
uint32_t FMC_ReadDataFlashBaseAddr(void)
Get the base address of Data Flash if enabled.
int32_t FMC_WriteConfig(uint32_t *u32Config, uint32_t u32Count)
Execute ISP command to write User Configuration.