Driver for the Advanced Peripheral Bus (APB) UART from the Cortex-M System Design Kit (apb).
More...
#include <uart_apb.h>
|
| Uart_apb (unsigned freq) |
| freq == 0 means unknown and don't change baud rate
|
|
bool | startup (Io_register_block const *) override |
| Start the UART driver.
|
|
void | shutdown () override |
| Terminate the UART driver.
|
|
bool | change_mode (Transfer_mode m, Baud_rate r) override |
| Set certain parameters of the UART.
|
|
bool | enable_rx_irq (bool enable) override |
| Enable the receive IRQ.
|
|
int | get_char (bool blocking=true) const override |
| Read a character from the UART.
|
|
int | char_avail () const override |
| Check if there is at least one character available for reading from the UART.
|
|
int | write (char const *s, unsigned long count, bool blocking=true) const override |
| Transmit a number of characters.
|
|
virtual void | irq_ack () |
| Acknowledge a received interrupt.
|
|
Transfer_mode | mode () const |
| Return the transfer mode.
|
|
Baud_rate | rate () const |
| Return the baud rate.
|
|
|
template<typename Uart_driver > |
int | generic_write (char const *s, unsigned long count, bool blocking=true) const |
| Internal function transmitting each character one-after-another and finally waiting that the transmission did actually finish.
|
|
Driver for the Advanced Peripheral Bus (APB) UART from the Cortex-M System Design Kit (apb).
Definition at line 18 of file uart_apb.h.
◆ change_mode()
bool L4::Uart_apb::change_mode |
( |
Transfer_mode |
m, |
|
|
Baud_rate |
r |
|
) |
| |
|
overridevirtual |
Set certain parameters of the UART.
- Parameters
-
m | UART mode. Depends on the hardware. |
r | Baud rate. |
- Return values
-
true | Mode setting succeeded (or was not performed at all). |
false | Mode setting failed for some reason. |
- Note
- Some drivers don't perform any mode setting at all and just return true.
Implements L4::Uart.
◆ char_avail()
int L4::Uart_apb::char_avail |
( |
| ) |
const |
|
overridevirtual |
Check if there is at least one character available for reading from the UART.
- Returns
- 0 if there is no character available for reading, !=0 otherwise.
Implements L4::Uart.
◆ enable_rx_irq()
bool L4::Uart_apb::enable_rx_irq |
( |
bool |
| ) |
|
|
overridevirtual |
Enable the receive IRQ.
- Return values
-
true | The RX IRQ was successfully enabled / disabled. |
false | The RX IRQ couldn't be enabled / disabled. The driver does not support this operation. |
Reimplemented from L4::Uart.
◆ get_char()
int L4::Uart_apb::get_char |
( |
bool |
blocking = true | ) |
const |
|
overridevirtual |
Read a character from the UART.
- Parameters
-
blocking | If true, wait until a character is available for reading. Otherwise do not wait and just return -1 if no character is available. |
- Returns
- The actual character read from the UART.
Implements L4::Uart.
◆ shutdown()
void L4::Uart_apb::shutdown |
( |
| ) |
|
|
overridevirtual |
Terminate the UART driver.
This includes disabling of interrupts.
Implements L4::Uart.
◆ startup()
bool L4::Uart_apb::startup |
( |
Io_register_block const * |
regs | ) |
|
|
overridevirtual |
Start the UART driver.
- Parameters
-
regs | IO register block of the UART. |
- Return values
-
true | Startup succeeded. |
false | Startup failed. |
Implements L4::Uart.
◆ write()
int L4::Uart_apb::write |
( |
char const * |
s, |
|
|
unsigned long |
count, |
|
|
bool |
blocking = true |
|
) |
| const |
|
overridevirtual |
Transmit a number of characters.
- Parameters
-
s | Buffer containing the characters. |
count | Number of characters to transmit. |
blocking | If true, wait until there is space in the transmit buffer and also wait until every character was successful transmitted. Otherwise do not wait. |
- Returns
- The number of successfully written characters.
Implements L4::Uart.
The documentation for this class was generated from the following file: