blob: b1983311eca8c993f9249b7eab5417e76eba8808 [file] [log] [blame]
/**
* ±¾³ÌÐò·ûºÏGPLÌõÔ¼
* Ò»×é²Ù×÷´®¿ÚµÄº¯Êý
* Beneboy 2003-5-16
*/
#ifndef comH
#define comH
typedef struct
{
char prompt; // prompt after reciving data
int baudrate; // baudrate
char databit; // data bits, 5, 6, 7, 8
char debug; // debug mode, 0: none, 1: debug
char echo; // echo mode, 0: none, 1: echo
char fctl; // flow control, 0: none, 1: hardware, 2: software
char tty; // tty: 0, 1, 2, 3, 4, 5, 6, 7
char parity; // parity 0: none, 1: odd, 2: even
char stopbit; // stop bits, 1, 2
int reserved; // reserved, must be zero
} portinfo_t, *pportinfo_t;
/**
* ´ò¿ª´®¿Ú, ·µ»ØÎļþÃèÊö·û
* pportinfo: ´ýÉèÖõĴ®¿ÚÐÅÏ¢
*/
int PortOpen(pportinfo_t pportinfo,int mode);
/**
* ¶Ë¿Ú³õʼ»¯
*/
int PortInit(int mode);
/**
* ÉèÖô®¿Ú
* fdcom: ´®¿ÚÎļþÃèÊö·û, pportinfo: ´ýÉèÖõĴ®¿ÚÐÅÏ¢
*/
int PortSet(int fd);
/**
* ¹Ø±Õ´®¿Ú
* fdcom: ´®¿ÚÎļþÃèÊö·û
*/
void PortClose(int fd);
/**
* PortSend
* fd: ´®¿ÚÃèÊö·û,
* data: ´ý·¢ËÍÊý¾ÝÖ¸Õë
* datalen: Êý¾Ý³¤¶È
* ·µ»ØÊµ¼Ê·¢Ëͳ¤¶È
*/
int PortSend(int fd, unsigned char* data, int datalen);
/**
* PortRecv
* ²ÎÊý£º
* fd: ´®¿ÚÃèÊö·û,
* data: ´ý½ÓÊÕÊý¾ÝÖ¸Õë
* datalen: Êý¾Ý³¤¶È
* ·µ»ØÊµ¼Ê¶ÁÈëµÄ×Ö½ÚÊý
*/
int PortRecv(int fd, unsigned char* data, int datalen);
#endif