1 /*
2 
3   $Id$
4 
5   G N O K I I
6 
7   A Linux/Unix toolset and driver for the mobile phones.
8 
9   This file is part of gnokii.
10 
11   Gnokii is free software; you can redistribute it and/or modify
12   it under the terms of the GNU General Public License as published by
13   the Free Software Foundation; either version 2 of the License, or
14   (at your option) any later version.
15 
16   Gnokii is distributed in the hope that it will be useful,
17   but WITHOUT ANY WARRANTY; without even the implied warranty of
18   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19   GNU General Public License for more details.
20 
21   You should have received a copy of the GNU General Public License
22   along with gnokii; if not, write to the Free Software
23   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
24 
25   Copyright (C) 1999-2000 Hugh Blemings & Pavel Janik ml.
26   Copyright (C) 2001-2004 Pawel Kot
27   Copyright (C) 2002      BORBELY Zoltan, Ladis Michl
28   Copyright (C) 2003      Osma Suominen
29 
30   This file provides an API for accessing functions via fbus.
31   See README for more details on supported mobile phones.
32 
33   The various routines are called fb3110_(whatever).
34 
35 */
36 
37 #ifndef _gnokii_links_fbus_3110_h
38 #define _gnokii_links_fbus_3110_h
39 
40 #include "compat.h"
41 #include "gnokii.h"
42 
43 #ifdef WIN32
44 #  include <sys/types.h>
45 #endif
46 
47 #define FB3110_FRAME_MAX_LENGTH		256
48 #define FB3110_MESSAGE_MAX_TYPES	128
49 #define FB3110_TRANSMIT_MAX_LENGTH	256
50 #define FB3110_CONTENT_MAX_LENGTH	120
51 
52 /* Frame types (first byte of FBUS v1 frame) */
53 #define FB3110_FRAME_TYPE_OUT_CMD 0x01
54 #define FB3110_FRAME_TYPE_OUT_RLP 0x02
55 #define FB3110_FRAME_TYPE_IN_RLP  0x03
56 #define FB3110_FRAME_TYPE_IN_CMD  0x04
57 
58 /* States for receive code. */
59 
60 enum fb3110_rx_states {
61 	FB3110_RX_Sync,
62 	FB3110_RX_Discarding,
63 	FB3110_RX_GetLength,
64 	FB3110_RX_GetMessage
65 };
66 
67 typedef struct{
68 	int checksum;
69 	int buffer_count;
70 	enum fb3110_rx_states state;
71 	int frame_type;
72 	int frame_len;
73 	char buffer[FB3110_FRAME_MAX_LENGTH];
74 } fb3110_incoming_frame;
75 
76 typedef struct {
77 	u16 message_length;
78 	u8 message_type;
79 	u8 *buffer;
80 } fb3110_outgoing_message;
81 
82 
83 typedef struct{
84 	fb3110_incoming_frame i;
85 	u8 request_sequence_number;
86 	u8 last_incoming_sequence_number;
87 } fb3110_link;
88 
89 gn_error fb3110_initialise(struct gn_statemachine *state);
90 
91 #endif   /* #ifndef _gnokii_links_fbus_3110_h */
92