UARTCC26XX.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2021, 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  */
377 #ifndef ti_drivers_uart_UARTCC26XX__include
378 #define ti_drivers_uart_UARTCC26XX__include
379 
380 #include <stdint.h>
381 #include <stdbool.h>
382 
383 #include <ti/drivers/UART.h>
384 #include <ti/drivers/GPIO.h>
385 #include <ti/drivers/Power.h>
387 
388 #include <ti/devices/DeviceFamily.h>
389 #include DeviceFamily_constructPath(driverlib/uart.h)
390 
391 #include <ti/drivers/dpl/HwiP.h>
392 #include <ti/drivers/dpl/SwiP.h>
393 #include <ti/drivers/dpl/ClockP.h>
394 #include <ti/drivers/dpl/SemaphoreP.h>
395 
396 #ifdef __cplusplus
397 extern "C" {
398 #endif
399 
410 /* Add UARTCC26XX_STATUS_* macros here */
411 
431 #define UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE (UART_CMD_RESERVED + 0)
432 
440 #define UARTCC26XX_CMD_RETURN_PARTIAL_DISABLE (UART_CMD_RESERVED + 1)
441 
448 #define UARTCC26XX_CMD_RX_FIFO_FLUSH (UART_CMD_RESERVED + 2)
449 
452 #define UARTCC26XX_FIFO_SIZE 32
453 
460 typedef enum
461 {
472 
473 /* BACKWARDS COMPATIBILITY */
474 #define UARTCC26XX_RETURN_PARTIAL_ENABLE UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE
475 #define UARTCC26XX_RETURN_PARTIAL_DISABLE UARTCC26XX_CMD_RETURN_PARTIAL_DISABLE
476 /* END BACKWARDS COMPATIBILITY */
477 
488 typedef void (*UARTCC26XX_ErrorCallback)(UART_Handle handle, uint32_t error);
489 
490 /* UART function table pointer */
492 
536 typedef struct
537 {
538  uint32_t baseAddr;
539  uint32_t powerMngrId;
540  int intNum;
554  uint8_t intPriority;
561  uint32_t swiPriority;
562  uint8_t txPin;
563  uint8_t rxPin;
564  uint8_t ctsPin;
565  uint8_t rtsPin;
566  unsigned char *ringBufPtr;
567  size_t ringBufSize;
568  UARTCC26XX_FifoThreshold txIntFifoThr;
569  UARTCC26XX_FifoThreshold rxIntFifoThr;
573 
579 typedef enum
580 {
581  UART_TIMED_OUT = 0x10,
582  UART_PARITY_ERROR = UART_RXERROR_PARITY,
583  UART_BRAKE_ERROR = UART_RXERROR_BREAK,
584  UART_OVERRUN_ERROR = UART_RXERROR_OVERRUN,
585  UART_FRAMING_ERROR = UART_RXERROR_FRAMING,
586  UART_OK = 0x0
587 } UART_Status;
588 
594 typedef struct
595 {
596  /* UART control variables */
597  bool opened;
600  unsigned int readTimeout;
601  unsigned int writeTimeout;
614  uint32_t baudRate;
620  /* UART write variables */
621  const void *writeBuf;
622  size_t writeCount;
623  size_t writeSize;
624  bool writeCR;
626  /* UART receive variables */
628  void *readBuf;
629  size_t readCount;
630  size_t readSize;
634  void *uartPostFxn;
637 
638  /* UART SYS/BIOS objects */
639  HwiP_Struct hwi;
640  SwiP_Struct swi;
641  SemaphoreP_Struct writeSem;
642  SemaphoreP_Struct readSem;
643  ClockP_Struct txFifoEmptyClk;
648 
649 #ifdef __cplusplus
650 }
651 #endif
652 
653 #endif /* ti_drivers_uart_UARTCC26XX__include */
uint8_t rtsPin
Definition: UARTCC26XX.h:565
struct UARTCC26XX_Object * UARTCC26XX_Handle
UART_STOP
UART stop bit settings.
Definition: UART.h:530
UARTCC26XX Hardware attributes.
Definition: UARTCC26XX.h:536
UART_Mode readMode
Definition: UARTCC26XX.h:598
UARTCC26XX_FifoThreshold
UART TX/RX interrupt FIFO threshold select.
Definition: UARTCC26XX.h:460
Definition: UARTCC26XX.h:581
Power_NotifyObj uartPostObj
Definition: UARTCC26XX.h:636
uint32_t baudRate
Baud rate for CC26xx UART.
Definition: UARTCC26XX.h:614
const void * writeBuf
Definition: UARTCC26XX.h:621
size_t writeSize
Definition: UARTCC26XX.h:623
The definition of a UART function table that contains the required set of functions to control a spec...
Definition: UART.h:641
Power Manager.
UART_PAR
UART parity type settings.
Definition: UART.h:541
const UART_FxnTable UARTCC26XX_fxnTable
UART_Mode
UART mode settings.
Definition: UART.h:430
RingBuf_Object ringBuffer
Definition: UARTCC26XX.h:631
SemaphoreP_Struct readSem
Definition: UARTCC26XX.h:642
size_t readSize
Definition: UARTCC26XX.h:630
Definition: UARTCC26XX.h:583
UART_DataMode
UART data mode settings.
Definition: UART.h:487
unsigned int readTimeout
Definition: UARTCC26XX.h:600
UART_ReturnMode
UART return mode settings.
Definition: UART.h:464
Definition: UARTCC26XX.h:462
bool readRetPartial
Definition: UARTCC26XX.h:627
void * uartPostFxn
Definition: UARTCC26XX.h:634
UART_ReturnMode readReturnMode
Definition: UARTCC26XX.h:604
UART_Status
UART status.
Definition: UARTCC26XX.h:579
Definition: UARTCC26XX.h:585
UARTCC26XX Object.
Definition: UARTCC26XX.h:594
UART_Callback readCallback
Definition: UARTCC26XX.h:602
UART Global configuration.
Definition: UART.h:685
bool uartRxPowerConstraint
Definition: UARTCC26XX.h:645
UART_PAR parityType
Definition: UARTCC26XX.h:617
Definition: UARTCC26XX.h:584
size_t readCount
Definition: UARTCC26XX.h:629
UART_LEN dataLength
Definition: UARTCC26XX.h:615
HwiP_Struct hwi
Definition: UARTCC26XX.h:639
SemaphoreP_Struct writeSem
Definition: UARTCC26XX.h:641
ClockP_Struct txFifoEmptyClk
Definition: UARTCC26XX.h:643
uint32_t baseAddr
Definition: UARTCC26XX.h:538
Definition: UARTCC26XX.h:467
int intNum
Definition: UARTCC26XX.h:540
UART_Status status
Definition: UARTCC26XX.h:618
Definition: UARTCC26XX.h:586
UARTCC26XX_FifoThreshold txIntFifoThr
Definition: UARTCC26XX.h:568
size_t writeCount
Definition: UARTCC26XX.h:622
unsigned int writeTimeout
Definition: UARTCC26XX.h:601
Power notify object structure.
Definition: Power.h:442
bool opened
Definition: UARTCC26XX.h:597
uint8_t intPriority
UART Peripheral&#39;s interrupt priority.
Definition: UARTCC26XX.h:554
Universal Asynchronous Receiver-Transmitter (UART) Driver.
size_t ringBufSize
Definition: UARTCC26XX.h:567
uint8_t rxPin
Definition: UARTCC26XX.h:563
unsigned char * ringBufPtr
Definition: UARTCC26XX.h:566
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:488
UART_STOP stopBits
Definition: UARTCC26XX.h:616
bool writeCR
Definition: UARTCC26XX.h:624
Definition: UARTCC26XX.h:582
UART_Mode writeMode
Definition: UARTCC26XX.h:599
Definition: UARTCC26XX.h:470
SwiP_Struct swi
Definition: UARTCC26XX.h:640
Definition: UARTCC26XX.h:469
Definition: RingBuf.h:44
Definition: UARTCC26XX.h:468
void * readBuf
Definition: UARTCC26XX.h:628
UART_LEN
UART data length settings.
Definition: UART.h:517
UART_DataMode readDataMode
Definition: UARTCC26XX.h:605
UARTCC26XX_ErrorCallback errorFxn
Definition: UARTCC26XX.h:571
General Purpose I/O driver interface.
Definition: UARTCC26XX.h:466
UART_DataMode writeDataMode
Definition: UARTCC26XX.h:606
uint8_t ctsPin
Definition: UARTCC26XX.h:564
UARTCC26XX_FifoThreshold rxIntFifoThr
Definition: UARTCC26XX.h:569
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:561
UART_Callback writeCallback
Definition: UARTCC26XX.h:603
uint32_t powerMngrId
Definition: UARTCC26XX.h:539
bool uartTxPowerConstraint
Definition: UARTCC26XX.h:646
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:423
uint8_t txPin
Definition: UARTCC26XX.h:562
© Copyright 1995-2022, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale