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