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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [rdi-share/] [unixcomm.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 106 markom
/*
2
 * Copyright (C) 1995 Advanced RISC Machines Limited. All rights reserved.
3
 *
4
 * This software may be freely used, copied, modified, and distributed
5
 * provided that the above copyright notice is preserved in all copies of the
6
 * software.
7
 */
8
 
9
/* -*-C-*-
10
 *
11
 * $Revision: 1.1.1.1 $
12
 *     $Date: 2001-05-18 11:16:47 $
13
 *
14
 */
15
#ifndef angsd_unixcomm_h
16
#define angsd_unixcomm_h
17
 
18
#include <errno.h>
19
 
20
#if defined(BSD)
21
#  define ERRNO_FOR_BLOCKED_IO EWOULDBLOCK
22
#else
23
#  define ERRNO_FOR_BLOCKED_IO EAGAIN
24
#endif
25
 
26
/*
27
 *  Function: Unix_MatchValidSerialDevice
28
 *   Purpose: check that the serial driver/port name is valid
29
 *            and return the actual device name if it is.
30
 *
31
 *    Params:
32
 *       Input: name    Name of device going to be used
33
 *
34
 *   Returns:
35
 *          OK: Pointer to name of the device matched
36
 *       Error or unrecognised deivce: 0
37
 */
38
extern const char *Unix_MatchValidSerialDevice(const char *name);
39
 
40
/*
41
 *  Function: Unix_IsSerialInUse
42
 *   Purpose: check whether the serial port is in use
43
 *
44
 *    Params:
45
 *       Input: Nothing
46
 *
47
 *   Returns:
48
 *          OK: 0       Serial device not in use
49
 *       Error: -1      Serial device in use
50
 */
51
extern int Unix_IsSerialInUse(void);
52
 
53
/*
54
 *  Function: Unix_OpenSerial
55
 *   Purpose: open the serial port
56
 *
57
 *    Params:
58
 *       Input: name    Name of device to open
59
 *
60
 *   Returns: Unix 'open' returns
61
 */
62
extern int Unix_OpenSerial(const char *name);
63
 
64
/*
65
 *  Function: Unix_CloseSerial
66
 *   Purpose: close the serial port
67
 *
68
 *    Params:
69
 *       Input: Nothing
70
 *
71
 *   Returns: Nothing
72
 */
73
extern void Unix_CloseSerial(void);
74
 
75
/*
76
 *  Function: Unix_ReadSerial
77
 *   Purpose: reads a specified number of bytes (or less) from the serial port
78
 *
79
 *    Params:
80
 *       Input: buf     Buffer to store read bytes
81
 *              n       Maximum number of bytes to read
82
 *
83
 *   Returns: Unix 'read' returns
84
 */
85
extern int Unix_ReadSerial(unsigned char *buf, int n, bool block);
86
 
87
/*
88
 *  Function: Unix_WriteSerial
89
 *   Purpose: writes a specified number of bytes (or less) to the serial port
90
 *
91
 *    Params:
92
 *       Input: buf     Buffer to write bytes from
93
 *              n       Maximum number of bytes to write
94
 *
95
 *   Returns: Unix 'write' returns
96
 */
97
extern int Unix_WriteSerial(unsigned char *buf, int n);
98
 
99
/*
100
 *  Function: Unix_ResetSerial
101
 *   Purpose: resets the serial port for another operation
102
 *
103
 *    Params:
104
 *       Input: Nothing
105
 *
106
 *   Returns: Nothing
107
 */
108
extern void Unix_ResetSerial(void);
109
 
110
/*
111
 *  Function: Unix_SetSerialBaudRate
112
 *   Purpose: check that the serial driver/port name is valid
113
 *
114
 *    Params:
115
 *       Input: baudrate    termios value for baud rate
116
 *
117
 *   Returns: Nothing
118
 */
119
extern void Unix_SetSerialBaudRate(int baudrate);
120
 
121
/*
122
 *  Function: Unix_ioctlNonBlocking
123
 *   Purpose: sets the serial port to non-blocking IO
124
 *
125
 *    Params:
126
 *       Input: Nothing
127
 *
128
 *   Returns: Nothing
129
 */
130
extern void Unix_ioctlNonBlocking(void);
131
 
132
/*
133
 *  Function: Unix_IsValidParallelDevice
134
 *   Purpose: check whether the combined serial and parallel device specification
135
 *            is ok, and return the ports selected
136
 *
137
 *    Params:
138
 *       Input: portstring - is a string which specifies which serial
139
 *                           and parallel ports are to be used. Can
140
 *                           include s=<val> and p=<val> separated by a
141
 *                           comma.
142
 *
143
 *   Returns:
144
 *       Output: *sername  - returns the device name of the chosen serial port
145
 *               *parname  - returns the device name of the chosen parallel port
146
 *               If either of these is NULL on return then the match failed.
147
 */
148
extern void Unix_IsValidParallelDevice(
149
  const char *portstring, char **sername, char **parname
150
);
151
 
152
/*
153
 *  Function: Unix_IsParallelInUse
154
 *   Purpose: check whether the parallel port is in use
155
 *
156
 *    Params:
157
 *       Input: Nothing
158
 *
159
 *   Returns:
160
 *          OK: 0       Parallel device not in use
161
 *       Error: -1      Parallel device in use
162
 */
163
extern int Unix_IsParallelInUse(void);
164
 
165
/*
166
 *  Function: Unix_OpenParallel
167
 *   Purpose: open the parallel port
168
 *
169
 *    Params:
170
 *       Input: name    Name of device to open
171
 *
172
 *   Returns: Unix 'open' returns
173
 */
174
extern int Unix_OpenParallel(const char *name);
175
 
176
/*
177
 *  Function: Unix_CloseParallel
178
 *   Purpose: close the parallel port
179
 *
180
 *    Params:
181
 *       Input: Nothing
182
 *
183
 *   Returns: Nothing
184
 */
185
extern void Unix_CloseParallel(void);
186
 
187
/*
188
 *  Function: Unix_WriteParallel
189
 *   Purpose: writes a specified number of bytes (or less) to the parallel port
190
 *
191
 *    Params:
192
 *       Input: buf     Buffer to write bytes from
193
 *              n       Maximum number of bytes to write
194
 *
195
 *   Returns: Unix 'write' returns
196
 */
197
extern unsigned int Unix_WriteParallel(unsigned char *buf, int n);
198
 
199
/*
200
 *  Function: Unix_ResetParallel
201
 *   Purpose: resets the parallel port for another operation
202
 *
203
 *    Params:
204
 *       Input: Nothing
205
 *
206
 *   Returns: Nothing
207
 */
208
extern void Unix_ResetParallel(void);
209
 
210
#endif /* ndef angsd_unixcomm_h */
211
 
212
/* EOF unixcomm.h */

powered by: WebSVN 2.1.0

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