Library support functions are not tied to any specific LPCSPIFILIB device.
Set or unset driver options.
- Parameters
-
pHandle | : Pointer to a LPCSPIFILIB device handle |
options | : Options to set or unset, an OR'ed value of SPIFI_OPT_xxx values (example SPIFI_OPT_USE_QUAD | SPIFI_OPT_NOBLOCK) |
set | : true to set the passed options, false to clear them |
- Returns
- Nothing
- Note
- Only options that are supported in the capabilities of the driver can be set or unset.
uint32_t spifiGetHandleMemSize |
( |
uint32_t |
spifiCtrlAddr | ) |
|
Detect and return memory needed for device handle at passed address.
- Parameters
-
spifiCtrlAddr | : Base address of SPIFI controller |
- Returns
- The size in bytes this device needs for the call to InitDevice(). If no supported device is detected 0 will be returned.
- Note
- Selects the first matching device in the library.
uint16_t spifiGetLibVersion |
( |
void |
| ) |
|
Report the SPIFILIB version.
- Returns
- SPIFI library version in format MMmm where MM is major number and mm is minor number.
uint32_t spifiGetSuppFamilyCount |
( |
void |
| ) |
|
Return the number of registered device families in this driver.
- Returns
- number of registered device families in this driver
const char* spifiGetSuppFamilyName |
( |
uint32_t |
index | ) |
|
Return the driver device family name for a specific index.
- Parameters
-
- Returns
- a string pointer to the generic device name
- Note
- Can be used with the spifiGetSuppFamilyCount() to get a list of device families the library is configured for.
SPIFI_ERR_T spifiInit |
( |
uint32_t |
spifiCtrlAddr, |
|
|
uint8_t |
reset |
|
) |
| |
Initialize the SPIFILIB driver.
- Parameters
-
spifiCtrlAddr | : Base address of SPIFI controller |
reset | : true to reset the SPIFI controller, or false to not reset |
- Returns
- SPIFI library error code
- Note
- This function should be called prior to any other SPIFILIB functions. In most cases, a reset isn't needed. Before calling this function, all board specific functions related to the SPIFI interface must be setup and the SPIFI clock must be enabled. If booting from SPIFI FLASH, this will already be done. If not booting from SPIFI FLASH, the SPIFI FLASH pin muxing and SPIFI controller clock need to be enabled prior to this call.
SPIFI_HANDLE_T* spifiInitDevice |
( |
void * |
pMem, |
|
|
uint32_t |
sizePMem, |
|
|
uint32_t |
spifiCtrlAddr, |
|
|
uint32_t |
baseAddr |
|
) |
| |
Initialize driver and hardware for a specific device.
- Parameters
-
pMem | : Pointer to a 32-bit aligned buffer with a size returned from spifiGetHandleMemSize() |
sizePMem | : Size of the buffer in bytes pass in pMem |
spifiCtrlAddr | : Base address of SPIFI controller |
baseAddr | : Base address of device |
- Returns
- Returns a pointer to a device handle if successful, or NULL on an error.
Register a SPIFILIB family driver.
- Parameters
-
regFx | : A function which returns persistent device specific data structure. |
- Returns
- Handle to device specific data structure.
- Note
- This function should be called prior to calling spifiGetHandleMemSize() or spifiInitDevice().
const char* spifiReturnErrString |
( |
SPIFI_ERR_T |
errCode | ) |
|
Converts a SPIFILIB error code into a meaningful string.
- Parameters
-
errCode | : Error code to get string pointer to |
- Returns
- Pointer to string for the passed error code