SimpleLink MCU SDK Driver APIs  tidrivers_cc13xx_cc26xx_3_01_01_03
SPICC26XXDMA.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2016, 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  */
490 #ifndef ti_drivers_spi_SPICC26XXDMA__include
491 #define ti_drivers_spi_SPICC26XXDMA__include
492 
493 #ifdef __cplusplus
494 extern "C" {
495 #endif
496 
497 #include <stdint.h>
498 #include <ti/drivers/SPI.h>
501 #include <ti/drivers/Power.h>
503 
504 #define ti_sysbios_family_arm_m3_Hwi__nolocalnames
505 #include <ti/sysbios/knl/Semaphore.h>
506 #include <ti/sysbios/knl/Swi.h>
507 #include <ti/sysbios/family/arm/m3/Hwi.h>
508 
519 /* Add SPICC26XXDMA_STATUS_* macros here */
520 
540 #define SPICC26XXDMA_CMD_RETURN_PARTIAL_ENABLE (SPI_CMD_RESERVED + 0)
541 
549 #define SPICC26XXDMA_CMD_RETURN_PARTIAL_DISABLE (SPI_CMD_RESERVED + 1)
550 
557 #define SPICC26XXDMA_CMD_SET_CSN_PIN (SPI_CMD_RESERVED + 2)
558 
568 #define SPICC26XXDMA_CMD_SET_CSN_WAKEUP (SPI_CMD_RESERVED + 3)
569 
571 /* BACKWARDS COMPATIBILITY */
572 #define SPICC26XXDMA_RETURN_PARTIAL_ENABLE SPICC26XXDMA_CMD_RETURN_PARTIAL_ENABLE
573 #define SPICC26XXDMA_RETURN_PARTIAL_DISABLE SPICC26XXDMA_CMD_RETURN_PARTIAL_DISABLE
574 #define SPICC26XXDMA_SET_CSN_PIN SPICC26XXDMA_CMD_SET_CSN_PIN
575 #define SPICC26XXDMA_SET_CSN_WAKEUP SPICC26XXDMA_CMD_SET_CSN_WAKEUP
576 /* END BACKWARDS COMPATIBILITY */
577 
584 
598 
606 typedef void (*SPICC26XXDMA_CallbackFxn) (SPI_Handle handle);
607 
662 typedef struct SPICC26XXDMA_HWAttrsV1 {
664  uint32_t baseAddr;
666  uint8_t intNum;
680  uint8_t intPriority;
686  uint32_t swiPriority;
688  PowerCC26XX_Resource powerMngrId;
704 
710 typedef struct SPICC26XXDMA_Object {
711  /* SPI control variables */
713  unsigned int transferTimeout;
722  unsigned int bitRate;
723  unsigned int dataSize;
726  /* SPI SYS/BIOS objects */
727  ti_sysbios_family_arm_m3_Hwi_Struct hwi;
728  Swi_Struct swi;
729  Semaphore_Struct transferComplete;
731  /* SPI current transaction */
735  /* Support for dynamic CSN pin allocation */
738  /* PIN driver state object and handle */
741 
742  /* UDMA driver handle */
744 
745  /* Optional slave mode features */
747 #ifdef SPICC26XXDMA_WAKEUP_ENABLED
748  SPICC26XXDMA_CallbackFxn wakeupCallbackFxn;
749 #endif
750  /* Scratch buffer of size uint32_t */
751  uint16_t scratchBuf;
752 
753  /* SPI pre- and post notification functions */
754  void *spiPreFxn;
755  void *spiPostFxn;
759  volatile bool spiPowerConstraint;
761  bool isOpen;
763 
764 
765 /* Do not interfere with the app if they include the family Hwi module */
766 #undef ti_sysbios_family_arm_m3_Hwi__nolocalnames
767 
768 #ifdef __cplusplus
769 }
770 #endif
771 
772 #endif /* ti_drivers_spi_SPICC26XXDMA__include */
Definition: SPICC26XXDMA.h:595
uint8_t PIN_Id
Pin identifier data type.
Definition: PIN.h:557
PIN_Id csnPin
Definition: SPICC26XXDMA.h:736
const SPI_FxnTable SPICC26XXDMA_fxnTable
uint16_t defaultTxBufValue
Definition: SPICC26XXDMA.h:690
SPI driver interface.
uint32_t baseAddr
Definition: SPICC26XXDMA.h:664
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:540
enum SPI_Mode_ SPI_Mode
Definitions for various SPI modes of operation.
Power_NotifyObj spiPostObj
Definition: SPICC26XXDMA.h:757
unsigned int bitRate
SPI bit rate in Hz.
Definition: SPICC26XXDMA.h:722
A SPI_Transaction data structure is used with SPI_transfer(). It indicates how many SPI_FrameFormat f...
Definition: SPI.h:522
SPI_CallbackFxn transferCallbackFxn
Definition: SPICC26XXDMA.h:714
struct SPICC26XXDMA_Object * SPICC26XXDMA_Handle
uint8_t intPriority
SPI CC26XXDMA Peripheral's interrupt priority.
Definition: SPICC26XXDMA.h:680
Semaphore_Struct transferComplete
Definition: SPICC26XXDMA.h:729
Power manager interface.
uint32_t rxChannelBitMask
Definition: SPICC26XXDMA.h:692
void * spiPreFxn
Definition: SPICC26XXDMA.h:754
UDMACC26XX Global configuration.
Definition: UDMACC26XX.h:235
uint32_t txChannelBitMask
Definition: SPICC26XXDMA.h:694
uint16_t scratchBuf
Definition: SPICC26XXDMA.h:751
Power manager interface for CC26XX/CC13XX.
Power notify object structure.
Definition: Power.h:113
PIN_Id clkPin
Definition: SPICC26XXDMA.h:700
SPICC26XXDMA Hardware attributes.
Definition: SPICC26XXDMA.h:662
volatile bool spiPowerConstraint
Definition: SPICC26XXDMA.h:759
PIN_Id misoPin
Definition: SPICC26XXDMA.h:698
SPI_TransferMode transferMode
Definition: SPICC26XXDMA.h:712
SPICC26XXDMA Object.
Definition: SPICC26XXDMA.h:710
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:652
void * spiPostFxn
Definition: SPICC26XXDMA.h:755
PIN_State pinState
Definition: SPICC26XXDMA.h:739
SPI_Mode mode
Definition: SPICC26XXDMA.h:715
SPICC26XXDMA_FrameSize
Definition: SPICC26XXDMA.h:594
SPICC26XXDMA_FrameSize frameSize
Definition: SPICC26XXDMA.h:733
UDMACC26XX driver implementation.
bool returnPartial
Definition: SPICC26XXDMA.h:746
struct SPICC26XXDMA_Object SPICC26XXDMA_Object
SPICC26XXDMA Object.
struct SPICC26XXDMA_HWAttrsV1 SPICC26XXDMA_HWAttrsV1
SPICC26XXDMA Hardware attributes.
SPI Global configuration.
Definition: SPI.h:683
PIN_Id csnPin
Definition: SPICC26XXDMA.h:702
UDMACC26XX_Handle udmaHandle
Definition: SPICC26XXDMA.h:743
uint8_t intNum
Definition: SPICC26XXDMA.h:666
PIN_Id mosiPin
Definition: SPICC26XXDMA.h:696
unsigned int transferTimeout
Definition: SPICC26XXDMA.h:713
underlying data structure for type PIN_State
Definition: PIN.h:687
enum SPI_FrameFormat_ SPI_FrameFormat
Definitions for various SPI data frame formats.
SPI_FrameFormat frameFormat
Definition: SPICC26XXDMA.h:724
Power_NotifyObj spiPreObj
Definition: SPICC26XXDMA.h:756
bool isOpen
Definition: SPICC26XXDMA.h:761
ti_sysbios_family_arm_m3_Hwi_Struct hwi
Definition: SPICC26XXDMA.h:727
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:686
void(* SPICC26XXDMA_CallbackFxn)(SPI_Handle handle)
Definition: SPICC26XXDMA.h:606
Definition: SPICC26XXDMA.h:596
PowerCC26XX_Resource powerMngrId
Definition: SPICC26XXDMA.h:688
PIN_Handle pinHandle
Definition: SPICC26XXDMA.h:740
unsigned int dataSize
Definition: SPICC26XXDMA.h:723
SPI_Transaction * currentTransaction
Definition: SPICC26XXDMA.h:732
Swi_Struct swi
Definition: SPICC26XXDMA.h:728
Copyright 2016, Texas Instruments Incorporated