SPIMSP432E4DMA.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017-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  */
126 #ifndef ti_drivers_spi_SPIMSP432E4DMA__include
127 #define ti_drivers_spi_SPIMSP432E4DMA__include
128 
129 #ifdef __cplusplus
130 extern "C" {
131 #endif
132 
133 #include <stdbool.h>
134 #include <stdint.h>
135 
136 #include <ti/devices/msp432e4/inc/msp432.h>
137 
138 #include <ti/devices/msp432e4/driverlib/pin_map.h>
139 
141 #include <ti/drivers/dpl/HwiP.h>
142 #include <ti/drivers/dpl/SemaphoreP.h>
144 #include <ti/drivers/SPI.h>
145 
149 #define SPIMSP432E4_PA2_SSI0CLK GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTA, 2, GPIO_PA2_SSI0CLK)
150 
154 #define SPIMSP432E4_PA3_SSI0FSS GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTA, 3, GPIO_PA3_SSI0FSS)
155 
159 #define SPIMSP432E4_PA4_SSI0XDAT0 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTA, 4, GPIO_PA4_SSI0XDAT0)
160 
164 #define SPIMSP432E4_PA5_SSI0XDAT1 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTA, 5, GPIO_PA5_SSI0XDAT1)
165 
169 #define SPIMSP432E4_PB5_SSI1CLK GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTB, 5, GPIO_PB5_SSI1CLK)
170 
174 #define SPIMSP432E4_PB4_SSI1FSS GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTB, 4, GPIO_PB4_SSI1FSS)
175 
179 #define SPIMSP432E4_PE4_SSI1XDAT0 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTE, 4, GPIO_PE4_SSI1XDAT0)
180 
184 #define SPIMSP432E4_PE5_SSI1XDAT1 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTE, 5, GPIO_PE5_SSI1XDAT1)
185 
189 #define SPIMSP432E4_PD3_SSI2CLK GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTD, 3, GPIO_PD3_SSI2CLK)
190 
194 #define SPIMSP432E4_PG7_SSI2CLK GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTG, 7, GPIO_PG7_SSI2CLK)
195 
199 #define SPIMSP432E4_PD2_SSI2FSS GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTD, 2, GPIO_PD2_SSI2FSS)
200 
204 #define SPIMSP432E4_PG6_SSI2FSS GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTG, 6, GPIO_PG6_SSI2FSS)
205 
209 #define SPIMSP432E4_PD1_SSI2XDAT0 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTD, 1, GPIO_PD1_SSI2XDAT0)
210 
214 #define SPIMSP432E4_PG5_SSI2XDAT0 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTG, 5, GPIO_PG5_SSI2XDAT0)
215 
219 #define SPIMSP432E4_PD0_SSI2XDAT1 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTD, 0, GPIO_PD0_SSI2XDAT1)
220 
224 #define SPIMSP432E4_PG4_SSI2XDAT1 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTG, 4, GPIO_PG4_SSI2XDAT1)
225 
229 #define SPIMSP432E4_PQ0_SSI3CLK GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTQ, 0, GPIO_PQ0_SSI3CLK)
230 
234 #define SPIMSP432E4_PF3_SSI3CLK GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTF, 3, GPIO_PF3_SSI3CLK)
235 
239 #define SPIMSP432E4_PQ1_SSI3FSS GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTQ, 1, GPIO_PQ1_SSI3FSS)
240 
244 #define SPIMSP432E4_PF2_SSI3FSS GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTF, 2, GPIO_PF2_SSI3FSS)
245 
249 #define SPIMSP432E4_PQ2_SSI3XDAT0 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTQ, 2, GPIO_PQ2_SSI3XDAT0)
250 
254 #define SPIMSP432E4_PF1_SSI3XDAT0 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTF, 1, GPIO_PF1_SSI3XDAT0)
255 
259 #define SPIMSP432E4_PQ3_SSI3XDAT1 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTQ, 3, GPIO_PQ3_SSI3XDAT1)
260 
264 #define SPIMSP432E4_PF0_SSI3XDAT1 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTF, 0, GPIO_PF0_SSI3XDAT1)
265 
293 #define SPIMSP432E4_PIN_NO_CONFIG (0xFFFFFFFF)
294 
305 /* Add SPIMSP432E4DMA_STATUS_* macros here */
306 
319 /* Add SPIMSP432E4DMA_CMD_* macros here */
320 
323 /* SPI function table pointer */
325 
366 typedef struct SPIMSP432E4DMA_HWAttrs {
368  uint32_t baseAddr;
370  uint32_t intNum;
372  uint32_t intPriority;
373 
375  uint16_t *scratchBufPtr;
376 
379 
381  uint32_t rxDmaChannel;
383  uint32_t txDmaChannel;
384 
387 
389  uint32_t clkPinMask;
391  uint32_t fssPinMask;
393  uint32_t xdat0PinMask;
395  uint32_t xdat1PinMask;
397 
403 typedef struct SPIMSP432E4DMA_Object {
404  HwiP_Handle hwiHandle;
405  SemaphoreP_Handle transferComplete;
408 
411  uint32_t activeChannel;
412 
413  size_t framesQueued;
417 
418  uint32_t bitRate;
419  uint32_t dataSize;
420  uint32_t transferTimeout;
421 
422  uint16_t rxScratchBuf;
423 
426 
427  uint8_t format;
428  bool isOpen;
430 
431 #ifdef __cplusplus
432 }
433 #endif
434 
435 #endif /* ti_drivers_spi_SPIMSP432E4DMA__include */
uint32_t activeChannel
Definition: SPIMSP432E4DMA.h:411
SPIMSP432E4DMA Object.
Definition: SPIMSP432E4DMA.h:403
uint32_t intNum
Definition: SPIMSP432E4DMA.h:370
uint32_t txDmaChannel
Definition: SPIMSP432E4DMA.h:383
uint32_t transferTimeout
Definition: SPIMSP432E4DMA.h:420
UDMAMSP432E4 Global configuration.
Definition: UDMAMSP432E4.h:151
SPI driver interface.
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.
uint32_t xdat1PinMask
Definition: SPIMSP432E4DMA.h:395
A SPI_Transaction data structure is used with SPI_transfer(). It indicates how many SPI_FrameFormat f...
Definition: SPI.h:548
uDMA driver implementation for MSP432E4.
size_t framesTransferred
Definition: SPIMSP432E4DMA.h:414
uint16_t minDmaTransferSize
Definition: SPIMSP432E4DMA.h:386
SPIMSP432E4DMA Hardware attributes.
Definition: SPIMSP432E4DMA.h:366
uint32_t baseAddr
Definition: SPIMSP432E4DMA.h:368
UDMAMSP432E4_Handle dmaHandle
Definition: SPIMSP432E4DMA.h:407
uint32_t dataSize
Definition: SPIMSP432E4DMA.h:419
uint16_t defaultTxBufValue
Definition: SPIMSP432E4DMA.h:378
SPI_Mode spiMode
Definition: SPIMSP432E4DMA.h:424
size_t framesQueued
Definition: SPIMSP432E4DMA.h:413
size_t altTransferSize
Definition: SPIMSP432E4DMA.h:416
uint32_t intPriority
Definition: SPIMSP432E4DMA.h:372
uint32_t xdat0PinMask
Definition: SPIMSP432E4DMA.h:393
uint32_t bitRate
Definition: SPIMSP432E4DMA.h:418
uint16_t rxScratchBuf
Definition: SPIMSP432E4DMA.h:422
enum SPI_TransferMode_ SPI_TransferMode
SPI transfer mode determines the whether the SPI controller operates synchronously or asynchronously...
The definition of a SPI function table that contains the required set of functions to control a speci...
Definition: SPI.h:683
SPI_Transaction * headPtr
Definition: SPIMSP432E4DMA.h:409
struct SPIMSP432E4DMA_Object SPIMSP432E4DMA_Object
SPIMSP432E4DMA Object.
SemaphoreP_Handle transferComplete
Definition: SPIMSP432E4DMA.h:405
uint32_t rxDmaChannel
Definition: SPIMSP432E4DMA.h:381
MSP432E4 GPIO driver.
HwiP_Handle hwiHandle
Definition: SPIMSP432E4DMA.h:404
uint16_t * scratchBufPtr
Definition: SPIMSP432E4DMA.h:375
uint32_t fssPinMask
Definition: SPIMSP432E4DMA.h:391
uint32_t clkPinMask
Definition: SPIMSP432E4DMA.h:389
SPI_CallbackFxn transferCallbackFxn
Definition: SPIMSP432E4DMA.h:406
SPI_Transaction * tailPtr
Definition: SPIMSP432E4DMA.h:410
const SPI_FxnTable SPIMSP432E4DMA_fxnTable
SPI_TransferMode transferMode
Definition: SPIMSP432E4DMA.h:425
bool isOpen
Definition: SPIMSP432E4DMA.h:428
struct SPIMSP432E4DMA_HWAttrs SPIMSP432E4DMA_HWAttrs
SPIMSP432E4DMA Hardware attributes.
size_t priTransferSize
Definition: SPIMSP432E4DMA.h:415
uint8_t format
Definition: SPIMSP432E4DMA.h:427
Copyright 2018, Texas Instruments Incorporated