OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [linux/] [isicom.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
#ifndef _LINUX_ISICOM_H
2
#define _LINUX_ISICOM_H
3
 
4
/*#define               ISICOM_DEBUG*/
5
/*#define               ISICOM_DEBUG_DTR_RTS*/
6
 
7
 
8
/*
9
 *      Firmware Loader definitions ...
10
 */
11
 
12
#define         __MultiTech             ('M'<<8)
13
#define         MIOCTL_LOAD_FIRMWARE    (__MultiTech | 0x01)
14
#define         MIOCTL_READ_FIRMWARE    (__MultiTech | 0x02)
15
#define         MIOCTL_XFER_CTRL        (__MultiTech | 0x03)
16
#define         MIOCTL_RESET_CARD       (__MultiTech | 0x04)
17
 
18
#define         DATA_SIZE       16
19
 
20
typedef struct  {
21
                unsigned short  exec_segment;
22
                unsigned short  exec_addr;
23
}       exec_record;
24
 
25
typedef struct  {
26
                int             board;          /* Board to load */
27
                unsigned short  addr;
28
                unsigned short  count;
29
}       bin_header;
30
 
31
typedef struct  {
32
                int             board;          /* Board to load */
33
                unsigned short  addr;
34
                unsigned short  count;
35
                unsigned short  segment;
36
                unsigned char   bin_data[DATA_SIZE];
37
}       bin_frame;
38
 
39
#ifdef __KERNEL__
40
 
41
#define         YES     1
42
#define         NO      0
43
 
44
#define         ISILOAD_MISC_MINOR      155     /* /dev/isctl */
45
#define         ISILOAD_NAME            "ISILoad"
46
 
47
/*
48
 *  ISICOM Driver definitions ...
49
 *
50
 */
51
 
52
#define         ISICOM_NAME     "ISICom"
53
 
54
/*
55
 *      These are now officially allocated numbers
56
 */
57
 
58
#define         ISICOM_NMAJOR   112     /* normal  */
59
#define         ISICOM_CMAJOR   113     /* callout */
60
#define         ISICOM_MAGIC    (('M' << 8) | 'T')
61
 
62
#define         WAKEUP_CHARS    256     /* hard coded for now   */ 
63
#define         TX_SIZE         254 
64
 
65
#define         BOARD_COUNT     4
66
#define         PORT_COUNT      (BOARD_COUNT*16)
67
 
68
#define         SERIAL_TYPE_NORMAL      1
69
#define         SERIAL_TYPE_CALLOUT     2
70
 
71
/*   character sizes  */
72
 
73
#define         ISICOM_CS5              0x0000
74
#define         ISICOM_CS6              0x0001
75
#define         ISICOM_CS7              0x0002
76
#define         ISICOM_CS8              0x0003
77
 
78
/* stop bits */
79
 
80
#define         ISICOM_1SB              0x0000
81
#define         ISICOM_2SB              0x0004
82
 
83
/* parity */
84
 
85
#define         ISICOM_NOPAR            0x0000
86
#define         ISICOM_ODPAR            0x0008
87
#define         ISICOM_EVPAR            0x0018
88
 
89
/* flow control */
90
 
91
#define         ISICOM_CTSRTS           0x03
92
#define         ISICOM_INITIATE_XONXOFF 0x04
93
#define         ISICOM_RESPOND_XONXOFF  0x08
94
 
95
#define InterruptTheCard(base) (outw(0,(base)+0xc)) 
96
#define ClearInterrupt(base) (inw((base)+0x0a)) 
97
 
98
#define BOARD(line)  (((line) >> 4) & 0x3)
99
#define MIN(a, b) ( (a) < (b) ? (a) : (b) )
100
 
101
        /*      isi kill queue bitmap   */
102
 
103
#define         ISICOM_KILLTX           0x01
104
#define         ISICOM_KILLRX           0x02
105
 
106
        /* isi_board status bitmap */
107
 
108
#define         FIRMWARE_LOADED         0x0001
109
#define         BOARD_ACTIVE            0x0002
110
 
111
        /* isi_port status bitmap  */
112
 
113
#define         ISI_CTS                 0x1000
114
#define         ISI_DSR                 0x2000
115
#define         ISI_RI                  0x4000
116
#define         ISI_DCD                 0x8000
117
#define         ISI_DTR                 0x0100
118
#define         ISI_RTS                 0x0200
119
 
120
 
121
#define         ISI_TXOK                0x0001 
122
 
123
struct  isi_board {
124
        unsigned short          base;
125
        unsigned char           irq;
126
        unsigned char           port_count;
127
        unsigned short          status;
128
        unsigned short          port_status; /* each bit represents a single port */
129
        unsigned short          shift_count;
130
        struct isi_port         * ports;
131
        signed char             count;
132
};
133
 
134
struct  isi_port {
135
        unsigned short          magic;
136
        unsigned int            flags;
137
        int                     count;
138
        int                     blocked_open;
139
        int                     close_delay;
140
        unsigned short          channel;
141
        unsigned short          status;
142
        unsigned short          closing_wait;
143
        long                    session;
144
        long                    pgrp;
145
        struct isi_board        * card;
146
        struct tty_struct       * tty;
147
        struct wait_queue       * close_wait;
148
        struct wait_queue       * open_wait;
149
        struct tq_struct        hangup_tq;
150
        struct tq_struct        bh_tqueue;
151
        unsigned char           * xmit_buf;
152
        int                     xmit_head;
153
        int                     xmit_tail;
154
        int                     xmit_cnt;
155
        struct termios          normal_termios;
156
        struct termios          callout_termios;
157
};
158
 
159
 
160
/*
161
 *  ISI Card specific ops ...
162
 */
163
 
164
extern inline void raise_dtr(struct isi_port * port)
165
{
166
        struct isi_board * card = port->card;
167
        unsigned short base = card->base;
168
        unsigned char channel = port->channel;
169
        short wait=300;
170
        while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
171
        if (wait <= 0) {
172
                printk(KERN_WARNING "ISICOM: Card found busy in raise_dtr.\n");
173
                return;
174
        }
175
#ifdef ISICOM_DEBUG_DTR_RTS     
176
        printk(KERN_DEBUG "ISICOM: raise_dtr.\n");
177
#endif  
178
        outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
179
        outw(0x0504, base);
180
        InterruptTheCard(base);
181
        port->status |= ISI_DTR;
182
}
183
extern inline void drop_dtr(struct isi_port * port)
184
{
185
        struct isi_board * card = port->card;
186
        unsigned short base = card->base;
187
        unsigned char channel = port->channel;
188
        short wait=300;
189
        while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
190
        if (wait <= 0) {
191
                printk(KERN_WARNING "ISICOM: Card found busy in drop_dtr.\n");
192
                return;
193
        }
194
#ifdef ISICOM_DEBUG_DTR_RTS     
195
        printk(KERN_DEBUG "ISICOM: drop_dtr.\n");
196
#endif  
197
        outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
198
        outw(0x0404, base);
199
        InterruptTheCard(base);
200
        port->status &= ~ISI_DTR;
201
}
202
extern inline void raise_rts(struct isi_port * port)
203
{
204
        struct isi_board * card = port->card;
205
        unsigned short base = card->base;
206
        unsigned char channel = port->channel;
207
        short wait=300;
208
        while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
209
        if (wait <= 0) {
210
                printk(KERN_WARNING "ISICOM: Card found busy in raise_rts.\n");
211
                return;
212
        }
213
#ifdef ISICOM_DEBUG_DTR_RTS     
214
        printk(KERN_DEBUG "ISICOM: raise_rts.\n");
215
#endif  
216
        outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
217
        outw(0x0a04, base);
218
        InterruptTheCard(base);
219
        port->status |= ISI_RTS;
220
}
221
extern inline void drop_rts(struct isi_port * port)
222
{
223
        struct isi_board * card = port->card;
224
        unsigned short base = card->base;
225
        unsigned char channel = port->channel;
226
        short wait=300;
227
        while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
228
        if (wait <= 0) {
229
                printk(KERN_WARNING "ISICOM: Card found busy in drop_rts.\n");
230
                return;
231
        }
232
#ifdef ISICOM_DEBUG_DTR_RTS     
233
        printk(KERN_DEBUG "ISICOM: drop_rts.\n");
234
#endif  
235
        outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
236
        outw(0x0804, base);
237
        InterruptTheCard(base);
238
        port->status &= ~ISI_RTS;
239
}
240
extern inline void raise_dtr_rts(struct isi_port * port)
241
{
242
        struct isi_board * card = port->card;
243
        unsigned short base = card->base;
244
        unsigned char channel = port->channel;
245
        short wait=300;
246
        while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
247
        if (wait <= 0) {
248
                printk(KERN_WARNING "ISICOM: Card found busy in raise_dtr_rts.\n");
249
                return;
250
        }
251
#ifdef ISICOM_DEBUG_DTR_RTS     
252
        printk(KERN_DEBUG "ISICOM: raise_dtr_rts.\n");
253
#endif  
254
        outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
255
        outw(0x0f04, base);
256
        InterruptTheCard(base);
257
        port->status |= (ISI_DTR | ISI_RTS);
258
}
259
extern inline void drop_dtr_rts(struct isi_port * port)
260
{
261
        struct isi_board * card = port->card;
262
        unsigned short base = card->base;
263
        unsigned char channel = port->channel;
264
        short wait=300;
265
        while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
266
        if (wait <= 0) {
267
                printk(KERN_WARNING "ISICOM: Card found busy in drop_dtr_rts.\n");
268
                return;
269
        }
270
#ifdef ISICOM_DEBUG_DTR_RTS     
271
        printk(KERN_DEBUG "ISICOM: drop_dtr_rts.\n");
272
#endif  
273
        outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
274
        outw(0x0c04, base);
275
        InterruptTheCard(base);
276
        port->status &= ~(ISI_RTS | ISI_DTR);
277
}
278
 
279
extern inline void kill_queue(struct isi_port * port, short queue)
280
{
281
        struct isi_board * card = port->card;
282
        unsigned short base = card->base;
283
        unsigned char channel = port->channel;
284
        short wait=300;
285
        while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0));
286
        if (wait <= 0) {
287
                printk(KERN_WARNING "ISICOM: Card found busy in kill_queue.\n");
288
                return;
289
        }
290
#ifdef ISICOM_DEBUG     
291
        printk(KERN_DEBUG "ISICOM: kill_queue 0x%x.\n", queue);
292
#endif  
293
        outw(0x8000 | (channel << card->shift_count) | 0x02 , base);
294
        outw((queue << 8) | 0x06, base);
295
        InterruptTheCard(base);
296
}
297
 
298
#endif  /*      __KERNEL__      */
299
 
300
#endif  /*      ISICOM_H        */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.