STM8S/A Standard Peripherals Drivers: FLASH_Exported_Functions

STM8S/A Standard Peripherals Library

STM8S/A Standard Peripherals Drivers
FLASH_Exported_Functions

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.
uint32_t FLASH_GetBootSize (void)
 Returns the Boot memory size in bytes.
FlagStatus FLASH_GetFlagStatus (FLASH_Flag_TypeDef FLASH_FLAG)
 Checks whether the specified SPI flag is set or not.
FLASH_LPMode_TypeDef FLASH_GetLowPowerMode (void)
 Returns the Flash behaviour type in low power mode.
FLASH_ProgramTime_TypeDef FLASH_GetProgrammingTime (void)
 Returns the fixed programming time.
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_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 any byte from flash memory.
uint16_t FLASH_ReadOptionByte (uint16_t Address)
 Reads one option byte.
void FLASH_SetLowPowerMode (FLASH_LPMode_TypeDef FLASH_LPMode)
 Select the Flash behaviour in low power mode.
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_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))

Function Documentation

void FLASH_DeInit ( void  )

DeInitializes the FLASH registers to their default reset values.

Parameters:
None
Return values:
None

Definition at line 126 of file stm8s_flash.c.

References FLASH, FLASH_CR1_RESET_VALUE, FLASH_CR2_RESET_VALUE, FLASH_IAPSR_DUL, FLASH_IAPSR_PUL, and FLASH_NCR2_RESET_VALUE.

void FLASH_EraseByte ( uint32_t  Address)

Erases one byte in the program or data EEPROM memory.

Note:
PointerAttr define is declared in the stm8s.h file to select if the pointer will be declared as near (2 bytes) or far (3 bytes).
Parameters:
Address: Address of the byte to erase
Return values:
None

Definition at line 164 of file stm8s_flash.c.

References FLASH_CLEAR_BYTE, IS_FLASH_ADDRESS_OK, MemoryAddressCast, and PointerAttr.

void FLASH_EraseOptionByte ( uint16_t  Address)

Erases option byte.

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

Definition at line 270 of file stm8s_flash.c.

References FLASH, FLASH_CLEAR_BYTE, FLASH_CR2_OPT, FLASH_MEMTYPE_PROG, FLASH_NCR2_NOPT, FLASH_SET_BYTE, IS_OPTION_BYTE_ADDRESS_OK, and NEAR.

uint32_t FLASH_GetBootSize ( void  )

Returns the Boot memory size in bytes.

Parameters:
None
Return values:
Bootmemory size in bytes

Definition at line 392 of file stm8s_flash.c.

References FLASH.

FlagStatus FLASH_GetFlagStatus ( FLASH_Flag_TypeDef  FLASH_FLAG)

Checks whether the specified SPI flag is set or not.

Parameters:
FLASH_FLAG: Specifies the flag to check. This parameter can be any of the FLASH_Flag_TypeDef enumeration.
Return values:
FlagStatus: Indicates the state of FLASH_FLAG. This parameter can be any of the FlagStatus enumeration.
Note:
This function can clear the EOP, WR_PG_DIS flags in the IAPSR register.

Definition at line 417 of file stm8s_flash.c.

References FLASH, IS_FLASH_FLAGS_OK, RESET, and SET.

FLASH_LPMode_TypeDef FLASH_GetLowPowerMode ( void  )

Returns the Flash behaviour type in low power mode.

Parameters:
None
Return values:
FLASH_LPMode_TypeDefFlash behaviour type in low power mode

Definition at line 372 of file stm8s_flash.c.

References FLASH, FLASH_CR1_AHALT, and FLASH_CR1_HALT.

FLASH_ProgramTime_TypeDef FLASH_GetProgrammingTime ( void  )

Returns the fixed programming time.

Parameters:
None
Return values:
FLASH_ProgramTime_TypeDefFixed programming time value

Definition at line 382 of file stm8s_flash.c.

References FLASH, and FLASH_CR1_FIX.

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 a value of FunctionalState enumeration.
Return values:
None

Definition at line 142 of file stm8s_flash.c.

References DISABLE, FLASH, FLASH_CR1_IE, and IS_FUNCTIONALSTATE_OK.

void FLASH_Lock ( FLASH_MemType_TypeDef  FLASH_MemType)

Locks the program or data EEPROM memory.

Parameters:
FLASH_MemType: Memory type This parameter can be a value of FLASH_MemType_TypeDef
Return values:
None

Definition at line 112 of file stm8s_flash.c.

References FLASH, and IS_MEMORY_TYPE_OK.

void FLASH_ProgramByte ( uint32_t  Address,
uint8_t  Data 
)

Programs one byte in program or data EEPROM memory.

Note:
PointerAttr define is declared in the stm8s.h file to select if the pointer will be declared as near (2 bytes) or far (3 bytes).
Parameters:
Address: Address where the byte will be programmed
Data: Value to be programmed
Return values:
None

Definition at line 181 of file stm8s_flash.c.

References IS_FLASH_ADDRESS_OK, MemoryAddressCast, 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 237 of file stm8s_flash.c.

References FLASH, FLASH_CR2_OPT, FLASH_MEMTYPE_PROG, FLASH_NCR2_NOPT, IS_OPTION_BYTE_ADDRESS_OK, and NEAR.

void FLASH_ProgramWord ( uint32_t  Address,
uint32_t  Data 
)

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

Note:
PointerAttr define is declared in the stm8s.h file to select if the pointer will be declared as near (2 bytes) or far (3 bytes).
Parameters:
Address: The address where the data will be programmed
Data: Value to be programmed
Return values:
None

Definition at line 212 of file stm8s_flash.c.

References FLASH, FLASH_CR2_WPRG, FLASH_NCR2_NWPRG, IS_FLASH_ADDRESS_OK, MemoryAddressCast, and PointerAttr.

uint8_t FLASH_ReadByte ( uint32_t  Address)

Reads any byte from flash memory.

Note:
PointerAttr define is declared in the stm8s.h file to select if the pointer will be declared as near (2 bytes) or far (3 bytes).
Parameters:
Address: Address to read
Return values:
Valueof the byte

Definition at line 195 of file stm8s_flash.c.

References IS_FLASH_ADDRESS_OK, MemoryAddressCast, and PointerAttr.

uint16_t FLASH_ReadOptionByte ( uint16_t  Address)

Reads one option byte.

Parameters:
Addressoption byte address to read.
Return values:
Optionbyte read value + its complement

Definition at line 303 of file stm8s_flash.c.

References FLASH_OPTIONBYTE_ERROR, IS_OPTION_BYTE_ADDRESS_OK, and NEAR.

void FLASH_SetLowPowerMode ( FLASH_LPMode_TypeDef  FLASH_LPMode)

Select the Flash behaviour in low power mode.

Parameters:
FLASH_LPModeLow power mode selection This parameter can be any of the FLASH_LPMode_TypeDef values.
Return values:
None

Definition at line 340 of file stm8s_flash.c.

References FLASH, FLASH_CR1_AHALT, FLASH_CR1_HALT, and IS_FLASH_LOW_POWER_MODE_OK.

void FLASH_SetProgrammingTime ( FLASH_ProgramTime_TypeDef  FLASH_ProgTime)

Sets the fixed programming time.

Parameters:
FLASH_ProgTimeIndicates the programming time to be fixed This parameter can be any of the FLASH_ProgramTime_TypeDef values.
Return values:
None

Definition at line 358 of file stm8s_flash.c.

References FLASH, FLASH_CR1_FIX, and IS_FLASH_PROGRAM_TIME_OK.

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 a value of FLASH_MemType_TypeDef
Return values:
None

Definition at line 87 of file stm8s_flash.c.

References FLASH, FLASH_MEMTYPE_PROG, FLASH_RASS_KEY1, FLASH_RASS_KEY2, and IS_MEMORY_TYPE_OK.

IN_RAM ( void   FLASH_EraseBlockuint16_t BlockNum, FLASH_MemType_TypeDef FLASH_MemType)
 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 stm8s_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_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)
STM8 Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM8 8-bit Microcontrollers platform visit www.st.com