RS232.h
34 lines
| 1.5 KiB
| text/x-c
|
CLexer
/ src / RS232.h
r3 | // SOPSUYSI_RS232.h | |||
yannic
|
r7 | #include "rs232config.h" | ||
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr
|
r8 | |||
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr
|
r5 | #ifdef HAVE_WINDOWS_H | ||
#include <windows.h> | ||||
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr
|
r8 | #define badPortValue INVALID_HANDLE_VALUE | ||
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr
|
r5 | typedef HANDLE rs232port_t; | ||
typedef DWORD rs232speed_t; | ||||
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr
|
r8 | typedef enum {rs232OneStop=ONESTOPBIT,rs232One5Stop=ONE5STOPBITS,rs232TwoStop=TWOSTOPBITS}rs232stop; | ||
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr
|
r5 | typedef enum {rs232parityNo=NOPARITY,rs232parityOdd=ODDPARITY,rs232parityEven=EVENPARITY}rs232parity; | ||
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr
|
r8 | #else | ||
#ifdef HAVE_TERMIOS_H | ||||
#include <termios.h> | ||||
#define badPortValue -1 | ||||
typedef int rs232port_t; | ||||
typedef speed_t rs232speed_t; | ||||
typedef enum {rs232OneStop=1,rs232One5Stop=2,rs232TwoStop=2}rs232stop; | ||||
typedef enum {rs232parityNo=(~PARENB),rs232parityOdd=(PARENB|PARODD),rs232parityEven=(PARENB|~PARODD)}rs232parity; | ||||
#endif | ||||
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr
|
r5 | #endif | ||
jeandet@PC-DE-JEANDET.lpp.polytechnique.fr
|
r8 | #ifdef __cplusplus | ||
#define rs232extern extern "C" | ||||
#else | ||||
#define rs232extern extern | ||||
#endif | ||||
rs232extern rs232port_t rs232open(char* psPortName); | ||||
rs232extern int rs232close(rs232port_t fd); | ||||
rs232extern int rs232setup(rs232port_t fd, int ChSize, int BaudeRate, rs232parity Parity, rs232stop NbStop); | ||||
rs232extern int rs232write(rs232port_t fd,char *psWrite, int WriteBufferSize); | ||||
rs232extern int rs232read(rs232port_t fd,char *psRead, int ReadBufferSize); | ||||
rs232extern int rs232setparity(rs232port_t fd, rs232parity Parity); | ||||
rs232extern int rs232setnbstop(rs232port_t fd, rs232stop NbStop); | ||||
rs232extern int rs232setcsize(rs232port_t fd, int ChSize); | ||||
rs232extern int rs232setbaudrate(rs232port_t fd, int baudrate); | ||||