![]() |
PDL for FM0+
Version1.0
Peripheral Driverl Library for FM0+
|
#include "flash.h"
Go to the source code of this file.
Defines | |
#define | Flash_Read(addr) *(volatile uint16_t*)((uint32_t)(addr)) |
Read a half word data from Flash. | |
#define | Flash_Write(addr, data) *(volatile uint16_t*)((uint32_t)(addr)) = ( uint16_t)(data) |
Wirte a half word data into Flash. | |
Functions | |
static __ramfunc uint8_t | MFlash_CheckToggle (uint16_t *pu16Addr) |
automatic algorithm of flash memory execution | |
static __ramfunc void | MFlash_ReadResetCmd (uint16_t *pu16ResetSecAddr) |
Issue read/reset command. | |
__ramfunc en_result_t | MFlash_ChipErase (boolean_t bCrRemain) |
Flash chip erase. | |
__ramfunc en_result_t | MFlash_SectorErase (uint16_t *pu16SecAddr) |
Flash sector erase. | |
__ramfunc en_result_t | MFlash_Write (uint16_t *pu16WriteAddr, uint16_t *pu16WriteData, uint32_t u32Size) |
Flash half-word write. |
A detailed description is available at Main Flash Module description
History:
Definition in file flash.c.
#define Flash_Read | ( | addr | ) | *(volatile uint16_t*)((uint32_t)(addr)) |
Read a half word data from Flash.
addr | Pointer to read data address |
Definition at line 65 of file flash.c.
Referenced by MFlash_CheckToggle(), MFlash_ChipErase(), MFlash_ReadResetCmd(), and MFlash_Write().
#define Flash_Write | ( | addr, | |
data | |||
) | *(volatile uint16_t*)((uint32_t)(addr)) = ( uint16_t)(data) |
Wirte a half word data into Flash.
addr | Pointer to read data address |
data | Write data |
Definition at line 74 of file flash.c.
Referenced by MFlash_ChipErase(), MFlash_ReadResetCmd(), MFlash_SectorErase(), and MFlash_Write().
static __ramfunc uint8_t MFlash_CheckToggle | ( | uint16_t * | pu16Addr | ) | [static] |
automatic algorithm of flash memory execution
pu16Addr | address of flash data |
MFLASH_RET_OK | |
MFLASH_RET_ABNORMAL | |
MFLASH_RET_INVALID_PARA |
Definition at line 310 of file flash.c.
References Flash_Read, MFLASH_CHK_TLOV_MASK, MFLASH_CHK_TOGG_ABNORMAL, MFLASH_CHK_TOGG_MASK, and MFLASH_CHK_TOGG_NORMAL.
Referenced by MFlash_ChipErase(), MFlash_SectorErase(), and MFlash_Write().
__ramfunc en_result_t MFlash_ChipErase | ( | boolean_t | bCrRemain | ) |
Flash chip erase.
bCrRemain | CR remain flag |
Ok | Flash chip erase normally |
ErrorInvalidParameter | bCrRemain > 1 |
Error | Flash erase failure |
Definition at line 129 of file flash.c.
References CR_DATA_ADDR, Error, ErrorInvalidParameter, Flash_Read, Flash_Write, MFlash_CheckToggle(), MFLASH_CHK_TOGG_ABNORMAL, MFLASH_CODE1, MFLASH_CODE2, MFlash_ReadResetCmd(), Ok, and TRUE.
static __ramfunc void MFlash_ReadResetCmd | ( | uint16_t * | pu16ResetSecAddr | ) | [static] |
Issue read/reset command.
pu16ResetSecAddr | address of reset sector |
Definition at line 102 of file flash.c.
References Flash_Read, and Flash_Write.
Referenced by MFlash_ChipErase(), MFlash_SectorErase(), and MFlash_Write().
__ramfunc en_result_t MFlash_SectorErase | ( | uint16_t * | pu16SecAddr | ) |
Flash sector erase.
pu16SecAddr | address of flash sector |
Ok | Flash sector erase successfully |
Error | Flash sector erase failure |
Definition at line 212 of file flash.c.
References Error, Flash_Write, MFlash_CheckToggle(), MFLASH_CHK_TOGG_ABNORMAL, MFLASH_CODE1, MFLASH_CODE2, MFlash_ReadResetCmd(), and Ok.
__ramfunc en_result_t MFlash_Write | ( | uint16_t * | pu16WriteAddr, |
uint16_t * | pu16WriteData, | ||
uint32_t | u32Size | ||
) |
Flash half-word write.
pu16WriteAddr | address of flash data |
pu16WriteData | pointer to write data |
u32Size | data size, 1 indicates 1 16-bit data |
Ok | Flash half-word write normally |
Error | Flash half-word write failure |
Definition at line 256 of file flash.c.
References Error, Flash_Read, Flash_Write, MFlash_CheckToggle(), MFLASH_CHK_TOGG_ABNORMAL, MFLASH_CODE1, MFLASH_CODE2, MFlash_ReadResetCmd(), and Ok.