UARTCC26XX.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2019, 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  */
371 #ifndef ti_drivers_uart_UARTCC26XX__include
372 #define ti_drivers_uart_UARTCC26XX__include
373 
374 #ifdef __cplusplus
375 extern "C" {
376 #endif
377 
378 #include <stdint.h>
379 #include <stdbool.h>
380 
381 #include <ti/drivers/UART.h>
383 #include <ti/drivers/Power.h>
385 
386 #include <ti/devices/DeviceFamily.h>
387 #include DeviceFamily_constructPath(driverlib/uart.h)
388 
389 #include <ti/drivers/dpl/HwiP.h>
390 #include <ti/drivers/dpl/SwiP.h>
391 #include <ti/drivers/dpl/ClockP.h>
392 #include <ti/drivers/dpl/SemaphoreP.h>
393 
404 /* Add UARTCC26XX_STATUS_* macros here */
405 
425 #define UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE (UART_CMD_RESERVED + 0)
426 
434 #define UARTCC26XX_CMD_RETURN_PARTIAL_DISABLE (UART_CMD_RESERVED + 1)
435 
442 #define UARTCC26XX_CMD_RX_FIFO_FLUSH (UART_CMD_RESERVED + 2)
443 
446 #define UARTCC26XX_FIFO_SIZE 32
447 
465 
466 /* BACKWARDS COMPATIBILITY */
467 #define UARTCC26XX_RETURN_PARTIAL_ENABLE UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE
468 #define UARTCC26XX_RETURN_PARTIAL_DISABLE UARTCC26XX_CMD_RETURN_PARTIAL_DISABLE
469 /* END BACKWARDS COMPATIBILITY */
470 
481 typedef void (*UARTCC26XX_ErrorCallback) (UART_Handle handle, uint32_t error);
482 
483 /* UART function table pointer */
485 
529 typedef struct UARTCC26XX_HWAttrsV2 {
530  uint32_t baseAddr;
531  uint32_t powerMngrId;
532  int intNum;
545  uint8_t intPriority;
551  uint32_t swiPriority;
552  uint8_t txPin;
553  uint8_t rxPin;
554  uint8_t ctsPin;
555  uint8_t rtsPin;
556  unsigned char *ringBufPtr;
557  size_t ringBufSize;
558  UARTCC26XX_FifoThreshold txIntFifoThr;
559  UARTCC26XX_FifoThreshold rxIntFifoThr;
563 
569 typedef enum UART_Status {
570  UART_TIMED_OUT = 0x10,
571  UART_PARITY_ERROR = UART_RXERROR_PARITY,
572  UART_BRAKE_ERROR = UART_RXERROR_BREAK,
573  UART_OVERRUN_ERROR = UART_RXERROR_OVERRUN,
574  UART_FRAMING_ERROR = UART_RXERROR_FRAMING,
575  UART_OK = 0x0
576 } UART_Status;
577 
583 typedef struct UARTCC26XX_Object {
584  /* UART control variables */
585  bool opened;
588  unsigned int readTimeout;
589  unsigned int writeTimeout;
602  uint32_t baudRate;
608  /* UART write variables */
609  const void *writeBuf;
610  size_t writeCount;
611  size_t writeSize;
612  bool writeCR;
614  /* UART receive variables */
616  void *readBuf;
617  size_t readCount;
618  size_t readSize;
621  /* PIN driver state object and handle */
624 
626  void *uartPostFxn;
629 
630  /* UART SYS/BIOS objects */
631  HwiP_Struct hwi;
632  SwiP_Struct swi;
633  SemaphoreP_Struct writeSem;
634  SemaphoreP_Struct readSem;
635  ClockP_Struct txFifoEmptyClk;
640 
641 #ifdef __cplusplus
642 }
643 #endif
644 
645 #endif /* ti_drivers_uart_UARTCC26XX__include */
uint8_t rtsPin
Definition: UARTCC26XX.h:555
UARTCC26XX Hardware attributes.
Definition: UARTCC26XX.h:529
UART_Mode readMode
Definition: UARTCC26XX.h:586
UARTCC26XX_FifoThreshold
UART TX/RX interrupt FIFO threshold select.
Definition: UARTCC26XX.h:454
Definition: UARTCC26XX.h:570
Power_NotifyObj uartPostObj
Definition: UARTCC26XX.h:628
uint32_t baudRate
Baud rate for CC26xx UART.
Definition: UARTCC26XX.h:602
const void * writeBuf
Definition: UARTCC26XX.h:609
size_t writeSize
Definition: UARTCC26XX.h:611
enum UART_PAR_ UART_PAR
UART parity type settings.
Power Manager.
enum UART_LEN_ UART_LEN
UART data length settings.
const UART_FxnTable UARTCC26XX_fxnTable
RingBuf_Object ringBuffer
Definition: UARTCC26XX.h:619
enum UART_Mode_ UART_Mode
UART mode settings.
SemaphoreP_Struct readSem
Definition: UARTCC26XX.h:634
size_t readSize
Definition: UARTCC26XX.h:618
Definition: UARTCC26XX.h:572
unsigned int readTimeout
Definition: UARTCC26XX.h:588
Definition: UARTCC26XX.h:455
bool readRetPartial
Definition: UARTCC26XX.h:615
void * uartPostFxn
Definition: UARTCC26XX.h:626
UART_ReturnMode readReturnMode
Definition: UARTCC26XX.h:592
UART_Status
UART status.
Definition: UARTCC26XX.h:569
Definition: UARTCC26XX.h:574
UARTCC26XX Object.
Definition: UARTCC26XX.h:583
UART_Callback readCallback
Definition: UARTCC26XX.h:590
UART Global configuration.
Definition: UART.h:678
bool uartRxPowerConstraint
Definition: UARTCC26XX.h:637
UART_PAR parityType
Definition: UARTCC26XX.h:605
Definition: UARTCC26XX.h:573
size_t readCount
Definition: UARTCC26XX.h:617
UART_LEN dataLength
Definition: UARTCC26XX.h:603
Device-specific pin & GPIO driver for CC26xx family [def].
struct UARTCC26XX_HWAttrsV2 UARTCC26XX_HWAttrsV2
UARTCC26XX Hardware attributes.
HwiP_Struct hwi
Definition: UARTCC26XX.h:631
SemaphoreP_Struct writeSem
Definition: UARTCC26XX.h:633
ClockP_Struct txFifoEmptyClk
Definition: UARTCC26XX.h:635
uint32_t baseAddr
Definition: UARTCC26XX.h:530
Definition: UARTCC26XX.h:460
int intNum
Definition: UARTCC26XX.h:532
UART_Status status
Definition: UARTCC26XX.h:606
Definition: UARTCC26XX.h:575
The definition of a UART function table that contains the required set of functions to control a spec...
Definition: UART.h:635
UARTCC26XX_FifoThreshold txIntFifoThr
Definition: UARTCC26XX.h:558
size_t writeCount
Definition: UARTCC26XX.h:610
unsigned int writeTimeout
Definition: UARTCC26XX.h:589
Power notify object structure.
Definition: Power.h:443
bool opened
Definition: UARTCC26XX.h:585
uint8_t intPriority
UART Peripheral&#39;s interrupt priority.
Definition: UARTCC26XX.h:545
Universal Asynchronous Receiver-Transmitter (UART) Driver.
size_t ringBufSize
Definition: UARTCC26XX.h:557
uint8_t rxPin
Definition: UARTCC26XX.h:553
unsigned char * ringBufPtr
Definition: UARTCC26XX.h:556
void(* UARTCC26XX_ErrorCallback)(UART_Handle handle, uint32_t error)
The definition of an optional callback function used by the UART driver to notify the application whe...
Definition: UARTCC26XX.h:481
UART_STOP stopBits
Definition: UARTCC26XX.h:604
bool writeCR
Definition: UARTCC26XX.h:612
Definition: UARTCC26XX.h:571
underlying data structure for type PIN_State
Definition: PIN.h:707
UART_Mode writeMode
Definition: UARTCC26XX.h:587
enum UART_STOP_ UART_STOP
UART stop bit settings.
Definition: UARTCC26XX.h:463
enum UART_ReturnMode_ UART_ReturnMode
UART return mode settings.
SwiP_Struct swi
Definition: UARTCC26XX.h:632
Definition: UARTCC26XX.h:462
Definition: RingBuf.h:44
Definition: UARTCC26XX.h:461
void * readBuf
Definition: UARTCC26XX.h:616
UART_DataMode readDataMode
Definition: UARTCC26XX.h:593
UARTCC26XX_ErrorCallback errorFxn
Definition: UARTCC26XX.h:561
struct UARTCC26XX_Object * UARTCC26XX_Handle
Definition: UARTCC26XX.h:459
UART_DataMode writeDataMode
Definition: UARTCC26XX.h:594
PIN_State pinState
Definition: UARTCC26XX.h:622
uint8_t ctsPin
Definition: UARTCC26XX.h:554
UARTCC26XX_FifoThreshold rxIntFifoThr
Definition: UARTCC26XX.h:559
struct UARTCC26XX_Object UARTCC26XX_Object
UARTCC26XX Object.
uint32_t swiPriority
SPI SWI priority. The higher the number, the higher the priority. The minimum is 0 and the maximum is...
Definition: UARTCC26XX.h:551
UART_Callback writeCallback
Definition: UARTCC26XX.h:591
uint32_t powerMngrId
Definition: UARTCC26XX.h:531
PIN_Handle hPin
Definition: UARTCC26XX.h:623
bool uartTxPowerConstraint
Definition: UARTCC26XX.h:638
void(* UART_Callback)(UART_Handle handle, void *buf, size_t count)
The definition of a callback function used by the UART driver when used in UART_MODE_CALLBACK The cal...
Definition: UART.h:421
uint8_t txPin
Definition: UARTCC26XX.h:552
enum UART_DataMode_ UART_DataMode
UART data mode settings.
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale