STM8L15x Standard Peripherals Drivers: FLASH

STM8L15x/16x Standard Peripherals Drivers

STM8L15x Standard Peripherals Drivers

FLASH driver modules. More...

Modules

 FLASH_Private_Define
 FLASH_Private_Functions
 FLASH_Exported_Constants
 FLASH_Exported_Types
 FLASH_Exported_Macros

Functions

void FLASH_DeInit (void)
 Deinitializes the FLASH registers to their default reset values.
void FLASH_EraseByte (uint32_t Address)
 Erases one byte in the program or data EEPROM memory.
void FLASH_EraseOptionByte (uint16_t Address)
 Erases option byte.
uint16_t FLASH_GetBootSize (void)
 Returns the Boot memory size in bytes.
uint16_t FLASH_GetCodeSize (void)
 Returns the Code Area size in bytes.
FlagStatus FLASH_GetFlagStatus (FLASH_FLAG_TypeDef FLASH_FLAG)
 Checks whether the specified FLASH flag is set or not.
FLASH_ProgramTime_TypeDef FLASH_GetProgrammingTime (void)
 Returns the fixed programming time.
FunctionalState FLASH_GetReadOutProtectionStatus (void)
 Returns the FLASH Read Out Protection Status.
void FLASH_ITConfig (FunctionalState NewState)
 Enables or Disables the Flash interrupt mode.
void FLASH_Lock (FLASH_MemType_TypeDef FLASH_MemType)
 Locks the program or data EEPROM memory.
void FLASH_PowerWaitModeConfig (FLASH_Power_TypeDef FLASH_Power)
 Configures the power state for Flash program and data EEPROM during wait for interrupt mode.
void FLASH_ProgramByte (uint32_t Address, uint8_t Data)
 Programs one byte in program or data EEPROM memory.
void FLASH_ProgramOptionByte (uint16_t Address, uint8_t Data)
 Programs option byte.
void FLASH_ProgramWord (uint32_t Address, uint32_t Data)
 Programs one word (4 bytes) in program or data EEPROM memory.
uint8_t FLASH_ReadByte (uint32_t Address)
 Reads one byte from flash memory.
void FLASH_SetProgrammingTime (FLASH_ProgramTime_TypeDef FLASH_ProgTime)
 Sets the fixed programming time.
void FLASH_Unlock (FLASH_MemType_TypeDef FLASH_MemType)
 Unlocks the program or data EEPROM memory.
 IN_RAM (void FLASH_PowerRunModeConfig(FLASH_Power_TypeDef FLASH_Power))
 IN_RAM (void FLASH_EraseBlock(uint16_t BlockNum, FLASH_MemType_TypeDef FLASH_MemType))
 IN_RAM (void FLASH_ProgramBlock(uint16_t BlockNum, FLASH_MemType_TypeDef FLASH_MemType, FLASH_ProgramMode_TypeDef FLASH_ProgMode, uint8_t *Buffer))
 IN_RAM (FLASH_Status_TypeDef FLASH_WaitForLastOperation(FLASH_MemType_TypeDef FLASH_MemType))
 IN_RAM (FLASH_PowerStatus_TypeDef FLASH_GetPowerStatus(void))

Detailed Description

FLASH driver modules.


Function Documentation

void FLASH_DeInit ( void  )

Deinitializes the FLASH registers to their default reset values.

Parameters:
None
Return values:
None

Definition at line 253 of file stm8l15x_flash.c.

References FLASH, FLASH_CR1_RESET_VALUE, FLASH_CR2_RESET_VALUE, and FLASH_IAPSR_RESET_VALUE.

void FLASH_EraseByte ( uint32_t  Address)

Erases one byte in the program or data EEPROM memory.

Parameters:
Address: Address of the byte to erase
Return values:
None

Definition at line 324 of file stm8l15x_flash.c.

References FLASH_CLEAR_BYTE, IS_FLASH_ADDRESS, and PointerAttr.

void FLASH_EraseOptionByte ( uint16_t  Address)

Erases option byte.

Parameters:
Address: Option byte address to erase
Return values:
None

Definition at line 432 of file stm8l15x_flash.c.

References FLASH, FLASH_CLEAR_BYTE, FLASH_CR2_OPT, FLASH_MemType_Program, IS_OPTION_BYTE_ADDRESS, and PointerAttr.

uint16_t FLASH_GetBootSize ( void  )

Returns the Boot memory size in bytes.

Parameters:
None
Return values:
Bootmemory size in bytes

Definition at line 478 of file stm8l15x_flash.c.

References OPT.

uint16_t FLASH_GetCodeSize ( void  )

Returns the Code Area size in bytes.

Parameters:
None
Return values:
CodeArea size in bytes

Definition at line 502 of file stm8l15x_flash.c.

References OPT.

FlagStatus FLASH_GetFlagStatus ( FLASH_FLAG_TypeDef  FLASH_FLAG)

Checks whether the specified FLASH flag is set or not.

Parameters:
FLASH_FLAG: specifies the Flash Flag to check. This parameter can be one of the following values:
  • FLASH_FLAG_HVOFF: End of high voltage
  • FLASH_FLAG_DUL: Data EEPROM unlocked
  • FLASH_FLAG_EOP: End of programming (write or erase operation)
  • FLASH_FLAG_PUL: Flash Program memory unlocked
  • FLASH_FLAG_WR_PG_DIS: Write attempted to protected page
Return values:
Indicatesthe state of the Flash_FLAG. This parameter can be SET or RESET

Definition at line 571 of file stm8l15x_flash.c.

References FLASH, IS_FLASH_FLAGS, RESET, and SET.

FLASH_ProgramTime_TypeDef FLASH_GetProgrammingTime ( void  )

Returns the fixed programming time.

Parameters:
None
Return values:
Fixedprogramming time value

Definition at line 182 of file stm8l15x_flash.c.

References FLASH, and FLASH_CR1_FIX.

FunctionalState FLASH_GetReadOutProtectionStatus ( void  )

Returns the FLASH Read Out Protection Status.

Parameters:
None
Return values:
FLASHRead Out Protection Status. This parameter can be a ENABLE or DISABLE

Definition at line 455 of file stm8l15x_flash.c.

References DISABLE, ENABLE, FLASH_READOUTPROTECTION_KEY, and OPT.

void FLASH_ITConfig ( FunctionalState  NewState)

Enables or Disables the Flash interrupt mode.

Parameters:
NewState: The new state of the flash interrupt mode This parameter can be: ENABLE or DISABLE.
Return values:
None

Definition at line 541 of file stm8l15x_flash.c.

References DISABLE, FLASH, FLASH_CR1_IE, and IS_FUNCTIONAL_STATE.

void FLASH_Lock ( FLASH_MemType_TypeDef  FLASH_MemType)

Locks the program or data EEPROM memory.

Parameters:
FLASH_MemType: Memory type This parameter can be one of the following values:
  • FLASH_MemType_Program: Program memory
  • FLASH_MemType_Data: Data EEPROM memory
Return values:
None

Definition at line 297 of file stm8l15x_flash.c.

References FLASH, and IS_FLASH_MEMORY_TYPE.

void FLASH_PowerWaitModeConfig ( FLASH_Power_TypeDef  FLASH_Power)

Configures the power state for Flash program and data EEPROM during wait for interrupt mode.

Parameters:
FLASH_Power,:The power state for Flash program and data EEPROM during wait for interrupt mode This parameter can be one of the following values:
  • FLASH_Power_IDDQ: Flash program and data EEPROM in IDDQ
  • FLASH_Power_On: Flash program and data EEPROM not in IDDQ
Return values:
None

Definition at line 197 of file stm8l15x_flash.c.

References FLASH, FLASH_CR1_WAITM, FLASH_Power_On, and IS_FLASH_POWER.

void FLASH_ProgramByte ( uint32_t  Address,
uint8_t  Data 
)

Programs one byte in program or data EEPROM memory.

Parameters:
Address: Address where the byte will be programmed
Data: Value to be programmed
Return values:
None

Definition at line 311 of file stm8l15x_flash.c.

References IS_FLASH_ADDRESS, and PointerAttr.

void FLASH_ProgramOptionByte ( uint16_t  Address,
uint8_t  Data 
)

Programs option byte.

Parameters:
Address: option byte address to program
Data: Value to write
Return values:
None

Definition at line 410 of file stm8l15x_flash.c.

References FLASH, FLASH_CR2_OPT, FLASH_MemType_Program, IS_OPTION_BYTE_ADDRESS, and PointerAttr.

void FLASH_ProgramWord ( uint32_t  Address,
uint32_t  Data 
)

Programs one word (4 bytes) in program or data EEPROM memory.

Parameters:
Address: The address where the data will be programmed
Data: Value to be programmed
Return values:
None

Definition at line 338 of file stm8l15x_flash.c.

References FLASH, FLASH_CR2_WPRG, IS_FLASH_ADDRESS, and PointerAttr.

uint8_t FLASH_ReadByte ( uint32_t  Address)

Reads one byte from flash memory.

Parameters:
Address: Address to read
Return values:
Valueof the byte

Definition at line 360 of file stm8l15x_flash.c.

References PointerAttr.

void FLASH_SetProgrammingTime ( FLASH_ProgramTime_TypeDef  FLASH_ProgTime)

Sets the fixed programming time.

Parameters:
FLASH_ProgTime: Indicates the programming time to be fixed This parameter can be one of the following values:
  • FLASH_ProgramTime_Standard: Standard programming time fixed at 1/2 tprog
  • FLASH_ProgramTime_TProg: Programming time fixed at tprog
Return values:
None

Definition at line 168 of file stm8l15x_flash.c.

References FLASH, FLASH_CR1_FIX, and IS_FLASH_PROGRAM_TIME.

void FLASH_Unlock ( FLASH_MemType_TypeDef  FLASH_MemType)

Unlocks the program or data EEPROM memory.

Parameters:
FLASH_MemType: Memory type to unlock This parameter can be one of the following values:
  • FLASH_MemType_Program: Program memory
  • FLASH_MemType_Data: Data EEPROM memory
Return values:
None

Definition at line 269 of file stm8l15x_flash.c.

References FLASH, FLASH_MemType_Data, FLASH_MemType_Program, FLASH_RASS_KEY1, FLASH_RASS_KEY2, and IS_FLASH_MEMORY_TYPE.

IN_RAM ( void   FLASH_PowerRunModeConfigFLASH_Power_TypeDef FLASH_Power)
 All the functions declared below must be executed from RAM exclusively, except 
 for the FLASH_WaitForLastOperation function which can be executed from Flash.
 
 Steps of the execution from RAM differs from one toolchain to another.
 for more details refer to stm8l15x_flash.c file.
 
 To enable execution from RAM you can either uncomment the following define 
 in the stm8s.h file or define it in your toolchain compiler preprocessor
 - #define RAM_EXECUTION  (1) 
IN_RAM ( void   FLASH_EraseBlockuint16_t BlockNum, FLASH_MemType_TypeDef FLASH_MemType)
IN_RAM ( void   FLASH_ProgramBlockuint16_t BlockNum, FLASH_MemType_TypeDef FLASH_MemType, FLASH_ProgramMode_TypeDef FLASH_ProgMode, uint8_t *Buffer)
IN_RAM ( FLASH_Status_TypeDef   FLASH_WaitForLastOperationFLASH_MemType_TypeDef FLASH_MemType)
IN_RAM ( FLASH_PowerStatus_TypeDef   FLASH_GetPowerStatusvoid)
STM8S Firmware Library: Overview

 

 

 

For complete documentation on STM8L15x 8-bit microcontrollers platform visit www.st.com