2 * Copyright (C) 1995 Advanced RISC Machines Limited. All rights reserved.
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
15 #ifndef angsd_unixcomm_h
16 #define angsd_unixcomm_h
21 # define ERRNO_FOR_BLOCKED_IO EWOULDBLOCK
23 # define ERRNO_FOR_BLOCKED_IO EAGAIN
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.
32 * Input: name Name of device going to be used
35 * OK: Pointer to name of the device matched
36 * Error or unrecognised deivce: 0
38 extern const char *Unix_MatchValidSerialDevice(const char *name
);
41 * Function: Unix_IsSerialInUse
42 * Purpose: check whether the serial port is in use
48 * OK: 0 Serial device not in use
49 * Error: -1 Serial device in use
51 extern int Unix_IsSerialInUse(void);
54 * Function: Unix_OpenSerial
55 * Purpose: open the serial port
58 * Input: name Name of device to open
60 * Returns: Unix 'open' returns
62 extern int Unix_OpenSerial(const char *name
);
65 * Function: Unix_CloseSerial
66 * Purpose: close the serial port
73 extern void Unix_CloseSerial(void);
76 * Function: Unix_ReadSerial
77 * Purpose: reads a specified number of bytes (or less) from the serial port
80 * Input: buf Buffer to store read bytes
81 * n Maximum number of bytes to read
83 * Returns: Unix 'read' returns
85 extern int Unix_ReadSerial(unsigned char *buf
, int n
, bool block
);
88 * Function: Unix_WriteSerial
89 * Purpose: writes a specified number of bytes (or less) to the serial port
92 * Input: buf Buffer to write bytes from
93 * n Maximum number of bytes to write
95 * Returns: Unix 'write' returns
97 extern int Unix_WriteSerial(unsigned char *buf
, int n
);
100 * Function: Unix_ResetSerial
101 * Purpose: resets the serial port for another operation
108 extern void Unix_ResetSerial(void);
111 * Function: Unix_SetSerialBaudRate
112 * Purpose: check that the serial driver/port name is valid
115 * Input: baudrate termios value for baud rate
119 extern void Unix_SetSerialBaudRate(int baudrate
);
122 * Function: Unix_ioctlNonBlocking
123 * Purpose: sets the serial port to non-blocking IO
130 extern void Unix_ioctlNonBlocking(void);
133 * Function: Unix_IsValidParallelDevice
134 * Purpose: check whether the combined serial and parallel device specification
135 * is ok, and return the ports selected
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
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.
148 extern void Unix_IsValidParallelDevice(
149 const char *portstring
, char **sername
, char **parname
153 * Function: Unix_IsParallelInUse
154 * Purpose: check whether the parallel port is in use
160 * OK: 0 Parallel device not in use
161 * Error: -1 Parallel device in use
163 extern int Unix_IsParallelInUse(void);
166 * Function: Unix_OpenParallel
167 * Purpose: open the parallel port
170 * Input: name Name of device to open
172 * Returns: Unix 'open' returns
174 extern int Unix_OpenParallel(const char *name
);
177 * Function: Unix_CloseParallel
178 * Purpose: close the parallel port
185 extern void Unix_CloseParallel(void);
188 * Function: Unix_WriteParallel
189 * Purpose: writes a specified number of bytes (or less) to the parallel port
192 * Input: buf Buffer to write bytes from
193 * n Maximum number of bytes to write
195 * Returns: Unix 'write' returns
197 extern unsigned int Unix_WriteParallel(unsigned char *buf
, int n
);
200 * Function: Unix_ResetParallel
201 * Purpose: resets the parallel port for another operation
208 extern void Unix_ResetParallel(void);
210 #endif /* ndef angsd_unixcomm_h */
This page took 0.0334 seconds and 4 git commands to generate.