L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
uart_imx.h
1/*
2 * Copyright (C) 2008-2009 Technische Universität Dresden.
3 * Copyright (C) 2023-2024 Kernkonzept GmbH.
4 * Author(s): Adam Lackorzynski <adam@os.inf.tu-dresden.de>
5 *
6 * License: see LICENSE.spdx (in this directory or the directories above)
7 */
8#pragma once
9
10#include "uart_base.h"
11
12namespace L4 {
13
14class Uart_imx : public Uart
15{
16public:
17 enum platform_type
18 {
19 Type_imx21,
20 Type_imx35,
21 Type_imx51,
22 Type_imx6,
23 Type_imx7,
24 Type_imx8,
25 };
26 explicit Uart_imx(enum platform_type type) : _type(type) {}
27 explicit Uart_imx(enum platform_type type, unsigned /*base_rate*/)
28 : _type(type) {}
29 bool startup(Io_register_block const *) override;
30 void shutdown() override;
31 bool change_mode(Transfer_mode m, Baud_rate r) override;
32 int tx_avail() const;
33 void wait_tx_done() const;
34 inline void out_char(char c) const;
35 int write(char const *s, unsigned long count,
36 bool blocking = true) const override;
37
38#ifndef UART_WITHOUT_INPUT
39 bool enable_rx_irq(bool enable = true) override;
40 int char_avail() const override;
41 int get_char(bool blocking = true) const override;
42#endif
43
44private:
45 enum platform_type _type;
46};
47
48class Uart_imx21 : public Uart_imx
49{
50public:
51 Uart_imx21() : Uart_imx(Type_imx21) {}
52 explicit Uart_imx21(unsigned base_rate) : Uart_imx(Type_imx21, base_rate) {}
53};
54
55class Uart_imx35 : public Uart_imx
56{
57public:
58 Uart_imx35() : Uart_imx(Type_imx35) {}
59 explicit Uart_imx35(unsigned base_rate) : Uart_imx(Type_imx35, base_rate) {}
60};
61
62class Uart_imx51 : public Uart_imx
63{
64public:
65 Uart_imx51() : Uart_imx(Type_imx51) {}
66 explicit Uart_imx51(unsigned base_rate) : Uart_imx(Type_imx51, base_rate) {}
67};
68
69class Uart_imx6 : public Uart_imx
70{
71public:
72 Uart_imx6() : Uart_imx(Type_imx6) {}
73 explicit Uart_imx6(unsigned base_rate) : Uart_imx(Type_imx6, base_rate) {}
74
75#ifndef UART_WITHOUT_INPUT
76 void irq_ack() override;
77#endif
78};
79
80class Uart_imx7 : public Uart_imx
81{
82public:
83 Uart_imx7() : Uart_imx(Type_imx7) {}
84 explicit Uart_imx7(unsigned base_rate) : Uart_imx(Type_imx7, base_rate) {}
85};
86
87class Uart_imx8 : public Uart_imx
88{
89public:
90 Uart_imx8() : Uart_imx(Type_imx8) {}
91 explicit Uart_imx8(unsigned base_rate) : Uart_imx(Type_imx8, base_rate) {}
92};
93
94} // namespace L4
Uart driver abstraction.
Definition uart_base.h:21
virtual void irq_ack()
Acknowledge a received interrupt.
Definition uart_base.h:109
virtual void shutdown()=0
Terminate the UART driver.
virtual int char_avail() const =0
Check if there is at least one character available for reading from the UART.
L4 low-level kernel interface.