Rev 715 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
538 | mauro | 1 | /* |
2 | * Project: S.Ha.R.K. |
||
3 | * |
||
4 | * Coordinators: |
||
5 | * Giorgio Buttazzo <giorgio@sssup.it> |
||
6 | * Paolo Gai <pj@gandalf.sssup.it> |
||
7 | * |
||
8 | * Authors : |
||
9 | * Paolo Gai <pj@gandalf.sssup.it> |
||
10 | * Massimiliano Giorgi <massy@gandalf.sssup.it> |
||
11 | * Luca Abeni <luca@gandalf.sssup.it> |
||
12 | * (see the web pages for full authors list) |
||
13 | * |
||
14 | * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
||
15 | * |
||
16 | * http://www.sssup.it |
||
17 | * http://retis.sssup.it |
||
18 | * http://shark.sssup.it |
||
19 | */ |
||
20 | |||
21 | /* |
||
22 | * Copyright (C) 2000 Gerardo Lamastra |
||
23 | * |
||
24 | * This program is free software; you can redistribute it and/or modify |
||
25 | * it under the terms of the GNU General Public License as published by |
||
26 | * the Free Software Foundation; either version 2 of the License, or |
||
27 | * (at your option) any later version. |
||
28 | * |
||
29 | * This program is distributed in the hope that it will be useful, |
||
30 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
31 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
32 | * GNU General Public License for more details. |
||
33 | * |
||
34 | * You should have received a copy of the GNU General Public License |
||
35 | * along with this program; if not, write to the Free Software |
||
36 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
37 | * |
||
38 | */ |
||
39 | |||
40 | #ifndef __SCOM_H__ |
||
41 | #define __SCOM_H__ |
||
42 | |||
43 | /* Number of available COM links */ |
||
44 | #define COM_LINKS 4 |
||
45 | |||
46 | #define COM1 0 |
||
47 | #define COM2 1 |
||
48 | #define COM3 2 |
||
49 | #define COM4 3 |
||
50 | |||
51 | /* These values identify interrupt type */ |
||
52 | #define RX_FULL 1 |
||
53 | #define TX_EMPTY 2 |
||
54 | #define LS_CHANGED 4 |
||
55 | #define MS_CHANGED 8 |
||
56 | |||
57 | /* This is set when the channel is open */ |
||
58 | #define LINK_BUSY 128 |
||
59 | /* This is set if the fast handler is installed */ |
||
60 | #define FAST_INSTALLED 64 |
||
61 | |||
62 | /* Register displacements */ |
||
63 | #define THR 0 |
||
64 | #define RBR 0 |
||
65 | #define IER 1 |
||
66 | #define FCR 2 |
||
67 | #define IIR 2 |
||
68 | #define LCR 3 |
||
69 | #define MCR 4 |
||
70 | #define LSR 5 |
||
71 | #define MSR 6 |
||
72 | #define SPad 7 |
||
73 | |||
74 | /* Parity value */ |
||
75 | #define NONE 0 |
||
76 | #define ODD 1 |
||
77 | #define EVEN 3 |
||
78 | |||
79 | /* Used for decoding the IIR status */ |
||
80 | extern const int IIRbits[]; |
||
81 | #define DECODE(v) IIRbits[((v >> 1) & 3)] |
||
82 | #define PENDIRQ(v) !((v) & 1) |
||
83 | |||
84 | /* Bit setting macros */ |
||
85 | #define bit_on(v,b) v |= (b) |
||
86 | #define bit_off(v,b) v &= (~(b)) |
||
87 | |||
715 | giacomo | 88 | int com_open(unsigned port, DWORD speed, BYTE parity, BYTE len, BYTE stop); |
89 | int com_close(unsigned port); |
||
90 | unsigned com_read(unsigned port, unsigned reg); |
||
91 | unsigned com_receive(unsigned port); |
||
92 | void com_write(unsigned port, unsigned reg, unsigned value); |
||
1035 | tullio | 93 | unsigned com_send(unsigned port, BYTE b, unsigned wait); |
538 | mauro | 94 | |
95 | #endif |