| MINI55_BSP V3.02.004 The Board Support Package for Mini55 Series 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_APROM_END 0x00004600UL
36#define FMC_LDROM_BASE 0x00100000UL
37#define FMC_LDROM_END 0x00100800UL
38#define FMC_CONFIG_BASE 0x00300000UL
40#define FMC_FLASH_PAGE_SIZE 0x200
41#define FMC_LDROM_SIZE 0x800
44/*---------------------------------------------------------------------------------------------------------*/
45/* ISPCMD constant definitions */
46/*---------------------------------------------------------------------------------------------------------*/
47#define FMC_ISPCMD_READ 0x00
48#define FMC_ISPCMD_PROGRAM 0x21
49#define FMC_ISPCMD_PAGE_ERASE 0x22
50#define FMC_ISPCMD_READ_CID 0x0B
51#define FMC_ISPCMD_READ_PID 0x0C
52#define FMC_ISPCMD_READ_UID 0x04
53#define FMC_ISPCMD_VECMAP 0x2E
55#define IS_BOOT_FROM_APROM 0
56#define IS_BOOT_FROM_LDROM 1 /* end of group MINI55_FMC_EXPORTED_CONSTANTS */
60
65#define FMC_SET_APROM_BOOT() (FMC->ISPCTL &= ~FMC_ISPCTL_BS_Msk)
66#define FMC_SET_LDROM_BOOT() (FMC->ISPCTL |= FMC_ISPCTL_BS_Msk)
67#define FMC_ENABLE_AP_UPDATE() (FMC->ISPCTL |= FMC_ISPCTL_APUEN_Msk)
68#define FMC_DISABLE_AP_UPDATE() (FMC->ISPCTL &= ~FMC_ISPCTL_APUEN_Msk)
69#define FMC_ENABLE_LD_UPDATE() (FMC->ISPCTL |= FMC_ISPCTL_LDUEN_Msk)
70#define FMC_DISABLE_LD_UPDATE() (FMC->ISPCTL &= ~FMC_ISPCTL_LDUEN_Msk)
71#define FMC_ENABLE_CFG_UPDATE() (FMC->ISPCTL |= FMC_ISPCTL_CFGUEN_Msk)
72#define FMC_DISABLE_CFG_UPDATE() (FMC->ISPCTL &= ~FMC_ISPCTL_CFGUEN_Msk)
73#define FMC_ENABLE_ISP() (FMC->ISPCTL |= FMC_ISPCTL_ISPEN_Msk)
74#define FMC_DISABLE_ISP() (FMC->ISPCTL &= ~FMC_ISPCTL_ISPEN_Msk)
75#define FMC_GET_FAIL_FLAG() ((FMC->ISPCTL & FMC_ISPCTL_ISPFF_Msk) ? 1 : 0)
76#define FMC_CLR_FAIL_FLAG() (FMC->ISPCTL |= FMC_ISPCTL_ISPFF_Msk)
78 extern void FMC_Close(void);
79 extern int32_t FMC_Erase(uint32_t u32PageAddr);
80 extern int32_t FMC_GetBootSource(void);
81 extern void FMC_Open(void);
82 extern uint32_t FMC_Read(uint32_t u32Addr);
83 extern uint32_t FMC_ReadCID(void);
84 extern uint32_t FMC_ReadPID(void);
85 extern uint32_t FMC_ReadUCID(uint32_t u32Index);
86 extern uint32_t FMC_ReadUID(uint32_t u32Index);
87 extern uint32_t FMC_ReadDataFlashBaseAddr(void);
88 extern void FMC_SetVectorPageAddr(uint32_t u32PageAddr);
89 extern uint32_t FMC_GetVectorPageAddr(void);
90 extern void FMC_Write(uint32_t u32Addr, uint32_t u32Data);
91 extern int32_t FMC_ReadConfig(uint32_t *u32Config, uint32_t u32Count);
92 extern int32_t FMC_WriteConfig(uint32_t *u32Config, uint32_t u32Count);
93
94 /* end of group MINI55_FMC_EXPORTED_FUNCTIONS */
96 /* end of group MINI55_FMC_Driver */
98 /* end of group MINI55_Device_Driver */
100
101#ifdef __cplusplus
102}
103#endif
104
105
106#endif
107
FMC_Close
void FMC_Close(void)
Disable all FMC functions.
Definition: fmc.c:34
FMC_ReadConfig
int32_t FMC_ReadConfig(uint32_t *u32Config, uint32_t u32Count)
Execute ISP command to read User Configuration.
Definition: fmc.c:226
FMC_SetVectorPageAddr
void FMC_SetVectorPageAddr(uint32_t u32PageAddr)
This function will force re-map assigned flash page to CPU address 0x0.
Definition: fmc.c:183
FMC_ReadCID
uint32_t FMC_ReadCID(void)
Read company ID.
Definition: fmc.c:111
FMC_GetVectorPageAddr
uint32_t FMC_GetVectorPageAddr(void)
Obtain the current vector page address setting.
Definition: fmc.c:196
FMC_ReadUID
uint32_t FMC_ReadUID(uint32_t u32Index)
This function reads one of the three UID.
Definition: fmc.c:157
FMC_Erase
int32_t FMC_Erase(uint32_t u32PageAddr)
Execute ISP command to erase a flash page. The page size is 512 bytes.
Definition: fmc.c:48
FMC_ReadDataFlashBaseAddr
uint32_t FMC_ReadDataFlashBaseAddr(void)
Get the base address of Data Flash if enabled.
Definition: fmc.c:173
FMC_Read
uint32_t FMC_Read(uint32_t u32Addr)
Execute ISP command to read a word from flash.
Definition: fmc.c:95
FMC_Write
void FMC_Write(uint32_t u32Addr, uint32_t u32Data)
Writes a word data to specified flash address.
Definition: fmc.c:207
FMC_ReadPID
uint32_t FMC_ReadPID(void)
Read product ID.
Definition: fmc.c:125
FMC_GetBootSource
int32_t FMC_GetBootSource(void)
Get the current boot source.
Definition: fmc.c:71
FMC_WriteConfig
int32_t FMC_WriteConfig(uint32_t *u32Config, uint32_t u32Count)
Execute ISP command to write User Configuration.
Definition: fmc.c:245
FMC_Open
void FMC_Open(void)
Enable FMC ISP function.
Definition: fmc.c:83
FMC_ReadUCID
uint32_t FMC_ReadUCID(uint32_t u32Index)
This function reads one of the four UCID.
Definition: fmc.c:140