source: svn/zas_dstar/hal/common/dsthaldebug.c @ 76

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

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

File size: 4.8 KB
Line 
1/****************************************************************************
2 *-Copyright (c) 2004 DST Technologies Inc.  All Rights Reserved.
3 *
4 * Module:      dsthaldebug.c
5 *
6 * Description: DST HAL Debug Routines
7 *             
8 *
9 * notes: 20040609hwatk
10 *
11 ***************************************************************************/
12
13#include <stdio.h>
14#include <stdarg.h> 
15#include "dsthalcommon.h"
16#include <string.h>
17
18#ifdef DMALLOC
19#include <dmalloc.h>
20#endif
21
22#define DELAY(x)        usleep((x)*1000)
23
24/****************************************************************************
25
26        gDbgLevel
27                0 : Print-out level 0.
28                1 : Print-out level 1 & level 0
29                2 : Print-out all debug messaged.
30       
31        gDbgMsgLevel
32                0 : Print-out only messages.
33                1 : Print-out function name and messages.
34                2 : Print-out component name and function name and messages.
35
36        bmDbg
37                DHLDBG_AV   : Enable AV debugging.
38                DHLDBG_FE   : Enable FE debugging.
39                DHLDBG_DEV  : Enable DEV debugging.
40                DHLDBG_COMM : Enable COMM debugging.
41                DHLDBG_ALL  : Enable all DHL component debugging.
42
43 ***************************************************************************/
44DS_U32 gDbgLevel = 3;
45DS_U32 gDbgMsgLevel = 2;
46DS_U32 bmDbg = DHLDBG_ALL;
47
48/****************************************************************************
49
50        DHL_DbgPrintf
51                - Summary : Debug printf for DHL
52                - Arguments
53                        print-out only if ( Level < gDbgLevel ).
54
55 ***************************************************************************/
56void DHL_DBGPRINTF(const char *Function, DS_U32 Level, DS_U32 bmDbgComponent, char *Format, ...)
57{
58        va_list va;
59        DS_S8 MsgBuf[256];
60       
61        if ( gDbgLevel <= Level )
62                return;
63
64        if ( (bmDbgComponent & bmDbg) == 0 )
65                return;
66        //jfet_20051026 |add for debug
67       
68        switch ( gDbgMsgLevel ) {
69                case 3:
70                        printf("%ld ", OS_GetTickCount());
71
72                case 2:
73                        {
74                                switch( bmDbgComponent ) {
75                                        case DHLDBG_SYS:        printf("dhl_sy|");              break;
76                                        case DHLDBG_DMX:        printf("dhl_dx|");              break;                                 
77                                        case DHLDBG_DTV:        printf("dhldtv|");              break;
78                                        case DHLDBG_FE:         printf("dhl_fe|");              break;
79                                        case DHLDBG_DEV:        printf("dhl_dv|");              break;
80                                        case DHLDBG_COMM:       printf("dhl_cm|");              break;
81                                        case DHLDBG_CAP:        printf("dhlcap|");              break;
82                                        case DHLDBG_CA:         printf("dhl_ca|");              break;                                 
83                                        case DHLDBG_IR:         printf("dhl_ir|");              break;                                 
84                                        case DHLDBG_MVS:        printf("dhl_mv|");              break;
85                                        case DDDBG_SYS:         printf("dd_sys|");              break;
86                                        case DDDBG_DMX:         printf("dd_dmx|");              break;
87                                        case DDDBG_V:           printf("dd_vid|");              break;
88                                        case DDDBG_A:           printf("dd_aud|");              break;
89                                        case DDDBG_CAP:         printf("dd_cap|");              break;
90                                        case DDDBG_CC:          printf("dd__cc|");              break;
91                                        case DDDBG_G:           printf("dd_grp|");              break;                                 
92                                        case DDDBG_IR:          printf("dd__ir|");              break;                                 
93                                        case DHLDBG_AUD:        printf("dhlaud|");              break;
94                                        case DDDBG_MVS:         printf("dd_mvs|");              break;                                                                                                                 
95                                        case DHLDBG_GFX:        printf("dhl_gf|");              break;
96                                        case DDDBG_GFX:         printf("dd_gfx|");              break;
97                                        case DHLDBG_PSI:        printf("dhlpsi|");              break;
98                                        case DDDBG_COMM:        printf("dd_com|");              break;
99                                        case DDDBG_FE:          printf("dd_fe |");              break;
100                                        case DDDBG_PSI:         printf("dd_psi|");              break;
101                                        case DHLDBG_EXT:        printf("extdev|");              break;
102                                }
103                        }
104                case 1:
105                        {
106                                printf(" %s| ",Function);
107                        }
108                        break;
109        }
110       
111       
112    va_start (va, Format);
113    vsprintf ((DS_S8 *)MsgBuf, Format, va);
114    va_end (va);
115
116        printf( MsgBuf );
117}
118
119void DHL_SetDbgLevel( DS_U32 Level )
120{
121        if ( Level > 3 ) 
122                return;
123               
124        gDbgLevel = Level;
125}
126
127void DHL_SetDbgMsgLevel( DS_U32 MsgLevel )
128{
129        if ( MsgLevel > 3 ) 
130                return;
131       
132        gDbgMsgLevel = MsgLevel;
133}
134
135void DHL_SetDbgComponent( DS_U32 bmDbgComponent )
136{
137        bmDbg |= bmDbgComponent;
138}
139
140void DHL_ClrDbgComponent( DS_U32 bmDbgComponent )
141{
142        bmDbg &= ~bmDbgComponent;
143}
144
145void DHL_DbgStatus(void)
146{
147        printf("Current Debug Level = %lx.\n", gDbgLevel);
148        printf("Current Debug Message Level = %lx\n.", gDbgMsgLevel);
149        printf("Current Enabled Component\n");
150        if ( bmDbg & DHLDBG_DTV ) printf("\tDHL_AV Enabled\n");
151        if ( bmDbg & DHLDBG_FE ) printf("\tDHL_FE Enabled\n");
152        if ( bmDbg & DHLDBG_DEV ) printf("\tDHL_DEV Enabled\n");
153        if ( bmDbg & DHLDBG_COMM ) printf("\tDHL_COMM Enabled\n");
154}
155
156static int *MemoryTestPtr;
157DHL_RESULT MemoryTest(DS_U32 Size)
158{
159        int i;
160       
161        printf("*** Memory Test - Size = 0x%08lX\n", Size);
162        for (i=0; i<(Size/sizeof(DS_U32)); i++) {
163                if ( MemoryTestPtr[i] != 0x5A5A5A5A )
164                        printf("Invalid data! ptr[%d] = 0x%08lX\n", i, (DS_U32)MemoryTestPtr[i]);
165        }
166                               
167        return DHL_OK;
168}
169
170void InvalidateMemory(DS_U32 addr, int pattern)
171{
172        DS_U32 *ptr;
173       
174        ptr = (DS_U32 *)addr;
175        printf("*** MemoryTestPtr[0x%08lX] = %08lX\n", addr, (DS_U32)pattern);
176        *ptr = (DS_U32)pattern;
177}
178
179void DumpMemory(DS_U32 addr)
180{
181        int i;
182        DS_U32 *ptr;
183
184        ptr = (DS_U32 *)addr;   
185        printf("0x%08lX: ", addr);
186        for (i=0; i<8; i++) {
187                printf("0x%08lX ", ptr[i]);
188        }
189        printf("\n");
190}
Note: See TracBrowser for help on using the repository browser.