RTEMS 7.0-rc1
Loading...
Searching...
No Matches
ns16550.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-2.0+-with-RTEMS-exception */
2
8/*
9 * COPYRIGHT (c) 1998 by Radstone Technology
10 *
11 * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY
12 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
13 * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK
14 * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU.
15 *
16 * You are hereby granted permission to use, copy, modify, and distribute
17 * this file, provided that this notice, plus the above copyright notice
18 * and disclaimer, appears in all copies. Radstone Technology will provide
19 * no support for this code.
20 *
21 * COPYRIGHT (c) 1989-2012.
22 * On-Line Applications Research Corporation (OAR).
23 *
24 * The license and distribution terms for this file may be
25 * found in the file LICENSE in this distribution or at
26 * http://www.rtems.org/license/LICENSE.
27 */
28
29#ifndef _NS16550_H_
30#define _NS16550_H_
31
32#include <rtems/termiostypes.h>
33#include <libchip/serial.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39/*
40 * Driver function table
41 */
42
43extern const console_fns ns16550_fns;
44extern const console_fns ns16550_fns_polled;
45
46/*
47 * Flow control function tables
48 */
49
50extern const console_flow ns16550_flow_RTSCTS;
51extern const console_flow ns16550_flow_DTRCTS;
52
53/*
54 * Helpers for printk
55 */
56void ns16550_outch_polled(console_tbl *c, char out);
57int ns16550_inch_polled(console_tbl *c);
58
59/* Alternative NS16550 driver using the Termios device context */
60
61typedef uint8_t (*ns16550_get_reg)(uintptr_t port, uint8_t reg);
62
63typedef void (*ns16550_set_reg)(uintptr_t port, uint8_t reg, uint8_t value);
64
65typedef struct ns16550_context ns16550_context;
66
67typedef uint32_t (*ns16550_calculate_baud_divisor)(ns16550_context *ctx, uint32_t baud);
68
71 ns16550_get_reg get_reg;
72 ns16550_set_reg set_reg;
73 uintptr_t port;
75 uint32_t clock;
76 uint32_t initial_baud;
77 bool has_fractional_divider_register;
78 bool has_precision_clock_synthesizer;
79 uint8_t modem_control;
80 uint8_t line_control;
81 uint32_t baud_divisor;
82 size_t out_total;
83 size_t out_remaining;
84 size_t out_current;
85 const char *out_buf;
87 ns16550_calculate_baud_divisor calculate_baud_divisor;
88};
89
90extern const rtems_termios_device_handler ns16550_handler_interrupt;
91extern const rtems_termios_device_handler ns16550_handler_polled;
92extern const rtems_termios_device_handler ns16550_handler_task;
93
94extern const rtems_termios_device_flow ns16550_flow_rtscts;
95extern const rtems_termios_device_flow ns16550_flow_dtrcts;
96
98
99int ns16550_polled_getchar(rtems_termios_device_context *base);
100
101bool ns16550_probe(rtems_termios_device_context *base);
102
103#ifdef __cplusplus
104}
105#endif
106
107#endif /* _NS16550_H_ */
ISR_Vector_number rtems_vector_number
This integer type represents interrupt vector numbers.
Definition: intr.h:102
void ns16550_outch_polled(console_tbl *c, char out)
Polled write for NS16550.
Definition: ns16550.c:374
void ns16550_polled_putchar(rtems_termios_device_context *base, char out)
Polled write for NS16550.
Definition: ns16550-context.c:533
The generic libchip serial driver interface.
Definition: serial.h:113
Definition: serial.h:95
Definition: serial.h:136
Definition: ns16550.h:69
Termios device context.
Definition: termiosdevice.h:68
Termios device flow control handler.
Definition: termiosdevice.h:207
Termios device handler.
Definition: termiosdevice.h:100
Definition: termiostypes.h:94