📄 etser.h
字号:
/*******************************************************
* *
* Program : EasyTask Language : C++ *
* *
* Modified : 20 nov 2003 *
* *
* Copyright (c) 1988,2003, ORITECH V 5.1 *
* All rights reserved. *
* *
*******************************************************
* You may not give away or cell or copy any part of *
* the source code. *
*******************************************************
* *
* ETSER.H serial functions *
* *
*******************************************************/
#if !defined(etser_h) // Sentry, use file only if it's not already included.
#define etser_h
#ifndef etker_h
#include "etker.h"
#endif
#define COM1 0x03F8
#define COM2 0x02F8
#define COM3 0x03E8
#define COM4 0x02E8
#define RVI_8250 1
#define RII_8250 2
#define RCL_8250 3
#define RCL_DATA5 0
#define RCL_DATA6 1
#define RCL_DATA7 2
#define RCL_DATA8 3
#define RCL_STOP2 4
#define RCL_ODD_PARITY 8
#define RCL_EVEN_PARITY 24
#define RCL_PARITY_BIT0 32
#define RCL_BREAK 64
#define RCL_DLAB 128
#define RCM_8250 4
#define RCM_DTR 1
#define RCM_RTS 2
#define RCM_OUT1 4
#define RCM_OUT2 8
#define RCM_LOOP 16
#define REL_8250 5
#define REL_DR 1
#define REL_ERR 14 // OE, PE, FE
#define REL_ERROE 2
#define REL_THRE 32
#define REM_8250 6
#define REM_CTS 16
#define REM_DSR 32
#define REM_RI 64
#define REM_RSLD 128
#define ERR_CADENCE 2
#define ERR_PARITY 32
#define ERR_TRAME 8
#define ERR_BREAK 16
#define MT_NOPARITY 0 // no parity
#define MT_EVENPARITY 1 // even parity
#define MT_ODDPARITY 2 // odd parity
#define smode_dtr 1 // mode control RS232
#define smode_rts 2
#define smode_cts 4
#define smode_dsr 8
#define smode_xon 16
#define err_grange 1
#define err_crange 2
#define err_open 3
#define err_nopen 4
#define err_hard 5
#define err_timeout 20
#define err_crlf 30
typedef struct {
uint qchar;
uint posGet;
uint posPut;
uint size;
char *buf;
} TBuffer;
typedef TBuffer *PBuffer;
typedef struct
{
word statM; /* status modem */
word statL; /* status line */
word cumErrL; /* line errors */
word errL; /* status line error */
word dtr; /* DTR bool */
word rts; /* RTS bool */
word cts; /* CTS bool */
word dsr; /* DSR bool */
word dtrFluxTX; /* DTR flow bool */
word rtsFluxTX; /* RTS flow bool */
word ctsFluxRX; /* CTS flow bool */
word dsrFluxRX; /* DSR flow bool */
word xon; /* caractere de xon Char */
word xoff; /* caractere de xoff Char */
word xonmode; /* mode xon bool */
word xonxoff; /* private */
word xon13; /* limit 1/3 */
word xon23; /* limit 2/3 */
word xonwr; /* private */
word xonout; /* private */
word inuse; /* port open bool */
int numirq; /* interrupt vecteur number */
word com; /* port address */
word charRX; /* character receive Char */
word rd23; /* private */
word rdPend; /* private */
word wrPend; /* private */
word wready; /* private */
TBuffer bufIn; /* input buffer */
TBuffer bufOut; /* output buffer */
word crlf;
} TSerial;
typedef TSerial *PSerial;
typedef struct
{
int nirq;
int quantity;
int chan;
int vect;
pvoid glo;
PSerial serp[32];
} TSerGroup;
typedef TSerGroup *PSerGroup;
typedef TSerGroup TSerList[16];
#define PSerList TSerList *
void ETSer_Init();
PSerList GetSerList();
PSerial GetSerialPtr(int groupIrq, int channel, int VAR err);
void OpenSerial(int groupIrq, int channels, uint lenBufIn, uint lenBufOut,
word comaddr, int VAR err);
void ResetSerial(int groupIrq, int channel, long bauds,
int lenWord, int bitStop, int parity, int mode, int VAR err);
void ReadBSerial(int groupIrq, int channel, Tstring s, uint sLen,
PFunc myproc, long timeout, int VAR err);
char GetSerial(int groupIrq, int channel,
PFunc myproc, long timeout, int VAR err);
uint ReadlnBSerial(int groupIrq, int channel, Tstring s, uint sLen,
char charln, PFunc myproc, long timeout, int VAR err);
void ReadlnSerial(int groupIrq, int channel, Tstring s, uint sLen,
PFunc myproc, long timeout, int VAR err);
void ReadlnPSerial(int groupIrq, int channel, Tstring s, uint sLen,
PFunc myproc, long timeout, int VAR err);
void WriteBSerial(int groupIrq, int channel, Tstring s, uint sLen,
PFunc myproc, long timeout, int VAR err);
void PutSerial(int groupIrq, int channel, char c,
PFunc myproc, long timeout, int VAR err);
void WriteSerial(int groupIrq, int channel, Tstring s,
PFunc myproc, long timeout, int VAR err);
void WritePSerial(int groupIrq, int channel, Tstring s,
PFunc myproc, long timeout, int VAR err);
void WritelnSerial(int groupIrq, int channel, Tstring s,
PFunc myproc, long timeout, int VAR err);
void WritelnPSerial(int groupIrq, int channel, Tstring s,
PFunc myproc, long timeout, int VAR err);
uint LenSerialBufIn(int groupIrq, int channel, int VAR err);
uint LenSerialBufOut(int groupIrq, int channel, int VAR err);
void ClearSerialIn(int groupIrq, int channel, int VAR err);
void ClearSerialOut(int groupIrq, int channel, int VAR err);
void ClearSerial(int groupIrq, int channel, int VAR err);
void CloseSerial(int groupIrq, int VAR err);
void DisposeSerial();
//======================= redefine =============================
#define tbuffer TBuffer
#define pbuffer PBuffer
#define tsergroup TSerGroup
#define psergroup PSerGroup
#define tserlist TSerList
#define pserlist PSerList
#define etser_init ETSer_Init
#define getserlist GetSerList
#define getserialptr GetSerialPtr
#define openserial OpenSerial
#define resetserial ResetSerial
#define readbserial ReadBSerial
#define getserial GetSerial
#define readlnbserial ReadlnBSerial
#define readlnserial ReadlnSerial
#define readlnpserial ReadlnPSerial
#define writebserial WriteBSerial
#define putserial PutSerial
#define writeserial WriteSerial
#define writepserial WritePSerial
#define writelnserial WritelnSerial
#define writelnpserial WritelnPSerial
#define lenserialbufin LenSerialBufIn
#define lenserialbufout LenSerialBufOut
#define clearserialin ClearSerialIn
#define clearserialout ClearSerialOut
#define clearserial ClearSerial
#define closeserial CloseSerial
#define disposeserial DisposeSerial
#endif // etser_h sentry.
// *** end of source ***
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -