| PDL for FM0+ Version1.0 Peripheral Driverl Library for FM0+

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Defines | Functions
C:/pdl_v10/library/driver/flash/flash.h File Reference
`#include "mcu.h"`
`#include "pdl_user.h"`
Include dependency graph for flash.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Defines
#define | MFLASH_CODE1 0x0AA8
#define | MFLASH_CODE2 0x0554
#define | MFLASH_CHK_TOGG_NORMAL 0
#define | MFLASH_CHK_TOGG_ABNORMAL 1
#define | MFLASH_CHK_DPOL_NORMAL 0
#define | MFLASH_CHK_DPOL_ABNORMAL 1
#define | MFLASH_CHK_DPOL_MASK (uint16_t)0x0080
#define | MFLASH_CHK_TOGG_MASK (uint16_t)0x0040
#define | MFLASH_CHK_TLOV_MASK (uint16_t)0x0020
#define | CR_DATA_ADDR (0x00100004)
## Functions
en_result_t | MFlash_ChipErase (boolean_t bCrRemain)
| Flash chip erase.
en_result_t | MFlash_SectorErase (uint16_t *pu16SecAddr)
| Flash sector erase.
en_result_t | MFlash_Write (uint16_t *pWriteAddr, uint16_t *pWriteData, uint32_t u32Size)
| Flash half-word write.

## Detailed Description

Headerfile for Main Flash operaiton

History:

- 2014-02-21 0.1 Edison Zhang First version.

Definition in file flash.h.

## Define Documentation

#define CR_DATA_ADDR (0x00100004)

Definition at line 106 of file flash.h.

Referenced by MFlash_ChipErase().

#define MFLASH_CHK_DPOL_ABNORMAL 1

Definition at line 100 of file flash.h.

#define MFLASH_CHK_DPOL_MASK (uint16_t)0x0080

Definition at line 102 of file flash.h.

#define MFLASH_CHK_DPOL_NORMAL 0

Definition at line 99 of file flash.h.

#define MFLASH_CHK_TLOV_MASK (uint16_t)0x0020

Definition at line 104 of file flash.h.

Referenced by MFlash_CheckToggle().

#define MFLASH_CHK_TOGG_ABNORMAL 1

Definition at line 97 of file flash.h.

Referenced by MFlash_CheckToggle(), MFlash_ChipErase(), MFlash_SectorErase(), and MFlash_Write().

#define MFLASH_CHK_TOGG_MASK (uint16_t)0x0040

Definition at line 103 of file flash.h.

Referenced by MFlash_CheckToggle().

#define MFLASH_CHK_TOGG_NORMAL 0

Definition at line 96 of file flash.h.

Referenced by MFlash_CheckToggle().

#define MFLASH_CODE1 0x0AA8

Definition at line 93 of file flash.h.

Referenced by MFlash_ChipErase(), MFlash_SectorErase(), and MFlash_Write().

#define MFLASH_CODE2 0x0554

Definition at line 94 of file flash.h.

Referenced by MFlash_ChipErase(), MFlash_SectorErase(), and MFlash_Write().

## Function Documentation

en_result_t MFlash_ChipErase | ( | boolean_t | bCrRemain | ) |

Flash chip erase.

Parameters:

  bCrRemain | CR remain flag

Return values:

  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.

Here is the call graph for this function:

en_result_t MFlash_SectorErase | ( | uint16_t * | pu16SecAddr | ) |

Flash sector erase.

Parameters:

  pu16SecAddr | address of flash sector

Return values:

  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.

Here is the call graph for this function:

en_result_t MFlash_Write | ( | uint16_t * | pu16WriteAddr,
|  | uint16_t * | pu16WriteData,
|  | uint32_t | u32Size
| ) |  |

Flash half-word write.

Parameters:

  pu16WriteAddr | address of flash data
  pu16WriteData | pointer to write data
  u32Size | data size, 1 indicates 1 16-bit data

Return values:

  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.

Here is the call graph for this function: