37 FMC->ISPCTL &= ~FMC_ISPCTL_ISPEN_Msk;
56int32_t
FMC_ConfigXOM(uint32_t u32XomNum, uint32_t u32XomBase, uint8_t u8XomPage)
75 FMC->ISPDAT = u32XomBase;
94 FMC->ISPDAT = u8XomPage;
155 FMC->ISPADDR = u32PageAddr;
192 FMC->ISPDAT = 0x0055AA03UL;
229 FMC->ISPADDR = u32BlockAddr;
265 FMC->ISPADDR = u32BankAddr;
304 int32_t i32Active, err = 0;
321 u32Addr = (
FMC->XOMR0STS & 0xFFFFFF00u) >> 8u;
324 u32Addr = (
FMC->XOMR1STS & 0xFFFFFF00u) >> 8u;
327 u32Addr = (
FMC->XOMR2STS & 0xFFFFFF00u) >> 8u;
330 u32Addr = (
FMC->XOMR3STS & 0xFFFFFF00u) >> 8u;
336 FMC->ISPADDR = u32Addr;
337 FMC->ISPDAT = 0x55aa03u;
343 while ((tout-- > 0) &&
FMC->ISPTRG) {}
379 if (u32XomNum >= 4UL)
384 u32act = (((
FMC->XOMSTS) & 0xful) & (1ul << u32XomNum)) >> u32XomNum;
385 ret = (int32_t)u32act;
437 FMC->ISPADDR = u32Addr;
463int32_t
FMC_Read_64(uint32_t u32addr, uint32_t * u32data0, uint32_t * u32data1)
469 FMC->ISPADDR = u32addr;
489 *u32data0 =
FMC->MPDAT0;
490 *u32data1 =
FMC->MPDAT1;
523 FMC->ISPCTL &= ~FMC_ISPCTL_BS_Msk;
544 FMC->ISPADDR = u32Addr;
545 FMC->ISPDAT = u32Data;
583 FMC->ISPADDR = u32addr;
584 FMC->MPDAT0 = u32data0;
585 FMC->MPDAT1 = u32data1;
622 int i, idx, retval = 0;
633 u32Len = u32Len - (u32Len % 8);
639 FMC->ISPADDR = u32Addr;
640 FMC->MPDAT0 = pu32Buf[idx++];
641 FMC->MPDAT1 = pu32Buf[idx++];
642 FMC->MPDAT2 = pu32Buf[idx++];
643 FMC->MPDAT3 = pu32Buf[idx++];
667 FMC->MPDAT0 = pu32Buf[idx++];
668 FMC->MPDAT1 = pu32Buf[idx++];
689 FMC->MPDAT2 = pu32Buf[idx++];
690 FMC->MPDAT3 = pu32Buf[idx++];
728int32_t
FMC_Write_OTP(uint32_t otp_num, uint32_t low_word, uint32_t high_word)
742 FMC->ISPDAT = low_word;
762 FMC->ISPDAT = high_word;
795int32_t
FMC_Read_OTP(uint32_t otp_num, uint32_t *low_word, uint32_t *high_word)
828 *low_word =
FMC->MPDAT0;
829 *high_word =
FMC->MPDAT1;
923 if (
FMC->ISPDAT != 0xFFFFFFFFUL)
1001 for (i = 0; i < u32Count; i++)
1045 if ((u32addr % 4096UL) || (u32count % 4096UL))
1052 FMC->ISPADDR = u32addr;
1053 FMC->ISPDAT = u32count;
1065 FMC->ISPADDR = u32addr;
1097 FMC->ISPSTS = 0x80UL;
1100 FMC->ISPADDR = u32addr;
1101 FMC->ISPDAT = u32count;
1116 FMC->ISPADDR = u32addr;
1125 while (
FMC->ISPDAT == 0UL);
1158 const int32_t lock_CONFIG,
const int32_t lock_SPROM)
1160 uint32_t lock_ctrl = 0UL;
1167 if (
FMC->KPKEYSTS != 0x200UL)
1209 u32KeySts =
FMC->KPKEYSTS;
1278 FMC->KPKEY0 = key[0];
1279 FMC->KPKEY1 = key[1];
1280 FMC->KPKEY2 = key[2];
1291 u32KeySts =
FMC->KPKEYSTS;
NuMicro peripheral access layer header file.
#define FMC_ISPCMD_READ_64
#define FMC_TIMEOUT_ERASE
#define FMC_ISPCMD_READ_CKS
#define FMC_ISPCMD_PROGRAM
#define FMC_ISPCMD_BLOCK_ERASE
#define FMC_TIMEOUT_CHKSUM
#define FMC_ISPCMD_RUN_ALL1
#define FMC_ISPCMD_BANK_ERASE
#define FMC_MULTI_WORD_PROG_LEN
#define FMC_TIMEOUT_CHKALLONE
#define FMC_ISPCMD_PROGRAM_64
#define FMC_ISPCMD_PROGRAM_MUL
#define FMC_ISPCMD_RUN_CKS
#define FMC_ISPCMD_READ_ALL1
#define FMC_TIMEOUT_WRITE
#define READ_ALLONE_CMD_FAIL
#define FMC_ISPCMD_PAGE_ERASE
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.
void FMC_Close(void)
Disable FMC ISP function.
int32_t FMC_Lock_OTP(uint32_t otp_num)
Lock the specified OTP.
int32_t FMC_ReadConfig(uint32_t u32Config[], uint32_t u32Count)
Execute FMC_ISPCMD_READ command to read User Configuration.
int32_t FMC_CompareSPKey(uint32_t key[3])
Execute security key comparison.
int32_t FMC_WriteMultiple(uint32_t u32Addr, uint32_t pu32Buf[], uint32_t u32Len)
Program Multi-Word data into specified address of flash.
int32_t FMC_Erase_SPROM(void)
Execute FMC_ISPCMD_PAGE_ERASE command to erase SPROM. The page size is 4096 bytes.
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.
int32_t FMC_ConfigXOM(uint32_t xom_num, uint32_t xom_base, uint8_t xom_page)
Config XOM Region.
uint32_t FMC_GetChkSum(uint32_t u32addr, uint32_t u32count)
Run CRC32 checksum calculation and get result.
int32_t FMC_WriteConfig(uint32_t u32Config[], uint32_t u32Count)
Execute ISP commands to erase then write User Configuration.
uint32_t FMC_CheckAllOne(uint32_t u32addr, uint32_t u32count)
Run flash all one verification and get result.
int32_t FMC_GetXOMState(uint32_t xom_num)
Check the XOM is actived or not.
int32_t FMC_Erase(uint32_t u32PageAddr)
Execute FMC_ISPCMD_PAGE_ERASE command to erase a flash page. The page size is 4096 bytes.
uint32_t FMC_ReadDataFlashBaseAddr(void)
Get the base address of Data Flash if enabled.
void FMC_SetBootSource(int32_t i32BootSrc)
Set boot source from LDROM or APROM after next software reset.
int32_t FMC_Write(uint32_t u32Addr, uint32_t u32Data)
Execute ISP FMC_ISPCMD_PROGRAM to program a word to flash.
uint32_t FMC_Read(uint32_t u32Addr)
Execute FMC_ISPCMD_READ command to read a word from flash.
int32_t FMC_Is_OTP_Locked(uint32_t otp_num)
Check the OTP is locked or not.
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.
int32_t FMC_GetBootSource(void)
Get the current boot source.
int32_t FMC_EraseXOM(uint32_t xom_num)
Execute Erase XOM Region.
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.
int32_t FMC_Erase_Bank(uint32_t u32BankAddr)
Execute FMC_ISPCMD_BANK_ERASE command to erase a flash block.
void FMC_Open(void)
Enable FMC ISP function.
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.
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.
#define FMC_DISABLE_CFG_UPDATE()
#define FMC_ENABLE_CFG_UPDATE()
#define FMC_KPKEYSTS_KEYBUSY_Msk
#define FMC_ISPCTL_ISPFF_Msk
#define FMC_ISPSTS_ISPFF_Msk
#define FMC_ISPCTL_BS_Msk
#define FMC_KPCNT_KPMAX_Pos
#define FMC_KPKEYCNT_KPKEMAX_Msk
#define FMC_KPKEYSTS_SPFLAG_Msk
#define FMC_KPKEYTRG_KPKEYGO_Msk
#define FMC_KPKEYTRG_TCEN_Msk
#define FMC_KPKEYSTS_KEYMATCH_Msk
#define FMC_ISPCTL_BL_Msk
#define FMC_ISPCTL_ISPEN_Msk
#define FMC_KPCNT_KPMAX_Msk
#define FMC_KPKEYSTS_FORBID_Msk
#define FMC_KPKEYCNT_KPKEMAX_Pos
#define FMC_ISPTRG_ISPGO_Msk
#define FMC_KPKEYSTS_CFGFLAG_Msk
#define FMC_KPKEYSTS_KEYLOCK_Msk
#define FMC_MPSTS_MPBUSY_Msk