TI-RTOS Drivers
tidrivers_tivac_2_16_01_13
|
WiFi driver interface.
============================================================================
The WiFi header file should be included in an application as follows:
The TI-RTOS WiFi driver implements many of the crucial elements necessary to communicate with a TI Wi-Fi device. It uses the TI-RTOS SPI module and implements a state machine to send and receive commands, data, and events to and from a Wi-Fi device.
The APIs in this driver give the user the ability to open a WiFi driver instance that will communicate with the Wi-Fi device's host driver without further direct calls to the driver from the application.
The SimpleLink Host Driver for CC3100 the device requires a mechanism to allow functions to execute in a temporary context. A SpawnTask is dynamically created to meet satisfy this requirement. The priority for the SpawnTask can be changed via the graphical editor, or by editing the script as a text file, with the following line of code:
The default will create the SpawnTask with the priority set to 3.
The WiFi driver interface module is joined (at link time) to a NULL-terminated array of WiFi_Config data structures named WiFi_config. WiFi_config is implemented in the application with each entry being an instance of a WiFi driver. Each entry in WiFi_config contains a:
The WiFi driver currently only supports one instance of the module. This means that the WiFi_config structure may only contain one non-NULL entry, and it must be located at index 0.
The WiFi 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 | WiFi_Params |
WiFi Parameters. More... | |
struct | WiFi_FxnTable |
The definition of a WiFi function table that contains the required set of functions to control a specific WiFi driver implementation. More... | |
struct | WiFi_Config |
WiFi Global configuration. More... | |
Macros | |
#define | WiFi_CMD_RESERVED 32 |
#define | WiFi_STATUS_RESERVED -32 |
#define | WiFi_STATUS_SUCCESS 0 |
Successful status code returned by WiFi_control(). More... | |
#define | WiFi_STATUS_ERROR -1 |
Generic error status code returned by WiFi_control(). More... | |
#define | WiFi_STATUS_UNDEFINEDCMD -2 |
An error status code returned by WiFi_control() for undefined command codes. More... | |
Typedefs | |
typedef void(* | WiFi_evntCallback) (long eventType, char *data, unsigned char length) |
A typedef to a an unsolicited event callback function. More... | |
typedef struct WiFi_Config * | WiFi_Handle |
A handle that is returned from a WiFi_open() call. More... | |
typedef struct WiFi_Params | WiFi_Params |
WiFi Parameters. More... | |
typedef void(* | WiFi_InitFxn) (WiFi_Handle handle) |
A function pointer to a driver specific implementation of WiFi_init(). More... | |
typedef WiFi_Handle(* | WiFi_OpenFxn) (WiFi_Handle handle, unsigned int spiIndex, WiFi_evntCallback evntCallback, WiFi_Params *params) |
A function pointer to a driver specific implementation of WiFi_open(). More... | |
typedef void(* | WiFi_CloseFxn) (WiFi_Handle handle) |
A function pointer to a driver specific implementation of WiFi_close(). More... | |
typedef int(* | WiFi_ControlFxn) (WiFi_Handle handle, unsigned int cmd, void *arg) |
A function pointer to a driver specific implementation of WiFi_control(). More... | |
typedef struct WiFi_FxnTable | WiFi_FxnTable |
The definition of a WiFi function table that contains the required set of functions to control a specific WiFi driver implementation. More... | |
typedef struct WiFi_Config | WiFi_Config |
WiFi Global configuration. More... | |
Functions | |
void | WiFi_close (WiFi_Handle handle) |
Function to close a WiFi peripheral specified by the WiFi handle. More... | |
int | WiFi_control (WiFi_Handle handle, unsigned int cmd, void *arg) |
Function performs implementation specific features on a given WiFi_Handle. More... | |
void | WiFi_init (void) |
Function to initialize the WiFi module. More... | |
WiFi_Handle | WiFi_open (unsigned int wifiIndex, unsigned int spiIndex, WiFi_evntCallback evntCallback, WiFi_Params *params) |
Function to initialize a given WiFi peripheral. More... | |
void | WiFi_Params_init (WiFi_Params *params) |
Function to initialize the WiFi_Params structure to its defaults. More... | |
typedef void(* WiFi_evntCallback) (long eventType, char *data, unsigned char length) |
A typedef to a an unsolicited event callback function.
This is the definition describing the function that is to be called when the Wi-Fi device has informed the host MCU that an event has occurred. For more details, see Doxygen documentation for the specific driver\ implementation in use.
eventType | Type of event |
data | Pointer to extra data that some events may supply |
length | Length of data |
typedef struct WiFi_Config* WiFi_Handle |
A handle that is returned from a WiFi_open() call.
typedef struct WiFi_Params WiFi_Params |
WiFi Parameters.
WiFi parameters are used to with the WiFi_open() call. Default values for these parameters are set using WiFi_Params_init().
typedef void(* WiFi_InitFxn) (WiFi_Handle handle) |
A function pointer to a driver specific implementation of WiFi_init().
typedef WiFi_Handle(* WiFi_OpenFxn) (WiFi_Handle handle, unsigned int spiIndex, WiFi_evntCallback evntCallback, WiFi_Params *params) |
A function pointer to a driver specific implementation of WiFi_open().
typedef void(* WiFi_CloseFxn) (WiFi_Handle handle) |
A function pointer to a driver specific implementation of WiFi_close().
typedef int(* WiFi_ControlFxn) (WiFi_Handle handle, unsigned int cmd, void *arg) |
A function pointer to a driver specific implementation of WiFi_control().
typedef struct WiFi_FxnTable WiFi_FxnTable |
The definition of a WiFi function table that contains the required set of functions to control a specific WiFi driver implementation.
typedef struct WiFi_Config WiFi_Config |
WiFi Global configuration.
The WiFi_Config structure contains a set of pointers used to characterize the WiFi driver implementation.
This structure needs to be defined before calling WiFi_init() and it must not be changed thereafter.
void WiFi_close | ( | WiFi_Handle | handle | ) |
Function to close a WiFi peripheral specified by the WiFi handle.
handle | A WiFi_Handle returned from WiFi_open |
int WiFi_control | ( | WiFi_Handle | handle, |
unsigned int | cmd, | ||
void * | arg | ||
) |
Function performs implementation specific features on a given WiFi_Handle.
Commands for WiFi_control can originate from WiFi.h or from implementation specific WiFi*.h (WiFiCC26XX.h, WiFiTiva.h, etc.. ) files. While commands from WiFi.h are API portable across driver implementations, not all implementations may support all these commands. Conversely, commands from driver implementation specific WiFi*.h files add unique driver capabilities but are not API portable across all WiFi driver implementations.
Commands supported by WiFi.h follow a WiFi_CMD_<cmd> naming convention.
Commands supported by WiFi*.h follow a WiFi*_CMD_<cmd> naming convention.
Each control command defines arg differently. The types of arg are documented with each command.
See WiFi_control command codes for command codes.
See WiFi_control return status codes for status codes.
handle | A WiFi handle returned from WiFi_open() |
cmd | WiFi.h or WiFi*.h commands. |
arg | An optional R/W (read/write) command argument accompanied with cmd |
void WiFi_init | ( | void | ) |
Function to initialize the WiFi module.
WiFi_Handle WiFi_open | ( | unsigned int | wifiIndex, |
unsigned int | spiIndex, | ||
WiFi_evntCallback | evntCallback, | ||
WiFi_Params * | params | ||
) |
Function to initialize a given WiFi peripheral.
Function to initialize a given WiFi peripheral specified by the particular index value. It initializes the specified SPI peripheral and registers the callbacks that the Wi-Fi device's host driver requires. WiFi_open() may only be called in the context of a Task.
wifiIndex | Logical peripheral number for the WiFi indexed into the WiFi_config table |
spiIndex | Logical peripheral number for SPI to be used with the WiFi indexed into the SPI_config table |
evntCallback | Pointer to callback function to handle unsolicited events from the WiFi device. For details, see WiFi_evntCallback and the Doxygen documentation for the specific driver implementation in use. |
params | Pointer to an parameter block, if NULL it will use default values. All the fields in this structure are RO (read-only). |
void WiFi_Params_init | ( | WiFi_Params * | params | ) |
Function to initialize the WiFi_Params structure to its defaults.
params | An pointer to WiFi_Params structure for initialization |
Default values are: bitRate = 1000000;