Imt.Base C++ API V4.1.1.0
Loading...
Searching...
No Matches
SystemPeripherals_Flash.h File Reference

Go to the source code of this file.

Enumerations

enum  FLASH_Status {
  FLASH_BUSY = 1 , FLASH_ERROR_PG , FLASH_ERROR_WRP , FLASH_ERROR_READ ,
  FLASH_COMPLETE , FLASH_TIMEOUT
}
 Flash peripheral module. More...
 
enum  FLASH_Latency { FLASH_Latency_0 = ((uint32_t)0x00000000U) , FLASH_Latency_1 = ((uint32_t)0x00000001U) , FLASH_Latency_2 = ((uint32_t)0x00000002U) }
 Flash latency cycles emumeration. More...
 
enum  FLASH_HalfCycleAccess { FLASH_HalfCycleAccess_Enable = ((uint32_t)0x00000008U) , FLASH_HalfCycleAccess_Disable = ((uint32_t)0x00000000U) }
 Flash half cycle access emumeration. More...
 
enum  FLASH_PrefetchBuffer { FLASH_PrefetchBuffer_Enable = ((uint32_t)0x00000010U) , FLASH_PrefetchBuffer_Disable = ((uint32_t)0x00000000U) }
 Flash prefetch buffer emumeration. More...
 
enum  FLASH_Irq { FLASH_Irq_Error = ((uint32_t)0x00000400U) , FLASH_Irq_EndOfOperation = ((uint32_t)0x00001000U) }
 Flash IRQ emumeration. More...
 

Functions

void FLASH_SetLatency (FLASH_Latency const latency)
 Sets the code latency value.
 
void FLASH_HalfCycleAccessCmd (FLASH_HalfCycleAccess const halfCycleAccess)
 Enables or disables the Half cycle flash access.
 
void FLASH_PrefetchBufferCmd (FLASH_PrefetchBuffer const prefetchBuffer)
 Enables or disables the Prefetch Buffer.
 
void FLASH_EnableInterrupt (FLASH_Irq const irq, bool const doEnable)
 Enables or disables the specified flash IRQ.
 
void FLASH_Unlock ()
 Unlocks the FLASH Program Erase Controller.
 
void FLASH_Lock ()
 Locks the FLASH Program Erase Controller.
 
FLASH_Status FLASH_ErasePage (uint32_t const pageAddress)
 Erases a specified FLASH page.
 
FLASH_Status FLASH_ErasePageAsync (uint32_t const pageAddress)
 Starts ereasing a specified FLASH page asynchronous.
 
void FLASH_ErasePageFinish ()
 Completes ereasing a page by cleraing the erease bit.
 
FLASH_Status FLASH_ProgramDoubleWord (uint32_t const address, uint32_t const data)
 Programs a double word (32 bit) at a specified address and blocks until the word has been written.
 
bool FLASH_ProgramWordAsync (uint32_t const address, uint16_t const data)
 Starts programming a word (16 bit) at a specified address and returns.
 
void FLASH_ProgramWordFinish ()
 Completes programming a word by cleraing the write bit.
 
bool FLASH_IsFlag (uint32_t const flag)
 Checks if a FLASH flag is pending.
 
void FLASH_ClearFlag (uint32_t const flag)
 Clears the FLASH's pending flags.
 
FLASH_Status FLASH_GetStatus ()
 Returns the FLASH Status.
 
FLASH_Status FLASH_WaitForLastOperation (uint32_t const timeout)
 Waits for a Flash operation to complete or a TIMEOUT to occur.
 
FLASH_Status FLASH_ReadBlock (uint32_t const address, uint8_t *pBuffer, uint32_t const bufferSize)
 Reads a block of memory from the flash.
 

Enumeration Type Documentation

◆ FLASH_HalfCycleAccess

Flash half cycle access emumeration.

Enumerator
FLASH_HalfCycleAccess_Enable 
FLASH_HalfCycleAccess_Disable 

Definition at line 50 of file SystemPeripherals_Flash.h.

◆ FLASH_Irq

enum FLASH_Irq

Flash IRQ emumeration.

Enumerator
FLASH_Irq_Error 
FLASH_Irq_EndOfOperation 

Definition at line 70 of file SystemPeripherals_Flash.h.

◆ FLASH_Latency

Flash latency cycles emumeration.

Enumerator
FLASH_Latency_0 
FLASH_Latency_1 
FLASH_Latency_2 

Definition at line 38 of file SystemPeripherals_Flash.h.

◆ FLASH_PrefetchBuffer

Flash prefetch buffer emumeration.

Enumerator
FLASH_PrefetchBuffer_Enable 
FLASH_PrefetchBuffer_Disable 

Definition at line 60 of file SystemPeripherals_Flash.h.

◆ FLASH_Status

Flash peripheral module.

Reference: ST_CortexM3_STM32F103_TRM_Rev15.pdf Reference: ST_CortexM3_STM32F103_HD_Datasheet_Rev12.pdf Reference: ST_CortexM3_STM32F103_Flash_programming_manual_Rev2.pdf Flash status emumeration.

Enumerator
FLASH_BUSY 
FLASH_ERROR_PG 
FLASH_ERROR_WRP 
FLASH_ERROR_READ 
FLASH_COMPLETE 
FLASH_TIMEOUT 

Definition at line 26 of file SystemPeripherals_Flash.h.

Function Documentation

◆ FLASH_ClearFlag()

void FLASH_ClearFlag ( uint32_t const  flag)

Clears the FLASH's pending flags.

Parameters
flagspecifies the FLASH flags to clear. This parameter can be any combination of the following values:
  • FLASH_FLAG_PGERR: FLASH Program error flag
  • FLASH_FLAG_WRPRTERR: FLASH Write protected error flag
  • FLASH_FLAG_EOP: FLASH End of Operation flag

◆ FLASH_EnableInterrupt()

void FLASH_EnableInterrupt ( FLASH_Irq const  irq,
bool const  doEnable 
)

Enables or disables the specified flash IRQ.

Parameters
irqSelect the IRQ to enable/disable.
doEnabletrue IRQ would be enabled false IRQ would be disabled

◆ FLASH_ErasePage()

FLASH_Status FLASH_ErasePage ( uint32_t const  pageAddress)

Erases a specified FLASH page.

Parameters
pageAddressThe page address to be erased.
Returns
FLASH_Status: The returned value can be: FLASH_BUSY, FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.

◆ FLASH_ErasePageAsync()

FLASH_Status FLASH_ErasePageAsync ( uint32_t const  pageAddress)

Starts ereasing a specified FLASH page asynchronous.

Parameters
pageAddressThe page address to be erased.
Returns
FLASH_Status: The returned value can be: FLASH_BUSY, FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE.

◆ FLASH_ErasePageFinish()

void FLASH_ErasePageFinish ( )

Completes ereasing a page by cleraing the erease bit.

◆ FLASH_GetStatus()

FLASH_Status FLASH_GetStatus ( )

Returns the FLASH Status.

Returns
FLASH_Status: The returned value can be: FLASH_BUSY, FLASH_ERROR_PG, FLASH_ERROR_WRP or FLASH_COMPLETE

◆ FLASH_HalfCycleAccessCmd()

void FLASH_HalfCycleAccessCmd ( FLASH_HalfCycleAccess const  halfCycleAccess)

Enables or disables the Half cycle flash access.

Parameters
halfCycleAccessspecifies the FLASH Half cycle Access mode.

◆ FLASH_IsFlag()

bool FLASH_IsFlag ( uint32_t const  flag)

Checks if a FLASH flag is pending.

Parameters
flagspecifies the FLASH flags to check. This parameter can be any of the following values:
  • FLASH_FLAG_PGERR: FLASH Program error flag
  • FLASH_FLAG_WRPRTERR: FLASH Write protected error flag
  • FLASH_FLAG_EOP: FLASH End of Operation flag
Returns
true when flag is pending, false otherwise

◆ FLASH_Lock()

void FLASH_Lock ( )

Locks the FLASH Program Erase Controller.

◆ FLASH_PrefetchBufferCmd()

void FLASH_PrefetchBufferCmd ( FLASH_PrefetchBuffer const  prefetchBuffer)

Enables or disables the Prefetch Buffer.

Parameters
prefetchBufferspecifies the Prefetch buffer status.

◆ FLASH_ProgramDoubleWord()

FLASH_Status FLASH_ProgramDoubleWord ( uint32_t const  address,
uint32_t const  data 
)

Programs a double word (32 bit) at a specified address and blocks until the word has been written.

Parameters
addressspecifies the address to be programmed.
dataspecifies the data to be programmed.
Returns
FLASH_Status: The returned value can be: FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.

◆ FLASH_ProgramWordAsync()

bool FLASH_ProgramWordAsync ( uint32_t const  address,
uint16_t const  data 
)

Starts programming a word (16 bit) at a specified address and returns.

Use FLASH_WaitForLastOperation or the EOP interrupt to wait on the eond of the programming.

Parameters
addressspecifies the address to be programmed.
dataspecifies the data to be programmed.
Returns
True if programming has been started.

◆ FLASH_ProgramWordFinish()

void FLASH_ProgramWordFinish ( )

Completes programming a word by cleraing the write bit.

◆ FLASH_ReadBlock()

FLASH_Status FLASH_ReadBlock ( uint32_t const  address,
uint8_t pBuffer,
uint32_t const  bufferSize 
)

Reads a block of memory from the flash.

Parameters
addressspecifies the address to be read.
pBufferthe buffer the block is read into.
bufferSizethe number of bytes to read.
Returns
FLASH_Status: The returned value can be: FLASH_ERROR_READ or FLASH_COMPLETE or FLASH_TIMEOUT.

◆ FLASH_SetLatency()

void FLASH_SetLatency ( FLASH_Latency const  latency)

Sets the code latency value.

Parameters
latencyspecifies the FLASH Latency value.

◆ FLASH_Unlock()

void FLASH_Unlock ( )

Unlocks the FLASH Program Erase Controller.

◆ FLASH_WaitForLastOperation()

FLASH_Status FLASH_WaitForLastOperation ( uint32_t const  timeout)

Waits for a Flash operation to complete or a TIMEOUT to occur.

Parameters
timeoutFLASH programming Timeout
Returns
FLASH_Status: FLASH Status: The returned value can be: FLASH_ERROR_PG, FLASH_ERROR_WRP, FLASH_COMPLETE or FLASH_TIMEOUT.