File indexing completed on 2025-05-11 08:23:43
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 #ifndef _NS16550_H_
0028 #define _NS16550_H_
0029
0030 #include <rtems/termiostypes.h>
0031 #include <libchip/serial.h>
0032
0033 #ifdef __cplusplus
0034 extern "C" {
0035 #endif
0036
0037
0038
0039
0040
0041 extern const console_fns ns16550_fns;
0042 extern const console_fns ns16550_fns_polled;
0043
0044
0045
0046
0047
0048 extern const console_flow ns16550_flow_RTSCTS;
0049 extern const console_flow ns16550_flow_DTRCTS;
0050
0051
0052
0053
0054 void ns16550_outch_polled(console_tbl *c, char out);
0055 int ns16550_inch_polled(console_tbl *c);
0056
0057
0058
0059 typedef uint8_t (*ns16550_get_reg)(uintptr_t port, uint8_t reg);
0060
0061 typedef void (*ns16550_set_reg)(uintptr_t port, uint8_t reg, uint8_t value);
0062
0063 typedef struct ns16550_context ns16550_context;
0064
0065 typedef uint32_t (*ns16550_calculate_baud_divisor)(ns16550_context *ctx, uint32_t baud);
0066
0067 struct ns16550_context{
0068 rtems_termios_device_context base;
0069 ns16550_get_reg get_reg;
0070 ns16550_set_reg set_reg;
0071 uintptr_t port;
0072 rtems_vector_number irq;
0073 uint32_t clock;
0074 uint32_t initial_baud;
0075 bool has_fractional_divider_register;
0076 bool has_precision_clock_synthesizer;
0077 uint8_t modem_control;
0078 uint8_t line_control;
0079 uint32_t baud_divisor;
0080 size_t out_total;
0081 size_t out_remaining;
0082 size_t out_current;
0083 const char *out_buf;
0084 rtems_termios_tty *tty;
0085 ns16550_calculate_baud_divisor calculate_baud_divisor;
0086 };
0087
0088 extern const rtems_termios_device_handler ns16550_handler_interrupt;
0089 extern const rtems_termios_device_handler ns16550_handler_polled;
0090 extern const rtems_termios_device_handler ns16550_handler_task;
0091
0092 extern const rtems_termios_device_flow ns16550_flow_rtscts;
0093 extern const rtems_termios_device_flow ns16550_flow_dtrcts;
0094
0095 void ns16550_polled_putchar(rtems_termios_device_context *base, char out);
0096
0097 int ns16550_polled_getchar(rtems_termios_device_context *base);
0098
0099 bool ns16550_probe(rtems_termios_device_context *base);
0100
0101 #ifdef __cplusplus
0102 }
0103 #endif
0104
0105 #endif