MSP432E4 DriverLib API Guide  1.11.00.03
Macros | Functions
Eeprom_api

Macros

#define BLOCKS_FROM_EESIZE(x)
 
#define SIZE_FROM_EESIZE(x)
 
#define OFFSET_FROM_ADDR(x)   (((x) >> 2) & 0x0F)
 
#define EEPROM_MASS_ERASE_KEY   ((uint32_t)0xE37B << EEPROM_EEDBGME_KEY_S)
 
#define EEPROM_INIT_OK   0
 
#define EEPROM_INIT_ERROR   2
 
#define EEPROM_RC_WRBUSY   0x00000020
 
#define EEPROM_RC_NOPERM   0x00000010
 
#define EEPROM_RC_WKCOPY   0x00000008
 
#define EEPROM_RC_WKERASE   0x00000004
 
#define EEPROM_RC_WORKING   0x00000001
 
#define EEPROM_PROT_SUPERVISOR_ONLY   0x00000008
 
#define EEPROM_PROT_RW_LRO_URW   0x00000000
 
#define EEPROM_PROT_NA_LNA_URW   0x00000001
 
#define EEPROM_PROT_RO_LNA_URO   0x00000002
 
#define EEPROM_INT_PROGRAM   0x00000004
 
#define EEPROMBlockFromAddr(ui32Addr)   ((ui32Addr) >> 6)
 
#define EEPROMAddrFromBlock(ui32Block)   ((ui32Block) << 6)
 

Functions

uint32_t EEPROMInit (void)
 
uint32_t EEPROMSizeGet (void)
 
uint32_t EEPROMBlockCountGet (void)
 
void EEPROMRead (uint32_t *pui32Data, uint32_t ui32Address, uint32_t ui32Count)
 
uint32_t EEPROMProgram (uint32_t *pui32Data, uint32_t ui32Address, uint32_t ui32Count)
 
uint32_t EEPROMProgramNonBlocking (uint32_t ui32Data, uint32_t ui32Address)
 
uint32_t EEPROMMassErase (void)
 
uint32_t EEPROMBlockProtectGet (uint32_t ui32Block)
 
uint32_t EEPROMBlockProtectSet (uint32_t ui32Block, uint32_t ui32Protect)
 
uint32_t EEPROMBlockPasswordSet (uint32_t ui32Block, uint32_t *pui32Password, uint32_t ui32Count)
 
uint32_t EEPROMBlockLock (uint32_t ui32Block)
 
uint32_t EEPROMBlockUnlock (uint32_t ui32Block, uint32_t *pui32Password, uint32_t ui32Count)
 
void EEPROMBlockHide (uint32_t ui32Block)
 
void EEPROMIntEnable (uint32_t ui32IntFlags)
 
void EEPROMIntDisable (uint32_t ui32IntFlags)
 
uint32_t EEPROMIntStatus (bool bMasked)
 
void EEPROMIntClear (uint32_t ui32IntFlags)
 
uint32_t EEPROMStatusGet (void)
 

Detailed Description

Introduction

The EEPROM API provides a set of functions for interacting with the on-chip EEPROM providing easy-to-use non-volatile data storage. Functions are provided to program and erase the EEPROM, configure the EEPROM protection, and handle the EEPROM interrupt.

The EEPROM can be programmed on a word-by-word basis and, unlike flash, the application need not explicitly erase a word or page before writing a new value to it.

The EEPROM controller has the ability to generate an interrupt when an invalid access is attempted (such as reading from a protected block). This interrupt can be used to validate the operation of a program; the interrupt prevents invalid accesses from being silently ignored, hiding potential bugs. An interrupt can also be generated when an erase or programming operation has completed.

The size of the available EEPROM and the number of blocks it contains varies between different members of the MSP432E4 family. API functions EEPROMSizeGet() and EEPROMBlockCountGet() are provided to allow this information to be determined at runtime.

Data protection is supported at both the device and block levels with configurable passwords used to control read and write access. Additionally, blocks may be configured to allow access only while the CPU is running in supervisor mode. A second protection mechanism allows one or more EEPROM blocks to be made completely inaccessible to software until the next system reset.

EEPROM Protection

The EEPROM device is organized into a number of blocks each of which may be configured with various protection options to control an application's ability to read and/or write data. Additionally, protection options set on the first block of the device, block 0, affect access to the EEPROM as a whole, allowing global options to be set on block 0 and individual block protection to be layered on top of this.

Each block may be configured for two protection states, one which is in effect when the block is locked and a second which applies when the block is unlocked. Unlocking is performed by writing a 32- to 96-bit password which has previously been set and committed by the user.

If a password is set on block 0, all other blocks in the device and the registers which control them are inaccessible until block 0 is unlocked. At this point, the protection set on each individual block applies with those blocks being individually lockable via their own passwords.

The EEPROM driver allows three specific protection modes to be set on each block. These modes are defined by the following labels from eeprom.h which define the protection provided if the block has no password set, if it has a password set and is not unlocked and if it has a password set and is unlocked. Additionally, EEPROM_PROT_SUPERVISOR_ONLY may be ORed with each of these labels when calling EEPROMBlockProtectSet() to prevent all accesses to the block when the CPU is executing in user mode.

EEPROM_PROT_RW_LRO_URW

If no password is set for the block, this protection level allows both read and write access to the block data.

If a password is set for the block and the block is locked, this protection level allows only read access to the block data.

If a password is set for the block and the block is unlocked, this protection level allows both read and write access to the block data.

EEPROM_PROT_NA_LNA_URW

If no password is set for the block, this protection level prevents the block data from being read or written.

If a password is set for the block and the block is locked, this protection level prevents the block data from being read or written.

If a password is set for the block and the block is unlocked, this protection level allows both read and write access to the block data.

EEPROM_PROT_RO_LNA_URO

If no password is set for the block, this protection level allows only read access to the block data.

If a password is set for the block and the block is locked, this protection level prevents the block data from being read or written.

If a password is set for the block and the block is unlocked, this protection level allows only read access to the block data.

API Functions

The EEPROM API is broken into four groups of functions: those that deal with reading the EEPROM, those that deal with programming the EEPROM, those that deal with EEPROM protection, and those that deal with interrupt handling.

EEPROM reading is managed with EEPROMRead().

EEPROM programming is managed with EEPROMMassErase(), EEPROMProgram() and EEPROMProgramNonBlocking().

EEPROM protection is managed with EEPROMBlockProtectGet(), EEPROMBlockProtectSet(), EEPROMBlockPasswordSet(), EEPROMBlockLock(), EEPROMBlockUnlock() and EEPROMBlockHide().

Interrupt handling is managed with EEPROMIntEnable(), EEPROMIntDisable(), EEPROMIntStatus(), and EEPROMIntClear().

An additional function, EEPROMSizeGet() is provided to allow an application to query the size of the device storage and the number of blocks it contains.

Programming Example

The following example shows how to use the EEPROM API to write a block of data and read it back.

uint32_t ui32EEPROMInit;
uint32_t pui32Data[2];
uint32_t pui32Read[2];
//
// Enable the EEPROM module.
//
//
// Wait for the EEPROM module to be ready.
//
{
}
//
// Wait for the EEPROM Initialization to complete
//
ui32EEPROMInit = EEPROMInit();
//
// Check if the EEPROM Initialization returned an error
// and inform the application
//
if(ui32EEPROMInit != EEPROM_INIT_OK)
{
while(1)
{
}
}
//
// Program some data into the EEPROM at address 0x400.
//
pui32Data[0] = 0x12345678;
pui32Data[1] = 0x56789abc;
EEPROMProgram(pui32Data, 0x400, sizeof(pui32Data));
//
// Read it back.
//
EEPROMRead(pui32Read, 0x400, sizeof(pui32Read));

Macro Definition Documentation

§ BLOCKS_FROM_EESIZE

#define BLOCKS_FROM_EESIZE (   x)
Value:
EEPROM_EESIZE_BLKCNT_S)
#define EEPROM_EESIZE_BLKCNT_M
Definition: hw_eeprom.h:73

Referenced by EEPROMBlockCountGet(), EEPROMBlockHide(), EEPROMBlockLock(), EEPROMBlockPasswordSet(), EEPROMBlockProtectGet(), EEPROMBlockProtectSet(), and EEPROMBlockUnlock().

§ SIZE_FROM_EESIZE

#define SIZE_FROM_EESIZE (   x)
Value:
EEPROM_EESIZE_WORDCNT_S) * 4)
#define EEPROM_EESIZE_WORDCNT_M
Definition: hw_eeprom.h:72

Referenced by EEPROMProgram(), EEPROMProgramNonBlocking(), EEPROMRead(), and EEPROMSizeGet().

§ OFFSET_FROM_ADDR

#define OFFSET_FROM_ADDR (   x)    (((x) >> 2) & 0x0F)

§ EEPROM_MASS_ERASE_KEY

#define EEPROM_MASS_ERASE_KEY   ((uint32_t)0xE37B << EEPROM_EEDBGME_KEY_S)

Referenced by EEPROMMassErase().

§ EEPROM_INIT_OK

#define EEPROM_INIT_OK   0

This value may be returned from a call to EEPROMInit(). It indicates that no previous write operations were interrupted by a reset event and that the EEPROM peripheral is ready for use.

§ EEPROM_INIT_ERROR

#define EEPROM_INIT_ERROR   2

This value may be returned from a call to EEPROMInit(). It indicates that a previous data or protection write operation was interrupted by a reset event and that the EEPROM peripheral was unable to clean up after the problem. This situation may be resolved with another reset or may be fatal depending upon the cause of the problem. For example, if the voltage to the part is unstable, retrying once the voltage has stabilized may clear the error.

§ EEPROM_RC_WRBUSY

#define EEPROM_RC_WRBUSY   0x00000020

This return code bit indicates that an attempt was made to read from the EEPROM while a write operation was in progress.

§ EEPROM_RC_NOPERM

#define EEPROM_RC_NOPERM   0x00000010

This return code bit indicates that an attempt was made to write a value but the destination permissions disallow write operations. This may be due to the destination block being locked, access protection set to prohibit writes or an attempt to write a password when one is already written.

§ EEPROM_RC_WKCOPY

#define EEPROM_RC_WKCOPY   0x00000008

This return code bit indicates that the EEPROM programming state machine is currently copying to or from the internal copy buffer to make room for a newly written value. It is provided as a status indicator and does not indicate an error.

§ EEPROM_RC_WKERASE

#define EEPROM_RC_WKERASE   0x00000004

This return code bit indicates that the EEPROM programming state machine is currently erasing the internal copy buffer. It is provided as a status indicator and does not indicate an error.

§ EEPROM_RC_WORKING

#define EEPROM_RC_WORKING   0x00000001

This return code bit indicates that the EEPROM programming state machine is currently working. No new write operations should be attempted until this bit is clear.

§ EEPROM_PROT_SUPERVISOR_ONLY

#define EEPROM_PROT_SUPERVISOR_ONLY   0x00000008

This bit may be ORed with the protection option passed to EEPROMBlockProtectSet() or returned from EEPROMBlockProtectGet(). It restricts EEPROM access to threads running in supervisor mode and prevents access to an EEPROM block when the CPU is in user mode.

§ EEPROM_PROT_RW_LRO_URW

#define EEPROM_PROT_RW_LRO_URW   0x00000000

This value may be passed to EEPROMBlockProtectSet() or returned from EEPROMBlockProtectGet(). It indicates that the block should offer read/write access when no password is set or when a password is set and the block is unlocked, and read-only access when a password is set but the block is locked.

§ EEPROM_PROT_NA_LNA_URW

#define EEPROM_PROT_NA_LNA_URW   0x00000001

This value may be passed to EEPROMBlockProtectSet() or returned from EEPROMBlockProtectGet(). It indicates that the block should offer neither read nor write access unless it is protected by a password and unlocked.

§ EEPROM_PROT_RO_LNA_URO

#define EEPROM_PROT_RO_LNA_URO   0x00000002

This value may be passed to EEPROMBlockProtectSet() or returned from EEPROMBlockProtectGet(). It indicates that the block should offer read-only access when no password is set or when a password is set and the block is unlocked. When a password is set and the block is locked, neither read nor write access is permitted.

§ EEPROM_INT_PROGRAM

#define EEPROM_INT_PROGRAM   0x00000004

This value may be passed to EEPROMIntEnable() and EEPROMIntDisable() and is returned by EEPROMIntStatus() if an EEPROM interrupt is currently being signaled.

Referenced by EEPROMIntDisable(), EEPROMIntEnable(), and EEPROMIntStatus().

§ EEPROMBlockFromAddr

#define EEPROMBlockFromAddr (   ui32Addr)    ((ui32Addr) >> 6)

Returns the EEPROM block number containing a given offset address.

Parameters
ui32Addris the linear, byte address of the EEPROM location whose block number is to be returned. This is a zero-based offset from the start of the EEPROM storage.

This macro may be used to translate an EEPROM address offset into a block number suitable for use in any of the driver's block protection functions. The address provided is expressed as a byte offset from the base of the EEPROM.

Returns
Returns the zero-based block number which contains the passed address.

Referenced by EEPROMProgram(), EEPROMProgramNonBlocking(), and EEPROMRead().

§ EEPROMAddrFromBlock

#define EEPROMAddrFromBlock (   ui32Block)    ((ui32Block) << 6)

Returns the offset address of the first word in an EEPROM block.

Parameters
ui32Blockis the index of the EEPROM block whose first word address is to be returned.

This macro may be used to determine the address of the first word in a given EEPROM block. The address returned is expressed as a byte offset from the base of EEPROM storage.

Returns
Returns the address of the first word in the given EEPROM block.

Function Documentation

§ EEPROMInit()

uint32_t EEPROMInit ( void  )

Performs any necessary recovery in case of power failures during write.

This function must be called after SysCtlPeripheralEnable() and before the EEPROM is accessed. It is used to check for errors in the EEPROM state such as from power failure during a previous write operation. The function detects these errors and performs as much recovery as possible.

If EEPROM_INIT_ERROR is returned, the EEPROM was unable to recover its state. If power is stable when this occurs, this indicates a fatal error and is likely an indication that the EEPROM memory has exceeded its specified lifetime write/erase specification. If the supply voltage is unstable when this return code is observed, retrying the operation once the voltage is stabilized may clear the error.

Failure to call this function after a reset may lead to incorrect operation or permanent data loss if the EEPROM is later written.

Returns
Returns EEPROM_INIT_OK if no errors were detected or EEPROM_INIT_ERROR if the EEPROM peripheral cannot currently recover from an interrupted write or erase operation.

References SysCtlDelay().

§ EEPROMSizeGet()

uint32_t EEPROMSizeGet ( void  )

Determines the size of the EEPROM.

This function returns the size of the EEPROM in bytes.

Returns
Returns the total number of bytes in the EEPROM.

References EEPROM_EESIZE, HWREG, and SIZE_FROM_EESIZE.

§ EEPROMBlockCountGet()

uint32_t EEPROMBlockCountGet ( void  )

Determines the number of blocks in the EEPROM.

This function may be called to determine the number of blocks in the EEPROM. Each block is the same size and the number of bytes of storage contained in a block may be determined by dividing the size of the device, obtained via a call to the EEPROMSizeGet() function, by the number of blocks returned by this function.

Returns
Returns the total number of blocks in the device EEPROM.

References BLOCKS_FROM_EESIZE, EEPROM_EESIZE, and HWREG.

§ EEPROMRead()

void EEPROMRead ( uint32_t *  pui32Data,
uint32_t  ui32Address,
uint32_t  ui32Count 
)

Reads data from the EEPROM.

Parameters
pui32Datais a pointer to storage for the data read from the EEPROM. This pointer must point to at least ui32Count bytes of available memory.
ui32Addressis the byte address within the EEPROM from which data is to be read. This value must be a multiple of 4.
ui32Countis the number of bytes of data to read from the EEPROM. This value must be a multiple of 4.

This function may be called to read a number of words of data from a word-aligned address within the EEPROM. Data read is copied into the buffer pointed to by the pui32Data parameter.

Returns
None.

References ASSERT, EEPROM_EEBLOCK, EEPROM_EEOFFSET, EEPROM_EERDWRINC, EEPROM_EESIZE, EEPROMBlockFromAddr, HWREG, OFFSET_FROM_ADDR, and SIZE_FROM_EESIZE.

§ EEPROMProgram()

uint32_t EEPROMProgram ( uint32_t *  pui32Data,
uint32_t  ui32Address,
uint32_t  ui32Count 
)

Writes data to the EEPROM.

Parameters
pui32Datapoints to the first word of data to write to the EEPROM.
ui32Addressdefines the byte address within the EEPROM that the data is to be written to. This value must be a multiple of 4.
ui32Countdefines the number of bytes of data that is to be written. This value must be a multiple of 4.

This function may be called to write data into the EEPROM at a given word-aligned address. The call is synchronous and returns only after all data has been written or an error occurs.

Returns
Returns 0 on success or non-zero values on failure. Failure codes are logical OR combinations of EEPROM_RC_WRBUSY, EEPROM_RC_NOPERM, EEPROM_RC_WKCOPY, EEPROM_RC_WKERASE, and EEPROM_RC_WORKING.

References ASSERT, EEPROM_EEBLOCK, EEPROM_EEDONE, EEPROM_EEDONE_NOPERM, EEPROM_EEDONE_WORKING, EEPROM_EEOFFSET, EEPROM_EERDWRINC, EEPROM_EESIZE, EEPROMBlockFromAddr, HWREG, OFFSET_FROM_ADDR, SIZE_FROM_EESIZE, and SysCtlDelay().

§ EEPROMProgramNonBlocking()

uint32_t EEPROMProgramNonBlocking ( uint32_t  ui32Data,
uint32_t  ui32Address 
)

Writes a word to the EEPROM.

Parameters
ui32Datais the word to write to the EEPROM.
ui32Addressdefines the byte address within the EEPROM to which the data is to be written. This value must be a multiple of 4.

This function is intended to allow EEPROM programming under interrupt control. It may be called to start the process of writing a single word of data into the EEPROM at a given word-aligned address. The call is asynchronous and returns immediately without waiting for the write to complete. Completion of the operation is signaled by means of an interrupt from the EEPROM module. The EEPROM peripheral shares a single interrupt vector with the flash memory subsystem, INT_FLASH.

Returns
Returns status and error information in the form of a logical OR combinations of EEPROM_RC_WRBUSY, EEPROM_RC_NOPERM, EEPROM_RC_WKCOPY, EEPROM_RC_WKERASE and EEPROM_RC_WORKING. Flags EEPROM_RC_WKCOPY, EEPROM_RC_WKERASE, and EEPROM_RC_WORKING are expected in normal operation and do not indicate an error.

References ASSERT, EEPROM_EEBLOCK, EEPROM_EEDONE, EEPROM_EEOFFSET, EEPROM_EERDWRINC, EEPROM_EESIZE, EEPROMBlockFromAddr, HWREG, OFFSET_FROM_ADDR, and SIZE_FROM_EESIZE.

§ EEPROMMassErase()

uint32_t EEPROMMassErase ( void  )

Erases the EEPROM and returns it to the factory default condition.

This function completely erases the EEPROM and removes any and all access protection on its blocks, leaving the device in the factory default condition. After this operation, all EEPROM words contain the value 0xFFFFFFFF and all blocks are accessible for both read and write operations in all CPU modes. No passwords are active.

The function is synchronous and does not return until the erase operation has completed.

Returns
Returns 0 on success or non-zero values on failure. Failure codes are logical OR combinations of EEPROM_RC_WRBUSY, EEPROM_RC_NOPERM, EEPROM_RC_WKCOPY, EEPROM_RC_WKERASE, and EEPROM_RC_WORKING.

References EEPROM_EEDBGME, EEPROM_EEDBGME_ME, EEPROM_MASS_ERASE_KEY, and HWREG.

§ EEPROMBlockProtectGet()

uint32_t EEPROMBlockProtectGet ( uint32_t  ui32Block)

Returns the current protection level for an EEPROM block.

Parameters
ui32Blockis the block number for which the protection level is to be queried.

This function returns the current protection settings for a given EEPROM block. If block 0 is currently locked, it must be unlocked prior to calling this function to query the protection setting for other blocks.

Returns
Returns one of EEPROM_PROT_RW_LRO_URW, EEPROM_PROT_NA_LNA_URW or EEPROM_PROT_RO_LNA_URO optionally OR-ed with EEPROM_PROT_SUPERVISOR_ONLY.

References ASSERT, BLOCKS_FROM_EESIZE, EEPROM_EEBLOCK, EEPROM_EEPROT, EEPROM_EESIZE, and HWREG.

§ EEPROMBlockProtectSet()

uint32_t EEPROMBlockProtectSet ( uint32_t  ui32Block,
uint32_t  ui32Protect 
)

Set the current protection options for an EEPROM block.

Parameters
ui32Blockis the block number for which the protection options are to be set.
ui32Protectconsists of one of the values EEPROM_PROT_RW_LRO_URW, EEPROM_PROT_NA_LNA_URW or EEPROM_PROT_RO_LNA_URO optionally ORed with EEPROM_PROT_SUPERVISOR_ONLY.

This function sets the protection settings for a given EEPROM block assuming no protection settings have previously been written. Note that protection settings applied to block 0 have special meaning and control access to the EEPROM peripheral as a whole. Protection settings applied to blocks numbered 1 and above are layered above any protection set on block 0 such that the effective protection on each block is the logical OR of the protection flags set for block 0 and for the target block. This protocol allows global protection options to be set for the whole device via block 0 and more restrictive protection settings to be set on a block-by-block basis.

The protection flags indicate access permissions as follow:

EEPROM_PROT_SUPERVISOR_ONLY restricts access to the block to threads running in supervisor mode. If clear, both user and supervisor threads can access the block.

EEPROM_PROT_RW_LRO_URW provides read/write access to the block if no password is set or if a password is set and the block is unlocked. If the block is locked, only read access is permitted.

EEPROM_PROT_NA_LNA_URW provides neither read nor write access unless a password is set and the block is unlocked. If the block is unlocked, both read and write access are permitted.

EEPROM_PROT_RO_LNA_URO provides read access to the block if no password is set or if a password is set and the block is unlocked. If the block is password protected and locked, neither read nor write access is permitted.

Returns
Returns a logical OR combination of EEPROM_RC_WRBUSY, EEPROM_RC_NOPERM, EEPROM_RC_WKCOPY, EEPROM_RC_WKERASE, and EEPROM_RC_WORKING to indicate status and error conditions.

References ASSERT, BLOCKS_FROM_EESIZE, EEPROM_EEBLOCK, EEPROM_EEDONE, EEPROM_EEDONE_WORKING, EEPROM_EEPROT, EEPROM_EESIZE, and HWREG.

§ EEPROMBlockPasswordSet()

uint32_t EEPROMBlockPasswordSet ( uint32_t  ui32Block,
uint32_t *  pui32Password,
uint32_t  ui32Count 
)

Sets the password used to protect an EEPROM block.

Parameters
ui32Blockis the EEPROM block number for which the password is to be set.
pui32Passwordpoints to an array of uint32_t values comprising the password to set. Each element may be any 32-bit value other than 0xFFFFFFFF. This array must contain the number of elements given by the ui32Count parameter.
ui32Countprovides the number of uint32_ts in the ui32Password. Valid values are 1, 2 and 3.

This function allows the password used to unlock an EEPROM block to be set. Valid passwords may be either 32, 64 or 96 bits comprising words with any value other than 0xFFFFFFFF. The password may only be set once. Any further attempts to set the password result in an error. Once the password is set, the block remains unlocked until EEPROMBlockLock() is called for that block or block 0, or a reset occurs.

If a password is set on block 0, this affects locking of the peripheral as a whole. When block 0 is locked, all other EEPROM blocks are inaccessible until block 0 is unlocked. Once block 0 is unlocked, other blocks become accessible according to any passwords set on those blocks and the protection set for that block via a call to EEPROMBlockProtectSet().

Returns
Returns a logical OR combination of EEPROM_RC_WRBUSY, EEPROM_RC_NOPERM, EEPROM_RC_WKCOPY, EEPROM_RC_WKERASE, and EEPROM_RC_WORKING to indicate status and error conditions.

References ASSERT, BLOCKS_FROM_EESIZE, EEPROM_EEBLOCK, EEPROM_EEDONE, EEPROM_EEDONE_WORKING, EEPROM_EEPASS0, EEPROM_EESIZE, and HWREG.

§ EEPROMBlockLock()

uint32_t EEPROMBlockLock ( uint32_t  ui32Block)

Locks a password-protected EEPROM block.

Parameters
ui32Blockis the EEPROM block number which is to be locked.

This function locks an EEPROM block that has previously been protected by writing a password. Access to the block once it is locked is determined by the protection settings applied via a previous call to the EEPROMBlockProtectSet() function. If no password has previously been set for the block, this function has no effect.

Locking block 0 has the effect of making all other blocks in the EEPROM inaccessible.

Returns
Returns the lock state for the block on exit, 1 if unlocked (as would be the case if no password was set) or 0 if locked.

References ASSERT, BLOCKS_FROM_EESIZE, EEPROM_EEBLOCK, EEPROM_EESIZE, EEPROM_EEUNLOCK, and HWREG.

§ EEPROMBlockUnlock()

uint32_t EEPROMBlockUnlock ( uint32_t  ui32Block,
uint32_t *  pui32Password,
uint32_t  ui32Count 
)

Unlocks a password-protected EEPROM block.

Parameters
ui32Blockis the EEPROM block number which is to be unlocked.
pui32Passwordpoints to an array of uint32_t values containing the password for the block. Each element must match the password originally set via a call to EEPROMBlockPasswordSet().
ui32Countprovides the number of elements in the pui32Password array and must match the value originally passed to EEPROMBlockPasswordSet(). Valid values are 1, 2 and 3.

This function unlocks an EEPROM block that has previously been protected by writing a password. Access to the block once it is unlocked is determined by the protection settings applied via a previous call to the EEPROMBlockProtectSet() function.

To successfully unlock an EEPROM block, the password provided must match the password provided on the original call to EEPROMBlockPasswordSet(). If an incorrect password is provided, the block remains locked.

Unlocking block 0 has the effect of making all other blocks in the device accessible according to their own access protection settings. When block 0 is locked, all other EEPROM blocks are inaccessible.

Returns
Returns the lock state for the block on exit, 1 if unlocked or 0 if locked.

References ASSERT, BLOCKS_FROM_EESIZE, EEPROM_EEBLOCK, EEPROM_EESIZE, EEPROM_EEUNLOCK, and HWREG.

§ EEPROMBlockHide()

void EEPROMBlockHide ( uint32_t  ui32Block)

Hides an EEPROM block until the next reset.

Parameters
ui32Blockis the EEPROM block number which is to be hidden.

This function hides an EEPROM block other than block 0. Once hidden, a block is completely inaccessible until the next reset. This mechanism allows initialization code to have access to data which is to be hidden from the rest of the application. Unlike applications using passwords, an application making using of block hiding need not contain any embedded passwords which could be found through disassembly.

Returns
None.

References ASSERT, BLOCKS_FROM_EESIZE, EEPROM_EEHIDE, EEPROM_EESIZE, and HWREG.

§ EEPROMIntEnable()

void EEPROMIntEnable ( uint32_t  ui32IntFlags)

Enables the EEPROM interrupt.

Parameters
ui32IntFlagsindicates which EEPROM interrupt source to enable. This must be EEPROM_INT_PROGRAM currently.

This function enables the EEPROM interrupt. When enabled, an interrupt is generated when any EEPROM write or erase operation completes. The EEPROM peripheral shares a single interrupt vector with the flash memory subsystem, INT_FLASH. This function is provided as a convenience but the EEPROM interrupt can also be enabled using a call to FlashIntEnable() passing FLASH_INT_EEPROM in the ui32IntFlags parameter.

Returns
None.

References ASSERT, EEPROM_EEINT, EEPROM_EEINT_INT, EEPROM_INT_PROGRAM, FLASH_FCIM, FLASH_FCRIS_ERIS, and HWREG.

§ EEPROMIntDisable()

void EEPROMIntDisable ( uint32_t  ui32IntFlags)

Disables the EEPROM interrupt.

Parameters
ui32IntFlagsindicates which EEPROM interrupt source to disable. This must be EEPROM_INT_PROGRAM currently.

This function disables the EEPROM interrupt and prevents calls to the interrupt vector when any EEPROM write or erase operation completes. The EEPROM peripheral shares a single interrupt vector with the flash memory subsystem, INT_FLASH. This function is provided as a convenience but the EEPROM interrupt can also be disabled using a call to FlashIntDisable() passing FLASH_INT_EEPROM in the ui32IntFlags parameter.

Returns
None.

References ASSERT, EEPROM_EEINT, EEPROM_EEINT_INT, EEPROM_INT_PROGRAM, FLASH_FCIM, FLASH_FCIM_EMASK, and HWREG.

§ EEPROMIntStatus()

uint32_t EEPROMIntStatus ( bool  bMasked)

Reports the state of the EEPROM interrupt.

Parameters
bMaskeddetermines whether the masked or unmasked state of the interrupt is to be returned. If bMasked is true, the masked state is returned, otherwise the unmasked state is returned.

This function allows an application to query the state of the EEPROM interrupt. If active, the interrupt may be cleared by calling EEPROMIntClear().

Returns
Returns EEPROM_INT_PROGRAM if an interrupt is being signaled or 0 otherwise.

References EEPROM_EEDONE, EEPROM_EEDONE_WORKING, EEPROM_INT_PROGRAM, FLASH_FCMISC, FLASH_FCMISC_EMISC, and HWREG.

§ EEPROMIntClear()

void EEPROMIntClear ( uint32_t  ui32IntFlags)

Clears the EEPROM interrupt.

Parameters
ui32IntFlagsindicates which interrupt sources to clear. Currently, the only valid value is EEPROM_INT_PROGRAM.

This function allows an application to clear the EEPROM interrupt.

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).
Returns
None.

References FLASH_FCMISC, FLASH_FCMISC_EMISC, and HWREG.

§ EEPROMStatusGet()

uint32_t EEPROMStatusGet ( void  )

Returns status on the last EEPROM program or erase operation.

This function returns the current status of the last program or erase operation performed by the EEPROM. It is intended to provide error information to applications programming or setting EEPROM protection options under interrupt control.

Returns
Returns 0 if the last program or erase operation completed without any errors. If an operation is ongoing or an error occurred, the return value is a logical OR combination of EEPROM_RC_WRBUSY, EEPROM_RC_NOPERM, EEPROM_RC_WKCOPY, EEPROM_RC_WKERASE, and EEPROM_RC_WORKING.

References EEPROM_EEDONE, and HWREG.

© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale