0
|
1 |
/**************************************************************************************************
|
|
2 |
*
|
|
3 |
* aip_com.h
|
|
4 |
*
|
|
5 |
* Macros für Kommunikation über serielle Schnittstelle
|
|
6 |
* Basiert auf rt_com.h von rtai !! (siehe unten)
|
|
7 |
*
|
|
8 |
*
|
|
9 |
* Autor: Wilhelm Hagemeister
|
|
10 |
*
|
|
11 |
* (C) Copyright IgH 2002
|
|
12 |
* Ingenieurgemeinschaft IgH
|
|
13 |
* Heinz-Bäcker Str. 34
|
|
14 |
* D-45356 Essen
|
|
15 |
* Tel.: +49 201/61 99 31
|
|
16 |
* Fax.: +49 201/61 98 36
|
|
17 |
* E-mail: hm@igh-essen.com
|
|
18 |
*
|
|
19 |
*
|
|
20 |
* $RCSfile: aip_com.h,v $
|
|
21 |
* $Revision: 1.1 $
|
|
22 |
* $Author: hm $
|
|
23 |
* $Date: 2004/09/30 15:50:32 $
|
|
24 |
* $State: Exp $
|
|
25 |
*
|
|
26 |
*
|
|
27 |
*
|
|
28 |
*
|
|
29 |
*
|
|
30 |
*
|
|
31 |
*
|
|
32 |
*
|
|
33 |
*
|
|
34 |
**************************************************************************************************/
|
|
35 |
|
|
36 |
/** rt_com
|
|
37 |
* ======
|
|
38 |
*
|
|
39 |
* RT-Linux kernel module for communication across serial lines.
|
|
40 |
*
|
|
41 |
* Copyright (C) 1997 Jens Michaelsen
|
|
42 |
* Copyright (C) 1997-2000 Jochen Kupper
|
|
43 |
* Copyright (C) 2002 Giuseppe Renoldi
|
|
44 |
*
|
|
45 |
* This program is free software; you can redistribute it and/or
|
|
46 |
* modify it under the terms of the GNU General Public License as
|
|
47 |
* published by the Free Software Foundation; either version 2 of the
|
|
48 |
* License, or (at your option) any later version.
|
|
49 |
*
|
|
50 |
* This program is distributed in the hope that it will be useful, but
|
|
51 |
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
52 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
53 |
* General Public License for more details.
|
|
54 |
*
|
|
55 |
* You should have received a copy of the GNU General Public License
|
|
56 |
* along with this program; see the file License. if not, write to the
|
|
57 |
* Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
58 |
* MA 02111-1307, USA.
|
|
59 |
*
|
|
60 |
* $Id: aip_com.h,v 1.1 2004/09/30 15:50:32 hm Exp $ */
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
#ifndef AIP_COM_H
|
|
65 |
#define AIP_COM_H
|
|
66 |
|
|
67 |
/** This is the interface definition of the plain rt_com API.
|
|
68 |
*
|
|
69 |
* This should be all you need to use rt_com within your real-time
|
|
70 |
* kernel module.
|
|
71 |
*
|
|
72 |
* (When POSIX is done, we will reference the appropriate header
|
|
73 |
* here - probably depending on a flag.) */
|
|
74 |
|
|
75 |
int init_aip_com(void); //Hm, IgH
|
|
76 |
void cleanup_aip_com(void); //Hm, IgH
|
|
77 |
|
|
78 |
|
|
79 |
/** specify hardware parameters, set-up communication parameters */
|
|
80 |
extern int rt_com_hwsetup( unsigned int ttyS, int base, int irq );
|
|
81 |
extern int rt_com_setup( unsigned int ttyS, int baud, int mode,
|
|
82 |
unsigned int parity, unsigned int stopbits,
|
|
83 |
unsigned int wordlength, int fifotrig );
|
|
84 |
|
|
85 |
/** read/write from/to input/output buffer */
|
|
86 |
extern int rt_com_read( unsigned int, char *, int );
|
|
87 |
extern int rt_com_write( unsigned int ttyS, char *buffer, int count );
|
|
88 |
|
|
89 |
/** clear input or output buffer */
|
|
90 |
extern int rt_com_clear_input( unsigned int ttyS );
|
|
91 |
extern int rt_com_clear_output( unsigned int ttyS );
|
|
92 |
|
|
93 |
/** read input signal from modem (CTS,DSR,RI,DCD), set output signal
|
|
94 |
* for modem control (DTR,RTS) */
|
|
95 |
extern int rt_com_read_modem( unsigned int ttyS, int signal );
|
|
96 |
extern int rt_com_write_modem( unsigned int ttyS, int signal, int value );
|
|
97 |
|
|
98 |
/** functioning mode and fifo trigger setting */
|
|
99 |
extern int rt_com_set_mode( unsigned int ttyS, int mode);
|
|
100 |
extern int rt_com_set_fifotrig( unsigned int ttyS, int fifotrig);
|
|
101 |
|
|
102 |
/** return last error detected */
|
|
103 |
extern int rt_com_error( unsigned int ttyS );
|
|
104 |
|
|
105 |
|
|
106 |
/** size of internal queues, this is constant during module lifetime */
|
|
107 |
extern unsigned int rt_com_buffersize;
|
|
108 |
|
|
109 |
#define rt_com_set_param rt_com_hwsetup
|
|
110 |
#define rt_com_setup_old(a,b,c,d,e) rt_com_setup((a),(b),0,(c),(d),(e),-1)
|
|
111 |
|
|
112 |
|
|
113 |
/** functioning modes */
|
|
114 |
#define RT_COM_NO_HAND_SHAKE 0x00
|
|
115 |
#define RT_COM_DSR_ON_TX 0x01
|
|
116 |
#define RT_COM_HW_FLOW 0x02
|
|
117 |
|
|
118 |
/** parity flags */
|
|
119 |
#define RT_COM_PARITY_EVEN 0x18
|
|
120 |
#define RT_COM_PARITY_NONE 0x00
|
|
121 |
#define RT_COM_PARITY_ODD 0x08
|
|
122 |
#define RT_COM_PARITY_HIGH 0x28
|
|
123 |
#define RT_COM_PARITY_LOW 0x38
|
|
124 |
|
|
125 |
/* FIFO Control */
|
|
126 |
#define RT_COM_FIFO_DISABLE 0x00
|
|
127 |
#define RT_COM_FIFO_SIZE_1 0x00
|
|
128 |
#define RT_COM_FIFO_SIZE_4 0x40
|
|
129 |
#define RT_COM_FIFO_SIZE_8 0x80
|
|
130 |
#define RT_COM_FIFO_SIZE_14 0xC0
|
|
131 |
|
|
132 |
/** rt_com_write_modem masks */
|
|
133 |
#define RT_COM_DTR 0x01
|
|
134 |
#define RT_COM_RTS 0x02
|
|
135 |
|
|
136 |
/** rt_com_read_modem masks */
|
|
137 |
#define RT_COM_CTS 0x10
|
|
138 |
#define RT_COM_DSR 0x20
|
|
139 |
#define RT_COM_RI 0x40
|
|
140 |
#define RT_COM_DCD 0x80
|
|
141 |
|
|
142 |
/** rt_com_error masks */
|
|
143 |
#define RT_COM_BUFFER_FULL 0x01
|
|
144 |
#define RT_COM_OVERRUN_ERR 0x02
|
|
145 |
#define RT_COM_PARITY_ERR 0x04
|
|
146 |
#define RT_COM_FRAMING_ERR 0x08
|
|
147 |
#define RT_COM_BREAK 0x10
|
|
148 |
|
|
149 |
|
|
150 |
#endif /* RT_COM_H */
|
|
151 |
|
|
152 |
|
|
153 |
|
|
154 |
/**
|
|
155 |
* Local Variables:
|
|
156 |
* mode: C
|
|
157 |
* c-file-style: "Stroustrup"
|
|
158 |
* End:
|
|
159 |
*/
|