[4f1173bc] | 1 | /** |
---|
| 2 | * @file |
---|
| 3 | * |
---|
| 4 | */ |
---|
| 5 | |
---|
[0737710] | 6 | /* |
---|
| 7 | * COPYRIGHT (c) 1998 by Radstone Technology |
---|
| 8 | * |
---|
[4f1173bc] | 9 | * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY |
---|
| 10 | * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 11 | * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK |
---|
| 12 | * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. |
---|
[0737710] | 13 | * |
---|
[4f1173bc] | 14 | * You are hereby granted permission to use, copy, modify, and distribute |
---|
| 15 | * this file, provided that this notice, plus the above copyright notice |
---|
| 16 | * and disclaimer, appears in all copies. Radstone Technology will provide |
---|
| 17 | * no support for this code. |
---|
[0737710] | 18 | * |
---|
[4f1173bc] | 19 | * COPYRIGHT (c) 1989-2012. |
---|
| 20 | * On-Line Applications Research Corporation (OAR). |
---|
[0737710] | 21 | * |
---|
[4f1173bc] | 22 | * The license and distribution terms for this file may be |
---|
| 23 | * found in the file LICENSE in this distribution or at |
---|
[c499856] | 24 | * http://www.rtems.org/license/LICENSE. |
---|
[0737710] | 25 | */ |
---|
| 26 | |
---|
| 27 | #ifndef _NS16550_H_ |
---|
| 28 | #define _NS16550_H_ |
---|
| 29 | |
---|
[6ec438e] | 30 | #include <rtems/termiostypes.h> |
---|
[5455f23a] | 31 | #include <libchip/serial.h> |
---|
| 32 | |
---|
[0737710] | 33 | #ifdef __cplusplus |
---|
| 34 | extern "C" { |
---|
| 35 | #endif |
---|
| 36 | |
---|
| 37 | /* |
---|
| 38 | * Driver function table |
---|
| 39 | */ |
---|
[4cd4c5a] | 40 | |
---|
[c8bd3cd] | 41 | extern const console_fns ns16550_fns; |
---|
| 42 | extern const console_fns ns16550_fns_polled; |
---|
[0737710] | 43 | |
---|
| 44 | /* |
---|
| 45 | * Flow control function tables |
---|
| 46 | */ |
---|
[4cd4c5a] | 47 | |
---|
[c8bd3cd] | 48 | extern const console_flow ns16550_flow_RTSCTS; |
---|
| 49 | extern const console_flow ns16550_flow_DTRCTS; |
---|
[0737710] | 50 | |
---|
[4f1173bc] | 51 | /* |
---|
| 52 | * Helpers for printk |
---|
| 53 | */ |
---|
| 54 | void ns16550_outch_polled(console_tbl *c, char out); |
---|
| 55 | int ns16550_inch_polled(console_tbl *c); |
---|
| 56 | |
---|
[6ec438e] | 57 | /* Alternative NS16550 driver using the Termios device context */ |
---|
| 58 | |
---|
| 59 | typedef uint8_t (*ns16550_get_reg)(uintptr_t port, uint8_t reg); |
---|
| 60 | |
---|
| 61 | typedef void (*ns16550_set_reg)(uintptr_t port, uint8_t reg, uint8_t value); |
---|
| 62 | |
---|
| 63 | typedef struct { |
---|
| 64 | rtems_termios_device_context base; |
---|
| 65 | ns16550_get_reg get_reg; |
---|
| 66 | ns16550_set_reg set_reg; |
---|
| 67 | uintptr_t port; |
---|
| 68 | rtems_vector_number irq; |
---|
| 69 | uint32_t clock; |
---|
| 70 | uint32_t initial_baud; |
---|
| 71 | bool has_fractional_divider_register; |
---|
| 72 | uint8_t modem_control; |
---|
[2fd3e65f] | 73 | size_t out_total; |
---|
| 74 | size_t out_remaining; |
---|
| 75 | size_t out_current; |
---|
| 76 | const char *out_buf; |
---|
[8a9bdc5] | 77 | rtems_termios_tty *tty; |
---|
[6ec438e] | 78 | } ns16550_context; |
---|
| 79 | |
---|
| 80 | extern const rtems_termios_device_handler ns16550_handler_interrupt; |
---|
| 81 | extern const rtems_termios_device_handler ns16550_handler_polled; |
---|
[8a9bdc5] | 82 | extern const rtems_termios_device_handler ns16550_handler_task; |
---|
[6ec438e] | 83 | |
---|
| 84 | extern const rtems_termios_device_flow ns16550_flow_rtscts; |
---|
| 85 | extern const rtems_termios_device_flow ns16550_flow_dtrcts; |
---|
| 86 | |
---|
| 87 | void ns16550_polled_putchar(rtems_termios_device_context *base, char out); |
---|
| 88 | |
---|
| 89 | int ns16550_polled_getchar(rtems_termios_device_context *base); |
---|
| 90 | |
---|
| 91 | bool ns16550_probe(rtems_termios_device_context *base); |
---|
| 92 | |
---|
[0737710] | 93 | #ifdef __cplusplus |
---|
| 94 | } |
---|
| 95 | #endif |
---|
| 96 | |
---|
| 97 | #endif /* _NS16550_H_ */ |
---|