This commit was generated by cvs2svn to compensate for changes in r161,
[gnokii.git] / include / links / fbus-3110.h
1 /*
2
3   $Id$
4
5   G N O K I I
6
7   A Linux/Unix toolset and driver for Nokia mobile phones.
8
9   Copyright (C) 2000 Hugh Blemings & Pavel Janík ml.
10
11   Released under the terms of the GNU GPL, see file COPYING for more details.
12
13   This file provides an API for accessing functions via fbus. 
14   See README for more details on supported mobile phones.
15
16   The various routines are called FB3110_(whatever).
17
18   $Log$
19   Revision 1.1.1.1  2001/11/25 21:59:22  short
20   :pserver:cvs@pserver.samba.org:/cvsroot - gnokii - Sun Nov 25 22:56 CET 2001
21
22   Revision 1.1  2001/11/09 12:55:07  pkot
23   Forgot about fbus support for 3110. FIXME: is it really needed?
24
25
26 */
27
28 #ifndef __links_fbus_3110_h
29 #define __links_fbus_3110_h
30
31 #include <time.h>
32 #include "gsm-statemachine.h"
33
34 #ifdef WIN32
35 #include <sys/types.h>
36 #include <sys/timeb.h>
37 #endif
38
39 #define FB3110_MAX_FRAME_LENGTH 256
40 #define FB3110_MAX_MESSAGE_TYPES 128
41 #define FB3110_MAX_TRANSMIT_LENGTH 256
42 #define FB3110_MAX_CONTENT_LENGTH 120
43
44 /* This byte is at the beginning of all GSM Frames sent over FBUS to Nokia
45    phones.  This may have to become a phone dependant parameter... */
46 #define FB3110_FRAME_ID 0x01
47
48
49 /* States for receive code. */
50
51 enum FB3110_RX_States {
52         FB3110_RX_Sync,
53         FB3110_RX_Discarding,
54         FB3110_RX_GetLength,
55         FB3110_RX_GetMessage
56 };
57
58
59 typedef struct{
60         int Checksum;
61         int BufferCount;
62         enum FB3110_RX_States State;
63         int FrameType;
64         int FrameLength;
65         char Buffer[FB3110_MAX_FRAME_LENGTH];
66 } FB3110_IncomingFrame;
67
68 typedef struct {
69         u16 message_length;
70         u8 message_type;
71         u8 *buffer;
72 } FB3110_OutgoingMessage;
73
74
75 typedef struct{
76         FB3110_IncomingFrame i;
77         u8 RequestSequenceNumber;
78 } FB3110_Link;
79
80 GSM_Error FB3110_Initialise(GSM_Link *newlink, GSM_Statemachine *state);
81
82
83
84 #ifdef __links_fbus_3110_c  /* Prototype functions for fbus-generic.c only */
85
86 bool FB3110_OpenSerial(void);
87 void FB3110_RX_StateMachine(unsigned char rx_byte);
88 GSM_Error FB3110_TX_SendFrame(u8 message_length, u8 message_type, u8 sequence_byte, u8 *buffer);
89 GSM_Error FB3110_SendMessage(u16 messagesize, u8 messagetype, void *message);
90 void FB3110_TX_SendAck(u8 *message, int length);
91 void FB3110_UpdateSequenceNumber(void);
92
93 #endif   /* #ifdef __links_fbus_3110_c */
94
95 #endif   /* #ifndef __links_fbus_3110_h */