TI-RTOS for SimpleLink Wireless MCUs  2.14.03.28
SPICC26XXDMA.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, 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  */
471 #ifndef ti_drivers_spi_SPICC26XXDMA__include
472 #define ti_drivers_spi_SPICC26XXDMA__include
473 
474 #ifdef __cplusplus
475 extern "C" {
476 #endif
477 
478 #include <stdint.h>
479 #include <ti/drivers/SPI.h>
482 #include <ti/sysbios/family/arm/cc26xx/Power.h>
483 #include <ti/sysbios/family/arm/cc26xx/PowerCC2650.h>
484 
485 #define ti_sysbios_family_arm_m3_Hwi__nolocalnames
486 #include <ti/sysbios/knl/Semaphore.h>
487 #include <ti/sysbios/family/arm/m3/Hwi.h>
488 
490 #define SPICC26XXDMA_CMD_RETURN_PARTIAL_ENABLE SPI_CMD_RESERVED + 0
491 
492 #define SPICC26XXDMA_CMD_RETURN_PARTIAL_DISABLE SPI_CMD_RESERVED + 1
493 
494 #define SPICC26XXDMA_CMD_SET_CSN_PIN SPI_CMD_RESERVED + 2
495 
496 #define SPICC26XXDMA_CMD_SET_CSN_WAKEUP SPI_CMD_RESERVED + 3
497 
498 /* BACKWARDS COMPATIBILITY */
499 #define SPICC26XXDMA_RETURN_PARTIAL_ENABLE SPICC26XXDMA_CMD_RETURN_PARTIAL_ENABLE
500 #define SPICC26XXDMA_RETURN_PARTIAL_DISABLE SPICC26XXDMA_CMD_RETURN_PARTIAL_DISABLE
501 #define SPICC26XXDMA_SET_CSN_PIN SPICC26XXDMA_CMD_SET_CSN_PIN
502 #define SPICC26XXDMA_SET_CSN_WAKEUP SPICC26XXDMA_CMD_SET_CSN_WAKEUP
503 /* END BACKWARDS COMPATIBILITY */
504 
511 
525 
533 typedef void (*SPICC26XXDMA_CallbackFxn) (SPI_Handle handle);
534 
587 typedef struct SPICC26XX_HWAttrs {
589  uint32_t baseAddr;
591  uint8_t intNum;
605  uint8_t intPriority;
607  Power_Resource powerMngrId;
623 
629 typedef struct SPICC26XX_Object {
630  /* SPI control variables */
632  unsigned int transferTimeout;
641  unsigned int bitRate;
642  unsigned int dataSize;
645  /* SPI SYS/BIOS objects */
646  ti_sysbios_family_arm_m3_Hwi_Struct hwi;
647  Semaphore_Struct transferComplete;
649  /* SPI current transaction */
653  /* Support for dynamic CSN pin allocation */
656  /* PIN driver state object and handle */
659 
660  /* UDMA driver handle */
662 
663  /* Optional slave mode features */
665 #ifdef SPICC26XXDMA_WAKEUP_ENABLED
666  SPICC26XXDMA_CallbackFxn wakeupCallbackFxn;
667 #endif
668  /* Scratch buffer of size uint32_t */
669  uint16_t scratchBuf;
670 
671  /* SPI pre- and post notification functions */
672  void *spiPreFxn;
673  void *spiPostFxn;
677  bool isOpen;
679 
680 
681 /* Do not interfere with the app if they include the family Hwi module */
682 #undef ti_sysbios_family_arm_m3_Hwi__nolocalnames
683 
684 #ifdef __cplusplus
685 }
686 #endif
687 
688 #endif /* ti_drivers_spi_SPICC26XXDMA__include */
Definition: SPICC26XXDMA.h:522
SPI_CallbackFxn transferCallbackFxn
Definition: SPICC26XXDMA.h:633
uint8_t PIN_Id
Pin identifier data type.
Definition: PIN.h:556
PIN_Id misoPin
Definition: SPICC26XXDMA.h:617
Power_NotifyObj spiPostObj
Definition: SPICC26XXDMA.h:675
const SPI_FxnTable SPICC26XXDMA_fxnTable
UDMACC26XX_Handle udmaHandle
Definition: SPICC26XXDMA.h:661
SPI driver interface.
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:264
bool isOpen
Definition: SPICC26XXDMA.h:677
SPICC26XXDMA Object.
Definition: SPICC26XXDMA.h:629
PIN_Id mosiPin
Definition: SPICC26XXDMA.h:615
SPI_TransferMode
SPI transfer mode determines the whether the SPI controller operates synchronously or asynchronously...
Definition: SPI.h:298
ti_sysbios_family_arm_m3_Hwi_Struct hwi
Definition: SPICC26XXDMA.h:646
PIN_State pinState
Definition: SPICC26XXDMA.h:657
uint8_t intPriority
SPI CC26XXDMA Peripheral's interrupt priority.
Definition: SPICC26XXDMA.h:605
Power_Resource powerMngrId
Definition: SPICC26XXDMA.h:607
PIN_Id csnPin
Definition: SPICC26XXDMA.h:621
SPI_FrameFormat frameFormat
Definition: SPICC26XXDMA.h:643
UDMACC26XX Global configuration.
Definition: UDMACC26XX.h:201
SPI Global configuration.
Definition: SPI.h:418
uint16_t scratchBuf
Definition: SPICC26XXDMA.h:669
unsigned int bitRate
SPI bit rate in Hz.
Definition: SPICC26XXDMA.h:641
The definition of a SPI function table that contains the required set of functions to control a speci...
Definition: SPI.h:384
uint32_t rxChannelBitMask
Definition: SPICC26XXDMA.h:611
struct SPICC26XX_Object * SPICC26XX_Handle
Device-specific pin & GPIO driver for CC26xx family [def].
uint32_t txChannelBitMask
Definition: SPICC26XXDMA.h:613
void * spiPreFxn
Definition: SPICC26XXDMA.h:672
SPICC26XXDMA_FrameSize
Definition: SPICC26XXDMA.h:521
struct SPICC26XX_Object SPICC26XX_Object
SPICC26XXDMA Object.
PIN_Id clkPin
Definition: SPICC26XXDMA.h:619
UDMACC26XX driver implementation.
uint16_t defaultTxBufValue
Definition: SPICC26XXDMA.h:609
Semaphore_Struct transferComplete
Definition: SPICC26XXDMA.h:647
A SPI_Transaction data structure is used with SPI_transfer(). It indicates how many SPI_FrameFormat f...
Definition: SPI.h:244
Power notify object structure.
Definition: Power.h:112
uint8_t intNum
Definition: SPICC26XXDMA.h:591
SPI_Mode
Definitions for various SPI modes of operation.
Definition: SPI.h:270
unsigned int transferTimeout
Definition: SPICC26XXDMA.h:632
Power_NotifyObj spiPreObj
Definition: SPICC26XXDMA.h:674
struct SPICC26XX_HWAttrs SPICC26XX_HWAttrs
SPICC26XXDMA Hardware attributes.
SPI_TransferMode transferMode
Definition: SPICC26XXDMA.h:631
underlying data structure for type PIN_State
Definition: PIN.h:686
PIN_Id csnPin
Definition: SPICC26XXDMA.h:654
void * spiPostFxn
Definition: SPICC26XXDMA.h:673
SPICC26XXDMA_FrameSize frameSize
Definition: SPICC26XXDMA.h:651
SPI_Transaction * currentTransaction
Definition: SPICC26XXDMA.h:650
SPI_Mode mode
Definition: SPICC26XXDMA.h:634
SPICC26XXDMA Hardware attributes.
Definition: SPICC26XXDMA.h:587
void(* SPICC26XXDMA_CallbackFxn)(SPI_Handle handle)
Definition: SPICC26XXDMA.h:533
PIN_Handle pinHandle
Definition: SPICC26XXDMA.h:658
Definition: SPICC26XXDMA.h:523
bool returnPartial
Definition: SPICC26XXDMA.h:664
unsigned int dataSize
Definition: SPICC26XXDMA.h:642
SPI_FrameFormat
Definitions for various SPI data frame formats.
Definition: SPI.h:279
uint32_t baseAddr
Definition: SPICC26XXDMA.h:589
Copyright 2015, Texas Instruments Incorporated