Imt.Base C++ API V4.1.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SystemPeripherals_Flash.h
Go to the documentation of this file.
1// (c) IMT - Information Management Technology AG, CH-9470 Buchs, www.imt.ch.
2
3#ifndef SYSTEMPERIPHERALS_FLASH_H
4#define SYSTEMPERIPHERALS_FLASH_H
5
7
8#include "SystemMemoryMap.h"
9
10// Determine if a C++ compiler is being used. If so, ensure that standard C is used to process the API information.
11#ifdef __cplusplus
12extern "C" {
13#endif // __cplusplus
14
26typedef enum {
34
38typedef enum {
39 // FLASH Zero Latency cycle
40 FLASH_Latency_0 = ((uint32_t)0x00000000U),
41 // FLASH One Latency cycle
42 FLASH_Latency_1 = ((uint32_t)0x00000001U),
43 // FLASH Two Latency cycles
44 FLASH_Latency_2 = ((uint32_t)0x00000002U)
46
50typedef enum {
51 // FLASH Half Cycle Enable
53 // FLASH Half Cycle Disable
56
60typedef enum {
61 // FLASH Prefetch Buffer Enable
63 // FLASH Prefetch Buffer Disable
66
70typedef enum {
71 // FLASH error interrupt generated on FPEC error
72 FLASH_Irq_Error = ((uint32_t)0x00000400U),
73 // FLASH EOP interrupt
75} FLASH_Irq;
76
80static uint32_t const FLASH_FLAG_BSY = 0x00000001U;
81
85static uint32_t const FLASH_FLAG_EOP = 0x00000020U;
86
90static uint32_t const FLASH_FLAG_PGERR = 0x00000004U;
91
95static uint32_t const FLASH_FLAG_WRPRTERR = 0x00000010U;
96
100static uint32_t const FLASH_FLAG_OPTERR = 0x00000001U;
101
106void FLASH_SetLatency(FLASH_Latency const latency);
107
113
119
126void FLASH_EnableInterrupt(FLASH_Irq const irq, bool const doEnable);
127
132
137
145
153
158
167
175bool FLASH_ProgramWordAsync(uint32_t const address, uint16_t const data);
176
181
191bool FLASH_IsFlag(uint32_t const flag);
192
201void FLASH_ClearFlag(uint32_t const flag);
202
209
217
225FLASH_Status FLASH_ReadBlock(uint32_t const address, uint8_t* pBuffer, uint32_t const bufferSize);
226
227#ifdef __cplusplus
228}
229#endif // __cplusplus
230#endif // SYSTEMPERIPHERALS_FLASH_H
FLASH_PrefetchBuffer
Flash prefetch buffer emumeration.
@ FLASH_PrefetchBuffer_Disable
@ FLASH_PrefetchBuffer_Enable
bool FLASH_IsFlag(uint32_t const flag)
Checks if a FLASH flag is pending.
FLASH_Status FLASH_ReadBlock(uint32_t const address, uint8_t *pBuffer, uint32_t const bufferSize)
Reads a block of memory from the flash.
void FLASH_EnableInterrupt(FLASH_Irq const irq, bool const doEnable)
Enables or disables the specified flash IRQ.
FLASH_Status FLASH_ErasePage(uint32_t const pageAddress)
Erases a specified FLASH page.
void FLASH_ErasePageFinish()
Completes ereasing a page by cleraing the erease bit.
void FLASH_Unlock()
Unlocks the FLASH Program Erase Controller.
void FLASH_SetLatency(FLASH_Latency const latency)
Sets the code latency value.
FLASH_Status FLASH_GetStatus()
Returns the FLASH Status.
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.
FLASH_Latency
Flash latency cycles emumeration.
FLASH_Status FLASH_WaitForLastOperation(uint32_t const timeout)
Waits for a Flash operation to complete or a TIMEOUT to occur.
FLASH_Irq
Flash IRQ emumeration.
@ FLASH_Irq_EndOfOperation
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.
FLASH_Status FLASH_ErasePageAsync(uint32_t const pageAddress)
Starts ereasing a specified FLASH page asynchronous.
void FLASH_Lock()
Locks the FLASH Program Erase Controller.
void FLASH_HalfCycleAccessCmd(FLASH_HalfCycleAccess const halfCycleAccess)
Enables or disables the Half cycle flash access.
void FLASH_ClearFlag(uint32_t const flag)
Clears the FLASH's pending flags.
void FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer const prefetchBuffer)
Enables or disables the Prefetch Buffer.
FLASH_Status
Flash peripheral module.
FLASH_HalfCycleAccess
Flash half cycle access emumeration.
@ FLASH_HalfCycleAccess_Disable
@ FLASH_HalfCycleAccess_Enable
unsigned __int16 uint16_t
Definition stdint.h:63
unsigned __int32 uint32_t
Definition stdint.h:64
unsigned __int8 uint8_t
Definition stdint.h:62