comparison g23m/condat/ms/src/aci/ati_cmd.h @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:509db1a7b7b8
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul : J:\g23m-aci\aci\ati_cmd.h
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose :
18 +-----------------------------------------------------------------------------
19 */
20 #ifndef ATI_CMD_H
21 #define ATI_CMD_H
22
23 /* copied from uart.h... should always be the same as there */
24 #ifdef FF_MULTI_PORT
25 #define UART_INSTANCES FF_MULTI_PORT
26 #else /* FF_MULTI_PORT */
27 #ifdef FF_TWO_UART_PORTS
28 #define UART_INSTANCES 2
29 #ifdef _SIMULATION_
30 # define UART_DATA_CHANNEL 3
31 #else
32 # define UART_DATA_CHANNEL 4
33 #endif
34 #else /* FF_TWO_UART_PORTS */
35 #define UART_INSTANCES 1
36 #endif /* FF_TWO_UART_PORTS */
37 #endif /* FF_MULTI_PORT */
38
39 /*
40 * SKA 2002-09-05
41 * when compiling for WIN32 allow ToDo message
42 * e.g.: #pragma message( __TODO__"verbose message for engineering mode" )
43 * appears during compiling as
44 * Z:\g23m\condat\MS\SRC\ACI\ati_cmd.c(2560) : ToDo : verbose message for engineering mode
45 */
46 #ifdef _SIMULATION_
47 #define __STR2__(x) #x
48 #define __STR1__(x) __STR2__(x)
49 #define __TODO__ __FILE__ "("__STR1__(__LINE__)") : ToDo : "
50 #else
51 #define __TODO__
52 #endif
53
54
55 typedef enum
56 {
57 ATI_SRC_TYPE_UNKNOWN = -1,
58 ATI_SRC_TYPE_UART,
59 ATI_SRC_TYPE_BLUETOOTH,
60 ATI_SRC_TYPE_SAT,
61 ATI_SRC_TYPE_IRDA,
62 ATI_SRC_TYPE_LC,
63 ATI_SRC_TYPE_TST,
64 ATI_SRC_TYPE_RIV,
65 ATI_SRC_TYPE_PSI
66 } T_ATI_SRC_TYPE;
67
68 typedef enum
69 {
70 ATI_FAIL,
71 ATI_FAIL_NO_OUTPUT,
72 ATI_BUSY,
73 ATI_EXCT,
74 ATI_CMPL,
75 ATI_CMPL_NO_OUTPUT
76 } T_ATI_RSLT;
77
78 #define ATI_OUTPUT_BASIC_FORMAT_START 1 /* BIT 3 - 0 */
79 #define ATI_OUTPUT_BASIC_TYPE_START 8 /* BIT 7 - 4 */
80 #define ATI_OUTPUT_ATTRIB_START 256 /* BIT 11 - 8 */
81 #define ATI_OUTPUT_RESPONSE_TYPES 0x1000 /* BIT 12, 13 */
82
83
84 typedef enum
85 {
86 ATI_BEGIN_CRLF_OUTPUT = (1 * ATI_OUTPUT_BASIC_FORMAT_START),
87 ATI_END_CRLF_OUTPUT = (2 * ATI_OUTPUT_BASIC_FORMAT_START),
88
89 ATI_ECHO_OUTPUT = (1 * ATI_OUTPUT_BASIC_TYPE_START), /* string without CR,LF */
90 ATI_NORMAL_OUTPUT = (2 * ATI_OUTPUT_BASIC_TYPE_START), /* string ends with CR,LF */
91 ATI_CONFIRM_OUTPUT = (4 * ATI_OUTPUT_BASIC_TYPE_START), /* string starts and ends with CR,LF */
92 ATI_INDICATION_OUTPUT = (8 * ATI_OUTPUT_BASIC_TYPE_START), /* string ends with CR,LF */
93
94 ATI_FORCED_OUTPUT = (1 * ATI_OUTPUT_ATTRIB_START),
95 ATI_ERROR_OUTPUT = (2 * ATI_OUTPUT_ATTRIB_START),
96 ATI_CONNECT_OUTPUT = (4 * ATI_OUTPUT_ATTRIB_START), /* buffer indications until back in CMD mode */
97
98 /* the v25ter defines two types of responses */
99 ATI_INFORMATION_TEXT_OUTPUT = (1 * ATI_OUTPUT_RESPONSE_TYPES),
100 ATI_RESULT_CODE_OUTPUT = (2 * ATI_OUTPUT_RESPONSE_TYPES)
101 } T_ATI_OUTPUT_TYPE;
102
103
104 /* send ATI output immediatly */
105 #define ATI_OUTPUT_TYPE_NORMAL 0
106 /* buffer ATI output and send when confirm output received */
107 #define ATI_OUTPUT_TYPE_LARGE 1
108
109 typedef enum
110 {
111 ATI_LINE_STATE_UNKNOWN = -1,
112 ATI_LINE_STATE_DCD,
113 ATI_LINE_STATE_RNG,
114 ATI_LINE_STATE_OUTPUT_TYPE, /* indication for output see above */
115 ATI_LINE_STATE_START,
116 ATI_LINE_STATE_END
117
118 } T_ATI_LINE_STATE_TYPE;
119
120
121 typedef enum
122 {
123 ATI_UNKN_MODE = -1,
124 ATI_CMD_MODE,
125 ATI_DATA_MODE
126 } T_ATI_IO_MODE;
127
128 typedef enum
129 {
130 CMD_IDLE = 0,
131 CMD_TYPING,
132 CMD_RUNNING
133 } T_ATI_CMD_STATE;
134
135 typedef enum
136 {
137 NO_BUFF = 0,
138 BUFF_TYPING,
139 BUFF_RUNNING
140 } T_ATI_BUFF_UNS_MODE;
141
142 typedef struct
143 {
144 CHAR *output;
145 T_ATI_OUTPUT_TYPE output_type;
146 } T_ATI_INDIC_BUFF;
147
148
149 typedef enum
150 {
151 CMD_MODE = 0,
152 TXT_MODE
153 } T_TEXT_MODE;
154
155 typedef struct
156 {
157 char *key; /* command key */
158 T_ATI_RSLT (*fnc) (char *, UBYTE srcId); /* basic command handler */
159 char *and_key; /* AND command key */
160 T_ATI_RSLT (*and_fnc) ( char *, UBYTE srcId); /* and command handler */
161 } ATCommand_bas;
162
163 typedef struct
164 {
165 CHAR *key; /* command key */
166 T_ACI_AT_CMD binKey; /* binary presentation of the cmd */
167 T_ATI_RSLT (*sfnc) (char *, UBYTE srcId); /* set command handler */
168 T_ATI_RSLT (*tfnc) (char *, UBYTE srcId); /* test command handler */
169 T_ATI_RSLT (*qfnc) (char *, UBYTE srcId); /* query command handler */
170 CHAR *output1;
171 } ATCommand;
172
173
174 typedef void T_ATI_RESULT_CB (UBYTE src_id,
175 T_ATI_OUTPUT_TYPE output_type,
176 UBYTE *output,
177 USHORT output_len);
178
179 typedef void T_ATI_LINE_STATE_CB (UBYTE src_id,
180 T_ATI_LINE_STATE_TYPE line_state_type,
181 ULONG line_state_param);
182
183 typedef struct
184 {
185 T_ATI_IO_MODE mode;
186 UBYTE src_id;
187 T_ATI_SRC_TYPE src_type;
188 T_ATI_RESULT_CB *result_cb;
189 T_ATI_LINE_STATE_CB *line_state_cb;
190 T_ATI_CMD_STATE cmd_state;
191 T_ATI_BUFF_UNS_MODE buff_uns_mode;
192 void *indication_buffer;
193 T_TEXT_MODE text_mode;
194 T_ACI_AT_CMD curAtCmd;
195 } T_ATI_SRC_PARAMS;
196
197 typedef enum
198 {
199 ATI_EXT_PART_UNKNOWN = -1,
200 ATI_EXT_PART_BEGIN, /* beginning part of a complete line */
201 ATI_EXT_PART_LINE, /* a middle part from a complete line */
202 ATI_EXT_PART_LAST, /* the last part from a complete line */
203 ATI_EXT_CMPL_LINE /* a complete line */
204 } T_ATI_EXT_FORMAT;
205
206 EXTERN BOOL search_ati_src_id (UBYTE src_id, void *elem);
207 EXTERN void init_ati (void);
208 EXTERN BOOL ati_is_src_type( UBYTE srcId, T_ATI_SRC_TYPE source_type );
209 /*
210 *
211 * AT-Command interpreter interface functions
212 *
213 */
214
215 EXTERN UBYTE ati_init (T_ATI_SRC_TYPE src_type,
216 T_ATI_RESULT_CB *result_cb,
217 T_ATI_LINE_STATE_CB *line_state_cb);
218
219 EXTERN void ati_finit (UBYTE src_id);
220
221 EXTERN T_ATI_RSLT ati_execute (UBYTE src_id, UBYTE *chars, USHORT len);
222
223 EXTERN BOOL ati_execute_config_cmd (UBYTE *chars, USHORT len);
224
225 EXTERN BOOL ati_abort (UBYTE src_id);
226
227 EXTERN T_ATI_RSLT map_aci_2_ati_rslt (T_ACI_RETURN rslt);
228 EXTERN void trace_run_cmd_line (char *prefix, UBYTE src_id, char *cmd_name, char *cmd_params);
229
230 EXTERN T_ACI_AT_CMD get_command_id (CHAR *command_str);
231 EXTERN T_ATI_RSLT sEXT_Output (UBYTE src_id, T_ATI_EXT_FORMAT output_format, CHAR *output);
232 EXTERN T_ATI_RSLT sEXT_Indication (UBYTE src_id, CHAR *indication_string);
233 EXTERN T_ATI_RSLT sEXT_Error (UBYTE src_id, T_ACI_CME_ERR err);
234 EXTERN T_ATI_RSLT sEXT_Confirm (UBYTE src_id);
235 EXTERN T_ATI_RSLT sEXT_Init (CHAR *cmd_list[]);
236 EXTERN T_ATI_RSLT sEXT_Finit ();
237
238
239
240 #if defined (SMS_PDU_SUPPORT)
241 EXTERN T_ATI_RSLT atPlusCMGSPdu ( char * cl, UBYTE srcId);
242 EXTERN T_ATI_RSLT atPlusCMGWPdu ( char * cl, UBYTE srcId);
243 EXTERN T_ATI_RSLT atPlusCMGCPdu ( char * cl, UBYTE srcId);
244 EXTERN T_ATI_RSLT atPlusCNMAPdu ( char * cl, UBYTE srcId);
245 #endif
246 #endif /* ATI_CMD_H */