forked from RealDeuce/OpenDoors
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathODCom.h
More file actions
137 lines (121 loc) · 5.07 KB
/
Copy pathODCom.h
File metadata and controls
137 lines (121 loc) · 5.07 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/* OpenDoors Online Software Programming Toolkit
* (C) Copyright 1991 - 1999 by Brian Pirie.
*
* Oct-2001 door32.sys/socket modifications by Rob Swindell (www.synchro.net)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*
* File: ODCom.h
*
* Description: Public definitions for serial communications module, which
* is implemented in odcom.c
*
* Revisions: Date Ver Who Change
* ---------------------------------------------------------------
* Oct 21, 1994 6.00 BP Created.
* Jan 01, 1995 6.00 BP Added ODComWaitEvent().
* Dec 21, 1995 6.00 BP Add ability to use already open port.
* Jan 09, 1996 6.00 BP Supply actual in/out buffer size used.
* Feb 19, 1996 6.00 BP Changed version number to 6.00.
* Mar 03, 1996 6.10 BP Begin version 6.10.
* Mar 06, 1996 6.10 BP Initial support for Door32 interface.
* Oct 19, 2001 6.20 RS Added TCP/IP socket (telnet) support.
*/
#ifndef _INC_ODCOM
#define _INC_ODCOM
/* odtypes.h is needed for definitions of tODHandle, and BOOL. */
#include "ODTypes.h"
/* Serial I/O handle. */
typedef tODHandle tPortHandle;
/* Flow Control setting manifest constants. */
#define FLOW_NONE 0x00
#define FLOW_RTSCTS 0x02
#define FLOW_DEFAULT 0x80
/* Parity bit setting manifest constants. */
#define ODPARITY_NONE 0x00
#define ODPARITY_ODD 0x08
#define ODPARITY_EVEN 0x18
#define ODPARITY_MASK 0x18
/* Stop bit setting manifest constants. */
#define STOP_ONE 0x00
#define STOP_ONE_POINT_FIVE 0x04 /* Only with DATABITS_FIVE. */
#define STOP_TWO 0x04 /* Only if not using DATABITS_FIVE. */
#define STOP_MASK 0x04
/* Character length manifest constants. */
#define DATABITS_FIVE 0x00
#define DATABITS_SIX 0x01
#define DATABITS_SEVEN 0x02
#define DATABITS_EIGHT 0x03
#define DATABITS_MASK 0x03
/* FIFO setting constants. */
#define FIFO_DISABLE 0x00
#define FIFO_ENABLE 0x01
#define FIFO_TRIGGER_1 0x00
#define FIFO_TRIGGER_4 0x40
#define FIFO_TRIGGER_8 0x80
#define FIFO_TRIGGER_14 0xc0
/* Misc. manifest constants. */
#define SPEED_UNSPECIFIED 0
#define SIZE_NON_ZERO -1
/* Serial I/O method settings. */
typedef enum
{
kComMethodUnspecified,
kComMethodFOSSIL,
kComMethodUART,
kComMethodWin32,
kComMethodDoor32,
kComMethodSocket,
kComMethodStdIO
} tComMethod;
/* Serial I/O event types. */
typedef enum
{
kNoCarrier
} tComEvent;
/* Serial I/O function prototypes. */
tODResult ODComAlloc(tPortHandle *phPort);
tODResult ODComFree(tPortHandle hPort);
tODResult ODComSetIdleFunction(tPortHandle hPort,
void (*pfCallback)(void));
tODResult ODComSetFlowControl(tPortHandle hPort, BYTE btFlowControlSetting);
tODResult ODComSetSpeed(tPortHandle hPort, long lSpeed);
tODResult ODComSetPort(tPortHandle hPort, BYTE btPort);
tODResult ODComSetIRQ(tPortHandle hPort, BYTE btIRQLevel);
tODResult ODComSetPortAddress(tPortHandle hPort, int nPortAddress);
tODResult ODComSetWordFormat(tPortHandle hPort, BYTE btWordFormat);
tODResult ODComSetRXBuf(tPortHandle hPort, int nReceiveBufferSize);
tODResult ODComSetTXBuf(tPortHandle hPort, int nTransmitBufferSize);
tODResult ODComSetFIFO(tPortHandle hPort, BYTE btFIFOSetting);
tODResult ODComSetPreferredMethod(tPortHandle hPort, tComMethod Method);
tODResult ODComGetMethod(tPortHandle hPort, tComMethod *pMethod);
tODResult ODComOpen(tPortHandle hPort);
tODResult ODComOpenFromExistingHandle(tPortHandle hPort,
DWORD_PTR dwExistingHandle);
tODResult ODComClose(tPortHandle hPort);
tODResult ODComClearInbound(tPortHandle hPort);
tODResult ODComClearOutbound(tPortHandle hPort);
tODResult ODComInbound(tPortHandle hPort, int *pnInboundWaiting);
tODResult ODComOutbound(tPortHandle hPort, int *pnOutboundWaiting);
tODResult ODComCarrier(tPortHandle hPort, BOOL *pbIsCarrier);
tODResult ODComSetDTR(tPortHandle hPort, BOOL bHigh);
tODResult ODComSendByte(tPortHandle hPort, BYTE btToSend);
tODResult ODComGetByte(tPortHandle hPort, char *pbtNext, BOOL bWait);
tODResult ODComSendBuffer(tPortHandle hPort, BYTE *pbtBuffer, int nSize);
tODResult ODComGetBuffer(tPortHandle hPort, BYTE *pbtBuffer, int nSize,
int *pnBytesRead);
tODResult ODComWaitEvent(tPortHandle hPort, tComEvent Event);
#endif /* !_INC_ODCOM */