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{
17 class Uart_apb : public Uart
18 {
19 public:
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 bool enable_rx_irq(bool enable) override;
26 int get_char(bool blocking = true) const override;
27 int char_avail() const override;
28 int tx_avail() const;
29 void wait_tx_done() const;
30 inline void out_char(char c) const;
31 int write(char const *s, unsigned long count,
32 bool blocking = true) const override;
33
34 private:
35 void set_rate(Baud_rate r);
36 unsigned _freq;
37 };
38};
Driver for the Advanced Peripheral Bus (APB) UART from the Cortex-M System Design Kit (CMSDK).
Definition uart_apb.h:18
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.
Uart driver abstraction.
Definition uart_base.h:21
L4 low-level kernel interface.