SimpleLink MCU SDK Driver APIs  tidrivers_msp43x_3_01_01_03
SPI.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2016, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 /*!*****************************************************************************
33  * @file SPI.h
34  *
35  * @brief SPI driver interface
36  *
37  * The SPI driver interface provides device independent APIs, data types,
38  * and macros. The SPI header file should be included in an application as
39  * follows:
40  * @code
41  * #include <ti/drivers/SPI.h>
42  * @endcode
43  *
44  * # Overview #
45  * The Serial Peripheral Interface (SPI) driver is a generic, full-duplex
46  * driver that transmits and receives data on a SPI bus. SPI is sometimes
47  * called SSI (Synchronous Serial Interface).
48  * The SPI protocol defines the format of a data transfer over the SPI bus,
49  * but it leaves flow control, data formatting, and handshaking mechanisms
50  * to higher-level software layers.
51  *
52  * The APIs in this driver serve as an interface to a typical RTOS
53  * application. Its purpose is to redirect the SPI APIs to specific
54  * driver implementations which are specified using a pointer to a
55  * #SPI_FxnTable. The specific SPI implementations are responsible for
56  * creating all the RTOS specific primitives to allow for thread-safe
57  * operation.
58  *
59  * The SPI driver operates on some key definitions and assumptions:
60  * - The driver operates transparently from the chip select. Some SPI
61  * controllers feature a hardware chip select to assert SPI slave
62  * peripherals. See the specific peripheral implementations on chip
63  * select requirements.
64  *
65  * - The SPI protocol does not account for a built-in handshaking mechanism
66  * and neither does this SPI driver. Therefore, when operating in
67  * ::SPI_SLAVE mode, the application must provide such a mechanism to
68  * ensure that the SPI slave is ready for the SPI master. The SPI slave
69  * must call SPI_transfer() *before* the SPI master starts transmitting.
70  * Some example application mechanisms could include:
71  * - Timed delays on the SPI master to guarantee the SPI slave is ready
72  * for a SPI transaction.
73  * - A form of GPIO flow control from the slave to the SPI master to notify
74  * the master when ready.
75  *
76  * # Usage #
77  *
78  * To use the SPI driver to send data over the SPI bus, the application
79  * calls the following APIs:
80  * - SPI_init(): Initialize the SPI driver.
81  * - SPI_Params_init(): Initialize a #SPI_Params structure with default
82  * vaules. Then change the parameters from non-default values as
83  * needed.
84  * - SPI_open(): Open an instance of the SPI driver, passing the
85  * initialized parameters, or NULL, and an index (described later).
86  * - SPI_transfer(): Transmit/receive data. This function takes a
87  * #SPI_Transaction argument that specifies buffers for data to be
88  * transmitted/received.
89  * - SPI_close(): De-initialize the SPI instance.
90  *
91  * The following code example opens a SPI instance as a master SPI,
92  * and issues a transaction.
93  *
94  * @code
95  * SPI_Handle spi;
96  * SPI_Params spiParams;
97  * SPI_Transaction spiTransaction;
98  * uint8_t transmitBuffer[MSGSIZE];
99  * uint8_t receiveBuffer[MSGSIZE];
100  * bool transferOK;
101  *
102  * SPI_init(); // Initialize the SPI driver
103  *
104  * SPI_Params_init(&spiParams); // Initialize SPI parameters
105  * spiParams.dataSize = 8; // 8-bit data size
106  *
107  * spi = SPI_open(Board_SPI0, &spiParams);
108  * if (spi == NULL) {
109  * while (1); // SPI_open() failed
110  * }
111  *
112  * // Fill in transmitBuffer
113  *
114  * spiTransaction.count = MSGSIZE;
115  * spiTransaction.txBuf = transmitBuffer;
116  * spiTransaction.rxBuf = receiveBuffer;
117  *
118  * transferOK = SPI_transfer(spi, &spiTransaction);
119  * if (!transferOK) {
120  * // Error in SPI or transfer already in progress.
121  * }
122  * @endcode
123  *
124  * More details on usage are provided in the following subsections.
125  *
126  * ### SPI Driver Configuration #
127  *
128  * In order to use the SPI APIs, the application is required
129  * to provide device-specific SPI configuration in the Board.c file.
130  * The SPI driver interface defines a configuration data structure:
131  *
132  * @code
133  * typedef struct SPI_Config_ {
134  * SPI_FxnTable const *fxnTablePtr;
135  * void *object;
136  * void const *hwAttrs;
137  * } SPI_Config;
138  * @endcode
139  *
140  * The application must declare an array of SPI_Config elements, named
141  * SPI_config[]. Each element of SPI_config[] must be populated with
142  * pointers to a device specific SPI driver implementation's function
143  * table, driver object, and hardware attributes. The hardware attributes
144  * define properties such as the SPI peripheral's base address, and
145  * the MOSI and MISO pins. Each element in SPI_config[] corresponds to
146  * a SPI instance, and none of the elements should have NULL pointers.
147  * There is no correlation between the index and the
148  * peripheral designation (such as SPI0 or SPI1). For example, it is
149  * possible to use SPI_config[0] for SPI1.
150  *
151  * Because the SPI configuration is very device dependent, you will need to
152  * check the doxygen for the device specific SPI implementation. There you
153  * will find a description of the SPI hardware attributes. Please also
154  * refer to the Board.c file of any of your examples to see the SPI
155  * configuration.
156  *
157  * ### Initializing the SPI Driver #
158  *
159  * SPI_init() must be called before any other SPI APIs. This function
160  * iterates through the elements of the SPI_config[] array, calling
161  * the element's device implementation SPI initialization function.
162  *
163  * ### SPI Parameters
164  *
165  * The #SPI_Params structure is passed to the SPI_open() call. If NULL
166  * is passed for the parameters, SPI_open() uses default parameters.
167  * A #SPI_Params structure is initialized with default values by passing
168  * it to SPI_Params_init().
169  * Some of the SPI parameters are described below. To see brief descriptions
170  * of all the parameters, see #SPI_Params.
171  *
172  * #### SPI Mode
173  * The SPI driver operates in both SPI master and SPI slave modes.
174  * Logically, the implementation is identical, however the difference
175  * between these two modes is driven by hardware. The default mode is
176  * ::SPI_MASTER, but can be set to slave mode by setting ::SPI_Params.mode
177  * to ::SPI_SLAVE in the parameters passed to SPI_open(). See
178  * <a href="#Master_Slave_Modes"> Master/Slave Modes</a> for further
179  * details.
180  *
181  * #### SPI Transfer Mode
182  * The SPI driver supports two transfer modes of operation: blocking and
183  * callback. The transfer mode is determined by the transferMode parameter
184  * in the SPI_Params data structure. The SPI driver
185  * defaults to blocking mode, if the application does not set it.
186  * Once a SPI driver is opened, the only way to change the operation mode
187  * is to close and re-open the SPI instance with the new transfer mode.
188  *
189  * In blocking mode, a task's code execution is blocked until a SPI
190  * transaction has completed. This ensures that only one SPI transaction
191  * operates at a given time. Other tasks requesting SPI transactions while
192  * a transaction is currently taking place are also placed into a blocked
193  * state. SPI transactions are executed in the order in which they were
194  * received. In blocking mode, you cannot perform SPI transactions
195  * in the context of a software or hardware ISR.
196  *
197  * In callback mode, a SPI transaction functions asynchronously, which
198  * means that it does not block code execution. After a SPI transaction
199  * has been completed, the SPI driver calls a user-provided hook function.
200  * Callback mode is supported in the execution context of tasks and
201  * hardware interrupt routines. However, if a SPI transaction is
202  * requested while a transaction is taking place, SPI_transfer() returns
203  * FALSE.
204  *
205  *
206  * #### SPI Frame Formats and Data Size
207  * The SPI driver can configure the device's SPI peripheral with various
208  * SPI format options: SPI (with various polarity and phase settings),
209  * TI, and Micro-wire. The frame format is set with SPI_Params.frameFormat.
210  * The smallest single unit of data transmitted onto the SPI bus is called
211  * a SPI frame and is of size SPI_Params.dataSize. A series of SPI frames
212  * transmitted/received on a SPI bus is known as a SPI transaction.
213  *
214  * ### Opening the SPI Driver #
215  * After initializing the SPI driver by calling SPI_init(), the application
216  * can open a SPI instance by calling SPI_open(). This function
217  * takes an index into the SPI_config[] array, and a SPI parameters data
218  * structure. The SPI instance is specified by the index of the SPI in
219  * SPI_config[]. Only one SPI index can be used at a time;
220  * calling SPI_open() a second time with the same index previosly
221  * passed to SPI_open() will result in an error. You can,
222  * though, re-use the index if the instance is closed via SPI_close().
223  *
224  * If no SPI_Params structure is passed to SPI_open(), default values are
225  * used. If the open call is successful, it returns a non-NULL value.
226  *
227  * Example opening a SPI driver instance in blocking mode:
228  * @code
229  * SPI_Handle spi;
230  * SPI_Params spiParams;
231  *
232  * SPI_Params_init(&spiParams);
233  * spiParams.transferMode = SPI_MODE_BLOCKING;
234  * spi = SPI_open(Board_SPI0, &spiParams);
235  *
236  * if (spi == NULL) {
237  * // Error opening SPI
238  * }
239  * @endcode
240  *
241  * Example opening a SPI driver instance in callback mode:
242  * @code
243  * SPI_Handle spi;
244  * SPI_Params spiParams;
245  *
246  * SPI_Params_init(&spiParams);
247  * spiParams.transferMode = SPI_MODE_CALLBACK;
248  * spiParams.transferCallbackFxn = UserCallbackFxn;
249  *
250  * spi = SPI_open(Board_SPI0, &spiParams);
251  * if (spi == NULL) {
252  * // Error opening SPI
253  * }
254  * @endcode
255  *
256  *
257  * ### SPI Transactions #
258  *
259  * A SPI transaction consists of a series of SPI frames
260  * transmitted/received on a SPI bus. A SPI transaction is performed
261  * using SPI_transfer(). SPI_transfer() accepts a pointer to a
262  * #SPI_Transaction structure that dictates the quantity of data to be
263  * sent and received.
264  * The SPI_Transaction.txBuf and SPI_Transaction.rxBuf are both pointers
265  * to data buffers. If txBuf is NULL, the driver sends SPI frames with all
266  * data bits set to 0. If rxBuf is NULL, the driver discards all SPI frames
267  * received.
268  * A SPI_transfer() of a SPI transaction is performed atomically.
269  *
270  * When the SPI is opened, the dataSize value determines the element types
271  * of txBuf and rxBuf. If the dataSize is from 4 to 8 bits, the driver
272  * assumes the data buffers are of type uint8_t (unsigned char). If the
273  * dataSize is larger than 8 bits, the driver assumes the data buffers are
274  * of type uint16_t (unsigned short).
275  * The optional SPI_Transaction.arg variable can only be used when the
276  * SPI driver has been opened in callback mode. This variable is used to
277  * pass a user-defined value into the user-defined callback function.
278  *
279  * SPI_transfer() always performs full-duplex SPI transactions. This means
280  * the SPI simultaneously receives data as it transmits data. The application
281  * is responsible for formatting the data to be transmitted as well as
282  * determining whether the data received is meaningful.
283  * Specifics about SPI frame formatting and data sizes are provided in
284  * device-specific data sheets and technical reference manuals.
285  *
286  * The following code snippets perform SPI transactions.
287  *
288  * Example transferring 6-bit SPI frames. The transmit and receive
289  * buffers are of type uint8_t.
290  * @code
291  * SPI_Transaction spiTransaction;
292  * uint8_t transmitBuffer[BUFSIZE];
293  * uint8_t receiveBuffer[BUFSIZE];
294  * bool transferOK;
295  *
296  * SPI_Params_init(&spiParams);
297  * spiParams.dataSize = 6;
298  * spi = SPI_open(Board_SPI0, &spiParams);
299  * ...
300  * spiTransaction.count = someIntegerValue;
301  * spiTransaction.txBuf = transmitBuffer;
302  * spiTransaction.rxBuf = receiveBuffer;
303  *
304  * ret = SPI_transfer(spi, &spiTransaction);
305  * if (!transferOK) {
306  * // Unsuccessful SPI transfer
307  * }
308  * @endcode
309  *
310  * Example transferring 12-bit SPI frames. The transmit and receive
311  * buffers are of type uint16_t.
312  * @code
313  * SPI_Transaction spiTransaction;
314  * uint16_t transmitBuffer[BUFSIZE];
315  * uint16_t receiveBuffer[BUFSIZE];
316  * bool transferOK;
317  *
318  * SPI_Params_init(&spiParams);
319  * spiParams.dataSize = 12;
320  * spi = SPI_open(Board_SPI0, &spiParams);
321  * ...
322  * spiTransaction.count = someIntegerValue;
323  * spiTransaction.txBuf = transmitBuffer;
324  * spiTransaction.rxBuf = receiveBuffer;
325  *
326  * ret = SPI_transfer(spi, &spiTransaction);
327  * if (!transferOK) {
328  * // Unsuccessful SPI transfer
329  * }
330  * @endcode
331  *
332  * ### Canceling a transaction #
333  * SPI_transferCancel() is used to cancel a SPI transaction when the driver is
334  * used in ::SPI_MODE_CALLBACK mode.
335  *
336  * Calling this API while no transfer is in progress has no effect. If a
337  * transfer is in progress, it is canceled and the callback functions is
338  * called.
339  * The ::SPI_Status status field in the ::SPI_Transaction structure
340  * can be examined within the callback to determine if the transaction
341  * succeeded.
342  *
343  * Example:
344  * @code
345  * SPI_transferCancel(spi);
346  * @endcode
347  *
348  *
349  * <h2><a NAME="Master_Slave_Modes">Master/Slave Modes</a></h2>
350  * This SPI driver functions in both SPI master and SPI slave modes.
351  * Logically, the implementation is identical, however the difference between
352  * these two modes is driven by hardware. As a SPI master, the peripheral is
353  * in control of the clock signal and therefore will commence communications
354  * to the SPI slave immediately. As a SPI slave, the SPI driver prepares
355  * the peripheral to transmit and receive data in a way such that the
356  * peripheral is ready to transfer data when the SPI master initiates a
357  * transaction.
358  *
359  * ### Asserting on Chip Select
360  * The SPI protocol requires that the SPI master asserts a SPI slave's chip
361  * select pin prior to starting a SPI transaction. While this protocol is
362  * generally followed, various types of SPI peripherals have different
363  * timing requirements as to when and for how long the chip select pin must
364  * remain asserted for a SPI transaction.
365  *
366  * Commonly, the SPI master uses a hardware chip select to assert and
367  * de-assert the SPI slave for every data frame. In other cases, a SPI slave
368  * imposes the requirement of asserting the chip select over several SPI
369  * data frames. This is generally accomplished by using a regular,
370  * general-purpose output pin. Due to the complexity of such SPI peripheral
371  * implementations, this SPI driver has been designed to operate
372  * transparently to the SPI chip select. When the hardware chip
373  * select is used, the peripheral automatically selects/enables the
374  * peripheral. When using a software chip select, the application needs to
375  * handle the proper chip select and pin configuration.
376  *
377  * - _Hardware chip select_ No additional action by the application is
378  * required.
379  * - _Software chip select_ The application needs to handle the chip select
380  * assertion and de-assertion for the proper SPI peripheral.
381  *
382  * # Implementation #
383  *
384  * This module serves as the main interface for RTOS applications. Its
385  * purpose is to redirect the module's APIs to specific peripheral
386  * implementations which are specified using a pointer to a #SPI_FxnTable.
387  *
388  * The SPI driver interface module is joined (at link time) to an
389  * array of SPI_Config data structures named *SPI_config*.
390  * The SPI_config array is implemented in the application with each entry
391  * being an instance of a SPI peripheral. Each entry in *SPI_config* contains
392  * the following:
393  * - (SPI_FxnTable *) A pointer to a set of functions that implement a
394  * SPI peripheral.
395  * - (void *) A data object that is associated with the SPI_FxnTable.
396  * - (void *) The hardware attributes that are associated with the
397  * SPI_FxnTable.
398  *
399  *******************************************************************************
400  */
401 
402 #ifndef ti_drivers_SPI__include
403 #define ti_drivers_SPI__include
404 
405 #ifdef __cplusplus
406 extern "C" {
407 #endif
408 
409 #include <stdint.h>
410 #include <stdbool.h>
411 #include <stddef.h>
412 
430 #define SPI_CMD_RESERVED (32)
431 
444 #define SPI_STATUS_RESERVED (-32)
445 
459 #define SPI_STATUS_SUCCESS (0)
460 
467 #define SPI_STATUS_ERROR (-1)
468 
476 #define SPI_STATUS_UNDEFINEDCMD (-2)
477 
487 /* Add SPI_CMD_<commands> here */
488 
496 #define SPI_WAIT_FOREVER (~(0U))
497 
501 typedef struct SPI_Config_ *SPI_Handle;
502 
506 typedef enum SPI_Status_ {
512 } SPI_Status;
513 
522 typedef struct SPI_Transaction_ {
523  /* User input (write-only) fields */
524  size_t count;
525  void *txBuf;
526  void *rxBuf;
527  void *arg;
529  /* User output (read-only) fields */
532 
540 typedef void (*SPI_CallbackFxn) (SPI_Handle handle,
541  SPI_Transaction *transaction);
546 typedef enum SPI_Mode_ {
549 } SPI_Mode;
550 
555 typedef enum SPI_FrameFormat_ {
560  SPI_TI = 4,
561  SPI_MW = 5
563 
574 typedef enum SPI_TransferMode_ {
586 
595 typedef struct SPI_Params_ {
597  uint32_t transferTimeout;
602  uint32_t bitRate;
603  uint32_t dataSize;
605  void *custom;
607 } SPI_Params;
608 
613 typedef void (*SPI_CloseFxn) (SPI_Handle handle);
614 
619 typedef int_fast16_t (*SPI_ControlFxn) (SPI_Handle handle, uint_fast16_t cmd,
620  void *arg);
621 
626 typedef void (*SPI_InitFxn) (SPI_Handle handle);
627 
632 typedef SPI_Handle (*SPI_OpenFxn) (SPI_Handle handle, SPI_Params *params);
633 
638 typedef bool (*SPI_TransferFxn) (SPI_Handle handle,
639  SPI_Transaction *transaction);
640 
645 typedef void (*SPI_TransferCancelFxn) (SPI_Handle handle);
646 
652 typedef struct SPI_FxnTable_ {
655 
658 
661 
664 
667 
670 } SPI_FxnTable;
671 
683 typedef struct SPI_Config_ {
686 
688  void *object;
689 
691  void const *hwAttrs;
692 } SPI_Config;
693 
703 extern void SPI_close(SPI_Handle handle);
704 
742 extern int_fast16_t SPI_control(SPI_Handle handle, uint_fast16_t cmd,
743  void *controlArg);
744 
753 extern void SPI_init(void);
754 
773 extern SPI_Handle SPI_open(uint_least8_t index, SPI_Params *params);
774 
790 extern void SPI_Params_init(SPI_Params *params);
791 
821 extern bool SPI_transfer(SPI_Handle handle, SPI_Transaction *transaction);
822 
840 extern void SPI_transferCancel(SPI_Handle handle);
841 
842 #ifdef __cplusplus
843 }
844 #endif
845 
846 #endif /* ti_drivers_SPI__include */
void SPI_init(void)
This function initializes the SPI module.
SPI_Mode mode
Definition: SPI.h:601
enum SPI_Status_ SPI_Status
Status codes that are set by the SPI driver.
Definition: SPI.h:547
void * rxBuf
Definition: SPI.h:526
SPI_FrameFormat_
Definitions for various SPI data frame formats.
Definition: SPI.h:555
SPI_CloseFxn closeFxn
Definition: SPI.h:654
void const * hwAttrs
Definition: SPI.h:691
Definition: SPI.h:584
void(* SPI_CallbackFxn)(SPI_Handle handle, SPI_Transaction *transaction)
The definition of a callback function used by the SPI driver when used in SPI_MODE_CALLBACK.
Definition: SPI.h:540
enum SPI_Mode_ SPI_Mode
Definitions for various SPI modes of operation.
SPI_InitFxn initFxn
Definition: SPI.h:660
A SPI_Transaction data structure is used with SPI_transfer(). It indicates how many SPI_FrameFormat f...
Definition: SPI.h:522
Definition: SPI.h:561
SPI_ControlFxn controlFxn
Definition: SPI.h:657
SPI_TransferFxn transferFxn
Definition: SPI.h:666
uint32_t bitRate
Definition: SPI.h:602
uint32_t dataSize
Definition: SPI.h:603
void SPI_transferCancel(SPI_Handle handle)
Function to cancel SPI transactions.
SPI_FxnTable const * fxnTablePtr
Definition: SPI.h:685
void SPI_Params_init(SPI_Params *params)
Function to initialize the SPI_Params struct to its defaults.
Definition: SPI.h:560
Definition: SPI.h:556
bool(* SPI_TransferFxn)(SPI_Handle handle, SPI_Transaction *transaction)
A function pointer to a driver specific implementation of SPI_transfer().
Definition: SPI.h:638
size_t count
Definition: SPI.h:524
struct SPI_Transaction_ SPI_Transaction
A SPI_Transaction data structure is used with SPI_transfer(). It indicates how many SPI_FrameFormat f...
Definition: SPI.h:579
SPI_TransferCancelFxn transferCancelFxn
Definition: SPI.h:669
void(* SPI_TransferCancelFxn)(SPI_Handle handle)
A function pointer to a driver specific implementation of SPI_transferCancel().
Definition: SPI.h:645
SPI_Status_
Status codes that are set by the SPI driver.
Definition: SPI.h:506
uint32_t transferTimeout
Definition: SPI.h:597
enum SPI_TransferMode_ SPI_TransferMode
SPI transfer mode determines the whether the SPI controller operates synchronously or asynchronously...
void(* SPI_CloseFxn)(SPI_Handle handle)
A function pointer to a driver specific implementation of SPI_close().
Definition: SPI.h:613
Definition: SPI.h:557
The definition of a SPI function table that contains the required set of functions to control a speci...
Definition: SPI.h:652
Definition: SPI.h:511
SPI Parameters.
Definition: SPI.h:595
SPI_Status status
Definition: SPI.h:530
int_fast16_t SPI_control(SPI_Handle handle, uint_fast16_t cmd, void *controlArg)
Function performs implementation specific features on a given SPI_Handle.
struct SPI_Params_ SPI_Params
SPI Parameters.
void * txBuf
Definition: SPI.h:525
Definition: SPI.h:507
bool SPI_transfer(SPI_Handle handle, SPI_Transaction *transaction)
Function to perform SPI transactions.
struct SPI_Config_ SPI_Config
SPI Global configuration.
SPI Global configuration.
Definition: SPI.h:683
SPI_OpenFxn openFxn
Definition: SPI.h:663
SPI_Mode_
Definitions for various SPI modes of operation.
Definition: SPI.h:546
void * custom
Definition: SPI.h:605
enum SPI_FrameFormat_ SPI_FrameFormat
Definitions for various SPI data frame formats.
Definition: SPI.h:548
void SPI_close(SPI_Handle handle)
Function to close a SPI peripheral specified by the SPI handle.
Definition: SPI.h:510
SPI_TransferMode transferMode
Definition: SPI.h:596
struct SPI_Config_ * SPI_Handle
A handle that is returned from a SPI_open() call.
Definition: SPI.h:501
SPI_Handle SPI_open(uint_least8_t index, SPI_Params *params)
This function opens a given SPI peripheral.
void * arg
Definition: SPI.h:527
int_fast16_t(* SPI_ControlFxn)(SPI_Handle handle, uint_fast16_t cmd, void *arg)
A function pointer to a driver specific implementation of SPI_control().
Definition: SPI.h:619
void(* SPI_InitFxn)(SPI_Handle handle)
A function pointer to a driver specific implementation of SPI_init().
Definition: SPI.h:626
Definition: SPI.h:508
Definition: SPI.h:559
SPI_Handle(* SPI_OpenFxn)(SPI_Handle handle, SPI_Params *params)
A function pointer to a driver specific implementation of SPI_open().
Definition: SPI.h:632
Definition: SPI.h:509
SPI_FrameFormat frameFormat
Definition: SPI.h:604
struct SPI_FxnTable_ SPI_FxnTable
The definition of a SPI function table that contains the required set of functions to control a speci...
SPI_CallbackFxn transferCallbackFxn
Definition: SPI.h:600
Definition: SPI.h:558
SPI_TransferMode_
SPI transfer mode determines the whether the SPI controller operates synchronously or asynchronously...
Definition: SPI.h:574
void * object
Definition: SPI.h:688
Copyright 2016, Texas Instruments Incorporated