TI-RTOS Drivers  tidrivers_full_2_20_00_08
Data Structures | Typedefs | Enumerations | Variables
SPICC3200DMA.h File Reference

Detailed Description

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.

SPI Chip Select

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.

DMA Interrupts

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

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

DMA transfer size limit

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.

DMA accessible memory

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>
#include <ti/drivers/dma/UDMACC3200.h>
Include dependency graph for SPICC3200DMA.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_ObjectSPICC3200DMA_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 Documentation

typedef unsigned long SPIBaseAddrType
typedef unsigned long SPIDataType

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

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:

  • driverlib/prcm.h
  • driverlib/spi.h
  • driverlib/udma.h
  • inc/hw_memmap.h
  • inc/hw_ints.h

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:

1 #if defined(__TI_COMPILER_VERSION__)
2 #pragma DATA_ALIGN(scratchBuf, 32)
3 #elif defined(__IAR_SYSTEMS_ICC__)
4 #pragma data_alignment=32
5 #elif defined(__GNUC__)
6 __attribute__ ((aligned (32)))
7 #endif
8 uint32_t scratchBuf;
9 
10 const SPICC3200DMA_HWAttrs SPICC3200DMAHWAttrs[] = {
11  {
12  .baseAddr = GSPI_BASE,
13  .intNum = INT_GSPI,
14  .intPriority = (~0),
15  .spiPRCM = PRCM_GSPI,
16  .csControl = SPI_HW_CTRL_CS,
17  .csPolarity = SPI_CS_ACTIVELOW,
18  .pinMode = SPI_4PIN_MODE,
19  .turboMode = SPI_TURBO_OFF,
20  .scratchBufPtr = &scratchBuf,
21  .defaultTxBufValue = 0,
22  .rxChannelIndex = UDMA_CH6_GSPI_RX,
23  .txChannelIndex = UDMA_CH7_GSPI_TX,
24  .minDmaTransferSize = 100;
25  },
26  ...
27 };

SPICC3200DMA Object.

The application must not access any member variables of this structure!

Enumeration Type Documentation

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 

Variable Documentation

const SPI_FxnTable SPICC3200DMA_fxnTable
Copyright 2016, Texas Instruments Incorporated