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  */
127 #ifndef ti_drivers_spi_SPIMSP432E4DMA__include
128 #define ti_drivers_spi_SPIMSP432E4DMA__include
129 
130 #ifdef __cplusplus
131 extern "C" {
132 #endif
133 
134 #include <stdbool.h>
135 #include <stdint.h>
136 
137 #include <ti/devices/msp432e4/inc/msp432.h>
138 
139 #include <ti/devices/msp432e4/driverlib/pin_map.h>
140 
142 #include <ti/drivers/dpl/HwiP.h>
143 #include <ti/drivers/dpl/SemaphoreP.h>
145 #include <ti/drivers/SPI.h>
146 
150 #define SPIMSP432E4_PA2_SSI0CLK GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTA, 2, GPIO_PA2_SSI0CLK)
151 
155 #define SPIMSP432E4_PA3_SSI0FSS GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTA, 3, GPIO_PA3_SSI0FSS)
156 
160 #define SPIMSP432E4_PA4_SSI0XDAT0 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTA, 4, GPIO_PA4_SSI0XDAT0)
161 
165 #define SPIMSP432E4_PA5_SSI0XDAT1 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTA, 5, GPIO_PA5_SSI0XDAT1)
166 
170 #define SPIMSP432E4_PB5_SSI1CLK GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTB, 5, GPIO_PB5_SSI1CLK)
171 
175 #define SPIMSP432E4_PB4_SSI1FSS GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTB, 4, GPIO_PB4_SSI1FSS)
176 
180 #define SPIMSP432E4_PE4_SSI1XDAT0 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTE, 4, GPIO_PE4_SSI1XDAT0)
181 
185 #define SPIMSP432E4_PE5_SSI1XDAT1 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTE, 5, GPIO_PE5_SSI1XDAT1)
186 
190 #define SPIMSP432E4_PD3_SSI2CLK GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTD, 3, GPIO_PD3_SSI2CLK)
191 
195 #define SPIMSP432E4_PG7_SSI2CLK GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTG, 7, GPIO_PG7_SSI2CLK)
196 
200 #define SPIMSP432E4_PD2_SSI2FSS GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTD, 2, GPIO_PD2_SSI2FSS)
201 
205 #define SPIMSP432E4_PG6_SSI2FSS GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTG, 6, GPIO_PG6_SSI2FSS)
206 
210 #define SPIMSP432E4_PD1_SSI2XDAT0 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTD, 1, GPIO_PD1_SSI2XDAT0)
211 
215 #define SPIMSP432E4_PG5_SSI2XDAT0 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTG, 5, GPIO_PG5_SSI2XDAT0)
216 
220 #define SPIMSP432E4_PD0_SSI2XDAT1 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTD, 0, GPIO_PD0_SSI2XDAT1)
221 
225 #define SPIMSP432E4_PG4_SSI2XDAT1 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTG, 4, GPIO_PG4_SSI2XDAT1)
226 
230 #define SPIMSP432E4_PQ0_SSI3CLK GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTQ, 0, GPIO_PQ0_SSI3CLK)
231 
235 #define SPIMSP432E4_PF3_SSI3CLK GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTF, 3, GPIO_PF3_SSI3CLK)
236 
240 #define SPIMSP432E4_PQ1_SSI3FSS GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTQ, 1, GPIO_PQ1_SSI3FSS)
241 
245 #define SPIMSP432E4_PF2_SSI3FSS GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTF, 2, GPIO_PF2_SSI3FSS)
246 
250 #define SPIMSP432E4_PQ2_SSI3XDAT0 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTQ, 2, GPIO_PQ2_SSI3XDAT0)
251 
255 #define SPIMSP432E4_PF1_SSI3XDAT0 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTF, 1, GPIO_PF1_SSI3XDAT0)
256 
260 #define SPIMSP432E4_PQ3_SSI3XDAT1 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTQ, 3, GPIO_PQ3_SSI3XDAT1)
261 
265 #define SPIMSP432E4_PF0_SSI3XDAT1 GPIOMSP432E4_pinConfigMask(GPIOMSP432E4_PORTF, 0, GPIO_PF0_SSI3XDAT1)
266 
294 #define SPIMSP432E4_PIN_NO_CONFIG (0xFFFFFFFF)
295 
306 /* Add SPIMSP432E4DMA_STATUS_* macros here */
307 
320 /* Add SPIMSP432E4DMA_CMD_* macros here */
321 
324 /* SPI function table pointer */
326 
367 typedef struct SPIMSP432E4DMA_HWAttrs {
369  uint32_t baseAddr;
371  uint32_t intNum;
373  uint32_t intPriority;
374 
376  uint16_t *scratchBufPtr;
377 
380 
382  uint32_t rxDmaChannel;
384  uint32_t txDmaChannel;
385 
388 
390  uint32_t clkPinMask;
392  uint32_t fssPinMask;
394  uint32_t xdat0PinMask;
396  uint32_t xdat1PinMask;
398 
404 typedef struct SPIMSP432E4DMA_Object {
405  HwiP_Handle hwiHandle;
406  SemaphoreP_Handle transferComplete;
409 
412  uint32_t activeChannel;
413 
414  size_t framesQueued;
418 
419  uint32_t bitRate;
420  uint32_t dataSize;
421  uint32_t transferTimeout;
422 
423  uint16_t rxScratchBuf;
424 
427 
428  uint8_t format;
429  bool isOpen;
431 
432 #ifdef __cplusplus
433 }
434 #endif
435 
436 #endif /* ti_drivers_spi_SPIMSP432E4DMA__include */
uint32_t activeChannel
Definition: SPIMSP432E4DMA.h:412
SPIMSP432E4DMA Object.
Definition: SPIMSP432E4DMA.h:404
uint32_t intNum
Definition: SPIMSP432E4DMA.h:371
uint32_t txDmaChannel
Definition: SPIMSP432E4DMA.h:384
uint32_t transferTimeout
Definition: SPIMSP432E4DMA.h:421
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:396
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:415
uint16_t minDmaTransferSize
Definition: SPIMSP432E4DMA.h:387
SPIMSP432E4DMA Hardware attributes.
Definition: SPIMSP432E4DMA.h:367
uint32_t baseAddr
Definition: SPIMSP432E4DMA.h:369
UDMAMSP432E4_Handle dmaHandle
Definition: SPIMSP432E4DMA.h:408
uint32_t dataSize
Definition: SPIMSP432E4DMA.h:420
uint16_t defaultTxBufValue
Definition: SPIMSP432E4DMA.h:379
SPI_Mode spiMode
Definition: SPIMSP432E4DMA.h:425
size_t framesQueued
Definition: SPIMSP432E4DMA.h:414
size_t altTransferSize
Definition: SPIMSP432E4DMA.h:417
uint32_t intPriority
Definition: SPIMSP432E4DMA.h:373
uint32_t xdat0PinMask
Definition: SPIMSP432E4DMA.h:394
uint32_t bitRate
Definition: SPIMSP432E4DMA.h:419
uint16_t rxScratchBuf
Definition: SPIMSP432E4DMA.h:423
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:410
struct SPIMSP432E4DMA_Object SPIMSP432E4DMA_Object
SPIMSP432E4DMA Object.
SemaphoreP_Handle transferComplete
Definition: SPIMSP432E4DMA.h:406
uint32_t rxDmaChannel
Definition: SPIMSP432E4DMA.h:382
MSP432E4 GPIO driver.
HwiP_Handle hwiHandle
Definition: SPIMSP432E4DMA.h:405
uint16_t * scratchBufPtr
Definition: SPIMSP432E4DMA.h:376
uint32_t fssPinMask
Definition: SPIMSP432E4DMA.h:392
uint32_t clkPinMask
Definition: SPIMSP432E4DMA.h:390
SPI_CallbackFxn transferCallbackFxn
Definition: SPIMSP432E4DMA.h:407
SPI_Transaction * tailPtr
Definition: SPIMSP432E4DMA.h:411
const SPI_FxnTable SPIMSP432E4DMA_fxnTable
SPI_TransferMode transferMode
Definition: SPIMSP432E4DMA.h:426
bool isOpen
Definition: SPIMSP432E4DMA.h:429
struct SPIMSP432E4DMA_HWAttrs SPIMSP432E4DMA_HWAttrs
SPIMSP432E4DMA Hardware attributes.
size_t priTransferSize
Definition: SPIMSP432E4DMA.h:416
uint8_t format
Definition: SPIMSP432E4DMA.h:428
Copyright 2018, Texas Instruments Incorporated