Berkeley Nuclear Data Software
rs232.h
Go to the documentation of this file.
1 /*
2 ***************************************************************************
3 *
4 * Author: Teunis van Beelen
5 *
6 * Copyright (C) 2005 - 2019 Teunis van Beelen
7 *
8 * Email: teuniz@protonmail.com
9 *
10 ***************************************************************************
11 *
12 * This program is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation, either version 3 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 *
25 ***************************************************************************
26 */
27 
28 /* Last revision: May 31, 2019 */
29 
30 /* For more info and how to use this library, visit: http://www.teuniz.net/RS-232/ */
31 
32 
33 #ifndef rs232_INCLUDED
34 #define rs232_INCLUDED
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 #include <stdio.h>
41 #include <string.h>
42 
43 
44 
45 #if defined(__linux__) || defined(__FreeBSD__)
46 
47 #include <termios.h>
48 #include <sys/ioctl.h>
49 #include <unistd.h>
50 #include <fcntl.h>
51 #include <sys/types.h>
52 #include <sys/stat.h>
53 #include <limits.h>
54 #include <sys/file.h>
55 #include <errno.h>
56 
57 #else
58 
59 #include <windows.h>
60 
61 #endif
62 
63 int RS232_OpenComport(int, int, const char *, int);
64 int RS232_PollComport(int, unsigned char *, int);
65 int RS232_SendByte(int, unsigned char);
66 int RS232_SendBuf(int, unsigned char *, int);
67 void RS232_CloseComport(int);
68 void RS232_cputs(int, const char *);
69 int RS232_IsDCDEnabled(int);
70 int RS232_IsRINGEnabled(int);
71 int RS232_IsCTSEnabled(int);
72 int RS232_IsDSREnabled(int);
73 void RS232_enableDTR(int);
74 void RS232_disableDTR(int);
75 void RS232_enableRTS(int);
76 void RS232_disableRTS(int);
77 void RS232_flushRX(int);
78 void RS232_flushTX(int);
79 void RS232_flushRXTX(int);
80 int RS232_GetPortnr(const char *);
81 
82 #ifdef __cplusplus
83 } /* extern "C" */
84 #endif
85 
86 #endif
87 
88 
void RS232_cputs(int, const char *)
Definition: rs232.c:832
void RS232_CloseComport(int)
Definition: rs232.c:730
void RS232_disableRTS(int)
Definition: rs232.c:801
int RS232_IsDSREnabled(int)
Definition: rs232.c:772
int RS232_OpenComport(int, int, const char *, int)
Definition: rs232.c:517
void RS232_flushRXTX(int)
Definition: rs232.c:822
int RS232_GetPortnr(const char *)
Definition: rs232.c:839
void RS232_flushRX(int)
Definition: rs232.c:810
int RS232_SendBuf(int, unsigned char *, int)
Definition: rs232.c:717
int RS232_IsCTSEnabled(int)
Definition: rs232.c:761
int RS232_PollComport(int, unsigned char *, int)
Definition: rs232.c:692
int RS232_IsRINGEnabled(int)
Definition: rs232.c:750
int RS232_SendByte(int, unsigned char)
Definition: rs232.c:705
int RS232_IsDCDEnabled(int)
Definition: rs232.c:739
void RS232_flushTX(int)
Definition: rs232.c:816
void RS232_enableRTS(int)
Definition: rs232.c:795
void RS232_disableDTR(int)
Definition: rs232.c:789
void RS232_enableDTR(int)
Definition: rs232.c:783