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

Detailed Description

SPI driver implementation for a USCIB peripheral 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 UCSI controller in SPI mode. It uses the APIs for a USCIB controller.

SPI Chip Select

The SPIEUSCIBDMA operates the controller in 3-pin mode; therefore it is not safe to use in a multi-master SPI bus environment. It is the application's responsibility to assert and de-assert a GPIO pin for chip select purposes.

Chip select type SPI_MASTER mode SPI_SLAVE mode
Hardware chip select Not available on this peripheral.
Software chip select The application is responsible to ensure that correct SPI slave is selected before performing a SPI_transfer(). Up to the application's implementation.

DMA Interrupts

The MSP430 DMA controller uses a single interrupt vector to handle all DMA related IRQ. Because of the "shared" nature, of the DMA's ISR, this driver implementation provides a simple ISR function SPIEUSCIBDMA_hwiIntFxn() which needs to be called from within the DMA's ISR. SPIEUSCIBDMA_hwiIntFxn() will only service DMA channel interrupts that are associated with the SPI_Handle. Each SPIEUSCIBDMA instance will require a call from within the DMA's ISR.

SPI_Handle spi0uscidma;
SPI_Handle spi1uscidma;
// As this DMA controller uses a single interrupt vector for all DMA
// channels (regardless of the triggering source), its left up to the user
// to call SPI_serviceISR() to service its associated DMA channels.
Void myDMAISR(UArg arg)
{
// Services and clears its assigned DMA channel interrupts
SPI_serviceISR(spi0uscidma);
// Services and clears its assigned DMA channel interrupts
SPI_serviceISR(spi1uscidma);
// some other user application code that's not related to the SPI driver,
// but is used to service remaining DMA channels
}
spi0uscidma = SPI_open(someSPI_configIndexValue, &params);
...
spi1uscidma = SPI_open(someSPI_configIndexValue, &params);
....

SPI data frames

The EUSCI controller only supports 8-bit data frames.

dataSize buffer element size
8 bits uint8_t

DMA transfer size limit

The MSP430 DMA controller supports 2^16 data frames per transfer. Each SPI driver instance requires 2 DMA channels (Tx and Rx) to operate.

DMA accessible memory

Ensure that the txBuf and rxBuf (in SPI_Transaction) point to memory that is accessible by the DMA.


#include <stdint.h>
#include <ti/drivers/SPI.h>
#include <ti/sysbios/knl/Semaphore.h>
Include dependency graph for SPIEUSCIBDMA.h:

Go to the source code of this file.

Data Structures

struct  SPIEUSCIBDMA_HWAttrs
 SPIEUSCIBDMA Hardware attributes. More...
 
struct  SPIEUSCIBDMA_Object
 SPIEUSCIBDMA Object. More...
 

Typedefs

typedef struct SPIEUSCIBDMA_HWAttrs SPIEUSCIBDMA_HWAttrs
 SPIEUSCIBDMA Hardware attributes. More...
 
typedef struct SPIEUSCIBDMA_Object SPIEUSCIBDMA_Object
 SPIEUSCIBDMA Object. More...
 
typedef struct SPIEUSCIBDMA_ObjectSPIEUSCIBDMA_Handle
 

Variables

const SPI_FxnTable SPIEUSCIBDMA_fxnTable
 

Typedef Documentation

SPIEUSCIBDMA Hardware attributes.

These fields are used by driverlib APIs and therefore must be populated by driverlib macro definitions. For MSP430Ware these definitions are found in:

  • inc/hw_memmap.h
  • usci_b_spi.h
  • dma.h

A sample structure is shown below:

1 uint8_t spiEUSCIBDMAscratchBuf;
2 const SPIEUSCIBDMA_HWAttrs spiEUSCIBDMAHWAttrs[] = {
3  {
4  .baseAddr = EUSCI_B0_BASE,
5  .clockSource = EUSCI_B_SPI_CLOCKSOURCE_SMCLK,
6  .bitOrder = EUSCI_B_SPI_MSB_FIRST,
7  .scratchBufPtr = &spiEUSCIBDMAscratchBuf,
8  .defaultTxBufValue = 0,
9 
10  // DMA
11  .dmaBaseAddr = DMA_BASE,
12  // Rx Channel
13  .rxDMAChannelIndex = DMA_CHANNEL_0,
14  .rxDMASourceTrigger = DMA_TRIGGERSOURCE_18,
15  // Tx Channel
16  .txDMAChannelIndex = DMA_CHANNEL_1,
17  .txDMASourceTrigger = DMA_TRIGGERSOURCE_19
18  }
19 };

SPIEUSCIBDMA Object.

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

Variable Documentation

const SPI_FxnTable SPIEUSCIBDMA_fxnTable
Copyright 2016, Texas Instruments Incorporated