SPRUJB8 April 2024
Configures Write(program)/Erase protection for the sectors.
Fapi_StatusType Fapi_setupBankSectorEnable(
uint32 WEPROT_register,
uint32 oSectorMask
)
pu32StartAddress [in] | Register address for Write/Erase protection configuration. Use FLASH_WRAPPER_PROGRAM_BASE+FLASH_O_CMDWEPROTA for the first 32 (0-31) sectors. Use FLASH_WRAPPER_PROGRAM_BASE+FLASH_O_CMDWEPROTB for the remaining main-array (32-127) sectors. Use FLASH_WRAPPER_PROGRAM_BASE+FLASH_O_CMDWEPROT_UO for the USER OTP. |
OSectorMask [in] | 32-bit mask indicating which sectors to mask from the erase and program operations. |
On this device, all of the flash main-array sectors and the USER OTP are protected from the erase and program operations by default. User application has to disable the protection for the sectors on which it wants to perform erase and/or program operations. This function can be used to enable/disable the protection. This function should be called before each erase and program command as shown in the flash API usage example provided in the C2000Ware.
First input parameter for this function can be the address of any of these three registers: CMDWEPROTA, CMDWEPROTB, CMDWEPROT_UO
CMDWEPROTA register is used to configure the protection for the first 32 sectors (0 to 31). Each bit in this register corresponds to each sector ā Example: Bit 0 of this register is used to configure the protection for Sector 0 and Bit 31 of this register is used to configure the protection for Sector 31. A 32-bit user-provided sector mask (second parameter passed to this function) indicates which sectors the user wants to mask from the erase and program operations, that is, sectors that will not be erased and programmed. If a bit in the mask is 1, that particular sector will not be erased/programmed. If a bit in the mask is 0, that particular sector will be erased/programmed.
CMDWEPROTB register is used to configure the protection for the 32 ā 127 sectors in the main-array flash bank. However, please note that each bit in this register is used to configure protection for 8 sectors together. This means, bit 0 is used to configure the protection for all of the sectors 32 to 39 together, bit 1 is used to configure the protection for all of the sectors 40 to 47 together, and so on. A 32-bit user-provided sector mask (second parameter passed to this function) indicates which sectors the user wants to mask from the erase and program operations, that is, sectors that will not be erased and programmed. If a bit in the mask is 1, that particular set of sectors will not be erased/programmed. If a bit in the mask is 0, that particular set of sectors will be erased/programmed.
CMDWEPROT_UO register is used to configure the protection for the USER OTP. Bit 0 in this register is used to configure the protection for the USER OTP. This means, if bit 0 is configured as 1, USER OTP will not be programmed. If bit 0 is configured as 0, USER OTP will be programmed. Other bits of this register can be configured as 1s. Since USER OTP is not erasable, the CMDWEPROT_UO register protection is not applicable for erase operations. This should be configured only for the program operation as needed.
There are no separate dedicated CMDWEPROT_x registers for each bank. Hence, these registers should be configured before each and every flash erase and program command for any bank.
Fapi_Status_Success (success)
(Please refer to the flash programming example provided in C2000Ware at āC2000Ware_.....\driverlib\F28P65x\examples\....\flash\flashapi_128bit_programming\flashapi_cpu1_128bitprogramming.cā)