File indexing completed on 2025-05-11 08:22:49
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 #ifndef _BSPUART_H
0024 #define _BSPUART_H
0025
0026 #include <rtems/bspIo.h>
0027
0028 void BSP_uart_init(int uart, int baud, int hwFlow);
0029 void BSP_uart_set_baud(int aurt, int baud);
0030 void BSP_uart_intr_ctrl(int uart, int cmd);
0031 void BSP_uart_throttle(int uart);
0032 void BSP_uart_unthrottle(int uart);
0033 int BSP_uart_polled_status(int uart);
0034 void BSP_uart_polled_write(int uart, int val);
0035 int BSP_uart_polled_read(int uart);
0036 void BSP_uart_termios_set(int uart, void *ttyp);
0037 int BSP_uart_termios_write_com1(int minor, const char *buf, int len);
0038 int BSP_uart_termios_write_com2(int minor, const char *buf, int len);
0039 void BSP_uart_termios_isr_com1(void);
0040 void BSP_uart_termios_isr_com2(void);
0041 void BSP_uart_dbgisr_com1(void);
0042 void BSP_uart_dbgisr_com2(void);
0043 extern unsigned BSP_poll_char_via_serial(void);
0044 extern void BSP_output_char_via_serial(int val);
0045 extern int BSPConsolePort;
0046 extern int BSPBaseBaud;
0047
0048
0049
0050
0051
0052 #define BSP_UART_INTR_CTRL_DISABLE (0)
0053 #define BSP_UART_INTR_CTRL_GDB (0xaa)
0054 #define BSP_UART_INTR_CTRL_ENABLE (0xbb)
0055 #define BSP_UART_INTR_CTRL_TERMIOS (0xcc)
0056
0057
0058 #define BSP_UART_STATUS_ERROR (-1)
0059 #define BSP_UART_STATUS_NOCHAR (0)
0060 #define BSP_UART_STATUS_CHAR (1)
0061 #define BSP_UART_STATUS_BREAK (2)
0062
0063
0064 #define BSP_UART_COM1 (0)
0065 #define BSP_UART_COM2 (1)
0066
0067
0068
0069
0070
0071 #define COM1_BASE_IO 0x3F8
0072 #define COM2_BASE_IO 0x2F8
0073
0074
0075
0076
0077
0078
0079 #define RBR RSRBR
0080 #define THR RSTHR
0081 #define IER RSIER
0082
0083
0084 #define IIR RSIIR
0085 #define FCR RSFCR
0086 #define LCR RSLCR
0087 #define LSR RSLSR
0088
0089
0090 #define DLL RSDLL
0091 #define DLM RSDLH
0092
0093
0094 #define CNT RSCNT
0095
0096
0097
0098
0099 #define UART_ENABLE 1
0100 #define PAD_ENABLE 2
0101
0102
0103
0104
0105 #define NO_MORE_INTR 1
0106 #define TRANSMITTER_HODING_REGISTER_EMPTY 2
0107 #define RECEIVER_DATA_AVAIL 4
0108 #define RECEIVER_ERROR 6
0109 #define CHARACTER_TIMEOUT_INDICATION 12
0110
0111
0112
0113
0114 #define RECEIVE_ENABLE 0x1
0115 #define TRANSMIT_ENABLE 0x2
0116 #define RECEIVER_LINE_ST_ENABLE 0x4
0117 #define INTERRUPT_DISABLE 0x0
0118
0119
0120
0121
0122 #define DR 0x01
0123 #define OE 0x02
0124 #define PE 0x04
0125 #define FE 0x08
0126 #define BI 0x10
0127 #define THRE 0x20
0128 #define TEMT 0x40
0129 #define ERFIFO 0x80
0130
0131
0132
0133
0134 #define CHR_5_BITS 0
0135 #define CHR_6_BITS 1
0136 #define CHR_7_BITS 2
0137 #define CHR_8_BITS 3
0138
0139 #define WL 0x03
0140 #define STB 0x04
0141 #define PEN 0x08
0142 #define EPS 0x10
0143 #define SP 0x20
0144 #define BCB 0x40
0145 #define DLAB 0x80
0146
0147
0148
0149
0150
0151 #define FIFO_CTRL 0x01
0152 #define FIFO_EN 0x01
0153 #define XMIT_RESET 0x04
0154 #define RCV_RESET 0x02
0155 #define FCR3 0x08
0156
0157 #define RECEIVE_FIFO_TRIGGER1 0x0
0158 #define RECEIVE_FIFO_TRIGGER4 0x40
0159 #define RECEIVE_FIFO_TRIGGER8 0x80
0160 #define RECEIVE_FIFO_TRIGGER12 0xc0
0161 #define TRIG_LEVEL 0xc0
0162
0163 #endif