-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathserial.h
62 lines (50 loc) · 1.16 KB
/
serial.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* -*- C -*-
* File: serial.h (~jb/serialport/serial.h)
* Author: Johan Bevemyr
* Created: Sun Oct 20 01:36:03 1996
* Purpose:
*/
#ifndef SERIAL_H
#define SERIAL_H
typedef enum {
FALSE = 0,
TRUE = 1
} boolean;
#define NULLFDS ((struct fd_set *) 0)
#define NULLTV ((struct timeval *) 0)
#define MAXLENGTH 1024
typedef struct {
int rate;
speed_t speed;
} bit_rate;
#define Max(A,B) (((A) > (B)) ? (A) : (B))
#define Min(A,B) (((A) < (B)) ? (A) : (B))
#define TtyOpen(TTY) ((TTY) != -1)
#define COMMANDPOS 2
#define COMMANDSIZE 1
#define HEADERSIZE 3
#define TBHSIZE 2
#define PacketType(MESSAGE) (MESSAGE[COMMANDPOS])
#define BREAKPERIOD 0
/* roland */
typedef enum {
SEND=0,
CONNECT=1,
DISCONNECT=2,
OPEN=3,
CLOSE=4,
SPEED=5,
PARITY_ODD=6,
PARITY_EVEN=7,
BREAK=8
} command;
#ifdef DEBUG
# define Debug(STRING) fprintf(stderr,STRING)
# define Debug1(STRING,Arg) fprintf(stderr,STRING,Arg)
# define Debug2(STRING,Arg1,Arg2) fprintf(stderr,STRING,Arg1,Arg2)
#else
# define Debug(STRING)
# define Debug1(STRING,Arg)
# define Debug2(STRING,Arg1,Arg2)
#endif
#endif /* SERIAL_H */