TI-RTOS Drivers  tidrivers_full_2_20_00_08
UARTCC26XX.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  */
332 #ifndef ti_drivers_uart_UARTCC26XX__include
333 #define ti_drivers_uart_UARTCC26XX__include
334 
335 #ifdef __cplusplus
336 extern "C" {
337 #endif
338 
339 #include <stdint.h>
340 #include <stdbool.h>
341 #include <ti/drivers/UART.h>
343 #include <ti/drivers/Power.h>
344 #include <driverlib/uart.h>
345 
346 /*
347  * The following allows this header file to be included in an application file
348  * which also includes ti/sysbios/hal/Hwi.h.
349  */
350 #define ti_sysbios_family_arm_m3_Hwi__nolocalnames
351 #include <ti/sysbios/family/arm/m3/Hwi.h>
352 #include <ti/sysbios/knl/Swi.h>
353 #include <ti/sysbios/knl/Clock.h>
354 #include <ti/sysbios/knl/Semaphore.h>
355 
366 /* Add UARTCC26XX_STATUS_* macros here */
367 
387 #define UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE UART_CMD_RESERVED + 0
388 
396 #define UARTCC26XX_CMD_RETURN_PARTIAL_DISABLE UART_CMD_RESERVED + 1
397 
404 #define UARTCC26XX_CMD_RX_FIFO_FLUSH UART_CMD_RESERVED + 2
405 
408 #define UARTCC26XX_FIFO_SIZE 32
409 
410 /* BACKWARDS COMPATIBILITY */
411 #define UARTCC26XX_RETURN_PARTIAL_ENABLE UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE
412 #define UARTCC26XX_RETURN_PARTIAL_DISABLE UARTCC26XX_CMD_RETURN_PARTIAL_DISABLE
413 /* END BACKWARDS COMPATIBILITY */
414 
415 /* UART function table pointer */
417 
456 typedef struct UARTCC26XX_HWAttrsV1 {
457  uint32_t baseAddr;
458  uint32_t powerMngrId;
459  int intNum;
472  uint8_t intPriority;
478  uint32_t swiPriority;
479  uint8_t txPin;
480  uint8_t rxPin;
481  uint8_t ctsPin;
482  uint8_t rtsPin;
484 
490 typedef enum UART_Status {
491  UART_TIMED_OUT = 0x10,
492  UART_PARITY_ERROR = UART_RXERROR_PARITY,
493  UART_BRAKE_ERROR = UART_RXERROR_BREAK,
494  UART_OVERRUN_ERROR = UART_RXERROR_OVERRUN,
495  UART_FRAMING_ERROR = UART_RXERROR_FRAMING,
496  UART_OK = 0x0
497 } UART_Status;
498 
504 typedef enum UART_FifoThreshold {
511 
517 typedef struct UARTCC26XX_Object {
518  /* UART control variables */
519  bool opened;
522  unsigned int readTimeout;
523  unsigned int writeTimeout;
536  uint32_t baudRate;
542  /* UART write variables */
543  const void *writeBuf;
544  size_t writeCount;
545  size_t writeSize;
546  bool writeCR;
548  /* UART receive variables */
550  void *readBuf;
551  size_t readCount;
552  size_t readSize;
556  /* PIN driver state object and handle */
559 
561  void *uartPostFxn;
564 
565  /* UART SYS/BIOS objects */
566  ti_sysbios_family_arm_m3_Hwi_Struct hwi;
567  Swi_Struct swi;
568  Semaphore_Struct writeSem;
569  Semaphore_Struct readSem;
570  Clock_Struct txFifoEmptyClk;
572 
573 
574 
575 /* Do not interfere with the app if they include the family Hwi module */
576 #undef ti_sysbios_family_arm_m3_Hwi__nolocalnames
577 
578 #ifdef __cplusplus
579 }
580 #endif
581 
582 #endif /* ti_drivers_uart_UARTCC26XX__include */
uint8_t txPin
Definition: UARTCC26XX.h:479
UART_STOP
UART stop bit settings.
Definition: UART.h:410
uint8_t rtsPin
Definition: UARTCC26XX.h:482
UART_Mode readMode
Definition: UARTCC26XX.h:520
Definition: UARTCC26XX.h:491
Power_NotifyObj uartPostObj
Definition: UARTCC26XX.h:563
uint32_t baudRate
Baud rate for CC26xx UART.
Definition: UARTCC26XX.h:536
uint32_t powerMngrId
Definition: UARTCC26XX.h:458
const void * writeBuf
Definition: UARTCC26XX.h:543
size_t writeSize
Definition: UARTCC26XX.h:545
Definition: UARTCC26XX.h:509
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
Definition: UARTCC26XX.h:505
uint8_t writeFifoThreshold
Definition: UARTCC26XX.h:554
size_t readSize
Definition: UARTCC26XX.h:552
Definition: UARTCC26XX.h:493
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:478
UART_DataMode
UART data mode settings.
Definition: UART.h:370
unsigned int readTimeout
Definition: UARTCC26XX.h:522
UART_ReturnMode
UART return mode settings.
Definition: UART.h:355
bool readRetPartial
Definition: UARTCC26XX.h:549
void * uartPostFxn
Definition: UARTCC26XX.h:561
UART_ReturnMode readReturnMode
Definition: UARTCC26XX.h:526
UART_Status
UART status.
Definition: UARTCC26XX.h:490
Semaphore_Struct writeSem
Definition: UARTCC26XX.h:568
Definition: UARTCC26XX.h:495
UARTCC26XX Object.
Definition: UARTCC26XX.h:517
UART_Callback readCallback
Definition: UARTCC26XX.h:524
Swi_Struct swi
Definition: UARTCC26XX.h:567
UART_PAR parityType
Definition: UARTCC26XX.h:539
Definition: UARTCC26XX.h:494
size_t readCount
Definition: UARTCC26XX.h:551
UART_LEN dataLength
Definition: UARTCC26XX.h:537
ti_sysbios_family_arm_m3_Hwi_Struct hwi
Definition: UARTCC26XX.h:566
Definition: UARTCC26XX.h:507
UART_FifoThreshold readFifoThreshold
Definition: UARTCC26XX.h:553
Device-specific pin & GPIO driver for CC26xx family [def].
Semaphore_Struct readSem
Definition: UARTCC26XX.h:569
struct UARTCC26XX_HWAttrsV1 UARTCC26XX_HWAttrsV1
UARTCC26XX Hardware attributes.
UART_Status status
Definition: UARTCC26XX.h:540
Definition: UARTCC26XX.h:496
size_t writeCount
Definition: UARTCC26XX.h:544
unsigned int writeTimeout
Definition: UARTCC26XX.h:523
Power notify object structure.
Definition: Power.h:112
bool opened
Definition: UARTCC26XX.h:519
UART driver interface.
UART_STOP stopBits
Definition: UARTCC26XX.h:538
bool writeCR
Definition: UARTCC26XX.h:546
Definition: UARTCC26XX.h:492
Definition: UARTCC26XX.h:508
underlying data structure for type PIN_State
Definition: PIN.h:687
int intNum
Definition: UARTCC26XX.h:459
uint8_t ctsPin
Definition: UARTCC26XX.h:481
UART_Mode writeMode
Definition: UARTCC26XX.h:521
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
uint32_t baseAddr
Definition: UARTCC26XX.h:457
void * readBuf
Definition: UARTCC26XX.h:550
UART_LEN
UART data length settings.
Definition: UART.h:398
UART_DataMode readDataMode
Definition: UARTCC26XX.h:527
struct UARTCC26XX_Object * UARTCC26XX_Handle
UART_DataMode writeDataMode
Definition: UARTCC26XX.h:528
PIN_State pinState
Definition: UARTCC26XX.h:557
UARTCC26XX Hardware attributes.
Definition: UARTCC26XX.h:456
uint8_t rxPin
Definition: UARTCC26XX.h:480
struct UARTCC26XX_Object UARTCC26XX_Object
UARTCC26XX Object.
Definition: UARTCC26XX.h:506
uint8_t intPriority
UART Peripheral's interrupt priority.
Definition: UARTCC26XX.h:472
UART_Callback writeCallback
Definition: UARTCC26XX.h:525
Clock_Struct txFifoEmptyClk
Definition: UARTCC26XX.h:570
PIN_Handle hPin
Definition: UARTCC26XX.h:558
UART_FifoThreshold
UART FIFO threshold.
Definition: UARTCC26XX.h:504
Copyright 2016, Texas Instruments Incorporated