comparison src/g23m-aci/aci/ati_em.c @ 162:53929b40109c

src/g23m-aci: initial import from TCS3.2/LoCosto
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 11 Oct 2016 02:02:43 +0000
parents
children
comparison
equal deleted inserted replaced
161:4557e2a9c18e 162:53929b40109c
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul :
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 module provides the ati interface for the engineering mode.
18 +-----------------------------------------------------------------------------
19 */
20
21
22 #undef DUMMY_ATI_STRINGS
23
24 #include "aci_all.h"
25
26 #include "aci_cmh.h"
27 #include "ati_cmd.h"
28 #include "aci_io.h"
29 #include "aci_cmd.h"
30 #include "l4_tim.h"
31 #include "aci_em.h"
32
33 #include "aci_mem.h"
34 #include "aci_prs.h"
35 #include "aci_lst.h"
36
37 #include "ati_int.h"
38
39 #ifdef FF_ATI_BAT
40
41 #include "typedefs.h"
42 #include "gdd.h"
43 #include "bat.h"
44
45 #include "ati_bat.h"
46
47 #endif /*FF_ATI_BAT*/
48
49 /*==== EXPORT =====================================================*/
50 /*==== VARIABLES ==================================================*/
51 /*==== FUNCTIONS ==================================================*/
52 /*==== CONSTANTS ==================================================*/
53 #define EMET_L1 0x0001
54 #define EMET_ALL 0x00ff
55
56 /*
57 +------------------------------------------------------------------------------
58 | Function : setatPercentEM
59 +------------------------------------------------------------------------------
60 | Description : AT-cmd for the EM infrastructure data
61 |
62 |
63 | Parameters : char *cl
64 | UBYTE srcId
65 |
66 | Return : char *
67 +------------------------------------------------------------------------------
68 */
69 GLOBAL T_ATI_RSLT setatPercentEM (char *cl, UBYTE srcId)
70 {
71 T_ACI_RETURN ret = AT_FAIL;
72 T_EM_AT_MODE mode = (T_EM_AT_MODE)ACI_NumParmNotPresent;
73 T_EM_AT_TYPE type = (T_EM_AT_TYPE)ACI_NumParmNotPresent;
74 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
75
76 src_params->curAtCmd = AT_CMD_EM;
77
78 cl = parse (cl, "dd", &mode, &type);
79
80 if ( (mode NEQ SIN_REP) AND (mode NEQ PCO_REP) )
81 {
82 cmdCmeError (CME_ERR_OpNotSupp);
83 return ATI_FAIL;
84 }
85
86 if ( (mode EQ SIN_REP) AND ((type EQ ACI_NumParmNotPresent) OR ((type < EM_AT_SC) AND (type > EM_AT_PDP))) )
87 {
88 cmdCmeError (CME_ERR_OpNotSupp);
89 return ATI_FAIL;
90 }
91
92 if ( (mode EQ PCO_REP) AND ((type EQ ACI_NumParmNotPresent) OR (type > EM_AT_PCO_HIGHEST-1)) )
93 {
94 cmdCmeError (CME_ERR_OpNotSupp);
95 return ATI_FAIL;
96 }
97
98 if (type EQ ACI_NumParmNotPresent)
99 {
100 type = EM_AT_SC;
101 }
102
103 srcId_cb = srcId;
104
105 #ifdef FF_ATI_BAT
106 {
107 T_BAT_cmd_send cmd;
108 T_BAT_cmd_set_percent_em my_bat_set_percent_em;
109
110 TRACE_FUNCTION("setatPercentEM() calls bat_send() <=== as APPLICATION");
111
112 memset(&my_bat_set_percent_em, 0, sizeof(my_bat_set_percent_em));
113 cmd.ctrl_params = BAT_CMD_SET_PERCENT_EM;
114 cmd.params.ptr_set_percent_em = &my_bat_set_percent_em;
115
116 my_bat_set_percent_em.mode = mode;
117 my_bat_set_percent_em.sin_type = type;
118 my_bat_set_percent_em.pco_type = type;
119
120 bat_send(ati_bat_get_client(srcId), &cmd);
121
122 return ATI_EXCT; /* executing, because response is passed by callback function */
123 }
124
125 #else /* OLD FUNCTION BODY */
126
127 TRACE_FUNCTION("setatPercentEM()");
128
129 ret = sAT_PercentEM((T_ACI_CMD_SRC)srcId, mode, type);
130
131 switch(ret)
132 {
133 case AT_CMPL:
134 break;
135
136 case AT_EXCT:
137 src_params->curAtCmd = AT_CMD_EM;
138 break;
139
140 case AT_FAIL:
141 cmdCmeError(CME_ERR_Unknown);
142 break;
143
144 default:
145 cmdCmeError(CME_ERR_Unknown);
146 break;
147 } /* switch */
148 return (map_aci_2_ati_rslt(ret));
149
150 #endif /* no FF_ATI_BAT*/
151 }
152
153 /*
154 +------------------------------------------------------------------------------
155 | Function : setatPercentEMET
156 +------------------------------------------------------------------------------
157 | Description : AT-cmd for the EM event traces
158 |
159 |
160 | Parameters : char *cl
161 | UBYTE srcId
162 |
163 | Return : char *
164 +------------------------------------------------------------------------------
165 */
166 GLOBAL T_ATI_RSLT setatPercentEMET (char *cl, UBYTE srcId)
167 {
168 T_ACI_RETURN ret = AT_EXCT;
169 SHORT type = ACI_NumParmNotPresent;
170 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
171
172
173 TRACE_FUNCTION("setatPercentEMET()");
174
175 cl = parse (cl, "d", &type);
176
177 /* if type is not in range then error*/
178 if ((type < EMET_L1) OR (type > EMET_ALL))
179 {
180 cmdCmeError (CME_ERR_OpNotSupp);
181 return ATI_FAIL;
182 }
183
184 srcId_cb = srcId;
185
186 ret = sAT_PercentEMET((T_ACI_CMD_SRC)srcId, (UBYTE)type);
187
188 switch(ret)
189 {
190 case AT_CMPL:
191 break;
192
193 case AT_EXCT:
194 src_params->curAtCmd = AT_CMD_EMET;
195 break;
196
197 case AT_FAIL:
198 cmdCmeError(CME_ERR_Unknown);
199 break;
200
201 default:
202 cmdCmeError(CME_ERR_Unknown);
203 break;
204 } /* switch */
205 return (map_aci_2_ati_rslt(ret));
206 } /* setatPercentEMET */
207
208 /*
209 +------------------------------------------------------------------------------
210 | Function : setatPercentEMETS
211 +------------------------------------------------------------------------------
212 | Description : AT-cmd for the EM event traces
213 |
214 |
215 | Parameters : char *cl
216 | UBYTE srcId
217 |
218 | Return : char *
219 +------------------------------------------------------------------------------
220 */
221 GLOBAL T_ATI_RSLT setatPercentEMETS (char *cl, UBYTE srcId)
222 {
223 T_ACI_RETURN ret = AT_EXCT;
224 SHORT subclass = ACI_NumParmNotPresent;
225 ULONG bitm_h = (ULONG)ACI_NumParmNotPresent;
226 ULONG bitm_l = (ULONG)ACI_NumParmNotPresent;
227 T_ATI_SRC_PARAMS *src_params = find_element (ati_src_list, srcId, search_ati_src_id);
228
229 TRACE_FUNCTION("setatPercentEMETS()");
230
231 cl = parse (cl, "dyy", &subclass, &bitm_h, &bitm_l);
232
233 if ( (subclass < EM_L1) OR (subclass > EM_SIM) )
234 {
235 cmdCmeError (CME_ERR_OpNotSupp);
236 return ATI_FAIL;
237 }
238
239 srcId_cb = srcId;
240
241 ret = sAT_PercentEMETS((T_ACI_CMD_SRC)srcId, (UBYTE)subclass, bitm_h, bitm_l);
242
243 switch(ret)
244 {
245 case AT_CMPL:
246 break;
247
248 case AT_EXCT:
249 src_params->curAtCmd = AT_CMD_EMETS;
250 break;
251
252 case AT_FAIL:
253 cmdCmeError(CME_ERR_Unknown);
254 break;
255
256 default:
257 cmdCmeError(CME_ERR_Unknown);
258 break;
259 } /* switch */
260 return (map_aci_2_ati_rslt(ret));
261 } /* setatPercentEMETS */
262
263
264
265 /*+++++++++++++++++++++++++++++++++++++++++ E O F +++++++++++++++++++++++++++++++++++++++++*/
266