| NUC029FAE_BSP V3.02.000 The Board Support Package for NUC029FAE MCU

fmc.h
Go to the documentation of this file.
1/**************************************************************************/
12#ifndef __FMC_H__
13#define __FMC_H__
14
15#ifdef __cplusplus
16 extern "C"
17{
18#endif
19
31/*---------------------------------------------------------------------------------------------------------*/
32/* Define Base Address */
33/*---------------------------------------------------------------------------------------------------------*/
34#define FMC_APROM_BASE 0x00000000UL
35#define FMC_LDROM_BASE 0x00100000UL
36#define FMC_LDROM_END 0x00100800UL
37#define FMC_CONFIG_BASE 0x00300000UL
39#define FMC_FLASH_PAGE_SIZE 0x200
40#define FMC_LDROM_SIZE 0x800
42#define FMC_TIMEOUT_READ ((SystemCoreClock/10)*2)
43#define FMC_TIMEOUT_WRITE ((SystemCoreClock/10)*2)
44#define FMC_TIMEOUT_ERASE ((SystemCoreClock/10)*4)
45#define FMC_TIMEOUT_CHKSUM (SystemCoreClock*2)
47/*---------------------------------------------------------------------------------------------------------*/
48/* ISPCMD constant definitions */
49/*---------------------------------------------------------------------------------------------------------*/
50#define FMC_ISPCMD_READ 0x00
51#define FMC_ISPCMD_PROGRAM 0x21
52#define FMC_ISPCMD_PAGE_ERASE 0x22
53#define FMC_ISPCMD_READ_CID 0x0B
54#define FMC_ISPCMD_READ_PID 0x0C
55#define FMC_ISPCMD_READ_UID 0x04
56#define FMC_ISPCMD_VECMAP 0x2E /* end of group NUC029FAE_FMC_EXPORTED_CONSTANTS */
60
65#define FMC_SET_APROM_BOOT() (FMC->ISPCON &= ~FMC_ISPCON_BS_Msk)
66#define FMC_SET_LDROM_BOOT() (FMC->ISPCON |= FMC_ISPCON_BS_Msk)
67#define FMC_DISABLE_AP_UPDATE() (FMC->ISPCON &= ~FMC_ISPCON_APUEN_Msk)
68#define FMC_DISABLE_CFG_UPDATE() (FMC->ISPCON &= ~FMC_ISPCON_CFGUEN_Msk)
69#define FMC_DISABLE_LD_UPDATE() (FMC->ISPCON &= ~FMC_ISPCON_LDUEN_Msk)
70#define FMC_DISABLE_ISP() (FMC->ISPCON &= ~FMC_ISPCON_ISPEN_Msk)
71#define FMC_ENABLE_AP_UPDATE() (FMC->ISPCON |= FMC_ISPCON_APUEN_Msk)
72#define FMC_ENABLE_LD_UPDATE() (FMC->ISPCON |= FMC_ISPCON_LDUEN_Msk)
73#define FMC_ENABLE_CFG_UPDATE() (FMC->ISPCON |= FMC_ISPCON_CFGUEN_Msk)
74#define FMC_ENABLE_ISP() (FMC->ISPCON |= FMC_ISPCON_ISPEN_Msk)
75#define FMC_GET_FAIL_FLAG() ((FMC->ISPCON & FMC_ISPCON_ISPFF_Msk) ? 1 : 0)
78 extern void FMC_SetBootSource(int32_t i32BootSrc);
79 extern void FMC_Close(void);
80 extern void FMC_DisableAPUpdate(void);
81 extern void FMC_DisableConfigUpdate(void);
82 extern void FMC_DisableLDUpdate(void);
83 extern void FMC_EnableAPUpdate(void);
84 extern void FMC_EnableConfigUpdate(void);
85 extern void FMC_EnableLDUpdate(void);
86 extern int32_t FMC_Erase(uint32_t u32PageAddr);
87 extern int32_t FMC_GetBootSource(void);
88 extern void FMC_Open(void);
89 extern uint32_t FMC_Read (uint32_t u32Addr);
90 extern uint32_t FMC_ReadCID(void);
91 extern uint32_t FMC_ReadPID(void);
92 extern uint32_t FMC_ReadUCID(uint32_t u32Index);
93 extern uint32_t FMC_ReadUID(uint32_t u32Index);
94 extern uint32_t FMC_ReadDataFlashBaseAddr(void);
95 extern void FMC_SetVectorPageAddr(uint32_t u32PageAddr);
96 extern int32_t FMC_Write(uint32_t u32Addr, uint32_t u32Data);
97 extern int32_t FMC_ReadConfig(uint32_t *u32Config, uint32_t u32Count);
98 extern int32_t FMC_WriteConfig(uint32_t *u32Config, uint32_t u32Count);
99
100 /* end of group NUC029FAE_FMC_EXPORTED_FUNCTIONS */
102 /* end of group NUC029FAE_FMC_Driver */
104 /* end of group NUC029FAE_Device_Driver */
106
107#ifdef __cplusplus
108}
109#endif
110
111
112#endif
113
FMC_DisableLDUpdate
void FMC_DisableLDUpdate(void)
Disable LDROM update function.
Definition: fmc.c:76
FMC_Close
void FMC_Close(void)
Disable all FMC functions.
Definition: fmc.c:49
FMC_EnableLDUpdate
void FMC_EnableLDUpdate(void)
Enable LDROM update function.
Definition: fmc.c:103
FMC_ReadConfig
int32_t FMC_ReadConfig(uint32_t *u32Config, uint32_t u32Count)
Read the User Configuration words.
Definition: fmc.c:326
FMC_SetVectorPageAddr
void FMC_SetVectorPageAddr(uint32_t u32PageAddr)
This function will force re-map assigned flash page to CPU address 0x0.
Definition: fmc.c:282
FMC_ReadCID
uint32_t FMC_ReadCID(void)
Read company ID.
Definition: fmc.c:184
FMC_ReadUID
uint32_t FMC_ReadUID(uint32_t u32Index)
This function reads one of the three UID.
Definition: fmc.c:250
FMC_EnableAPUpdate
void FMC_EnableAPUpdate(void)
Enable APROM update function.
Definition: fmc.c:85
FMC_Erase
int32_t FMC_Erase(uint32_t u32PageAddr)
Erase a page. The page size is 512 bytes.
Definition: fmc.c:115
FMC_ReadDataFlashBaseAddr
uint32_t FMC_ReadDataFlashBaseAddr(void)
Get the base address of Data Flash if enabled.
Definition: fmc.c:272
FMC_SetBootSource
void FMC_SetBootSource(int32_t i32BootSrc)
Set boot source of next software reset.
Definition: fmc.c:37
FMC_Write
int32_t FMC_Write(uint32_t u32Addr, uint32_t u32Data)
Writes a word data to specified flash address.
Definition: fmc.c:300
FMC_DisableAPUpdate
void FMC_DisableAPUpdate(void)
Disable APROM update function.
Definition: fmc.c:58
FMC_Read
uint32_t FMC_Read(uint32_t u32Addr)
Read a word from specified flash address.
Definition: fmc.c:162
FMC_ReadPID
uint32_t FMC_ReadPID(void)
Read product ID.
Definition: fmc.c:205
FMC_GetBootSource
int32_t FMC_GetBootSource(void)
get the current boot source
Definition: fmc.c:139
FMC_WriteConfig
int32_t FMC_WriteConfig(uint32_t *u32Config, uint32_t u32Count)
Write User Configuration.
Definition: fmc.c:343
FMC_DisableConfigUpdate
void FMC_DisableConfigUpdate(void)
Disable User Configuration update function.
Definition: fmc.c:67
FMC_Open
void FMC_Open(void)
Enable FMC ISP function.
Definition: fmc.c:151
FMC_EnableConfigUpdate
void FMC_EnableConfigUpdate(void)
Enable User Configuration update function.
Definition: fmc.c:94
FMC_ReadUCID
uint32_t FMC_ReadUCID(uint32_t u32Index)
This function reads one of the four UCID.
Definition: fmc.c:227