TI-RTOS Drivers
tidrivers_cc32xx_2_16_01_13
|
SPI driver implementation for a CC3200 SPI controller using the micro DMA controller.
============================================================================
The SPI header file should be included in an application as follows:
Refer to SPI.h for a complete description of APIs & example of use.
This SPI driver implementation is designed to operate on a CC3200 SPI controller using a micro DMA controller.
This SPI controller supports a hardware chip select pin. Refer to the device's user manual on how this hardware chip select pin behaves in regards to the SPI frame format.
Chip select type | SPI_MASTER mode | SPI_SLAVE mode |
---|---|---|
Hardware chip select | No action is needed by the application to select the peripheral. | See the device documentation on it's chip select requirements. |
Software chip select | The application is responsible to ensure that correct SPI slave is selected before performing a SPI_transfer(). | See the device documentation on it's chip select requirements. |
This driver is designed to operate with the micro DMA. The micro DMA generates IRQ on the perpheral's interrupt vector. This implementation automatically installs a DMA aware Hwi (interrupt) to service the assigned micro DMA channels.
SPI data frames can be any size from 4-bits to 32-bits. If the dataSize in SPI_Params is greater than 8-bits, then the SPICC3200DMA driver implementation will assume that the SPI_Transaction txBuf and rxBuf point to an array of 16-bit uint16_t elements. The driver will also assume the SPI_Transaction txBuf and rxBuf point to 32-bit uint32_t elements if dataSize is greater than 16-bits.
dataSize | buffer element size |
---|---|
4-8 bits | uint8_t |
9-16 bits | uint16_t |
16-32 bits | uint32_t |
The micro DMA controller only supports data transfers of up to 1024 data frames. A data frame can be 4 to 32 bits in length.
As this driver uses uDMA to transfer data/from data buffers, it is the responsibility of the application to ensure that theses buffers reside in memory that is accessible by the DMA.
#include <ti/drivers/ports/HwiP.h>
#include <ti/drivers/ports/SemaphoreP.h>
#include <ti/drivers/Power.h>
#include <ti/drivers/SPI.h>
Go to the source code of this file.
Data Structures | |
struct | SPICC3200DMA_HWAttrs |
SPICC3200DMA Hardware attributes. More... | |
struct | SPICC3200DMA_Object |
SPICC3200DMA Object. More... | |
Typedefs | |
typedef unsigned long | SPIBaseAddrType |
typedef unsigned long | SPIDataType |
typedef enum SPICC3200DMA_FrameSize | SPICC3200DMA_FrameSize |
SPICC3200DMA data frame size is used to determine how to configure the DMA data transfers. This field is to be only used internally. More... | |
typedef struct SPICC3200DMA_HWAttrs | SPICC3200DMA_HWAttrs |
SPICC3200DMA Hardware attributes. More... | |
typedef struct SPICC3200DMA_Object | SPICC3200DMA_Object |
SPICC3200DMA Object. More... | |
typedef struct SPICC3200DMA_Object * | SPICC3200DMA_Handle |
Enumerations | |
enum | SPICC3200DMA_FrameSize { SPICC3200DMA_8bit = 0, SPICC3200DMA_16bit = 1, SPICC3200DMA_32bit = 2 } |
SPICC3200DMA data frame size is used to determine how to configure the DMA data transfers. This field is to be only used internally. More... | |
Variables | |
const SPI_FxnTable | SPICC3200DMA_fxnTable |
typedef unsigned long SPIBaseAddrType |
typedef unsigned long SPIDataType |
typedef enum SPICC3200DMA_FrameSize SPICC3200DMA_FrameSize |
SPICC3200DMA data frame size is used to determine how to configure the DMA data transfers. This field is to be only used internally.
SPICC3200DMA_8bit: txBuf and rxBuf are arrays of uint8_t elements SPICC3200DMA_16bit: txBuf and rxBuf are arrays of uint16_t elements SPICC3200DMA_32bit: txBuf and rxBuf are arrays of uint32_t elements
typedef struct SPICC3200DMA_HWAttrs SPICC3200DMA_HWAttrs |
SPICC3200DMA Hardware attributes.
These fields, with the exception of intPriority, are used by driverlib APIs and therefore must be populated by driverlib macro definitions. For CCWare these definitions are found in:
intPriority is the SPI peripheral's interrupt priority, as defined by the underlying OS. It is passed unmodified to the underlying OS's interrupt handler creation code, so you need to refer to the OS documentation for usage. For example, for SYS/BIOS applications, refer to the ti.sysbios.family.arm.m3.Hwi documentation for SYS/BIOS usage of interrupt priorities. If the driver uses the ti.drivers.ports interface instead of making OS calls directly, then the HwiP port handles the interrupt priority in an OS specific way. In the case of the SYS/BIOS port, intPriority is passed unmodified to Hwi_create().
A sample structure is shown below:
typedef struct SPICC3200DMA_Object SPICC3200DMA_Object |
SPICC3200DMA Object.
The application must not access any member variables of this structure!
typedef struct SPICC3200DMA_Object * SPICC3200DMA_Handle |
SPICC3200DMA data frame size is used to determine how to configure the DMA data transfers. This field is to be only used internally.
SPICC3200DMA_8bit: txBuf and rxBuf are arrays of uint8_t elements SPICC3200DMA_16bit: txBuf and rxBuf are arrays of uint16_t elements SPICC3200DMA_32bit: txBuf and rxBuf are arrays of uint32_t elements
Enumerator | |
---|---|
SPICC3200DMA_8bit | |
SPICC3200DMA_16bit | |
SPICC3200DMA_32bit |
const SPI_FxnTable SPICC3200DMA_fxnTable |