comparison src/g23m-aci/aci/aci_bat.c @ 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 : GSM-F&D (8411)
4 | Modul : ACI_BAT
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 : This Modul is the main entry point of BAT at ACI.
18 |
19 +-----------------------------------------------------------------------------
20 */
21
22 #ifndef ACI_BAT_C
23 #define ACI_BAT_C
24
25 /*==== INCLUDES ===================================================*/
26 #include "aci_all.h"
27 #include "aci_mem.h"
28 #include "aci_cmh.h"
29 #include "ati_cmd.h"
30 #include "dti.h" /* functionality of the dti library */
31
32 #include "aci.h"
33 #include "aci_lst.h"
34
35 #include "psa_psi.h"
36 #include "cmh_psi.h"
37 #include "ati_src_psi.h"
38 #include "sap_dti.h"
39 #include "psa.h"
40 #include "cmh.h"
41
42 #include "aci_bat_cmh.h"
43 #include "aci_bat.h"
44 #include "aci_bat_err.h"
45 #include "aci_bat_cb.h" /* for rBAT_OK */
46 #include "aci_bat_ext.h"
47
48 #include "l2p_types.h"
49 #include "l2p.h"
50 #include "bat_ctrl.h"
51 #include "aci_cmd.h"
52
53 #include "ati_ext_mech.h"
54
55 #ifdef _SIMULATION_
56 #include "gdd_aci.h"
57 #endif
58
59 /*==== CONSTANTS ==================================================*/
60
61 #define BAT_BIT_12 0x1000
62 #define BAT_BIT_15 0x8000
63 #define BAT_CTRL_CHANNEL 0xFE
64
65 #define MAX_NORMAL_BUFFER_LEN (100-4) /* Since Malloc uses 4 additional internal bytes of the Blocks */
66 #ifdef GPRS
67 #define MAX_LARGE_BUFFER_LEN (600-4)
68 #else
69 #define MAX_LARGE_BUFFER_LEN (400-4)
70 #endif
71
72 /* This value must always match with >>#define BAT_RCV_BUF_SIZE 800<< of bat_types.h !!! */
73 #define BAT_MTU_SIZE 800 /* %SIMEF response comes with 784 bytes. */
74
75 /*==== TYPES ======================================================*/
76 typedef struct
77 {
78 T_ACI_BAT_RSLT (*fptr)(T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_send *cmd); /* BAT wrapper func */
79 } BATCommand;
80
81 typedef struct
82 {
83 T_ACI_DTI_PRC_PSI *psi_src; /* remember which PSI source currently active */
84 BOOL l2p_configured;
85 U32 l2p_mem[(L2P_CONTROL_BLOCK_HDR_SIZE+3)/4];
86 U8 l2p_id; /* L2P calls this bat_id, for us it is a unique l2p_id */
87 } T_ACI_BAT_GLOBALS;
88
89 /*==== EXPORT =====================================================*/
90
91 /*==== VARIABLES ==================================================*/
92
93 LOCAL T_ACI_BAT_GLOBALS aci_bat_globs[CMD_SRC_MAX];
94 LOCAL BOOL aci_bat_first_time = TRUE;
95
96
97 /* basic BAT commands, which are always supported */
98 #define BAT_BAS(batFoo) {BAT_##batFoo}
99
100 /* default extended BAT commands, which are always supported
101 * c = command type --> s=set, t=test, q=query
102 */
103 #define BAT_DEF(c,batFoo) {c##BAT_##batFoo}
104
105 #ifdef FAX_AND_DATA
106 #define BAT_FAD(c,batFoo) {c##BAT_##batFoo}
107 #else
108 #define BAT_FAD(c,batFoo) {0}
109 #endif
110
111 #ifdef SIM_TOOLKIT
112 #define BAT_STK(c,batFoo) {c##BAT_##batFoo}
113 #else
114 #define BAT_STK(c,batFoo) {0}
115 #endif
116
117 #ifdef GPRS
118 #define BAT_GPR(c,batFoo) {c##BAT_##batFoo}
119 #else
120 #define BAT_GPR(c,batFoo) {0}
121 #endif
122
123 #if defined(FF_WAP) || defined(FF_TCP_IP) || defined(FF_SAT_E)
124 #define BAT_PPP(c,batFoo) {c##BAT_##batFoo}
125 #else
126 #define BAT_PPP(c,batFoo) {0}
127 #endif
128
129 #ifdef TI_PS_FF_AT_CMD_P_ECC
130 #define BAT_ECC(c,batFoo) {c##BAT_##batFoo}
131 #else
132 #define BAT_ECC(c,batFoo) {0}
133 #endif /* TI_PS_FF_AT_CMD_P_ECC */
134
135 #ifdef SIM_PERS
136 #define BAT_SLK(c,batFoo) {c##BAT_##batFoo}
137 #else
138 #define BAT_SLK(c,batFoo) {0}
139 #endif /* SIM_PERS */
140
141 /*
142 * all the set commands are in range of 0x0000..0x0nnn
143 * T_BAT_ctrl_params types is used as index to the table
144 */
145 #ifdef _SIMULATION_
146 #pragma message( __TODO__"Currently No Support for Wide Chars !" )
147 #endif
148 /* expand the macro by hand: BAT_DEF(s,PercentALS) --> sBAT_PercentALS */
149 LOCAL const BATCommand bat_cmds [] =
150 {
151 BAT_DEF(s,PercentALS), /* BAT_CMD_SET_PERCENT_ALS = 0x0 */
152 BAT_DEF(s,PercentBAND), /* BAT_CMD_SET_PERCENT_BAND = 0x1 */
153 BAT_BAS(ANDC), /* BAT_CMD_ANDC = 0x2 */
154 BAT_DEF(s,PlusCACM), /* BAT_CMD_SET_PLUS_CACM = 0x3 */
155 BAT_DEF(s,PlusCAMM), /* BAT_CMD_SET_PLUS_CAMM = 0x4 */
156 BAT_DEF(s,PlusCAOC), /* BAT_CMD_SET_PLUS_CAOC = 0x5 */
157 BAT_DEF(s,PercentCBHZ), /* BAT_CMD_SET_PERCENT_CBHZ = 0x6 */
158 #ifdef FAX_AND_DATA
159 BAT_DEF(s,PlusCBST), /* BAT_CMD_SET_PLUS_CBST = 0x7 */
160 #else
161 {NULL},
162 #endif /* FAX_AND_DATA */
163 BAT_DEF(s,PercentCCBS), /* BAT_CMD_SET_PERCENT_CCBS = 0x8 */
164 BAT_DEF(s,PlusCCFC), /* BAT_CMD_SET_PLUS_CCFC = 0x9 */
165 BAT_DEF(s,PlusCCLK), /* BAT_CMD_SET_PLUS_CCLK = 0xa */
166 BAT_DEF(s,PlusCCUG), /* BAT_CMD_SET_PLUS_CCUG = 0xb */
167 BAT_DEF(s,PlusCCWA), /* BAT_CMD_SET_PLUS_CCWA = 0xc */
168 BAT_DEF(s,PlusCCWA), /* BAT_CMD_SET_PLUS_CCWA_W = 0xd */
169 BAT_DEF(s,PlusCFUN), /* BAT_CMD_SET_PLUS_CFUN = 0xe */
170 BAT_GPR(s,PercentCGAATT), /* BAT_CMD_SET_PERCENT_CGAATT = 0xf */
171 BAT_GPR(s,PlusCGACT), /* BAT_CMD_SET_PLUS_CGACT = 0x10 */
172 BAT_GPR(s,PlusCGANS), /* BAT_CMD_SET_PLUS_CGANS = 0x11 */
173 BAT_GPR(s,PlusCGATT), /* BAT_CMD_SET_PLUS_CGATT = 0x12 */
174 BAT_GPR(s,PercentCGCLASS), /* BAT_CMD_SET_PERCENT_CGCLASS = 0x13 */
175 BAT_GPR(s,PlusCGCLASS), /* BAT_CMD_SET_PLUS_CGCLASS = 0x14 */
176 BAT_GPR(s,PlusCGDATA), /* BAT_CMD_SET_PLUS_CGDATA = 0x15 */
177 BAT_GPR(s,PlusCGDCONT), /* BAT_CMD_SET_PLUS_CGDCONT = 0x16 */
178 BAT_GPR(s,PercentCGMM), /* BAT_CMD_SET_PERCENT_CGMM = 0x17 */
179 BAT_GPR(s,PlusCGPADDR), /* BAT_CMD_SET_PLUS_CGPADDR = 0x18 */
180 BAT_GPR(s,PercentCGPCO), /* BAT_CMD_SET_PERCENT_CGPCO = 0x19 */
181 BAT_GPR(s,PercentCGPPP), /* BAT_CMD_SET_PERCENT_CGPPP = 0x1a */
182 BAT_GPR(s,PlusCGQMIN), /* BAT_CMD_SET_PLUS_CGQMIN = 0x1b */
183 BAT_GPR(s,PlusCGQREQ), /* BAT_CMD_SET_PLUS_CGQREQ = 0x1c */
184 BAT_GPR(s,PlusCGSMS), /* BAT_CMD_SET_PLUS_CGSMS = 0x1d */
185 BAT_DEF(s,PercentCHLD), /* BAT_CMD_SET_PERCENT_CHLD = 0x1e */
186 BAT_DEF(s,PercentCHPL), /* BAT_CMD_SET_PERCENT_CHPL = 0x1f */
187 BAT_DEF(s,PercentCHPL), /* BAT_CMD_SET_PERCENT_CHPL_W = 0x20 */
188 BAT_DEF(s,PlusCIND), /* BAT_CMD_SET_PLUS_CIND = 0x21 */
189 BAT_DEF(s,PlusCLAN), /* BAT_CMD_SET_PLUS_CLAN = 0x22 */
190 BAT_DEF(s,PlusCLCK), /* BAT_CMD_SET_PLUS_CLCK = 0x23 */
191 BAT_DEF(s,PlusCLIR), /* BAT_CMD_SET_PLUS_CLIR = 0x24 */
192 BAT_DEF(s,PlusCLVL), /* BAT_CMD_SET_PLUS_CLVL = 0x25 */
193 BAT_DEF(s,PlusCMER), /* BAT_CMD_SET_PLUS_CMER = 0x26 */
194 BAT_DEF(s,PlusCMGC), /* BAT_CMD_SET_PLUS_CMGC = 0x27 */
195 BAT_DEF(s,PlusCMGD), /* BAT_CMD_SET_PLUS_CMGD = 0x28 */
196 BAT_DEF(s,PlusCMGL), /* BAT_CMD_SET_PLUS_CMGL = 0x29 */
197 BAT_DEF(s,PlusCMGL), /* BAT_CMD_SET_PLUS_CMGL_W = 0x2a */
198 BAT_DEF(s,PlusCMGR), /* BAT_CMD_SET_PLUS_CMGR = 0x2b */
199 BAT_DEF(s,PlusCMGR), /* BAT_CMD_SET_PLUS_CMGR_W = 0x2c */
200 BAT_DEF(s,PlusCMGS), /* BAT_CMD_SET_PLUS_CMGS = 0x2d */
201 BAT_DEF(s,PlusCMGW), /* BAT_CMD_SET_PLUS_CMGW = 0x2e */
202 BAT_DEF(s,PlusCMOD), /* BAT_CMD_SET_PLUS_CMOD = 0x2f */
203 BAT_DEF(s,PlusCMSS), /* BAT_CMD_SET_PLUS_CMSS = 0x30 */
204 BAT_DEF(s,PlusCMUT), /* BAT_CMD_SET_PLUS_CMUT = 0x31 */
205 BAT_DEF(s,PlusCMUX), /* BAT_CMD_SET_PLUS_CMUX = 0x32 */
206 BAT_DEF(s,PlusCNMA), /* BAT_CMD_SET_PLUS_CNMA = 0x33 */
207 BAT_DEF(s,PlusCNMI), /* BAT_CMD_SET_PLUS_CNMI = 0x34 */
208 BAT_DEF(s,PercentCOPS), /* BAT_CMD_SET_PERCENT_COPS = 0x35 */
209 BAT_DEF(s,PlusCOPS), /* BAT_CMD_SET_PLUS_COPS = 0x36 */
210 BAT_DEF(s,PercentCOPS), /* BAT_CMD_SET_PERCENT_COPS_W = 0x37 */
211 #ifdef FF_CPHS
212 BAT_DEF(s,PercentCPALS), /* BAT_CMD_SET_PERCENT_CPALS = 0x38 */
213 BAT_DEF(s,PercentCPALS), /* BAT_CMD_SET_PERCENT_CPALS_W = 0x39 */
214 #endif
215 BAT_DEF(s,PlusCPBF), /* BAT_CMD_SET_PLUS_CPBF = 0x3a */
216 BAT_DEF(s,PlusCPBF), /* BAT_CMD_SET_PLUS_CPBF_W = 0x3b */
217 BAT_DEF(s,PlusCPBR), /* BAT_CMD_SET_PLUS_CPBR = 0x3c */
218 BAT_DEF(s,PlusCPBR), /* BAT_CMD_SET_PLUS_CPBR_W = 0x3d */
219 BAT_DEF(s,PlusCPBS), /* BAT_CMD_SET_PLUS_CPBS = 0x3e */
220 BAT_DEF(s,PlusCPBW), /* BAT_CMD_SET_PLUS_CPBW = 0x3f */
221 BAT_DEF(s,PlusCPBW), /* BAT_CMD_SET_PLUS_CPBW_W = 0x40 */
222 #ifdef FF_CPHS
223 BAT_DEF(s,PercentCPCFU), /* BAT_CMD_SET_PERCENT_CPCFU = 0x41 */
224 BAT_DEF(s,PercentCPHS), /* BAT_CMD_SET_PERCENT_CPHS = 0x42 */
225 #endif
226 BAT_DEF(s,PlusCPIN), /* BAT_CMD_SET_PLUS_CPIN = 0x43 */
227 #ifdef FF_CPHS
228 BAT_DEF(s,PercentCPMB), /* BAT_CMD_SET_PERCENT_CPMB = 0x44 */
229 BAT_DEF(s,PercentCPMBW), /* BAT_CMD_SET_PERCENT_CPMBW = 0x45 */
230 BAT_DEF(s,PercentCPMBW), /* BAT_CMD_SET_PERCENT_CPMBW_W = 0x46 */
231 BAT_DEF(s,PercentCPMB), /* BAT_CMD_SET_PERCENT_CPMB_W = 0x47 */
232 #endif
233 BAT_DEF(s,PlusCPMS), /* BAT_CMD_SET_PLUS_CPMS = 0x48 */
234 #ifdef FF_CPHS
235 BAT_DEF(s,PercentCPNUMS), /* BAT_CMD_SET_PERCENT_CPNUMS = 0x49 */
236 BAT_DEF(s,PercentCPNUMS), /* BAT_CMD_SET_PERCENT_CPNUMS_W = 0x4a */
237 #endif
238 BAT_DEF(s,PlusCPOL), /* BAT_CMD_SET_PLUS_CPOL = 0x4b */
239 BAT_DEF(s,PlusCPOL), /* BAT_CMD_SET_PLUS_CPOL_W = 0x4c */
240 #ifdef TI_PS_FF_AT_P_CMD_CPRSM
241 BAT_DEF(s,PercentCPRSM), /* BAT_CMD_SET_PERCENT_CPRSM = 0x4d */
242 #else
243 {NULL},
244 #endif /* TI_PS_FF_AT_P_CMD_CPRSM */
245 BAT_DEF(s,PlusCPUC), /* BAT_CMD_SET_PLUS_CPUC = 0x4e */
246 BAT_DEF(s,PlusCPUC), /* BAT_CMD_SET_PLUS_CPUC_W = 0x4f */
247 #ifdef FF_CPHS
248 BAT_DEF(s,PercentCPVWI), /* BAT_CMD_SET_PERCENT_CPVWI = 0x50 */
249 #endif
250 BAT_DEF(s,PlusCPWD), /* BAT_CMD_SET_PLUS_CPWD = 0x51 */
251 BAT_DEF(s,PlusCRES), /* BAT_CMD_SET_PLUS_CRES = 0x52 */
252 BAT_DEF(s,PlusCRLP), /* BAT_CMD_SET_PLUS_CRLP = 0x53 */
253 BAT_DEF(s,PlusCRSM), /* BAT_CMD_SET_PLUS_CRSM = 0x54 */
254 BAT_DEF(s,PlusCSAS), /* BAT_CMD_SET_PLUS_CSAS = 0x55 */
255 BAT_DEF(s,PlusCSCA), /* BAT_CMD_SET_PLUS_CSCA = 0x56 */
256 BAT_DEF(s,PlusCSCB), /* BAT_CMD_SET_PLUS_CSCB = 0x57 */
257 BAT_DEF(s,PlusCSCS), /* BAT_CMD_SET_PLUS_CSCS = 0x58 */
258 BAT_DEF(s,PlusCSIM), /* BAT_CMD_SET_PLUS_CSIM = 0x59 */
259 BAT_DEF(s,PlusCSMS), /* BAT_CMD_SET_PLUS_CSMS = 0x5a */
260 BAT_DEF(s,PlusCSNS), /* BAT_CMD_SET_PLUS_CSNS = 0x5b */
261 BAT_DEF(s,PlusCSTA), /* BAT_CMD_SET_PLUS_CSTA = 0x5c */
262 BAT_DEF(s,PlusCSVM), /* BAT_CMD_SET_PLUS_CSVM = 0x5d */
263 BAT_DEF(s,PlusCTFR), /* BAT_CMD_SET_PLUS_CTFR = 0x5e */
264 BAT_DEF(s,PercentCTTY), /* BAT_CMD_SET_PERCENT_CTTY = 0x5f */
265 BAT_DEF(s,PlusCTZU), /* BAT_CMD_SET_PLUS_CTZU = 0x60 */
266 BAT_DEF(s,PlusCUSD), /* BAT_CMD_SET_PLUS_CUSD = 0x61 */
267 BAT_DEF(s,PlusCUSD), /* BAT_CMD_SET_PLUS_CUSD_W = 0x62 */
268 #ifdef TI_PS_FF_AT_P_CMD_CUST
269 BAT_DEF(s,PercentCUST), /* BAT_CMD_SET_PERCENT_CUST = 0x63 */
270 #else
271 {NULL},
272 #endif /* TI_PS_FF_AT_P_CMD_CUST */
273 BAT_DEF(s,PercentCWUP), /* BAT_CMD_SET_PERCENT_CWUP = 0x64 */
274 BAT_BAS(D), /* BAT_CMD_AT_D = 0x65 */
275 BAT_DEF(s,PercentDATA), /* BAT_CMD_SET_PERCENT_DATA = 0x66 */
276 BAT_DEF(s,PercentDINF), /* BAT_CMD_SET_PERCENT_DINF = 0x67 */
277 BAT_DEF(s,PlusDS), /* BAT_CMD_SET_PLUS_DS = 0x68 */
278 BAT_BAS(D), /* BAT_CMD_AT_D_W = 0x69 */
279 BAT_DEF(s,PercentEFRSLT), /* BAT_CMD_SET_PERCENT_EFRSLT = 0x6a */
280 BAT_DEF(s,PercentEM), /* BAT_CMD_SET_PERCENT_EM = 0x6b */
281 BAT_FAD(s,PlusFAP), /* BAT_CMD_SET_PLUS_FAP = 0x6c */
282 BAT_FAD(s,PlusFBO), /* BAT_CMD_SET_PLUS_FBO = 0x6d */
283 BAT_FAD(s,PlusFBU), /* BAT_CMD_SET_PLUS_FBU = 0x6e */
284 BAT_FAD(s,PlusFCC), /* BAT_CMD_SET_PLUS_FCC = 0x6f */
285 BAT_FAD(s,PlusFCLASS), /* BAT_CMD_SET_PLUS_FCLASS = 0x70 */
286 BAT_FAD(s,PlusFCQ), /* BAT_CMD_SET_PLUS_FCQ = 0x71 */
287 BAT_FAD(s,PlusFCR), /* BAT_CMD_SET_PLUS_FCR = 0x72 */
288 BAT_FAD(s,PlusFCT), /* BAT_CMD_SET_PLUS_FCT = 0x73 */
289 BAT_FAD(s,PlusFEA), /* BAT_CMD_SET_PLUS_FEA = 0x74 */
290 BAT_FAD(s,PlusFFC), /* BAT_CMD_SET_PLUS_FFC = 0x75 */
291 BAT_FAD(s,PlusFIE), /* BAT_CMD_SET_PLUS_FIE = 0x76 */
292 BAT_FAD(s,PlusFIS), /* BAT_CMD_SET_PLUS_FIS = 0x77 */
293 BAT_FAD(s,PlusFIT), /* BAT_CMD_SET_PLUS_FIT = 0x78 */
294 BAT_FAD(s,PlusFLI), /* BAT_CMD_SET_PLUS_FLI = 0x79 */
295 BAT_FAD(s,PlusFLO), /* BAT_CMD_SET_PLUS_FLO = 0x7a */
296 BAT_FAD(s,PlusFLP), /* BAT_CMD_SET_PLUS_FLP = 0x7b */
297 BAT_FAD(s,PlusFMS), /* BAT_CMD_SET_PLUS_FMS = 0x7c */
298 BAT_FAD(s,PlusFNS), /* BAT_CMD_SET_PLUS_FNS = 0x7d */
299 BAT_FAD(s,PlusFPA), /* BAT_CMD_SET_PLUS_FPA = 0x7e */
300 BAT_FAD(s,PlusFPI), /* BAT_CMD_SET_PLUS_FPI = 0x7f */
301 BAT_FAD(s,PlusFPS), /* BAT_CMD_SET_PLUS_FPS = 0x80 */
302 BAT_FAD(s,PlusFPW), /* BAT_CMD_SET_PLUS_FPW = 0x81 */
303 BAT_FAD(s,PlusFRQ), /* BAT_CMD_SET_PLUS_FRQ = 0x82 */
304 BAT_FAD(s,PlusFSA), /* BAT_CMD_SET_PLUS_FSA = 0x83 */
305 BAT_FAD(s,PlusFSP), /* BAT_CMD_SET_PLUS_FSP = 0x84 */
306 BAT_DEF(s,PlusICF), /* BAT_CMD_SET_PLUS_ICF = 0x85 */
307 BAT_DEF(s,PlusIFC), /* BAT_CMD_SET_PLUS_IFC = 0x86 */
308 BAT_DEF(s,PlusIPR), /* BAT_CMD_SET_PLUS_IPR = 0x87 */
309 BAT_DEF(s,PercentPBCF), /* BAT_CMD_SET_PERCENT_PBCF = 0x88 */
310 BAT_PPP(s,PercentPPP), /* BAT_CMD_SET_PERCENT_PPP = 0x89 */
311 BAT_DEF(s,PercentPVRF), /* BAT_CMD_SET_PERCENT_PVRF = 0x8a */
312 BAT_DEF(s,PercentRDL), /* BAT_CMD_SET_PERCENT_RDL = 0x8b */
313 #ifdef TI_PS_FF_AT_P_CMD_RDLB
314 BAT_DEF(s,PercentRDLB), /* BAT_CMD_SET_PERCENT_RDLB = 0x8c */
315 #else
316 {NULL},
317 #endif /* TI_PS_FF_AT_P_CMD_RDLB */
318 BAT_STK(s,PercentSATC), /* BAT_CMD_SET_PERCENT_SATC = 0x8d */
319 BAT_STK(s,PercentSATCC), /* BAT_CMD_SET_PERCENT_SATCC = 0x8e */
320 BAT_STK(s,PercentSATE), /* BAT_CMD_SET_PERCENT_SATE = 0x8f */
321 BAT_STK(s,PercentSATR), /* BAT_CMD_SET_PERCENT_SATR = 0x80 */
322 BAT_STK(s,PercentSATT), /* BAT_CMD_SET_PERCENT_SATT = 0x91 */
323 BAT_GPR(s,PercentSNCNT), /* BAT_CMD_SET_PERCENT_SNCNT = 0x92 */
324 BAT_DEF(s,PercentVTS), /* BAT_CMD_SET_PERCENT_VTS = 0x93 */
325 BAT_DEF(s,PlusVTS), /* BAT_CMD_SET_PLUS_VTS = 0x94 */
326 #ifdef TI_PS_FF_AT_CMD_WS46
327 BAT_DEF(s,PlusWS46), /* BAT_CMD_SET_PLUS_WS46 = 0x95 */
328 #else
329 {NULL},
330 #endif /* TI_PS_FF_AT_CMD_WS46 */
331 #ifdef FF_CPHS
332 BAT_DEF(s,PercentCPINF), /* BAT_CMD_SET_PERCENT_CPINF = 0x96 */
333 #endif
334 BAT_DEF(s,PercentCMGR), /* BAT_CMD_SET_PERCENT_CMGR = 0x97 */
335 BAT_DEF(s,PercentCMGL), /* BAT_CMD_SET_PERCENT_CMGL = 0x98 */
336 BAT_DEF(s,PercentCTZV), /* BAT_CMD_SET_PERCENT_CTZV = 0x99 */
337 BAT_DEF(s,PercentECC), /* BAT_CMD_SET_PERCENT_ECC = 0x9a */
338 BAT_SLK(s,PercentMEPD), /* BAT_CMD_SET_PERCENT_MEPD = 0x9b */
339 BAT_DEF(s,PercentCSQ), /* BAT_CMD_SET_PERCENT_CSQ = 0x9c */
340 BAT_DEF(s,PercentCNIV), /* BAT_CMD_SET_PERCENT_CNIV = 0x9d */
341 #ifdef REL99
342 BAT_DEF(s,PercentCMGRS), /* BAT_CMD_SET_PERCENT_CMGRS = 0x9e */
343 BAT_GPR(s,PlusCGCMOD), /* BAT_CMD_SET_PLUS_CGDSCONT = 0x9f */
344 BAT_GPR(s,PlusCGDSCONT), /* BAT_CMD_SET_PLUS_CGDSCONT = 0xA0 */
345 BAT_GPR(s,PlusCGEQREQ), /* BAT_CMD_SET_PLUS_CGEQREQ = 0xA1 */
346 BAT_GPR(s,PlusCGEQMIN), /* BAT_CMD_SET_PLUS_CGEQMIN = 0xA2 */
347 BAT_GPR(s,PlusCGEQNEG), /* BAT_CMD_SET_PLUS_CGEQNEG = 0xA3 */
348 BAT_GPR(s,PlusCGTFT), /* BAT_CMD_SET_PLUS_CGTFT = 0xA4 */
349 #endif
350 BAT_DEF(s,PercentSIMEF) /* BAT_CMD_SET_PERCENT_SIMEF = 0xA7 */
351 };
352
353 LOCAL const BATCommand bat_cmds_without_params [] =
354 {
355 BAT_BAS(A), /* BAT_CMD_AT_A = 0x1000 */
356 BAT_DEF(s,PlusCBC), /* BAT_CMD_SET_PLUS_CBC = 0x1001 */
357 BAT_DEF(s,PlusCEER), /* BAT_CMD_SET_PLUS_CEER = 0x1002 */
358 BAT_DEF(s,PlusCIMI), /* BAT_CMD_SET_PLUS_CIMI = 0x1003 */
359 BAT_DEF(s,PlusCNUM), /* BAT_CMD_SET_PLUS_CNUM = 0x1004 */
360 BAT_DEF(s,PlusCNUM), /* BAT_CMD_SET_PLUS_CNUM_W = 0x1005 */
361 BAT_DEF(s,PlusCPAS), /* BAT_CMD_SET_PLUS_CPAS = 0x1006 */
362 BAT_DEF(s,PlusCSQ), /* BAT_CMD_SET_PLUS_CSQ = 0x1007 */
363 BAT_BAS(ANDF), /* BAT_CMD_ANDF = 0x1008 */
364 BAT_BAS(H), /* BAT_CMD_AT_H = 0x1009 */
365 BAT_BAS(O), /* BAT_CMD_AT_O = 0x100a */
366 BAT_BAS(Z), /* BAT_CMD_AT_Z = 0x100b */
367 BAT_DEF(q,PercentALS), /* BAT_CMD_QUE_PERCENT_ALS = 0x100c */
368 BAT_DEF(t,PercentALS), /* BAT_CMD_TST_PERCENT_ALS = 0x100d */
369 #ifdef TI_PS_FF_AT_P_CMD_ATR
370 BAT_DEF(q,PercentATR), /* BAT_CMD_QUE_PERCENT_ATR = 0x100e */
371 #else
372 {NULL},
373 #endif /* TI_PS_FF_AT_P_CMD_ATR */
374 BAT_DEF(q,PercentBAND), /* BAT_CMD_QUE_PERCENT_BAND = 0x100f */
375 BAT_DEF(t,PercentBAND), /* BAT_CMD_TST_PERCENT_BAND = 0x1010 */
376 BAT_DEF(q,PlusCACM), /* BAT_CMD_QUE_PLUS_CACM = 0x1011 */
377 BAT_DEF(q,PlusCAMM), /* BAT_CMD_QUE_PLUS_CAMM = 0x1012 */
378 BAT_DEF(q,PercentCBHZ), /* BAT_CMD_QUE_PERCENT_CBHZ = 0x1013 */
379 BAT_DEF(t,PercentCBHZ), /* BAT_CMD_TST_PERCENT_CBHZ = 0x1014 */
380 #ifdef FAX_AND_DATA
381 BAT_DEF(q,PlusCBST), /* BAT_CMD_QUE_PLUS_CBST = 0x1015 */
382 #else
383 {NULL},
384 #endif /* FAX_AND_DATA */
385 BAT_DEF(q,PercentCCBS), /* BAT_CMD_QUE_PERCENT_CCBS = 0x1016 */
386 BAT_DEF(q,PlusCCLK), /* BAT_CMD_QUE_PLUS_CCLK = 0x1017 */
387 BAT_DEF(q,PlusCCUG), /* BAT_CMD_QUE_PLUS_CCUG = 0x1018 */
388 BAT_DEF(q,PlusCFUN), /* BAT_CMD_QUE_PLUS_CFUN = 0x1019 */
389 BAT_GPR(q,PercentCGAATT), /* BAT_CMD_QUE_PERCENT_CGAATT = 0x101a */
390 BAT_GPR(q,PlusCGACT), /* BAT_CMD_QUE_PLUS_CGACT = 0x101b */
391 BAT_GPR(q,PlusCGATT), /* BAT_CMD_QUE_PLUS_CGATT = 0x101c */
392 BAT_GPR(q,PercentCGCLASS), /* BAT_CMD_QUE_PERCENT_CGCLASS = 0x101d */
393 BAT_GPR(q,PlusCGCLASS), /* BAT_CMD_QUE_PLUS_CGCLASS = 0x101e */
394 BAT_GPR(q,PlusCGDCONT), /* BAT_CMD_QUE_PLUS_CGDCONT = 0x101f */
395 BAT_GPR(t,PlusCGPADDR), /* BAT_CMD_TST_PLUS_CGPADDR = 0x1020 */
396 BAT_GPR(q,PercentCGPPP), /* BAT_CMD_QUE_PERCENT_CGPPP = 0x1021 */
397 BAT_GPR(q,PlusCGQMIN), /* BAT_CMD_QUE_PLUS_CGQMIN = 0x1022 */
398 BAT_GPR(q,PlusCGQREQ), /* BAT_CMD_QUE_PLUS_CGQREQ = 0x1023 */
399 BAT_GPR(q,PercentCGREG), /* BAT_CMD_QUE_PERCENT_CGREG = 0x1024 */
400 BAT_GPR(q,PlusCGREG), /* BAT_CMD_QUE_PLUS_CGREG = 0x1025 */
401 BAT_GPR(q,PlusCGSMS), /* BAT_CMD_QUE_PLUS_CGSMS = 0x1026 */
402 BAT_DEF(q,PlusCIND), /* BAT_CMD_QUE_PLUS_CIND = 0x1027 */
403 BAT_DEF(q,PlusCLAN), /* BAT_CMD_QUE_PLUS_CLAN = 0x1028 */
404 BAT_DEF(t,PlusCLAN), /* BAT_CMD_TST_PLUS_CLAN = 0x1029 */
405 BAT_DEF(q,PlusCLCC), /* BAT_CMD_QUE_PLUS_CLCC = 0x102a */
406 BAT_DEF(q,PlusCLIP), /* BAT_CMD_QUE_PLUS_CLIP = 0x102b */
407 BAT_DEF(q,PlusCLIP), /* BAT_CMD_QUE_PLUS_CLIP_W = 0x102c */
408 BAT_DEF(q,PlusCLIR), /* BAT_CMD_QUE_PLUS_CLIR = 0x102d */
409 BAT_DEF(q,PlusCLVL), /* BAT_CMD_QUE_PLUS_CLVL = 0x102e */
410 BAT_DEF(q,PlusCMER), /* BAT_CMD_QUE_PLUS_CMER = 0x102f */
411 BAT_DEF(q,PlusCMOD), /* BAT_CMD_QUE_PLUS_CMOD = 0x1030 */
412 BAT_DEF(q,PlusCMUT), /* BAT_CMD_QUE_PLUS_CMUT = 0x1031 */
413 BAT_DEF(q,PlusCMUX), /* BAT_CMD_QUE_PLUS_CMUX = 0x1032 */
414 BAT_DEF(q,PercentCNAP), /* BAT_CMD_QUE_PERCENT_CNAP = 0x1033 */
415 BAT_DEF(q,PlusCNMI), /* BAT_CMD_QUE_PLUS_CNMI = 0x1034 */
416 BAT_DEF(q,PlusCOLP), /* BAT_CMD_QUE_PLUS_COLP = 0x1035 */
417 BAT_DEF(q,PlusCOLP), /* BAT_CMD_QUE_PLUS_COLP_W = 0x1036 */
418 BAT_DEF(q,PercentCOPS), /* BAT_CMD_QUE_PERCENT_COPS = 0x1037 */
419 BAT_DEF(t,PercentCOPS), /* BAT_CMD_TST_PERCENT_COPS = 0x1038 */
420 BAT_DEF(q,PlusCOPS), /* BAT_CMD_QUE_PLUS_COPS = 0x1039 */
421 BAT_DEF(t,PlusCOPS), /* BAT_CMD_TST_PLUS_COPS = 0x103a */
422 BAT_DEF(q,PercentCOPS), /* BAT_CMD_QUE_PERCENT_COPS_W = 0x103b */
423 BAT_DEF(t,PercentCOPS), /* BAT_CMD_TST_PERCENT_COPS_W = 0x103c */
424 #ifdef FF_CPHS
425 BAT_DEF(q,PercentCPALS), /* BAT_CMD_QUE_PERCENT_CPALS = 0x103d */
426 BAT_DEF(q,PercentCPALS), /* BAT_CMD_QUE_PERCENT_CPALS_W = 0x103e */
427 #endif
428 BAT_DEF(t,PlusCPBF), /* BAT_CMD_TST_PLUS_CPBF = 0x103f */
429 BAT_DEF(t,PlusCPBF), /* BAT_CMD_TST_PLUS_CPBF_W = 0x1040 */
430 BAT_DEF(t,PlusCPBR), /* BAT_CMD_TST_PLUS_CPBR = 0x1041 */
431 BAT_DEF(t,PlusCPBR), /* BAT_CMD_TST_PLUS_CPBR_W = 0x1042 */
432 BAT_DEF(q,PercentCPBS), /* BAT_CMD_QUE_PERCENT_CPBS = 0x1043 */
433 BAT_DEF(q,PlusCPBS), /* BAT_CMD_QUE_PLUS_CPBS = 0x1044 */
434 BAT_DEF(t,PlusCPBW), /* BAT_CMD_TST_PLUS_CPBW = 0x1045 */
435 BAT_DEF(t,PlusCPBW), /* BAT_CMD_TST_PLUS_CPBW_W = 0x1046 */
436 #ifdef FF_CPHS //fix x0083023
437 BAT_DEF(q,PercentCPHS), /* BAT_CMD_QUE_PERCENT_CPHS = 0x1047 */
438 #endif
439 BAT_DEF(q,PlusCPIN), /* BAT_CMD_QUE_PLUS_CPIN = 0x1048 */
440 #ifdef FF_CPHS
441 BAT_DEF(q,PercentCPINF), /* BAT_CMD_QUE_PERCENT_CPINF = 0x1049 */
442 BAT_DEF(q,PercentCPMB), /* BAT_CMD_QUE_PERCENT_CPMB = 0x104a */
443 BAT_DEF(t,PercentCPMBW), /* BAT_CMD_TST_PERCENT_CPMBW = 0x104b */
444 BAT_DEF(t,PercentCPMBW), /* BAT_CMD_TST_PERCENT_CPMBW_W = 0x104c */
445 #endif
446 BAT_DEF(q,PlusCPMS), /* BAT_CMD_QUE_PLUS_CPMS = 0x104d */
447 #ifdef FF_CPHS
448 BAT_DEF(t,PercentCPNUMS), /* BAT_CMD_TST_PERCENT_CPNUMS = 0x104e */
449 BAT_DEF(t,PercentCPNUMS), /* BAT_CMD_TST_PERCENT_CPNUMS_W = 0x104f */
450 #endif
451 BAT_DEF(q,PlusCPOL), /* BAT_CMD_QUE_PLUS_CPOL = 0x1050 */
452 BAT_DEF(t,PlusCPOL), /* BAT_CMD_TST_PLUS_CPOL = 0x1051 */
453 BAT_DEF(q,PlusCPOL), /* BAT_CMD_QUE_PLUS_CPOL_W = 0x1052 */
454 BAT_DEF(t,PlusCPOL), /* BAT_CMD_TST_PLUS_CPOL_W = 0x1053 */
455 #ifdef FF_CPHS
456 BAT_DEF(q,PercentCPOPN), /* BAT_CMD_QUE_PERCENT_CPOPN = 0x1054 */
457 #endif
458 #ifdef TI_PS_FF_AT_P_CMD_CPRSM
459 BAT_DEF(q,PercentCPRSM), /* BAT_CMD_QUE_PERCENT_CPRSM = 0x1055 */
460 #else
461 {NULL},
462 #endif /* TI_PS_FF_AT_P_CMD_CPRSM */
463 BAT_DEF(q,PlusCPUC), /* BAT_CMD_QUE_PLUS_CPUC = 0x1056 */
464 BAT_DEF(q,PlusCPUC), /* BAT_CMD_QUE_PLUS_CPUC_W = 0x1057 */
465 BAT_DEF(q,PercentCREG), /* BAT_CMD_QUE_PERCENT_CREG = 0x1058 */
466 BAT_DEF(t,PlusCRES), /* BAT_CMD_TST_PLUS_CRES = 0x1059 */
467 BAT_DEF(q,PlusCRLP), /* BAT_CMD_QUE_PLUS_CRLP = 0x105a */
468 BAT_DEF(t,PlusCSAS), /* BAT_CMD_TST_PLUS_CSAS = 0x105b */
469 BAT_DEF(q,PlusCSCA), /* BAT_CMD_QUE_PLUS_CSCA = 0x105c */
470 BAT_DEF(q,PlusCSCB), /* BAT_CMD_QUE_PLUS_CSCB = 0x105d */
471 BAT_DEF(q,PlusCSCS), /* BAT_CMD_QUE_PLUS_CSCS = 0x105e */
472 BAT_DEF(q,PlusCSMS), /* BAT_CMD_QUE_PLUS_CSMS = 0x105f */
473 BAT_DEF(q,PlusCSNS), /* BAT_CMD_QUE_PLUS_CSNS = 0x1060 */
474 BAT_DEF(q,PercentCSQ), /* BAT_CMD_QUE_PERCENT_CSQ = 0x1061 */
475 BAT_DEF(q,PlusCSTA), /* BAT_CMD_QUE_PLUS_CSTA = 0x1062 */
476 BAT_DEF(q,PlusCSVM), /* BAT_CMD_QUE_PLUS_CSVM = 0x1063 */
477 BAT_DEF(q,PercentCTTY), /* BAT_CMD_QUE_PERCENT_CTTY = 0x1064 */
478 BAT_DEF(q,PlusCTZU), /* BAT_CMD_QUE_PLUS_CTZU = 0x1065 */
479 #ifdef TI_PS_FF_AT_P_CMD_CUST
480 BAT_DEF(q,PercentCUST), /* BAT_CMD_QUE_PERCENT_CUST = 0x1066 */
481 #else
482 {NULL},
483 #endif /* TI_PS_FF_AT_P_CMD_CUST */
484 BAT_DEF(q,PercentDATA), /* BAT_CMD_QUE_PERCENT_DATA = 0x1067 */
485 BAT_DEF(q,PlusDS), /* BAT_CMD_QUE_PLUS_DS = 0x1068 */
486 BAT_FAD(q,PlusFAP), /* BAT_CMD_QUE_PLUS_FAP = 0x1069 */
487 BAT_FAD(q,PlusFBO), /* BAT_CMD_QUE_PLUS_FBO = 0x106a */
488 BAT_FAD(q,PlusFBS), /* BAT_CMD_QUE_PLUS_FBS = 0x106b */
489 BAT_FAD(q,PlusFBU), /* BAT_CMD_QUE_PLUS_FBU = 0x106c */
490 BAT_FAD(q,PlusFCC), /* BAT_CMD_QUE_PLUS_FCC = 0x106d */
491 BAT_FAD(q,PlusFCLASS), /* BAT_CMD_QUE_PLUS_FCLASS = 0x106e */
492 BAT_FAD(q,PlusFCQ), /* BAT_CMD_QUE_PLUS_FCQ = 0x106f */
493 BAT_FAD(q,PlusFCR), /* BAT_CMD_QUE_PLUS_FCR = 0x1070 */
494 BAT_FAD(q,PlusFCS), /* BAT_CMD_QUE_PLUS_FCS = 0x1071 */
495 BAT_FAD(q,PlusFCT), /* BAT_CMD_QUE_PLUS_FCT = 0x1072 */
496 {NULL}, /* BAT_CMD_QUE_PLUS_FEA = 0x1073 */
497 BAT_FAD(q,PlusFFC), /* BAT_CMD_QUE_PLUS_FFC = 0x1074 */
498 BAT_FAD(q,PlusFHS), /* BAT_CMD_QUE_PLUS_FHS = 0x1075 */
499 BAT_FAD(q,PlusFIE), /* BAT_CMD_QUE_PLUS_FIE = 0x1076 */
500 BAT_FAD(q,PlusFIS), /* BAT_CMD_QUE_PLUS_FIS = 0x1077 */
501 BAT_FAD(q,PlusFIT), /* BAT_CMD_QUE_PLUS_FIT = 0x1078 */
502 BAT_FAD(q,PlusFLI), /* BAT_CMD_QUE_PLUS_FLI = 0x1079 */
503 BAT_FAD(q,PlusFLO), /* BAT_CMD_QUE_PLUS_FLO = 0x107a */
504 BAT_FAD(q,PlusFLP), /* BAT_CMD_QUE_PLUS_FLP = 0x107b */
505 BAT_FAD(q,PlusFMS), /* BAT_CMD_QUE_PLUS_FMS = 0x107c */
506 BAT_FAD(q,PlusFNS), /* BAT_CMD_QUE_PLUS_FNS = 0x107d */
507 BAT_FAD(q,PlusFPA), /* BAT_CMD_QUE_PLUS_FPA = 0x107e */
508 BAT_FAD(q,PlusFPI), /* BAT_CMD_QUE_PLUS_FPI = 0x107f */
509 BAT_FAD(q,PlusFPS), /* BAT_CMD_QUE_PLUS_FPS = 0x1080 */
510 BAT_FAD(q,PlusFPW), /* BAT_CMD_QUE_PLUS_FPW = 0x1081 */
511 BAT_FAD(q,PlusFRQ), /* BAT_CMD_QUE_PLUS_FRQ = 0x1082 */
512 BAT_FAD(q,PlusFSA), /* BAT_CMD_QUE_PLUS_FSA = 0x1083 */
513 BAT_FAD(q,PlusFSP), /* BAT_CMD_QUE_PLUS_FSP = 0x1084 */
514 BAT_DEF(q,PlusICF), /* BAT_CMD_QUE_PLUS_ICF = 0x1085 */
515 BAT_DEF(q,PlusIFC), /* BAT_CMD_QUE_PLUS_IFC = 0x1086 */
516 {NULL}, /* BAT_CMD_QUE_PERCENT_IMEI = 0x1087 */
517 BAT_DEF(q,PlusIPR), /* BAT_CMD_QUE_PLUS_IPR = 0x1088 */
518 BAT_DEF(q,PercentPBCF), /* BAT_CMD_QUE_PERCENT_PBCF = 0x1089 */
519 BAT_PPP(q,PercentPPP), /* BAT_CMD_QUE_PERCENT_PPP = 0x108a */
520 BAT_DEF(q,PercentPVRF), /* BAT_CMD_QUE_PERCENT_PVRF = 0x108b */
521 BAT_DEF(q,PercentRDL), /* BAT_CMD_QUE_PERCENT_RDL = 0x108c */
522 #ifdef TI_PS_FF_AT_P_CMD_RDLB
523 BAT_DEF(q,PercentRDLB), /* BAT_CMD_QUE_PERCENT_RDLB = 0x108d */
524 #else
525 {NULL},
526 #endif /* TI_PS_FF_AT_P_CMD_RDLB */
527 BAT_STK(q,PercentSATC), /* BAT_CMD_QUE_PERCENT_SATC = 0x108e */
528 BAT_STK(q,PercentSATCC), /* BAT_CMD_QUE_PERCENT_SATCC = 0x108f */
529 BAT_GPR(q,PercentSNCNT), /* BAT_CMD_QUE_PERCENT_SNCNT = 0x1090 */
530 #ifdef TI_PS_FF_AT_CMD_WS46
531 BAT_DEF(q,PlusWS46), /* BAT_CMD_QUE_PLUS_WS46 = 0x1091 */
532 #else
533 {NULL},
534 #endif /* TI_PS_FF_AT_CMD_WS46 */
535 BAT_DEF(q,PlusCDIP), /* BAT_CMD_QUE_PLUS_CDIP = 0x1092 */
536 BAT_DEF(s,PlusCGMI), /* BAT_CMD_SET_PLUS_CGMI = 0x1093 */
537 BAT_DEF(s,PlusCGMM), /* BAT_CMD_SET_PLUS_CGMM = 0x1094 */
538 BAT_DEF(s,PlusCGMR), /* BAT_CMD_SET_PLUS_CGMR = 0x1095 */
539 BAT_DEF(s,PlusCGSN), /* BAT_CMD_SET_PLUS_CGSN = 0x1096 */
540 BAT_DEF(q,PercentCNIV), /* BAT_CMD_QUE_PERCENT_CNIV = 0x1097 */
541 {NULL}, /* BAT_CMD_QUE_PERCENT_CMGRS = 0x1098 */
542 {NULL}, /*BAT_DEF(q,PercentPBCI), BAT_CMD_QUE_PERCENT_PBCI = 0x1099 */
543 BAT_DEF(q,PercentSIMEF), /*BAT_CMD_QUE_PERCENT_SIMEF = 0x109A */
544 BAT_DEF(s,PlusCHUP) /*BAT_CMD_SET_PLUS_CHUP = 0x109B */
545 };
546
547
548 typedef struct
549 {
550 size_t size;
551 } T_map_response_2_size;
552
553 static T_map_response_2_size response_2_size[] =
554 {
555 {sizeof(T_BAT_no_parameter)}, /* BAT_RES_AT_OK = 0x0 */
556 {sizeof(T_BAT_res_at_connect)}, /* BAT_RES_AT_CONNECT = 0x1 */
557 {sizeof(T_BAT_no_parameter)}, /* BAT_RES_AT_NO_CARRIER_FINAL = 0x2 */
558 {sizeof(T_BAT_res_plus_cme_error)}, /* BAT_RES_PLUS_CME_ERROR = 0x3 */
559 {sizeof(T_BAT_res_plus_cms_error)}, /* BAT_RES_PLUS_CMS_ERROR = 0x4 */
560 {sizeof(T_BAT_no_parameter)}, /* BAT_RES_AT_BUSY = 0x5 */
561 {sizeof(T_BAT_no_parameter)}, /* BAT_RES_AT_CHANNEL_BUSY = 0x6 */
562 {sizeof(T_BAT_no_parameter)}, /* BAT_RES_AT_NO_ANSWER = 0x7 */
563 {sizeof(T_BAT_res_plus_ext_error)}, /* BAT_RES_PLUS_EXT_ERROR = 0x8 */
564 {sizeof(T_BAT_res_que_percent_als)}, /* BAT_RES_QUE_PERCENT_ALS = 0x9 */
565 {sizeof(T_BAT_res_tst_percent_als)}, /* BAT_RES_TST_PERCENT_ALS = 0xa */
566 {sizeof(T_BAT_res_que_percent_atr)}, /* BAT_RES_QUE_PERCENT_ATR = 0xb */
567 {sizeof(T_BAT_res_que_percent_band)}, /* BAT_RES_QUE_PERCENT_BAND = 0xc */
568 {sizeof(T_BAT_res_tst_percent_band)}, /* BAT_RES_TST_PERCENT_BAND = 0xd */
569 {sizeof(T_BAT_res_que_plus_cacm)}, /* BAT_RES_QUE_PLUS_CACM = 0xe */
570 {sizeof(T_BAT_res_que_plus_camm)}, /* BAT_RES_QUE_PLUS_CAMM = 0xf */
571 {sizeof(T_BAT_res_set_plus_caoc)}, /* BAT_RES_SET_PLUS_CAOC = 0x10 */
572 {sizeof(T_BAT_res_set_plus_cbc)}, /* BAT_RES_SET_PLUS_CBC = 0x11 */
573 {sizeof(T_BAT_res_que_percent_cbhz)}, /* BAT_RES_QUE_PERCENT_CBHZ = 0x12 */
574 {sizeof(T_BAT_res_tst_percent_cbhz)}, /* BAT_RES_TST_PERCENT_CBHZ = 0x13 */
575 {sizeof(T_BAT_res_que_plus_cbst)}, /* BAT_RES_QUE_PLUS_CBST = 0x14 */
576 {sizeof(T_BAT_res_que_percent_ccbs)}, /* BAT_RES_QUE_PERCENT_CCBS = 0x15 */
577 {sizeof(T_BAT_res_set_plus_ccfc)}, /* BAT_RES_SET_PLUS_CCFC = 0x16 */
578 {sizeof(T_BAT_res_que_plus_cclk)}, /* BAT_RES_QUE_PLUS_CCLK = 0x17 */
579 {sizeof(T_BAT_res_que_plus_ccug)}, /* BAT_RES_QUE_PLUS_CCUG = 0x18 */
580 {sizeof(T_BAT_res_set_plus_ccwa)}, /* BAT_RES_SET_PLUS_CCWA = 0x19 */
581 {sizeof(T_BAT_res_set_plus_ccwa_w)}, /* BAT_RES_SET_PLUS_CCWA_W = 0x1a */
582 {sizeof(T_BAT_res_set_plus_ceer)}, /* BAT_RES_SET_PLUS_CEER = 0x1b */
583 {sizeof(T_BAT_res_que_plus_cfun)}, /* BAT_RES_QUE_PLUS_CFUN = 0x1c */
584 {sizeof(T_BAT_res_que_percent_cgaatt)}, /* BAT_RES_QUE_PERCENT_CGAATT = 0x1d */
585 {sizeof(T_BAT_res_que_plus_cgact)}, /* BAT_RES_QUE_PLUS_CGACT = 0x1e */
586 {sizeof(T_BAT_res_que_plus_cgatt)}, /* BAT_RES_QUE_PLUS_CGATT = 0x1f */
587 {sizeof(T_BAT_res_que_percent_cgclass)}, /* BAT_RES_QUE_PERCENT_CGCLASS = 0x20 */
588 {sizeof(T_BAT_res_que_plus_cgclass)}, /* BAT_RES_QUE_PLUS_CGCLASS = 0x21 */
589 {sizeof(T_BAT_res_que_plus_cgdcont)}, /* BAT_RES_QUE_PLUS_CGDCONT = 0x22 */
590 {sizeof(T_BAT_res_set_plus_cgpaddr)}, /* BAT_RES_SET_PLUS_CGPADDR = 0x23 */
591 {sizeof(T_BAT_res_tst_plus_cgpaddr)}, /* BAT_RES_TST_PLUS_CGPADDR = 0x24 */
592 {sizeof(T_BAT_res_set_percent_cgpco)}, /* BAT_RES_SET_PERCENT_CGPCO = 0x25 */
593 {sizeof(T_BAT_res_que_percent_cgppp)}, /* BAT_RES_QUE_PERCENT_CGPPP = 0x26 */
594 {sizeof(T_BAT_res_que_plus_cgqmin)}, /* BAT_RES_QUE_PLUS_CGQMIN = 0x27 */
595 {sizeof(T_BAT_res_que_plus_cgqreq)}, /* BAT_RES_QUE_PLUS_CGQREQ = 0x28 */
596 {sizeof(T_BAT_res_que_percent_cgreg)}, /* BAT_RES_QUE_PERCENT_CGREG = 0x29 */
597 {sizeof(T_BAT_res_que_plus_cgreg)}, /* BAT_RES_QUE_PLUS_CGREG = 0x2a */
598 {sizeof(T_BAT_res_que_plus_cgsms)}, /* BAT_RES_QUE_PLUS_CGSMS = 0x2b */
599 {sizeof(T_BAT_res_set_percent_chpl)}, /* BAT_RES_SET_PERCENT_CHPL = 0x2c */
600 {sizeof(T_BAT_res_set_percent_chpl_w)}, /* BAT_RES_SET_PERCENT_CHPL_W = 0x2d */
601 {sizeof(T_BAT_res_set_plus_cimi)}, /* BAT_RES_SET_PLUS_CIMI = 0x2e */
602 {sizeof(T_BAT_res_que_plus_cind)}, /* BAT_RES_QUE_PLUS_CIND = 0x2f */
603 {sizeof(T_BAT_res_que_plus_clan)}, /* BAT_RES_QUE_PLUS_CLAN = 0x30 */
604 {sizeof(T_BAT_res_tst_plus_clan)}, /* BAT_RES_TST_PLUS_CLAN = 0x31 */
605 {sizeof(T_BAT_res_que_plus_clcc)}, /* BAT_RES_QUE_PLUS_CLCC = 0x32 */
606 {sizeof(T_BAT_res_set_plus_clck)}, /* BAT_RES_SET_PLUS_CLCK = 0x33 */
607 {sizeof(T_BAT_res_que_plus_clip)}, /* BAT_RES_QUE_PLUS_CLIP = 0x34 */
608 {sizeof(T_BAT_res_que_plus_clip_w)}, /* BAT_RES_QUE_PLUS_CLIP_W = 0x35 */
609 {sizeof(T_BAT_res_que_plus_clir)}, /* BAT_RES_QUE_PLUS_CLIR = 0x36 */
610 {sizeof(T_BAT_no_parameter)}, /* BAT_RES_SET_PLUS_CLVL = 0x37 */
611 {sizeof(T_BAT_res_que_plus_clvl)}, /* BAT_RES_QUE_PLUS_CLVL = 0x38 */
612 {sizeof(T_BAT_res_que_plus_cmer)}, /* BAT_RES_QUE_PLUS_CMER = 0x39 */
613 {sizeof(T_BAT_res_set_plus_cmgc)}, /* BAT_RES_SET_PLUS_CMGC = 0x3a */
614 {sizeof(T_BAT_res_set_plus_cmgl)}, /* BAT_RES_SET_PLUS_CMGL = 0x3b */
615 {sizeof(T_BAT_res_set_plus_cmgl_w)}, /* BAT_RES_SET_PLUS_CMGL_W = 0x3c */
616 {sizeof(T_BAT_res_set_plus_cmgr)}, /* BAT_RES_SET_PLUS_CMGR = 0x3d */
617 {sizeof(T_BAT_res_set_plus_cmgr_w)}, /* BAT_RES_SET_PLUS_CMGR_W = 0x3e */
618 {sizeof(T_BAT_res_set_plus_cmgs)}, /* BAT_RES_SET_PLUS_CMGS = 0x3f */
619 {sizeof(T_BAT_res_set_plus_cmgw)}, /* BAT_RES_SET_PLUS_CMGW = 0x40 */
620 {sizeof(T_BAT_res_que_plus_cmod)}, /* BAT_RES_QUE_PLUS_CMOD = 0x41 */
621 {sizeof(T_BAT_res_que_plus_cmut)}, /* BAT_RES_QUE_PLUS_CMUT = 0x42 */
622 {sizeof(T_BAT_res_que_plus_cmux)}, /* BAT_RES_QUE_PLUS_CMUX = 0x43 */
623 {sizeof(T_BAT_res_que_percent_cnap)}, /* BAT_RES_QUE_PERCENT_CNAP = 0x44 */
624 {sizeof(T_BAT_res_que_plus_cnmi)}, /* BAT_RES_QUE_PLUS_CNMI = 0x45 */
625 {sizeof(T_BAT_res_set_plus_cnum)}, /* BAT_RES_SET_PLUS_CNUM = 0x46 */
626 {sizeof(T_BAT_res_set_plus_cnum_w)}, /* BAT_RES_SET_PLUS_CNUM_W = 0x47 */
627 {sizeof(T_BAT_res_que_plus_colp)}, /* BAT_RES_QUE_PLUS_COLP = 0x48 */
628 {sizeof(T_BAT_res_que_plus_colp_w)}, /* BAT_RES_QUE_PLUS_COLP_W = 0x49 */
629 {sizeof(T_BAT_res_que_percent_cops)}, /* BAT_RES_QUE_PERCENT_COPS = 0x4a */
630 {sizeof(T_BAT_res_tst_percent_cops)}, /* BAT_RES_TST_PERCENT_COPS = 0x4b */
631 {sizeof(T_BAT_res_que_plus_cops)}, /* BAT_RES_QUE_PLUS_COPS = 0x4c */
632 {sizeof(T_BAT_res_tst_plus_cops)}, /* BAT_RES_TST_PLUS_COPS = 0x4d */
633 {sizeof(T_BAT_res_que_percent_cops_w)}, /* BAT_RES_QUE_PERCENT_COPS_W = 0x4e */
634 {sizeof(T_BAT_res_tst_percent_cops_w)}, /* BAT_RES_TST_PERCENT_COPS_W = 0x4f */
635 {sizeof(T_BAT_res_set_percent_cpals)}, /* BAT_RES_SET_PERCENT_CPALS = 0x50 */
636 {sizeof(T_BAT_res_que_percent_cpals)}, /* BAT_RES_QUE_PERCENT_CPALS = 0x51 */
637 {sizeof(T_BAT_res_set_percent_cpals_w)}, /* BAT_RES_SET_PERCENT_CPALS_W = 0x52 */
638 {sizeof(T_BAT_res_que_percent_cpals_w)}, /* BAT_RES_QUE_PERCENT_CPALS_W = 0x53 */
639 {sizeof(T_BAT_res_set_plus_cpas)}, /* BAT_RES_SET_PLUS_CPAS = 0x54 */
640 {sizeof(T_BAT_res_set_plus_cpbf)}, /* BAT_RES_SET_PLUS_CPBF = 0x55 */
641 {sizeof(T_BAT_res_tst_plus_cpbf)}, /* BAT_RES_TST_PLUS_CPBF = 0x56 */
642 {sizeof(T_BAT_res_set_plus_cpbf_w)}, /* BAT_RES_SET_PLUS_CPBF_W = 0x57 */
643 {sizeof(T_BAT_res_tst_plus_cpbf_w)}, /* BAT_RES_TST_PLUS_CPBF_W = 0x58 */
644 {sizeof(T_BAT_res_set_plus_cpbr)}, /* BAT_RES_SET_PLUS_CPBR = 0x59 */
645 {sizeof(T_BAT_res_tst_plus_cpbr)}, /* BAT_RES_TST_PLUS_CPBR = 0x5a */
646 {sizeof(T_BAT_res_set_plus_cpbr_w)}, /* BAT_RES_SET_PLUS_CPBR_W = 0x5b */
647 {sizeof(T_BAT_res_tst_plus_cpbr_w)}, /* BAT_RES_TST_PLUS_CPBR_W = 0x5c */
648 {sizeof(T_BAT_res_que_percent_cpbs)}, /* BAT_RES_QUE_PERCENT_CPBS = 0x5d */
649 {sizeof(T_BAT_res_que_plus_cpbs)}, /* BAT_RES_QUE_PLUS_CPBS = 0x5e */
650 {sizeof(T_BAT_res_tst_plus_cpbw)}, /* BAT_RES_TST_PLUS_CPBW = 0x5f */
651 {sizeof(T_BAT_res_tst_plus_cpbw_w)}, /* BAT_RES_TST_PLUS_CPBW_W = 0x60 */
652 {sizeof(T_BAT_res_set_percent_cpcfu)}, /* BAT_RES_SET_PERCENT_CPCFU = 0x61 */
653 {sizeof(T_BAT_res_que_percent_cphs)}, /* BAT_RES_QUE_PERCENT_CPHS = 0x62 */
654 {sizeof(T_BAT_res_que_plus_cpin)}, /* BAT_RES_QUE_PLUS_CPIN = 0x63 */
655 {sizeof(T_BAT_res_que_percent_cpinf)}, /* BAT_RES_QUE_PERCENT_CPINF = 0x64 */
656 {sizeof(T_BAT_res_set_percent_cpmb)}, /* BAT_RES_SET_PERCENT_CPMB = 0x65 */
657 {sizeof(T_BAT_res_que_percent_cpmb)}, /* BAT_RES_QUE_PERCENT_CPMB = 0x66 */
658 {sizeof(T_BAT_res_tst_percent_cpmbw)}, /* BAT_RES_TST_PERCENT_CPMBW = 0x67 */
659 {sizeof(T_BAT_res_tst_percent_cpmbw_w)}, /* BAT_RES_TST_PERCENT_CPMBW_W = 0x68 */
660 {sizeof(T_BAT_res_set_percent_cpmb_w)}, /* BAT_RES_SET_PERCENT_CPMB_W = 0x69 */
661 {sizeof(T_BAT_res_set_plus_cpms)}, /* BAT_RES_SET_PLUS_CPMS = 0x6a */
662 {sizeof(T_BAT_res_que_plus_cpms)}, /* BAT_RES_QUE_PLUS_CPMS = 0x6b */
663 {sizeof(T_BAT_res_set_percent_cpnums)}, /* BAT_RES_SET_PERCENT_CPNUMS = 0x6c */
664 {sizeof(T_BAT_res_tst_percent_cpnums)}, /* BAT_RES_TST_PERCENT_CPNUMS = 0x6d */
665 {sizeof(T_BAT_res_set_percent_cpnums_w)},/* BAT_RES_SET_PERCENT_CPNUMS_W = 0x6e */
666 {sizeof(T_BAT_res_tst_percent_cpnums_w)},/* BAT_RES_TST_PERCENT_CPNUMS_W = 0x6f */
667 {sizeof(T_BAT_res_que_plus_cpol)}, /* BAT_RES_QUE_PLUS_CPOL = 0x70 */
668 {sizeof(T_BAT_res_tst_plus_cpol)}, /* BAT_RES_TST_PLUS_CPOL = 0x71 */
669 {sizeof(T_BAT_res_que_plus_cpol_w)}, /* BAT_RES_QUE_PLUS_CPOL_W = 0x72 */
670 {sizeof(T_BAT_res_tst_plus_cpol_w)}, /* BAT_RES_TST_PLUS_CPOL_W = 0x73 */
671 {sizeof(T_BAT_res_que_percent_cpopn)}, /* BAT_RES_QUE_PERCENT_CPOPN = 0x74 */
672 {sizeof(T_BAT_res_que_percent_cprsm)}, /* BAT_RES_QUE_PERCENT_CPRSM = 0x75 */
673 {sizeof(T_BAT_res_que_plus_cpuc)}, /* BAT_RES_QUE_PLUS_CPUC = 0x76 */
674 {sizeof(T_BAT_res_que_plus_cpuc_w)}, /* BAT_RES_QUE_PLUS_CPUC_W = 0x77 */
675 {sizeof(T_BAT_res_set_percent_cpvwi)}, /* BAT_RES_SET_PERCENT_CPVWI = 0x78 */
676 {sizeof(T_BAT_res_que_percent_creg)}, /* BAT_RES_QUE_PERCENT_CREG = 0x79 */
677 {sizeof(T_BAT_res_tst_plus_cres)}, /* BAT_RES_TST_PLUS_CRES = 0x7a */
678 {sizeof(T_BAT_res_que_plus_crlp)}, /* BAT_RES_QUE_PLUS_CRLP = 0x7b */
679 {sizeof(T_BAT_res_set_plus_crsm)}, /* BAT_RES_SET_PLUS_CRSM = 0x7c */
680 {sizeof(T_BAT_res_tst_plus_csas)}, /* BAT_RES_TST_PLUS_CSAS = 0x7d */
681 {sizeof(T_BAT_res_que_plus_csca)}, /* BAT_RES_QUE_PLUS_CSCA = 0x7e */
682 {sizeof(T_BAT_res_que_plus_cscb)}, /* BAT_RES_QUE_PLUS_CSCB = 0x7f */
683 {sizeof(T_BAT_res_que_plus_cscs)}, /* BAT_RES_QUE_PLUS_CSCS = 0x80 */
684 {sizeof(T_BAT_res_set_plus_csim)}, /* BAT_RES_SET_PLUS_CSIM = 0x81 */
685 {sizeof(T_BAT_res_que_plus_csms)}, /* BAT_RES_QUE_PLUS_CSMS = 0x82 */
686 {sizeof(T_BAT_res_que_plus_csns)}, /* BAT_RES_QUE_PLUS_CSNS = 0x83 */
687 {sizeof(T_BAT_res_que_percent_csq)}, /* BAT_RES_QUE_PERCENT_CSQ = 0x84 */
688 {sizeof(T_BAT_res_set_plus_csq)}, /* BAT_RES_SET_PLUS_CSQ = 0x85 */
689 {sizeof(T_BAT_res_que_plus_csta)}, /* BAT_RES_QUE_PLUS_CSTA = 0x86 */
690 {sizeof(T_BAT_res_que_plus_csvm)}, /* BAT_RES_QUE_PLUS_CSVM = 0x87 */
691 {sizeof(T_BAT_res_que_percent_ctty)}, /* BAT_RES_QUE_PERCENT_CTTY = 0x88 */
692 {sizeof(T_BAT_res_que_plus_ctzu)}, /* BAT_RES_QUE_PLUS_CTZU = 0x89 */
693 {sizeof(T_BAT_res_que_percent_cust)}, /* BAT_RES_QUE_PERCENT_CUST = 0x8a */
694 {sizeof(T_BAT_res_que_percent_data)}, /* BAT_RES_QUE_PERCENT_DATA = 0x8b */
695 {sizeof(T_BAT_res_set_percent_dinf)}, /* BAT_RES_SET_PERCENT_DINF = 0x8c */
696 {sizeof(T_BAT_res_que_plus_ds)}, /* BAT_RES_QUE_PLUS_DS = 0x8d */
697 {sizeof(T_BAT_res_que_plus_fap)}, /* BAT_RES_QUE_PLUS_FAP = 0x8e */
698 {sizeof(T_BAT_res_que_plus_fbo)}, /* BAT_RES_QUE_PLUS_FBO = 0x8f */
699 {sizeof(T_BAT_res_que_plus_fbs)}, /* BAT_RES_QUE_PLUS_FBS = 0x90 */
700 {sizeof(T_BAT_res_que_plus_fbu)}, /* BAT_RES_QUE_PLUS_FBU = 0x91 */
701 {sizeof(T_BAT_res_que_plus_fcc)}, /* BAT_RES_QUE_PLUS_FCC = 0x92 */
702 {sizeof(T_BAT_res_que_plus_fclass)}, /* BAT_RES_QUE_PLUS_FCLASS = 0x93 */
703 {sizeof(T_BAT_res_que_plus_fcq)}, /* BAT_RES_QUE_PLUS_FCQ = 0x94 */
704 {sizeof(T_BAT_res_que_plus_fcr)}, /* BAT_RES_QUE_PLUS_FCR = 0x95 */
705 {sizeof(T_BAT_res_que_plus_fcs)}, /* BAT_RES_QUE_PLUS_FCS = 0x96 */
706 {sizeof(T_BAT_res_que_plus_fct)}, /* BAT_RES_QUE_PLUS_FCT = 0x97 */
707 {sizeof(T_BAT_res_que_plus_fea)}, /* BAT_RES_QUE_PLUS_FEA = 0x98 */
708 {sizeof(T_BAT_res_que_plus_ffc)}, /* BAT_RES_QUE_PLUS_FFC = 0x99 */
709 {sizeof(T_BAT_res_que_plus_fhs)}, /* BAT_RES_QUE_PLUS_FHS = 0x9a */
710 {sizeof(T_BAT_res_que_plus_fie)}, /* BAT_RES_QUE_PLUS_FIE = 0x9b */
711 {sizeof(T_BAT_res_que_plus_fis)}, /* BAT_RES_QUE_PLUS_FIS = 0x9c */
712 {sizeof(T_BAT_res_que_plus_fit)}, /* BAT_RES_QUE_PLUS_FIT = 0x9d */
713 {sizeof(T_BAT_res_que_plus_fli)}, /* BAT_RES_QUE_PLUS_FLI = 0x9e */
714 {sizeof(T_BAT_res_que_plus_flo)}, /* BAT_RES_QUE_PLUS_FLO = 0x9f */
715 {sizeof(T_BAT_res_que_plus_flp)}, /* BAT_RES_QUE_PLUS_FLP = 0xa0 */
716 {sizeof(T_BAT_res_que_plus_fms)}, /* BAT_RES_QUE_PLUS_FMS = 0xa1 */
717 {sizeof(T_BAT_res_que_plus_fns)}, /* BAT_RES_QUE_PLUS_FNS = 0xa2 */
718 {sizeof(T_BAT_res_que_plus_fpa)}, /* BAT_RES_QUE_PLUS_FPA = 0xa3 */
719 {sizeof(T_BAT_res_que_plus_fpi)}, /* BAT_RES_QUE_PLUS_FPI = 0xa4 */
720 {sizeof(T_BAT_res_que_plus_fps)}, /* BAT_RES_QUE_PLUS_FPS = 0xa5 */
721 {sizeof(T_BAT_res_que_plus_fpw)}, /* BAT_RES_QUE_PLUS_FPW = 0xa6 */
722 {sizeof(T_BAT_res_que_plus_frq)}, /* BAT_RES_QUE_PLUS_FRQ = 0xa7 */
723 {sizeof(T_BAT_res_que_plus_fsa)}, /* BAT_RES_QUE_PLUS_FSA = 0xa8 */
724 {sizeof(T_BAT_res_que_plus_fsp)}, /* BAT_RES_QUE_PLUS_FSP = 0xa9 */
725 {sizeof(T_BAT_res_que_plus_icf)}, /* BAT_RES_QUE_PLUS_ICF = 0xaa */
726 {sizeof(T_BAT_res_que_plus_ifc)}, /* BAT_RES_QUE_PLUS_IFC = 0xab */
727 {sizeof(T_BAT_res_que_percent_imei)}, /* BAT_RES_QUE_PERCENT_IMEI = 0xac */
728 {sizeof(T_BAT_res_que_plus_ipr)}, /* BAT_RES_QUE_PLUS_IPR = 0xad */
729 {sizeof(T_BAT_res_que_percent_pbcf)}, /* BAT_RES_QUE_PERCENT_PBCF = 0xae */
730 {sizeof(T_BAT_res_que_percent_ppp)}, /* BAT_RES_QUE_PERCENT_PPP = 0xaf */
731 {sizeof(T_BAT_res_que_percent_pvrf)}, /* BAT_RES_QUE_PERCENT_PVRF = 0xb0 */
732 {sizeof(T_BAT_res_que_percent_rdl)}, /* BAT_RES_QUE_PERCENT_RDL = 0xb1 */
733 {sizeof(T_BAT_res_que_percent_rdlb)}, /* BAT_RES_QUE_PERCENT_RDLB = 0xb2 */
734 {sizeof(T_BAT_res_que_percent_satc)}, /* BAT_RES_QUE_PERCENT_SATC = 0xb3 */
735 {sizeof(T_BAT_res_que_percent_satcc)}, /* BAT_RES_QUE_PERCENT_SATCC = 0xb4 */
736 {sizeof(T_BAT_res_set_percent_sate)}, /* BAT_RES_SET_PERCENT_SATE = 0xb5 */
737 {sizeof(T_BAT_res_que_plus_ws46)}, /* BAT_RES_QUE_PLUS_WS46 = 0xb6 */
738 {sizeof(T_BAT_res_que_plus_cdip)}, /* BAT_RES_QUE_PLUS_CDIP = 0xb7 */
739 {sizeof(T_BAT_res_set_percent_cmgr)}, /* BAT_RES_SET_PERCENT_CMGR = 0xb8 */
740 {sizeof(T_BAT_res_set_percent_cmgl)}, /* BAT_RES_SET_PERCENT_CMGL = 0xb9 */
741 {sizeof(T_BAT_res_set_plus_cmss)}, /* BAT_RES_SET_PLUS_CMSS = 0xba */
742 {sizeof(T_BAT_res_set_plus_cgmi)}, /* BAT_RES_SET_PLUS_CGMI = 0xbb */
743 {sizeof(T_BAT_res_set_plus_cgmm)}, /* BAT_RES_SET_PLUS_CGMM = 0xbc */
744 {sizeof(T_BAT_res_set_plus_cgmr)}, /* BAT_RES_SET_PLUS_CGMR = 0xbd */
745 {sizeof(T_BAT_res_set_plus_cgsn)}, /* BAT_RES_SET_PLUS_CGSN = 0xbe */
746 #ifdef SIM_PERS
747 {sizeof(T_BAT_res_set_percent_mepd)}, /* BAT_RES_SET_PERCENT_MEPD = 0xbf */
748 #else
749 {0}, /* If the flag is not enabled to get the proper size of structure of response according to the command id */
750 #endif /* SIM_PERS */
751 {sizeof(T_BAT_res_set_percent_csq)}, /* BAT_RES_SET_PERCENT_CSQ = 0xc0 */
752 {sizeof(T_BAT_res_que_percent_cniv)}, /* BAT_RES_QUE_PERCENT_CNIV = 0xc1 */
753 {sizeof(T_BAT_res_que_percent_simef)} /* BAT_RES_QUE_PERCENT_SIMEF = 0xcb */
754 };
755
756 static T_map_response_2_size unsolicited_2_size[] =
757 {
758 {sizeof(T_BAT_no_parameter)}, /* BAT_RES_UNS_AT_BUSY = 0x1000 */
759 {sizeof(T_BAT_no_parameter)}, /* BAT_RES_UNS_AT_NO_ANSWER = 0x1001 */
760 {sizeof(T_BAT_res_uns_plus_cbm)}, /* BAT_RES_UNS_PLUS_CBM = 0x1002 */
761 {sizeof(T_BAT_res_uns_plus_cbmi)}, /* BAT_RES_UNS_PLUS_CBMI = 0x1003 */
762 {sizeof(T_BAT_res_uns_percent_ccbs)}, /* BAT_RES_UNS_PERCENT_CCBS = 0x1004 */
763 {sizeof(T_BAT_res_uns_plus_cccm)}, /* BAT_RES_UNS_PLUS_CCCM = 0x1005 */
764 {sizeof(T_BAT_res_uns_percent_cccn)}, /* BAT_RES_UNS_PERCENT_CCCN = 0x1006 */
765 {sizeof(T_BAT_res_uns_plus_ccwa)}, /* BAT_RES_UNS_PLUS_CCWA = 0x1007 */
766 {sizeof(T_BAT_res_uns_plus_ccwa_w)}, /* BAT_RES_UNS_PLUS_CCWA_W = 0x1008 */
767 {sizeof(T_BAT_no_parameter)}, /* BAT_RES_UNS_PLUS_CCWE = 0x1009 */
768 {sizeof(T_BAT_res_uns_plus_cdip)}, /* BAT_RES_UNS_PLUS_CDIP = 0x100a */
769 {sizeof(T_BAT_res_uns_plus_cds)}, /* BAT_RES_UNS_PLUS_CDS = 0x100b */
770 {sizeof(T_BAT_no_parameter)}, /* BAT_RES_UNS_PLUS_CCWV = 0x100c */
771 {sizeof(T_BAT_res_uns_percent_cgev)}, /* BAT_RES_UNS_PERCENT_CGEV = 0x100d */
772 {sizeof(T_BAT_res_uns_plus_cgev)}, /* BAT_RES_UNS_PLUS_CGEV = 0x100e */
773 {sizeof(T_BAT_res_uns_percent_cgreg)}, /* BAT_RES_UNS_PERCENT_CGREG = 0x100f */
774 {sizeof(T_BAT_res_uns_plus_cgreg)}, /* BAT_RES_UNS_PLUS_CGREG = 0x1010 */
775 {sizeof(T_BAT_res_uns_plus_clae)}, /* BAT_RES_UNS_PLUS_CLAE = 0x1011 */
776 {sizeof(T_BAT_res_uns_plus_clav)}, /* BAT_RES_UNS_PLUS_CLAV = 0x1012 */
777 {sizeof(T_BAT_res_uns_plus_clip)}, /* BAT_RES_UNS_PLUS_CLIP = 0x1013 */
778 {sizeof(T_BAT_res_uns_plus_clip_w)}, /* BAT_RES_UNS_PLUS_CLIP_W = 0x1014 */
779 {sizeof(T_BAT_res_uns_plus_cmt)}, /* BAT_RES_UNS_PLUS_CMT = 0x1015 */
780 {sizeof(T_BAT_res_uns_plus_cmti)}, /* BAT_RES_UNS_PLUS_CMTI = 0x1016 */
781 {sizeof(T_BAT_res_uns_plus_cmt_w)}, /* BAT_RES_UNS_PLUS_CMT_W = 0x1017 */
782 {sizeof(T_BAT_res_uns_percent_cnap)}, /* BAT_RES_UNS_PERCENT_CNAP = 0x1018 */
783 {sizeof(T_BAT_res_uns_plus_colp)}, /* BAT_RES_UNS_PLUS_COLP = 0x1019 */
784 {sizeof(T_BAT_res_uns_plus_colp_w)}, /* BAT_RES_UNS_PLUS_COLP_W = 0x101a */
785 {sizeof(T_BAT_res_uns_percent_cpi)}, /* BAT_RES_UNS_PERCENT_CPI = 0x101b */
786 {sizeof(T_BAT_res_uns_percent_cpi_w)}, /* BAT_RES_UNS_PERCENT_CPI_W = 0x101c */
787 {sizeof(T_BAT_res_uns_percent_cpri)}, /* BAT_RES_UNS_PERCENT_CPRI = 0x101d */
788 {sizeof(T_BAT_res_uns_percent_cproam)}, /* BAT_RES_UNS_PERCENT_CPROAM = 0x101e */
789 {sizeof(T_BAT_res_uns_percent_cpvwi)}, /* BAT_RES_UNS_PERCENT_CPVWI = 0x101f */
790 {sizeof(T_BAT_res_uns_plus_cr)}, /* BAT_RES_UNS_PLUS_CR = 0x1020 */
791 {sizeof(T_BAT_res_uns_percent_creg)}, /* BAT_RES_UNS_PERCENT_CREG = 0x1021 */
792 {sizeof(T_BAT_res_uns_plus_cring)}, /* BAT_RES_UNS_PLUS_CRING = 0x1022 */
793 {sizeof(T_BAT_res_uns_percent_csq)}, /* BAT_RES_UNS_PERCENT_CSQ = 0x1023 */
794 {sizeof(T_BAT_res_uns_plus_cssi)}, /* BAT_RES_UNS_PLUS_CSSI = 0x1024 */
795 {sizeof(T_BAT_res_uns_percent_cssn)}, /* BAT_RES_UNS_PERCENT_CSSN = 0x1025 */
796 {sizeof(T_BAT_res_uns_plus_cssu)}, /* BAT_RES_UNS_PLUS_CSSU = 0x1026 */
797 {sizeof(T_BAT_res_uns_percent_cstat)}, /* BAT_RES_UNS_PERCENT_CSTAT = 0x1027 */
798 {sizeof(T_BAT_res_uns_percent_ctyi)}, /* BAT_RES_UNS_PERCENT_CTYI = 0x1028 */
799 {sizeof(T_BAT_res_uns_plus_ctzr)}, /* BAT_RES_UNS_PLUS_CTZR = 0x1029 */
800 {sizeof(T_BAT_res_uns_percent_ctzv)}, /* BAT_RES_UNS_PERCENT_CTZV = 0x102a */
801 {sizeof(T_BAT_res_uns_plus_ctzv)}, /* BAT_RES_UNS_PLUS_CTZV = 0x102b */
802 {sizeof(T_BAT_res_uns_percent_ctzv_w)}, /* BAT_RES_UNS_PERCENT_CTZV_W = 0x102c */
803 {sizeof(T_BAT_res_uns_plus_cusd)}, /* BAT_RES_UNS_PLUS_CUSD = 0x102d */
804 {sizeof(T_BAT_res_uns_plus_cusd_w)}, /* BAT_RES_UNS_PLUS_CUSD_W = 0x102e */
805 {sizeof(T_BAT_no_parameter)}, /* BAT_RES_UNS_AT_NO_CARRIER = 0x102f */
806 {sizeof(T_BAT_res_uns_plus_fhs)}, /* BAT_RES_UNS_PLUS_FHS = 0x1030 */
807 {sizeof(T_BAT_res_uns_plus_ilrr)}, /* BAT_RES_UNS_PLUS_ILRR = 0x1031 */
808 {sizeof(T_BAT_res_uns_percent_rdl)}, /* BAT_RES_UNS_PERCENT_RDL = 0x1032 */
809 {sizeof(T_BAT_res_uns_percent_rdlb)}, /* BAT_RES_UNS_PERCENT_RDLB = 0x1033 */
810 {sizeof(T_BAT_res_uns_percent_sata)}, /* BAT_RES_UNS_PERCENT_SATA = 0x1034 */
811 {sizeof(T_BAT_res_uns_percent_sati)}, /* BAT_RES_UNS_PERCENT_SATI = 0x1035 */
812 {sizeof(T_BAT_res_uns_percent_satn)}, /* BAT_RES_UNS_PERCENT_SATN = 0x1036 */
813 {sizeof(T_BAT_res_uns_percent_simef)}, /* BAT_RES_UNS_PERCENT_SIMEF = 0x1037 */
814 {sizeof(T_BAT_res_uns_percent_simins)}, /* BAT_RES_UNS_PERCENT_SIMINS = 0x1038 */
815 {sizeof(T_BAT_res_uns_percent_simrem)}, /* BAT_RES_UNS_PERCENT_SIMREM = 0x1039 */
816 {sizeof(T_BAT_res_uns_percent_sncnt)}, /* BAT_RES_UNS_PERCENT_SNCNT = 0x103a */
817 {sizeof(T_BAT_res_uns_percent_cniv)} /* BAT_RES_UNS_PERCENT_CNIV = 0x103b */
818 };
819
820 typedef struct
821 {
822 T_BAT_ctrl_params bat;
823 T_ACI_AT_CMD aci;
824 } T_map_batcmd_to_acicmd;
825 /*
826 * only asynchronous commands are listed (interaction with PS)
827 */
828 #define CMD_MAP_NOT_PRESENT -1
829 T_map_batcmd_to_acicmd map_batcmd_to_acicmd [] =
830 {
831 {BAT_CMD_SET_PLUS_CFUN, AT_CMD_CFUN},
832 {BAT_CMD_SET_PERCENT_BAND, AT_CMD_BAND},
833 {BAT_CMD_SET_PLUS_CPIN, AT_CMD_CPIN},
834 {BAT_CMD_QUE_PLUS_CPIN, AT_CMD_CPIN},
835 {BAT_CMD_QUE_PERCENT_CPINF, AT_CMD_CPIN},
836 {BAT_CMD_SET_PLUS_CPBW, AT_CMD_CPBW},
837 {BAT_CMD_TST_PERCENT_COPS, AT_CMD_P_COPS},
838 {BAT_CMD_TST_PLUS_COPS, AT_CMD_COPS},
839 {BAT_CMD_SET_PERCENT_COPS, AT_CMD_P_COPS},
840 {BAT_CMD_SET_PLUS_COPS, AT_CMD_COPS},
841 {BAT_CMD_AT_D, AT_CMD_D},
842 {BAT_CMD_AT_A, AT_CMD_A},
843 {BAT_CMD_AT_Z, AT_CMD_Z},
844 {BAT_CMD_SET_PERCENT_CHLD, AT_CMD_CHLD},
845 {BAT_CMD_SET_PLUS_CTFR, AT_CMD_CTFR},
846 {BAT_CMD_SET_PERCENT_VTS, AT_CMD_VTS},
847 {BAT_CMD_SET_PLUS_VTS, AT_CMD_VTS},
848 {BAT_CMD_QUE_PLUS_CLIR, AT_CMD_CLIR},
849 {BAT_CMD_SET_PLUS_CLIR, AT_CMD_CLIR},
850 {BAT_CMD_QUE_PLUS_CLIP, AT_CMD_CLIP},
851 {BAT_CMD_QUE_PLUS_COLP, AT_CMD_COLP},
852 {BAT_CMD_SET_PLUS_CCFC, AT_CMD_CCFC},
853 {BAT_CMD_SET_PLUS_CLCK, AT_CMD_CLCK},
854 {BAT_CMD_SET_PLUS_CCWA, AT_CMD_CCWA},
855 {BAT_CMD_SET_PLUS_CPWD, AT_CMD_CPWD},
856 {BAT_CMD_SET_PLUS_CUSD, AT_CMD_CUSD},
857 {BAT_CMD_SET_PLUS_CMGD, AT_CMD_CMGD},
858 {BAT_CMD_SET_PLUS_CMGW, AT_CMD_CMGW},
859 {BAT_CMD_SET_PLUS_CMGS, AT_CMD_CMGS},
860 {BAT_CMD_SET_PLUS_CMSS, AT_CMD_CMSS},
861 {BAT_CMD_SET_PLUS_CSCA, AT_CMD_CSCA},
862 {BAT_CMD_QUE_PLUS_CSCA, AT_CMD_CSCA},
863 {BAT_CMD_SET_PLUS_CGATT, AT_CMD_CGATT},
864 {BAT_CMD_QUE_PLUS_CGATT, AT_CMD_CGATT},
865 {BAT_CMD_QUE_PERCENT_CGCLASS, AT_CMD_P_CGCLASS},
866 {BAT_CMD_QUE_PLUS_CGCLASS, AT_CMD_CGCLASS},
867 {BAT_CMD_SET_PERCENT_CGCLASS, AT_CMD_P_CGCLASS},
868 {BAT_CMD_SET_PLUS_CGCLASS, AT_CMD_CGCLASS},
869 {BAT_CMD_SET_PLUS_CGACT, AT_CMD_CGACT},
870 {BAT_CMD_QUE_PLUS_CGACT, AT_CMD_CGACT},
871 {BAT_CMD_SET_PLUS_CGDATA, AT_CMD_CGDATA},
872 {BAT_CMD_SET_PLUS_CGANS, AT_CMD_CGANS},
873 {BAT_CMD_SET_PLUS_CGSMS, AT_CMD_CGSMS},
874 {BAT_CMD_QUE_PLUS_CGSMS, AT_CMD_CGSMS},
875 {(T_BAT_ctrl_params)CMD_MAP_NOT_PRESENT, AT_CMD_NONE}
876 };
877
878
879
880 /*==== LOCAL FUNCTONS =============================================*/
881 LOCAL void aci_bat_init_globs(void);
882 LOCAL void aci_bat_queue_put (T_aci_bat_queue *que, T_BAT_cmd_send *cmd, U8 client_id, U16 dataSize);
883 LOCAL BOOL aci_bat_queue_get (T_aci_bat_queue *que, T_BAT_cmd_send *cmd, U8 *client_id);
884 LOCAL T_aci_bat_queue *aci_bat_queue_create (void);
885 LOCAL void aci_bat_queue_remove (T_aci_bat_queue *que);
886
887
888 LOCAL void *aci_bat_give_l2p_rx_buf_cb (U8 batId);
889 LOCAL void *aci_bat_give_l2p_tx_buf_cb (U8 batId, U16 dataSize, void **seg_hdr_ptr, U16 *totalSize, U16 *segSize);
890 LOCAL void aci_bat_free_data_buffer (T_ACI_DTI_DATA_BUF *data_buffer);
891 LOCAL BOOL aci_bat_buffer_dti_data (T_ACI_DTI_PRC_PSI *src_infos_psi, T_desc2 *data);
892 LOCAL void aci_bat_send_dti_data (T_ACI_DTI_PRC_PSI *src_infos_psi, T_desc2 *data);
893 LOCAL void *aci_bat_l2p_next_seg_cb (U8 batId , void *last_seg_hdr, void **seg_hdr_ptr, U16 *segSize);
894 LOCAL int aci_bat_l2p_send_frame_cb (U8 batId);
895 LOCAL void aci_bat_l2p_msg_rxd_cb (U8 batId, U8 muxId, U32 dataTag, void *dataPtr, U16 dataSize);
896
897 LOCAL int aci_bat_get_size (T_BAT_ctrl_response ctrl_response);
898 LOCAL void aci_bat_init_max_client_maintenance (T_ACI_DTI_PRC_PSI *src_infos_psi, U8 num_clients);
899 LOCAL void aci_bat_clean_client_maintenance (T_ACI_DTI_PRC_PSI *src_infos_psi, U8 client);
900 LOCAL BOOL aci_bat_bootstrap_l2p (T_ACI_DTI_PRC_PSI *src_infos_psi, T_DTI2_DATA_IND *dti_data_ind);
901 LOCAL BOOL aci_bat_abort (T_ACI_DTI_PRC_PSI *src_infos_psi, U8 client_id);
902 LOCAL T_ACI_AT_CMD map_cmd_id (T_BAT_ctrl_params cmd);
903
904 /*------------------------------------------------------------------------------
905 * prepare unique identifiers for L2P_Configure, BATLib starts with 0, we start with 0x80
906 */
907 LOCAL void aci_bat_init_globs(void)
908 {
909 int i;
910 for (i=0; i<CMD_SRC_MAX; i++)
911 {
912 aci_bat_globs[i].l2p_configured = FALSE;
913 aci_bat_globs[i].l2p_id = 0x80+i;
914 aci_bat_globs[i].psi_src = NULL;
915 memset(aci_bat_globs[i].l2p_mem, 0x00, L2P_CONTROL_BLOCK_HDR_SIZE);
916 }
917 }
918
919
920 /*------------------------------------------------------------------------------
921 * received BAT commands cannot be processed, make it pending
922 */
923 LOCAL void aci_bat_queue_put (T_aci_bat_queue *que, T_BAT_cmd_send *cmd, U8 client_id, U16 dataSize)
924 {
925 T_aci_bat_queue_entry *qe;
926
927 ACI_MALLOC(qe, sizeof (T_aci_bat_queue_entry));
928
929 qe->next = 0;
930 qe->cmd.ctrl_params = cmd->ctrl_params;
931 qe->client_id = client_id;
932
933 /* due to union params, we can use any pointer. will be freed in aci_bat_run_cmd() */
934 ACI_MALLOC(qe->cmd.params.ptr_andc, dataSize);
935 memcpy (qe->cmd.params.ptr_andc, cmd->params.ptr_andc, dataSize);
936
937 if (que->first)
938 {
939 que->last->next = qe;
940 }
941 else
942 {
943 que->first = qe;
944 }
945 que->last = qe;
946 }
947
948 /*------------------------------------------------------------------------------
949 * get pending BAT command of a client queue
950 */
951 LOCAL BOOL aci_bat_queue_get (T_aci_bat_queue *que, T_BAT_cmd_send *cmd, U8 *client_id)
952 {
953 T_aci_bat_queue_entry *qe;
954
955 if (!que)
956 {
957 return (FALSE);
958 }
959
960 qe = que->first;
961 if (!qe)
962 {
963 return (FALSE);
964 }
965 cmd->ctrl_params = qe->cmd.ctrl_params;
966 cmd->params = qe->cmd.params;
967 *client_id = qe->client_id;
968
969 que->first = qe->next;
970
971 if (que->first EQ NULL)
972 {
973 que->last = NULL;
974 }
975
976 ACI_MFREE(qe);
977
978 return (TRUE);
979 }
980
981 /*------------------------------------------------------------------------------
982 * aci_bat_queue_create
983 */
984 LOCAL T_aci_bat_queue *aci_bat_queue_create (void)
985 {
986 T_aci_bat_queue *que;
987
988 ACI_MALLOC(que, sizeof (T_aci_bat_queue));
989
990 if (que EQ NULL)
991 {
992 return 0;
993 }
994 que->first = 0;
995 return que;
996 }
997
998 /*------------------------------------------------------------------------------
999 * aci_bat_queue_remove
1000 */
1001 LOCAL void aci_bat_queue_remove (T_aci_bat_queue *que)
1002 {
1003 T_BAT_cmd_send dummy1;
1004 U8 dummy2 = 0;
1005
1006 while (aci_bat_queue_get (que, &dummy1, &dummy2))
1007 {
1008 ;
1009 }
1010 if (que)
1011 {
1012 ACI_MFREE (que);
1013 }
1014 }
1015
1016
1017 /*------------------------------------------------------------------------------
1018 * get the response size needed for L2P to know how many bytes to send
1019 */
1020 LOCAL int aci_bat_get_size (T_BAT_ctrl_response ctrl_response)
1021 {
1022 if (BITFIELD_CHECK(ctrl_response, BAT_BIT_12)) /* 0x1000 */
1023 {
1024 return (unsolicited_2_size[ctrl_response - BAT_BIT_12].size);
1025 }
1026 else
1027 {
1028 return (response_2_size[ctrl_response].size);
1029 }
1030 }
1031
1032 /*------------------------------------------------------------------------------
1033 * init max BAT clients maintance for a PSI source
1034 */
1035 LOCAL void aci_bat_init_max_client_maintenance(T_ACI_DTI_PRC_PSI *src_infos_psi, U8 num_clients)
1036 {
1037 int i;
1038 ACI_MALLOC(src_infos_psi->bat_client, num_clients * sizeof(T_bat_aci_client_maintain));
1039 src_infos_psi->queue = aci_bat_queue_create();
1040 src_infos_psi->max_clients = num_clients;
1041 for (i=0; i< num_clients; i++)
1042 {
1043 src_infos_psi->bat_client[i].opened = FALSE;
1044 src_infos_psi->bat_client[i].curCmd = (T_BAT_ctrl_params)-1;
1045 src_infos_psi->bat_client[i].send_data = (T_desc2 *)NULL;
1046 }
1047 }
1048
1049 /*------------------------------------------------------------------------------
1050 * clean up the whole clients maintenance for a PSI source
1051 */
1052 LOCAL void aci_bat_clean_client_maintenance(T_ACI_DTI_PRC_PSI *src_infos_psi, U8 client)
1053 {
1054 BOOL all_closed = TRUE;
1055 int i = 0;
1056
1057 src_infos_psi->bat_client[client].curCmd = (T_BAT_ctrl_params)-1;
1058 src_infos_psi->bat_client[client].opened = FALSE;
1059
1060 for (i=0; i< src_infos_psi->max_clients; i++)
1061 {
1062 if (src_infos_psi->bat_client[i].opened EQ TRUE)
1063 {
1064 all_closed = FALSE;
1065 break;
1066 }
1067 }
1068 if (all_closed)
1069 {
1070 aci_bat_queue_remove(src_infos_psi->queue);
1071 L2P_Remove(aci_bat_globs[src_infos_psi->srcId].l2p_id);
1072 ACI_MFREE(src_infos_psi->bat_client);
1073 aci_bat_globs[src_infos_psi->srcId].l2p_configured = FALSE;
1074 }
1075
1076 all_closed = TRUE;
1077 for (i=0; i< CMD_SRC_MAX; i++)
1078 {
1079 if (aci_bat_globs[i].l2p_configured NEQ FALSE)
1080 {
1081 all_closed = FALSE;
1082 break;
1083 }
1084 }
1085 if (all_closed)
1086 {
1087 aci_bat_first_time = TRUE;
1088 }
1089 }
1090
1091
1092 /*------------------------------------------------------------------------------
1093 * pick out from the very first received DTI_DATA_IND the L2P protocol id.
1094 * our client (BAT lib at Application or ATI) defined the L2P protocol
1095 */
1096
1097 LOCAL BOOL aci_bat_bootstrap_l2p (T_ACI_DTI_PRC_PSI *src_infos_psi, T_DTI2_DATA_IND *dti_data_ind)
1098 {
1099 U16 tot_len;
1100 U8 protocol_id = 0;
1101 T_L2P_STATUS l2p_status = L2P_STAT_UNKNOWN_ERROR;
1102 T_L2P_FRAME_CONTROL_BYTES *l2p_header = (T_L2P_FRAME_CONTROL_BYTES *)NULL;
1103 T_desc2 *p_desc;
1104
1105 tot_len = dti_data_ind->desc_list2.list_len;
1106 p_desc = (T_desc2 *)dti_data_ind->desc_list2.first;
1107
1108 if (p_desc NEQ NULL)
1109 {
1110 if( p_desc->len > tot_len)
1111 {
1112 TRACE_EVENT("aci_bat_bootstrap_l2p(): invalid dti_data_ind");
1113 return (FALSE);
1114 }
1115
1116 l2p_header = (T_L2P_FRAME_CONTROL_BYTES *)p_desc->buffer;
1117 protocol_id = l2p_header->protocol_id;
1118
1119
1120 TRACE_EVENT_P3("aci_bat_bootstrap_l2p(): protocol_id = %d, src_id = %d, l2p_id = 0x%02X",
1121 protocol_id, src_infos_psi->srcId, aci_bat_globs[src_infos_psi->srcId].l2p_id);
1122
1123
1124 l2p_status = L2P_Configure(aci_bat_globs[src_infos_psi->srcId].l2p_id, /* what L2P maintains as bat_id */
1125 (void *)(aci_bat_globs[src_infos_psi->srcId].l2p_mem), /* memory for the internal L2P maintenance */
1126 (T_L2P_SUPPORTED_PROTOCOLS)protocol_id,
1127 BAT_MTU_SIZE, /* replace replace GDD_DIO_MTU_SIZE */
1128 aci_bat_give_l2p_tx_buf_cb, /* L2P needs callbacks */
1129 aci_bat_give_l2p_rx_buf_cb,
1130 aci_bat_l2p_next_seg_cb,
1131 aci_bat_l2p_send_frame_cb,
1132 aci_bat_l2p_msg_rxd_cb);
1133
1134 switch (l2p_status)
1135 {
1136 case (L2P_STAT_SUCCESS):
1137 return (TRUE);
1138 default: /* any error */
1139 TRACE_EVENT_P1("aci_bat_bootstrap_l2p(): L2P error = %d", l2p_status);
1140 return (FALSE);
1141 }
1142 }
1143 return (FALSE);
1144 }
1145
1146 /*------------------------------------------------------------------------------
1147 * L2P wants always to have the BAT_MTU_SIZE memory for the received data
1148 * it rebuilds from L2P fragments and T_desc2 segements the complete BAT command
1149 * We will free the memory in aci_bat_l2p_msg_rxd_cb()
1150 * From the batId we derive the src_id by substract 0x80, see aci_bat_init_globs()
1151 */
1152 LOCAL void *aci_bat_give_l2p_rx_buf_cb (U8 batId)
1153 {
1154 U8 src_id = batId-0x80;
1155 TRACE_FUNCTION("aci_bat_give_l2p_rx_buf_cb()");
1156
1157 if (batId EQ aci_bat_globs[src_id].l2p_id)
1158 {
1159 T_ACI_DTI_PRC_PSI *src_infos_psi = aci_bat_globs[src_id].psi_src;
1160
1161 ACI_MALLOC(src_infos_psi->rcv_data, BAT_MTU_SIZE);
1162
1163 return (src_infos_psi->rcv_data);
1164 }
1165 else
1166 {
1167 TRACE_ERROR("aci_bat_give_l2p_rx_buf_cb(): L2P used wrong identifier");
1168 return (NULL);
1169 }
1170 }
1171
1172 /*------------------------------------------------------------------------------
1173 * L2P wants to have some memory to transmit data. It is called only for the first segment.
1174 * dataSize is what L2P requests from us
1175 * with totalSize we tell L2P what we got from the memory pool
1176 * segSize ist the size of the first segment
1177 * seg_hdr_ptr is the pointer to T_desc2, but casted to void
1178 * returned is T_desc2.buffer
1179 * PSI will free the memory
1180 * From the batId we derive the src_id by substract 0x80, see aci_bat_init_globs()
1181 */
1182 LOCAL void *aci_bat_give_l2p_tx_buf_cb (U8 batId, U16 dataSize, void **seg_hdr_ptr, U16 *totalSize, U16 *segSize)
1183 {
1184 U8 src_id = batId-0x80;
1185 TRACE_FUNCTION("aci_bat_give_l2p_tx_buf_cb()");
1186
1187 if (batId EQ aci_bat_globs[src_id].l2p_id)
1188 {
1189 T_desc2 *send_data;
1190 U16 send_len = (U16)(sizeof(T_desc2) - 1 + dataSize);
1191
1192 T_ACI_DTI_PRC_PSI *src_infos_psi = aci_bat_globs[src_id].psi_src;
1193
1194 ACI_MALLOC(send_data, send_len);
1195
1196 send_data->next = (U32)NULL;
1197 send_data->len = dataSize;
1198 send_data->size = dataSize;
1199 send_data->offset = 0;
1200
1201 *seg_hdr_ptr = (void *)send_data;
1202 *totalSize = send_len;
1203 *segSize = send_len;
1204 TRACE_EVENT_P2("aci_bat_give_l2p_tx_buf_cb(): L2P requested %i bytes and got %i bytes", dataSize, send_len);
1205
1206 /* for control and broadcast channel we must not maintain the first T_desc2
1207 * in the client array, because it were just too large, BAT_CTRL_CHANNEL = 0xFE)
1208 */
1209 if (src_infos_psi->active_client >= BAT_CTRL_CHANNEL)
1210 {
1211 src_infos_psi->send_data = send_data;
1212 }
1213 else
1214 {
1215 src_infos_psi->bat_client[src_infos_psi->active_client].send_data = send_data;
1216 }
1217
1218 return ((void *)send_data->buffer);
1219 }
1220 else
1221 {
1222 TRACE_ERROR("aci_bat_give_l2p_tx_buf_cb(): L2P used wrong identifier");
1223 return (NULL);
1224 }
1225 }
1226
1227 /*------------------------------------------------------------------------------
1228 *
1229 */
1230 LOCAL void *aci_bat_l2p_next_seg_cb (U8 batId, void *last_seg_hdr, void **seg_hdr_ptr, U16 *segSize)
1231 {
1232 T_desc2 *segment;
1233
1234 TRACE_FUNCTION("aci_bat_l2p_next_seg_cb()");
1235
1236 segment = (T_desc2 *)last_seg_hdr;
1237 segment = (T_desc2 *)segment->next;
1238 *seg_hdr_ptr = segment;
1239 *segSize = segment->size;
1240
1241 return ((void *)segment->buffer);
1242 }
1243
1244 LOCAL void aci_bat_free_data_buffer (T_ACI_DTI_DATA_BUF *data_buffer)
1245 {
1246 T_desc2 *p_desc, *p_desc_next=NULL;
1247
1248 if (data_buffer->data_list EQ NULL)
1249 {
1250 return;
1251 }
1252
1253 p_desc = data_buffer->data_list;
1254 if (p_desc NEQ NULL)
1255 {
1256 p_desc_next = (T_desc2 *)p_desc->next;
1257 }
1258
1259 while (p_desc NEQ NULL)
1260 {
1261 ACI_MFREE (p_desc);
1262
1263 p_desc = p_desc_next;
1264 if (p_desc NEQ NULL)
1265 {
1266 p_desc_next = (T_desc2 *)p_desc->next;
1267 }
1268 }
1269
1270 data_buffer->data_list = NULL;
1271 data_buffer->max_buffer_size = 0;
1272 data_buffer->create_time = 0;
1273 }
1274
1275
1276 /*------------------------------------------------------------------------------
1277 *
1278 */
1279 LOCAL BOOL aci_bat_buffer_dti_data (T_ACI_DTI_PRC_PSI *src_infos_psi, T_desc2 *data)
1280 {
1281 T_desc2 *tmp;
1282 T_TIME current_time;
1283
1284 static int i = 0;
1285
1286 TRACE_FUNCTION("aci_bat_buffer_dti_data()");
1287
1288 if (src_infos_psi->data_buffer.data_list EQ NULL)
1289 {
1290 src_infos_psi->data_buffer.data_list = data; /* the first buffered resp/ind */
1291 /* store the creation time for the data buffer */
1292 vsi_t_time (VSI_CALLER &src_infos_psi->data_buffer.create_time);
1293 }
1294 else
1295 {
1296 /*
1297 * check whether the buffered resp/ind are already too long buffered
1298 * this avoids eating up all the memory
1299 */
1300 vsi_t_time (VSI_CALLER &current_time);
1301 if ((current_time - src_infos_psi->data_buffer.create_time) > MAX_DATA_BUFFER_LIFE_TIME)
1302 {
1303 TRACE_EVENT_P1 ("[WRN] aci_bat_buffer_dti_data(): life time expired, buffer deleted (%d)",
1304 current_time - src_infos_psi->data_buffer.create_time);
1305 aci_bat_free_data_buffer (&src_infos_psi->data_buffer);
1306 /* send an error to BAT Lib */
1307 return (FALSE);
1308 }
1309
1310 /*
1311 * we still can buffer further resp/ind
1312 */
1313 tmp = src_infos_psi->data_buffer.data_list;
1314 while ((T_desc2*)tmp->next NEQ NULL)
1315 {
1316 tmp = (T_desc2*)tmp->next;
1317 }
1318 tmp->next = (U32)data; /* append the current resp/ind */
1319 i++;
1320 }
1321 return (TRUE);
1322 }
1323
1324
1325 /*------------------------------------------------------------------------------
1326 *
1327 */
1328 LOCAL void aci_bat_send_dti_data (T_ACI_DTI_PRC_PSI *src_infos_psi, T_desc2 *data)
1329 {
1330 U16 data_len = 0;
1331 T_desc2 *next_data;
1332 TRACE_FUNCTION("aci_bat_send_dti_data");
1333
1334 {
1335 PALLOC_DESC2(dti_data_ind, DTI2_DATA_IND);
1336
1337 next_data = data;
1338
1339 while (next_data NEQ NULL)
1340 {
1341 data_len += next_data->len;
1342 next_data = (T_desc2*)next_data->next;
1343 }
1344
1345 dti_data_ind->desc_list2.list_len = data_len;
1346 dti_data_ind->desc_list2.first = (U32)data;
1347 dti_data_ind->parameters.p_id = 0; /*dummy_ubyte; */
1348
1349 dti_data_ind->parameters.st_lines.st_flow = DTI_FLOW_OFF;
1350 dti_data_ind->parameters.st_lines.st_line_sb = DTI_SB_ON;
1351 dti_data_ind->parameters.st_lines.st_line_sa = DTI_SA_ON;
1352 dti_data_ind->parameters.st_lines.st_break_len = DTI_BREAK_OFF;
1353 #ifdef _SIMULATION_
1354 if (src_infos_psi->devId NEQ DIO_DATA_PKT)
1355 {
1356 gdd_aci_write_bat(src_infos_psi->srcId, &(dti_data_ind->desc_list2)); /* special GDD adapter between BATLib and BATModule */
1357 PFREE(dti_data_ind);
1358 }
1359 else
1360 { /* this is for the acibat_test suite, which does not use the ATI as application */
1361 dti_send_data (aci_hDTI,
1362 src_infos_psi->srcId,
1363 (U8)DTI_ENTITY_PSI,
1364 ACI_DTI_DN_CHANNEL,
1365 dti_data_ind);
1366 }
1367 #else
1368 dti_send_data (aci_hDTI,
1369 src_infos_psi->srcId,
1370 (U8)DTI_ENTITY_PSI,
1371 ACI_DTI_DN_CHANNEL,
1372 dti_data_ind);
1373 #endif
1374 }
1375 }
1376
1377
1378 /*------------------------------------------------------------------------------
1379 * L2P has a frame ready for sending.
1380 * We have to send a DTI2_DATA_IND primitive to PSI
1381 * the pointer of the first T_desc2 is maintained in src_infos_psi.
1382 * From the batId we derive the src_id by substract 0x80, see aci_bat_init_globs()
1383 */
1384 LOCAL int aci_bat_l2p_send_frame_cb (U8 batId)
1385 {
1386 U8 src_id = batId-0x80;
1387 T_desc2 *data;
1388 T_ACI_DTI_PRC_PSI *src_infos_psi = aci_bat_globs[src_id].psi_src;
1389
1390 TRACE_FUNCTION("aci_bat_l2p_send_frame_cb()");
1391
1392 if (src_infos_psi->active_client >= BAT_CTRL_CHANNEL)
1393 {
1394 data = src_infos_psi->send_data;
1395 }
1396 else
1397 {
1398 data = src_infos_psi->bat_client[src_infos_psi->active_client].send_data;
1399 }
1400
1401 if ((aci_src_dti_params[src_infos_psi->srcId].isDtiConnected) AND
1402 (aci_src_dti_params[src_infos_psi->srcId].dtxState EQ READY))
1403 {
1404 aci_bat_send_dti_data (src_infos_psi, data);
1405 }
1406 else
1407 {
1408 /* buffer data, will be send in sig_dti_tx_buffer_ready_ind() */
1409 if (aci_bat_buffer_dti_data (src_infos_psi, data) EQ FALSE)
1410 {
1411 return (1); /* any value larger than 0 tells L2P that there is a problem */
1412 }
1413 }
1414
1415 return (0); /* what L2P expects */
1416 }
1417
1418 /*------------------------------------------------------------------------------
1419 * L2P signals that our payload has been completely received (BAT command request or control signal)
1420 * control signal is immediately processed , commands are queued first
1421 * From the batId we derive the src_id by substract 0x80, see aci_bat_init_globs()
1422 */
1423 LOCAL void aci_bat_l2p_msg_rxd_cb (U8 batId , U8 muxId, U32 dataTag, void *dataPtr, U16 dataSize)
1424 {
1425 U8 src_id = batId-0x80;
1426 TRACE_FUNCTION("aci_bat_l2p_msg_rxd_cb()");
1427
1428 if (batId EQ aci_bat_globs[src_id].l2p_id)
1429 {
1430 T_ACI_DTI_PRC_PSI *src_infos_psi = aci_bat_globs[src_id].psi_src;
1431
1432 dataSize = dataSize; /* has no meaning for aci_bat */
1433
1434 if (BITFIELD_CHECK(dataTag, BAT_BIT_13)) /* 0x2000 - 0x3FFF = customer commands */
1435 {
1436 aci_bat_rcv_custom (src_id, muxId, dataTag, dataPtr, dataSize);
1437 /* free the requested L2P RX buffer, see aci_bat_give_l2p_rx_buf_cb */
1438 if (src_infos_psi->rcv_data)
1439 {
1440 ACI_MFREE(src_infos_psi->rcv_data);
1441 }
1442 }
1443 else if (BITFIELD_CHECK(dataTag, BAT_BIT_15)) /* 0x8000 = BAT Lib control cmd*/
1444 {
1445 T_BATC_signal signal;
1446 signal.ctrl_params = (T_BATC_ctrl_params)dataTag; /* this is the important thing */
1447 /* due to union of pointers, we can use any pointer, just to make the compiler happy */
1448 signal.params.ptr_max_clients = (T_BATC_max_clients *)dataPtr;
1449 aci_bat_ctrl_rcv(src_infos_psi, &signal);
1450 /* free the requested L2P RX buffer, see aci_bat_give_l2p_rx_buf_cb */
1451 if (src_infos_psi->rcv_data)
1452 {
1453 ACI_MFREE(src_infos_psi->rcv_data);
1454 }
1455 }
1456 else /* binary AT command */
1457 {
1458 T_BAT_cmd_send cmd;
1459 cmd.ctrl_params = (T_BAT_ctrl_params)dataTag;
1460 cmd.params.ptr_at_a = (T_BAT_no_parameter *)dataPtr; /* we can use any pointer, don't worry */
1461 TRACE_EVENT_P1("command identifier: = 0x%04X", dataTag);
1462 TRACE_BINDUMP(aci_handle, TC_USER4, "BAT COMMAND PARAMETER 2", (U8 *)dataPtr, 4);
1463
1464 /* in case of no memory, ACI goes sleeping until there is enough */
1465 aci_bat_queue_put(src_infos_psi->queue, &cmd, muxId, dataSize);
1466
1467 /* free the requested L2P RX buffer, see aci_bat_give_l2p_rx_buf_cb */
1468 if (src_infos_psi->rcv_data)
1469 {
1470 ACI_MFREE(src_infos_psi->rcv_data);
1471 }
1472 if (src_infos_psi->run_cmd EQ FALSE)
1473 {
1474 aci_bat_run_cmd (src_infos_psi);
1475 }
1476 else
1477 {
1478 TRACE_EVENT_P1("aci_bat_l2p_msg_rxd_cb(): there is a cmd running, put 0x%04X in queue", cmd.ctrl_params);
1479 }
1480 }
1481 }
1482 else
1483 {
1484 TRACE_ERROR("aci_bat_l2p_msg_rxd_cb(): L2P used wrong identifier");
1485 }
1486 }
1487
1488
1489 /*------------------------------------------------------------------------------
1490 * AT command identifier is different in BAT and ACI. Need to map it.
1491 */
1492 LOCAL T_ACI_AT_CMD map_cmd_id (T_BAT_ctrl_params cmd)
1493 {
1494 int i = 0;
1495
1496 while (map_batcmd_to_acicmd[i].aci NEQ AT_CMD_NONE)
1497 {
1498 if (cmd EQ map_batcmd_to_acicmd[i].bat)
1499 {
1500 return (map_batcmd_to_acicmd[i].aci);
1501 }
1502 i++;
1503 }
1504 return (AT_CMD_NONE);
1505 }
1506
1507 /*------------------------------------------------------------------------------
1508 * BAT Lib sent command abort request for a particular client
1509 */
1510 LOCAL BOOL aci_bat_abort (T_ACI_DTI_PRC_PSI *src_infos_psi, U8 client_id)
1511 {
1512 T_ACI_RETURN ret = AT_FAIL;
1513 T_ACI_AT_CMD AciCurCmd = map_cmd_id ( src_infos_psi->bat_client[client_id].curCmd);
1514
1515 ret = sAT_Abort ((T_ACI_CMD_SRC)src_infos_psi->srcId, AciCurCmd);
1516 switch (ret)
1517 {
1518 case (AT_EXCT):
1519 {
1520 /*
1521 * in aci_bat_ctrl_rcv() we check for BATC_ABORT_CMD to suppress any response.
1522 * only call control needs some time to abort (disconnet the call).
1523 * command handler of call control emits the OK via R_AT (rBAT_OK).
1524 * in rBAT_OK we have to check again for BATC_ABORT_COMMAND_CNF and send then
1525 * a
1526 */
1527 src_infos_psi->bat_client[client_id].curCmd = (T_BAT_ctrl_params)BATC_ABORT_CMD;
1528 return(TRUE);
1529 }
1530 case ( AT_CMPL ):
1531 {
1532 src_infos_psi->bat_client[client_id].curCmd = (T_BAT_ctrl_params)-1;
1533 return(TRUE);
1534 }
1535 default:
1536 {
1537 switch (src_infos_psi->bat_client[client_id].curCmd)
1538 {
1539 case ( BAT_CMD_SET_PLUS_CMGC ):
1540 case ( BAT_CMD_SET_PLUS_CNMI ):
1541 case ( BAT_CMD_SET_PLUS_CSMS ):
1542 case ( BAT_CMD_SET_PLUS_CMGD ):
1543 case ( BAT_CMD_SET_PLUS_CMGR ):
1544 case ( BAT_CMD_SET_PLUS_CMGR_W ):
1545 case ( BAT_CMD_SET_PLUS_CMGW ):
1546 case ( BAT_CMD_SET_PLUS_CMGS ):
1547 case ( BAT_CMD_SET_PLUS_CMSS ):
1548 case ( BAT_CMD_SET_PLUS_CPMS ):
1549 /* case ( AT_CMD_CSMP ): not supported by BAT ? */
1550 case ( BAT_CMD_SET_PLUS_CSCA ):
1551 case ( BAT_CMD_SET_PLUS_CRES ):
1552 case ( BAT_CMD_SET_PLUS_CSAS ):
1553 case ( BAT_CMD_SET_PLUS_CMGL ):
1554 case ( BAT_CMD_SET_PLUS_CMGL_W ):
1555 /* ACI_ERR_DESC( ACI_ERR_CLASS_Cms, CMS_ERR_FailedToAbort); */
1556 break;
1557 default:
1558 /* ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_FailedToAbort); */
1559 break;
1560 }
1561 /* aci_bat_err(src_infos_psi); */
1562 break;
1563 }
1564 }
1565 return(FALSE);
1566 }
1567
1568
1569 /*==== GLOBAL FUNCTONS ============================================*/
1570
1571
1572 /*
1573 +--------------------------------------------------------------------+
1574 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1575 | STATE : code ROUTINE : aci_bat_send_buffer_dti_data |
1576 +--------------------------------------------------------------------+
1577
1578 PURPOSE : Send buffered DTI data, because dtxState is ready now.
1579 This function is called by sig_dti_tx_buffer_ready_ind()
1580 */
1581
1582 GLOBAL U8 aci_bat_get_l2p_id(U8 src_id)
1583 {
1584 return (aci_bat_globs[src_id].l2p_id);
1585 }
1586
1587
1588 /*
1589 +--------------------------------------------------------------------+
1590 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1591 | STATE : code ROUTINE : aci_bat_send_buffer_dti_data |
1592 +--------------------------------------------------------------------+
1593
1594 PURPOSE : Send buffered DTI data, because dtxState is ready now.
1595 This function is called by sig_dti_tx_buffer_ready_ind()
1596 */
1597 GLOBAL void aci_bat_send_buffer_dti_data (UBYTE src_id)
1598 {
1599 T_ACI_DTI_PRC_PSI *src_infos_psi = NULL;
1600 int i = 0;
1601
1602 TRACE_FUNCTION("aci_bat_send_buffer_dti_data()");
1603
1604 /* dti_id should be supported by DTI_ENTITY_ID or something, here.. */
1605 src_infos_psi = find_element (psi_src_params, src_id, cmhPSItest_srcId);
1606
1607 if (aci_src_dti_params[src_id].isDtiConnected EQ FALSE)
1608 {
1609 TRACE_EVENT ("DTI_READY_IND: line not connected");
1610 return;
1611 }
1612 /*
1613 * send data which may have been stored ..
1614 */
1615 if (src_infos_psi->data_buffer.data_list NEQ NULL)
1616 {
1617 T_desc2 *data_list = src_infos_psi->data_buffer.data_list;
1618
1619 while (data_list NEQ NULL)
1620 {
1621 /* TRACE_BINDUMP(aci_handle, TC_USER4, "BUFFERED BAT DATA", (U8 *)data_list, data_list->len); */
1622 TRACE_EVENT_P1 ("aci_bat_send_buffer_dti_data(): buffered resp/ind has %i bytes", data_list->len);
1623 i++;
1624 data_list = (T_desc2*)data_list->next;
1625 }
1626
1627 TRACE_EVENT_P1 ("aci_bat_send_buffer_dti_data(): there are %i buffered resp/ind", i);
1628 aci_bat_send_dti_data (src_infos_psi, src_infos_psi->data_buffer.data_list);
1629 src_infos_psi->data_buffer.data_list = NULL;
1630 src_infos_psi->data_buffer.max_buffer_size = 0;
1631 src_infos_psi->data_buffer.create_time = 0;
1632 }
1633 }
1634
1635 /*
1636 +-------------------------------------------------------------------------------------+
1637 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1638 | STATE : code ROUTINE : aci_bat_check_for_multi_line_response_command |
1639 +-------------------------------------------------------------------------------------+
1640
1641 PURPOSE : Some BAT commands send several responses to the application (CPBR,COPN,...).
1642 To avoid eating up too much memory with aci_bat_buffer_dti_data(),
1643 these multi line response commands send only a limited number of responses
1644 at once. After that the command stores the current context (how many
1645 responses it already sent and how many it still has to sent) and gives up
1646 the CPU context. With it we return to pei_primitive and the frame is able
1647 to pass the next primtive from ACI's input queue to the next call of pei_primitive.
1648 In case of a DTI_REASON_TX_BUFFER_READY we will check in this function
1649 whether there is still a multi line BAT command active. If so, we call this
1650 BAT function once again with updated parameters to send the next responses.
1651 */
1652
1653 GLOBAL void aci_bat_check_for_multi_line_response_command(UBYTE src_id)
1654 {
1655 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
1656 T_ACI_DTI_PRC_PSI *src_infos_psi = NULL;
1657
1658 TRACE_FUNCTION("aci_bat_check_for_multi_line_response_command()");
1659
1660 src_infos_psi = find_element (psi_src_params, src_id, cmhPSItest_srcId);
1661
1662 if(src_infos_psi->large_type) /* large type means multi line responses */
1663 {
1664 switch (src_infos_psi->bat_client[src_infos_psi->active_client].curCmd)
1665 {
1666 case (BAT_CMD_SET_PLUS_CPBR):
1667 {
1668 ret = sBAT_PlusCPBR_CB(src_infos_psi);
1669 /* vsi_t_sleep (aci_handle, 3000); for testing only */
1670 break;
1671 }
1672 case (BAT_CMD_SET_PLUS_CPBF):
1673 {
1674 ret = sBAT_PlusCPBF_CB(src_infos_psi);
1675 /* vsi_t_sleep (aci_handle, 3000); for testing only */
1676 break;
1677 }
1678 default:
1679 {
1680 TRACE_EVENT_P1("aci_bat_check_for_multi_line_response_command(): cmd %04X has no multi line responses",
1681 src_infos_psi->bat_client[src_infos_psi->active_client].curCmd);
1682 return;
1683 }
1684 }
1685
1686 switch (ret)
1687 {
1688 case (ACI_BAT_CMPL):
1689 {
1690 srcId_cb = src_infos_psi->srcId;
1691 rBAT_OK((T_ACI_AT_CMD)src_infos_psi->bat_client[src_infos_psi->active_client].curCmd);
1692 break;
1693 }
1694 case (ACI_BAT_EXCT):
1695 {
1696 break;
1697 }
1698 default:
1699 {
1700 aci_bat_err(src_infos_psi);
1701 }
1702 }
1703 }
1704 }
1705
1706
1707 /*
1708 +--------------------------------------------------------------------+
1709 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1710 | STATE : code ROUTINE : aci_bat_cur_cmd_get |
1711 +--------------------------------------------------------------------+
1712
1713 PURPOSE : Get the current command of the specified source.
1714 */
1715 GLOBAL T_BAT_ctrl_params aci_bat_cur_cmd_get (T_ACI_DTI_PRC_PSI *src_infos_psi)
1716 {
1717 if (src_infos_psi EQ NULL)
1718 return((T_BAT_ctrl_params)-1);
1719
1720 if (src_infos_psi->bat_client EQ NULL)
1721 return((T_BAT_ctrl_params)-1);
1722
1723 return(src_infos_psi->bat_client[src_infos_psi->active_client].curCmd);
1724 }
1725
1726 /*
1727 +--------------------------------------------------------------------+
1728 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1729 | STATE : code ROUTINE : aci_bat_cs_get |
1730 +--------------------------------------------------------------------+
1731
1732 PURPOSE : Get the character set, potentially for BAT or even the
1733 individual client, though for now it just returns the
1734 value of the ATI global variable 'cscsChset'.
1735 */
1736 GLOBAL T_BAT_plus_cscs_cs aci_bat_cs_get (T_ACI_DTI_PRC_PSI *src_infos_psi)
1737 {
1738 /*
1739 * Necessary for target build?
1740 */
1741 src_infos_psi=src_infos_psi;
1742
1743 /*
1744 * This relies on T_BAT_plus_cscs_cs being equivalent to
1745 * T_ACI_CSCS_CHSET. It is, except that the ACI version has
1746 * a 'NotPresent' value, which we must deal with.
1747 */
1748 if (ati_user_output_cfg[src_infos_psi->srcId].cscsChset EQ CSCS_CHSET_NotPresent)
1749 return(BAT_CSCS_CS_IRA);
1750 else
1751 return((T_BAT_plus_cscs_cs)ati_user_output_cfg[src_infos_psi->srcId].cscsChset);
1752 }
1753
1754 /*
1755 +--------------------------------------------------------------------+
1756 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1757 | STATE : code ROUTINE : aci_bat_cs_set |
1758 +--------------------------------------------------------------------+
1759
1760 PURPOSE : Set the character set, potentially for BAT or even the
1761 individual client, though for now it just acts on the
1762 ATI global variable 'cscsChset'.
1763 */
1764 GLOBAL void aci_bat_cs_set (T_ACI_DTI_PRC_PSI *src_infos_psi,
1765 T_BAT_plus_cscs_cs cs)
1766 {
1767 /*
1768 * Necessary for target build?
1769 */
1770 src_infos_psi=src_infos_psi;
1771
1772 /*
1773 * This relies on T_BAT_plus_cscs_cs being equivalent to
1774 * T_ACI_CSCS_CHSET. It is, except that the ACI version has
1775 * a 'NotPresent' value. As the input to this function is in
1776 * BAT format, this will not be a problem.
1777 */
1778 if ((cs>=BAT_CSCS_CS_IRA) AND (cs<=BAT_CSCS_CS_UCS2))
1779 {
1780 ati_user_output_cfg[src_infos_psi->srcId].cscsChset=(T_ACI_CSCS_CHSET)cs;
1781 TRACE_EVENT_P1 ("aci_bat_cs_set(): new charset is %i", cs);
1782 }
1783 }
1784
1785 /*
1786 +--------------------------------------------------------------------+
1787 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1788 | STATE : code ROUTINE : aci_bat_rcv |
1789 +--------------------------------------------------------------------+
1790
1791 PURPOSE : called by sig_dti_data_received_ind(), see sap_dti.c
1792 */
1793 GLOBAL void aci_bat_rcv (T_ACI_DTI_PRC_PSI *src_infos_psi, T_DTI2_DATA_IND *dti_data_ind)
1794 {
1795 U8 src_id = src_infos_psi->srcId;
1796 T_desc2 *p_desc = (T_desc2 *)NULL;
1797 T_L2P_STATUS l2p_status = L2P_STAT_UNKNOWN_ERROR;
1798
1799 TRACE_FUNCTION("aci_bat_rcv()");
1800
1801 if (aci_bat_first_time)
1802 {
1803 aci_bat_first_time = FALSE;
1804 aci_bat_init_globs();
1805 }
1806
1807 if (aci_bat_globs[src_id].l2p_configured EQ FALSE)
1808 {
1809 if (aci_bat_bootstrap_l2p(src_infos_psi, dti_data_ind) EQ TRUE)
1810 {
1811 aci_bat_globs[src_id].l2p_configured = TRUE;
1812 aci_bat_globs[src_id].psi_src = src_infos_psi;
1813 }
1814 else
1815 {
1816 return; /* trace message already in aci_bat_bootstrap_l2p */
1817 }
1818 }
1819
1820 p_desc = (T_desc2 *)dti_data_ind->desc_list2.first;
1821
1822 if (aci_bat_globs[src_id].psi_src NEQ src_infos_psi)
1823 {
1824 /* maintenance problem, just a reminder that there is still something to do */
1825 TRACE_ERROR("aci_bat_rcv(): race condition between two PSI sources");
1826 }
1827 aci_bat_globs[src_id].psi_src = src_infos_psi;
1828
1829 /*
1830 * L2P_Receive() calls aci_bat_l2p_msg_rxd_cb() and returns with
1831 * a senseful value, which could used by ourself to decide what to do.
1832 * callback functions make it hard to follow the function flow.
1833 */
1834 l2p_status = L2P_Receive(aci_bat_globs[src_id].l2p_id, /* unique identifier */
1835 (void *)p_desc->buffer, /* first segment buffer */
1836 (void *)p_desc, /* first segment descriptor */
1837 dti_data_ind->desc_list2.list_len, /* total size */
1838 p_desc->size); /* first segment size */
1839
1840 switch (l2p_status)
1841 {
1842 case (L2P_STAT_SUCCESS): /* BAT command has been processed */
1843 break;
1844 default: /* any error */
1845 TRACE_EVENT_P1("aci_bat_rcv(): L2P status = %d", l2p_status);
1846 break;
1847 }
1848 }
1849
1850 /*
1851 +--------------------------------------------------------------------+
1852 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1853 | STATE : code ROUTINE : aci_bat_ctrl_rcv |
1854 +--------------------------------------------------------------------+
1855
1856 PURPOSE : BAT Library sent a control signal to BAT Module
1857 */
1858 GLOBAL void aci_bat_ctrl_rcv (T_ACI_DTI_PRC_PSI *src_infos_psi, T_BATC_signal *signal)
1859 {
1860 T_BATC_confirm confirm;
1861
1862 TRACE_FUNCTION("aci_bat_ctrl_rcv()");
1863
1864 switch (signal->ctrl_params)
1865 {
1866 case (BATC_MAX_CLIENTS):
1867 {
1868 T_BATC_max_clients max_clients;
1869 aci_bat_init_max_client_maintenance(src_infos_psi, (U8)signal->params.ptr_max_clients->num_clients);
1870 confirm.rsp_params = BATC_MAX_CLIENTS_CNF;
1871 /* acknowledge with the same data, because L2P does not accept NULL pointer */
1872 confirm.rsp.ptr_bat_open_client_cnf = (T_BATC_open_client *)&max_clients;
1873 max_clients.num_clients = signal->params.ptr_max_clients->num_clients;
1874 TRACE_EVENT_P2("aci_bat_ctrl_rcv(): BAT Lib instance with %d clients for src_id %d",
1875 (U8)signal->params.ptr_max_clients->num_clients, src_infos_psi->srcId);
1876 break;
1877 }
1878 case (BATC_OPEN_CLIENT):
1879 {
1880 T_BATC_open_client open_client;
1881 src_infos_psi->bat_client[signal->params.ptr_open_client->client_id].opened = TRUE;
1882 confirm.rsp_params = BATC_OPEN_CLIENT_CNF;
1883 confirm.rsp.ptr_bat_open_client_cnf = &open_client;
1884 confirm.rsp.ptr_bat_open_client_cnf->client_id = signal->params.ptr_open_client->client_id;
1885 TRACE_EVENT_P2("aci_bat_ctrl_rcv(): BAT Lib client %d for src_id %d opened",
1886 (U8)signal->params.ptr_open_client->client_id, src_infos_psi->srcId);
1887 break;
1888 }
1889 case (BATC_CLOSE_CLIENT):
1890 {
1891 aci_bat_clean_client_maintenance(src_infos_psi, (U8)signal->params.ptr_close_client->client_id);
1892 TRACE_EVENT_P2("aci_bat_ctrl_rcv(): BAT Lib client %d for src_id %d closed",
1893 (U8)signal->params.ptr_close_client->client_id, src_infos_psi->srcId);
1894 #ifndef _SIMULATION_
1895 /* make DTI happy with its flow control stuff */
1896 psa_psi_DTI_getdata ((UBYTE)(src_infos_psi->srcId), DTI_ENTITY_PSI);
1897 #endif
1898 return; /* return, because it is not confirmed to BAT library */
1899 }
1900 case (BATC_ABORT_CMD):
1901 {
1902 T_BATC_abort_cmd abort_cmd;
1903 U8 client_id = (U8)(signal->params.ptr_abort_cmd->client_id);
1904 T_BAT_ctrl_params curCmd = src_infos_psi->bat_client[client_id].curCmd;
1905
1906 if (src_infos_psi->run_cmd EQ FALSE)
1907 {
1908 /*
1909 * there is no command running at all, but return with confirmation
1910 * to make the state machine of BAT Lib happy
1911 */
1912 confirm.rsp_params = BATC_ABORT_COMMAND_CNF;
1913 TRACE_EVENT("aci_bat_ctrl_rcv(): no command to abort");
1914 }
1915 else if (aci_bat_abort(src_infos_psi, client_id))
1916 {
1917 confirm.rsp_params = BATC_ABORT_COMMAND_CNF;
1918 TRACE_EVENT_P1("aci_bat_ctrl_rcv(): aborted the command %d ", curCmd);
1919 src_infos_psi->run_cmd = FALSE;
1920 }
1921 else
1922 {
1923 TRACE_EVENT_P1("aci_bat_ctrl_rcv(): failed aborting command %d ", curCmd);
1924 confirm.rsp_params = BATC_ABORT_COMMAND_REJ;
1925 }
1926 if (src_infos_psi->bat_client[client_id].curCmd EQ (T_BAT_ctrl_params)BATC_ABORT_CMD)/*lint !e650 (Warning - constant out of range for operator) */
1927 {
1928 TRACE_EVENT_P1("aci_bat_ctrl_rcv(): executing to abort command %d ", curCmd);
1929 return; /* do nothing, (call must be disconnected), takes some time, then send OK via rBAT_OK*/
1930 }
1931 abort_cmd.client_id = client_id;
1932 confirm.rsp.ptr_bat_abort_command_cnf = &abort_cmd;
1933 break;
1934 }
1935 default:
1936 TRACE_EVENT("aci_bat_ctrl_rcv(): unknown ctrl_params");
1937 return; /* control signal to BAT library */
1938 }
1939 src_infos_psi->active_client = BAT_CTRL_CHANNEL; /* control channel */
1940 /* command responses and signal confirmations are organized in exactly the same way,
1941 but signal confirmation must be casted to a command response */
1942 aci_bat_send(src_infos_psi, (T_BAT_cmd_response *)&confirm);
1943 }
1944
1945 /*
1946 +--------------------------------------------------------------------+
1947 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
1948 | STATE : code ROUTINE : aci_bat_send |
1949 +--------------------------------------------------------------------+
1950
1951 PURPOSE :
1952 */
1953 GLOBAL void aci_bat_send (T_ACI_DTI_PRC_PSI *src_infos_psi,
1954 T_BAT_cmd_response *resp)
1955 {
1956 T_L2P_STATUS l2p_status = L2P_STAT_UNKNOWN_ERROR;
1957 int errVal = -1;
1958 U8 client_id = 0xFF; /*broadcast */
1959 U16 resp_len = 0;
1960
1961 TRACE_FUNCTION("aci_bat_send()");
1962
1963 if (BITFIELD_CHECK(resp->ctrl_response, BAT_BIT_12) || /* 0x1xxx = unsolicited --> broadcast */
1964 resp->ctrl_response EQ BAT_RES_UNS_PLUS_CRING ||
1965 resp->ctrl_response EQ BAT_RES_UNS_PLUS_CCWV)
1966 {
1967 client_id = 0xFF; /* broadcast */
1968 TRACE_EVENT_P1("aci_bat_send(): unsolicited response 0x%04X over broadcast channel", resp->ctrl_response);
1969 }
1970 else
1971 {
1972 client_id = src_infos_psi->active_client; /* not a broadcast message */
1973 TRACE_EVENT_P2("aci_bat_send(): response 0x%04X on client channel %d", resp->ctrl_response, client_id);
1974 }
1975
1976 if (BITFIELD_CHECK(resp->ctrl_response, BAT_BIT_15)) /* 0x8xxx = control response */
1977 {
1978 resp_len = 4; /* the resp->ctrl_response (for L2P = Cmd Tag) does not count to resp length */
1979 }
1980 else
1981 {
1982 resp_len = aci_bat_get_size(resp->ctrl_response);
1983 }
1984
1985 TRACE_EVENT_P2("aci_bat_send(): response = 0x%04X, size = %i", resp->ctrl_response, resp_len);
1986 TRACE_BINDUMP(aci_handle, TC_USER4, "BAT RESPONSE PARAMETER", (U8 *)resp->response.ptr_at_ok, resp_len);
1987
1988
1989 /*
1990 * The format of an L2 frame for BAT will be as follows :
1991 *
1992 * For the first frame
1993 * ----------------------------------------------------------------
1994 * | L2P Header | BAT Cmd TAG | BAT Command Data |
1995 * | (n Bytes) | 4 Bytes | (Remaining Bytes) |
1996 * ----------------------------------------------------------------
1997 *
1998 * For any subsequent frames
1999 * ----------------------------------------------------------------
2000 * | L2 Header | BAT Command Data |
2001 * | (n Bytes) | (Remaining Bytes) |
2002 * ----------------------------------------------------------------
2003 */
2004 srcId_cb = src_infos_psi->srcId;
2005
2006 l2p_status = L2P_Send(aci_bat_globs[src_infos_psi->srcId].l2p_id, /* unique identifier */
2007 client_id,
2008 resp->ctrl_response, /* this is the important thing */
2009 resp->response.ptr_at_ok, /* don't worry, it always points to the right thing */
2010 resp_len,
2011 &errVal);
2012 switch (l2p_status)
2013 {
2014 case (L2P_STAT_SUCCESS):
2015 if (resp->ctrl_response <= BAT_RES_PLUS_EXT_ERROR)
2016 {
2017 if (src_infos_psi->large_type EQ FALSE) /* not CPBR, COPN, ... */
2018 {
2019 src_infos_psi->run_cmd = FALSE;
2020 src_infos_psi->bat_client[src_infos_psi->active_client].curCmd = (T_BAT_ctrl_params)-1;
2021 }
2022 }
2023 break;
2024 default:
2025 TRACE_EVENT_P1("aci_bat_send(): l2p_status = %d", l2p_status);
2026 TRACE_EVENT_P1("aci_bat_send(): errVal = %d", errVal); /* what is so special ? */
2027 break;
2028 }
2029 #ifndef _SIMULATION_
2030 /* make DTI happy with its flow control stuff */
2031 psa_psi_DTI_getdata ((UBYTE)(src_infos_psi->srcId), DTI_ENTITY_PSI);
2032 #endif
2033 }
2034
2035
2036 GLOBAL void aci_bat_run_cmd (T_ACI_DTI_PRC_PSI *src_infos_psi)
2037 {
2038 U8 client_id;
2039 T_BAT_cmd_send cmd;
2040
2041 TRACE_FUNCTION("aci_bat_run_cmd()");
2042
2043 /* run all pending commands from the queue */
2044 while (aci_bat_queue_get(src_infos_psi->queue, &cmd, &client_id) EQ TRUE)
2045 {
2046 src_infos_psi->bat_client[client_id].curCmd = cmd.ctrl_params;
2047 src_infos_psi->active_client = client_id;
2048 src_infos_psi->run_cmd = TRUE;
2049
2050 TRACE_EVENT_P1("client_id = %d", client_id);
2051 TRACE_EVENT_P1("command identifier = 0x%04X", cmd.ctrl_params);
2052 TRACE_BINDUMP(aci_handle, TC_USER4, "BAT COMMAND PARAMETER 3", (U8 *)cmd.params.ptr_at_a, 4);
2053
2054 /* run the command, result code is send back also from wrapper */
2055 switch (aci_bat_wrapper(src_infos_psi, &cmd)) /* run the command */
2056 {
2057 case (ACI_BAT_EXCT):
2058 {
2059 ACI_MFREE(cmd.params.ptr_andc); /* was allocated in aci_bat_queue_put() */
2060 return; /* asynchronous command terminates with rBAT_OK ... rBAT_NO_ANSWER */
2061 }
2062 default:
2063 {
2064 src_infos_psi->bat_client[client_id].curCmd = (T_BAT_ctrl_params)-1;
2065 src_infos_psi->active_client = 0xFF;
2066 src_infos_psi->run_cmd = FALSE;
2067 ACI_MFREE(cmd.params.ptr_andc); /* was allocated in aci_bat_queue_put() */
2068 break; /* terminated, so start with the next command */
2069 }
2070 }
2071 }
2072 }
2073
2074
2075
2076 /*
2077 +--------------------------------------------------------------------+
2078 | PROJECT : GSM-F&D (8411) MODULE : ACI_BAT |
2079 | STATE : code ROUTINE : aci_bat_wrapper |
2080 +--------------------------------------------------------------------+
2081
2082 PURPOSE :
2083 */
2084 GLOBAL T_ACI_BAT_RSLT aci_bat_wrapper (T_ACI_DTI_PRC_PSI *src_infos_psi, T_BAT_cmd_send *cmd)
2085 {
2086 U16 index = 0;
2087 T_ACI_BAT_RSLT ret = ACI_BAT_FAIL;
2088
2089 if (BITFIELD_CHECK(cmd->ctrl_params, BAT_BIT_12)) /* 0x1000 */
2090 {
2091 index = (U16)(cmd->ctrl_params - BAT_BIT_12);
2092 if (bat_cmds_without_params[index].fptr)
2093 {
2094 ret = bat_cmds_without_params[index].fptr(src_infos_psi, cmd);
2095 }
2096 else
2097 {
2098 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow);
2099 }
2100 }
2101 else
2102 {
2103 index = (U16)cmd->ctrl_params;
2104 if (bat_cmds[index].fptr)
2105 {
2106 ret = bat_cmds[index].fptr(src_infos_psi, cmd);
2107 }
2108 else
2109 {
2110 ACI_ERR_DESC( ACI_ERR_CLASS_Cme, CME_ERR_OpNotAllow);
2111 }
2112 }
2113
2114 switch (ret)
2115 {
2116 case ACI_BAT_FAIL:
2117 /*
2118 * The reason for the failure will have been stored in aciErrDesc,
2119 * we first call aci_bat_err() to translate this into a BAT
2120 * response message (CME ERROR / CMS ERROR / CEER) and send it.
2121 */
2122 aci_bat_err(src_infos_psi);
2123 break;
2124
2125 case ACI_BAT_CMPL:
2126 /*
2127 * Send OK.
2128 */
2129 {
2130 T_BAT_cmd_response resp;
2131 T_BAT_no_parameter dummy;
2132
2133 resp.ctrl_response=BAT_RES_AT_OK;
2134 resp.response.ptr_at_ok=(T_BAT_no_parameter *)&dummy;
2135 dummy.bat_dummy = 0xFF;
2136 TRACE_EVENT("aci_bat_wrapper(): OK");
2137 aci_bat_send(src_infos_psi,&resp);
2138 }
2139 break;
2140
2141 case ACI_BAT_BUSY:
2142 /*
2143 * Send BUSY.
2144 */
2145 {
2146 T_BAT_cmd_response resp;
2147 T_BAT_no_parameter dummy;
2148
2149 resp.ctrl_response=BAT_RES_AT_BUSY;
2150 resp.response.ptr_at_busy=(T_BAT_no_parameter *)&dummy;
2151 dummy.bat_dummy = 0xFF;
2152 TRACE_EVENT("aci_bat_wrapper(): BUSY");
2153 aci_bat_send(src_infos_psi,&resp);
2154 }
2155 break;
2156
2157 case ACI_BAT_EXCT:
2158 /*
2159 * This return value implies interaction with the protocol stack,
2160 * and the response will be delivered via an rBAT_xxx(). No further
2161 * action needs to be taken at this point.
2162 */
2163 TRACE_EVENT("aci_bat_wrapper(): EXCT");
2164 #ifdef _SIMULATION_
2165 src_infos_psi->res.response = NULL;
2166 #endif
2167 break;
2168
2169 default:
2170 /*
2171 * Reaching this point, which should not happen, may indicate that
2172 * T_ACI_BAT_RSLT is no longer identical to T_ACI_RETURN - and it
2173 * needs to be.
2174 */
2175 break;
2176 }
2177 return (ret);
2178 }
2179
2180 #endif /* ACI_BAT_C */