Data Structures | Macros | Typedefs | Functions
FlashCtl_A

Module for erasing, programming, verifying and configuring different functionalities of the Flash IP. More...

Data Structures

struct  __sFlashCtl_ProtectionRegister
 

Macros

#define FLASH_A_BURST_PRG_BIT   0x03
 
#define FLASH_A_SECTOR_SIZE   4096
 
#define FLASH_A_PROGRAM_ERROR   FLCTL_A_IFG_PRG_ERR
 
#define FLASH_A_BENCHMARK_INT   FLCTL_A_IFG_BMRK
 
#define FLASH_A_ERASE_COMPLETE   FLCTL_A_IFG_ERASE
 
#define FLASH_A_BRSTPRGM_COMPLETE   FLCTL_A_IFG_PRGB
 
#define FLASH_A_WRDPRGM_COMPLETE   FLCTL_A_IFG_PRG
 
#define FLASH_A_POSTVERIFY_FAILED   FLCTL_A_IFG_AVPST
 
#define FLASH_A_PREVERIFY_FAILED   FLCTL_A_IFG_AVPRE
 
#define FLASH_A_BRSTRDCMP_COMPLETE   FLCTL_A_IFG_RDBRST
 
#define FLASH_A_NORMAL_READ_MODE   FLCTL_A_BANK0_RDCTL_RD_MODE_0
 
#define FLASH_A_MARGIN0_READ_MODE   FLCTL_A_BANK0_RDCTL_RD_MODE_1
 
#define FLASH_A_MARGIN1_READ_MODE   FLCTL_A_BANK0_RDCTL_RD_MODE_2
 
#define FLASH_A_PROGRAM_VERIFY_READ_MODE   FLCTL_A_BANK0_RDCTL_RD_MODE_3
 
#define FLASH_A_ERASE_VERIFY_READ_MODE   FLCTL_A_BANK0_RDCTL_RD_MODE_4
 
#define FLASH_A_LEAKAGE_VERIFY_READ_MODE   FLCTL_A_BANK0_RDCTL_RD_MODE_5
 
#define FLASH_A_MARGIN0B_READ_MODE   FLCTL_A_BANK0_RDCTL_RD_MODE_9
 
#define FLASH_A_MARGIN1B_READ_MODE   FLCTL_A_BANK0_RDCTL_RD_MODE_10
 
#define FLASH_A_PRGBRSTCTLSTAT_BURSTSTATUS_COMPLETE   FLCTL_A_PRGBRST_CTLSTAT_BURST_STATUS_7
 
#define FLASH_A_BANK0   0x00
 
#define FLASH_A_BANK1   0x01
 
#define FLASH_A_DATA_READ   0x00
 
#define FLASH_A_INSTRUCTION_FETCH   0x01
 
#define FLASH_A_MAIN_MEMORY_SPACE_BANK0   0x01
 
#define FLASH_A_MAIN_MEMORY_SPACE_BANK1   0x02
 
#define FLASH_A_INFO_MEMORY_SPACE_BANK0   0x03
 
#define FLASH_A_INFO_MEMORY_SPACE_BANK1   0x04
 
#define FLASH_A_MAIN_SPACE   FLCTL_A_RDBRST_CTLSTAT_MEM_TYPE_0
 
#define FLASH_A_INFO_SPACE   FLCTL_A_RDBRST_CTLSTAT_MEM_TYPE_1
 
#define FLASH_A_1_PATTERN   FLCTL_A_RDBRST_CTLSTAT_DATA_CMP
 
#define FLASH_A_0_PATTERN   0x00
 
#define FLASH_A_SECTOR0   FLCTL_A_BANK0_MAIN_WEPROT_PROT0
 
#define FLASH_A_SECTOR1   FLCTL_A_BANK0_MAIN_WEPROT_PROT1
 
#define FLASH_A_SECTOR2   FLCTL_A_BANK0_MAIN_WEPROT_PROT2
 
#define FLASH_A_SECTOR3   FLCTL_A_BANK0_MAIN_WEPROT_PROT3
 
#define FLASH_A_SECTOR4   FLCTL_A_BANK0_MAIN_WEPROT_PROT4
 
#define FLASH_A_SECTOR5   FLCTL_A_BANK0_MAIN_WEPROT_PROT5
 
#define FLASH_A_SECTOR6   FLCTL_A_BANK0_MAIN_WEPROT_PROT6
 
#define FLASH_A_SECTOR7   FLCTL_A_BANK0_MAIN_WEPROT_PROT7
 
#define FLASH_A_SECTOR8   FLCTL_A_BANK0_MAIN_WEPROT_PROT8
 
#define FLASH_A_SECTOR9   FLCTL_A_BANK0_MAIN_WEPROT_PROT9
 
#define FLASH_A_SECTOR10   FLCTL_A_BANK0_MAIN_WEPROT_PROT10
 
#define FLASH_A_SECTOR11   FLCTL_A_BANK0_MAIN_WEPROT_PROT11
 
#define FLASH_A_SECTOR12   FLCTL_A_BANK0_MAIN_WEPROT_PROT12
 
#define FLASH_A_SECTOR13   FLCTL_A_BANK0_MAIN_WEPROT_PROT13
 
#define FLASH_A_SECTOR14   FLCTL_A_BANK0_MAIN_WEPROT_PROT14
 
#define FLASH_A_SECTOR15   FLCTL_A_BANK0_MAIN_WEPROT_PROT15
 
#define FLASH_A_SECTOR16   FLCTL_A_BANK0_MAIN_WEPROT_PROT16
 
#define FLASH_A_SECTOR17   FLCTL_A_BANK0_MAIN_WEPROT_PROT17
 
#define FLASH_A_SECTOR18   FLCTL_A_BANK0_MAIN_WEPROT_PROT18
 
#define FLASH_A_SECTOR19   FLCTL_A_BANK0_MAIN_WEPROT_PROT19
 
#define FLASH_A_SECTOR20   FLCTL_A_BANK0_MAIN_WEPROT_PROT20
 
#define FLASH_A_SECTOR21   FLCTL_A_BANK0_MAIN_WEPROT_PROT21
 
#define FLASH_A_SECTOR22   FLCTL_A_BANK0_MAIN_WEPROT_PROT22
 
#define FLASH_A_SECTOR23   FLCTL_A_BANK0_MAIN_WEPROT_PROT23
 
#define FLASH_A_SECTOR24   FLCTL_A_BANK0_MAIN_WEPROT_PROT24
 
#define FLASH_A_SECTOR25   FLCTL_A_BANK0_MAIN_WEPROT_PROT25
 
#define FLASH_A_SECTOR26   FLCTL_A_BANK0_MAIN_WEPROT_PROT26
 
#define FLASH_A_SECTOR27   FLCTL_A_BANK0_MAIN_WEPROT_PROT27
 
#define FLASH_A_SECTOR28   FLCTL_A_BANK0_MAIN_WEPROT_PROT28
 
#define FLASH_A_SECTOR29   FLCTL_A_BANK0_MAIN_WEPROT_PROT29
 
#define FLASH_A_SECTOR30   FLCTL_A_BANK0_MAIN_WEPROT_PROT30
 
#define FLASH_A_SECTOR31   FLCTL_A_BANK0_MAIN_WEPROT_PROT31
 
#define FLASH_A_NOVER   0
 
#define FLASH_A_BURSTPOST   FLCTL_A_PRGBRST_CTLSTAT_AUTO_PST
 
#define FLASH_A_BURSTPRE   FLCTL_A_PRGBRST_CTLSTAT_AUTO_PRE
 
#define FLASH_A_REGPRE   FLCTL_A_PRG_CTLSTAT_VER_PRE
 
#define FLASH_A_REGPOST   FLCTL_A_PRG_CTLSTAT_VER_PST
 
#define FLASH_A_FULLVER
 
#define FLASH_A_COLLATED_WRITE_MODE   0x01
 
#define FLASH_A_IMMEDIATE_WRITE_MODE   0x02
 
#define __INFO_FLASH_A_TECH_START__   0x00200000
 
#define __INFO_FLASH_A_TECH_MIDDLE__   0x00204000
 

Typedefs

typedef struct
__sFlashCtl_ProtectionRegister 
__FlashCtl_ProtectionRegister
 

Functions

void FlashCtl_A_getMemoryInfo (uint32_t addr, uint32_t *bankNum, uint32_t *sectorNum)
 
void FlashCtl_A_enableReadBuffering (uint_fast8_t memoryBank, uint_fast8_t accessMethod)
 
void FlashCtl_A_disableReadBuffering (uint_fast8_t memoryBank, uint_fast8_t accessMethod)
 
bool FlashCtl_A_protectMemory (uint32_t startAddr, uint32_t endAddr)
 
bool FlashCtl_A_unprotectMemory (uint32_t startAddr, uint32_t endAddr)
 
bool FlashCtl_A_isMemoryRangeProtected (uint32_t startAddr, uint32_t endAddr)
 
bool FlashCtl_A_isMemoryProtected (uint32_t addr)
 
bool FlashCtl_A_verifyMemory (void *verifyAddr, uint32_t length, uint_fast8_t pattern)
 
bool FlashCtl_A_performMassErase (void)
 
void FlashCtl_A_initiateMassErase (void)
 
bool FlashCtl_A_eraseSector (uint32_t addr)
 
bool FlashCtl_A_programMemory (void *src, void *dest, uint32_t length)
 
void FlashCtl_A_setProgramVerification (uint32_t verificationSetting)
 
void FlashCtl_A_clearProgramVerification (uint32_t verificationSetting)
 
void FlashCtl_A_enableWordProgramming (uint32_t mode)
 
void FlashCtl_A_disableWordProgramming (void)
 
uint32_t FlashCtl_A_isWordProgrammingEnabled (void)
 
bool FlashCtl_A_setReadMode (uint32_t flashBank, uint32_t readMode)
 
uint32_t FlashCtl_A_getReadMode (uint32_t flashBank)
 
void FlashCtl_A_setWaitState (uint32_t bank, uint32_t waitState)
 
uint32_t FlashCtl_A_getWaitState (uint32_t bank)
 
void FlashCtl_A_enableInterrupt (uint32_t flags)
 
void FlashCtl_A_disableInterrupt (uint32_t flags)
 
uint32_t FlashCtl_A_getEnabledInterruptStatus (void)
 
uint32_t FlashCtl_A_getInterruptStatus (void)
 
void FlashCtl_A_clearInterruptFlag (uint32_t flags)
 
void FlashCtl_A_registerInterrupt (void(*intHandler)(void))
 
void FlashCtl_A_unregisterInterrupt (void)
 
void FlashCtl_A_initiateSectorErase (uint32_t addr)
 
uint8_t __FlashCtl_A_remaskData8Post (uint8_t data, uint32_t addr)
 
uint8_t __FlashCtl_A_remaskData8Pre (uint8_t data, uint32_t addr)
 
uint32_t __FlashCtl_A_remaskData32Post (uint32_t data, uint32_t addr)
 
uint32_t __FlashCtl_A_remaskData32Pre (uint32_t data, uint32_t addr)
 
void __FlashCtl_A_remaskBurstDataPost (uint32_t addr, uint32_t size)
 
void __FlashCtl_A_remaskBurstDataPre (uint32_t addr, uint32_t size)
 

Detailed Description

Module for erasing, programming, verifying and configuring different functionalities of the Flash IP.


Module Operation


Note that this module is for use exclusively on the MSP432P4111. If using the MSP432P401, please refer to the non-a variant.

The MSP432 DriverLib Flash Controller A peripheral is designed to simplify the process or writing, erasing, and configuring the flash memory on the MSP432 part. Many of the stringent verification requirements/preconditions are handled entirely inside the FlashCtl APIs.


Flash Controller Limitations


When utilizing the flash controller for MSP432, the user program has to take special consideration on a few critical limitations. The biggest obstacle that the user has to be mindful of is the stringent verification requirements imposed by the flash controller. Many operations (such as program and verify) will take multiple cycles to complete successfully and the usage is somewhat complicated for a normal user program. For this reason, it is strongly recommended that the user uses the DriverLib APIs for programming and erasing flash. Using the flash controller directly is strongly discouraged as the level of overhead and attention to verification requirements make for a very intricate user experience.

Furthermore, when using the FlashCtl APIs, the user must take special consideration of where the API is being executed. For the critical APIs (such as erase and program), the DriverLib APIs are required to be executed from either SRAM or ROM (using the ROM_ prefix). Due to the verification requirements of the flash controller, running these APIs out of Flash is not currently supported.


Wait State Considerations


When changing read modes on the MSP432 microcontroller, some read modes (such as erase verify) require an additional number of wait states. The wait states of the flash controller can be configured using the FlashCtl_setWaitState command. When using the DriverLib APIs, the wait states are automatically changed within the API.

Programming Examples


Macro Definition Documentation

#define FLASH_A_BURST_PRG_BIT   0x03
#define FLASH_A_SECTOR_SIZE   4096
#define FLASH_A_PROGRAM_ERROR   FLCTL_A_IFG_PRG_ERR
#define FLASH_A_BENCHMARK_INT   FLCTL_A_IFG_BMRK
#define FLASH_A_ERASE_COMPLETE   FLCTL_A_IFG_ERASE
#define FLASH_A_BRSTPRGM_COMPLETE   FLCTL_A_IFG_PRGB
#define FLASH_A_WRDPRGM_COMPLETE   FLCTL_A_IFG_PRG
#define FLASH_A_POSTVERIFY_FAILED   FLCTL_A_IFG_AVPST
#define FLASH_A_PREVERIFY_FAILED   FLCTL_A_IFG_AVPRE
#define FLASH_A_BRSTRDCMP_COMPLETE   FLCTL_A_IFG_RDBRST
#define FLASH_A_NORMAL_READ_MODE   FLCTL_A_BANK0_RDCTL_RD_MODE_0
#define FLASH_A_MARGIN0_READ_MODE   FLCTL_A_BANK0_RDCTL_RD_MODE_1
#define FLASH_A_MARGIN1_READ_MODE   FLCTL_A_BANK0_RDCTL_RD_MODE_2
#define FLASH_A_PROGRAM_VERIFY_READ_MODE   FLCTL_A_BANK0_RDCTL_RD_MODE_3
#define FLASH_A_ERASE_VERIFY_READ_MODE   FLCTL_A_BANK0_RDCTL_RD_MODE_4

Referenced by FlashCtl_A_verifyMemory().

#define FLASH_A_LEAKAGE_VERIFY_READ_MODE   FLCTL_A_BANK0_RDCTL_RD_MODE_5
#define FLASH_A_MARGIN0B_READ_MODE   FLCTL_A_BANK0_RDCTL_RD_MODE_9
#define FLASH_A_MARGIN1B_READ_MODE   FLCTL_A_BANK0_RDCTL_RD_MODE_10
#define FLASH_A_PRGBRSTCTLSTAT_BURSTSTATUS_COMPLETE   FLCTL_A_PRGBRST_CTLSTAT_BURST_STATUS_7
#define FLASH_A_BANK0   0x00
#define FLASH_A_BANK1   0x01
#define FLASH_A_DATA_READ   0x00
#define FLASH_A_INSTRUCTION_FETCH   0x01
#define FLASH_A_MAIN_MEMORY_SPACE_BANK0   0x01
#define FLASH_A_MAIN_MEMORY_SPACE_BANK1   0x02
#define FLASH_A_INFO_MEMORY_SPACE_BANK0   0x03
#define FLASH_A_INFO_MEMORY_SPACE_BANK1   0x04
#define FLASH_A_MAIN_SPACE   FLCTL_A_RDBRST_CTLSTAT_MEM_TYPE_0
#define FLASH_A_INFO_SPACE   FLCTL_A_RDBRST_CTLSTAT_MEM_TYPE_1
#define FLASH_A_1_PATTERN   FLCTL_A_RDBRST_CTLSTAT_DATA_CMP
#define FLASH_A_0_PATTERN   0x00

Referenced by FlashCtl_A_verifyMemory().

#define FLASH_A_SECTOR0   FLCTL_A_BANK0_MAIN_WEPROT_PROT0
#define FLASH_A_SECTOR1   FLCTL_A_BANK0_MAIN_WEPROT_PROT1
#define FLASH_A_SECTOR2   FLCTL_A_BANK0_MAIN_WEPROT_PROT2
#define FLASH_A_SECTOR3   FLCTL_A_BANK0_MAIN_WEPROT_PROT3
#define FLASH_A_SECTOR4   FLCTL_A_BANK0_MAIN_WEPROT_PROT4
#define FLASH_A_SECTOR5   FLCTL_A_BANK0_MAIN_WEPROT_PROT5
#define FLASH_A_SECTOR6   FLCTL_A_BANK0_MAIN_WEPROT_PROT6
#define FLASH_A_SECTOR7   FLCTL_A_BANK0_MAIN_WEPROT_PROT7
#define FLASH_A_SECTOR8   FLCTL_A_BANK0_MAIN_WEPROT_PROT8
#define FLASH_A_SECTOR9   FLCTL_A_BANK0_MAIN_WEPROT_PROT9
#define FLASH_A_SECTOR10   FLCTL_A_BANK0_MAIN_WEPROT_PROT10
#define FLASH_A_SECTOR11   FLCTL_A_BANK0_MAIN_WEPROT_PROT11
#define FLASH_A_SECTOR12   FLCTL_A_BANK0_MAIN_WEPROT_PROT12
#define FLASH_A_SECTOR13   FLCTL_A_BANK0_MAIN_WEPROT_PROT13
#define FLASH_A_SECTOR14   FLCTL_A_BANK0_MAIN_WEPROT_PROT14
#define FLASH_A_SECTOR15   FLCTL_A_BANK0_MAIN_WEPROT_PROT15
#define FLASH_A_SECTOR16   FLCTL_A_BANK0_MAIN_WEPROT_PROT16
#define FLASH_A_SECTOR17   FLCTL_A_BANK0_MAIN_WEPROT_PROT17
#define FLASH_A_SECTOR18   FLCTL_A_BANK0_MAIN_WEPROT_PROT18
#define FLASH_A_SECTOR19   FLCTL_A_BANK0_MAIN_WEPROT_PROT19
#define FLASH_A_SECTOR20   FLCTL_A_BANK0_MAIN_WEPROT_PROT20
#define FLASH_A_SECTOR21   FLCTL_A_BANK0_MAIN_WEPROT_PROT21
#define FLASH_A_SECTOR22   FLCTL_A_BANK0_MAIN_WEPROT_PROT22
#define FLASH_A_SECTOR23   FLCTL_A_BANK0_MAIN_WEPROT_PROT23
#define FLASH_A_SECTOR24   FLCTL_A_BANK0_MAIN_WEPROT_PROT24
#define FLASH_A_SECTOR25   FLCTL_A_BANK0_MAIN_WEPROT_PROT25
#define FLASH_A_SECTOR26   FLCTL_A_BANK0_MAIN_WEPROT_PROT26
#define FLASH_A_SECTOR27   FLCTL_A_BANK0_MAIN_WEPROT_PROT27
#define FLASH_A_SECTOR28   FLCTL_A_BANK0_MAIN_WEPROT_PROT28
#define FLASH_A_SECTOR29   FLCTL_A_BANK0_MAIN_WEPROT_PROT29
#define FLASH_A_SECTOR30   FLCTL_A_BANK0_MAIN_WEPROT_PROT30
#define FLASH_A_SECTOR31   FLCTL_A_BANK0_MAIN_WEPROT_PROT31
#define FLASH_A_NOVER   0
#define FLASH_A_BURSTPOST   FLCTL_A_PRGBRST_CTLSTAT_AUTO_PST
#define FLASH_A_BURSTPRE   FLCTL_A_PRGBRST_CTLSTAT_AUTO_PRE
#define FLASH_A_REGPRE   FLCTL_A_PRG_CTLSTAT_VER_PRE
#define FLASH_A_REGPOST   FLCTL_A_PRG_CTLSTAT_VER_PST
#define FLASH_A_FULLVER
Value:
(FLCTL_A_PRGBRST_CTLSTAT_AUTO_PST | \
FLCTL_A_PRGBRST_CTLSTAT_AUTO_PRE | FLCTL_A_PRG_CTLSTAT_VER_PRE \
| FLCTL_A_PRG_CTLSTAT_VER_PST)
#define FLASH_A_COLLATED_WRITE_MODE   0x01
#define FLASH_A_IMMEDIATE_WRITE_MODE   0x02
#define __INFO_FLASH_A_TECH_START__   0x00200000
#define __INFO_FLASH_A_TECH_MIDDLE__   0x00204000

Typedef Documentation

Function Documentation

void FlashCtl_A_getMemoryInfo ( uint32_t  addr,
uint32_t *  bankNum,
uint32_t *  sectorNum 
)

Calculates the flash bank and sector number given an address. Stores the results into the two pointers given as parameters. The user must provide a valid memory address (an address in SRAM for example will give an invalid result).

Parameters
addrAddress to calculate the bank/sector information for
bankNumThe bank number will be stored in here after the function completes.
sectorNumThe sector number will be stored in here after the function completes.
Note
For simplicity, this API only works with address in MAIN flash memory. For calculating the sector/bank number of an address in info memory, please refer to your device datasheet/
Returns
None.

References FLASH_A_BANK0, FLASH_A_BANK1, FLASH_A_SECTOR_SIZE, and SysCtl_A_getFlashSize().

void FlashCtl_A_enableReadBuffering ( uint_fast8_t  memoryBank,
uint_fast8_t  accessMethod 
)

Enables read buffering on accesses to a specified bank of flash memory

Parameters
memoryBankis the value of the memory bank to enable read buffering. Must be only one of the following values:
  • FLASH_A_BANK0,
  • FLASH_A_BANK1
accessMethodis the value of the access type to enable read buffering. Must be only one of the following values:
  • FLASH_A_DATA_READ,
  • FLASH_A_INSTRUCTION_FETCH
Returns
None.

References ASSERT, FLASH_A_BANK0, FLASH_A_BANK1, FLASH_A_DATA_READ, and FLASH_A_INSTRUCTION_FETCH.

void FlashCtl_A_disableReadBuffering ( uint_fast8_t  memoryBank,
uint_fast8_t  accessMethod 
)

Disables read buffering on accesses to a specified bank of flash memory

Parameters
memoryBankis the value of the memory bank to disable read buffering. Must be only one of the following values:
  • FLASH_A_BANK0,
  • FLASH_A_BANK1
accessMethodis the value of the access type to disable read buffering. Must ne only one of the following values:
  • FLASH_A_DATA_READ,
  • FLASH_A_INSTRUCTION_FETCH
Returns
None.

References ASSERT, FLASH_A_BANK0, FLASH_A_BANK1, FLASH_A_DATA_READ, and FLASH_A_INSTRUCTION_FETCH.

bool FlashCtl_A_protectMemory ( uint32_t  startAddr,
uint32_t  endAddr 
)

Enables protection on the given flash memory range from writes. Note that this function only works on flash memory and giving in an address to ROM or SRAM will result in unreliable behavior.

Parameters
startAddris the start address of the memory to protect
endAddris the end address of the memory to protect
Note
Flash memory is organized by protection by sector sizes. This means that you will only be able to protect/unprotect memory based off 4096 aligned boundaries.
Returns
true if sector protection enabled false otherwise.

References __INFO_FLASH_A_TECH_START__, FLASH_A_SECTOR_SIZE, SysCtl_A_getFlashSize(), and SysCtl_A_getInfoFlashSize().

Referenced by FlashCtl_A_performMassErase().

bool FlashCtl_A_unprotectMemory ( uint32_t  startAddr,
uint32_t  endAddr 
)

Disables protection on the given flash memory range from writes. Note that this function only works on flash memory and giving in an address to ROM or SRAM will result in unreliable behavior.

Parameters
startAddris the start address of the memory to unprotect
endAddris the end address of the memory to unprotect
Note
Flash memory is organized by protection by sector sizes. This means that you will only be able to protect/unprotect memory based off 4096 aligned boundaries.
Returns
true if sector protection enabled false otherwise.

References __INFO_FLASH_A_TECH_START__, FLASH_A_SECTOR_SIZE, SysCtl_A_getFlashSize(), and SysCtl_A_getInfoFlashSize().

bool FlashCtl_A_isMemoryRangeProtected ( uint32_t  startAddr,
uint32_t  endAddr 
)

Scans over the given memory range and returns false if any of the inclusive memory addresses is protect from writes.

Parameters
startAddris the start address to scan
endAddris the end address to scan
Returns
true if sector protection enabled on any of the incluseive memory addresses, false otherwise.

References FLASH_A_SECTOR_SIZE, and FlashCtl_A_isMemoryProtected().

bool FlashCtl_A_isMemoryProtected ( uint32_t  addr)

Scans over the given memory range and returns false if any of the inclusive memory addresses is protect from writes.

Parameters
startAddris the start address to scan
endAddris the end address to scan
Returns
true if sector protection enabled on any of the incluseive memory addresses, false otherwise.

References __INFO_FLASH_A_TECH_START__, FLASH_A_SECTOR_SIZE, SysCtl_A_getFlashSize(), and SysCtl_A_getInfoFlashSize().

Referenced by FlashCtl_A_isMemoryRangeProtected(), and FlashCtl_A_performMassErase().

bool FlashCtl_A_verifyMemory ( void *  verifyAddr,
uint32_t  length,
uint_fast8_t  pattern 
)

Verifies a given segment of memory based off either a high (1) or low (0) state.

Parameters
verifyAddrStart address where verification will begin
lengthLength in bytes to verify based off the pattern
patternThe pattern which verification will check versus. This can either be a low pattern (each register will be checked versus a pattern of 32 zeros, or a high pattern (each register will be checked versus a pattern of 32 ones). Valid values are: FLASH_A_0_PATTERN, FLASH_A_1_PATTERN
Note
There are no sector/boundary restrictions for this function, however it is encouraged to proved a start address aligned on 32-bit boundaries. Providing an unaligned address will result in unaligned data accesses and detriment efficiency.
This function is blocking and will not exit until operation has either completed or failed due to an error. Furthermore, given the complex verification requirements of the flash controller, master interrupts are disabled throughout execution of this function. The original interrupt context is saved at the start of execution and restored prior to exit of the API.
Due to the hardware limitations of the flash controller, this function cannot verify a memory adress in the same flash bank that it is executing from. If using the ROM version of this API (by using the (ROM_ or MAP_ prefixes) this is a don't care, however if this API resides in flash then special care needs to be taken to ensure no code execution or reads happen in the flash bank being programmed while this API is being executed.
Returns
true if memory verification is successful, false otherwise.

References __INFO_FLASH_A_TECH_MIDDLE__, __INFO_FLASH_A_TECH_START__, ASSERT, CPU_primask(), FLASH_A_0_PATTERN, FLASH_A_1_PATTERN, FLASH_A_BANK0, FLASH_A_BANK1, FLASH_A_ERASE_VERIFY_READ_MODE, FLASH_A_INFO_SPACE, FLASH_A_MAIN_SPACE, FLASH_A_PROGRAM_VERIFY_READ_MODE, FlashCtl_A_getReadMode(), FlashCtl_A_getWaitState(), FlashCtl_A_setReadMode(), FlashCtl_A_setWaitState(), HWREG32, HWREG8, Interrupt_disableMaster(), Interrupt_enableMaster(), and SysCtl_A_getFlashSize().

Referenced by FlashCtl_A_eraseSector(), and FlashCtl_A_performMassErase().

bool FlashCtl_A_performMassErase ( void  )

Performs a mass erase on all unprotected flash sectors. Protected sectors are ignored.

Note
This function is blocking and will not exit until operation has either completed or failed due to an error. Furthermore, given the complex verification requirements of the flash controller, master interrupts are disabled throughout execution of this function. The original interrupt context is saved at the start of execution and restored prior to exit of the API.
Due to the hardware limitations of the flash controller, this function cannot erase a memory adress in the same flash bank that it is executing from. If using the ROM version of this API (by using the (ROM_ or MAP_ prefixes) this is a don't care, however if this API resides in flash then special care needs to be taken to ensure no code execution or reads happen in the flash bank being programmed while this API is being executed.
Returns
true if mass erase completes successfully, false otherwise

References __INFO_FLASH_A_TECH_START__, CPU_primask(), FLASH_A_1_PATTERN, FLASH_A_SECTOR_SIZE, FlashCtl_A_isMemoryProtected(), FlashCtl_A_protectMemory(), FlashCtl_A_verifyMemory(), Interrupt_disableMaster(), Interrupt_enableMaster(), SysCtl_A_FlashTLV_Info::maxErasePulses, SysCtl_A_getFlashSize(), SysCtl_A_getInfoFlashSize(), SysCtl_A_getTLVInfo(), and TLV_TAG_FLASHCTL.

void FlashCtl_A_initiateMassErase ( void  )

Initiates a mass erase and returns control back to the program. This is a non-blocking function, however it is the user's responsibility to perform the necessary verification requirements after the interrupt is set to signify completion.

Returns
None
bool FlashCtl_A_eraseSector ( uint32_t  addr)

Erases a sector of MAIN or INFO flash memory.

Parameters
addrThe start of the sector to erase. Note that with flash, the minimum allowed size that can be erased is a flash sector (which is 4KB on the MSP432 family). If an address is provided to this function which is not on a 4KB boundary, the entire sector will still be erased.
Note
This function is blocking and will not exit until operation has either completed or failed due to an error. Furthermore, given the complex verification requirements of the flash controller, master interrupts are disabled throughout execution of this function. The original interrupt context is saved at the start of execution and restored prior to exit of the API.
Due to the hardware limitations of the flash controller, this function cannot erase a memory adress in the same flash bank that it is executing from. If using the ROM version of this API (by using the (ROM_ or MAP_ prefixes) this is a don't care, however if this API resides in flash then special care needs to be taken to ensure no code execution or reads happen in the flash bank being programmed while this API is being executed.
Returns
true if sector erase is successful, false otherwise.

References __INFO_FLASH_A_TECH_START__, CPU_primask(), FLASH_A_1_PATTERN, FLASH_A_INFO_SPACE, FLASH_A_MAIN_SPACE, FLASH_A_SECTOR_SIZE, FlashCtl_A_verifyMemory(), Interrupt_disableMaster(), Interrupt_enableMaster(), SysCtl_A_FlashTLV_Info::maxErasePulses, SysCtl_A_getFlashSize(), SysCtl_A_getTLVInfo(), and TLV_TAG_FLASHCTL.

bool FlashCtl_A_programMemory ( void *  src,
void *  dest,
uint32_t  length 
)

Program a portion of flash memory with the provided data

Parameters
srcPointer to the data source to program into flash
destPointer to the destination in flash to program
lengthLength in bytes to program
Note
There are no sector/boundary restrictions for this function, however it is encouraged to proved a start address aligned on 32-bit boundaries. Providing an unaligned address will result in unaligned data accesses and detriment efficiency.
This function is blocking and will not exit until operation has either completed or failed due to an error. Furthermore, given the complex verification requirements of the flash controller, master interrupts are disabled throughout execution of this function. The original interrupt context is saved at the start of execution and restored prior to exit of the API.
Due to the hardware limitations of the flash controller, this function cannot program a memory adress in the same flash bank that it is executing from. If using the ROM version of this API (by using the (ROM_ or MAP_ prefixes) this is a don't care, however if this API resides in flash then special care needs to be taken to ensure no code execution or reads happen in the flash bank being programmed while this API is being executed.
Returns
Whether or not the program succeeded

References CPU_primask(), FLASH_A_IMMEDIATE_WRITE_MODE, FlashCtl_A_disableWordProgramming(), FlashCtl_A_enableWordProgramming(), Interrupt_disableMaster(), Interrupt_enableMaster(), SysCtl_A_FlashTLV_Info::maxProgramPulses, SysCtl_A_getTLVInfo(), and TLV_TAG_FLASHCTL.

void FlashCtl_A_setProgramVerification ( uint32_t  verificationSetting)

Setups pre/post verification of burst and regular flash programming instructions. Note that this API is for advanced users that are programming their own flash drivers. The program/erase APIs are not affected by this setting and take care of the verification requirements.

Parameters
verificationSettingVerification setting to set. This value can be a bitwise OR of the following values:
  • FLASH_A_BURSTPOST,
  • FLASH_A_BURSTPRE,
  • FLASH_A_REGPRE,
  • FLASH_A_REGPOST
  • FLASH_A_NOVER No verification enabled
  • FLASH_A_FULLVER Full verification enabled
Returns
none

References FLASH_A_BURSTPOST, FLASH_A_BURSTPRE, FLASH_A_REGPOST, and FLASH_A_REGPRE.

void FlashCtl_A_clearProgramVerification ( uint32_t  verificationSetting)

Clears pre/post verification of burst and regular flash programming instructions. Note that this API is for advanced users that are programming their own flash drivers. The program/erase APIs are not affected by this setting and take care of the verification requirements.

Parameters
verificationSettingVerification setting to clear. This value can be a bitwise OR of the following values:
  • FLASH_A_BURSTPOST,
  • FLASH_A_BURSTPRE,
  • FLASH_A_REGPRE,
  • FLASH_A_REGPOST
  • FLASH_A_NOVER No verification enabled
  • FLASH_A_FULLVER Full verification enabled
Returns
none

References FLASH_A_BURSTPOST, FLASH_A_BURSTPRE, FLASH_A_REGPOST, and FLASH_A_REGPRE.

void FlashCtl_A_enableWordProgramming ( uint32_t  mode)

Enables word programming of flash memory.

This function will enable word programming of the flash memory and set the mode of behavior when the flash write occurs.

Parameters
modeThe mode specifies the behavior of the flash controller when programming words to flash. In FLASH_A_IMMEDIATE_WRITE_MODE, the program operation happens immediately on the write to flash while in FLASH_A_COLLATED_WRITE_MODE the write will be delayed until a full 128-bits have been collated. Possible values include:
  • FLASH_A_IMMEDIATE_WRITE_MODE
  • FLASH_A_COLLATED_WRITE_MODE

Refer to the user's guide for further documentation.

Returns
none

References FLASH_A_COLLATED_WRITE_MODE, and FLASH_A_IMMEDIATE_WRITE_MODE.

Referenced by FlashCtl_A_programMemory().

void FlashCtl_A_disableWordProgramming ( void  )

Disables word programming of flash memory.

Refer to FlashCtl_A_enableWordProgramming and the user's guide for description on the difference between full word and immediate programming

Returns
None.

Referenced by FlashCtl_A_programMemory().

uint32_t FlashCtl_A_isWordProgrammingEnabled ( void  )

Returns if word programming mode is enabled (and if it is, the specific mode)

Refer to FlashCtl_A_enableWordProgramming and the user's guide for description on the difference between full word and immediate programming

Returns
a zero value if word programming is disabled,
  • FLASH_A_IMMEDIATE_WRITE_MODE
  • FLASH_A_COLLATED_WRITE_MODE

References FLASH_A_COLLATED_WRITE_MODE, and FLASH_A_IMMEDIATE_WRITE_MODE.

bool FlashCtl_A_setReadMode ( uint32_t  flashBank,
uint32_t  readMode 
)

Sets the flash read mode to be used by default flash read operations. Note that the proper wait states must be set prior to entering this function.

Parameters
flashBankFlash bank to set read mode for. Valid values are:
  • FLASH_A_BANK0
  • FLASH_A_BANK1
readModeThe read mode to set. Valid values are:
  • FLASH_A_NORMAL_READ_MODE,
  • FLASH_A_MARGIN0_READ_MODE,
  • FLASH_A_MARGIN1_READ_MODE,
  • FLASH_A_PROGRAM_VERIFY_READ_MODE,
  • FLASH_A_ERASE_VERIFY_READ_MODE,
  • FLASH_A_LEAKAGE_VERIFY_READ_MODE,
  • FLASH_A_MARGIN0B_READ_MODE,
  • FLASH_A_MARGIN1B_READ_MODE
Returns
None.

References ASSERT, FLASH_A_BANK0, and FLASH_A_BANK1.

Referenced by __FlashCtl_A_remaskBurstDataPost(), __FlashCtl_A_remaskBurstDataPre(), __FlashCtl_A_remaskData32Post(), __FlashCtl_A_remaskData32Pre(), __FlashCtl_A_remaskData8Post(), __FlashCtl_A_remaskData8Pre(), and FlashCtl_A_verifyMemory().

uint32_t FlashCtl_A_getReadMode ( uint32_t  flashBank)

Gets the flash read mode to be used by default flash read operations.

Parameters
flashBankFlash bank to set read mode for. Valid values are:
  • FLASH_A_BANK0
  • FLASH_A_BANK1
Returns
Returns the read mode to set. Valid values are:
  • FLASH_A_NORMAL_READ_MODE,
  • FLASH_A_MARGIN0_READ_MODE,
  • FLASH_A_MARGIN1_READ_MODE,
  • FLASH_A_PROGRAM_VERIFY_READ_MODE,
  • FLASH_A_ERASE_VERIFY_READ_MODE,
  • FLASH_A_LEAKAGE_VERIFY_READ_MODE,
  • FLASH_A_MARGIN0B_READ_MODE,
  • FLASH_A_MARGIN1B_READ_MODE

References ASSERT, FLASH_A_BANK0, and FLASH_A_BANK1.

Referenced by __FlashCtl_A_remaskBurstDataPost(), __FlashCtl_A_remaskBurstDataPre(), __FlashCtl_A_remaskData32Post(), __FlashCtl_A_remaskData32Pre(), __FlashCtl_A_remaskData8Post(), __FlashCtl_A_remaskData8Pre(), and FlashCtl_A_verifyMemory().

void FlashCtl_A_setWaitState ( uint32_t  bank,
uint32_t  waitState 
)

Changes the number of wait states that are used by the flash controller for read operations. When changing frequency ranges of the clock, this functions must be used in order to allow for readable flash memory.

Parameters
waitStateThe number of wait states to set. Note that only bits 0-3 are used.
flashBankFlash bank to set wait state for. Valid values are:
  • FLASH_A_BANK0
  • FLASH_A_BANK1

References ASSERT, FLASH_A_BANK0, and FLASH_A_BANK1.

Referenced by __FlashCtl_A_remaskBurstDataPost(), __FlashCtl_A_remaskBurstDataPre(), __FlashCtl_A_remaskData32Post(), __FlashCtl_A_remaskData32Pre(), __FlashCtl_A_remaskData8Post(), __FlashCtl_A_remaskData8Pre(), and FlashCtl_A_verifyMemory().

uint32_t FlashCtl_A_getWaitState ( uint32_t  bank)

Returns the set number of flash wait states for the given flash bank.

Parameters
flashBankFlash bank to set wait state for. Valid values are:
  • FLASH_A_BANK0
  • FLASH_A_BANK1
Returns
The wait state setting for the specified flash bank

References ASSERT, FLASH_A_BANK0, and FLASH_A_BANK1.

Referenced by __FlashCtl_A_remaskBurstDataPost(), __FlashCtl_A_remaskBurstDataPre(), __FlashCtl_A_remaskData32Post(), __FlashCtl_A_remaskData32Pre(), __FlashCtl_A_remaskData8Post(), __FlashCtl_A_remaskData8Pre(), and FlashCtl_A_verifyMemory().

void FlashCtl_A_enableInterrupt ( uint32_t  flags)

Enables individual flash control interrupt sources.

Parameters
flagsis a bit mask of the interrupt sources to be enabled. Must be a logical OR of:
  • FLASH_A_PROGRAM_ERROR,
  • FLASH_A_BENCHMARK_INT,
  • FLASH_A_ERASE_COMPLETE,
  • FLASH_A_BRSTPRGM_COMPLETE,
  • FLASH_A_WRDPRGM_COMPLETE,
  • FLASH_A_POSTVERIFY_FAILED,
  • FLASH_A_PREVERIFY_FAILED,
  • FLASH_A_BRSTRDCMP_COMPLETE

This function enables the indicated flash system interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

Note
The interrupt sources vary based on the part in use. Please consult the data sheet for the part you are using to determine which interrupt sources are available.
Returns
None.
void FlashCtl_A_disableInterrupt ( uint32_t  flags)

Disables individual flash system interrupt sources.

Parameters
flagsis a bit mask of the interrupt sources to be disabled. Must be a logical OR of:
  • FLASH_A_PROGRAM_ERROR,
  • FLASH_A_BENCHMARK_INT,
  • FLASH_A_ERASE_COMPLETE,
  • FLASH_A_BRSTPRGM_COMPLETE,
  • FLASH_A_WRDPRGM_COMPLETE,
  • FLASH_A_POSTVERIFY_FAILED,
  • FLASH_A_PREVERIFY_FAILED,
  • FLASH_A_BRSTRDCMP_COMPLETE

This function disables the indicated flash system interrupt sources. Only the sources that are enabled can be reflected to the processor interrupt; disabled sources have no effect on the processor.

Returns
None.
uint32_t FlashCtl_A_getEnabledInterruptStatus ( void  )

Gets the current interrupt status masked with the enabled interrupts. This function is useful to call in ISRs to get a list of pending interrupts that are actually enabled and could have caused the ISR.

Returns
The current interrupt status, enumerated as a bit field of
  • FLASH_A_PROGRAM_ERROR,
  • FLASH_A_BENCHMARK_INT,
  • FLASH_A_ERASE_COMPLETE,
  • FLASH_A_BRSTPRGM_COMPLETE,
  • FLASH_A_WRDPRGM_COMPLETE,
  • FLASH_A_POSTVERIFY_FAILED,
  • FLASH_A_PREVERIFY_FAILED,
  • FLASH_A_BRSTRDCMP_COMPLETE
Note
The interrupt sources vary based on the part in use. Please consult the data sheet for the part you are using to determine which interrupt sources are available.

References FlashCtl_A_getInterruptStatus().

uint32_t FlashCtl_A_getInterruptStatus ( void  )

Gets the current interrupt status.

Returns
The current interrupt status, enumerated as a bit field of:
  • FLASH_A_PROGRAM_ERROR,
  • FLASH_A_BENCHMARK_INT,
  • FLASH_A_ERASE_COMPLETE,
  • FLASH_A_BRSTPRGM_COMPLETE,
  • FLASH_A_WRDPRGM_COMPLETE,
  • FLASH_A_POSTVERIFY_FAILED,
  • FLASH_A_PREVERIFY_FAILED,
  • FLASH_A_BRSTRDCMP_COMPLETE
Note
The interrupt sources vary based on the part in use. Please consult the data sheet for the part you are using to determine which interrupt sources are available.

Referenced by FlashCtl_A_getEnabledInterruptStatus().

void FlashCtl_A_clearInterruptFlag ( uint32_t  flags)

Clears flash system interrupt sources.

Parameters
flagsis a bit mask of the interrupt sources to be cleared. Must be a logical OR of:
  • FLASH_A_PROGRAM_ERROR,
  • FLASH_A_BENCHMARK_INT,
  • FLASH_A_ERASE_COMPLETE,
  • FLASH_A_BRSTPRGM_COMPLETE,
  • FLASH_A_WRDPRGM_COMPLETE,
  • FLASH_A_POSTVERIFY_FAILED,
  • FLASH_A_PREVERIFY_FAILED,
  • FLASH_A_BRSTRDCMP_COMPLETE

The specified flash system interrupt sources are cleared, so that they no longer assert. This function must be called in the interrupt handler to keep it from being called again immediately upon exit.

Note
Because there is a write buffer in the Cortex-M processor, it may take several clock cycles before the interrupt source is actually cleared. Therefore, it is recommended that the interrupt source be cleared early in the interrupt handler (as opposed to the very last action) to avoid returning from the interrupt handler before the interrupt source is actually cleared. Failure to do so may result in the interrupt handler being immediately reentered (because the interrupt controller still sees the interrupt source asserted).
The interrupt sources vary based on the part in use. Please consult the data sheet for the part you are using to determine which interrupt sources are available.
Returns
None.
void FlashCtl_A_registerInterrupt ( void(*)(void)  intHandler)

Registers an interrupt handler for flash clock system interrupt.

Parameters
intHandleris a pointer to the function to be called when the clock system interrupt occurs.

This function registers the handler to be called when a clock system interrupt occurs. This function enables the global interrupt in the interrupt controller; specific flash controller interrupts must be enabled via FlashCtl_A_enableInterrupt(). It is the interrupt handler's responsibility to clear the interrupt source via FlashCtl_A_clearInterruptFlag().

See Also
Interrupt_registerInterrupt() for important information about registering interrupt handlers.
Returns
None.

References INT_FLCTL, Interrupt_enableInterrupt(), and Interrupt_registerInterrupt().

void FlashCtl_A_unregisterInterrupt ( void  )

Unregisters the interrupt handler for the flash system.

This function unregisters the handler to be called when a clock system interrupt occurs. This function also masks off the interrupt in the interrupt controller so that the interrupt handler no longer is called.

See Also
Interrupt_registerInterrupt() for important information about registering interrupt handlers.
Returns
None.

References INT_FLCTL, Interrupt_disableInterrupt(), and Interrupt_unregisterInterrupt().

void FlashCtl_A_initiateSectorErase ( uint32_t  addr)

Initiates a sector erase of MAIN or INFO flash memory. Note that this function simply initaites the sector erase, but does no verification which is required by the flash controller. The user must manually set and enable interrupts on the flash controller to fire on erase completion and then use the FlashCtl_A_verifyMemory function to verify that the sector was actually erased

Parameters
addrThe start of the sector to erase. Note that with flash, the minimum allowed size that can be erased is a flash sector (which is 4KB on the MSP432 family). If an address is provided to this function which is not on a 4KB boundary, the entire sector will still be erased.
Returns
None

References __INFO_FLASH_A_TECH_START__, FLASH_A_INFO_SPACE, FLASH_A_MAIN_SPACE, and SysCtl_A_getFlashSize().

uint8_t __FlashCtl_A_remaskData8Post ( uint8_t  data,
uint32_t  addr 
)
uint8_t __FlashCtl_A_remaskData8Pre ( uint8_t  data,
uint32_t  addr 
)
uint32_t __FlashCtl_A_remaskData32Post ( uint32_t  data,
uint32_t  addr 
)
uint32_t __FlashCtl_A_remaskData32Pre ( uint32_t  data,
uint32_t  addr 
)
void __FlashCtl_A_remaskBurstDataPost ( uint32_t  addr,
uint32_t  size 
)
void __FlashCtl_A_remaskBurstDataPre ( uint32_t  addr,
uint32_t  size 
)

Copyright 2018, Texas Instruments Incorporated