Loading...
Searching...
No Matches
uart_apb.h
/*
* Copyright (C) 2017, 2019, 2023-2024 Kernkonzept GmbH.
* Author(s): Georg Kotheimer <georg.kotheimer@kernkonzept.com>
*
* License: see LICENSE.spdx (in this directory or the directories above)
*/
#pragma once
#include "uart_base.h"
namespace L4 {
class Uart_apb : public Uart
{
public:
Uart_apb(unsigned freq) : _freq(freq) {}
bool startup(Io_register_block const *) override;
void shutdown() override;
bool change_mode(Transfer_mode m, Baud_rate r) override;
int tx_avail() const;
void wait_tx_done() const;
inline void out_char(char c) const;
int write(char const *s, unsigned long count,
bool blocking = true) const override;
bool enable_rx_irq(bool enable) override;
int char_avail() const override;
int get_char(bool blocking = true) const override;
private:
void set_rate(Baud_rate r);
unsigned _freq;
};
} // namespace L4
L4::Uart_apb::enable_rx_irq
bool enable_rx_irq(bool enable) override
Enable the receive IRQ.
L4::Uart_apb::startup
bool startup(Io_register_block const *) override
Start the UART driver.
L4::Uart_apb::get_char
int get_char(bool blocking=true) const override
Read a character from the UART.
L4::Uart_apb::Uart_apb
Uart_apb(unsigned freq)
freq == 0 means unknown and don't change baud rate
Definition uart_apb.h:21
L4::Uart_apb::char_avail
int char_avail() const override
Check if there is at least one character available for reading from the UART.
L4::Uart_apb::write
int write(char const *s, unsigned long count, bool blocking=true) const override
Transmit a number of characters.
L4::Uart_apb::change_mode
bool change_mode(Transfer_mode m, Baud_rate r) override
Set certain parameters of the UART.
L4::Uart_apb::shutdown
void shutdown() override
Terminate the UART driver.
L4
L4 low-level kernel interface.
Definition l4sys-l4f-groups.dox:50