source: svn/newcon3bcm2_21bu/dst/dmw/src/cc/cc_ddi_nec.c

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

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

  • Property svn:executable set to *
File size: 8.6 KB
Line 
1
2#include "DHL_DBG.h"
3#include "DHL_OSAL.h"
4#include "DHL_OSAL_Config.h"
5
6#include "cc_config.h"
7#include "cc_def.h"
8#include "cc_private.h"
9
10#include "DMW_Dummy.h"
11
12#include <stdarg.h> /* for va_list */
13//#include <string.h>
14
15#define MAX_NUM_PIC_UD_Q CC_NUM_PIC_USER_Q
16#if CC_TRACE_PIC_UD_Q
17int g_total_using_pic_ud = 0;
18#endif
19
20#define IS_FONT_BMF (FONT_ID==FONT_BMF)
21
22static tDCC_PicUDRaw p_ud_buf[MAX_NUM_PIC_UD_Q];
23
24// zooyouny: »ç¿ëµÇ´Â °÷ ¾øÀ½
25// static tDCCDDI_MSGQ p_ud_msgq;
26static int p_ud_buf_wr_idx=0;
27static tDCC_UserCallback p_ud_callback = NULL;
28
29#include "DHL_Graphic.h"
30#include "DHL_AVCAP.h"
31#include "DHL_AVCAP_Priv.h"
32#include "DMG_Draw.h"
33
34#if IS_FONT_JUNGLE
35//.#include "utfAPI.h"
36#elif IS_FONT_MLF
37#include "MLSupport.h"
38#elif IS_FONT_BMF
39#include "BMF.h"
40#endif
41
42
43
44
45#if 0
46__Local_Func__() {}
47#endif
48
49static UINT16 p_remap_char(UINT16 ch)
50{
51        UINT16 ret;
52       
53        switch(ch) {
54                case 0x121:
55                case 0x120:
56                        ret=0x120; break;
57               
58                case 0x125:
59                case 0x12a:
60                case 0x12c:
61                case 0x130:
62                case 0x131:
63                case 0x132:
64                case 0x133:
65                case 0x134:
66                case 0x135:
67                case 0x139:
68                case 0x13a:
69                case 0x13c:
70                case 0x13d:
71                case 0x13f:
72                case 0x176:
73                case 0x177:
74                case 0x178:
75                case 0x179:
76                case 0x17a:
77                case 0x17b:
78                case 0x17c:
79                case 0x17d:
80                case 0x17e:
81                case 0x17f:
82                case 0x1a0:
83                        ret=ch; break;
84               
85                default:
86                        ret=0x20;
87        }
88       
89        return ret;
90}
91
92
93
94//static FILE *p_fd;
95
96
97void *DCCDDI_Malloc(int size)
98{
99        return DHL_OS_Malloc(size);
100}
101
102
103void DCCDDI_Printf(const char *fmt, ...)
104{
105        char buf[512];
106        va_list v;
107
108        va_start(v, fmt);
109
110        vsnprintf(buf, 512, fmt, v);
111
112        va_end(v);
113
114        DHL_OS_Printf("%s", buf);
115}
116
117
118
119void DCCDDI_SpawnTask(void *func)
120{
121        DHL_OS_CreateTask((DHL_OS_TASKFUNCTION)func, "CC", TASK_PRI_DCC_DMX, 16384, 0);
122}
123
124
125tDCCDDI_MSGQ DCCDDI_CreateMessageQueue(char *pname, UINT32 num_msgq, UINT32 size_msgq)
126{
127        return (tDCCDDI_MSGQ)DHL_OS_CreateMessageQueue(pname, 0, num_msgq, size_msgq);
128}
129
130
131tDCCDDI_SEM DCCDDI_CreateMutexSemaphore(char *pname)
132{
133        return (tDCCDDI_SEM)DHL_OS_CreateMutexSemaphore(pname);
134}
135
136
137tDCCDDI_SEM DCCDDI_CreateBinarySemaphore(char *pname)
138{
139        return (tDCCDDI_SEM)DHL_OS_CreateBinarySemaphore(pname, 0, 0);
140}
141
142
143void DCCDDI_SendMessage(tDCCDDI_MSGQ id, void *buf, UINT32 len)
144{
145        DHL_OS_SendMessage((DHL_OS_MSGQ_ID)id, buf);
146}
147
148
149int DCCDDI_ReceiveMessage(tDCCDDI_MSGQ id, void *buf, UINT32 max_len, int *rcv_len)
150{
151        return DHL_OS_ReceiveMessage((DHL_OS_MSGQ_ID)id, buf, DHL_TIMEOUT_FOREVER);
152}
153
154
155int DCCDDI_ReceiveMessage_Wait(tDCCDDI_MSGQ id, void *buf, UINT32 max_len, int *rcv_len, UINT32 msec)
156{
157        return DHL_OS_ReceiveMessage((DHL_OS_MSGQ_ID)id, buf, msec);
158}
159
160int DCCDDI_ReceiveMessage_NoWait(tDCCDDI_MSGQ id, void *buf, UINT32 max_len, int *rcv_len)
161{
162        return DHL_OS_ReceiveMessage((DHL_OS_MSGQ_ID)id, buf, 0);
163}
164
165
166void DCCDDI_TakeSemaphore(tDCCDDI_SEM id)
167{
168        DHL_OS_TakeSemaphore((DHL_OS_SEMA_ID)id, DHL_TIMEOUT_FOREVER);
169}
170
171void DCCDDI_GiveSemaphore(tDCCDDI_SEM id)
172{
173        DHL_OS_GiveSemaphore((DHL_OS_SEMA_ID)id);
174}
175
176void DCCDDI_Delay(UINT32 msec)
177{
178        DHL_OS_Delay(msec);
179}
180
181UINT32 DCCDDI_GetCurMs()
182{
183        return DHL_OS_GetMsCount();
184}
185
186
187
188#if 0
189__Picture_User_Data__() {}
190#endif
191
192static void p_user_data(MMAC_VIDEO_USER_DATA* pUd, MMAC_VIDEO_PICTURE_INFO* pPic)
193{
194#if 0
195        // zooyouny Å×½ºÆ®¿ë Àӽà ÄÚµå..
196        // todo »ç¿ë·® traceÇÏ´Â ÄÚµå ³ÖÀ» °Í
197        DHL_ASSERT(p_ud_buf[p_ud_buf_wr_idx].pic_type == 0, "!!ud_buf is overflow.. \n");
198#else
199        if(p_ud_buf[p_ud_buf_wr_idx].isUsing != 0)
200        {
201                CCPRINT("error", "!! ud_buf is overflow.. \n");
202                return ;
203        }
204        p_ud_buf[p_ud_buf_wr_idx].isUsing = 1;
205        #if CC_TRACE_PIC_UD_Q
206        g_total_using_pic_ud++;
207        CCPRINT("ddi", "max pic userdata: %d, cur used pic userdata: %d\n", MAX_NUM_PIC_UD_Q, g_total_using_pic_ud);
208        #endif
209#endif
210               
211        memcpy(p_ud_buf[p_ud_buf_wr_idx].data, pUd->userDataBuffer, pUd->userDataSize);
212        p_ud_buf[p_ud_buf_wr_idx].size = pUd->userDataSize;
213
214        p_ud_buf[p_ud_buf_wr_idx].pic_type = pPic->pictureCodingType;
215       
216        if(p_ud_callback) 
217                p_ud_callback(&p_ud_buf[p_ud_buf_wr_idx]);
218               
219        if(++p_ud_buf_wr_idx>=MAX_NUM_PIC_UD_Q) 
220                p_ud_buf_wr_idx=0;
221
222}
223
224
225void DCCDDI_SetUserCallback(tDCC_UserCallback func)
226{
227        p_ud_callback=func;
228}
229
230
231// zooyouny: »ç¿ëµÇ´Â °÷ ¾øÀ½
232#if 0
233tDCC_PicUDRaw *DCCDDI_GetUserData()
234{
235        int err;
236        int rcv_len;
237        int idx;
238       
239        err=DCCDDI_ReceiveMessage_Wait(p_ud_msgq, &idx, sizeof(idx), &rcv_len, 10);
240       
241        if(err) return NULL;
242               
243        return &p_ud_buf[idx];
244}
245#endif
246
247int DCCDDI_Feeding608(BOOL is_even, UINT8 data1, UINT8 data2)
248{
249        return 0;
250}
251
252
253#if 0
254__Graphic__() {}
255#endif
256
257
258
259void DCCDDI_GraphicStart(UINT8 resolution)
260{
261        //DMG_SetFont(eDMG_FONT_BMF); //Ç×»ó BMF¸¸ »ç¿ëÇÔ
262}
263
264void DCCDDI_GraphicStop()
265{
266        //DMG_SetFont(eDMG_FONT_BMF); //Ç×»ó BMF¸¸ »ç¿ëÇÔ
267}
268
269void DCCDDI_DrawBox(int x, int y, int w, int h, int color)
270{
271        CCPRINT("ddi", "DCCDDI_DrawBox(%d,%d,%d,%d,%d)\n", x, y, w, h, color);
272       
273        if(w<=0 || h<=0) return;
274
275        DMG_EraseRect(x, y, w, h, color);
276}
277
278//height°¡ -À̸é up, +À̸é down
279void DCCDDI_BLT(int x, int y, int w, int h, int height)
280{
281        tDHL_GrpRect r1, r2;
282
283        CCPRINT("ddi", "DCCDDI_BLT(%d,%d,%d,%d,%d)\n", x, y, w, h, height);
284       
285        if(height==0 || h==0) return;
286       
287        DHL_FILLRECT(&r1, x, y, w, h);
288        DHL_FILLRECT(&r2, x, y+height, w, h);
289       
290        DMG_BLT(CC_PLANE, CC_TEMP_PLANE, &r1, &r1);
291        DMG_BLT(CC_TEMP_PLANE, CC_PLANE, &r1, &r2);
292}
293
294void DCCDDI_DrawHLine(int x, int y, int w, int color)
295{
296        if(w<=0) return;
297
298        DMG_DrawHLine(x, y, w, color);
299}
300
301
302void DCCDDI_Refresh()
303{
304
305}
306
307
308#if 0
309__Font__() {}
310#endif
311
312#define USE_MARGINE 0
313
314#if IS_FONT_JUNGLE
315//static UT_FC p_reg_fc;
316#elif IS_FONT_MLF
317static RML_FC p_reg_fc;
318#elif IS_FONT_BMF
319static BMF_FC p_reg_fc;
320#endif
321
322
323static struct {
324        int size;
325        BOOL is_italic;
326        BOOL is_underline;
327        BOOL is_unicode; //2byte. ÇѱÛÀÎ °æ¿ì unicode/¿Ï¼ºÇü Áß ¾î´À °ÍÀÎÁö..
328        BOOL is_p16; 
329        int font_style;
330        int edge_type;
331} p_font_attr;
332
333
334
335#define USE_FONT_CACHE 0
336        //font cache¸¦ »ç¿ëÇÔ.
337       
338#define CH_BLANK 0x20
339#define MAX_CH_W (p_font_attr.size*8/10)
340        //neverdai analog cc¿¡¸¸ »ç¿ëÇÔ.
341
342#if IS_FONT_JUNGLE
343
344
345#if USE_FONT_CACHE
346
347#define IMG_CACHE_SIZE 128
348
349static struct {
350        UINT16 ch;
351       
352        SINT8 x;
353        SINT8 y;
354        SINT8 w;
355        SINT8 h;
356        SINT8 pitch;
357       
358        UINT8 buf[512]; //ÃÖ´ë 45»çÀÌÁî ±ÛÀÚ±îÁö ÀúÀåÇÒ ¼ö ÀÖÀ½.
359} p_ut_img_cache[IMG_CACHE_SIZE];//¾à 6.5K Á¤µµ
360
361static int p_cache_idx;
362
363#endif // USE_FONT_CACHE
364
365#endif /* IS_FONT_JUNGLE */
366
367
368
369
370int DCCDDI_PrintCh(int x, int y, UINT16 ch, int c_font, int c_edge)
371{
372        tDMG_FontAttr attr;
373        int width;
374       
375        if(!p_font_attr.is_unicode) {
376                //¿Ï¼ºÇüÀ» unicode·Î º¯°æÇÔ.                   
377                ch=DCCUtil_Ksx1001toUnicode(ch);
378                CCPRINT("ddi", "convert to ksx1001(0x%x)\n", ch);
379        }
380       
381        DMG_GetFontAttr(&attr);
382        attr.c_edge=c_edge;
383        DMG_SetFontAttr(&attr);
384       
385        width=DMG_PrintCh(x, y, ch, c_font);
386
387        DHL_PostDraw(CC_PLANE, x, y, width, DMG_GetChHeight(ch));
388       
389        return width;
390}
391
392
393int DCCDDI_GetChWidth(UINT16 ch)
394{
395        if(!p_font_attr.is_unicode) {
396                //¿Ï¼ºÇüÀ» unicode·Î º¯°æÇÔ.                   
397                CCPRINT("ddi_ch", "convert to ksx1001(0x%x->0x%x)\n", ch, DCCUtil_Ksx1001toUnicode(ch));
398                ch=DCCUtil_Ksx1001toUnicode(ch);
399        }
400       
401        return DMG_GetChWidth(ch);
402}
403
404
405int DCCDDI_GetChHeight(UINT16 ch)
406{
407        if(!p_font_attr.is_unicode) {
408                //¿Ï¼ºÇüÀ» unicode·Î º¯°æÇÔ.                   
409                CCPRINT("ddi_ch", "convert to ksx1001(0x%x)\n", ch);
410                ch=DCCUtil_Ksx1001toUnicode(ch);
411        }
412       
413        return DMG_GetChHeight(ch);
414}
415
416
417void DCCDDI_SetFontAttr(int size, BOOL is_italic, BOOL is_underline, UINT8 font_style, 
418        UINT8 edge_type, BOOL is_p16)
419{
420        tDMG_FontAttr attr;
421       
422        DMG_GetFontAttr(&attr);
423       
424        attr.size=size;
425        attr.is_italic=is_italic;
426        attr.is_underline=is_underline;
427       
428        if(is_p16) {
429                attr.font_style=eDMG_FS_KOREAN;
430        }
431        else {
432                attr.font_style=(tDMG_FontStyle)font_style;
433        }
434       
435        attr.edge_type=(tDMG_EdgeType)edge_type;
436       
437        DMG_SetFontAttr(&attr);
438       
439}
440
441
442#if 0
443__Init__() {}
444#endif
445
446
447void DCCDDI_Init()
448{
449// zooyouny: »ç¿ëµÇ´Â °÷ ¾øÀ½
450//      p_ud_msgq=DCCDDI_CreateMessageQueue("udmsgq", MAX_NUM_PIC_UD_Q, sizeof(int));
451       
452#if IS_FONT_JUNGLE
453                //ut_InitFontContext(&p_reg_fc, 0, 0);
454#elif IS_FONT_MLF
455        RML_InitFontContext(&p_reg_fc, 0, 0);
456#elif IS_FONT_BMF
457        BMF_InitFontContext(&p_reg_fc, 0, 0);
458#endif
459        memset(p_ud_buf, 0, sizeof(tDCC_PicUDRaw) * MAX_NUM_PIC_UD_Q);
460
461        /* user data callback ¼³Á¤ */
462        dhl_set_userdata_callback(p_user_data);
463}
464
465void DCCDDI_SetKoreanMode(BOOL is_unicode)
466{
467        //unicode¸¦ ¾µ °ÍÀÎÁö.
468        p_font_attr.is_unicode=is_unicode;
469}
470
471
472#if 0
473___Debug___()
474#endif
475
476void cc_ddi_info()
477{
478
479}
480
Note: See TracBrowser for help on using the repository browser.