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  */
506 #ifndef ti_drivers_spi_SPICC26XXDMA__include
507 #define ti_drivers_spi_SPICC26XXDMA__include
508 
509 #ifdef __cplusplus
510 extern "C" {
511 #endif
512 
513 #include <stdint.h>
514 #include <ti/drivers/SPI.h>
517 #include <ti/drivers/Power.h>
519 
520 #include <ti/drivers/dpl/HwiP.h>
521 #include <ti/drivers/dpl/SemaphoreP.h>
522 #include <ti/drivers/dpl/SwiP.h>
523 
534 /* Add SPICC26XXDMA_STATUS_* macros here */
535 
555 #define SPICC26XXDMA_CMD_RETURN_PARTIAL_ENABLE (SPI_CMD_RESERVED + 0)
556 
564 #define SPICC26XXDMA_CMD_RETURN_PARTIAL_DISABLE (SPI_CMD_RESERVED + 1)
565 
572 #define SPICC26XXDMA_CMD_SET_CSN_PIN (SPI_CMD_RESERVED + 2)
573 
583 #define SPICC26XXDMA_CMD_SET_CSN_WAKEUP (SPI_CMD_RESERVED + 3)
584 
586 /* BACKWARDS COMPATIBILITY */
587 #define SPICC26XXDMA_RETURN_PARTIAL_ENABLE SPICC26XXDMA_CMD_RETURN_PARTIAL_ENABLE
588 #define SPICC26XXDMA_RETURN_PARTIAL_DISABLE SPICC26XXDMA_CMD_RETURN_PARTIAL_DISABLE
589 #define SPICC26XXDMA_SET_CSN_PIN SPICC26XXDMA_CMD_SET_CSN_PIN
590 #define SPICC26XXDMA_SET_CSN_WAKEUP SPICC26XXDMA_CMD_SET_CSN_WAKEUP
591 /* END BACKWARDS COMPATIBILITY */
592 
599 
613 
621 typedef void (*SPICC26XXDMA_CallbackFxn) (SPI_Handle handle);
622 
677 typedef struct SPICC26XXDMA_HWAttrsV1 {
679  uint32_t baseAddr;
681  uint8_t intNum;
695  uint8_t intPriority;
701  uint32_t swiPriority;
703  PowerCC26XX_Resource powerMngrId;
718 
722 
728 typedef struct SPICC26XXDMA_Object {
729  /* SPI control variables */
731  unsigned int transferTimeout;
740  unsigned int bitRate;
741  unsigned int dataSize;
744  /* SPI SYS/BIOS objects */
745  HwiP_Struct hwi;
746  SwiP_Struct swi;
747  SemaphoreP_Struct transferComplete;
749  /* SPI current transaction */
753  /* Support for dynamic CSN pin allocation */
756  /* PIN driver state object and handle */
759 
760  /* UDMA driver handle */
762 
763  /* Optional slave mode features */
765 #ifdef SPICC26XXDMA_WAKEUP_ENABLED
766  SPICC26XXDMA_CallbackFxn wakeupCallbackFxn;
767 #endif
768  /* Scratch buffer of size uint32_t */
769  uint16_t scratchBuf;
770 
771  /* SPI pre- and post notification functions */
772  void *spiPreFxn;
773  void *spiPostFxn;
777  volatile bool spiPowerConstraint;
779  bool isOpen;
781 
782 
783 #ifdef __cplusplus
784 }
785 #endif
786 
787 #endif /* ti_drivers_spi_SPICC26XXDMA__include */
Definition: SPICC26XXDMA.h:610
uint8_t PIN_Id
Pin identifier data type.
Definition: PIN.h:550
PIN_Id csnPin
Definition: SPICC26XXDMA.h:754
const SPI_FxnTable SPICC26XXDMA_fxnTable
uint16_t defaultTxBufValue
Definition: SPICC26XXDMA.h:705
SPI driver interface.
uint32_t baseAddr
Definition: SPICC26XXDMA.h:679
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:553
enum SPI_Mode_ SPI_Mode
Definitions for various SPI modes of operation.
Power_NotifyObj spiPostObj
Definition: SPICC26XXDMA.h:775
unsigned int bitRate
SPI bit rate in Hz.
Definition: SPICC26XXDMA.h:740
A SPI_Transaction data structure is used with SPI_transfer(). It indicates how many SPI_FrameFormat f...
Definition: SPI.h:535
SPI_CallbackFxn transferCallbackFxn
Definition: SPICC26XXDMA.h:732
struct SPICC26XXDMA_Object * SPICC26XXDMA_Handle
uint32_t minDmaTransferSize
Definition: SPICC26XXDMA.h:720
uint8_t intPriority
SPI CC26XXDMA Peripheral&#39;s interrupt priority.
Definition: SPICC26XXDMA.h:695
Power manager interface.
uint32_t rxChannelBitMask
Definition: SPICC26XXDMA.h:707
void * spiPreFxn
Definition: SPICC26XXDMA.h:772
UDMACC26XX Global configuration.
Definition: UDMACC26XX.h:229
uint32_t txChannelBitMask
Definition: SPICC26XXDMA.h:709
uint16_t scratchBuf
Definition: SPICC26XXDMA.h:769
Power manager interface for CC26XX/CC13XX.
Power notify object structure.
Definition: Power.h:115
PIN_Id clkPin
Definition: SPICC26XXDMA.h:715
SPICC26XXDMA Hardware attributes.
Definition: SPICC26XXDMA.h:677
volatile bool spiPowerConstraint
Definition: SPICC26XXDMA.h:777
PIN_Id misoPin
Definition: SPICC26XXDMA.h:713
SPI_TransferMode transferMode
Definition: SPICC26XXDMA.h:730
SPICC26XXDMA Object.
Definition: SPICC26XXDMA.h:728
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:667
void * spiPostFxn
Definition: SPICC26XXDMA.h:773
PIN_State pinState
Definition: SPICC26XXDMA.h:757
SPI_Mode mode
Definition: SPICC26XXDMA.h:733
SPICC26XXDMA_FrameSize
Definition: SPICC26XXDMA.h:609
SPICC26XXDMA_FrameSize frameSize
Definition: SPICC26XXDMA.h:751
UDMACC26XX driver implementation.
bool returnPartial
Definition: SPICC26XXDMA.h:764
struct SPICC26XXDMA_Object SPICC26XXDMA_Object
SPICC26XXDMA Object.
struct SPICC26XXDMA_HWAttrsV1 SPICC26XXDMA_HWAttrsV1
SPICC26XXDMA Hardware attributes.
SPI Global configuration.
Definition: SPI.h:698
PIN_Id csnPin
Definition: SPICC26XXDMA.h:717
UDMACC26XX_Handle udmaHandle
Definition: SPICC26XXDMA.h:761
uint8_t intNum
Definition: SPICC26XXDMA.h:681
PIN_Id mosiPin
Definition: SPICC26XXDMA.h:711
unsigned int transferTimeout
Definition: SPICC26XXDMA.h:731
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:745
SPI_FrameFormat frameFormat
Definition: SPICC26XXDMA.h:742
Power_NotifyObj spiPreObj
Definition: SPICC26XXDMA.h:774
SemaphoreP_Struct transferComplete
Definition: SPICC26XXDMA.h:747
SwiP_Struct swi
Definition: SPICC26XXDMA.h:746
bool isOpen
Definition: SPICC26XXDMA.h:779
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:701
void(* SPICC26XXDMA_CallbackFxn)(SPI_Handle handle)
Definition: SPICC26XXDMA.h:621
Definition: SPICC26XXDMA.h:611
PowerCC26XX_Resource powerMngrId
Definition: SPICC26XXDMA.h:703
PIN_Handle pinHandle
Definition: SPICC26XXDMA.h:758
unsigned int dataSize
Definition: SPICC26XXDMA.h:741
SPI_Transaction * currentTransaction
Definition: SPICC26XXDMA.h:750
Copyright 2017, Texas Instruments Incorporated