comparison src/g23m-aci/aci/ati_cmd.h @ 1:fa8dc04885d8

src/g23m-*: import from Magnetite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:25:50 +0000
parents
children
comparison
equal deleted inserted replaced
0:4e78acac3d88 1:fa8dc04885d8
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_NO_OUTPUT = 0,
87 ATI_BEGIN_CRLF_OUTPUT = (1 * ATI_OUTPUT_BASIC_FORMAT_START),
88 ATI_END_CRLF_OUTPUT = (2 * ATI_OUTPUT_BASIC_FORMAT_START),
89
90 ATI_ECHO_OUTPUT = (1 * ATI_OUTPUT_BASIC_TYPE_START), /* string without CR,LF */
91 ATI_NORMAL_OUTPUT = (2 * ATI_OUTPUT_BASIC_TYPE_START), /* string ends with CR,LF */
92 ATI_CONFIRM_OUTPUT = (4 * ATI_OUTPUT_BASIC_TYPE_START), /* string starts and ends with CR,LF */
93 ATI_INDICATION_OUTPUT = (8 * ATI_OUTPUT_BASIC_TYPE_START), /* string ends with CR,LF */
94
95 ATI_FORCED_OUTPUT = (1 * ATI_OUTPUT_ATTRIB_START),
96 ATI_ERROR_OUTPUT = (2 * ATI_OUTPUT_ATTRIB_START),
97 ATI_CONNECT_OUTPUT = (4 * ATI_OUTPUT_ATTRIB_START), /* buffer indications until back in CMD mode */
98
99 /* the v25ter defines two types of responses */
100 ATI_INFORMATION_TEXT_OUTPUT = (1 * ATI_OUTPUT_RESPONSE_TYPES),
101 ATI_RESULT_CODE_OUTPUT = (2 * ATI_OUTPUT_RESPONSE_TYPES)
102 } T_ATI_OUTPUT_TYPE;
103
104
105 /* send ATI output immediatly */
106 #define ATI_OUTPUT_TYPE_NORMAL 0
107 /* buffer ATI output and send when confirm output received */
108 #define ATI_OUTPUT_TYPE_LARGE 1
109
110 typedef enum
111 {
112 ATI_LINE_STATE_UNKNOWN = -1,
113 ATI_LINE_STATE_DCD,
114 ATI_LINE_STATE_RNG,
115 ATI_LINE_STATE_OUTPUT_TYPE, /* indication for output see above */
116 ATI_LINE_STATE_START,
117 ATI_LINE_STATE_END
118
119 } T_ATI_LINE_STATE_TYPE;
120
121
122 typedef enum
123 {
124 ATI_UNKN_MODE = -1,
125 ATI_CMD_MODE,
126 ATI_DATA_MODE
127 } T_ATI_IO_MODE;
128
129 typedef enum
130 {
131 CMD_IDLE = 0,
132 CMD_TYPING,
133 CMD_RUNNING
134 } T_ATI_CMD_STATE;
135
136 typedef enum
137 {
138 NO_BUFF = 0,
139 BUFF_TYPING,
140 BUFF_RUNNING
141 } T_ATI_BUFF_UNS_MODE;
142
143 typedef struct
144 {
145 CHAR *output;
146 T_ATI_OUTPUT_TYPE output_type;
147 } T_ATI_INDIC_BUFF;
148
149
150 typedef enum
151 {
152 CMD_MODE = 0,
153 TXT_MODE
154 } T_TEXT_MODE;
155
156 typedef struct
157 {
158 char *key; /* command key */
159 T_ATI_RSLT (*fnc) (char *, UBYTE srcId); /* basic command handler */
160 char *and_key; /* AND command key */
161 T_ATI_RSLT (*and_fnc) ( char *, UBYTE srcId); /* and command handler */
162 } ATCommand_bas;
163
164 typedef struct
165 {
166 CHAR *key; /* command key */
167 T_ACI_AT_CMD binKey; /* binary presentation of the cmd */
168 T_ATI_RSLT (*sfnc) (char *, UBYTE srcId); /* set command handler */
169 T_ATI_RSLT (*tfnc) (char *, UBYTE srcId); /* test command handler */
170 T_ATI_RSLT (*qfnc) (char *, UBYTE srcId); /* query command handler */
171 CHAR *output1;
172 } ATCommand;
173
174
175 typedef void T_ATI_RESULT_CB (UBYTE src_id,
176 T_ATI_OUTPUT_TYPE output_type,
177 UBYTE *output,
178 USHORT output_len);
179
180 typedef void T_ATI_LINE_STATE_CB (UBYTE src_id,
181 T_ATI_LINE_STATE_TYPE line_state_type,
182 ULONG line_state_param);
183
184 typedef struct
185 {
186 T_ATI_IO_MODE mode;
187 UBYTE src_id;
188 T_ATI_SRC_TYPE src_type;
189 T_ATI_RESULT_CB *result_cb;
190 T_ATI_LINE_STATE_CB *line_state_cb;
191 T_ATI_CMD_STATE cmd_state;
192 T_ATI_BUFF_UNS_MODE buff_uns_mode;
193 void *indication_buffer;
194 T_TEXT_MODE text_mode;
195 T_ACI_AT_CMD curAtCmd;
196 } T_ATI_SRC_PARAMS;
197
198 typedef enum
199 {
200 ATI_EXT_PART_UNKNOWN = -1,
201 ATI_EXT_PART_BEGIN, /* beginning part of a complete line */
202 ATI_EXT_PART_LINE, /* a middle part from a complete line */
203 ATI_EXT_PART_LAST, /* the last part from a complete line */
204 ATI_EXT_CMPL_LINE /* a complete line */
205 } T_ATI_EXT_FORMAT;
206
207 EXTERN BOOL search_ati_src_id (UBYTE src_id, void *elem);
208 EXTERN void init_ati (void);
209 EXTERN BOOL ati_is_src_type( UBYTE srcId, T_ATI_SRC_TYPE source_type );
210 /*
211 *
212 * AT-Command interpreter interface functions
213 *
214 */
215
216 EXTERN UBYTE ati_init (T_ATI_SRC_TYPE src_type,
217 T_ATI_RESULT_CB *result_cb,
218 T_ATI_LINE_STATE_CB *line_state_cb);
219
220 EXTERN void ati_finit (UBYTE src_id);
221
222 EXTERN T_ATI_RSLT ati_execute (UBYTE src_id, UBYTE *chars, USHORT len);
223
224 EXTERN BOOL ati_execute_config_cmd (UBYTE *chars, USHORT len);
225
226 EXTERN BOOL ati_abort (UBYTE src_id);
227
228 EXTERN T_ATI_RSLT map_aci_2_ati_rslt (T_ACI_RETURN rslt);
229 EXTERN void trace_run_cmd_line (char *prefix, UBYTE src_id, char *cmd_name, char *cmd_params);
230
231 EXTERN T_ACI_AT_CMD get_command_id (CHAR *command_str);
232 EXTERN T_ATI_RSLT sEXT_Output (UBYTE src_id, T_ATI_EXT_FORMAT output_format, CHAR *output);
233 EXTERN T_ATI_RSLT sEXT_Indication (UBYTE src_id, CHAR *indication_string);
234 EXTERN T_ATI_RSLT sEXT_Error (UBYTE src_id, T_ACI_CME_ERR err);
235 EXTERN T_ATI_RSLT sEXT_Confirm (UBYTE src_id);
236 EXTERN T_ATI_RSLT sEXT_Init (CHAR *cmd_list[]);
237 EXTERN T_ATI_RSLT sEXT_Finit ();
238
239
240
241 #if defined (SMS_PDU_SUPPORT)
242 EXTERN T_ATI_RSLT atPlusCMGSPdu ( char * cl, UBYTE srcId);
243 EXTERN T_ATI_RSLT atPlusCMGWPdu ( char * cl, UBYTE srcId);
244 EXTERN T_ATI_RSLT atPlusCMGCPdu ( char * cl, UBYTE srcId);
245 EXTERN T_ATI_RSLT atPlusCNMAPdu ( char * cl, UBYTE srcId);
246 #endif
247 #endif /* ATI_CMD_H */