yuezonghe | 824eb0c | 2024-06-27 02:32:26 -0700 | [diff] [blame] | 1 | /**
|
| 2 | * ±¾³ÌÐò·ûºÏGPLÌõÔ¼
|
| 3 | * Ò»×é²Ù×÷´®¿ÚµÄº¯Êý
|
| 4 | * Beneboy 2003-5-16
|
| 5 | */
|
| 6 |
|
| 7 | #ifndef comH
|
| 8 | #define comH
|
| 9 |
|
| 10 |
|
| 11 | typedef struct
|
| 12 | {
|
| 13 | char prompt; // prompt after reciving data
|
| 14 | int baudrate; // baudrate
|
| 15 | char databit; // data bits, 5, 6, 7, 8
|
| 16 | char debug; // debug mode, 0: none, 1: debug
|
| 17 | char echo; // echo mode, 0: none, 1: echo
|
| 18 | char fctl; // flow control, 0: none, 1: hardware, 2: software
|
| 19 | char tty; // tty: 0, 1, 2, 3, 4, 5, 6, 7
|
| 20 | char parity; // parity 0: none, 1: odd, 2: even
|
| 21 | char stopbit; // stop bits, 1, 2
|
| 22 | int reserved; // reserved, must be zero
|
| 23 | } portinfo_t, *pportinfo_t;
|
| 24 |
|
| 25 |
|
| 26 | /**
|
| 27 | * ´ò¿ª´®¿Ú, ·µ»ØÎļþÃèÊö·û
|
| 28 | * pportinfo: ´ýÉèÖõĴ®¿ÚÐÅÏ¢
|
| 29 | */
|
| 30 | int PortOpen(pportinfo_t pportinfo,int mode);
|
| 31 |
|
| 32 | /**
|
| 33 | * ¶Ë¿Ú³õʼ»¯
|
| 34 | */
|
| 35 | int PortInit(int mode);
|
| 36 | /**
|
| 37 | * ÉèÖô®¿Ú
|
| 38 | * fdcom: ´®¿ÚÎļþÃèÊö·û, pportinfo: ´ýÉèÖõĴ®¿ÚÐÅÏ¢
|
| 39 | */
|
| 40 | int PortSet(int fd);
|
| 41 | /**
|
| 42 | * ¹Ø±Õ´®¿Ú
|
| 43 | * fdcom: ´®¿ÚÎļþÃèÊö·û
|
| 44 | */
|
| 45 | void PortClose(int fd);
|
| 46 |
|
| 47 | /**
|
| 48 | * PortSend
|
| 49 | * fd: ´®¿ÚÃèÊö·û,
|
| 50 | * data: ´ý·¢ËÍÊý¾ÝÖ¸Õë
|
| 51 | * datalen: Êý¾Ý³¤¶È
|
| 52 | * ·µ»ØÊµ¼Ê·¢Ëͳ¤¶È
|
| 53 | */
|
| 54 | int PortSend(int fd, unsigned char* data, int datalen);
|
| 55 |
|
| 56 | /**
|
| 57 | * PortRecv
|
| 58 | * ²ÎÊý£º
|
| 59 | * fd: ´®¿ÚÃèÊö·û,
|
| 60 | * data: ´ý½ÓÊÕÊý¾ÝÖ¸Õë
|
| 61 | * datalen: Êý¾Ý³¤¶È
|
| 62 | * ·µ»ØÊµ¼Ê¶ÁÈëµÄ×Ö½ÚÊý
|
| 63 | */
|
| 64 | int PortRecv(int fd, unsigned char* data, int datalen);
|
| 65 |
|
| 66 | #endif
|
| 67 |
|