SPI.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2018, 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  * values. 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 = (void *)transmitBuffer;
116  * spiTransaction.rxBuf = (void *)receiveBuffer;
117  *
118  * transferOK = SPI_transfer(spi, &spiTransaction);
119  * if (!transferOK) {
120  * // Error in SPI or transfer already in progress.
121  * while (1);
122  * }
123  * @endcode
124  *
125  * More details on usage are provided in the following subsections.
126  *
127  * ### SPI Driver Configuration #
128  *
129  * In order to use the SPI APIs, the application is required
130  * to provide device-specific SPI configuration in the Board.c file.
131  * The SPI driver interface defines a configuration data structure:
132  *
133  * @code
134  * typedef struct SPI_Config_ {
135  * SPI_FxnTable const *fxnTablePtr;
136  * void *object;
137  * void const *hwAttrs;
138  * } SPI_Config;
139  * @endcode
140  *
141  * The application must declare an array of SPI_Config elements, named
142  * SPI_config[]. Each element of SPI_config[] must be populated with
143  * pointers to a device specific SPI driver implementation's function
144  * table, driver object, and hardware attributes. The hardware attributes
145  * define properties such as the SPI peripheral's base address, and
146  * the MOSI and MISO pins. Each element in SPI_config[] corresponds to
147  * a SPI instance, and none of the elements should have NULL pointers.
148  * There is no correlation between the index and the
149  * peripheral designation (such as SPI0 or SPI1). For example, it is
150  * possible to use SPI_config[0] for SPI1.
151  *
152  * Because the SPI configuration is very device dependent, you will need to
153  * check the doxygen for the device specific SPI implementation. There you
154  * will find a description of the SPI hardware attributes. Please also
155  * refer to the Board.c file of any of your examples to see the SPI
156  * configuration.
157  *
158  * ### Initializing the SPI Driver #
159  *
160  * SPI_init() must be called before any other SPI APIs. This function
161  * iterates through the elements of the SPI_config[] array, calling
162  * the element's device implementation SPI initialization function.
163  *
164  * ### SPI Parameters
165  *
166  * The #SPI_Params structure is passed to the SPI_open() call. If NULL
167  * is passed for the parameters, SPI_open() uses default parameters.
168  * A #SPI_Params structure is initialized with default values by passing
169  * it to SPI_Params_init().
170  * Some of the SPI parameters are described below. To see brief descriptions
171  * of all the parameters, see #SPI_Params.
172  *
173  * #### SPI Mode
174  * The SPI driver operates in both SPI master and SPI slave modes.
175  * Logically, the implementation is identical, however the difference
176  * between these two modes is driven by hardware. The default mode is
177  * ::SPI_MASTER, but can be set to slave mode by setting ::SPI_Params.mode
178  * to ::SPI_SLAVE in the parameters passed to SPI_open(). See
179  * <a href="#Master_Slave_Modes"> Master/Slave Modes</a> for further
180  * details.
181  *
182  * #### SPI Transfer Mode
183  * The SPI driver supports two transfer modes of operation: blocking and
184  * callback. The transfer mode is determined by the transferMode parameter
185  * in the SPI_Params data structure. The SPI driver
186  * defaults to blocking mode, if the application does not set it.
187  * Once a SPI driver is opened, the only way to change the operation mode
188  * is to close and re-open the SPI instance with the new transfer mode.
189  *
190  * In blocking mode, a task's code execution is blocked until a SPI
191  * transaction has completed or a timeout has occurred. This ensures
192  * that only one SPI transfer operates at a given time. Other tasks requesting
193  * SPI transfers while a transfer is currently taking place will receive
194  * a FALSE return value. If a timeout occurs the transfer is canceled, the
195  * task is unblocked & will receive a FALSE return value. The transaction
196  * count field will have the amount of frames which were transferred
197  * successfully before the timeout. In blocking mode, transfers cannot be
198  * performed in software or hardware ISR context.
199  *
200  * In callback mode, a SPI transaction functions asynchronously, which
201  * means that it does not block code execution. After a SPI transaction
202  * has been completed, the SPI driver calls a user-provided hook function.
203  * Callback mode is supported in the execution context of tasks and
204  * hardware interrupt routines. However, if a SPI transaction is
205  * requested while a transaction is taking place, SPI_transfer() returns
206  * FALSE.
207  *
208  * #### SPI Frame Formats and Data Size
209  * The SPI driver can configure the device's SPI peripheral to transfer
210  * data in several SPI format options: SPI (with various polarity and phase
211  * settings), TI, and Micro-wire. The frame format is set with
212  * SPI_Params.frameFormat. Some SPI implementations may not support all frame
213  * formats & the SPI driver will fail to opened. Refer to the device specific
214  * implementation documentation for details on which frame formats are
215  * supported.
216  *
217  * The smallest single unit of data transmitted onto the SPI bus is called
218  * a SPI frame and is of size SPI_Params.dataSize. A series of SPI frames
219  * transmitted/received on a SPI bus is known as a SPI transaction.
220  *
221  * ### Opening the SPI Driver #
222  * After initializing the SPI driver by calling SPI_init(), the application
223  * can open a SPI instance by calling SPI_open(). This function
224  * takes an index into the SPI_config[] array, and a SPI parameters data
225  * structure. The SPI instance is specified by the index of the SPI in
226  * SPI_config[]. Only one SPI index can be used at a time;
227  * calling SPI_open() a second time with the same index previously
228  * passed to SPI_open() will result in an error. You can,
229  * though, re-use the index if the instance is closed via SPI_close().
230  *
231  * If no SPI_Params structure is passed to SPI_open(), default values are
232  * used. If the open call is successful, it returns a non-NULL value.
233  *
234  * Example opening a SPI driver instance in blocking mode:
235  * @code
236  * SPI_Handle spi;
237  * SPI_Params spiParams;
238  *
239  * SPI_Params_init(&spiParams);
240  * spiParams.transferMode = SPI_MODE_BLOCKING;
241  * spi = SPI_open(Board_SPI0, &spiParams);
242  *
243  * if (spi == NULL) {
244  * // Error opening SPI
245  * while(1);
246  * }
247  * @endcode
248  *
249  * Example opening a SPI driver instance in callback mode:
250  * @code
251  * SPI_Handle spi;
252  * SPI_Params spiParams;
253  *
254  * SPI_Params_init(&spiParams);
255  * spiParams.transferMode = SPI_MODE_CALLBACK;
256  * spiParams.transferCallbackFxn = UserCallbackFxn;
257  *
258  * spi = SPI_open(Board_SPI0, &spiParams);
259  * if (spi == NULL) {
260  * // Error opening SPI
261  * while (1);
262  * }
263  * @endcode
264  *
265  *
266  * ### SPI Transactions #
267  *
268  * A SPI transaction consists of a series of SPI frames
269  * transmitted/received on a SPI bus. A SPI transaction is performed
270  * using SPI_transfer(). SPI_transfer() accepts a pointer to a
271  * #SPI_Transaction structure that dictates the quantity of data to be
272  * sent and received.
273  * The SPI_Transaction.txBuf and SPI_Transaction.rxBuf are both pointers
274  * to data buffers. If txBuf is NULL, the driver sends SPI frames with all
275  * data set to the default value specified in the hardware attributes. If
276  * rxBuf is NULL, the driver discards all SPI frames received. SPI_transfer()
277  * of a SPI transaction is performed atomically.
278  *
279  * @warning The use of NULL as a sentinel txBuf or rxBuf value to determine
280  * whether the SPI transaction includes a tx or rx component implies
281  * that it is not possible to perform a transmit or receive transfer
282  * directly from/to a buffer with a base address of 0x00000000. To support
283  * this rare use-case, the application will have to manually copy the
284  * contents of location 0x00000000 to/from a temporary buffer before/after
285  * the tx/rx SPI transaction.
286  *
287  * When the SPI is opened, the dataSize value determines the element types
288  * of txBuf and rxBuf. If the dataSize is from 4 to 8 bits, the driver
289  * assumes the data buffers are of type uint8_t (unsigned char). If the
290  * dataSize is from 8 to 16 bits, the driver assumes the data buffers are
291  * of type uint16_t (unsigned short). If the dataSize is greater than
292  * 16 bits, the driver assumes the data buffers are uint32_t (unsigned long).
293  * Some SPI driver implementations may not support all data sizes; refer
294  * to device specific SPI implementation documentation for details on
295  * what data sizes are supported.
296  *
297  * The optional SPI_Transaction.arg variable can only be used when the
298  * SPI driver has been opened in callback mode. This variable is used to
299  * pass a user-defined value into the user-defined callback function.
300  *
301  * SPI_transfer() always performs full-duplex SPI transactions. This means
302  * the SPI simultaneously receives data as it transmits data. The application
303  * is responsible for formatting the data to be transmitted as well as
304  * determining whether the data received is meaningful.
305  * Specifics about SPI frame formatting and data sizes are provided in
306  * device-specific data sheets and technical reference manuals.
307  *
308  * The following code snippets perform SPI transactions.
309  *
310  * Example transferring 6-bit SPI frames. The transmit and receive
311  * buffers are of type uint8_t.
312  * @code
313  * SPI_Transaction spiTransaction;
314  * uint8_t transmitBuffer[BUFSIZE];
315  * uint8_t receiveBuffer[BUFSIZE];
316  * bool transferOK;
317  *
318  * SPI_Params_init(&spiParams);
319  * spiParams.dataSize = 6;
320  * spi = SPI_open(Board_SPI0, &spiParams);
321  * ...
322  * spiTransaction.count = someIntegerValue;
323  * spiTransaction.txBuf = transmitBuffer;
324  * spiTransaction.rxBuf = receiveBuffer;
325  *
326  * transferOK = SPI_transfer(spi, &spiTransaction);
327  * if (!transferOK) {
328  * // Error in SPI or transfer already in progress.
329  * }
330  * @endcode
331  *
332  * Example transferring 12-bit SPI frames. The transmit and receive
333  * buffers are of type uint16_t.
334  * @code
335  * SPI_Transaction spiTransaction;
336  * uint16_t transmitBuffer[BUFSIZE];
337  * uint16_t receiveBuffer[BUFSIZE];
338  * bool transferOK;
339  *
340  * SPI_Params_init(&spiParams);
341  * spiParams.dataSize = 12;
342  * spi = SPI_open(Board_SPI0, &spiParams);
343  * ...
344  * spiTransaction.count = someIntegerValue;
345  * spiTransaction.txBuf = transmitBuffer;
346  * spiTransaction.rxBuf = receiveBuffer;
347  *
348  * transferOK = SPI_transfer(spi, &spiTransaction);
349  * if (!transferOK) {
350  * // Error in SPI or transfer already in progress.
351  * }
352  * @endcode
353  *
354  * ### Canceling a transaction #
355  * SPI_transferCancel() is used to cancel a SPI transaction when the driver is
356  * used in ::SPI_MODE_CALLBACK mode.
357  *
358  * Calling this API while no transfer is in progress has no effect. If a
359  * transfer is in progress, it is canceled and the callback functions is
360  * called.
361  * The ::SPI_Status status field in the ::SPI_Transaction structure
362  * can be examined within the callback to determine if the transaction
363  * succeeded.
364  *
365  * Example:
366  * @code
367  * SPI_transferCancel(spi);
368  * @endcode
369  *
370  *
371  * <h2><a NAME="Master_Slave_Modes">Master/Slave Modes</a></h2>
372  * This SPI driver functions in both SPI master and SPI slave modes.
373  * Logically, the implementation is identical, however the difference between
374  * these two modes is driven by hardware. As a SPI master, the peripheral is
375  * in control of the clock signal and therefore will commence communications
376  * to the SPI slave immediately. As a SPI slave, the SPI driver prepares
377  * the peripheral to transmit and receive data in a way such that the
378  * peripheral is ready to transfer data when the SPI master initiates a
379  * transaction.
380  *
381  * ### Asserting on Chip Select
382  * The SPI protocol requires that the SPI master asserts a SPI slave's chip
383  * select pin prior to starting a SPI transaction. While this protocol is
384  * generally followed, various types of SPI peripherals have different
385  * timing requirements as to when and for how long the chip select pin must
386  * remain asserted for a SPI transaction.
387  *
388  * Commonly, the SPI master uses a hardware chip select to assert and
389  * de-assert the SPI slave for every data frame. In other cases, a SPI slave
390  * imposes the requirement of asserting the chip select over several SPI
391  * data frames. This is generally accomplished by using a regular,
392  * general-purpose output pin. Due to the complexity of such SPI peripheral
393  * implementations, this SPI driver has been designed to operate
394  * transparently to the SPI chip select. When the hardware chip
395  * select is used, the peripheral automatically selects/enables the
396  * peripheral. When using a software chip select, the application needs to
397  * handle the proper chip select and pin configuration. Chip select support
398  * will vary per SPI peripheral, refer to the device specific implementation
399  * documentation for details on chip select support.
400  *
401  * - _Hardware chip select_ No additional action by the application is
402  * required.
403  * - _Software chip select_ The application needs to handle the chip select
404  * assertion and de-assertion for the proper SPI peripheral.
405  *
406  * # Implementation #
407  *
408  * This module serves as the main interface for RTOS applications. Its
409  * purpose is to redirect the module's APIs to specific peripheral
410  * implementations which are specified using a pointer to a #SPI_FxnTable.
411  *
412  * The SPI driver interface module is joined (at link time) to an
413  * array of SPI_Config data structures named *SPI_config*.
414  * The SPI_config array is implemented in the application with each entry
415  * being an instance of a SPI peripheral. Each entry in *SPI_config* contains
416  * the following:
417  * - (SPI_FxnTable *) A pointer to a set of functions that implement a
418  * SPI peripheral.
419  * - (void *) A data object that is associated with the SPI_FxnTable.
420  * - (void *) The hardware attributes that are associated with the
421  * SPI_FxnTable.
422  *
423  *******************************************************************************
424  */
425 
426 #ifndef ti_drivers_SPI__include
427 #define ti_drivers_SPI__include
428 
429 #ifdef __cplusplus
430 extern "C" {
431 #endif
432 
433 #include <stdbool.h>
434 #include <stddef.h>
435 #include <stdint.h>
436 
454 #define SPI_CMD_RESERVED (32)
455 
468 #define SPI_STATUS_RESERVED (-32)
469 
483 #define SPI_STATUS_SUCCESS (0)
484 
491 #define SPI_STATUS_ERROR (-1)
492 
500 #define SPI_STATUS_UNDEFINEDCMD (-2)
501 
511 /* Add SPI_CMD_<commands> here */
512 
520 #define SPI_WAIT_FOREVER (~(0U))
521 
525 typedef struct SPI_Config_ *SPI_Handle;
526 
530 typedef enum SPI_Status_ {
538 } SPI_Status;
539 
548 typedef struct SPI_Transaction_ {
549  /* User input (write-only) fields */
550  size_t count;
551  void *txBuf;
552  void *rxBuf;
553  void *arg;
555  /* User output (read-only) fields */
556  SPI_Status status;
558  void *nextPtr;
561 
569 typedef void (*SPI_CallbackFxn) (SPI_Handle handle,
570  SPI_Transaction *transaction);
575 typedef enum SPI_Mode_ {
578 } SPI_Mode;
579 
584 typedef enum SPI_FrameFormat_ {
589  SPI_TI = 4,
591  SPI_MW = 5
594 
605 typedef enum SPI_TransferMode_ {
618 
627 typedef struct SPI_Params_ {
628  SPI_TransferMode transferMode;
629  uint32_t transferTimeout;
633  uint32_t bitRate;
634  uint32_t dataSize;
636  void *custom;
638 } SPI_Params;
639 
644 typedef void (*SPI_CloseFxn) (SPI_Handle handle);
645 
650 typedef int_fast16_t (*SPI_ControlFxn) (SPI_Handle handle, uint_fast16_t cmd,
651  void *arg);
652 
657 typedef void (*SPI_InitFxn) (SPI_Handle handle);
658 
663 typedef SPI_Handle (*SPI_OpenFxn) (SPI_Handle handle, SPI_Params *params);
664 
669 typedef bool (*SPI_TransferFxn) (SPI_Handle handle,
670  SPI_Transaction *transaction);
671 
676 typedef void (*SPI_TransferCancelFxn) (SPI_Handle handle);
677 
683 typedef struct SPI_FxnTable_ {
686 
689 
692 
695 
698 
701 } SPI_FxnTable;
702 
714 typedef struct SPI_Config_ {
717 
719  void *object;
720 
722  void const *hwAttrs;
723 } SPI_Config;
724 
734 extern void SPI_close(SPI_Handle handle);
735 
773 extern int_fast16_t SPI_control(SPI_Handle handle, uint_fast16_t cmd,
774  void *controlArg);
775 
784 extern void SPI_init(void);
785 
804 extern SPI_Handle SPI_open(uint_least8_t index, SPI_Params *params);
805 
821 extern void SPI_Params_init(SPI_Params *params);
822 
867 extern bool SPI_transfer(SPI_Handle handle, SPI_Transaction *transaction);
868 
886 extern void SPI_transferCancel(SPI_Handle handle);
887 
888 #ifdef __cplusplus
889 }
890 #endif
891 
892 #endif /* ti_drivers_SPI__include */
void SPI_init(void)
This function initializes the SPI module.
SPI_Mode mode
Definition: SPI.h:632
enum SPI_Status_ SPI_Status
Status codes that are set by the SPI driver.
Definition: SPI.h:576
void * rxBuf
Definition: SPI.h:552
SPI_FrameFormat_
Definitions for various SPI data frame formats.
Definition: SPI.h:584
SPI_CloseFxn closeFxn
Definition: SPI.h:685
void const * hwAttrs
Definition: SPI.h:722
Definition: SPI.h:616
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:569
enum SPI_Mode_ SPI_Mode
Definitions for various SPI modes of operation.
SPI_InitFxn initFxn
Definition: SPI.h:691
A SPI_Transaction data structure is used with SPI_transfer(). It indicates how many SPI_FrameFormat f...
Definition: SPI.h:548
Definition: SPI.h:591
SPI_ControlFxn controlFxn
Definition: SPI.h:688
SPI_TransferFxn transferFxn
Definition: SPI.h:697
uint32_t bitRate
Definition: SPI.h:633
uint32_t dataSize
Definition: SPI.h:634
void SPI_transferCancel(SPI_Handle handle)
Function to cancel SPI transactions.
SPI_FxnTable const * fxnTablePtr
Definition: SPI.h:716
void SPI_Params_init(SPI_Params *params)
Function to initialize the SPI_Params struct to its defaults.
Definition: SPI.h:589
Definition: SPI.h:585
bool(* SPI_TransferFxn)(SPI_Handle handle, SPI_Transaction *transaction)
A function pointer to a driver specific implementation of SPI_transfer().
Definition: SPI.h:669
size_t count
Definition: SPI.h:550
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:610
SPI_TransferCancelFxn transferCancelFxn
Definition: SPI.h:700
void(* SPI_TransferCancelFxn)(SPI_Handle handle)
A function pointer to a driver specific implementation of SPI_transferCancel().
Definition: SPI.h:676
SPI_Status_
Status codes that are set by the SPI driver.
Definition: SPI.h:530
uint32_t transferTimeout
Definition: SPI.h:629
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:644
Definition: SPI.h:586
The definition of a SPI function table that contains the required set of functions to control a speci...
Definition: SPI.h:683
Definition: SPI.h:535
SPI Parameters.
Definition: SPI.h:627
SPI_Status status
Definition: SPI.h:556
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:551
Definition: SPI.h:531
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:714
SPI_OpenFxn openFxn
Definition: SPI.h:694
Definition: SPI.h:536
SPI_Mode_
Definitions for various SPI modes of operation.
Definition: SPI.h:575
void * custom
Definition: SPI.h:636
enum SPI_FrameFormat_ SPI_FrameFormat
Definitions for various SPI data frame formats.
Definition: SPI.h:577
void SPI_close(SPI_Handle handle)
Function to close a SPI peripheral specified by the SPI handle.
Definition: SPI.h:534
SPI_TransferMode transferMode
Definition: SPI.h:628
struct SPI_Config_ * SPI_Handle
A handle that is returned from a SPI_open() call.
Definition: SPI.h:525
SPI_Handle SPI_open(uint_least8_t index, SPI_Params *params)
This function opens a given SPI peripheral.
void * arg
Definition: SPI.h:553
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:650
void(* SPI_InitFxn)(SPI_Handle handle)
A function pointer to a driver specific implementation of SPI_init().
Definition: SPI.h:657
Definition: SPI.h:532
Definition: SPI.h:588
SPI_Handle(* SPI_OpenFxn)(SPI_Handle handle, SPI_Params *params)
A function pointer to a driver specific implementation of SPI_open().
Definition: SPI.h:663
void * nextPtr
Definition: SPI.h:558
Definition: SPI.h:533
SPI_FrameFormat frameFormat
Definition: SPI.h:635
Definition: SPI.h:537
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:631
Definition: SPI.h:587
SPI_TransferMode_
SPI transfer mode determines the whether the SPI controller operates synchronously or asynchronously...
Definition: SPI.h:605
void * object
Definition: SPI.h:719
© Copyright 1995-2018, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale