00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _PILOT_CMP_H_
00024 #define _PILOT_CMP_H_
00025
00031 #include "pi-args.h"
00032 #include "pi-buffer.h"
00033
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037
00038 #define PI_CMP_HEADER_LEN 10
00039 #define PI_CMP_MTU 10
00040
00041 #define PI_CMP_OFFSET_TYPE 0
00042 #define PI_CMP_OFFSET_FLGS 1
00043 #define PI_CMP_OFFSET_VERS 2
00044 #define PI_CMP_OFFSET_RESV 4
00045 #define PI_CMP_OFFSET_BAUD 6
00046
00047 #define PI_CMP_TYPE_WAKE 0x01
00048 #define PI_CMP_TYPE_INIT 0x02
00049 #define PI_CMP_TYPE_ABRT 0x03
00050 #define PI_CMP_TYPE_EXTN 0x04
00052 #define PI_CMP_VERS_1_0 0x0100L
00053 #define PI_CMP_VERS_1_1 0x0101L
00054 #define PI_CMP_VERS_1_2 0x0102L
00055 #define PI_CMP_VERS_1_3 0x0103L
00056
00057 #define PI_CMP_VERSION PI_CMP_VERS_1_2
00058
00059
00060 #define CMP_FL_CHANGE_BAUD_RATE 0x80
00061 #define CMP_FL_ONE_MINUTE_TIMEOUT 0x40
00062 #define CMP_FL_TWO_MINUTE_TIMEOUT 0x20
00063 #define CMP_FL_LONG_PACKET_SUPPORT 0x10
00065 struct pi_cmp_data {
00066 unsigned char type;
00067 unsigned char flags;
00068 unsigned int version;
00069 int baudrate;
00070 };
00071
00072 extern pi_protocol_t *cmp_protocol
00073 PI_ARGS((void));
00074
00075 extern int cmp_rx_handshake
00076 PI_ARGS((pi_socket_t *ps, int establishrate, int establishhighrate));
00077
00078 extern int cmp_tx_handshake
00079 PI_ARGS((pi_socket_t *ps));
00080
00081 extern ssize_t cmp_tx
00082 PI_ARGS((pi_socket_t *ps, PI_CONST unsigned char *buf,
00083 size_t len, int flags));
00084
00085 extern ssize_t cmp_rx
00086 PI_ARGS((pi_socket_t *ps, pi_buffer_t *msg,
00087 size_t expect, int flags));
00088
00089 extern int cmp_init
00090 PI_ARGS((pi_socket_t *ps, int baudrate));
00091
00092 extern int cmp_abort
00093 PI_ARGS((pi_socket_t *ps, int reason));
00094
00095 extern int cmp_wakeup
00096 PI_ARGS((pi_socket_t *ps, int maxbaud));
00097
00098 extern void cmp_dump
00099 PI_ARGS((PI_CONST unsigned char *cmp, int rxtx));
00100
00101 #ifdef __cplusplus
00102 }
00103 #endif
00104 #endif