Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
CC32xxUart.hxx
Go to the documentation of this file.
1
34#ifndef _FREERTOS_DRIVERS_TI_CC32XXUART_HXX_
35#define _FREERTOS_DRIVERS_TI_CC32XXUART_HXX_
36
37#ifndef gcc
38#define gcc
39#endif
40
41#include <cstdint>
42
43#include "Serial.hxx"
44
45#include "driverlib/uart.h"
46
47class Notifiable;
48
51class CC32xxUart : public Serial
52{
53public:
54 enum Mode
55 {
56 CS5 = UART_CONFIG_WLEN_5,
57 CS6 = UART_CONFIG_WLEN_6,
58 CS7 = UART_CONFIG_WLEN_7,
59 CS8 = UART_CONFIG_WLEN_8,
60 CSTOPB = UART_CONFIG_STOP_TWO,
61 };
62
64 typedef void (*TxEnableMethod)();
65
76 CC32xxUart(const char *name, unsigned long base, uint32_t interrupt,
77 uint32_t baud = 115200, uint32_t mode = CS8, bool hw_fifo = true,
78 TxEnableMethod tx_enable_assert = nullptr,
79 TxEnableMethod tx_enable_deassert = nullptr);
80
84 {
85 }
86
90 void interrupt_handler();
91
94 int ioctl(File *file, unsigned long int key, unsigned long data) override;
95
96private:
97 void enable() override;
98 void disable() override;
103 void tx_char() override;
104
107 void send();
108
110 void set_mode();
111
114
117
120
121 unsigned long base_;
122 uint32_t interrupt_ : 8;
123 uint32_t baud_ : 24;
124 uint32_t uartMode_;
125 uint8_t txPending_;
126 uint8_t hwFIFO_;
127 uint8_t nineBit_;
132
134};
135
136
137#endif /* _FREERTOS_DRIVERS_TI_CC32XXUART_HXX_ */
Specialization of Serial driver for CC32xx UART.
uint8_t txPending_
transmission currently pending
void disable() override
function to disable device
Notifiable * txComplete_
Notifiable to invoke when the transmit engine has finished operation.
void tx_char() override
Try and transmit a message.
uint8_t hwFIFO_
true if hardware fifo is to be enabled, else false
CC32xxUart()
Default constructor.
unsigned long base_
base address of this device
TxEnableMethod txEnableAssert_
function pointer to a method that asserts the transmit enable.
~CC32xxUart()
Destructor.
void send()
Send data until there is no more space left.
uint32_t interrupt_
interrupt of this device
@ CS6
6-bits word length
@ CSTOPB
send two stop bits instead of 1
@ CS8
8-bits word length
@ CS7
7-bits word length
@ CS5
5-bits word length
uint32_t baud_
desired baud rate
void set_mode()
Sets the port baud rate and mode from the class variables.
uint8_t nineBit_
true if using 9-bit reception
uint32_t uartMode_
mode of the UART, 8 or 9 bit, 1 or 2 stop...
TxEnableMethod txEnableDeassert_
function pointer to a method that deasserts the transmit enable.
int ioctl(File *file, unsigned long int key, unsigned long data) override
Request an ioctl transaction.
void enable() override
function to enable device
void interrupt_handler()
handle an interrupt.
void(* TxEnableMethod)()
Function point for the tx enable assert and deassert methods.
const char * name
device name
Definition Devtab.hxx:266
An object that can schedule itself on an executor to run.
Private data for a serial device.
Definition Serial.hxx:46
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Removes default copy-constructor and assignment added by C++.
Definition macros.h:171
File information.
Definition Devtab.hxx:52