TI-RTOS Drivers  tidrivers_full_2_20_00_08
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  */
482 #ifndef ti_drivers_spi_SPICC26XXDMA__include
483 #define ti_drivers_spi_SPICC26XXDMA__include
484 
485 #ifdef __cplusplus
486 extern "C" {
487 #endif
488 
489 #include <stdint.h>
490 #include <ti/drivers/SPI.h>
493 #include <ti/drivers/Power.h>
495 
496 #define ti_sysbios_family_arm_m3_Hwi__nolocalnames
497 #include <ti/sysbios/knl/Semaphore.h>
498 #include <ti/sysbios/knl/Swi.h>
499 #include <ti/sysbios/family/arm/m3/Hwi.h>
500 
511 /* Add SPICC26XXDMA_STATUS_* macros here */
512 
532 #define SPICC26XXDMA_CMD_RETURN_PARTIAL_ENABLE SPI_CMD_RESERVED + 0
533 
541 #define SPICC26XXDMA_CMD_RETURN_PARTIAL_DISABLE SPI_CMD_RESERVED + 1
542 
549 #define SPICC26XXDMA_CMD_SET_CSN_PIN SPI_CMD_RESERVED + 2
550 
558 #define SPICC26XXDMA_CMD_SET_CSN_WAKEUP SPI_CMD_RESERVED + 3
559 
561 /* BACKWARDS COMPATIBILITY */
562 #define SPICC26XXDMA_RETURN_PARTIAL_ENABLE SPICC26XXDMA_CMD_RETURN_PARTIAL_ENABLE
563 #define SPICC26XXDMA_RETURN_PARTIAL_DISABLE SPICC26XXDMA_CMD_RETURN_PARTIAL_DISABLE
564 #define SPICC26XXDMA_SET_CSN_PIN SPICC26XXDMA_CMD_SET_CSN_PIN
565 #define SPICC26XXDMA_SET_CSN_WAKEUP SPICC26XXDMA_CMD_SET_CSN_WAKEUP
566 /* END BACKWARDS COMPATIBILITY */
567 
574 
588 
596 typedef void (*SPICC26XXDMA_CallbackFxn) (SPI_Handle handle);
597 
652 typedef struct SPICC26XXDMA_HWAttrsV1 {
654  uint32_t baseAddr;
656  uint8_t intNum;
670  uint8_t intPriority;
676  uint32_t swiPriority;
694 
700 typedef struct SPICC26XXDMA_Object {
701  /* SPI control variables */
703  unsigned int transferTimeout;
712  unsigned int bitRate;
713  unsigned int dataSize;
716  /* SPI SYS/BIOS objects */
717  ti_sysbios_family_arm_m3_Hwi_Struct hwi;
718  Swi_Struct swi;
719  Semaphore_Struct transferComplete;
721  /* SPI current transaction */
725  /* Support for dynamic CSN pin allocation */
728  /* PIN driver state object and handle */
731 
732  /* UDMA driver handle */
734 
735  /* Optional slave mode features */
737 #ifdef SPICC26XXDMA_WAKEUP_ENABLED
738  SPICC26XXDMA_CallbackFxn wakeupCallbackFxn;
739 #endif
740  /* Scratch buffer of size uint32_t */
741  uint16_t scratchBuf;
742 
743  /* SPI pre- and post notification functions */
744  void *spiPreFxn;
745  void *spiPostFxn;
749  volatile bool spiPowerConstraint;
751  bool isOpen;
753 
754 
755 /* Do not interfere with the app if they include the family Hwi module */
756 #undef ti_sysbios_family_arm_m3_Hwi__nolocalnames
757 
758 #ifdef __cplusplus
759 }
760 #endif
761 
762 #endif /* ti_drivers_spi_SPICC26XXDMA__include */
Definition: SPICC26XXDMA.h:585
uint8_t PIN_Id
Pin identifier data type.
Definition: PIN.h:557
PIN_Id csnPin
Definition: SPICC26XXDMA.h:726
const SPI_FxnTable SPICC26XXDMA_fxnTable
uint16_t defaultTxBufValue
Definition: SPICC26XXDMA.h:680
SPI driver interface.
uint32_t baseAddr
Definition: SPICC26XXDMA.h:654
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:747
unsigned int bitRate
SPI bit rate in Hz.
Definition: SPICC26XXDMA.h:712
SPI_CallbackFxn transferCallbackFxn
Definition: SPICC26XXDMA.h:704
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:670
Semaphore_Struct transferComplete
Definition: SPICC26XXDMA.h:719
Power manager interface.
uint32_t rxChannelBitMask
Definition: SPICC26XXDMA.h:682
void * spiPreFxn
Definition: SPICC26XXDMA.h:744
UDMACC26XX Global configuration.
Definition: UDMACC26XX.h:229
SPI Global configuration.
Definition: SPI.h:436
uint32_t txChannelBitMask
Definition: SPICC26XXDMA.h:684
uint16_t scratchBuf
Definition: SPICC26XXDMA.h:741
Power manager interface for CC26XX.
PIN_Id clkPin
Definition: SPICC26XXDMA.h:690
uint8_t PowerCC26XX_Resource
Definition: PowerCC26XX.h:66
SPICC26XXDMA Hardware attributes.
Definition: SPICC26XXDMA.h:652
volatile bool spiPowerConstraint
Definition: SPICC26XXDMA.h:749
PIN_Id misoPin
Definition: SPICC26XXDMA.h:688
SPI_TransferMode transferMode
Definition: SPICC26XXDMA.h:702
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:700
Device-specific pin & GPIO driver for CC26xx family [def].
void * spiPostFxn
Definition: SPICC26XXDMA.h:745
PIN_State pinState
Definition: SPICC26XXDMA.h:729
SPI_Mode mode
Definition: SPICC26XXDMA.h:705
SPICC26XXDMA_FrameSize
Definition: SPICC26XXDMA.h:584
SPICC26XXDMA_FrameSize frameSize
Definition: SPICC26XXDMA.h:723
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:736
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:692
UDMACC26XX_Handle udmaHandle
Definition: SPICC26XXDMA.h:733
uint8_t intNum
Definition: SPICC26XXDMA.h:656
PIN_Id mosiPin
Definition: SPICC26XXDMA.h:686
unsigned int transferTimeout
Definition: SPICC26XXDMA.h:703
underlying data structure for type PIN_State
Definition: PIN.h:687
SPI_FrameFormat frameFormat
Definition: SPICC26XXDMA.h:714
Power_NotifyObj spiPreObj
Definition: SPICC26XXDMA.h:746
bool isOpen
Definition: SPICC26XXDMA.h:751
ti_sysbios_family_arm_m3_Hwi_Struct hwi
Definition: SPICC26XXDMA.h:717
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:676
void(* SPICC26XXDMA_CallbackFxn)(SPI_Handle handle)
Definition: SPICC26XXDMA.h:596
Definition: SPICC26XXDMA.h:586
PowerCC26XX_Resource powerMngrId
Definition: SPICC26XXDMA.h:678
PIN_Handle pinHandle
Definition: SPICC26XXDMA.h:730
unsigned int dataSize
Definition: SPICC26XXDMA.h:713
SPI_FrameFormat
Definitions for various SPI data frame formats.
Definition: SPI.h:297
SPI_Transaction * currentTransaction
Definition: SPICC26XXDMA.h:722
Swi_Struct swi
Definition: SPICC26XXDMA.h:718
Copyright 2016, Texas Instruments Incorporated