L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
uart_imx.h
1/* SPDX-License-Identifier: GPL-2.0-only OR License-Ref-kk-custom */
2/*
3 * Copyright (C) 2023 Kernkonzept GmbH.
4 */
5/*
6 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>
7 * economic rights: Technische Universität Dresden (Germany)
8 *
9 * This file is part of TUD:OS and distributed under the terms of the
10 * GNU General Public License 2.
11 * Please see the COPYING-GPL-2 file for details.
12 */
13#pragma once
14
15#include "uart_base.h"
16
17namespace L4
18{
19 class Uart_imx : public Uart
20 {
21 public:
22 enum platform_type
23 {
24 Type_imx21,
25 Type_imx35,
26 Type_imx51,
27 Type_imx6,
28 Type_imx7,
29 Type_imx8,
30 };
31 explicit Uart_imx(enum platform_type type) : _type(type) {}
32 explicit Uart_imx(enum platform_type type, unsigned /*base_rate*/)
33 : _type(type) {}
34 bool startup(Io_register_block const *) override;
35 void shutdown() override;
36 bool enable_rx_irq(bool enable = true) override;
37 bool change_mode(Transfer_mode m, Baud_rate r) override;
38 int get_char(bool blocking = true) const override;
39 int char_avail() const override;
40 int tx_avail() const;
41 void wait_tx_done() const;
42 inline void out_char(char c) const;
43 int write(char const *s, unsigned long count,
44 bool blocking = true) const override;
45
46 private:
47 enum platform_type _type;
48 };
49
50 class Uart_imx21 : public Uart_imx
51 {
52 public:
53 Uart_imx21() : Uart_imx(Type_imx21) {}
54 explicit Uart_imx21(unsigned base_rate) : Uart_imx(Type_imx21, base_rate) {}
55 };
56
57 class Uart_imx35 : public Uart_imx
58 {
59 public:
60 Uart_imx35() : Uart_imx(Type_imx35) {}
61 explicit Uart_imx35(unsigned base_rate) : Uart_imx(Type_imx35, base_rate) {}
62 };
63
64 class Uart_imx51 : public Uart_imx
65 {
66 public:
67 Uart_imx51() : Uart_imx(Type_imx51) {}
68 explicit Uart_imx51(unsigned base_rate) : Uart_imx(Type_imx51, base_rate) {}
69 };
70
71 class Uart_imx6 : public Uart_imx
72 {
73 public:
74 Uart_imx6() : Uart_imx(Type_imx6) {}
75 explicit Uart_imx6(unsigned base_rate) : Uart_imx(Type_imx6, base_rate) {}
76
77 void irq_ack() override;
78 };
79
80 class Uart_imx7 : public Uart_imx
81 {
82 public:
83 Uart_imx7() : Uart_imx(Type_imx7) {}
84 explicit Uart_imx7(unsigned base_rate) : Uart_imx(Type_imx7, base_rate) {}
85 };
86
87 class Uart_imx8 : public Uart_imx
88 {
89 public:
90 Uart_imx8() : Uart_imx(Type_imx8) {}
91 explicit Uart_imx8(unsigned base_rate) : Uart_imx(Type_imx8, base_rate) {}
92 };
93};
L4 low-level kernel interface.
Definition io_regblock.h:19