TI-RTOS for SimpleLink Wireless MCUs
2.14.02.22
|
SDSPI driver interface.
============================================================================
The SDSPI header file should be included in an application as follows:
The SDSPI driver is a driver designed to hook into FatFs. It implements a set of functions that FatFs needs to call to perform basic block data transfers.
A SDSPI driver peripheral implementation doesn't require RTOS protection primitives due to the resource protection provided with FatFs. The only functions that can be called by the application are the standard driver framework functions (_open, _close, etc...).
Once the driver has been opened, the application may used the FatFs APIs or the standard C runtime file I/O calls (fopen, fclose, etc...). Once the driver has been closed, ensure the application does NOT make any file I/O calls.
This module serves as the main interface for TI-RTOS applications. Its purpose is to redirect the module's APIs to specific peripheral implementations which are specified using a pointer to a SDSPI_FxnTable.
The SDSPI driver interface module is joined (at link time) to a NULL-terminated array of SDSPI_Config data structures named SDSPI_config. SDSPI_config is implemented in the application with each entry being an instance of a SDSPI peripheral. Each entry in SDSPI_config contains a:
Currently the following SDSPI peripheral implementations are supported:
The SDSPI driver interface produces log statements if instrumentation is enabled.
Diagnostics Mask | Log details |
---|---|
Diags_USER1 | basic operations performed |
Diags_USER2 | detailed operations performed |
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | SDSPI_Params |
SDSPI Parameters. More... | |
struct | SDSPI_FxnTable |
The definition of a SDSPI function table that contains the required set of functions to control a specific SDSPI driver implementation. More... | |
struct | SDSPI_Config |
SDSPI Global configuration. More... | |
Macros | |
#define | SDSPI_CMD_RESERVED 32 |
#define | SDSPI_STATUS_RESERVED -32 |
#define | SDSPI_STATUS_SUCCESS 0 |
Successful status code returned by SDSPI_control(). More... | |
#define | SDSPI_STATUS_ERROR -1 |
Generic error status code returned by SDSPI_control(). More... | |
#define | SDSPI_STATUS_UNDEFINEDCMD -2 |
An error status code returned by SDSPI_control() for undefined command codes. More... | |
Typedefs | |
typedef struct SDSPI_Config * | SDSPI_Handle |
A handle that is returned from a SDSPI_open() call. More... | |
typedef struct SDSPI_Params | SDSPI_Params |
SDSPI Parameters. More... | |
typedef void(* | SDSPI_InitFxn) (SDSPI_Handle handle) |
A function pointer to a driver specific implementation of SDSPI_init(). More... | |
typedef SDSPI_Handle(* | SDSPI_OpenFxn) (SDSPI_Handle handle, unsigned char drv, SDSPI_Params *params) |
A function pointer to a driver specific implementation of SDSPI_open(). More... | |
typedef void(* | SDSPI_CloseFxn) (SDSPI_Handle handle) |
A function pointer to a driver specific implementation of SDSPI_close(). More... | |
typedef int(* | SDSPI_ControlFxn) (SDSPI_Handle handle, unsigned int cmd, void *arg) |
A function pointer to a driver specific implementation of SDSPI_control(). More... | |
typedef struct SDSPI_FxnTable | SDSPI_FxnTable |
The definition of a SDSPI function table that contains the required set of functions to control a specific SDSPI driver implementation. More... | |
typedef struct SDSPI_Config | SDSPI_Config |
SDSPI Global configuration. More... | |
Functions | |
void | SDSPI_close (SDSPI_Handle handle) |
Function to close a SDSPI peripheral specified by the SDSPI handle. This function unmounts the file system mounted by SDSPI_open and unregisters the SDSPI driver from BIOS' FatFs module. More... | |
int | SDSPI_control (SDSPI_Handle handle, unsigned int cmd, void *arg) |
Function performs implementation specific features on a given SDSPI_Handle. More... | |
void | SDSPI_init (void) |
This function initializes the SDSPI driver module. More... | |
SDSPI_Handle | SDSPI_open (unsigned int index, unsigned char drv, SDSPI_Params *params) |
This function registers the SDSPI driver with BIOS' FatFs module and mounts the FatFs file system. More... | |
void | SDSPI_Params_init (SDSPI_Params *params) |
Function to initialize the SDSPI_Params struct to its defaults. More... | |
#define SDSPI_CMD_RESERVED 32 |
Common SDSPI_control command code reservation offset. SDSPI driver implementations should offset command codes with SDSPI_CMD_RESERVED growing positively
Example implementation specific command codes:
#define SDSPI_STATUS_RESERVED -32 |
Common SDSPI_control status code reservation offset. SDSPI driver implementations should offset status codes with SDSPI_STATUS_RESERVED growing negatively.
Example implementation specific status codes:
#define SDSPI_STATUS_SUCCESS 0 |
Successful status code returned by SDSPI_control().
SDSPI_control() returns SDSPI_STATUS_SUCCESS if the control code was executed successfully.
#define SDSPI_STATUS_ERROR -1 |
Generic error status code returned by SDSPI_control().
SDSPI_control() returns SDSPI_STATUS_ERROR if the control code was not executed successfully.
#define SDSPI_STATUS_UNDEFINEDCMD -2 |
An error status code returned by SDSPI_control() for undefined command codes.
SDSPI_control() returns SDSPI_STATUS_UNDEFINEDCMD if the control code is not recognized by the driver implementation.
typedef struct SDSPI_Config* SDSPI_Handle |
A handle that is returned from a SDSPI_open() call.
typedef struct SDSPI_Params SDSPI_Params |
SDSPI Parameters.
SDSPI Parameters are used to with the SDSPI_open() call. Default values for these parameters are set using SDSPI_Params_init().
typedef void(* SDSPI_InitFxn) (SDSPI_Handle handle) |
A function pointer to a driver specific implementation of SDSPI_init().
typedef SDSPI_Handle(* SDSPI_OpenFxn) (SDSPI_Handle handle, unsigned char drv, SDSPI_Params *params) |
A function pointer to a driver specific implementation of SDSPI_open().
typedef void(* SDSPI_CloseFxn) (SDSPI_Handle handle) |
A function pointer to a driver specific implementation of SDSPI_close().
typedef int(* SDSPI_ControlFxn) (SDSPI_Handle handle, unsigned int cmd, void *arg) |
A function pointer to a driver specific implementation of SDSPI_control().
typedef struct SDSPI_FxnTable SDSPI_FxnTable |
The definition of a SDSPI function table that contains the required set of functions to control a specific SDSPI driver implementation.
typedef struct SDSPI_Config SDSPI_Config |
SDSPI Global configuration.
The SDSPI_Config structure contains a set of pointers used to characterize the SDSPI driver implementation.
This structure needs to be defined before calling SDSPI_init() and it must not be changed thereafter.
void SDSPI_close | ( | SDSPI_Handle | handle | ) |
Function to close a SDSPI peripheral specified by the SDSPI handle. This function unmounts the file system mounted by SDSPI_open and unregisters the SDSPI driver from BIOS' FatFs module.
handle | A SDSPI handle returned from SDSPI_open |
int SDSPI_control | ( | SDSPI_Handle | handle, |
unsigned int | cmd, | ||
void * | arg | ||
) |
Function performs implementation specific features on a given SDSPI_Handle.
handle | A SDSPI handle returned from SDSPI_open() |
cmd | A command value defined by the driver specific implementation |
arg | An optional R/W (read/write) argument that is accompanied with cmd |
void SDSPI_init | ( | void | ) |
This function initializes the SDSPI driver module.
SDSPI_Handle SDSPI_open | ( | unsigned int | index, |
unsigned char | drv, | ||
SDSPI_Params * | params | ||
) |
This function registers the SDSPI driver with BIOS' FatFs module and mounts the FatFs file system.
index | Logical peripheral number for the SDSPI indexed into the SDSPI_config table |
drv | Drive number to be associated with the SDSPI FatFs driver |
params | Pointer to an parameter block, if NULL it will use default values. All the fields in this structure are RO (read-only). |
void SDSPI_Params_init | ( | SDSPI_Params * | params | ) |
Function to initialize the SDSPI_Params struct to its defaults.
params | An pointer to SDSPI_Params structure for initialization |
Defaults values are: bitRate = 12500000 (Hz)