L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
uart_apb.h
1/*
2 * Copyright (C) 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
8#pragma once
9
10#include "uart_base.h"
11
12namespace L4
13{
18 class Uart_apb : public Uart
19 {
20 public:
22 Uart_apb(unsigned freq) : _freq(freq) {}
23 bool startup(Io_register_block const *) override;
24 void shutdown() override;
25 bool change_mode(Transfer_mode m, Baud_rate r) override;
26 bool enable_rx_irq(bool enable) override;
27 int get_char(bool blocking = true) const override;
28 int char_avail() const override;
29 int tx_avail() const;
30 void wait_tx_done() const;
31 inline void out_char(char c) const;
32 int write(char const *s, unsigned long count,
33 bool blocking = true) const override;
34
35 private:
36 void set_rate(Baud_rate r);
37 unsigned _freq;
38 };
39};
Driver for the Advanced Peripheral Bus (APB) UART from the Cortex-M System Design Kit (apb).
Definition uart_apb.h:19
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:22
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.
Uart driver abstraction.
Definition uart_base.h:26
L4 low-level kernel interface.
Definition io_regblock.h:19