UARTCC26XX.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2017, 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  */
360 #ifndef ti_drivers_uart_UARTCC26XX__include
361 #define ti_drivers_uart_UARTCC26XX__include
362 
363 #ifdef __cplusplus
364 extern "C" {
365 #endif
366 
367 #include <stdint.h>
368 #include <stdbool.h>
369 
370 #include <ti/drivers/UART.h>
372 #include <ti/drivers/Power.h>
374 
375 #include <ti/devices/DeviceFamily.h>
376 #include DeviceFamily_constructPath(driverlib/uart.h)
377 
378 #include <ti/drivers/dpl/HwiP.h>
379 #include <ti/drivers/dpl/SwiP.h>
380 #include <ti/drivers/dpl/ClockP.h>
381 #include <ti/drivers/dpl/SemaphoreP.h>
382 
393 /* Add UARTCC26XX_STATUS_* macros here */
394 
414 #define UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE UART_CMD_RESERVED + 0
415 
423 #define UARTCC26XX_CMD_RETURN_PARTIAL_DISABLE UART_CMD_RESERVED + 1
424 
431 #define UARTCC26XX_CMD_RX_FIFO_FLUSH UART_CMD_RESERVED + 2
432 
435 #define UARTCC26XX_FIFO_SIZE 32
436 
437 /* BACKWARDS COMPATIBILITY */
438 #define UARTCC26XX_RETURN_PARTIAL_ENABLE UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE
439 #define UARTCC26XX_RETURN_PARTIAL_DISABLE UARTCC26XX_CMD_RETURN_PARTIAL_DISABLE
440 /* END BACKWARDS COMPATIBILITY */
441 
442 /* UART function table pointer */
444 
485 typedef struct UARTCC26XX_HWAttrsV2 {
486  uint32_t baseAddr;
487  uint32_t powerMngrId;
488  int intNum;
501  uint8_t intPriority;
507  uint32_t swiPriority;
508  uint8_t txPin;
509  uint8_t rxPin;
510  uint8_t ctsPin;
511  uint8_t rtsPin;
512  unsigned char *ringBufPtr;
513  size_t ringBufSize;
515 
521 typedef enum UART_Status {
522  UART_TIMED_OUT = 0x10,
523  UART_PARITY_ERROR = UART_RXERROR_PARITY,
524  UART_BRAKE_ERROR = UART_RXERROR_BREAK,
525  UART_OVERRUN_ERROR = UART_RXERROR_OVERRUN,
526  UART_FRAMING_ERROR = UART_RXERROR_FRAMING,
527  UART_OK = 0x0
528 } UART_Status;
529 
535 typedef enum UART_FifoThreshold {
542 
548 typedef struct UARTCC26XX_Object {
549  /* UART control variables */
550  bool opened;
553  unsigned int readTimeout;
554  unsigned int writeTimeout;
567  uint32_t baudRate;
573  /* UART write variables */
574  const void *writeBuf;
575  size_t writeCount;
576  size_t writeSize;
577  bool writeCR;
579  /* UART receive variables */
581  void *readBuf;
582  size_t readCount;
583  size_t readSize;
588  /* PIN driver state object and handle */
591 
593  void *uartPostFxn;
596 
597  /* UART SYS/BIOS objects */
598  HwiP_Struct hwi;
599  SwiP_Struct swi;
600  SemaphoreP_Struct writeSem;
601  SemaphoreP_Struct readSem;
602  ClockP_Struct txFifoEmptyClk;
604 
605 #ifdef __cplusplus
606 }
607 #endif
608 
609 #endif /* ti_drivers_uart_UARTCC26XX__include */
uint8_t rtsPin
Definition: UARTCC26XX.h:511
UARTCC26XX Hardware attributes.
Definition: UARTCC26XX.h:485
UART_Mode readMode
Definition: UARTCC26XX.h:551
Definition: UARTCC26XX.h:522
Power_NotifyObj uartPostObj
Definition: UARTCC26XX.h:595
uint32_t baudRate
Baud rate for CC26xx UART.
Definition: UARTCC26XX.h:567
const void * writeBuf
Definition: UARTCC26XX.h:574
size_t writeSize
Definition: UARTCC26XX.h:576
Definition: UARTCC26XX.h:540
enum UART_PAR_ UART_PAR
UART parity type settings.
Power manager interface.
enum UART_LEN_ UART_LEN
UART data length settings.
const UART_FxnTable UARTCC26XX_fxnTable
RingBuf_Object ringBuffer
Definition: UARTCC26XX.h:586
enum UART_Mode_ UART_Mode
UART mode settings.
Definition: UARTCC26XX.h:536
Power notify object structure.
Definition: Power.h:115
uint8_t writeFifoThreshold
Definition: UARTCC26XX.h:585
SemaphoreP_Struct readSem
Definition: UARTCC26XX.h:601
size_t readSize
Definition: UARTCC26XX.h:583
Definition: UARTCC26XX.h:524
unsigned int readTimeout
Definition: UARTCC26XX.h:553
bool readRetPartial
Definition: UARTCC26XX.h:580
void * uartPostFxn
Definition: UARTCC26XX.h:593
UART_ReturnMode readReturnMode
Definition: UARTCC26XX.h:557
UART_Status
UART status.
Definition: UARTCC26XX.h:521
Definition: UARTCC26XX.h:526
UARTCC26XX Object.
Definition: UARTCC26XX.h:548
UART_Callback readCallback
Definition: UARTCC26XX.h:555
UART_PAR parityType
Definition: UARTCC26XX.h:570
Definition: UARTCC26XX.h:525
size_t readCount
Definition: UARTCC26XX.h:582
UART_LEN dataLength
Definition: UARTCC26XX.h:568
Definition: UARTCC26XX.h:538
UART_FifoThreshold readFifoThreshold
Definition: UARTCC26XX.h:584
Device-specific pin & GPIO driver for CC26xx family [def].
struct UARTCC26XX_HWAttrsV2 UARTCC26XX_HWAttrsV2
UARTCC26XX Hardware attributes.
HwiP_Struct hwi
Definition: UARTCC26XX.h:598
SemaphoreP_Struct writeSem
Definition: UARTCC26XX.h:600
ClockP_Struct txFifoEmptyClk
Definition: UARTCC26XX.h:602
uint32_t baseAddr
Definition: UARTCC26XX.h:486
int intNum
Definition: UARTCC26XX.h:488
UART_Status status
Definition: UARTCC26XX.h:571
Definition: UARTCC26XX.h:527
The definition of a UART function table that contains the required set of functions to control a spec...
Definition: UART.h:652
size_t writeCount
Definition: UARTCC26XX.h:575
unsigned int writeTimeout
Definition: UARTCC26XX.h:554
bool opened
Definition: UARTCC26XX.h:550
uint8_t intPriority
UART Peripheral&#39;s interrupt priority.
Definition: UARTCC26XX.h:501
UART driver interface.
size_t ringBufSize
Definition: UARTCC26XX.h:513
uint8_t rxPin
Definition: UARTCC26XX.h:509
unsigned char * ringBufPtr
Definition: UARTCC26XX.h:512
UART_STOP stopBits
Definition: UARTCC26XX.h:569
bool writeCR
Definition: UARTCC26XX.h:577
Definition: UARTCC26XX.h:523
Definition: UARTCC26XX.h:539
underlying data structure for type PIN_State
Definition: PIN.h:680
UART_Mode writeMode
Definition: UARTCC26XX.h:552
enum UART_STOP_ UART_STOP
UART stop bit settings.
enum UART_ReturnMode_ UART_ReturnMode
UART return mode settings.
SwiP_Struct swi
Definition: UARTCC26XX.h:599
Definition: RingBuf.h:44
void * readBuf
Definition: UARTCC26XX.h:581
UART_DataMode readDataMode
Definition: UARTCC26XX.h:558
struct UARTCC26XX_Object * UARTCC26XX_Handle
UART_DataMode writeDataMode
Definition: UARTCC26XX.h:559
PIN_State pinState
Definition: UARTCC26XX.h:589
uint8_t ctsPin
Definition: UARTCC26XX.h:510
struct UARTCC26XX_Object UARTCC26XX_Object
UARTCC26XX Object.
Definition: UARTCC26XX.h:537
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:507
UART_Callback writeCallback
Definition: UARTCC26XX.h:556
uint32_t powerMngrId
Definition: UARTCC26XX.h:487
PIN_Handle hPin
Definition: UARTCC26XX.h:590
UART_FifoThreshold
UART FIFO threshold.
Definition: UARTCC26XX.h:535
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:438
uint8_t txPin
Definition: UARTCC26XX.h:508
enum UART_DataMode_ UART_DataMode
UART data mode settings.
Copyright 2017, Texas Instruments Incorporated