SPICC26XXDMA.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2017, 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  */
593 #ifndef ti_drivers_spi_SPICC26XXDMA__include
594 #define ti_drivers_spi_SPICC26XXDMA__include
595 
596 #ifdef __cplusplus
597 extern "C" {
598 #endif
599 
600 #include <stdint.h>
601 #include <ti/drivers/SPI.h>
604 #include <ti/drivers/Power.h>
606 
607 #include <ti/drivers/dpl/HwiP.h>
608 #include <ti/drivers/dpl/SemaphoreP.h>
609 #include <ti/drivers/dpl/SwiP.h>
610 
621 /* Add SPICC26XXDMA_STATUS_* macros here */
622 
642 #define SPICC26XXDMA_CMD_RETURN_PARTIAL_ENABLE (SPI_CMD_RESERVED + 0)
643 
651 #define SPICC26XXDMA_CMD_RETURN_PARTIAL_DISABLE (SPI_CMD_RESERVED + 1)
652 
659 #define SPICC26XXDMA_CMD_SET_CSN_PIN (SPI_CMD_RESERVED + 2)
660 
662 /* BACKWARDS COMPATIBILITY */
663 #define SPICC26XXDMA_RETURN_PARTIAL_ENABLE SPICC26XXDMA_CMD_RETURN_PARTIAL_ENABLE
664 #define SPICC26XXDMA_RETURN_PARTIAL_DISABLE SPICC26XXDMA_CMD_RETURN_PARTIAL_DISABLE
665 #define SPICC26XXDMA_SET_CSN_PIN SPICC26XXDMA_CMD_SET_CSN_PIN
666 /* END BACKWARDS COMPATIBILITY */
667 
674 
688 
743 typedef struct SPICC26XXDMA_HWAttrsV1 {
745  uint32_t baseAddr;
747  uint8_t intNum;
761  uint8_t intPriority;
767  uint32_t swiPriority;
769  PowerCC26XX_Resource powerMngrId;
784 
788 
794 typedef struct SPICC26XXDMA_Object {
795  /* SPI control variables */
797  unsigned int transferTimeout;
806  unsigned int bitRate;
807  unsigned int dataSize;
810  /* SPI SYS/BIOS objects */
811  HwiP_Struct hwi;
812  SwiP_Struct swi;
813  SemaphoreP_Struct transferComplete;
815  /* SPI current transaction */
819  /* Support for dynamic CSN pin allocation */
822  /* PIN driver state object and handle */
825 
826  /* UDMA driver handle */
828 
829  /* Optional slave mode features */
832  /* Scratch buffer of size uint32_t */
833  uint16_t scratchBuf;
834 
835  /* SPI pre- and post notification functions */
836  void *spiPreFxn;
837  void *spiPostFxn;
841  volatile bool spiPowerConstraint;
843  bool isOpen;
845 
846 
847 #ifdef __cplusplus
848 }
849 #endif
850 
851 #endif /* ti_drivers_spi_SPICC26XXDMA__include */
Definition: SPICC26XXDMA.h:685
uint8_t PIN_Id
Pin identifier data type.
Definition: PIN.h:550
PIN_Id csnPin
Definition: SPICC26XXDMA.h:820
const SPI_FxnTable SPICC26XXDMA_fxnTable
uint16_t defaultTxBufValue
Definition: SPICC26XXDMA.h:771
SPI driver interface.
uint32_t baseAddr
Definition: SPICC26XXDMA.h:745
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:561
enum SPI_Mode_ SPI_Mode
Definitions for various SPI modes of operation.
Power_NotifyObj spiPostObj
Definition: SPICC26XXDMA.h:839
unsigned int bitRate
SPI bit rate in Hz.
Definition: SPICC26XXDMA.h:806
A SPI_Transaction data structure is used with SPI_transfer(). It indicates how many SPI_FrameFormat f...
Definition: SPI.h:543
SPI_CallbackFxn transferCallbackFxn
Definition: SPICC26XXDMA.h:798
struct SPICC26XXDMA_Object * SPICC26XXDMA_Handle
uint32_t minDmaTransferSize
Definition: SPICC26XXDMA.h:786
uint8_t intPriority
SPI CC26XXDMA Peripheral&#39;s interrupt priority.
Definition: SPICC26XXDMA.h:761
Power manager interface.
uint32_t rxChannelBitMask
Definition: SPICC26XXDMA.h:773
void * spiPreFxn
Definition: SPICC26XXDMA.h:836
UDMACC26XX Global configuration.
Definition: UDMACC26XX.h:229
uint32_t txChannelBitMask
Definition: SPICC26XXDMA.h:775
uint16_t scratchBuf
Definition: SPICC26XXDMA.h:833
Power manager interface for CC26XX/CC13XX.
Power notify object structure.
Definition: Power.h:115
PIN_Id clkPin
Definition: SPICC26XXDMA.h:781
SPICC26XXDMA Hardware attributes.
Definition: SPICC26XXDMA.h:743
volatile bool spiPowerConstraint
Definition: SPICC26XXDMA.h:841
PIN_Id misoPin
Definition: SPICC26XXDMA.h:779
SPI_TransferMode transferMode
Definition: SPICC26XXDMA.h:796
SPICC26XXDMA Object.
Definition: SPICC26XXDMA.h:794
enum SPI_TransferMode_ SPI_TransferMode
SPI transfer mode determines the whether the SPI controller operates synchronously or asynchronously...
Device-specific pin & GPIO driver for CC26xx family [def].
The definition of a SPI function table that contains the required set of functions to control a speci...
Definition: SPI.h:675
void * spiPostFxn
Definition: SPICC26XXDMA.h:837
PIN_State pinState
Definition: SPICC26XXDMA.h:823
SPI_Mode mode
Definition: SPICC26XXDMA.h:799
SPICC26XXDMA_FrameSize
Definition: SPICC26XXDMA.h:684
SPICC26XXDMA_FrameSize frameSize
Definition: SPICC26XXDMA.h:817
UDMACC26XX driver implementation.
bool returnPartial
Definition: SPICC26XXDMA.h:830
struct SPICC26XXDMA_Object SPICC26XXDMA_Object
SPICC26XXDMA Object.
struct SPICC26XXDMA_HWAttrsV1 SPICC26XXDMA_HWAttrsV1
SPICC26XXDMA Hardware attributes.
PIN_Id csnPin
Definition: SPICC26XXDMA.h:783
UDMACC26XX_Handle udmaHandle
Definition: SPICC26XXDMA.h:827
uint8_t intNum
Definition: SPICC26XXDMA.h:747
PIN_Id mosiPin
Definition: SPICC26XXDMA.h:777
unsigned int transferTimeout
Definition: SPICC26XXDMA.h:797
underlying data structure for type PIN_State
Definition: PIN.h:680
enum SPI_FrameFormat_ SPI_FrameFormat
Definitions for various SPI data frame formats.
HwiP_Struct hwi
Definition: SPICC26XXDMA.h:811
SPI_FrameFormat frameFormat
Definition: SPICC26XXDMA.h:808
Power_NotifyObj spiPreObj
Definition: SPICC26XXDMA.h:838
SemaphoreP_Struct transferComplete
Definition: SPICC26XXDMA.h:813
SwiP_Struct swi
Definition: SPICC26XXDMA.h:812
bool isOpen
Definition: SPICC26XXDMA.h:843
uint32_t swiPriority
SPI SWI priority. The higher the number, the higher the priority. The minimum is 0 and the maximum is...
Definition: SPICC26XXDMA.h:767
Definition: SPICC26XXDMA.h:686
PowerCC26XX_Resource powerMngrId
Definition: SPICC26XXDMA.h:769
PIN_Handle pinHandle
Definition: SPICC26XXDMA.h:824
unsigned int dataSize
Definition: SPICC26XXDMA.h:807
SPI_Transaction * currentTransaction
Definition: SPICC26XXDMA.h:816
Copyright 2017, Texas Instruments Incorporated