00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #ifndef __FOSSIL_H__
00048 #define __FOSSIL_H__
00049
00050
00051
00052 #define FOSSIL_EXT 0
00053 #define FOSSIL_COM 1
00054
00055
00056 #define FOSSIL_PARITY_NO 0
00057 #define FOSSIL_PARITY_ODD 1
00058 #define FOSSIL_PARITY_EVEN 2
00059 #define FOSSIL_PARITY_MARK 3
00060 #define FOSSIL_PARITY_SPACE 4
00061
00062
00063 #define FOSSIL_OUTPUT_BUFFER_EMPTY 0x40
00064 #define FOSSIL_OUTPUT_NOT_FULL 0x20
00065 #define FOSSIL_LINE_BREAK 0x10
00066 #define FOSSIL_FRAMING_ERROR 0x08
00067 #define FOSSIL_PARITY_ERROR 0x04
00068 #define FOSSIL_OVERRUN_ERROR 0x02
00069 #define FOSSIL_DATA_AVAILABLE 0x01
00070
00071
00072 #define FOSSIL_FLOWCTRL_OFF 0x00
00073 #define FOSSIL_FLOWCTRL_XONXOFF_SEND 0x01
00074 #define FOSSIL_FLOWCTRL_RTSCTS 0x02
00075 #define FOSSIL_FLOWCTRL_XONXOFF_RECV 0x08
00076
00077
00078 #define FOSSIL_RS485_LOWACTIVE 0
00079 #define FOSSIL_RS485_HIGHACTIVE 1
00080 #define FOSSIL_RS485_DISABLE 2
00081
00082
00083
00084 typedef struct
00085 {
00086 unsigned size;
00087 unsigned char version;
00088 unsigned char level;
00089 char *id;
00090 unsigned inputBuffSize;
00091 unsigned inputAvaiable;
00092 unsigned outputBuffSize;
00093 unsigned ouputAvaiable;
00094 unsigned char screenWidth;
00095 unsigned char screenHeight;
00096 unsigned char baudrateMask;
00097 } FossilDriverInfo_t;
00098
00099
00100
00101
00102 int fossil_init(int port);
00103 void fossil_deinit(int port);
00104 int fossil_setbaud(int port, long baudrate, int parity, int wordlen, int stopbits);
00105 int fossil_putbyte_wait(int port, int ch);
00106 int fossil_putbyte(int port, int ch);
00107 int fossil_getbyte_wait(int port);
00108 int fossil_peek_input(int port);
00109 int fossil_status_request(int port);
00110 void fossil_flush_output(int port);
00111 void fossil_purge_output(int port);
00112 void fossil_purge_input(int port);
00113 void fossil_set_flowcontrol(int port, int flowctrl);
00114 unsigned int fossil_readblock(int port, unsigned char *buffer, unsigned int count);
00115 unsigned int fossil_writeblock(int port, unsigned char *buffer, unsigned int count);
00116 void fossil_set_rs485(int port, int mode);
00117 void fossil_set_rs485_txenable(int port, int pin);
00118 void fossil_set_extctrl(int port, int divider, int parity, int wordlen, int stopbits);
00119 int fossil_get_driver_info(int port, FossilDriverInfo_t *drv_info);
00120 void fossil_send_break(int port, unsigned char longbreak );
00121 int fossil_get_bytes_in_uart(int port);
00122
00123
00124 #endif
00125
00126
00127