2 * serial.h: Arch-dep definitions for the Etrax100 serial driver.
4 * Copyright (C) 1998, 1999, 2000 Axis Communications AB
7 #ifndef _ETRAX_SERIAL_H
8 #define _ETRAX_SERIAL_H
10 #include <linux/config.h>
11 #include <linux/circ_buf.h>
12 #include <asm/termios.h>
14 /* Software state per channel */
18 * This is our internal structure for each serial port's state.
20 * Many fields are paralleled by the structure used by the serial_struct
23 * For definitions of the flags field, see tty.h
26 #define SERIAL_RECV_DESCRIPTORS 8
28 struct etrax_recv_buffer
{
29 struct etrax_recv_buffer
*next
;
30 unsigned short length
;
34 unsigned char buffer
[0];
39 volatile u8
*port
; /* R_SERIALx_CTRL */
40 u32 irq
; /* bitnr in R_IRQ_MASK2 for dmaX_descr */
42 /* Output registers */
43 volatile u8
*oclrintradr
; /* adr to R_DMA_CHx_CLR_INTR */
44 volatile u32
*ofirstadr
; /* adr to R_DMA_CHx_FIRST */
45 volatile u8
*ocmdadr
; /* adr to R_DMA_CHx_CMD */
46 const volatile u8
*ostatusadr
; /* adr to R_DMA_CHx_STATUS */
49 volatile u8
*iclrintradr
; /* adr to R_DMA_CHx_CLR_INTR */
50 volatile u32
*ifirstadr
; /* adr to R_DMA_CHx_FIRST */
51 volatile u8
*icmdadr
; /* adr to R_DMA_CHx_CMD */
52 volatile u32
*idescradr
; /* adr to R_DMA_CHx_DESCR */
54 int flags
; /* defined in tty.h */
56 u8 rx_ctrl
; /* shadow for R_SERIALx_REC_CTRL */
57 u8 tx_ctrl
; /* shadow for R_SERIALx_TR_CTRL */
58 u8 iseteop
; /* bit number for R_SET_EOP for the input dma */
59 int enabled
; /* Set to 1 if the port is enabled in HW config */
61 u8 dma_out_enabled
:1; /* Set to 1 if DMA should be used */
62 u8 dma_in_enabled
:1; /* Set to 1 if DMA should be used */
64 /* end of fields defined in rs_table[] in .c-file */
65 u8 uses_dma_in
; /* Set to 1 if DMA is used */
66 u8 uses_dma_out
; /* Set to 1 if DMA is used */
67 u8 forced_eop
; /* a fifo eop has been forced */
68 int baud_base
; /* For special baudrates */
69 int custom_divisor
; /* For special baudrates */
70 struct etrax_dma_descr tr_descr
;
71 struct etrax_dma_descr rec_descr
[SERIAL_RECV_DESCRIPTORS
];
74 volatile int tr_running
; /* 1 if output is running */
76 struct tty_struct
*tty
;
78 int ignore_status_mask
;
79 int x_char
; /* xon/xoff character */
81 unsigned short closing_wait
;
82 unsigned short closing_wait2
;
84 unsigned long last_active
;
86 int type
; /* PORT_ETRAX */
87 int count
; /* # of fd on device */
88 int blocked_open
; /* # of blocked opens */
90 struct etrax_recv_buffer
*first_recv_buffer
;
91 struct etrax_recv_buffer
*last_recv_buffer
;
92 unsigned int recv_cnt
;
93 unsigned int max_recv_cnt
;
95 struct work_struct work
;
96 struct async_icount icount
; /* error-statistics etc.*/
97 struct termios normal_termios
;
98 struct termios callout_termios
;
99 #ifdef DECLARE_WAITQUEUE
100 wait_queue_head_t open_wait
;
101 wait_queue_head_t close_wait
;
103 struct wait_queue
*open_wait
;
104 struct wait_queue
*close_wait
;
107 unsigned long char_time_usec
; /* The time for 1 char, in usecs */
108 unsigned long flush_time_usec
; /* How often we should flush */
109 unsigned long last_tx_active_usec
; /* Last tx usec in the jiffies */
110 unsigned long last_tx_active
; /* Last tx time in jiffies */
111 unsigned long last_rx_active_usec
; /* Last rx usec in the jiffies */
112 unsigned long last_rx_active
; /* Last rx time in jiffies */
114 int break_detected_cnt
;
117 #ifdef CONFIG_ETRAX_RS485
118 struct rs485_control rs485
; /* RS-485 support */
122 /* this PORT is not in the standard serial.h. it's not actually used for
123 * anything since we only have one type of async serial-port anyway in this
130 * Events are used to schedule things to happen at timer-interrupt
131 * time, instead of at rs interrupt time.
133 #define RS_EVENT_WRITE_WAKEUP 0
135 #endif /* __KERNEL__ */
137 #endif /* !_ETRAX_SERIAL_H */