pi-cmp.h

Go to the documentation of this file.
00001 /*
00002  * $Id: pi-cmp.h,v 1.22 2006-10-17 13:24:06 desrod Exp $
00003  *
00004  * pi-cmp.h - Palm Connection Management Protocol interface
00005  *
00006  * This latches early in the sync to determine serial sync speeds
00007  *
00008  * This library is free software; you can redistribute it and/or modify it
00009  * under the terms of the GNU Library General Public License as published by
00010  * the Free Software Foundation; either version 2 of the License, or (at
00011  * your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
00016  * General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Library General Public License
00019  * along with this library; if not, write to the Free Software Foundation,
00020  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
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 /* CMP packet flag values */
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                          /* _PILOT_CMP_H_ */

© 1996-2007 by pilot-link.org. All rights reserved.