FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/services/dar/dar_diagnose.c @ 308:3c5a17928fda
DAR: starting to clean and compile .c files
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Sun, 16 Mar 2014 20:46:10 +0000 |
parents | 4dccc9d3305f |
children |
comparison
equal
deleted
inserted
replaced
307:749ca89741fa | 308:3c5a17928fda |
---|---|
5 /* Purpose: This function contains the DAR diagnose functions */ | 5 /* Purpose: This function contains the DAR diagnose functions */ |
6 /* */ | 6 /* */ |
7 /* */ | 7 /* */ |
8 /* Version 0.1 */ | 8 /* Version 0.1 */ |
9 /* */ | 9 /* */ |
10 /* Date Modification */ | 10 /* Date Modification */ |
11 /* ------------------------------------ */ | 11 /* ------------------------------------ */ |
12 /* 18 October 2001 Create */ | 12 /* 18 October 2001 Create */ |
13 /* */ | 13 /* */ |
14 /* Author Stephanie Gerthoux */ | 14 /* Author Stephanie Gerthoux */ |
15 /* */ | 15 /* */ |
16 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/ | 16 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/ |
17 /****************************************************************************/ | 17 /****************************************************************************/ |
18 | 18 |
19 #include "rv/rv_defined_swe.h" | 19 #include "../../riviera/rv/rv_defined_swe.h" |
20 #ifdef RVM_DAR_SWE | 20 #ifdef RVM_DAR_SWE |
21 #ifndef _WINDOWS | 21 #ifndef _WINDOWS |
22 #include "timer/timer.h" | 22 #include "../../bsp/timer.h" |
23 #endif | 23 #endif |
24 | 24 |
25 #include "rv/rv_general.h" | 25 #include "../../riviera/rv/rv_general.h" |
26 #include "rvm/rvm_gen.h" | 26 #include "../../riviera/rvm/rvm_gen.h" |
27 #include "rvm/rvm_priorities.h" | 27 #include "../../riviera/rvm/rvm_priorities.h" |
28 #include "dar/dar_api.h" | 28 #include "dar_api.h" |
29 #include "dar/dar_structs_i.h" | 29 #include "dar_structs_i.h" |
30 #include "dar/dar_env.h" | 30 #include "dar_env.h" |
31 #include "rvf/rvf_target.h" | 31 #include "../../riviera/rvf/rvf_target.h" |
32 #include "dar/dar_const_i.h" | 32 #include "dar_const_i.h" |
33 #include "dar/dar_macro_i.h" | 33 #include "dar_macro_i.h" |
34 #include "dar/dar_messages_i.h" | 34 #include "dar_messages_i.h" |
35 #include "dar/dar_error_hdlr_i.h" | 35 #include "dar_error_hdlr_i.h" |
36 //#include "rvf/rvf_i.h" | 36 //#include "rvf/rvf_i.h" |
37 | 37 |
38 /**** Global variables ****/ | 38 /**** Global variables ****/ |
39 | 39 |
40 /* Define a pointer to the Global Environment Control block */ | 40 /* Define a pointer to the Global Environment Control block */ |
41 extern T_DAR_ENV_CTRL_BLK *dar_gbl_var_p; | 41 extern T_DAR_ENV_CTRL_BLK *dar_gbl_var_p; |
42 | 42 |
43 | 43 |
44 | 44 |
45 /********************************************************************************/ | 45 /***************************************************************************/ |
46 /* Function dar_search_group */ | 46 /* Function dar_search_group */ |
47 /* */ | 47 /* */ |
48 /* Description This function checks if the use_id group_nb exists: */ | 48 /* Description This function checks if the use_id group_nb exists: */ |
49 /* */ | 49 /* */ |
50 /********************************************************************************/ | 50 /***************************************************************************/ |
51 T_RV_RET dar_search_group(UINT16 group, UINT8 *index_p) | 51 T_RV_RET dar_search_group(UINT16 group, UINT8 *index_p) |
52 { | 52 { |
53 /* Declare local variables */ | 53 /* Declare local variables */ |
54 UINT8 i=0; | 54 UINT8 i=0; |
55 | 55 |
72 { | 72 { |
73 return(RV_NOT_READY); | 73 return(RV_NOT_READY); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 /********************************************************************************/ | 77 /***************************************************************************/ |
78 /* Function dar_add_group */ | 78 /* Function dar_add_group */ |
79 /* */ | 79 /* */ |
80 /* Description This function research the index of the first free group */ | 80 /* Description This function research the index of the first free */ |
81 /* */ | 81 /* group */ |
82 /********************************************************************************/ | 82 /***************************************************************************/ |
83 T_RV_RET dar_add_group(UINT8 *index_p) | 83 T_RV_RET dar_add_group(UINT8 *index_p) |
84 { | 84 { |
85 /* Declare local variables */ | 85 /* Declare local variables */ |
86 UINT8 i=0; | 86 UINT8 i=0; |
87 | 87 |
103 } | 103 } |
104 return(RV_NOT_SUPPORTED); | 104 return(RV_NOT_SUPPORTED); |
105 } | 105 } |
106 | 106 |
107 | 107 |
108 /********************************************************************************/ | 108 /***************************************************************************/ |
109 /* */ | 109 /* */ |
110 /* Function Name: dar_send_write_data */ | 110 /* Function Name: dar_send_write_data */ |
111 /* */ | 111 /* */ |
112 /* Purpose: This function is called to send write data in the DAR mailbox */ | 112 /* Purpose: This function is called to send write data in the DAR */ |
113 /* */ | 113 /* mailbox. */ |
114 /* Input Parameters: */ | 114 /* Input Parameters: */ |
115 /* Pointer to the message to store */ | 115 /* Pointer to the message to store */ |
116 /* Data Format, */ | 116 /* Data Format, */ |
117 /* Data level, */ | 117 /* Data level, */ |
118 /* Data Use Id, */ | 118 /* Data Use Id, */ |
119 /* */ | 119 /* */ |
120 /* Output Parameters: */ | 120 /* Output Parameters: */ |
121 /* Validation of the function execution. */ | 121 /* Validation of the function execution. */ |
122 /* */ | 122 /* */ |
123 /* Note: */ | 123 /* Note: */ |
124 /* None */ | 124 /* None */ |
125 /* */ | 125 /* */ |
126 /********************************************************************************/ | 126 /***************************************************************************/ |
127 | 127 |
128 T_RV_RET dar_send_write_data ( T_DAR_INFO *buffer_p, | 128 T_RV_RET dar_send_write_data ( T_DAR_INFO *buffer_p, |
129 T_DAR_FORMAT format, | 129 T_DAR_FORMAT format, |
130 T_DAR_LEVEL diagnose_info_level, | 130 T_DAR_LEVEL diagnose_info_level, |
131 T_RVM_USE_ID dar_use_id) | 131 T_RVM_USE_ID dar_use_id) |
163 | 163 |
164 /* fill the addr source id */ | 164 /* fill the addr source id */ |
165 write_data_p->os_hdr.src_addr_id = dar_gbl_var_p->addrId; | 165 write_data_p->os_hdr.src_addr_id = dar_gbl_var_p->addrId; |
166 | 166 |
167 /* fill the message parameters */ | 167 /* fill the message parameters */ |
168 write_data_p->data_write.char_p = buffer_p ; | 168 write_data_p->data_write.char_p = buffer_p ; |
169 write_data_p->data_write.data_format = format; | 169 write_data_p->data_write.data_format = format; |
170 write_data_p->data_write.level = diagnose_info_level; | 170 write_data_p->data_write.level = diagnose_info_level; |
171 write_data_p->data_write.use_id.group_nb = (dar_use_id>>16)& 0x7FFF; | 171 write_data_p->data_write.use_id.group_nb = (dar_use_id>>16)& 0x7FFF; |
172 write_data_p->data_write.use_id.mask = (dar_use_id)&0xFFFF; | 172 write_data_p->data_write.use_id.mask = (dar_use_id)&0xFFFF; |
173 | 173 |
174 /* send the messsage to the DAR entity */ | 174 /* send the messsage to the DAR entity */ |
175 rvf_send_msg (dar_gbl_var_p->addrId, | 175 rvf_send_msg (dar_gbl_var_p->addrId, |
176 write_data_p); | 176 write_data_p); |
177 | 177 |
180 else | 180 else |
181 { | 181 { |
182 return(RV_NOT_READY); | 182 return(RV_NOT_READY); |
183 } | 183 } |
184 | 184 |
185 | 185 |
186 } /* dar_send_write_data */ | 186 } /* dar_send_write_data */ |
187 | 187 |
188 /********************************************************************************/ | 188 /***************************************************************************/ |
189 /* Function dar_reset */ | 189 /* Function dar_reset */ |
190 /* */ | 190 /* */ |
191 /* Description This function is used to reset the system */ | 191 /* Description This function is used to reset the system */ |
192 /* */ | 192 /* */ |
193 /* Input Parameters: */ | 193 /* Input Parameters: */ |
194 /* None */ | 194 /* None */ |
195 /* */ | 195 /* */ |
196 /* Output Parameters: */ | 196 /* Output Parameters: */ |
197 /* Validation of the function execution. */ | 197 /* Validation of the function execution. */ |
198 /* */ | 198 /* */ |
199 /* Note: */ | 199 /* Note: */ |
200 /* None */ | 200 /* None */ |
201 /* */ | 201 /* */ |
202 /********************************************************************************/ | 202 /***************************************************************************/ |
203 T_RV_RET dar_reset(void) | 203 T_RV_RET dar_reset(void) |
204 { | 204 { |
205 #ifndef _WINDOWS | 205 #ifndef _WINDOWS |
206 /* Declare global variable*/ | 206 /* Declare global variable*/ |
207 volatile UINT16 *register_p; | 207 volatile UINT16 *register_p; |
213 | 213 |
214 /* Reset the system with the Watchdog */ | 214 /* Reset the system with the Watchdog */ |
215 /* initialize the adress of the watchdog timer pointer */ | 215 /* initialize the adress of the watchdog timer pointer */ |
216 register_p = (volatile UINT16 *)WATCHDOG_TIM_MODE; | 216 register_p = (volatile UINT16 *)WATCHDOG_TIM_MODE; |
217 | 217 |
218 /* Write the 0xF5 value to the Watchdog timer mode register to disable the Watchdog*/ | 218 /* Write the 0xF5 value to the Watchdog timer mode register to disable |
219 the Watchdog */ | |
219 /* Note the bit 15 must be unchanged ( bit 15 = 1 -> 0x8000)*/ | 220 /* Note the bit 15 must be unchanged ( bit 15 = 1 -> 0x8000)*/ |
220 *register_p =0x80F5; | 221 *register_p =0x80F5; |
221 | 222 |
222 /* Wait a couple of time to be sure that this register has a new value */ | 223 /* Wait a couple of time to be sure that this register has a new |
224 value */ | |
223 for (i=0;i<100;i++); | 225 for (i=0;i<100;i++); |
224 | 226 |
225 /* After having received 0xF5 in the Watchdog timer mode register, if the */ | 227 /* |
226 /* second write access is differennt from 0xA0, ARM core is reset */ | 228 * After having received 0xF5 in the Watchdog timer mode register, |
227 /* The ARM HW core is reset + branch to adress 0x0000 ( SW reset) */ | 229 * if the second write access is differennt from 0xA0, ARM core is |
230 * reset. | |
231 * | |
232 * The ARM HW core is reset + branch to adress 0x0000 ( SW reset) | |
233 */ | |
228 *register_p=0x80F5; | 234 *register_p=0x80F5; |
229 | 235 |
230 /* Wait until the ARM reset */ | 236 /* Wait until the ARM reset */ |
231 while(1); | 237 while(1); |
232 #endif | 238 #endif |
233 | 239 |
234 return(RV_OK); | 240 return(RV_OK); |
235 } /* dar_reset */ | 241 } /* dar_reset */ |
236 | 242 |
237 | 243 |
238 /********************************************************************************/ | 244 /***************************************************************************/ |
239 /* */ | 245 /* */ |
240 /* Function dar_read_mbox */ | 246 /* Function dar_read_mbox */ |
241 /* */ | 247 /* */ |
242 /* Description Called by the dar to read a buffer from its mailboxes. */ | 248 /* Description Called by the dar to read a buffer from its mailboxes. */ |
243 /* when the Operating System is out */ | 249 /* when the Operating System is out */ |
244 /* Input Parameters: */ | 250 /* Input Parameters: */ |
245 /* None */ | 251 /* None */ |
246 /* */ | 252 /* */ |
247 /* Output Parameters: */ | 253 /* Output Parameters: */ |
248 /* NULL if the mailbox was empty, else the address of a buffer */ | 254 /* NULL if the mailbox was empty, else the address of a buffer */ |
249 /* */ | 255 /* */ |
250 /********************************************************************************/ | 256 /***************************************************************************/ |
251 | 257 |
252 void * dar_read_mbox (UINT8 mbox) | 258 void * dar_read_mbox (UINT8 mbox) |
253 { | 259 { |
254 // void * p_buf = NULL; | 260 // void * p_buf = NULL; |
255 // T_RVF_INTERNAL_BUF * p_hdr; | 261 // T_RVF_INTERNAL_BUF * p_hdr; |
285 | 291 |
286 /* ******************************************************* */ | 292 /* ******************************************************* */ |
287 /* THE DAR ENTITY IS DISABLED */ | 293 /* THE DAR ENTITY IS DISABLED */ |
288 /* ******************************************************* */ | 294 /* ******************************************************* */ |
289 #ifndef _WINDOWS | 295 #ifndef _WINDOWS |
290 #include "config/swconfig.cfg" | 296 #include "../../bsp/timer.h" |
291 #include "config/sys.cfg" | |
292 #include "config/chipset.cfg" | |
293 #include "timer/timer.h" | |
294 #endif | 297 #endif |
295 | 298 |
296 #include "rv/rv_general.h" | 299 #include "../../riviera/rv/rv_general.h" |
297 #include "rvm/rvm_gen.h" | 300 #include "../../riviera/rvm/rvm_gen.h" |
298 #include "rvm/rvm_priorities.h" | 301 #include "../../riviera/rvm/rvm_priorities.h" |
299 #include "rvf/rvf_target.h" | 302 #include "../../riviera/rvf/rvf_target.h" |
300 //#include "rvf/rvf_i.h" | 303 //#include "rvf/rvf_i.h" |
301 | 304 |
302 /* Define the Watchdog timer register mode */ | 305 /* Define the Watchdog timer register mode */ |
303 #define WATCHDOG_TIM_MODE (0xFFFFF804) | 306 #define WATCHDOG_TIM_MODE (0xFFFFF804) |
304 | 307 |
305 | 308 |
306 /********************************************************************************/ | 309 /***************************************************************************/ |
307 /* Function dar_reset */ | 310 /* Function dar_reset */ |
308 /* */ | 311 /* */ |
309 /* Description This function is used to reset the system */ | 312 /* Description This function is used to reset the system */ |
310 /* */ | 313 /* */ |
311 /* Input Parameters: */ | 314 /* Input Parameters: */ |
312 /* None */ | 315 /* None */ |
313 /* */ | 316 /* */ |
314 /* Output Parameters: */ | 317 /* Output Parameters: */ |
315 /* Validation of the function execution. */ | 318 /* Validation of the function execution. */ |
316 /* */ | 319 /* */ |
317 /* Note: */ | 320 /* Note: */ |
318 /* None */ | 321 /* None */ |
319 /* */ | 322 /* */ |
320 /********************************************************************************/ | 323 /***************************************************************************/ |
321 T_RV_RET dar_reset(void) | 324 T_RV_RET dar_reset(void) |
322 { | 325 { |
323 #ifndef _WINDOWS | 326 #ifndef _WINDOWS |
324 /* Declare global variable*/ | 327 /* Declare global variable*/ |
325 volatile UINT16 *register_p; | 328 volatile UINT16 *register_p; |
331 | 334 |
332 /* Reset the system with the Watchdog */ | 335 /* Reset the system with the Watchdog */ |
333 /* initialize the adress of the watchdog timer pointer */ | 336 /* initialize the adress of the watchdog timer pointer */ |
334 register_p = (volatile UINT16 *)WATCHDOG_TIM_MODE; | 337 register_p = (volatile UINT16 *)WATCHDOG_TIM_MODE; |
335 | 338 |
336 /* Write the 0xF5 value to the Watchdog timer mode register to disable the Watchdog*/ | 339 /* Write the 0xF5 value to the Watchdog timer mode register to disable |
340 the Watchdog */ | |
337 /* Note the bit 15 must be unchanged ( bit 15 = 1 -> 0x8000)*/ | 341 /* Note the bit 15 must be unchanged ( bit 15 = 1 -> 0x8000)*/ |
338 *register_p =0x80F5; | 342 *register_p =0x80F5; |
339 | 343 |
340 /* Wait a couple of time to be sure that this register has a new value */ | 344 /* Wait a couple of time to be sure that this register has a new |
345 value */ | |
341 for (i=0;i<100;i++); | 346 for (i=0;i<100;i++); |
342 | 347 |
343 /* After having received 0xF5 in the Watchdog timer mode register, if the */ | 348 /* |
344 /* second write access is differennt from 0xA0, ARM core is reset */ | 349 * After having received 0xF5 in the Watchdog timer mode register, |
345 /* The ARM HW core is reset + branch to adress 0x0000 ( SW reset) */ | 350 * if the second write access is differennt from 0xA0, ARM core is |
351 * reset. | |
352 * | |
353 * The ARM HW core is reset + branch to adress 0x0000 ( SW reset) | |
354 */ | |
346 *register_p=0x80F5; | 355 *register_p=0x80F5; |
347 | 356 |
348 /* Wait until the ARM reset */ | 357 /* Wait until the ARM reset */ |
349 while(1); | 358 while(1); |
350 #endif | 359 #endif |