Data Structures | Macros | Typedefs | Enumerations | Variables
SPICC32XXDMA.h File Reference

Detailed Description

SPI driver implementation for a CC32XX 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 CC32XX 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 an IRQ on the perpheral's interrupt vector. This implementation automatically installs a DMA aware hardware ISR to service the assigned micro DMA channels.

SPI data frames

SPI data frames can be any size from 4-bits to 32-bits. The SPI data frame size is set in SPI_Params.dataSize passed to SPI_open. The SPICC32XXDMA driver implementation makes assumptions on the element size of the SPI_Transaction txBuf and rxBuf arrays, based on the data frame size. If the data frame size is less than or equal to 8 bits, txBuf and rxBuf are assumed to be arrays of 8-bit uint8_t elements. If the data frame size is greater than 8 bits, but less than or equal to 16 bits, txBuf and rxBuf are assumed to be arrays of 16-bit uint16_t elements. Otherwise, txBuf and rxBuf are assumed to point to 32-bit uint32_t elements.

data frame size 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 these buffers reside in memory that is accessible by the DMA.

#include <ti/drivers/dpl/HwiP.h>
#include <ti/drivers/dpl/SemaphoreP.h>
#include <ti/drivers/Power.h>
#include <ti/drivers/SPI.h>
#include <ti/drivers/dma/UDMACC32XX.h>

Go to the source code of this file.

Data Structures

struct  SPICC32XXDMA_HWAttrsV1
 SPICC32XXDMA Hardware attributes. More...
 
struct  SPICC32XXDMA_Object
 SPICC32XXDMA Object. More...
 

Macros

#define SPICC32XXDMA_PIN_05_CLK   0x0704
 
#define SPICC32XXDMA_PIN_06_MISO   0x0705
 
#define SPICC32XXDMA_PIN_07_MOSI   0x0706
 
#define SPICC32XXDMA_PIN_08_CS   0x0707
 
#define SPICC32XXDMA_PIN_45_CLK   0x072C
 
#define SPICC32XXDMA_PIN_50_CS   0x0931
 
#define SPICC32XXDMA_PIN_52_MOSI   0x0833
 
#define SPICC32XXDMA_PIN_53_MISO   0x0734
 
#define SPICC32XXDMA_PIN_NO_CONFIG   0xFFFF
 

Typedefs

typedef unsigned long SPIBaseAddrType
 
typedef unsigned long SPIDataType
 
typedef enum SPICC32XXDMA_FrameSize SPICC32XXDMA_FrameSize
 SPICC32XXDMA 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 SPICC32XXDMA_HWAttrsV1 SPICC32XXDMA_HWAttrsV1
 SPICC32XXDMA Hardware attributes. More...
 
typedef struct SPICC32XXDMA_Object SPICC32XXDMA_Object
 SPICC32XXDMA Object. More...
 
typedef struct SPICC32XXDMA_ObjectSPICC32XXDMA_Handle
 

Enumerations

enum  SPICC32XXDMA_FrameSize { SPICC32XXDMA_8bit = 0, SPICC32XXDMA_16bit = 1, SPICC32XXDMA_32bit = 2 }
 SPICC32XXDMA 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 SPICC32XXDMA_fxnTable
 

Macro Definition Documentation

§ SPICC32XXDMA_PIN_05_CLK

#define SPICC32XXDMA_PIN_05_CLK   0x0704

§ SPICC32XXDMA_PIN_06_MISO

#define SPICC32XXDMA_PIN_06_MISO   0x0705

§ SPICC32XXDMA_PIN_07_MOSI

#define SPICC32XXDMA_PIN_07_MOSI   0x0706

§ SPICC32XXDMA_PIN_08_CS

#define SPICC32XXDMA_PIN_08_CS   0x0707

§ SPICC32XXDMA_PIN_45_CLK

#define SPICC32XXDMA_PIN_45_CLK   0x072C

§ SPICC32XXDMA_PIN_50_CS

#define SPICC32XXDMA_PIN_50_CS   0x0931

§ SPICC32XXDMA_PIN_52_MOSI

#define SPICC32XXDMA_PIN_52_MOSI   0x0833

§ SPICC32XXDMA_PIN_53_MISO

#define SPICC32XXDMA_PIN_53_MISO   0x0734

§ SPICC32XXDMA_PIN_NO_CONFIG

#define SPICC32XXDMA_PIN_NO_CONFIG   0xFFFF

Typedef Documentation

§ SPIBaseAddrType

typedef unsigned long SPIBaseAddrType

§ SPIDataType

typedef unsigned long SPIDataType

§ SPICC32XXDMA_FrameSize

SPICC32XXDMA data frame size is used to determine how to configure the DMA data transfers. This field is to be only used internally.

SPICC32XXDMA_8bit: txBuf and rxBuf are arrays of uint8_t elements SPICC32XXDMA_16bit: txBuf and rxBuf are arrays of uint16_t elements SPICC32XXDMA_32bit: txBuf and rxBuf are arrays of uint32_t elements

§ SPICC32XXDMA_HWAttrsV1

SPICC32XXDMA 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.dpl 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:

#if defined(__TI_COMPILER_VERSION__)
#pragma DATA_ALIGN(scratchBuf, 32)
#elif defined(__IAR_SYSTEMS_ICC__)
#pragma data_alignment=32
#elif defined(__GNUC__)
__attribute__ ((aligned (32)))
#endif
uint32_t scratchBuf;
const SPICC32XXDMA_HWAttrsV1 SPICC32XXDMAHWAttrs[] = {
{
.baseAddr = GSPI_BASE,
.intNum = INT_GSPI,
.intPriority = (~0),
.spiPRCM = PRCM_GSPI,
.csControl = SPI_HW_CTRL_CS,
.csPolarity = SPI_CS_ACTIVELOW,
.pinMode = SPI_4PIN_MODE,
.turboMode = SPI_TURBO_OFF,
.scratchBufPtr = &scratchBuf,
.defaultTxBufValue = 0,
.rxChannelIndex = UDMA_CH6_GSPI_RX,
.txChannelIndex = UDMA_CH7_GSPI_TX,
.minDmaTransferSize = 100,
},
...
};

§ SPICC32XXDMA_Object

SPICC32XXDMA Object.

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

§ SPICC32XXDMA_Handle

Enumeration Type Documentation

§ SPICC32XXDMA_FrameSize

SPICC32XXDMA data frame size is used to determine how to configure the DMA data transfers. This field is to be only used internally.

SPICC32XXDMA_8bit: txBuf and rxBuf are arrays of uint8_t elements SPICC32XXDMA_16bit: txBuf and rxBuf are arrays of uint16_t elements SPICC32XXDMA_32bit: txBuf and rxBuf are arrays of uint32_t elements

Enumerator
SPICC32XXDMA_8bit 
SPICC32XXDMA_16bit 
SPICC32XXDMA_32bit 

Variable Documentation

§ SPICC32XXDMA_fxnTable

const SPI_FxnTable SPICC32XXDMA_fxnTable
Copyright 2017, Texas Instruments Incorporated