L4Re Operating System Framework – Interface and Usage Documentation
Loading...
Searching...
No Matches
L4::Uart Class Referenceabstract

Uart driver abstraction. More...

#include <uart_base.h>

Inherited by L4::Uart_16550, L4::Uart_cadence, L4::Uart_dcc_v6, L4::Uart_dm, L4::Uart_dummy, L4::Uart_geni, L4::Uart_imx, L4::Uart_leon3, L4::Uart_linflex, L4::Uart_lpuart, L4::Uart_mvebu, L4::Uart_of, L4::Uart_omap35x, L4::Uart_pl011, L4::Uart_s3c, L4::Uart_sa1000, and L4::Uart_sh.

+ Collaboration diagram for L4::Uart:

Public Member Functions

virtual bool startup (Io_register_block const *regs)=0
 Start the UART driver.
 
virtual void shutdown ()=0
 Terminate the UART driver.
 
virtual bool change_mode (Transfer_mode m, Baud_rate r)=0
 Set certain parameters of the UART.
 
virtual int get_char (bool blocking=true) const =0
 Read a character from the UART.
 
virtual int char_avail () const =0
 Check if there is at least one character available for reading from the UART.
 
virtual int write (char const *s, unsigned long count, bool blocking=true) const =0
 Transmit a number of characters.
 
virtual void irq_ack ()
 Acknowledge a received interrupt.
 
virtual bool enable_rx_irq (bool=true)
 Enable the receive IRQ.
 
Transfer_mode mode () const
 Return the transfer mode.
 
Baud_rate rate () const
 Return the baud rate.
 

Protected Member Functions

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

Uart driver abstraction.

Definition at line 25 of file uart_base.h.

Member Function Documentation

◆ change_mode()

virtual bool L4::Uart::change_mode ( Transfer_mode  m,
Baud_rate  r 
)
pure virtual

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.

◆ char_avail()

virtual int L4::Uart::char_avail ( ) const
pure virtual

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.

◆ enable_rx_irq()

virtual bool L4::Uart::enable_rx_irq ( bool  = true)
inlinevirtual

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.

Definition at line 116 of file uart_base.h.

◆ generic_write()

template<typename Uart_driver >
int L4::Uart::generic_write ( char const *  s,
unsigned long  count,
bool  blocking = true 
) const
inlineprotected

Internal function transmitting each character one-after-another and finally waiting that the transmission did actually finish.

Parameters
sBuffer containing the characters.
countThe number 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 successful written characters.

Definition at line 145 of file uart_base.h.

References L4::Poll_timeout_counter::test().

+ Here is the call graph for this function:

◆ get_char()

virtual int L4::Uart::get_char ( bool  blocking = true) const
pure virtual

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.

◆ mode()

Transfer_mode L4::Uart::mode ( ) const
inline

Return the transfer mode.

Returns
The transfer mode.

Definition at line 123 of file uart_base.h.

◆ rate()

Baud_rate L4::Uart::rate ( ) const
inline

Return the baud rate.

Returns
The baud rate.

Definition at line 130 of file uart_base.h.

◆ shutdown()

virtual void L4::Uart::shutdown ( )
pure virtual

Terminate the UART driver.

This includes disabling of interrupts.

◆ startup()

virtual bool L4::Uart::startup ( Io_register_block const *  regs)
pure virtual

Start the UART driver.

Parameters
regsIO register block of the UART.
Return values
trueStartup succeeded.
falseStartup failed.

◆ write()

virtual int L4::Uart::write ( char const *  s,
unsigned long  count,
bool  blocking = true 
) const
pure virtual

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.

The documentation for this class was generated from the following file: