M471M/R1/S BSP V3.01.000
The Board Support Package for M4521
Macros | Functions | Variables
fmc.h File Reference

M471M/R1/S Flash Memory Controller Driver Header File. More...

#include "NuMicro.h"
Include dependency graph for fmc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ISBEN   0
 
#define FMC_APROM_BASE   0x00000000UL
 
#define FMC_LDROM_BASE   0x00100000UL
 
#define FMC_SPROM_BASE   0x00200000UL
 
#define FMC_CONFIG_BASE   0x00300000UL
 
#define FMC_CONFIG0_ADDR   (FMC_CONFIG_BASE)
 
#define FMC_CONFIG1_ADDR   (FMC_CONFIG_BASE + 4)
 
#define FMC_FLASH_PAGE_SIZE   0x800
 
#define FMC_LDROM_SIZE   0x1000
 
#define FMC_ISPCTL_BS_LDROM   0x2
 
#define FMC_ISPCTL_BS_APROM   0x0
 
#define FMC_ISPCMD_READ   0x00
 
#define FMC_ISPCMD_PROGRAM   0x21
 
#define FMC_ISPCMD_WRITE_8   0x61
 
#define FMC_ISPCMD_PAGE_ERASE   0x22
 
#define FMC_ISPCMD_READ_CID   0x0B
 
#define FMC_ISPCMD_READ_UID   0x04
 
#define FMC_ISPCMD_READ_DID   0x0C
 
#define FMC_ISPCMD_VECMAP   0x2E
 
#define FMC_ISPCMD_CHECKSUM   0x0D
 
#define FMC_ISPCMD_CAL_CHECKSUM   0x2D
 
#define FMC_ISPCMD_MULTI_PROG   0x27
 
#define FMC_FTCTL_OPTIMIZE_DISABLE   0x00
 
#define FMC_FTCTL_OPTIMIZE_12MHZ   0x01
 
#define FMC_FTCTL_OPTIMIZE_36MHZ   0x02
 
#define FMC_FTCTL_OPTIMIZE_60MHZ   0x04
 
#define FMC_FTCTL_OPTIMIZE_72MHZ   0x05
 
#define FMC_TIMEOUT_READ
 
#define FMC_TIMEOUT_WRITE
 
#define FMC_TIMEOUT_ERASE
 
#define FMC_TIMEOUT_CHKSUM
 
#define FMC_TIMEOUT_CHKALLONE
 
#define FMC_ENABLE_ISP()   (FMC->ISPCTL |= FMC_ISPCTL_ISPEN_Msk)
 Enable ISP Function. More...
 
#define FMC_DISABLE_ISP()   (FMC->ISPCTL &= ~FMC_ISPCTL_ISPEN_Msk)
 Disable ISP Function. More...
 
#define FMC_ENABLE_LD_UPDATE()   (FMC->ISPCTL |= FMC_ISPCTL_LDUEN_Msk)
 Enable LDROM Update Function. More...
 
#define FMC_DISABLE_LD_UPDATE()   (FMC->ISPCTL &= ~FMC_ISPCTL_LDUEN_Msk)
 Disable LDROM Update Function. More...
 
#define FMC_ENABLE_CFG_UPDATE()   (FMC->ISPCTL |= FMC_ISPCTL_CFGUEN_Msk)
 Enable User Configuration Update Function. More...
 
#define FMC_DISABLE_CFG_UPDATE()   (FMC->ISPCTL &= ~FMC_ISPCTL_CFGUEN_Msk)
 Disable User Configuration Update Function. More...
 
#define FMC_ENABLE_AP_UPDATE()   (FMC->ISPCTL |= FMC_ISPCTL_APUEN_Msk)
 Enable APROM Update Function. More...
 
#define FMC_DISABLE_AP_UPDATE()   (FMC->ISPCTL &= ~FMC_ISPCTL_APUEN_Msk)
 Disable APROM Update Function. More...
 
#define FMC_SELECT_NEXT_BOOT(x)   (FMC->ISPCTL = (FMC->ISPCTL & ~FMC_ISPCTL_BS_Msk) | ((x) << FMC_ISPCTL_BS_Pos))
 Next Booting Selection function. More...
 
#define FMC_GET_BOOT_STATUS()   ((FMC->ISPCTL & FMC_ISPCTL_BS_Msk)?1:0)
 Get MCU Booting Status. More...
 

Functions

static __INLINE void FMC_Write (uint32_t u32Addr, uint32_t u32Data)
 Program 32-bit data into specified address of flash. More...
 
static __INLINE void FMC_Write8 (uint32_t u32Addr, uint32_t u32Data0, uint32_t u32Data1)
 Program 64-bit data into specified address of flash. More...
 
static __INLINE uint32_t FMC_Read (uint32_t u32Addr)
 Read 32-bit Data from specified address of flash. More...
 
static __INLINE int32_t FMC_Erase (uint32_t u32Addr)
 Flash page erase. More...
 
static __INLINE uint32_t FMC_ReadUID (uint8_t u8Index)
 Read Unique ID. More...
 
static __INLINE uint32_t FMC_ReadCID (void)
 Read company ID. More...
 
static __INLINE uint32_t FMC_ReadPID (void)
 Read product ID. More...
 
static __INLINE uint32_t FMC_ReadUCID (uint32_t u32Index)
 To read UCID. More...
 
static __INLINE void FMC_SetVectorPageAddr (uint32_t u32PageAddr)
 Set vector mapping address. More...
 
static __INLINE uint32_t FMC_GetVECMAP (void)
 Get current vector mapping address. More...
 
static __INLINE uint32_t FMC_GetCheckSum (uint32_t u32Addr, int32_t i32Size)
 Get Flash Checksum. More...
 
static __INLINE void FMC_Write256 (uint32_t u32Addr, uint32_t *pu32Buf)
 Program Multi-Word data into specified address of flash. More...
 
void FMC_Open (void)
 Enable FMC ISP function. More...
 
void FMC_Close (void)
 Disable ISP Functions. More...
 
void FMC_EnableAPUpdate (void)
 Enable APROM update function. More...
 
void FMC_DisableAPUpdate (void)
 Disable APROM update function. More...
 
void FMC_EnableConfigUpdate (void)
 Enable User Configuration update function. More...
 
void FMC_DisableConfigUpdate (void)
 Disable User Configuration update function. More...
 
void FMC_EnableLDUpdate (void)
 Enable LDROM update function. More...
 
void FMC_DisableLDUpdate (void)
 Disable LDROM update function. More...
 
int32_t FMC_ReadConfig (uint32_t *u32Config, uint32_t u32Count)
 Read the User Configuration words. More...
 
int32_t FMC_WriteConfig (uint32_t *u32Config, uint32_t u32Count)
 Write User Configuration. More...
 
void FMC_SetBootSource (int32_t i32BootSrc)
 Set boot source from LDROM or APROM after next software reset. More...
 
int32_t FMC_GetBootSource (void)
 Get the current boot source. More...
 
uint32_t FMC_ReadDataFlashBaseAddr (void)
 Get the base address of Data Flash if enabled. More...
 
void FMC_EnableFreqOptimizeMode (uint32_t u32Mode)
 Enable Flash Access Frequency Optimization Mode. More...
 
void FMC_DisableFreqOptimizeMode (void)
 Disable Flash Access Frequency Optimization Mode. More...
 

Variables

int32_t g_FMC_i32ErrCode
 

Detailed Description

M471M/R1/S Flash Memory Controller Driver Header File.

SPDX-License-Identifier: Apache-2.0

Definition in file fmc.h.

Variable Documentation

◆ g_FMC_i32ErrCode

int32_t g_FMC_i32ErrCode
extern