1 #ifndef HAYESESP_H
2 #define HAYESESP_H
3 
4 struct hayes_esp_config {
5 	short flow_on;
6 	short flow_off;
7 	short rx_trigger;
8 	short tx_trigger;
9 	short pio_threshold;
10 	unsigned char rx_timeout;
11 	char dma_channel;
12 };
13 
14 #ifdef __KERNEL__
15 
16 #define ESP_DMA_CHANNEL   0
17 #define ESP_RX_TRIGGER    768
18 #define ESP_TX_TRIGGER    768
19 #define ESP_FLOW_OFF      1016
20 #define ESP_FLOW_ON       944
21 #define ESP_RX_TMOUT      128
22 #define ESP_PIO_THRESHOLD 32
23 
24 #define ESP_IN_MAJOR	57	/* major dev # for dial in */
25 #define ESP_OUT_MAJOR	58	/* major dev # for dial out */
26 #define ESPC_SCALE 	3
27 #define UART_ESI_BASE	0x00
28 #define UART_ESI_SID	0x01
29 #define UART_ESI_RX	0x02
30 #define UART_ESI_TX	0x02
31 #define UART_ESI_CMD1	0x04
32 #define UART_ESI_CMD2	0x05
33 #define UART_ESI_STAT1	0x04
34 #define UART_ESI_STAT2	0x05
35 #define UART_ESI_RWS	0x07
36 
37 #define UART_IER_DMA_TMOUT	0x80
38 #define UART_IER_DMA_TC		0x08
39 
40 #define ESI_SET_IRQ		0x04
41 #define ESI_SET_DMA_TMOUT	0x05
42 #define ESI_SET_SRV_MASK	0x06
43 #define ESI_SET_ERR_MASK	0x07
44 #define ESI_SET_FLOW_CNTL	0x08
45 #define ESI_SET_FLOW_CHARS	0x09
46 #define ESI_SET_FLOW_LVL	0x0a
47 #define ESI_SET_TRIGGER		0x0b
48 #define ESI_SET_RX_TIMEOUT	0x0c
49 #define ESI_SET_FLOW_TMOUT	0x0d
50 #define ESI_WRITE_UART		0x0e
51 #define ESI_READ_UART		0x0f
52 #define ESI_SET_MODE		0x10
53 #define ESI_GET_ERR_STAT	0x12
54 #define ESI_GET_UART_STAT	0x13
55 #define ESI_GET_RX_AVAIL	0x14
56 #define ESI_GET_TX_AVAIL	0x15
57 #define ESI_START_DMA_RX	0x16
58 #define ESI_START_DMA_TX	0x17
59 #define ESI_ISSUE_BREAK		0x1a
60 #define ESI_FLUSH_RX		0x1b
61 #define ESI_FLUSH_TX		0x1c
62 #define ESI_SET_BAUD		0x1d
63 #define ESI_SET_ENH_IRQ		0x1f
64 #define ESI_SET_REINTR		0x20
65 #define ESI_SET_PRESCALAR	0x23
66 #define ESI_NO_COMMAND		0xff
67 
68 #define ESP_STAT_RX_TIMEOUT	0x01
69 #define ESP_STAT_DMA_RX		0x02
70 #define ESP_STAT_DMA_TX		0x04
71 #define ESP_STAT_NEVER_DMA      0x08
72 #define ESP_STAT_USE_PIO        0x10
73 
74 #define ESP_EVENT_WRITE_WAKEUP	0
75 #define ESP_MAGIC		0x53ee
76 #define ESP_XMIT_SIZE		4096
77 
78 struct esp_struct {
79 	int			magic;
80 	int			port;
81 	int			irq;
82 	int			flags; 		/* defined in tty.h */
83 	struct tty_struct 	*tty;
84 	int			read_status_mask;
85 	int			ignore_status_mask;
86 	int			timeout;
87 	int			stat_flags;
88 	int			custom_divisor;
89 	int			close_delay;
90 	unsigned short		closing_wait;
91 	unsigned short		closing_wait2;
92 	int			IER; 	/* Interrupt Enable Register */
93 	int			MCR; 	/* Modem control register */
94 	unsigned long		event;
95 	unsigned long		last_active;
96 	int			line;
97 	int			count;	    /* # of fd on device */
98 	int			blocked_open; /* # of blocked opens */
99 	long			session; /* Session of opening process */
100 	long			pgrp; /* pgrp of opening process */
101 	unsigned char 		*xmit_buf;
102 	int			xmit_head;
103 	int			xmit_tail;
104 	int			xmit_cnt;
105 	struct tq_struct	tqueue;
106 	struct tq_struct	tqueue_hangup;
107 	struct termios		normal_termios;
108 	struct termios		callout_termios;
109 	wait_queue_head_t	open_wait;
110 	wait_queue_head_t	close_wait;
111 	wait_queue_head_t	delta_msr_wait;
112 	wait_queue_head_t	break_wait;
113 	struct async_icount	icount;	/* kernel counters for the 4 input interrupts */
114 	struct hayes_esp_config config; /* port configuration */
115 	struct esp_struct	*next_port; /* For the linked list */
116 };
117 
118 struct esp_pio_buffer {
119 	unsigned char data[1024];
120 	struct esp_pio_buffer *next;
121 };
122 
123 #endif /* __KERNEL__ */
124 
125 
126 #endif /* ESP_H */
127 
128