source: svn/newcon3bcm2_21bu/dst/app/src/Main/App_Debug.c @ 76

Last change on this file since 76 was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 21.6 KB
Line 
1/****************************************************************************
2* NAME: App_Debug.c
3*----------------------------------------------------------------------------
4* Copyright (c) DIGITAL STREAM Technology Inc.
5*----------------------------------------------------------------------------
6* CREATED_BY: Do Gon Lee
7* CREATION_DATE: 2009/08/28
8* $Author: foxhunt $
9* $Revision: 1.0 $
10* $Date: 2009/08/28 10:47:19 $
11*----------------------------------------------------------------------------
12* PURPOSE:
13* -
14*****************************************************************************/
15
16/*_____ I N C L U D E __________________________________________*/
17
18#include "App_Main.h"
19
20#include "App_Fnc_NvRam.h"
21#include "App_Version.h"
22
23#include "App_Res_Resources.h"
24#include "DMG_Menu.h"
25
26#include "DMW_ChannelAPI.h"
27#include "DMW_EpgInterface.h"
28#include "DMW_SysTime.h"
29#include "DMW_Mutex.h"  /* register mutex symbols. */
30
31
32
33/*_____ D E F I N I T I O N ____________________________________*/
34
35DHL_MODULE("@dbg", 0);
36
37
38#if COMMENT
39____Config____(){}
40#endif
41
42
43
44#define MY_SYM_ENTRY(shortcut, fn) { #shortcut, (void *)fn, DHL_SYM_FN, }
45
46
47
48
49
50#if COMMENT
51____Types____(){}
52#endif
53
54
55
56
57
58#if COMMENT
59____Variables____(){}
60#endif
61
62int g_Trace_AppMain = 1;
63
64
65
66
67
68/*_____ F U N C T I O N ________________________________________*/
69
70#if COMMENT
71____Function____(){}
72#endif
73
74
75BOOL AppCheckPrintable(void)
76{
77        return g_Trace_AppMain ? TRUE : FALSE;
78}
79
80
81/******************************************************************************************
82FUNCTION:
83  - App_PrintTextMessageBox2
84
85Purpose:
86  - ¿©·¯¶óÀÎ ¸Þ½ÃÁö Ãâ·Â
87Noet: cafrii 060621, add debug utils..
88******************************************************************************************/
89void App_PrintTextMessageBox2(int n_msg, char **msglist, int width)
90{
91        /* widthÀÇ ÃÖ´ë ±æÀÌ´Â 78. ¾çÂÊ side¸¦ Æ÷ÇÔÇØ¼­ ÃÖ´ë 80À¸·Î ¸ÂÃß±â À§ÇÔ. */
92        int spacelen, msglen, spaceodd;
93        char bufline[80], bufspace[40];
94        char *msg;
95        int i;
96       
97        if (msglist == NULL) return;
98       
99        width = min(78, width);
100        /* width´Â ¾çÂÊ side bar¸¦ Á¦¿ÜÇÑ ½ÇÁ¦ ¹®ÀÚ¿­ Ãâ·Â °¡´ÉÇÑ °ø°£ÀÇ ÆøÀÌ´Ù. */
101
102        if (width < 1) width = 1;
103
104        memset(bufline, '-', width);  bufline[width] = 0;
105        DHL_OS_Printf("+%s+\n", bufline);
106
107        for (i=0; i<n_msg; i++)
108        {
109                msg = msglist[i];
110               
111                if (msg == NULL) msg = "";
112               
113                msglen = strlen(msg);
114               
115                strncpy(bufline, msg, width);   /* ÃÖ´ë width ±ÛÀÚ¸¸Å­À» º¹»ç. */
116                bufline[width] = 0;
117               
118                if (msglen > width) {   /* ¿øº» ¹®ÀÚ¿­¿¡¼­ ÀϺΰ¡ À߸° °æ¿ì truncate Ç¥½Ã.. */
119                        bufline[width-1] = '.';
120                        if (width >= 2) bufline[width-2] = '.';
121                }
122                /* buflineÀº Áغñ ¿Ï·á. ÃÖ´ë±æÀÌ: width */
123
124                if (msglen > width) {
125                        spacelen = spaceodd = 0;
126                }
127                else {
128                        spacelen = (width - msglen)/2;  /* oddÀÏ °æ¿ì °ø°£ 1°³ ºÎÁ·ÇÔ. ³ªÁß¿¡ º¸Ãæ. */
129                        spaceodd = (width - msglen)&1;  /* Â¥Åõ¸® ÇѱÛÀÚ °ø°£ */
130                }
131               
132                memset(bufspace, ' ', spacelen);
133                bufspace[spacelen] = 0;
134
135                /* bufspace Áغñ ¿Ï·á. ±æÀÌ´Â space. */
136                DHL_OS_Printf("|%s%s%s%s|\n", bufspace, bufline, bufspace, spaceodd ? " " : "");
137        }
138
139        memset(bufline, '-', width);  bufline[width] = 0;
140        DHL_OS_Printf("+%s+\n", bufline);
141}
142
143
144/******************************************************************************************
145FUNCTION:
146  - App_PrintTextMessageBox
147
148Purpose:
149  - ÇÑ ¶óÀÎ ¸Þ½ÃÁö Ãâ·Â.
150******************************************************************************************/
151void App_PrintTextMessageBox(char *msg, int width)
152{
153        App_PrintTextMessageBox2(1, &msg, width);
154}
155
156
157
158
159
160#if COMMENT
161____SignalCheck____(){}
162#endif
163
164#if 1//BKTEMP APP_PORTING
165
166/* Driver */
167void sigstr()
168{
169        int r1,r2,r3,r4,r5,r6,r7,r8;
170        UINT32 lock,str,ser1,ser10,snr1000, quality, meter, ddmsnr;
171
172#if APP_PORTING
173        r1 = DHL_FE_GetSignalStatus(TUNER_FAT, SIGNAL_LOCK, &lock);
174        r2 = DHL_FE_GetSignalStatus(TUNER_FAT, SIGNAL_STRENGTH, &str);
175        r3 = DHL_FE_GetSignalStatus(TUNER_FAT, SIGNAL_SER_1SEC, &ser1);
176        r4 = DHL_FE_GetSignalStatus(TUNER_FAT, SIGNAL_SER_10SEC, &ser10);
177        r5 = DHL_FE_GetSignalStatus(TUNER_FAT, SIGNAL_SNR2, &snr1000);
178        r6 = DHL_FE_GetSignalStatus(TUNER_FAT, SIGNAL_QUALITY, &quality);
179        r7 = DHL_FE_GetSignalStatus(TUNER_FAT, SIGNAL_METER, &meter);
180        r8 = DHL_FE_GetSignalStatus(TUNER_FAT, SIGNAL_DDM10_SNR, &ddmsnr);
181#endif  /* #if APP_PORTING */
182
183        DHL_OS_Printf("Signal lock %d, Strength %d, SER1 %d, SER10 %d, SNR %.3f\n", 
184                                lock, str, ser1, ser10, (float)(snr1000/1000.));
185        DHL_OS_Printf("Signal quality %d, meter %.3f, DDM SNR %.3f\n", 
186                                quality, (float)(meter/1000.), (float)(ddmsnr/1000.));
187}
188
189
190void sigtune(int rf, int mod)
191{
192        int err;
193       
194        DHL_OS_Printf("tuning.. (rf %d, mod %d)\n", rf, mod);
195        err = DMW_HAL_TunerSetChannel(rf, (tDHL_Demod)mod, 0, FREQTUNE_FIXED, NULL);
196        if (err)
197                DHL_OS_Printf("!! tuning to rf %d err %d\n", rf, err);
198        else
199                DHL_OS_Printf("  tune %d (mod %d) ok..\n", rf, mod);   
200}
201
202
203void sigreset(int ms)
204{
205#if 1
206        /* CB2¿¡´Â tuner/demod resetÀÌ ¾øÀ½. sw reset ÇÊ¿äÇÔ. */
207#else
208        DHL_SYS_SetGPIO(9);
209        DHL_OS_Delay(ms);
210       
211        DHL_SYS_ResetGPIO(9);
212        DHL_OS_Delay(ms);
213
214        DHL_SYS_SetGPIO(9);
215        DHL_OS_Delay(ms);
216
217        DHL_OS_Printf("sigreset (tick %d) completed\n", tick);
218#endif // #if 1
219}
220
221#endif // #if APP_PORTING
222
223
224
225
226
227#if COMMENT
228____Utils____(){}
229#endif
230
231/* cafrii 050819 add */
232void selfdie(UINT32 addr)
233{
234        *(UINT8 *)(addr) = 0;
235}
236
237
238void reboot(int mode)
239{
240        App_NVM_Sync();
241       
242        DMW_CDB_WaitForNvRamSyncDone();
243#if APP_PORTING
244        DHL_SYS_SystemCommand(DHL_SYS_RESET, mode);
245#endif
246}
247
248
249#if APP_PORTING
250/******************************************************************************************
251FUNCTION:
252  - show_info
253
254Purpose:
255  - show variety information : sw version, device info, etc..
256Noet: cafrii 070725 add
257******************************************************************************************/
258void show_info(void)
259{
260        char buf[2][80];
261        char *buflist[2] = { buf[0], buf[1], };
262       
263        DHL_SYS_Info sys_info;
264        char t_vendor[30] = {0, };
265        char f_vendor[40], f_device[40];
266
267        DHL_SYS_GetInfo(&sys_info);
268
269#if APP_PORTING
270        sprintf(buf[0], " SW: %s(%d) %s %s %s %s", MODEL_NAME, SUBMODEL_ID, 
271                        App_GetSwVersion(), App_GetBuildNumber(),
272                        App_GetBuildDateString(), App_GetBuildTimeString());
273#else                   
274        sprintf(buf[0], " SW: %s %s %s %s %s", MODEL_NAME, 
275                        App_GetSwVersion(), App_GetBuildNumber(),
276                        App_GetBuildDateString(), App_GetBuildTimeString());
277#endif  /* #if APP_PORTING */
278
279#if APP_PORTING
280        DHL_FE_GetDeviceInfo(TUNER_FAT, FE_DEV_VENDOR_NAME, (UINT32 *)t_vendor);
281#endif  /* #if APP_PORTING */
282        DHL_DEV_GetInfo(eDEV_INFO_VENDOR_NAME, (UINT32)f_vendor);
283        DHL_DEV_GetInfo(eDEV_INFO_DEVICE_NAME, (UINT32)f_device);
284
285        sprintf(buf[1], " HW: Board %u, Tuner %s, Flash %s %s", 
286                                sys_info.board_verion, t_vendor, f_vendor, f_device);
287                               
288        App_PrintTextMessageBox2(2, buflist, 60);
289}
290
291
292/******************************************************************************************
293FUNCTION:
294  - show_info
295
296Purpose:
297  - °¢ Å×À̺íµéÀÇ Get/Print/Free Å×½ºÆ® ÇÔ¼ö.
298Noet: Monitor°¡ °É·Á ÀÖ´Â °æ¿ì¿¡´Â download°¡ ¾ÈµÉ ¼ö ÀÖÀ½.
299******************************************************************************************/
300void TestGetEit(int pid, int sid, int waitSeconds)
301{
302        STATUS err;
303        eitPtr_t eit;
304       
305        if (waitSeconds == 0) waitSeconds = 10;
306       
307        err = Dmc_GetEit(DHL_DMX_GetTsd(), pid, sid, &eit, 
308                        waitSeconds*OS_GetTicksPerSecond(), NULL);
309
310        if (err) {
311                DHL_OS_Printf("!! eit (pid %x sid %x) get failed %d\n", err);
312                return;
313        }
314       
315        PrintEit(eit);
316       
317        DHL_OS_Printf("\n");
318        Dmc_PrintEit(eit, 8, NULL);
319       
320        Dmc_FreeAtscTable(&eit);
321}
322
323
324void TestGetEtt(int pid, UINT32 etmid, int waitSeconds)
325{
326        STATUS err;
327        ettSectionPtr_t ett;
328
329        if (waitSeconds == 0) waitSeconds = 10;
330       
331        err = Dmc_GetEttSection(DHL_DMX_GetTsd(), pid, etmid, &ett, 
332                        waitSeconds*OS_GetTicksPerSecond(), NULL);
333
334        if (err) {
335                DHL_OS_Printf("!! ett (pid %x etmid %x) get failed %d\n", err);
336                return;
337        }
338
339        PrintEttSection(ett);
340
341        DHL_OS_Printf("\n");
342        Dmc_PrintEtt(ett, 8);
343
344        Dmc_FreeAtscTable(&ett);
345}
346
347#else
348
349void App_SWVer()
350{
351        DHL_OS_Printf("-------------------------------------------------------\n");
352        DHL_OS_Printf("  Project : %s\n", App_GetPrjName());
353        DHL_OS_Printf("    SW Version : %s\n", App_GetSwVersion());
354        DHL_OS_Printf("    Build Date/Time : %s %s\n", __DATE__,__TIME__);
355        DHL_OS_Printf("-------------------------------------------------------\n");
356       
357}
358
359#endif // #if APP_PORTING
360
361
362
363
364
365#if COMMENT
366____RemoteControl____(){}
367#endif
368
369// cafrii 060616
370// note!
371//  for key simulation feature, do not use space
372// 
373char *RCU_KEY_STR(UINT32 id)
374{
375        return
376                        //id==APP_VK_CH_ADD?"CH_ADD":
377                        //id==APP_VK_CH_DEL?"CH_DEL":
378                        id==APP_VK_LEFT?"LEFT":
379                        id==APP_VK_RIGHT?"RIGHT":
380                        id==APP_VK_UP?"UP":
381                        id==APP_VK_DOWN?"DOWN":
382                        id==APP_VK_INFO?"INFO":
383                        id==APP_VK_CH_UP?"CH+":
384                        id==APP_VK_CH_DOWN?"CH-":
385                        id==APP_VK_VOL_UP?"VOL+":
386                        id==APP_VK_VOL_DOWN?"VOL-":
387                        id==APP_VK_SELECT?"OK":
388                        id==APP_VK_BACK?"BACK":
389                        id==APP_VK_MENU?"MENU":
390                        id==APP_VK_POWER_OFF?"POWER":
391                        id==APP_VK_1?"1":
392                        id==APP_VK_2?"2":
393                        id==APP_VK_3?"3":
394                        id==APP_VK_4?"4":
395                        id==APP_VK_5?"5":
396                        id==APP_VK_6?"6":
397                        id==APP_VK_7?"7":
398                        id==APP_VK_8?"8":
399                        id==APP_VK_9?"9":
400                        id==APP_VK_0?"0":
401                        id==APP_VK_MUTE?"MUTE":
402                        id==APP_VK_DOT?"DOT":
403                        //id==APP_VK_DRF?"DRF":
404                        id==APP_VK_EPG?"EPG":
405                        id==APP_VK_CC?"CC": 
406                        id==APP_VK_ALANG?"ALANG":
407                        //id==APP_VK_SCREEN?"SCREEN":
408                        id==APP_VK_DMODE?"ZOOM":
409                        id==APP_VK_FAV?"FAV":
410                        id==APP_VK_STILL?"STILL":
411                        //id==APP_VK_EXIT?"EXIT":
412                        id==APP_VK_PREV_CH?"PREV_CH":
413                        //id==APP_VK_HELP?"HELP":
414                        id==APP_VK_SLEEP?"SLEEP":
415                        id==APP_VK_INFO?"INFO":
416                        //id==APP_VK_SRS_MODE?"SRS_MODE":
417                        id==APP_VK_SMART_PICTURE?"SMART_PICTURE":
418                        id==APP_VK_SMART_SOUND?"SMART_SOUND":
419                        //id==APP_VK_CH_BLOCK_EDIT?"CH_BLOCK_EDIT":
420                        //id==APP_VK_EXT_INPUT?"EXT_INPUT":
421                        id==APP_VK_AD?"ADT":
422                        "UNKNOWN"
423        ;
424}
425
426
427// cafrii 060616 add for key simulation
428void SimulateRemoconKey(char *s)
429{
430        UINT32 code;
431        int i;
432        char *name, input[20];
433        //COMM_PKT_INFO packet; // cafrii API »ç¿ëÀ¸·Î ´ëü..
434
435        // brute force search..
436        //
437        UINT32 code_start = APP_VK_MIN;
438        UINT32 code_end = APP_VK_MAX;
439
440        if (s == NULL || s[0] == 0)
441        {
442                DHL_OS_Printf("-- key string help --\n");
443                for (code = code_start; code <= code_end; code++)
444                {
445                        name = RCU_KEY_STR(code);
446                        if (name[0]=='U' && name[1]=='N' && name[2]=='K')
447                                continue;
448                        DHL_OS_Printf("  %08x   %s\n", code, name);
449                }
450                DHL_OS_Printf("\n");
451                return;
452        }
453
454        strncpy(input, s, 19);
455        input[19] = 0;
456        for (i=0; i<strlen(input); i++) // ¸ðµÎ ´ë¹®ÀÚ·Î º¯°æ.
457                input[i] = (input[i] >= 'a' && input[i] <= 'z') ? input[i]-'a'+'A' : input[i];
458                       
459        //memset(&packet, 0, sizeof(packet));
460       
461        for (code = code_start; code <= code_end; code++)
462        {
463                name = RCU_KEY_STR(code);
464                if (strstr(name, input))  // substringÀ¸·Î ¹ß°ß¸¸ µÇ¸é
465                {
466                        DHL_OS_Printf("==> input '%s', simulate key '%s'\n", input, name);
467                       
468                        DMG_SetKeyInput(code);
469                        return;
470                }
471        }
472
473        DHL_OS_Printf("!! no such key name '%s'\n", input);
474}
475
476
477void App_SimulateRcuKey(UINT32 key)
478{
479        DMG_SetKeyInput(key);
480}
481
482
483void App_SimulateDigitKeys(char *str)
484{
485        char *p = str;
486        int i;
487       
488        for (i=0; *p && i<7; p++, i++) {
489                if (*p >= '0' && *p <= '9') {
490                        printf("---- feed %c\n", *p);
491                        App_SimulateRcuKey(APP_VK_0 + (*p - '0'));
492                }
493                else if (*p == '.' || *p == '-') {
494                        printf("---- feed dot\n");
495                        App_SimulateRcuKey(APP_VK_DOT);
496                }
497                else if (*p) {
498                        printf("---- feed OK\n");
499                        App_SimulateRcuKey(APP_VK_SELECT);
500                }
501        }
502}
503
504
505
506
507
508#if COMMENT
509____AgingTest____(){}
510#endif
511
512/******************************************************************************************
513FUNCTION:
514  - ChannelUpTest
515
516Purpose:
517  - Channel Up againg test
518        shell¿¡¼­ ÀÌ ¸í·ÉÀ» ½ÇÇàÇϸé shellÀÌ blocking µÇ¾î ¹ö¸®¹Ç·Î
519        ¹Ýµå½Ã background ¸ðµå·Î ½ÇÇàÇØ¾ß ÇÑ´Ù.
520
521        Shell> ChannelUpTest &
522
523        Á» ´õ ´Ù¾çÇÑ ±â´ÉÀ» »ç¿ëÇÏ·Á¸é App_StartAgingTest ÇÔ¼ö¸¦ »ç¿ëÇÒ °Í.
524******************************************************************************************/
525void ChannelUpTest(BOOL bStop)
526{
527        static UINT8 g_ChUpTestPeriod = 5;
528        static UINT8 g_ChUpTestWorking;
529       
530        int count, sec;
531        UINT32 msStart;
532
533        if (1) {
534                DHL_DBG_RegisterVarSymbol(DHL_VAR_SYM_ARGS(g_ChUpTestPeriod));
535        }
536       
537        if (bStop) {
538                DHL_OS_Printf("Stop ch up test\n");
539                g_ChUpTestWorking = FALSE;
540                return;
541        }
542       
543        g_ChUpTestWorking = 1;
544        count = 0;
545
546        msStart = DHL_OS_GetMsCount();
547
548        while (g_ChUpTestWorking)
549        {
550                sec = (DHL_OS_GetMsCount() - msStart)/1000;
551                DHL_OS_Printf("\n\n");
552                DHL_OS_Printf("----------------------------------------------------\n");
553                DHL_OS_Printf("[TEST] %d..  running %d:%02d \n", count++, sec/60, sec%60);
554                DHL_OS_Printf("----------------------------------------------------\n");
555               
556                App_SimulateRcuKey(APP_VK_CH_UP);
557
558                DHL_OS_Delay(1000*g_ChUpTestPeriod);
559        }
560       
561        DHL_OS_Printf("[TEST] test end\n");
562}
563
564
565/******************************************************************************************
566FUNCTION:
567  - AudioTest
568
569Purpose:
570  - audio stop/start test. usage is same as above two example.
571******************************************************************************************/
572void AudioTest(BOOL bStop)
573{
574        static UINT8 s_AudioTestWorking;
575        static UINT8 s_AudioTestPeriod100Ms = 5; 
576
577        int count, sec; 
578        UINT32 msStart;
579        DHL_RESULT dhlResult;
580       
581        if (1) {
582                DHL_DBG_RegisterVarSymbol(DHL_VAR_SYM_ARGS(s_AudioTestPeriod100Ms));
583        }
584
585        if (bStop) {
586                DHL_OS_Printf("Stop ch up test\n");
587                s_AudioTestWorking = FALSE;
588                /* dhl_set_lgtrace(21, 0); // turn off ADEC log */
589
590                return;
591        }
592
593        /* dhl_set_lgtrace(21, 1); // enable ADEC log */
594
595        s_AudioTestWorking = 1;
596        count = 0;
597        msStart = DHL_OS_GetMsCount();
598
599        while (s_AudioTestWorking)
600        {
601                sec = (DHL_OS_GetMsCount() - msStart)/1000;
602                DHL_OS_Printf("\n\n");
603                DHL_OS_Printf("----------------------------------------------------\n");
604                DHL_OS_Printf("[TEST] %d..  running %d:%02d \n", count++, sec/60, sec%60);
605                DHL_OS_Printf("----------------------------------------------------\n");
606
607                /* this PID is for KBS */
608                dhlResult = DHL_AV_AudioStart(0x24, 0x21, eDHL_AUDIO_TYPE_AC3);
609                if (dhlResult)
610                        break;
611                       
612                DHL_AV_AudioStop();
613
614                DHL_OS_Delay(s_AudioTestPeriod100Ms*10);
615        }
616       
617        DHL_OS_Printf("[TEST] test end\n");
618}
619
620
621
622
623
624#if COMMENT
625____RcuAgingTest____(){}
626#endif
627
628typedef struct 
629{
630        /* const char *cmd; */
631        int key;
632        int count;
633        int max_count;
634        int interval;
635       
636        UINT32 ms_start;
637} AgingTestParam;
638
639AgingTestParam g_AgingTestParam;
640
641void App_StartAgingTest(int key, UINT32 count, int interval_sec);
642
643/******************************************************************************************
644FUNCTION:
645  - _TestFinalizeHandler
646
647Purpose:
648  -
649******************************************************************************************/
650static void _TestFinalizeHandler(UINT32 nTimerID, UINT32 param)
651{
652        printf("\n ***** finalize aging test..\n");
653#if APP_PORTING
654        DHL_SYS_EnableWatchdog();
655#endif 
656        //App_SetRcuConfig(APP_RCU_SKIP_POWER_OFF, FALSE);
657       
658}
659
660
661/******************************************************************************************
662FUNCTION:
663  - _AgingTestHandler
664
665Purpose:
666  -
667******************************************************************************************/
668static void _AgingTestHandler(UINT32 nTimerID, UINT32 param)
669{
670        AgingTestParam *p = (AgingTestParam *)param;
671       
672        printf("\n========== aging, key '%s', %d/%d ========\n", 
673                        RCU_KEY_STR(p->key), 
674                        p->count, p->max_count);
675#if 0   
676        dhl_heap_status stat;
677        os_heap_status(&stat);
678        printf("heap: alloc %u(%u), free %u(%u)\n\n",
679                        stat.size_alloc, stat.num_alloc_chunk,
680                        stat.size_free, stat.num_free_chunk);
681#endif
682
683        DMW_SYS_SetTimer(TIMER_ID_AGING_END, (p->interval+1)*1000,
684                _TestFinalizeHandler, 0, TRUE); /* one shot timer */
685       
686        App_SimulateRcuKey(p->key);
687
688        p->count++;
689        if (p->count >= p->max_count)
690                /* stop test.. */
691                App_StartAgingTest(0, 0, 0);
692}
693
694
695/******************************************************************************************
696FUNCTION:
697  - App_StartAgingTest
698
699Purpose:
700  - application aging test start function
701
702
703        Shell> key
704                // »ç¿ëÇÒ Å° ¹øÈ£¸¦ ±â¾ï. CHUPÀ» ÇÏ°í ½ÍÀ¸¸é 0À» ÁöÁ¤ÇÏ¸é µÊ.
705       
706        Shell> App_StartAgingTest key, 1000000, 3
707                // 3Ãʸ¶´Ù ÇØ´ç ۸¦ simulate.
708
709        Shell> App_StartAgingTest
710                // ÇöÀç ¼öÇàµÇ°í ÀÖ´Â aging test¸¦ Á¾·á.
711******************************************************************************************/
712void App_StartAgingTest(int key, UINT32 count, int interval_sec)
713{
714        DMW_SYS_KillTimer(TIMER_ID_AGING_FIRST);
715        DMW_SYS_KillTimer(TIMER_ID_AGING_CONT);
716
717        if (interval_sec <= 0)
718                interval_sec = 3;
719               
720        if (key == 0) {
721                key = APP_VK_CH_UP;
722        }
723
724        printf("rcu key: %x\n", key);
725       
726        if (count > 0)
727        {
728#if APP_PORTING
729                DHL_SYS_DisableWatchdog();
730#endif
731
732        #if APP_PORTING
733                // aging test µµÁß¿¡ ¸®¸ðÄÁ power off Ű ½ÅÈ£°¡ ¿ÀÀÔ·Â µÇ¾î Å×½ºÆ® ¸ÁÄ¡´Â °ÍÀ» ¹æÁö.
734                // RCUÀÇ power off ۸¦ skip Çϴ Ư¼ö ¿É¼Ç »ç¿ë.
735                App_SetRcuConfig(APP_RCU_SKIP_POWER_OFF, TRUE);
736        #endif
737
738                /* this will be resumed after some time.
739                         if aging test keep going, this will be delayed until test end. */
740                DMW_SYS_SetTimer(TIMER_ID_AGING_END, (interval_sec+2)*1000,
741                        _TestFinalizeHandler, 0, TRUE); /* one shot timer */
742
743                printf("aging test start. count %u, interval %d sec\n", count, interval_sec);
744
745                g_AgingTestParam.ms_start = DHL_OS_GetMsCount();
746                g_AgingTestParam.key = key;
747                g_AgingTestParam.count = 0;
748                g_AgingTestParam.max_count = count;
749                g_AgingTestParam.interval = interval_sec;
750               
751                DMW_SYS_SetTimer(TIMER_ID_AGING_FIRST, 0, // trigger now
752                        _AgingTestHandler, (UINT32)&g_AgingTestParam, TRUE);  // one shot
753               
754                DMW_SYS_SetTimer(TIMER_ID_AGING_CONT, interval_sec*1000, 
755                        _AgingTestHandler, (UINT32)&g_AgingTestParam, FALSE); // continuous
756                       
757        }
758        else {
759                printf("\n======== aging test stopped\n\n");
760                printf("Usage: %s rcu_key count [interval_second]\n", __FUNCTION__);
761        }
762}
763
764
765/******************************************************************************************
766FUNCTION:
767  - App_SetDebugLevel
768
769Purpose:
770  - Set application debug level
771******************************************************************************************/
772void App_SetDebugLevel(int level)
773{
774#if APP_PORTING
775        extern int g_Trace_DmcMain;
776        extern int g_Trace_ChannelScan;
777        extern BOOL g_Trace_bDmcPsiEvent;
778       
779        if (level) {
780                DHL_OS_Printf("debug trace ON\n");
781                g_Trace_DmcMain = 4;
782                g_Trace_ChannelScan = 4;
783                g_Trace_bDmcPsiEvent = 1;
784                g_Trace_AppMain = 1;
785                DHL_DBG_SetModuleLevel("AV_P", 3);
786                DHL_DBG_SetModuleLevel("@f_vid", 0);
787                DHL_DBG_SetModuleLevel("@f_aud", 0);
788                DHL_DBG_SetModuleLevel("@f_sim", 0);
789                DHL_DBG_SetModuleLevel("@f_cht", 0);
790                DHL_DBG_SetModuleLevel("@f_pod", 2);
791                DHL_DBG_SetModuleLevel("@f_pwr", 2);
792                DHL_DBG_SetModuleLevel("p_idl", 0);             
793                DHL_DBG_SetModuleLevel("GRP_M", 1);
794        }
795        else {
796                DHL_OS_Printf("debug trace off\n");
797                g_Trace_DmcMain = 0;
798                g_Trace_ChannelScan = 0;
799                g_Trace_bDmcPsiEvent = 0;
800                g_Trace_AppMain = 0;
801                DHL_DBG_SetModuleLevel("AV_P", 0);
802                DHL_DBG_SetModuleLevel("@f_vid", -1);
803                DHL_DBG_SetModuleLevel("@f_aud", -1);
804                DHL_DBG_SetModuleLevel("@f_sim", -1);
805                DHL_DBG_SetModuleLevel("@f_cht", -1);
806                DHL_DBG_SetModuleLevel("@f_pod", 0);
807                DHL_DBG_SetModuleLevel("@f_pwr", 0);
808                DHL_DBG_SetModuleLevel("p_idl", -1);
809                DHL_DBG_SetModuleLevel("GRP_M", -1);
810        }
811#endif
812}
813
814
815
816#if COMMENT
817____Shell_Commands____(){}
818#endif
819
820static DHL_SymbolTable g_AppShellCommands[] =
821{
822        MY_SYM_ENTRY(print_ver, App_PrintLogo),
823
824        MY_SYM_ENTRY(debug, App_SetDebugLevel), /* ¸ðµç debug flag on/off */
825        MY_SYM_ENTRY(key, SimulateRemoconKey),
826        MY_SYM_ENTRY(sigtune,   sigtune),
827
828
829#if 0
830        MY_SYM_ENTRY(autoscan, App_StartAutoScan),
831
832        MY_SYM_ENTRY(drf, App_StartAutoScan),
833        MY_SYM_ENTRY(rf,  App_StartAutoScan),
834        MY_SYM_ENTRY(ch,  App_ChTuneByDigitKey),
835        MY_SYM_ENTRY(stop, App_ChTuneStopTV),
836       
837        MY_SYM_ENTRY(format, App_FormatNvRam),
838        MY_SYM_ENTRY(print_param, App_PrintSysParam),
839
840        MY_SYM_ENTRY(sigtune,   sigtune),
841        MY_SYM_ENTRY(sigstr,    sigstr),
842        MY_SYM_ENTRY(sigreset,  sigreset),
843        MY_SYM_ENTRY(siginit,   siginit),
844       
845        MY_SYM_ENTRY(selfdie,   selfdie),
846       
847        /* CC Test */
848        MY_SYM_ENTRY(ccstart, ccstart),
849        MY_SYM_ENTRY(ccstop, ccstop),
850        MY_SYM_ENTRY(Font_Test, Font_Test),
851        MY_SYM_ENTRY(Screen_Clear, Screen_Clear),
852        MY_SYM_ENTRY(App_ChangeResolution, App_ChangeResolution),
853#endif  /* #if 0 */
854};
855
856
857/******************************************************************************************
858FUNCTION:
859  - App_InitDebug
860
861Purpose:
862  - application debug initialize
863******************************************************************************************/
864void App_InitDebug(void)
865{
866#if 1 // APP_PORTING
867        /* register MW debug symbols */
868        Dmc_RegisterChannelSymbols();                                   /* channeltask/av/tune/scan/util.c */
869        Dmc_RegisterChannelDemuxSymbols();              /* channeldemux.c */
870       
871        DMW_HAL_RegisterChannelHalSymbols();    /* channelhal.c */
872       
873        DMW_CDB_RegisterChannelUcmSymbols();    /* ucm.c */
874        DMW_CDB_RegisterChannelNvRamSymbols();/* channeldb.c nvram.c */
875       
876        DMW_SYS_RegisterTimerSymbols();                         /* systime.c */
877        DMW_RegisterSysTimeSymbols();                                   /* time.c */
878        DMW_RegisterMutexSymbols();                                             /* mutex.c */
879       
880        Dmc_EpgRegisterEpgSymbols();                                    /* epgbase/debug/driver.c */
881        DMW_EPG_RegisterEpgIntfSymbols();                       /* epgintf.c */
882
883        /* App_SetDebugLevel(1); */
884#endif
885
886        /* register App debug symbols */
887        DHL_DBG_RegisterSymbols(g_AppShellCommands, DHL_NUMSYMBOLS(g_AppShellCommands));
888
889}
890
891
892/* end of file */
Note: See TracBrowser for help on using the repository browser.