FreeCalypso > hg > freecalypso-citrine
comparison gpf/frame/vsi_drv.c @ 0:75a11d740a02
initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 09 Jun 2016 00:02:41 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:75a11d740a02 |
---|---|
1 /* | |
2 +------------------------------------------------------------------------------ | |
3 | File: vsi_drv.c | |
4 +------------------------------------------------------------------------------ | |
5 | Copyright 2002 Texas Instruments Berlin, AG | |
6 | All rights reserved. | |
7 | | |
8 | This file is confidential and a trade secret of Texas | |
9 | Instruments Berlin, AG | |
10 | The receipt of or possession of this file does not convey | |
11 | any rights to reproduce or disclose its contents or to | |
12 | manufacture, use, or sell anything it may describe, in | |
13 | whole, or in part, without the specific written consent of | |
14 | Texas Instruments Berlin, AG. | |
15 +----------------------------------------------------------------------------- | |
16 | Purpose : This Module defines the virtual system interface part | |
17 | for driver access. | |
18 +----------------------------------------------------------------------------- | |
19 */ | |
20 | |
21 #ifndef __VSI_DRV_C__ | |
22 #define __VSI_DRV_C__ | |
23 #endif | |
24 | |
25 /*==== INCLUDES ===================================================*/ | |
26 | |
27 #include <string.h> | |
28 #include <stdio.h> | |
29 | |
30 #include "gpfconf.h" | |
31 #include "typedefs.h" | |
32 | |
33 #include "vsi.h" | |
34 #include "gdi.h" | |
35 #include "os.h" | |
36 #ifdef _TOOLS_ | |
37 #include "drvconf.h" | |
38 #endif | |
39 #include "frm_defs.h" | |
40 #include "frm_types.h" | |
41 #include "frm_glob.h" | |
42 #include "frame.h" | |
43 | |
44 /*==== TYPES ======================================================*/ | |
45 | |
46 | |
47 #ifdef _TOOLS_ | |
48 typedef struct | |
49 { | |
50 char Name[RESOURCE_NAMELEN]; | |
51 char Process[RESOURCE_NAMELEN]; | |
52 char DrvConfig[80]; | |
53 } _T_DRV_LIST_ENTRY; | |
54 | |
55 typedef struct | |
56 { | |
57 _T_DRV_LIST_ENTRY DrvEntry [ 5 ]; | |
58 } _T_DRV_LIST; | |
59 | |
60 #endif | |
61 | |
62 /*==== CONSTANTS ==================================================*/ | |
63 | |
64 | |
65 /*==== EXTERNALS ==================================================*/ | |
66 | |
67 /* -------------- S H A R E D - BEGIN ---------------- */ | |
68 #ifdef _TOOLS_ | |
69 #pragma data_seg("FRAME_SHARED") | |
70 #endif | |
71 | |
72 extern T_DRV_TABLE_ENTRY DrvTable []; | |
73 | |
74 /*==== VARIABLES ==================================================*/ | |
75 | |
76 #undef EXTR_SEND_CONTROL | |
77 #ifndef RUN_INT_RAM | |
78 T_DRV_LIST *DriverConfigList; /* pointer to start of driver cinfiguration list */ | |
79 static T_DRV_LIST *DriverList; /* pointer to selected driver list */ | |
80 #ifdef EXTR_SEND_CONTROL | |
81 FILE *fp; | |
82 #endif | |
83 #endif | |
84 | |
85 #ifdef _TOOLS_ | |
86 _T_DRV_LIST _DrvList={0}; | |
87 T_DRV_LIST DrvList={0}; | |
88 #endif | |
89 | |
90 #ifdef _TOOLS_ | |
91 #pragma data_seg() | |
92 #endif /* _TOOLS_ */ | |
93 /* -------------- S H A R E D - END ---------------- */ | |
94 | |
95 | |
96 /*==== FUNCTIONS ==================================================*/ | |
97 | |
98 void ClearDriverTable ( void ); | |
99 | |
100 #ifndef RUN_INT_RAM | |
101 /* | |
102 +--------------------------------------------------------------------+ | |
103 | PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | | |
104 | STATE : code ROUTINE : vsi_d_create | | |
105 +--------------------------------------------------------------------+ | |
106 | |
107 PURPOSE : enter a new driver in the driver list | |
108 | |
109 */ | |
110 int vsi_d_create ( T_HANDLE caller, T_TST_DRV_ENTRY *drv_info ) | |
111 { | |
112 T_HANDLE drv_handle; | |
113 | |
114 drv_handle = drv_info->drv_pos; | |
115 vsi_d_exit ( caller, 0 ); | |
116 DriverList->DrvEntry[drv_handle].drv_Init = drv_info->entry.drv_Init; | |
117 DriverList->DrvEntry[drv_handle].Name = drv_info->entry.Name; | |
118 DriverList->DrvEntry[drv_handle].Process = drv_info->entry.Process; | |
119 DriverList->DrvEntry[drv_handle].DrvConfig = drv_info->entry.DrvConfig; | |
120 | |
121 ClearDriverTable(); | |
122 vsi_d_init ( caller ); | |
123 vsi_d_setsignal ( caller, 0, DRV_SIGTYPE_READ|DRV_SIGTYPE_CONNECT|DRV_SIGTYPE_DISCONNECT); | |
124 vsi_d_setconfig ( caller, 0, NULL ); | |
125 return VSI_OK; | |
126 } | |
127 #endif | |
128 | |
129 #ifndef RUN_INT_RAM | |
130 /* | |
131 +--------------------------------------------------------------------+ | |
132 | PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | | |
133 | STATE : code ROUTINE : vsi_d_callback | | |
134 +--------------------------------------------------------------------+ | |
135 | |
136 PURPOSE : callback from a driver | |
137 | |
138 */ | |
139 void vsi_d_callback ( T_DRV_SIGNAL *Signal ) | |
140 { | |
141 T_HANDLE Caller; | |
142 T_HANDLE DrvHandle; | |
143 int sts; | |
144 #ifdef EXTR_SEND_CONTROL | |
145 OS_TIME time; | |
146 T_PRIM_HEADER *p; | |
147 static int cnt = 0; | |
148 int bytes; | |
149 #endif | |
150 | |
151 Caller = Signal->DrvHandle; | |
152 DrvHandle = DrvTable[Caller].UpperDrv; | |
153 if ( DrvHandle ) | |
154 { | |
155 if ( DrvTable[DrvHandle].DrvInfo->DrvFunc.drv_Callback != NULL ) | |
156 { | |
157 #if defined _TARGET_ && defined _NUCLEUS_ | |
158 if ( DrvTable[Caller].DrvInfo->Flags & CALLED_FROM_ISR ) | |
159 os_ExecuteCallback ( Caller, DrvTable[DrvHandle].DrvInfo->DrvFunc.drv_Callback, Signal ); | |
160 else | |
161 #endif | |
162 (DrvTable[DrvHandle].DrvInfo->DrvFunc.drv_Callback)( Signal ); | |
163 } | |
164 } | |
165 else | |
166 { | |
167 if ( DrvTable[Caller].ProcessHandle ) | |
168 { | |
169 OS_QDATA Msg; | |
170 OS_TIME time; | |
171 Msg.data16 = MSG_SIGNAL; | |
172 Msg.data32 = Signal->SignalType; | |
173 Msg.ptr = Signal->UserData; | |
174 os_GetTime ( 0, &time ); | |
175 Msg.time = (ULONG)time; | |
176 Msg.e_id = DrvTable[Caller].ProcessHandle; | |
177 #ifdef EXTR_SEND_CONTROL | |
178 if ( Msg.ptr ) | |
179 { | |
180 os_GetTime(0,&time); | |
181 fp = fopen("test.txt", "a"); | |
182 p = (T_PRIM_HEADER*)((T_PRIM_X*)Msg.ptr)->prim_ptr; | |
183 if ( p->opc == 0x8000 ) | |
184 { | |
185 printf("EXTR: Start sending %s, time %d, %d\n", (char*)P2D(p),time, cnt & 1023 ); | |
186 bytes = fprintf(fp, "EXTR: Start sending %s, time %d, %d\n", (char*)P2D(p),time, cnt & 1023 ); | |
187 } | |
188 else | |
189 { | |
190 printf("EXTR: Start sending primitive, time %d, %d\n", time, cnt & 1023); | |
191 bytes = fprintf(fp, "EXTR: Start sending primitive, time %d, %d\n", time, cnt & 1023); | |
192 } | |
193 fclose(fp); | |
194 } | |
195 #endif | |
196 #ifdef _TOOLS_ | |
197 sts = os_SendToQueue (NO_TASK, DrvTable[Caller].ProcessHandle, OS_NORMAL, OS_SUSPEND, &Msg ); | |
198 #else | |
199 sts = os_SendToQueue (NO_TASK, pf_TaskTable[DrvTable[Caller].ProcessHandle].QueueHandle, OS_NORMAL, OS_SUSPEND, &Msg ); | |
200 #endif | |
201 #ifdef EXTR_SEND_CONTROL | |
202 os_GetTime(0,&time); | |
203 fp = fopen("test.txt", "a"); | |
204 printf("EXTR: Complete sending, time %d %d\n", time, cnt & 1023); | |
205 bytes = fprintf(fp,"EXTR: Complete sending, time %d %d\n", time, cnt++ & 1023); | |
206 fclose(fp); | |
207 #endif | |
208 /* | |
209 * This is a dirty patch, but due to the missing return value there is no other choice | |
210 */ | |
211 if ( sts == OS_TIMEOUT || sts == OS_ERROR ) | |
212 { | |
213 T_PRIM_X *sys_prim; | |
214 | |
215 sys_prim = (T_PRIM_X*)Signal->UserData; | |
216 PFREE(P2D(sys_prim->prim_ptr)); | |
217 PFREE(P2D(sys_prim)); | |
218 } | |
219 } | |
220 } | |
221 } | |
222 #endif | |
223 | |
224 #ifndef RUN_INT_RAM | |
225 /* | |
226 +--------------------------------------------------------------------+ | |
227 | PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | | |
228 | STATE : code ROUTINE : vsi_d_init | | |
229 +--------------------------------------------------------------------+ | |
230 | |
231 PURPOSE : initialize drivers | |
232 | |
233 */ | |
234 /*lint -esym(644,DrvInfo) */ | |
235 int vsi_d_init ( T_HANDLE Caller ) | |
236 { | |
237 T_DRV_EXPORT const *DrvInfo; | |
238 USHORT i; | |
239 SHORT sts; | |
240 | |
241 #ifdef EXTR_SEND_CONTROL | |
242 fp = fopen("test.txt", "a"); | |
243 fprintf(fp,"=========================================================\n"); | |
244 fclose (fp); | |
245 #endif | |
246 for ( i = 1; i < MAX_TST_DRV; i++ ) | |
247 { | |
248 sts = DRV_NOTCONFIGURED; | |
249 #ifdef _TOOLS_ | |
250 if ( DrvTable[i].DrvInfo ) | |
251 sts = (SHORT)(DrvTable[i].DrvInfo->DrvFunc.drv_Init)(i,vsi_d_callback,&DrvInfo); | |
252 else | |
253 #endif | |
254 if ( DriverList->DrvEntry[i].drv_Init ) | |
255 sts = (SHORT)(DriverList->DrvEntry[i].drv_Init)(i,vsi_d_callback,&DrvInfo); | |
256 if ( sts == DRV_OK ) | |
257 { | |
258 if ( DriverList->DrvEntry[i].Process ) | |
259 DrvTable[i].ProcessHandle = vsi_c_open ( Caller, (char*)DriverList->DrvEntry[i].Process ); | |
260 DrvTable[i].UpperDrv = i-1; | |
261 DrvTable[i-1].LowerDrv = i; | |
262 DrvTable[i].DrvInfo = DrvInfo; | |
263 #if defined _TARGET_ && defined _NUCLEUS_ | |
264 if ( DrvTable[i].DrvInfo->Flags & CALLED_FROM_ISR ) | |
265 if ( os_CreateCallback() == OS_ERROR ) | |
266 return VSI_ERROR; | |
267 #endif | |
268 } | |
269 else | |
270 { | |
271 if ( sts != DRV_NOTCONFIGURED ) | |
272 { | |
273 return VSI_ERROR; | |
274 } | |
275 } | |
276 } | |
277 return VSI_OK; | |
278 } | |
279 #endif | |
280 | |
281 #ifndef RUN_INT_RAM | |
282 /* | |
283 +--------------------------------------------------------------------+ | |
284 | PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | | |
285 | STATE : code ROUTINE : vsi_d_exit | | |
286 +--------------------------------------------------------------------+ | |
287 | |
288 PURPOSE : exit drivers | |
289 | |
290 */ | |
291 int vsi_d_exit ( T_HANDLE Caller, T_HANDLE DrvHandle ) | |
292 { | |
293 T_HANDLE Handle; | |
294 T_HANDLE min, max; | |
295 | |
296 if ( DrvHandle ) | |
297 { | |
298 min = DrvHandle; | |
299 max = DrvHandle+1; | |
300 } | |
301 else | |
302 { | |
303 min = 1; | |
304 max = MAX_TST_DRV; | |
305 } | |
306 | |
307 for ( Handle = min; Handle < max; Handle++ ) | |
308 { | |
309 if ( DrvTable[Handle].DrvInfo ) | |
310 { | |
311 if ( DrvTable[Handle].DrvInfo->DrvFunc.drv_Exit != NULL ) | |
312 (DrvTable[Handle].DrvInfo->DrvFunc.drv_Exit)(); | |
313 } | |
314 } | |
315 return VSI_OK; | |
316 } | |
317 #endif | |
318 | |
319 #ifndef RUN_INT_RAM | |
320 /* | |
321 +--------------------------------------------------------------------+ | |
322 | PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | | |
323 | STATE : code ROUTINE : vsi_d_open | | |
324 +--------------------------------------------------------------------+ | |
325 | |
326 PURPOSE : open a drivers | |
327 | |
328 */ | |
329 int vsi_d_open ( T_HANDLE Caller, char *Name ) | |
330 { | |
331 int i; | |
332 | |
333 for ( i = 1; i <= MAX_TST_DRV; i++ ) | |
334 { | |
335 if ( DrvTable[i].DrvInfo && DrvTable[i].DrvInfo->Name ) | |
336 if ( !strcmp ( DrvTable[i].DrvInfo->Name, Name ) ) | |
337 return (i); | |
338 } | |
339 return VSI_ERROR; | |
340 } | |
341 #endif | |
342 | |
343 #ifndef RUN_INT_RAM | |
344 /* | |
345 +--------------------------------------------------------------------+ | |
346 | PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | | |
347 | STATE : code ROUTINE : vsi_d_close | | |
348 +--------------------------------------------------------------------+ | |
349 | |
350 PURPOSE : close a driver | |
351 | |
352 */ | |
353 /*lint -esym(715,DrvHandle) suppress Info -- Symbol 'DrvHandle' not referenced */ | |
354 int vsi_d_close ( T_HANDLE Caller, T_HANDLE DrvHandle ) | |
355 { | |
356 | |
357 return VSI_OK; | |
358 } | |
359 #endif | |
360 | |
361 #ifndef RUN_INT_RAM | |
362 /* | |
363 +--------------------------------------------------------------------+ | |
364 | PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | | |
365 | STATE : code ROUTINE : vsi_d_read | | |
366 +--------------------------------------------------------------------+ | |
367 | |
368 PURPOSE : read data from a driver | |
369 | |
370 */ | |
371 int vsi_d_read ( T_HANDLE Caller, T_HANDLE DrvHandle, void *Buffer, ULONG *Size ) | |
372 { | |
373 T_HANDLE Handle; | |
374 | |
375 if ( DrvHandle ) | |
376 Handle = DrvHandle; /* Caller TST: opened driver with vsi_d_open() */ | |
377 else | |
378 Handle = DrvTable[Caller].LowerDrv; /* Caller drv: handle defined by ConfigSring */ | |
379 | |
380 if ( DrvTable[Handle].DrvInfo->DrvFunc.drv_Read != NULL ) | |
381 if ( (DrvTable[Handle].DrvInfo->DrvFunc.drv_Read)( (void*)Buffer, Size ) == DRV_OK ) | |
382 return VSI_OK; | |
383 | |
384 return VSI_ERROR; | |
385 } | |
386 #endif | |
387 | |
388 #ifndef RUN_FLASH | |
389 /* | |
390 +--------------------------------------------------------------------+ | |
391 | PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | | |
392 | STATE : code ROUTINE : vsi_d_write | | |
393 +--------------------------------------------------------------------+ | |
394 | |
395 PURPOSE : write data to a driver | |
396 | |
397 */ | |
398 int vsi_d_write ( T_HANDLE Caller, T_HANDLE DrvHandle, void *Buffer, ULONG Size ) | |
399 { | |
400 T_HANDLE Handle; | |
401 ULONG TotalBytesToWrite = Size; | |
402 ULONG BytesToWrite = Size; | |
403 ULONG TotalBytesWritten = 0; | |
404 ULONG BytesWritten = 0; | |
405 char *ptr = (char*)Buffer; | |
406 | |
407 if ( DrvHandle ) | |
408 Handle = DrvHandle; /* Caller TST: opened driver with vsi_d_open() */ | |
409 else | |
410 Handle = DrvTable[Caller].LowerDrv; /* Caller drv: handle defined by ConfigSring */ | |
411 | |
412 if ( DrvTable[Handle].DrvInfo->DrvFunc.drv_Write != NULL ) | |
413 { | |
414 while ( TotalBytesWritten < TotalBytesToWrite ) | |
415 { | |
416 BytesWritten = BytesToWrite; | |
417 if ( (DrvTable[Handle].DrvInfo->DrvFunc.drv_Write)( (void*)ptr, &BytesWritten ) != DRV_OK ) | |
418 return VSI_ERROR; | |
419 ptr += BytesWritten; | |
420 TotalBytesWritten += BytesWritten; | |
421 BytesToWrite = TotalBytesToWrite - TotalBytesWritten; | |
422 } | |
423 } | |
424 return VSI_OK; | |
425 } | |
426 #endif | |
427 | |
428 #ifndef RUN_INT_RAM | |
429 /* | |
430 +--------------------------------------------------------------------+ | |
431 | PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | | |
432 | STATE : code ROUTINE : vsi_d_flush | | |
433 +--------------------------------------------------------------------+ | |
434 | |
435 PURPOSE : flush the internal buffers of a driver | |
436 | |
437 */ | |
438 int vsi_d_flush ( T_HANDLE Caller, T_HANDLE DrvHandle ) | |
439 { | |
440 T_HANDLE Handle; | |
441 T_HANDLE min, max; | |
442 | |
443 if ( DrvHandle ) | |
444 { | |
445 min = DrvHandle; | |
446 max = DrvHandle+1; | |
447 } | |
448 else | |
449 { | |
450 min = 1; | |
451 max = MAX_TST_DRV; | |
452 } | |
453 | |
454 for ( Handle = min; Handle < max; Handle++ ) | |
455 { | |
456 if ( DrvTable[Handle].DrvInfo ) | |
457 if ( DrvTable[Handle].DrvInfo->DrvFunc.drv_Flush != NULL ) | |
458 if ( (DrvTable[Handle].DrvInfo->DrvFunc.drv_Flush)() != DRV_OK ) | |
459 return VSI_ERROR; | |
460 } | |
461 return VSI_OK; | |
462 } | |
463 #endif | |
464 | |
465 #ifndef RUN_INT_RAM | |
466 /* | |
467 +--------------------------------------------------------------------+ | |
468 | PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | | |
469 | STATE : code ROUTINE : vsi_d_setsignal | | |
470 +--------------------------------------------------------------------+ | |
471 | |
472 PURPOSE : enable a signal in a driver | |
473 | |
474 */ | |
475 int vsi_d_setsignal ( T_HANDLE Caller, T_HANDLE DrvHandle, USHORT SignalType ) | |
476 { | |
477 T_HANDLE Handle; | |
478 T_HANDLE min, max; | |
479 | |
480 if ( DrvHandle ) | |
481 { | |
482 min = DrvHandle; | |
483 max = DrvHandle+1; | |
484 } | |
485 else | |
486 { | |
487 min = 1; | |
488 max = MAX_TST_DRV; | |
489 } | |
490 | |
491 for ( Handle = min; Handle < max; Handle++ ) | |
492 { | |
493 if ( DrvTable[Handle].DrvInfo ) | |
494 if ( DrvTable[Handle].DrvInfo->DrvFunc.drv_SetSignal != NULL ) | |
495 if ( (DrvTable[Handle].DrvInfo->DrvFunc.drv_SetSignal)( SignalType ) != DRV_OK ) | |
496 return VSI_ERROR; | |
497 } | |
498 return VSI_OK; | |
499 } | |
500 #endif | |
501 | |
502 #ifndef RUN_INT_RAM | |
503 /* | |
504 +--------------------------------------------------------------------+ | |
505 | PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | | |
506 | STATE : code ROUTINE : vsi_d_resetsignal | | |
507 +--------------------------------------------------------------------+ | |
508 | |
509 PURPOSE : disable a signal in a driver | |
510 | |
511 */ | |
512 int vsi_d_resetsignal ( T_HANDLE Caller, T_HANDLE DrvHandle, USHORT SignalType ) | |
513 { | |
514 T_HANDLE Handle; | |
515 T_HANDLE min, max; | |
516 | |
517 if ( DrvHandle ) | |
518 { | |
519 min = DrvHandle; | |
520 max = DrvHandle+1; | |
521 } | |
522 else | |
523 { | |
524 min = 1; | |
525 max = MAX_TST_DRV; | |
526 } | |
527 | |
528 for ( Handle = min; Handle < max; Handle++ ) | |
529 { | |
530 if ( DrvTable[Handle].DrvInfo ) | |
531 if ( DrvTable[Handle].DrvInfo->DrvFunc.drv_ResetSignal != NULL ) | |
532 if ( (DrvTable[Handle].DrvInfo->DrvFunc.drv_ResetSignal)( SignalType ) != DRV_OK ) | |
533 return VSI_ERROR; | |
534 } | |
535 return VSI_OK; | |
536 } | |
537 #endif | |
538 | |
539 #ifndef RUN_INT_RAM | |
540 /* | |
541 +--------------------------------------------------------------------+ | |
542 | PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | | |
543 | STATE : code ROUTINE : vsi_d_setconfig | | |
544 +--------------------------------------------------------------------+ | |
545 | |
546 PURPOSE : configure a driver | |
547 | |
548 */ | |
549 int vsi_d_setconfig ( T_HANDLE Caller, T_HANDLE DrvHandle, char *Config ) | |
550 { | |
551 T_HANDLE Handle; | |
552 | |
553 if ( Config && DrvHandle != 0) | |
554 { | |
555 if ( DrvTable[DrvHandle].DrvInfo->DrvFunc.drv_SetConfig != NULL ) | |
556 if ( (DrvTable[DrvHandle].DrvInfo->DrvFunc.drv_SetConfig)( Config ) != DRV_OK ) | |
557 return VSI_ERROR; | |
558 } | |
559 else | |
560 { | |
561 T_HANDLE min, max; | |
562 | |
563 if ( DrvHandle ) | |
564 { | |
565 min = DrvHandle; | |
566 max = DrvHandle+1; | |
567 } | |
568 else | |
569 { | |
570 min = 1; | |
571 max = MAX_TST_DRV; | |
572 } | |
573 | |
574 for ( Handle = min; Handle < max; Handle++ ) | |
575 { | |
576 if ( DriverList->DrvEntry[Handle].DrvConfig ) | |
577 { | |
578 if ( DrvTable[Handle].DrvInfo->DrvFunc.drv_SetConfig != NULL ) | |
579 if ( (DrvTable[Handle].DrvInfo->DrvFunc.drv_SetConfig)( (char*)DriverList->DrvEntry[Handle].DrvConfig ) != DRV_OK ) | |
580 return VSI_ERROR; | |
581 } | |
582 } | |
583 } | |
584 return VSI_OK; | |
585 } | |
586 #endif | |
587 | |
588 #ifndef RUN_INT_RAM | |
589 /* | |
590 +--------------------------------------------------------------------+ | |
591 | PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | | |
592 | STATE : code ROUTINE : vsi_d_getconfig | | |
593 +--------------------------------------------------------------------+ | |
594 | |
595 PURPOSE : read configuration data from a driver | |
596 | |
597 */ | |
598 | |
599 int vsi_d_getconfig ( T_HANDLE Caller, T_HANDLE DrvHandle, char *Config ) | |
600 { | |
601 T_HANDLE Handle; | |
602 char Buffer[40]; | |
603 char *ptr = Config; | |
604 | |
605 Handle = DrvHandle; | |
606 while ( Handle ) | |
607 { | |
608 if ( DrvTable[Handle].DrvInfo ) | |
609 if ( DrvTable[Handle].DrvInfo->DrvFunc.drv_GetConfig != NULL ) | |
610 if ( (DrvTable[Handle].DrvInfo->DrvFunc.drv_GetConfig)( Buffer ) != DRV_OK ) | |
611 return VSI_ERROR; | |
612 | |
613 sprintf ( ptr, "%s:%s;",DrvTable[Handle].DrvInfo->Name,Buffer ); | |
614 ptr = ptr + strlen(DrvTable[Handle].DrvInfo->Name) + strlen(Buffer) + 2; | |
615 Handle = DrvTable[Handle].LowerDrv; | |
616 } | |
617 return VSI_OK; | |
618 } | |
619 #endif | |
620 | |
621 #ifndef RUN_INT_RAM | |
622 /* | |
623 +--------------------------------------------------------------------+ | |
624 | PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | | |
625 | STATE : code ROUTINE : InitializeDriverTable | | |
626 +--------------------------------------------------------------------+ | |
627 | |
628 PURPOSE : Initialize the driver table | |
629 | |
630 */ | |
631 void InitializeDriverConfig ( void ) | |
632 { | |
633 #ifdef _TOOLS_ | |
634 USHORT j; | |
635 | |
636 for ( j = 1; j < MAX_TST_DRV ; j++ ) | |
637 { | |
638 if ( DriverConfigList->DrvEntry[j].Name ) | |
639 { | |
640 strcpy ( _DrvList.DrvEntry[j].Name, DriverConfigList->DrvEntry[j].Name ); | |
641 DrvList.DrvEntry[j].Name = _DrvList.DrvEntry[j].Name; | |
642 } | |
643 | |
644 if ( DriverConfigList->DrvEntry[j].drv_Init ) | |
645 { | |
646 DrvList.DrvEntry[j].drv_Init = DriverConfigList->DrvEntry[j].drv_Init; | |
647 } | |
648 | |
649 if ( DriverConfigList->DrvEntry[j].Process ) | |
650 { | |
651 strcpy ( _DrvList.DrvEntry[j].Process, DriverConfigList->DrvEntry[j].Process ); | |
652 DrvList.DrvEntry[j].Process = _DrvList.DrvEntry[j].Process; | |
653 } | |
654 | |
655 if ( DriverConfigList->DrvEntry[j].DrvConfig ) | |
656 { | |
657 strcpy ( _DrvList.DrvEntry[j].DrvConfig, DriverConfigList->DrvEntry[j].DrvConfig ); | |
658 DrvList.DrvEntry[j].DrvConfig = _DrvList.DrvEntry[j].DrvConfig; | |
659 } | |
660 } | |
661 | |
662 DriverList = &DrvList; | |
663 #else | |
664 DriverList = DriverConfigList; | |
665 #endif /* _TOOLS_ */ | |
666 ClearDriverTable(); | |
667 } | |
668 #endif | |
669 | |
670 #ifndef RUN_INT_RAM | |
671 /* | |
672 +--------------------------------------------------------------------+ | |
673 | PROJECT : GSM-Frame (8415) MODULE : VSI_DRV | | |
674 | STATE : code ROUTINE : ClearDriverTable | | |
675 +--------------------------------------------------------------------+ | |
676 | |
677 PURPOSE : Clear the driver table | |
678 | |
679 */ | |
680 void ClearDriverTable ( void ) | |
681 { | |
682 char i; | |
683 | |
684 for ( i = 1; i <= MAX_TST_DRV; i++ ) | |
685 { | |
686 memset ( &DrvTable[i], 0, sizeof(T_DRV_TABLE_ENTRY) ); | |
687 } | |
688 | |
689 } | |
690 #endif |