TI-RTOS Drivers  tidrivers_cc13xx_cc26xx_2_21_00_04
UARTCC26XX.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  */
338 #ifndef ti_drivers_uart_UARTCC26XX__include
339 #define ti_drivers_uart_UARTCC26XX__include
340 
341 #ifdef __cplusplus
342 extern "C" {
343 #endif
344 
345 #include <stdint.h>
346 #include <stdbool.h>
347 #include <ti/drivers/UART.h>
349 #include <ti/drivers/Power.h>
351 #include <driverlib/uart.h>
352 
353 /*
354  * The following allows this header file to be included in an application file
355  * which also includes ti/sysbios/hal/Hwi.h.
356  */
357 #define ti_sysbios_family_arm_m3_Hwi__nolocalnames
358 #include <ti/sysbios/family/arm/m3/Hwi.h>
359 #include <ti/sysbios/knl/Swi.h>
360 #include <ti/sysbios/knl/Clock.h>
361 #include <ti/sysbios/knl/Semaphore.h>
362 
373 /* Add UARTCC26XX_STATUS_* macros here */
374 
394 #define UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE UART_CMD_RESERVED + 0
395 
403 #define UARTCC26XX_CMD_RETURN_PARTIAL_DISABLE UART_CMD_RESERVED + 1
404 
411 #define UARTCC26XX_CMD_RX_FIFO_FLUSH UART_CMD_RESERVED + 2
412 
415 #define UARTCC26XX_FIFO_SIZE 32
416 
417 /* BACKWARDS COMPATIBILITY */
418 #define UARTCC26XX_RETURN_PARTIAL_ENABLE UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE
419 #define UARTCC26XX_RETURN_PARTIAL_DISABLE UARTCC26XX_CMD_RETURN_PARTIAL_DISABLE
420 /* END BACKWARDS COMPATIBILITY */
421 
422 /* UART function table pointer */
424 
465 typedef struct UARTCC26XX_HWAttrsV2 {
466  uint32_t baseAddr;
467  uint32_t powerMngrId;
468  int intNum;
481  uint8_t intPriority;
487  uint32_t swiPriority;
488  uint8_t txPin;
489  uint8_t rxPin;
490  uint8_t ctsPin;
491  uint8_t rtsPin;
492  unsigned char *ringBufPtr;
493  size_t ringBufSize;
495 
501 typedef enum UART_Status {
502  UART_TIMED_OUT = 0x10,
503  UART_PARITY_ERROR = UART_RXERROR_PARITY,
504  UART_BRAKE_ERROR = UART_RXERROR_BREAK,
505  UART_OVERRUN_ERROR = UART_RXERROR_OVERRUN,
506  UART_FRAMING_ERROR = UART_RXERROR_FRAMING,
507  UART_OK = 0x0
508 } UART_Status;
509 
515 typedef enum UART_FifoThreshold {
522 
528 typedef struct UARTCC26XX_Object {
529  /* UART control variables */
530  bool opened;
533  unsigned int readTimeout;
534  unsigned int writeTimeout;
547  uint32_t baudRate;
553  /* UART write variables */
554  const void *writeBuf;
555  size_t writeCount;
556  size_t writeSize;
557  bool writeCR;
559  /* UART receive variables */
561  void *readBuf;
562  size_t readCount;
563  size_t readSize;
568  /* PIN driver state object and handle */
571 
573  void *uartPostFxn;
576 
577  /* UART SYS/BIOS objects */
578  ti_sysbios_family_arm_m3_Hwi_Struct hwi;
579  Swi_Struct swi;
580  Semaphore_Struct writeSem;
581  Semaphore_Struct readSem;
582  Clock_Struct txFifoEmptyClk;
584 
585 
586 
587 /* Do not interfere with the app if they include the family Hwi module */
588 #undef ti_sysbios_family_arm_m3_Hwi__nolocalnames
589 
590 #ifdef __cplusplus
591 }
592 #endif
593 
594 #endif /* ti_drivers_uart_UARTCC26XX__include */
uint8_t rtsPin
Definition: UARTCC26XX.h:491
UART_STOP
UART stop bit settings.
Definition: UART.h:410
UARTCC26XX Hardware attributes.
Definition: UARTCC26XX.h:465
UART_Mode readMode
Definition: UARTCC26XX.h:531
Definition: UARTCC26XX.h:502
Power_NotifyObj uartPostObj
Definition: UARTCC26XX.h:575
uint32_t baudRate
Baud rate for CC26xx UART.
Definition: UARTCC26XX.h:547
const void * writeBuf
Definition: UARTCC26XX.h:554
size_t writeSize
Definition: UARTCC26XX.h:556
Definition: UARTCC26XX.h:520
The definition of a UART function table that contains the required set of functions to control a spec...
Definition: UART.h:528
Power manager interface.
UART_PAR
UART parity type settings.
Definition: UART.h:420
const UART_FxnTable UARTCC26XX_fxnTable
UART_Mode
UART mode settings.
Definition: UART.h:322
RingBuf_Object ringBuffer
Definition: UARTCC26XX.h:566
Definition: UARTCC26XX.h:516
uint8_t writeFifoThreshold
Definition: UARTCC26XX.h:565
size_t readSize
Definition: UARTCC26XX.h:563
Definition: UARTCC26XX.h:504
UART_DataMode
UART data mode settings.
Definition: UART.h:370
unsigned int readTimeout
Definition: UARTCC26XX.h:533
UART_ReturnMode
UART return mode settings.
Definition: UART.h:355
bool readRetPartial
Definition: UARTCC26XX.h:560
void * uartPostFxn
Definition: UARTCC26XX.h:573
UART_ReturnMode readReturnMode
Definition: UARTCC26XX.h:537
UART_Status
UART status.
Definition: UARTCC26XX.h:501
Semaphore_Struct writeSem
Definition: UARTCC26XX.h:580
Definition: UARTCC26XX.h:506
UARTCC26XX Object.
Definition: UARTCC26XX.h:528
UART_Callback readCallback
Definition: UARTCC26XX.h:535
Swi_Struct swi
Definition: UARTCC26XX.h:579
UART_PAR parityType
Definition: UARTCC26XX.h:550
Definition: UARTCC26XX.h:505
size_t readCount
Definition: UARTCC26XX.h:562
UART_LEN dataLength
Definition: UARTCC26XX.h:548
ti_sysbios_family_arm_m3_Hwi_Struct hwi
Definition: UARTCC26XX.h:578
Definition: UARTCC26XX.h:518
UART_FifoThreshold readFifoThreshold
Definition: UARTCC26XX.h:564
Device-specific pin & GPIO driver for CC26xx family [def].
struct UARTCC26XX_HWAttrsV2 UARTCC26XX_HWAttrsV2
UARTCC26XX Hardware attributes.
Semaphore_Struct readSem
Definition: UARTCC26XX.h:581
uint32_t baseAddr
Definition: UARTCC26XX.h:466
int intNum
Definition: UARTCC26XX.h:468
UART_Status status
Definition: UARTCC26XX.h:551
Definition: UARTCC26XX.h:507
size_t writeCount
Definition: UARTCC26XX.h:555
unsigned int writeTimeout
Definition: UARTCC26XX.h:534
Power notify object structure.
Definition: Power.h:112
bool opened
Definition: UARTCC26XX.h:530
uint8_t intPriority
UART Peripheral's interrupt priority.
Definition: UARTCC26XX.h:481
UART driver interface.
size_t ringBufSize
Definition: UARTCC26XX.h:493
uint8_t rxPin
Definition: UARTCC26XX.h:489
unsigned char * ringBufPtr
Definition: UARTCC26XX.h:492
UART_STOP stopBits
Definition: UARTCC26XX.h:549
bool writeCR
Definition: UARTCC26XX.h:557
Definition: UARTCC26XX.h:503
Definition: UARTCC26XX.h:519
underlying data structure for type PIN_State
Definition: PIN.h:687
UART_Mode writeMode
Definition: UARTCC26XX.h:532
void(* UART_Callback)(UART_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:315
Definition: RingBuf.h:44
void * readBuf
Definition: UARTCC26XX.h:561
UART_LEN
UART data length settings.
Definition: UART.h:398
UART_DataMode readDataMode
Definition: UARTCC26XX.h:538
struct UARTCC26XX_Object * UARTCC26XX_Handle
UART_DataMode writeDataMode
Definition: UARTCC26XX.h:539
PIN_State pinState
Definition: UARTCC26XX.h:569
uint8_t ctsPin
Definition: UARTCC26XX.h:490
struct UARTCC26XX_Object UARTCC26XX_Object
UARTCC26XX Object.
Definition: UARTCC26XX.h:517
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:487
UART_Callback writeCallback
Definition: UARTCC26XX.h:536
Clock_Struct txFifoEmptyClk
Definition: UARTCC26XX.h:582
uint32_t powerMngrId
Definition: UARTCC26XX.h:467
PIN_Handle hPin
Definition: UARTCC26XX.h:570
UART_FifoThreshold
UART FIFO threshold.
Definition: UARTCC26XX.h:515
uint8_t txPin
Definition: UARTCC26XX.h:488
Copyright 2016, Texas Instruments Incorporated