L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
L4::Uart_apb Class Reference

Driver for the Advanced Peripheral Bus (APB) UART from the Cortex-M System Design Kit (apb). More...

#include <uart_apb.h>

+ Inheritance diagram for L4::Uart_apb:
+ Collaboration diagram for L4::Uart_apb:

Public Member Functions

 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.
 
- Public Member Functions inherited from L4::Uart
virtual void irq_ack ()
 Acknowledge a received interrupt.
 
Transfer_mode mode () const
 Return the transfer mode.
 
Baud_rate rate () const
 Return the baud rate.
 

Additional Inherited Members

- Protected Member Functions inherited from L4::Uart
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.
 

Detailed Description

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.

Member Function Documentation

◆ change_mode()

bool L4::Uart_apb::change_mode ( Transfer_mode  m,
Baud_rate  r 
)
overridevirtual

Set certain parameters of the UART.

Parameters
mUART mode. Depends on the hardware.
rBaud rate.
Return values
trueMode setting succeeded (or was not performed at all).
falseMode 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
trueThe RX IRQ was successfully enabled / disabled.
falseThe 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
blockingIf 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
regsIO register block of the UART.
Return values
trueStartup succeeded.
falseStartup 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
sBuffer containing the characters.
countNumber of characters to transmit.
blockingIf 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: