Flash controller (MSC) peripheral API. More...
![]() |
Defines | |
#define | MSC_PROGRAM_TIMEOUT 10000000ul |
The timeout used while waiting for the flash to become ready after a write. This number indicates the number of iterations to perform before issuing a timeout. | |
Enumerations | |
enum | msc_Return_TypeDef { mscReturnOk = 0, mscReturnInvalidAddr = -1, mscReturnLocked = -2, mscReturnTimeOut = -3, mscReturnUnaligned = -4 } |
Functions | |
void | MSC_Deinit (void) |
Disables the flash controller for writing. | |
void | MSC_Init (void) |
Enables the flash controller for writing. | |
__STATIC_INLINE void | MSC_IntClear (uint32_t flags) |
Clear one or more pending MSC interrupts. | |
__STATIC_INLINE void | MSC_IntDisable (uint32_t flags) |
Disable one or more MSC interrupts. | |
__STATIC_INLINE void | MSC_IntEnable (uint32_t flags) |
Enable one or more MSC interrupts. | |
__STATIC_INLINE uint32_t | MSC_IntGet (void) |
Get pending MSV interrupt flags. | |
__STATIC_INLINE void | MSC_IntSet (uint32_t flags) |
Set one or more pending MSC interrupts from SW. | |
msc_Return_TypeDef | MSC_WriteWord (uint32_t *address, void const *data, int numBytes) |
Writes a single word to flash memory. Data to write must be aligned to words and contain a number of bytes that is divisable by four. | |
msc_Return_TypeDef | MSC_ErasePage (uint32_t *startAddress) |
Erases a page in flash memory. |
Flash controller (MSC) peripheral API.
Flash controller (MSC) Peripheral API.
#define MSC_PROGRAM_TIMEOUT 10000000ul |
The timeout used while waiting for the flash to become ready after a write. This number indicates the number of iterations to perform before issuing a timeout.
Definition at line 73 of file em_msc.h.
Referenced by MSC_ErasePage().
enum msc_Return_TypeDef |
Return codes for writing/erasing the flash
void MSC_Deinit | ( | void | ) |
msc_Return_TypeDef MSC_ErasePage | ( | uint32_t * | startAddress | ) |
Erases a page in flash memory.
[in] | startAddress | Pointer to the flash page to erase. Must be aligned to beginning of page boundary. |
* mscReturnOk - Operation completed successfully. * mscReturnInvalidAddr - Operation tried to erase a non-flash area. * mscReturnLocked - Operation tried to erase a locked area of the flash. * mscReturnTimeOut - Operation timed out waiting for flash operation * to complete. *
Definition at line 436 of file em_msc.c.
References MSC_PROGRAM_TIMEOUT, mscReturnInvalidAddr, mscReturnLocked, mscReturnOk, and mscReturnTimeOut.
void MSC_Init | ( | void | ) |
Enables the flash controller for writing.
Definition at line 95 of file em_msc.c.
References CMU_ClockFreqGet(), and cmuClock_AUX.
__STATIC_INLINE void MSC_IntClear | ( | uint32_t | flags | ) |
__STATIC_INLINE void MSC_IntDisable | ( | uint32_t | flags | ) |
__STATIC_INLINE void MSC_IntEnable | ( | uint32_t | flags | ) |
Enable one or more MSC interrupts.
[in] | flags | MSC interrupt sources to enable. Use a bitwise logic OR combination of valid interrupt flags for the MSC module (MSC_IF_nnn). |
__STATIC_INLINE uint32_t MSC_IntGet | ( | void | ) |
__STATIC_INLINE void MSC_IntSet | ( | uint32_t | flags | ) |
msc_Return_TypeDef MSC_WriteWord | ( | uint32_t * | address, | |
void const * | data, | |||
int | numBytes | |||
) |
Writes a single word to flash memory. Data to write must be aligned to words and contain a number of bytes that is divisable by four.
[in] | address | Pointer to the flash word to write to. Must be aligned to words. |
[in] | data | Data to write to flash. |
[in] | numBytes | Number of bytes to write from flash. NB: Must be divisable by four. |
* flashReturnOk - Operation completed successfully. * flashReturnInvalidAddr - Operation tried to erase a non-flash area. * flashReturnLocked - Operation tried to erase a locked area of the flash. * flashReturnTimeOut - Operation timed out waiting for flash operation * to complete. Or the MSC timed out waiting for the software to write * the next word into the DWORD register. This may happen, for instance, * when an interrupt occurs during a flash burst write transaction. In * order to prevent this situation, the user should call INT_Disable * before MSC_WriteWord and INT_Enable after. *
Definition at line 539 of file em_msc.c.
References mscReturnOk.