MINI51DE_BSP V3.02.003
The Board Support Package for Mini51DE Series MCU
fmc.h
Go to the documentation of this file.
1/**************************************************************************/
12#ifndef __FMC_H__
13#define __FMC_H__
14
15#ifdef __cplusplus
16extern "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
43/*---------------------------------------------------------------------------------------------------------*/
44/* ISPCMD constant definitions */
45/*---------------------------------------------------------------------------------------------------------*/
46#define FMC_ISPCMD_READ 0x00
47#define FMC_ISPCMD_PROGRAM 0x21
48#define FMC_ISPCMD_PAGE_ERASE 0x22
49#define FMC_ISPCMD_READ_CID 0x0B
50#define FMC_ISPCMD_READ_PID 0x0C
51#define FMC_ISPCMD_READ_UID 0x04
52#define FMC_ISPCMD_VECMAP 0x2E /* end of group MINI51_FMC_EXPORTED_CONSTANTS */
56
61#define FMC_SET_APROM_BOOT() (FMC->ISPCON &= ~FMC_ISPCON_BS_Msk)
62#define FMC_SET_LDROM_BOOT() (FMC->ISPCON |= FMC_ISPCON_BS_Msk)
63#define FMC_DISABLE_AP_UPDATE() (FMC->ISPCON &= ~FMC_ISPCON_APUEN_Msk)
64#define FMC_DISABLE_CFG_UPDATE() (FMC->ISPCON &= ~FMC_ISPCON_CFGUEN_Msk)
65#define FMC_DISABLE_LD_UPDATE() (FMC->ISPCON &= ~FMC_ISPCON_LDUEN_Msk)
66#define FMC_DISABLE_ISP() (FMC->ISPCON &= ~FMC_ISPCON_ISPEN_Msk)
67#define FMC_ENABLE_AP_UPDATE() (FMC->ISPCON |= FMC_ISPCON_APUEN_Msk)
68#define FMC_ENABLE_LD_UPDATE() (FMC->ISPCON |= FMC_ISPCON_LDUEN_Msk)
69#define FMC_ENABLE_CFG_UPDATE() (FMC->ISPCON |= FMC_ISPCON_CFGUEN_Msk)
70#define FMC_ENABLE_ISP() (FMC->ISPCON |= FMC_ISPCON_ISPEN_Msk)
71#define FMC_GET_FAIL_FLAG() ((FMC->ISPCON & FMC_ISPCON_ISPFF_Msk) ? 1 : 0)
72#define FMC_CLR_FAIL_FLAG() (FMC->ISPCON |= FMC_ISPCON_ISPFF_Msk)
75extern void FMC_Close(void);
76extern int32_t FMC_Erase(uint32_t u32PageAddr);
77extern int32_t FMC_GetBootSource(void);
78extern void FMC_Open(void);
79extern uint32_t FMC_Read (uint32_t u32Addr);
80extern uint32_t FMC_ReadCID(void);
81extern uint32_t FMC_ReadPID(void);
82extern uint32_t FMC_ReadUCID(uint32_t u32Index);
83extern uint32_t FMC_ReadUID(uint32_t u32Index);
84extern uint32_t FMC_ReadDataFlashBaseAddr(void);
85extern void FMC_SetVectorPageAddr(uint32_t u32PageAddr);
86extern uint32_t FMC_GetVectorPageAddr(void);
87extern void FMC_Write(uint32_t u32Addr, uint32_t u32Data);
88extern int32_t FMC_ReadConfig(uint32_t *u32Config, uint32_t u32Count);
89extern int32_t FMC_WriteConfig(uint32_t *u32Config, uint32_t u32Count);
90
91 /* end of group MINI51_FMC_EXPORTED_FUNCTIONS */
93 /* end of group MINI51_FMC_Driver */
95 /* end of group MINI51_Device_Driver */
97
98#ifdef __cplusplus
99}
100#endif
101
102
103#endif
104
void FMC_Close(void)
Disable all FMC functions.
Definition: fmc.c:34
int32_t FMC_ReadConfig(uint32_t *u32Config, uint32_t u32Count)
Read the User Configuration words.
Definition: fmc.c:220
void FMC_SetVectorPageAddr(uint32_t u32PageAddr)
This function will force re-map assigned flash page to CPU address 0x0.
Definition: fmc.c:179
uint32_t FMC_ReadCID(void)
Read company ID.
Definition: fmc.c:107
uint32_t FMC_GetVectorPageAddr(void)
Obtain the current vector page address setting.
Definition: fmc.c:192
uint32_t FMC_ReadUID(uint32_t u32Index)
This function reads one of the three UID.
Definition: fmc.c:153
int32_t FMC_Erase(uint32_t u32PageAddr)
Erase a page. The page size is 512 bytes.
Definition: fmc.c:46
uint32_t FMC_ReadDataFlashBaseAddr(void)
Get the base address of Data Flash if enabled.
Definition: fmc.c:169
uint32_t FMC_Read(uint32_t u32Addr)
Read a word from specified flash address.
Definition: fmc.c:91
void FMC_Write(uint32_t u32Addr, uint32_t u32Data)
Writes a word data to specified flash address.
Definition: fmc.c:203
uint32_t FMC_ReadPID(void)
Read product ID.
Definition: fmc.c:121
int32_t FMC_GetBootSource(void)
get the current boot source
Definition: fmc.c:68
int32_t FMC_WriteConfig(uint32_t *u32Config, uint32_t u32Count)
Write User Configuration.
Definition: fmc.c:237
void FMC_Open(void)
Enable FMC ISP function.
Definition: fmc.c:80
uint32_t FMC_ReadUCID(uint32_t u32Index)
This function reads one of the four UCID.
Definition: fmc.c:136