L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
uart_apb.h
1/*
2 * Copyright (C) 2017, 2019, 2023-2024 Kernkonzept GmbH.
3 * Author(s): Georg Kotheimer <georg.kotheimer@kernkonzept.com>
4 *
5 * License: see LICENSE.spdx (in this directory or the directories above)
6 */
7#pragma once
8
9#include "uart_base.h"
10
11namespace L4 {
12
17class Uart_apb : public Uart
18{
19public:
21 Uart_apb(unsigned freq) : _freq(freq) {}
22 bool startup(Io_register_block const *) override;
23 void shutdown() override;
24 bool change_mode(Transfer_mode m, Baud_rate r) override;
25 int tx_avail() const;
26 void wait_tx_done() const;
27 inline void out_char(char c) const;
28 int write(char const *s, unsigned long count,
29 bool blocking = true) const override;
30
31 bool enable_rx_irq(bool enable) override;
32 int char_avail() const override;
33 int get_char(bool blocking = true) const override;
34
35private:
36 void set_rate(Baud_rate r);
37 unsigned _freq;
38};
39
40} // namespace L4
bool enable_rx_irq(bool enable) override
Enable the receive IRQ.
bool startup(Io_register_block const *) override
Start the UART driver.
int get_char(bool blocking=true) const override
Read a character from the UART.
Uart_apb(unsigned freq)
freq == 0 means unknown and don't change baud rate
Definition uart_apb.h:21
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.
bool change_mode(Transfer_mode m, Baud_rate r) override
Set certain parameters of the UART.
void shutdown() override
Terminate the UART driver.
L4 low-level kernel interface.