TI-RTOS Drivers  tidrivers_cc13xx_cc26xx_2_21_00_04
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 
566 #define SPICC26XXDMA_CMD_SET_CSN_WAKEUP SPI_CMD_RESERVED + 3
567 
569 /* BACKWARDS COMPATIBILITY */
570 #define SPICC26XXDMA_RETURN_PARTIAL_ENABLE SPICC26XXDMA_CMD_RETURN_PARTIAL_ENABLE
571 #define SPICC26XXDMA_RETURN_PARTIAL_DISABLE SPICC26XXDMA_CMD_RETURN_PARTIAL_DISABLE
572 #define SPICC26XXDMA_SET_CSN_PIN SPICC26XXDMA_CMD_SET_CSN_PIN
573 #define SPICC26XXDMA_SET_CSN_WAKEUP SPICC26XXDMA_CMD_SET_CSN_WAKEUP
574 /* END BACKWARDS COMPATIBILITY */
575 
582 
596 
604 typedef void (*SPICC26XXDMA_CallbackFxn) (SPI_Handle handle);
605 
660 typedef struct SPICC26XXDMA_HWAttrsV1 {
662  uint32_t baseAddr;
664  uint8_t intNum;
678  uint8_t intPriority;
684  uint32_t swiPriority;
702 
708 typedef struct SPICC26XXDMA_Object {
709  /* SPI control variables */
711  unsigned int transferTimeout;
720  unsigned int bitRate;
721  unsigned int dataSize;
724  /* SPI SYS/BIOS objects */
725  ti_sysbios_family_arm_m3_Hwi_Struct hwi;
726  Swi_Struct swi;
727  Semaphore_Struct transferComplete;
729  /* SPI current transaction */
733  /* Support for dynamic CSN pin allocation */
736  /* PIN driver state object and handle */
739 
740  /* UDMA driver handle */
742 
743  /* Optional slave mode features */
745 #ifdef SPICC26XXDMA_WAKEUP_ENABLED
746  SPICC26XXDMA_CallbackFxn wakeupCallbackFxn;
747 #endif
748  /* Scratch buffer of size uint32_t */
749  uint16_t scratchBuf;
750 
751  /* SPI pre- and post notification functions */
752  void *spiPreFxn;
753  void *spiPostFxn;
757  volatile bool spiPowerConstraint;
759  bool isOpen;
761 
762 
763 /* Do not interfere with the app if they include the family Hwi module */
764 #undef ti_sysbios_family_arm_m3_Hwi__nolocalnames
765 
766 #ifdef __cplusplus
767 }
768 #endif
769 
770 #endif /* ti_drivers_spi_SPICC26XXDMA__include */
Definition: SPICC26XXDMA.h:593
uint8_t PIN_Id
Pin identifier data type.
Definition: PIN.h:557
PIN_Id csnPin
Definition: SPICC26XXDMA.h:734
const SPI_FxnTable SPICC26XXDMA_fxnTable
uint16_t defaultTxBufValue
Definition: SPICC26XXDMA.h:688
SPI driver interface.
uint32_t baseAddr
Definition: SPICC26XXDMA.h:662
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:282
Power_NotifyObj spiPostObj
Definition: SPICC26XXDMA.h:755
unsigned int bitRate
SPI bit rate in Hz.
Definition: SPICC26XXDMA.h:720
SPI_CallbackFxn transferCallbackFxn
Definition: SPICC26XXDMA.h:712
struct SPICC26XXDMA_Object * SPICC26XXDMA_Handle
SPI_TransferMode
SPI transfer mode determines the whether the SPI controller operates synchronously or asynchronously...
Definition: SPI.h:316
uint8_t intPriority
SPI CC26XXDMA Peripheral's interrupt priority.
Definition: SPICC26XXDMA.h:678
Semaphore_Struct transferComplete
Definition: SPICC26XXDMA.h:727
Power manager interface.
uint32_t rxChannelBitMask
Definition: SPICC26XXDMA.h:690
void * spiPreFxn
Definition: SPICC26XXDMA.h:752
UDMACC26XX Global configuration.
Definition: UDMACC26XX.h:229
SPI Global configuration.
Definition: SPI.h:436
uint32_t txChannelBitMask
Definition: SPICC26XXDMA.h:692
uint16_t scratchBuf
Definition: SPICC26XXDMA.h:749
Power manager interface for CC26XX.
PIN_Id clkPin
Definition: SPICC26XXDMA.h:698
uint8_t PowerCC26XX_Resource
Definition: PowerCC26XX.h:66
SPICC26XXDMA Hardware attributes.
Definition: SPICC26XXDMA.h:660
volatile bool spiPowerConstraint
Definition: SPICC26XXDMA.h:757
PIN_Id misoPin
Definition: SPICC26XXDMA.h:696
SPI_TransferMode transferMode
Definition: SPICC26XXDMA.h:710
The definition of a SPI function table that contains the required set of functions to control a speci...
Definition: SPI.h:402
SPICC26XXDMA Object.
Definition: SPICC26XXDMA.h:708
Device-specific pin & GPIO driver for CC26xx family [def].
void * spiPostFxn
Definition: SPICC26XXDMA.h:753
PIN_State pinState
Definition: SPICC26XXDMA.h:737
SPI_Mode mode
Definition: SPICC26XXDMA.h:713
SPICC26XXDMA_FrameSize
Definition: SPICC26XXDMA.h:592
SPICC26XXDMA_FrameSize frameSize
Definition: SPICC26XXDMA.h:731
UDMACC26XX driver implementation.
A SPI_Transaction data structure is used with SPI_transfer(). It indicates how many SPI_FrameFormat f...
Definition: SPI.h:262
bool returnPartial
Definition: SPICC26XXDMA.h:744
Power notify object structure.
Definition: Power.h:112
struct SPICC26XXDMA_Object SPICC26XXDMA_Object
SPICC26XXDMA Object.
SPI_Mode
Definitions for various SPI modes of operation.
Definition: SPI.h:288
struct SPICC26XXDMA_HWAttrsV1 SPICC26XXDMA_HWAttrsV1
SPICC26XXDMA Hardware attributes.
PIN_Id csnPin
Definition: SPICC26XXDMA.h:700
UDMACC26XX_Handle udmaHandle
Definition: SPICC26XXDMA.h:741
uint8_t intNum
Definition: SPICC26XXDMA.h:664
PIN_Id mosiPin
Definition: SPICC26XXDMA.h:694
unsigned int transferTimeout
Definition: SPICC26XXDMA.h:711
underlying data structure for type PIN_State
Definition: PIN.h:687
SPI_FrameFormat frameFormat
Definition: SPICC26XXDMA.h:722
Power_NotifyObj spiPreObj
Definition: SPICC26XXDMA.h:754
bool isOpen
Definition: SPICC26XXDMA.h:759
ti_sysbios_family_arm_m3_Hwi_Struct hwi
Definition: SPICC26XXDMA.h:725
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:684
void(* SPICC26XXDMA_CallbackFxn)(SPI_Handle handle)
Definition: SPICC26XXDMA.h:604
Definition: SPICC26XXDMA.h:594
PowerCC26XX_Resource powerMngrId
Definition: SPICC26XXDMA.h:686
PIN_Handle pinHandle
Definition: SPICC26XXDMA.h:738
unsigned int dataSize
Definition: SPICC26XXDMA.h:721
SPI_FrameFormat
Definitions for various SPI data frame formats.
Definition: SPI.h:297
SPI_Transaction * currentTransaction
Definition: SPICC26XXDMA.h:730
Swi_Struct swi
Definition: SPICC26XXDMA.h:726
Copyright 2016, Texas Instruments Incorporated