comparison gsm-fw/services/dar/dar_msg_ft.c @ 309:a7087f91c752

DAR: all C modules compile without RVM_DAR_SWE
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 17 Mar 2014 04:51:36 +0000
parents 4dccc9d3305f
children 083f262b7bbe
comparison
equal deleted inserted replaced
308:3c5a17928fda 309:a7087f91c752
15 /* Author Stephanie Gerthoux */ 15 /* Author Stephanie Gerthoux */
16 /* */ 16 /* */
17 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/ 17 /* (C) Copyright 2001 by Texas Instruments Incorporated, All Rights Reserved*/
18 /****************************************************************************/ 18 /****************************************************************************/
19 19
20 #include "rv/rv_defined_swe.h" 20 #include "../../riviera/rv/rv_defined_swe.h"
21 #ifdef RVM_DAR_SWE 21 #ifdef RVM_DAR_SWE
22 #ifndef _WINDOWS 22 #ifndef _WINDOWS
23 #include "config/swconfig.cfg" 23 #include "../../include/config.h"
24 #include "config/sys.cfg"
25 #include "config/chipset.cfg"
26 #endif 24 #endif
27 25
28 #include <string.h> 26 #include <string.h>
29 #include "rvm/rvm_gen.h" 27 #include "../../riviera/rvm/rvm_gen.h"
30 #include "dar/dar_api.h" 28 #include "dar_api.h"
31 #include "dar/dar_macro_i.h" 29 #include "dar_macro_i.h"
32 #include "dar/dar_messages_i.h" 30 #include "dar_messages_i.h"
33 #include "dar/dar_const_i.h" 31 #include "dar_const_i.h"
34 #include "dar/dar_diagnose_i.h" 32 #include "dar_diagnose_i.h"
35 #include "dar/dar_error_hdlr_i.h" 33 #include "dar_error_hdlr_i.h"
36 34
37 #ifndef _WINDOWS 35 #ifndef _WINDOWS
38 #include "timer/timer.h" 36 #include "../../bsp/timer.h"
39 #endif 37 #endif
40 38
41 /**** Global variable ****/ 39 /**** Global variable ****/
42 /* index used in the circular buffer*/ 40 /* index used in the circular buffer*/
43 UINT16 dar_current_index = 0; 41 UINT16 dar_current_index = 0;
56 /**** Extern functions ****/ 54 /**** Extern functions ****/
57 extern void * dar_read_mbox (UINT8 mbox); 55 extern void * dar_read_mbox (UINT8 mbox);
58 56
59 extern void exception(void); 57 extern void exception(void);
60 58
61 /********************************************************************************/ 59 /***************************************************************************/
62 /* Function dar_filter_request */ 60 /* Function dar_filter_request */
63 /* */ 61 /* */
64 /* Description This function checks if the use_id group_nb exists: */ 62 /* Description This function checks if the use_id group_nb exists: */
65 /* - if the group_nb exists, it adds the warning and debug */ 63 /* - if the group_nb exists, it adds the warning and */
66 /* masks in the dar_array_filter */ 64 /* debug masks in the dar_array_filter */
67 /* - otherwise, this function add the new group_nb and the */ 65 /* - otherwise, this function add the new group_nb and*/
68 /* masks in the dar_array_filter */ 66 /* the masks in the dar_array_filter */
69 /* */ 67 /* */
70 /********************************************************************************/ 68 /***************************************************************************/
71 69
72 T_RV_RET dar_filter_request (T_DAR_FILTER_START *msg_p) 70 T_RV_RET dar_filter_request (T_DAR_FILTER_START *msg_p)
73 { 71 {
74 /* Declare local variables*/ 72 /* Declare local variables*/
75 UINT8 index = 0; 73 UINT8 index = 0;
90 { 88 {
91 case DAR_WARNING: 89 case DAR_WARNING:
92 { /* The DAR entity wants to process Warning messages */ 90 { /* The DAR entity wants to process Warning messages */
93 /* add the mask_warning in the dar_filter array */ 91 /* add the mask_warning in the dar_filter array */
94 dar_gbl_var_p ->dar_filter_array[index].mask_warning |= 92 dar_gbl_var_p ->dar_filter_array[index].mask_warning |=
95 msg_p->use_msg_parameter.mask; 93 msg_p->use_msg_parameter.mask;
96 dar_gbl_var_p ->dar_filter_array[index].mask_debug = 0x00; 94 dar_gbl_var_p ->dar_filter_array[index].mask_debug = 0x00;
97 95
98 break; 96 break;
99 } 97 }
100 98
101 case DAR_DEBUG: 99 case DAR_DEBUG:
102 { 100 {
103 /* The DAR entity wants to process Debug messages */ 101 /* The DAR entity wants to process Debug messages */
104 /* As the Warning messages are more important than debug messages, */ 102 /* As the Warning messages are more important than debug */
105 /* it processes warning message too */ 103 /* messages, it processes warning message too */
106 104
107 /* add the mask_debug in the dar_filter array */ 105 /* add the mask_debug in the dar_filter array */
108 dar_gbl_var_p ->dar_filter_array[index].mask_debug |= 106 dar_gbl_var_p ->dar_filter_array[index].mask_debug |=
109 msg_p->use_msg_parameter.mask; 107 msg_p->use_msg_parameter.mask;
110 108
111 /* add the mask_warning in the dar_filter array */ 109 /* add the mask_warning in the dar_filter array */
112 dar_gbl_var_p ->dar_filter_array[index].mask_warning |= 110 dar_gbl_var_p ->dar_filter_array[index].mask_warning |=
113 msg_p->use_msg_parameter.mask; 111 msg_p->use_msg_parameter.mask;
114 break; 112 break;
115 } 113 }
116 114
117 case DAR_NO_DIAGNOSE: 115 case DAR_NO_DIAGNOSE:
118 { 116 {
119 /* The DAR entity doesn't want to process Diagnose messages */ 117 /* The DAR entity doesn't want to process Diagnose messages */
120 118
121 /* delete the mask_debug in the dar_filter array */ 119 /* delete the mask_debug in the dar_filter array */
122 dar_gbl_var_p ->dar_filter_array[index].mask_debug = 0x00; 120 dar_gbl_var_p ->dar_filter_array[index].mask_debug = 0x00;
123 121
124 /* delete the mask_warning in the dar_filter array */ 122 /* delete the mask_warning in the dar_filter array */
125 dar_gbl_var_p ->dar_filter_array[index].mask_warning = 0x00; 123 dar_gbl_var_p ->dar_filter_array[index].mask_warning = 0x00;
135 } /* switch(msg_p->use_msg_parameter.level) */ 133 } /* switch(msg_p->use_msg_parameter.level) */
136 } /* if (search_group(msg_p->use_msg_parameter.group_nb,*index_gbl_p)== RV_OK) */ 134 } /* if (search_group(msg_p->use_msg_parameter.group_nb,*index_gbl_p)== RV_OK) */
137 135
138 else 136 else
139 { 137 {
140 /* if the group doesn't exist and if there is enough space in the dar_filter_array */ 138 /* if the group doesn't exist and if there is enough space in the
139 dar_filter_array */
141 if ( dar_add_group(&index)== RV_OK) 140 if ( dar_add_group(&index)== RV_OK)
142 { 141 {
143 /* ... add the group in the dar_array_filter */ 142 /* ... add the group in the dar_array_filter */
144 dar_gbl_var_p ->dar_filter_array[index].group_nb |= msg_p->use_msg_parameter.group_nb; 143 dar_gbl_var_p ->dar_filter_array[index].group_nb |=
144 msg_p->use_msg_parameter.group_nb;
145 /* Check the Dar level */ 145 /* Check the Dar level */
146 switch(msg_p->use_msg_parameter.level) 146 switch(msg_p->use_msg_parameter.level)
147 { 147 {
148 case DAR_WARNING: 148 case DAR_WARNING:
149 { /* The DAR entity wants to process Warning messages */ 149 { /* The DAR entity wants to process Warning messages */
150 /* add the mask_warning in the dar_filter array */ 150 /* add the mask_warning in the dar_filter array */
151 dar_gbl_var_p ->dar_filter_array[index].mask_warning |= 151 dar_gbl_var_p ->dar_filter_array[index].mask_warning |=
152 msg_p->use_msg_parameter.mask; 152 msg_p->use_msg_parameter.mask;
153 break; 153 break;
154 } 154 }
155 155
156 case DAR_DEBUG: 156 case DAR_DEBUG:
157 { 157 {
158 /* The DAR entity wants to process Debug messages */ 158 /* The DAR entity wants to process Debug messages */
159 /* As the Warning messages are more important than debug messages, */ 159 /* As the Warning messages are more important than debug */
160 /* it processes warning message too */ 160 /* messages, it processes warning message too */
161 161
162 /* add the mask_debug in the dar_filter array */ 162 /* add the mask_debug in the dar_filter array */
163 dar_gbl_var_p ->dar_filter_array[index].mask_debug |= 163 dar_gbl_var_p ->dar_filter_array[index].mask_debug |=
164 msg_p->use_msg_parameter.mask; 164 msg_p->use_msg_parameter.mask;
165 165
166 /* add the mask_warning in the dar_filter array */ 166 /* add the mask_warning in the dar_filter array */
167 dar_gbl_var_p ->dar_filter_array[index].mask_warning |= 167 dar_gbl_var_p ->dar_filter_array[index].mask_warning |=
168 msg_p->use_msg_parameter.mask; 168 msg_p->use_msg_parameter.mask;
169 break; 169 break;
170 } 170 }
171 171
172 default: 172 default:
173 { 173 {
186 } 186 }
187 return(RV_OK); 187 return(RV_OK);
188 }/* dar_filter_request */ 188 }/* dar_filter_request */
189 189
190 190
191 /********************************************************************************/ 191 /***************************************************************************/
192 /* */ 192 /* */
193 /* Function Name: dar_write_data_in_buffer */ 193 /* Function Name: dar_write_data_in_buffer */
194 /* */ 194 /* */
195 /* Purpose: This function is called to store diagnose data in RAM buffer */ 195 /* Purpose: This function is called to store diagnose data in RAM */
196 /* */ 196 /* buffer. */
197 /* note: In order to separate the different string, the data are */ 197 /* */
198 /* ---- stored as follows: */ 198 /* note: In order to separate the different string, the data */
199 /* */ 199 /* are stored as follows: */
200 /* Input Parameters: */ 200 /* */
201 /* Pointer to the message to store */ 201 /* Input Parameters: */
202 /* Data Format, */ 202 /* Pointer to the message to store */
203 /* Data level, */ 203 /* Data Format, */
204 /* Data Use Id, */ 204 /* Data level, */
205 /* */ 205 /* Data Use Id, */
206 /* Output Parameters: */ 206 /* */
207 /* Validation of the diagnose execution. */ 207 /* Output Parameters: */
208 /* */ 208 /* Validation of the diagnose execution. */
209 /* */ 209 /* */
210 /* */ 210 /* */
211 /* Revision History: */ 211 /* */
212 /* None. */ 212 /* Revision History: */
213 /* */ 213 /* None. */
214 /********************************************************************************/ 214 /* */
215 /***************************************************************************/
215 T_RV_RET dar_write_data_in_buffer( T_DAR_WRITE_START *msg_p) 216 T_RV_RET dar_write_data_in_buffer( T_DAR_WRITE_START *msg_p)
216 { 217 {
217 /* Local variables */ 218 /* Local variables */
218 UINT8 i = 0; 219 UINT8 i = 0;
219 UINT8 length = 0; 220 UINT8 length = 0;
222 length = (UINT16) strlen(msg_p->data_write.char_p); 223 length = (UINT16) strlen(msg_p->data_write.char_p);
223 224
224 /*** Circular buffer to store data ***/ 225 /*** Circular buffer to store data ***/
225 /* Add 0xFF to separate 2 strings */ 226 /* Add 0xFF to separate 2 strings */
226 dar_write_buffer[dar_current_index] = 0xF; 227 dar_write_buffer[dar_current_index] = 0xF;
227 DAR_PLUS_PLUS(dar_current_index); /* to detected if it is the end of the buffer */ 228 DAR_PLUS_PLUS(dar_current_index); /* increment with wraparound */
228 dar_write_buffer[dar_current_index] = 0xF; 229 dar_write_buffer[dar_current_index] = 0xF;
229 DAR_PLUS_PLUS(dar_current_index); /* to detected if it is the end of the buffer */ 230 DAR_PLUS_PLUS(dar_current_index); /* increment with wraparound */
230 231
231 232
232 /* The group_nb is 16 bit length, and the buffer is an UINT8 length */ 233 /* The group_nb is 16 bit length, and the buffer is an UINT8 length */
233 /* So the group_nb must be stocked by dividing it in 2 parts */ 234 /* So the group_nb must be stocked by dividing it in 2 parts */
234 dar_write_buffer[dar_current_index] = (msg_p->data_write.use_id.group_nb)>>8; 235 dar_write_buffer[dar_current_index] =
235 /*add the 8 first bits of the Use id group*/ 236 (msg_p->data_write.use_id.group_nb)>>8;
237 /*add the 8 first bits of the Use id group*/
236 DAR_PLUS_PLUS(dar_current_index); 238 DAR_PLUS_PLUS(dar_current_index);
237 dar_write_buffer[dar_current_index] = msg_p->data_write.use_id.group_nb; 239 dar_write_buffer[dar_current_index] = msg_p->data_write.use_id.group_nb;
238 /*add the 8 last bits of the Use id group*/ 240 /*add the 8 last bits of the Use id group*/
239 DAR_PLUS_PLUS(dar_current_index); 241 DAR_PLUS_PLUS(dar_current_index);
240 /* The mask is 16 bit length, and the buffer is an UINT8 length */ 242 /* The mask is 16 bit length, and the buffer is an UINT8 length */
241 /* So the mask must be stocked by dividing it in 2 parts */ 243 /* So the mask must be stocked by dividing it in 2 parts */
242 dar_write_buffer[dar_current_index] = (msg_p->data_write.use_id.mask)>>8; 244 dar_write_buffer[dar_current_index] = (msg_p->data_write.use_id.mask)>>8;
243 /* add the 8 first bits of the Use id mask */ 245 /* add the 8 first bits of the Use id mask */
244 DAR_PLUS_PLUS(dar_current_index); 246 DAR_PLUS_PLUS(dar_current_index);
245 dar_write_buffer[dar_current_index] = msg_p->data_write.use_id.mask; 247 dar_write_buffer[dar_current_index] = msg_p->data_write.use_id.mask;
246 /* add the 8 last bits of the Use id mask */ 248 /* add the 8 last bits of the Use id mask */
247 DAR_PLUS_PLUS(dar_current_index); 249 DAR_PLUS_PLUS(dar_current_index);
248 250
249 /* Add the dar_level data */ 251 /* Add the dar_level data */
250 dar_write_buffer[dar_current_index] = msg_p->data_write.level; 252 dar_write_buffer[dar_current_index] = msg_p->data_write.level;
251 DAR_PLUS_PLUS(dar_current_index); 253 DAR_PLUS_PLUS(dar_current_index);
267 269
268 return(RV_OK); 270 return(RV_OK);
269 271
270 } /* dar_send_write_data */ 272 } /* dar_send_write_data */
271 273
272 /********************************************************************************/ 274 /***************************************************************************/
273 /* Function dar_empty_mb_and_save_data */ 275 /* Function dar_empty_mb_and_save_data */
274 /* */ 276 /* */
275 /* Description This function is used to empty the mailbox and save data in */ 277 /* Description This function is used to empty the mailbox and save */
276 /* the RAM buffer */ 278 /* data in the RAM buffer. */
277 /* */ 279 /* */
278 /* Input Parameters: */ 280 /* Input Parameters: */
279 /* Pointer to the message to store */ 281 /* Pointer to the message to store */
280 /* */ 282 /* */
281 /* Output Parameters: */ 283 /* Output Parameters: */
282 /* Validation of the function execution. */ 284 /* Validation of the function execution. */
283 /* */ 285 /* */
284 /* Note: */ 286 /* Note: */
285 /* None */ 287 /* None */
286 /* */ 288 /* */
287 /********************************************************************************/ 289 /***************************************************************************/
288 T_RV_RET dar_empty_mb_and_save_data( T_DAR_INFO *buffer_p) 290 T_RV_RET dar_empty_mb_and_save_data( T_DAR_INFO *buffer_p)
289 { 291 {
290 /* Declare local variables */ 292 /* Declare local variables */
291 UINT8 i = 0; 293 UINT8 i = 0;
292 UINT16 length = 0; 294 UINT16 length = 0;
310 } /* while (msg_p != NULL) */ 312 } /* while (msg_p != NULL) */
311 313
312 /**** Store data in RAM buffer ****/ 314 /**** Store data in RAM buffer ****/
313 /* Diagnose string length */ 315 /* Diagnose string length */
314 length = (UINT16) strlen(buffer_p); 316 length = (UINT16) strlen(buffer_p);
315 317
316 /** Circular buffer to store data **/ 318 /** Circular buffer to store data **/
317 /* Add 0xFF to separate 2 strings */ 319 /* Add 0xFF to separate 2 strings */
318 dar_write_buffer[dar_current_index] = 0xF; 320 dar_write_buffer[dar_current_index] = 0xF;
319 DAR_PLUS_PLUS(dar_current_index); /* to detected if it is the end of the buffer */ 321 DAR_PLUS_PLUS(dar_current_index); /* increment with wraparound */
320 dar_write_buffer[dar_current_index] = 0xF; 322 dar_write_buffer[dar_current_index] = 0xF;
321 DAR_PLUS_PLUS(dar_current_index); /* to detected if it is the end of the buffer */ 323 DAR_PLUS_PLUS(dar_current_index); /* increment with wraparound */
322 324
323 /* Add the dar_level data */ 325 /* Add the dar_level data */
324 dar_write_buffer[dar_current_index] = DAR_EXCEPTION; 326 dar_write_buffer[dar_current_index] = DAR_EXCEPTION;
325 DAR_PLUS_PLUS(dar_current_index); 327 DAR_PLUS_PLUS(dar_current_index);
326 /* circular buffer to store diagnose data in RAM buffer */ 328 /* circular buffer to store diagnose data in RAM buffer */
341 343
342 #endif /* #ifdef RVM_DAR_SWE */ 344 #endif /* #ifdef RVM_DAR_SWE */
343 345
344 346
345 347
346 /********************************************************************************/ 348 /******************************************************************************/
347 /* */ 349 /* */
348 /* ------------------------------------------------ */ 350 /* ------------------------------------------------ */
349 /* | WARNING - IMPORTANT | */ 351 /* | WARNING - IMPORTANT | */
350 /* ------------------------------------------------ */ 352 /* ------------------------------------------------ */
351 /* */ 353 /* */
352 /* */ 354 /* */
353 /* Function Name: dar_lib */ 355 /* Function Name: dar_lib */
354 /* */ 356 /* */
355 /* Purpose: This function is only used in order to have a function in the */ 357 /* Purpose: This function is only used in order to have a function in the */
356 /* dar_lib when the DAR is NOT_COMPILED */ 358 /* dar_lib when the DAR is NOT_COMPILED */
357 /* */ 359 /* */
358 /* Input Parameters: */ 360 /* Input Parameters: */
359 /* None */ 361 /* None */
360 /* */ 362 /* */
361 /* Output Parameters: */ 363 /* Output Parameters: */
362 /* NONE */ 364 /* NONE */
363 /* */ 365 /* */
364 /********************************************************************************/ 366 /******************************************************************************/
365 void dar_lib(void) 367 void dar_lib(void)
366 { 368 {
367 } 369 }