FreeCalypso > hg > fc-magnetite
comparison src/cs/services/atp/atp_env.c @ 0:945cf7f506b2
src/cs: chipsetsw import from tcs211-fcmodem
binary blobs and LCD demo files have been excluded,
all line endings are LF only
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 25 Sep 2016 22:50:11 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:945cf7f506b2 |
---|---|
1 /******************************************************************************* | |
2 * | |
3 * File Name : atp_env.c | |
4 * | |
5 * Generic functions of ATP definition | |
6 * | |
7 * (C) Texas Instruments, all rights reserved | |
8 * | |
9 * Version number : 0.1 Date : 28-Feb-2000 | |
10 * | |
11 * History : 0.1 - Created by E. Baissus | |
12 * : 0.9 (3-May-2000) : reviewed | |
13 * | |
14 * Author : Eric Baissus : e-baissus@ti.com | |
15 * | |
16 * (C) Copyright 2000 by Texas Instruments Incorporated, All Rights Reserved | |
17 ******************************************************************************/ | |
18 | |
19 //#include "rv_general.h" | |
20 #include "rvf/rvf_api.h" | |
21 #include "atp/atp_api.h" | |
22 #include "atp/atp_i.h" | |
23 #include "atp/atp_config.h" | |
24 #include "atp/atp_env.h" | |
25 #include "rvm/rvm_priorities.h" | |
26 #include "rvm/rvm_gen.h" | |
27 #include "rvm/rvm_use_id_list.h" | |
28 | |
29 #include <string.h> | |
30 | |
31 | |
32 /* Memory bank dedicated to internal use of ATP entity (initiated in atp_init) */ | |
33 T_RVF_MB_ID atp_mb_prim; | |
34 T_RVM_RETURN (*atp_error_ft)(T_RVM_NAME swe_name, T_RVM_RETURN error_cause, \ | |
35 T_RVM_ERROR_TYPE error_type,T_RVM_STRING error_msg); | |
36 | |
37 T_ATP_SWE_STATE atp_swe_state = ATP_STOPPED; | |
38 | |
39 | |
40 /****************************************************************************** | |
41 * Function name: atp_get_info | |
42 * | |
43 * Description : Generic ATP get info function : provide general information | |
44 * regarding the ATP SWE to the Riviera Manager | |
45 * For more details, see Riviera Manager documentation | |
46 * | |
47 * Parameters : Pointer on the info structure | |
48 * | |
49 * Return : Always OK | |
50 * | |
51 * History : 0.1 (30-May-2000) - Created | |
52 * | |
53 ******************************************************************************/ | |
54 T_RVM_RETURN atp_get_info (T_RVM_INFO_SWE * swe_info_p) | |
55 { | |
56 if (swe_info_p == NULL) | |
57 { | |
58 return RVM_INVALID_PARAMETER; | |
59 } | |
60 | |
61 /* Provide SWE USEID and type */ | |
62 swe_info_p->swe_type = RVM_SWE_TYPE_1; | |
63 swe_info_p->type_info.type1.swe_use_id = ATP_USE_ID; | |
64 strcpy (swe_info_p->type_info.type1.swe_name, | |
65 "ATP"); | |
66 | |
67 /* Return Path of ATP */ | |
68 swe_info_p->type_info.type1.return_path.callback_func = NULL; | |
69 swe_info_p->type_info.type1.return_path.addr_id = 0; | |
70 | |
71 | |
72 /* ATP MB */ | |
73 swe_info_p->type_info.type1.nb_mem_bank = 1; | |
74 memcpy (swe_info_p->type_info.type1.mem_bank[0].bank_name, | |
75 "ATP_PRIM", | |
76 sizeof("ATP_PRIM")); | |
77 swe_info_p->type_info.type1.mem_bank[0].initial_params.size = ATP_MB_PRIM_SIZE; | |
78 swe_info_p->type_info.type1.mem_bank[0].initial_params.watermark = ATP_MB_PRIM_WATERMARK; | |
79 | |
80 /* ATP generic RVM functions */ | |
81 swe_info_p->type_info.type1.init = &atp_init; | |
82 swe_info_p->type_info.type1.start = &atp_start; | |
83 swe_info_p->type_info.type1.stop = &atp_stop; | |
84 swe_info_p->type_info.type1.kill = &atp_kill; | |
85 swe_info_p->type_info.type1.set_info = &atp_set_info; | |
86 | |
87 /* Linked SW entities : ATP does not need any other entity to run | |
88 Actually, other SWE will register to ATP before using its services */ | |
89 swe_info_p->type_info.type1.nb_linked_swe = 0; | |
90 | |
91 return RVM_OK; | |
92 } | |
93 | |
94 | |
95 | |
96 /****************************************************************************** | |
97 * Function name: atp_set_info | |
98 * | |
99 * Description : Generic ATP set info function : environment use it to set a | |
100 * a certain number of information for ATP | |
101 * For more details, see Riviera Manager documentation | |
102 * | |
103 * Parameters : | |
104 * | |
105 * Return : Always OK | |
106 * | |
107 * History : 0.1 (30-May-2000) - Created | |
108 * | |
109 ******************************************************************************/ | |
110 T_RVM_RETURN | |
111 atp_set_info(T_RVF_ADDR_ID addr_id, | |
112 T_RV_RETURN return_path[], | |
113 T_RVF_MB_ID mb_id[], | |
114 T_RVM_RETURN (*rvm_error_ft) ( T_RVM_NAME swe_name, | |
115 T_RVM_RETURN error_cause, | |
116 T_RVM_ERROR_TYPE error_type, | |
117 T_RVM_STRING error_msg) ) | |
118 { | |
119 | |
120 /* Save the parameters given by environment */ | |
121 | |
122 /* Bank Ids */ | |
123 atp_mb_prim = mb_id [0]; | |
124 | |
125 /* Error function */ | |
126 atp_error_ft = rvm_error_ft; | |
127 | |
128 return RVM_OK; | |
129 } | |
130 | |
131 | |
132 | |
133 | |
134 | |
135 | |
136 /****************************************************************************** | |
137 * Function name: atp_init | |
138 * | |
139 * Description : This function is used to initialise the ATP entity | |
140 * | |
141 * Parameters : none | |
142 * | |
143 * Return : Standard error | |
144 * RV_OK | |
145 * | |
146 * History : 0.1 (29-Feb-2000) | |
147 * : 0.9 (3-May-2000) : reviewed | |
148 * : 1.0 (30-May-2000) updated to support RVM | |
149 ******************************************************************************/ | |
150 T_RVM_RETURN atp_init(void) | |
151 { | |
152 UINT8 i; | |
153 | |
154 | |
155 // Initialise global variables used by ATP | |
156 atp_nb_sw_entity=0; // Number of SW entity which has been registered into ATP excluding GSM | |
157 atp_first_port_p = NULL; // No port instance has been created yet | |
158 | |
159 // Initialise SW entity list table | |
160 for(i=1;i<(ATP_MAX_NB_SW_ENTITY+1);i++) | |
161 { | |
162 atp_sw_entity_table_p[i]=NULL; | |
163 } | |
164 | |
165 atp_swe_state=ATP_STARTED ; | |
166 | |
167 rvf_send_trace("ATP : Initialisation performed ",31,NULL_PARAM,RV_TRACE_LEVEL_DEBUG_LOW, | |
168 ATP_USE_ID); | |
169 | |
170 return RVM_OK; | |
171 } | |
172 | |
173 | |
174 | |
175 | |
176 | |
177 | |
178 /****************************************************************************** | |
179 * Function name: atp_start | |
180 * | |
181 * Description : This function is used to start ATP (used by RVM) | |
182 * | |
183 * Parameters : none | |
184 * | |
185 * Return : | |
186 * RVM_OK | |
187 * | |
188 * History | |
189 * : 1.0 (30-May-2000) created | |
190 ******************************************************************************/ | |
191 T_RVM_RETURN atp_start (void) | |
192 { | |
193 | |
194 atp_swe_state=ATP_STARTED; | |
195 | |
196 rvf_send_trace("ATP : Start performed ",31,NULL_PARAM,RV_TRACE_LEVEL_DEBUG_LOW, | |
197 ATP_USE_ID); | |
198 | |
199 return RVM_OK; | |
200 } | |
201 | |
202 | |
203 | |
204 | |
205 /****************************************************************************** | |
206 * Function name: atp_stop | |
207 * | |
208 * Description : This function is used to stop ATP (used by RVM) | |
209 * | |
210 * Parameters : none | |
211 * | |
212 * Return : | |
213 * RVM_OK | |
214 * | |
215 * History | |
216 * : 1.0 (30-May-2000) created | |
217 ******************************************************************************/ | |
218 T_RVM_RETURN atp_stop (void) | |
219 { | |
220 | |
221 atp_swe_state=ATP_STOPPED; | |
222 | |
223 return RVM_OK; | |
224 } | |
225 | |
226 | |
227 | |
228 | |
229 /****************************************************************************** | |
230 * Function name: atp_kill | |
231 * | |
232 * Description : This function is used to kill ATP (used by RVM) | |
233 * | |
234 * Parameters : none | |
235 * | |
236 * Return : | |
237 * RVM_OK | |
238 * | |
239 * History | |
240 * : 1.0 (30-May-2000) created | |
241 ******************************************************************************/ | |
242 T_RVM_RETURN atp_kill (void) | |
243 { | |
244 if (atp_delete_all_port() ==RV_OK) | |
245 { | |
246 return atp_dereg_all(); | |
247 } | |
248 return RVM_INTERNAL_ERR; | |
249 } | |
250 | |
251 | |
252 | |
253 | |
254 /****************************************************************************** | |
255 * Function name: atp_error | |
256 * | |
257 * Description : Generic ATP error function | |
258 * | |
259 * Parameters : | |
260 * | |
261 * Return : no return | |
262 * | |
263 * History : 0.1 (1-Marsh-2000) - Created | |
264 * | |
265 ******************************************************************************/ | |
266 void atp_error(T_ATP_ERROR_REASON atp_error_reason) | |
267 { | |
268 | |
269 switch (atp_error_reason) | |
270 { | |
271 case ATP_ERROR_MB_PRIM_RED: | |
272 { | |
273 | |
274 rvf_send_trace("ATP : ATP MEMORY BANK CRASHED !!!!!!!",37,NULL_PARAM,RV_TRACE_LEVEL_ERROR, | |
275 ATP_USE_ID); | |
276 | |
277 atp_error_ft("ATP",RVM_MEMORY_ERR,0," ATP memory bank irrecoverably crashed "); | |
278 break; | |
279 } | |
280 | |
281 default: | |
282 { | |
283 rvf_send_trace("ATP : Function ATP error has been called",40,NULL_PARAM, | |
284 RV_TRACE_LEVEL_ERROR, ATP_USE_ID); | |
285 | |
286 atp_error_ft("ATP",RVM_INTERNAL_ERR,0," ATP irrecoverable error occured "); | |
287 break; | |
288 } | |
289 } | |
290 } | |
291 | |
292 | |
293 | |
294 |