source: svn/newcon3bcm2_21bu/nexus/app/dta/main.c @ 22

Last change on this file since 22 was 22, checked in by phkim, 11 years ago
  1. phkim
  2. newcon3sk 를 kctv 로 브랜치 함
  • Property svn:executable set to *
File size: 8.4 KB
Line 
1/***************************************************************
2**
3**  Broadcom Corp. Confidential
4**  Copyright 1998-2000 Broadcom Corp.  All Rights Reserved.
5**
6**  THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED
7**  SOFTWARE LICENSE AGREEMENT  BETWEEN THE USER AND BROADCOM. 
8**  YOU HAVE NO RIGHT TO USE OR EXPLOIT THIS MATERIAL EXCEPT
9**  SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
10**
11**  File:         main.c
12**  Description:  main entry point
13**  Created:      04/18/02 Jeffrey P. Fisher     
14**
15****************************************************************/
16#define BDISPATCH_BYPASS
17#include "bsettop_decode.h"
18#include "bsettop_tuner.h"
19#include "fstore.h"
20#ifdef GFX_DEBUG
21#include "bsettop_gfx.h"
22#endif
23#ifndef CONFIG_HAS_STREAM
24#undef BDISPATCH_BYPASS
25#endif
26#include "bsettop_stream.h"
27#include "bsettop_message.h"
28#undef BDISPATCH_BYPASS
29#include "ministd.h"
30#include "bstd.h"
31#include "bsettop.h"
32#include "cache_util.h"
33#include "ts_psi.h"
34#include "ts_pat.h"
35#include "ts_pmt.h"
36#include "psip_mgt.h"
37#include "psip_stt.h"
38
39#if MINISTD_RAM
40#include "bint.h"
41#endif
42#if PROFILE
43#include "bkni.h"
44#include "bprofile.h"
45#endif
46
47#include "bsettop_gfx.h"
48#ifdef CONFIG_DTA_CABLE
49#include "bapp.h"
50#else
51#include "bapp.h"
52#endif
53#include "bpwr.h"
54
55BDBG_MODULE(ram);
56#ifdef CONFIG_FSTORE
57static const bfstore_t  s_fstore = 
58{
59        fstore_init,
60        fstore_update,
61        fstore_get
62};
63#endif
64
65#ifdef GFX_DEBUG
66static const bgfx_api_t s_bgfx = 
67{
68        bgfx_init,
69        bgfx_done,
70        bgfx_create,
71        bgfx_destroy,
72        bgfx_get_info,
73        bgfx_get_palette,
74        bgfx_set_palette,
75        bgfx_set_pixel,
76        bgfx_get_pixel,
77        bgfx_h_draw_line,
78        bgfx_v_draw_line,
79        bgfx_fill_rect,
80        bgfx_draw_text,
81        bgfx_draw_text_box,
82        bgfx_render_file,
83        bgfx_blit,
84        bgfx_blit_rect,
85        bgfx_free_font,
86        bgfx_get_glyph,
87        bgfx_string_info,
88        bgfx_load_font,
89};
90#endif
91
92#ifdef CONFIG_HAS_STREAM
93static const bmessage_api s_bmessage_api =
94{
95        bmessage_init,
96        bmessage_uninit,
97        bmessage_open,
98        bmessage_stream_params_init,
99        bmessage_start,
100        bmessage_get_buffer,
101        bmessage_read_complete,
102        bmessage_stop,
103        bmessage_close
104};
105static const bstream_api s_stream_api =
106{
107        bstream_mpeg_init,
108        bstream_open,
109        bstream_close,
110        bstreamer_attach,
111        bstream_get_status,
112        bstream_get_config,
113        bstream_set_config,
114        bstream_callback
115};
116#endif
117
118#ifdef CONFIG_HAS_MVPI
119const bdecode_api_t g_bdecode_api =
120{
121        bdecode_open,
122        bdecode_close,
123        bdecode_start,
124        bdecode_stop,
125        bdecode_get_status,
126        bdecode_set_config,
127        bdecode_get_config
128};
129
130#endif
131
132#if !defined(CONFIG_COMPRESSED_DECODER_FW)
133extern unsigned short BMVD_P_MTPMV_DataRamImage[];
134extern unsigned short BMVD_P_MTPMV_CodeRamImage[];
135#if (BCHP_CHIP == 3543) || (BCHP_CHIP == 3560)
136extern unsigned short BMVD_P_MTPT_DataRamImage[];
137extern unsigned short BMVD_P_MTPT_CodeRamImage[];
138#endif
139#endif
140
141#if (CONFIG_HAS_AUDIO == 2)
142extern const baudio_decode_api g_baudio_decode_api;
143#endif
144#if MINISTD_RAM
145extern const bint_t     g_bint_api;
146extern const bministd_t g_ministd_api;
147extern const bpcm_t g_bpcm_api;
148#endif
149
150#ifdef CONFIG_HAS_TUNER
151static btuner_api_t s_btuner_api =
152{
153        btuner_open,
154        btuner_close,
155        btuner_ds_params_init,
156        btuner_tune_ds,
157        btuner_get_ds_status
158};
159
160#if !defined(CONFIG_COMPRESSED_VSB_FW)
161#if (BCHP_CHIP == 3543)
162extern uint8_t vsb_acq[];
163extern uint16_t scr_table[];
164extern uint8_t vsb_config[];
165#endif
166#endif
167
168#endif
169
170
171/* Extern font arrays and sizes */
172#ifdef CONFIG_FONTS_RAM
173extern const unsigned int g_FrancophilB_22_mono_size;
174extern const unsigned int g_FrancophilB_28_mono_size;
175extern const unsigned int g_FrancophilB_40_mono_size;
176extern const unsigned char g_FrancophilB_22_mono[];
177extern const unsigned char g_FrancophilB_28_mono[];
178extern const unsigned char g_FrancophilB_40_mono[];
179#ifdef  CONFIG_CHINESE_FONTS_RAM
180extern const unsigned int g_HDZB_75_16_mono_size;
181extern const unsigned char g_HDZB_75_16_mono[];
182extern const unsigned int g_HDZB_75_24_mono_size;
183extern const unsigned char g_HDZB_75_24_mono[];
184extern const unsigned int g_HDZB_75_28_mono_size;
185extern const unsigned char g_HDZB_75_28_mono[];
186#endif
187#endif
188
189extern unsigned int _fbss;
190extern unsigned int _end;
191extern void fupdate(void);
192
193/******************************************************************************
194* void ram_start(void)
195*
196* INPUTS:    none
197* OUTPUTS:    none.
198* RETURNS:    none
199* FUNCTION: Main C program entry point
200******************************************************************************/
201void ram_start(void) 
202{
203#if !defined(RAM_BUILD)
204        unsigned int *ptr = &_fbss;
205#endif
206        static bapp_t app; /* Declare static so it it is not on the stack */
207#if !defined(RAM_BUILD)
208        while (ptr != (unsigned int*)&_end)
209        {
210                *ptr = 0;
211                ptr++;
212        }
213#endif
214        printf("CONFIG0 = 0x%08x\n",bcm_read_cp0($16,0));
215        printf("BCMCONFIG0 = 0x%08x\n",bcm_read_cp0($22,0));
216        /* patch these performance critical functions */
217#if BDBG_DEBUG_BUILD
218#warning "***Debug Build***"
219        BDBG_Init();
220        BDBG_SetLevel(BDBG_eWrn);
221#endif
222{
223    unsigned int memory_size;
224    memory_size = bos_ram_size();
225    if(MEMORY_SIZE > memory_size){
226        BDBG_ERR(("Not enough memory to run software."));
227        while(1) bos_sleep(1000);
228    }
229}
230#if CONFIG_SYMTABLE
231#warning "*** SYMTABLE BUILD***"
232        bsymtable_init();
233#endif
234
235#if MINISTD_RAM
236#warning "***MINISTD RAM BUILD***"
237        console_shutdown();
238        memcpy(&g_p_dsp->ministd, &g_ministd_api, sizeof(g_ministd_api));
239        memcpy(&g_p_dsp->bpcm, &g_bpcm_api, sizeof(g_bpcm_api));
240        memcpy(&g_p_dsp->bint, &g_bint_api, sizeof(g_bint_api));
241        bint_init();
242#undef flush_dcache_all
243#undef flush_dcache
244        g_p_dsp->cache.dflush_all = flush_dcache_all;
245        g_p_dsp->cache.dflush = flush_dcache;
246        console_init(CONSOLE_UART);
247#endif
248#ifdef GFX_DEBUG
249#warning "***GFX_DEBUG RAM BUILD***"
250        memcpy(&g_p_dsp->bgfx, &s_bgfx, sizeof(bgfx_api_t));
251#endif
252
253#ifdef CONFIG_HAS_STREAM
254#warning "***BSTREAM RAM BUILD***"
255        memcpy(&g_p_dsp->bstream, &s_stream_api, sizeof(s_stream_api));
256        memcpy(&g_p_dsp->bmessage, &s_bmessage_api, sizeof(s_bmessage_api));
257#ifdef CONFIG_ENABLE_PSIS
258        smessage_install_dispatch();
259#endif
260#endif
261#ifdef CONFIG_HAS_MVPI
262#warning "***MVPI RAM BUILD***"
263        memcpy(&g_p_dsp->bdecode, &g_bdecode_api, sizeof(g_bdecode_api));
264#endif
265#if !defined(CONFIG_COMPRESSED_DECODER_FW)
266#warning "***DECODER FW RAM BUILD***"
267        g_p_dsp->video_firmware.MTPMV_DataRamImage = BMVD_P_MTPMV_DataRamImage;
268        g_p_dsp->video_firmware.MTPMV_CodeRamImage = BMVD_P_MTPMV_CodeRamImage;
269#if (BCHP_CHIP == 3543) || (BCHP_CHIP == 3560)
270        g_p_dsp->video_firmware.MTPT_DataRamImage = BMVD_P_MTPT_DataRamImage;
271        g_p_dsp->video_firmware.MTPT_CodeRamImage = BMVD_P_MTPT_CodeRamImage;
272#endif
273#endif
274#if (CONFIG_HAS_AUDIO == 2)
275#warning "***AUDIO RAM BUILD***"
276        memcpy(&g_p_dsp->baudio_decode, &g_baudio_decode_api, sizeof(g_baudio_decode_api));
277#endif
278#ifdef CONFIG_FSTORE
279#warning "***FSTORE RAM BUILD***"
280        memcpy(&g_p_dsp->fstore, &s_fstore, sizeof(bfstore_t));
281#endif
282#ifdef CONFIG_HAS_TUNER
283#warning "***TUNER RAM BUILD***"
284        memcpy(&g_p_dsp->btuner,&s_btuner_api,sizeof(s_btuner_api));
285#if !defined(CONFIG_COMPRESSED_VSB_FW)
286#warning "***VSB FW RAM BUILD***"
287#if (BCHP_CHIP == 3543)
288        g_p_dsp->vsb_firmware.vsb_acq_fw = vsb_acq;
289        g_p_dsp->vsb_firmware.scr_table_fw = scr_table;
290        g_p_dsp->vsb_firmware.vsb_config_fw = vsb_config;
291#endif
292#endif
293#endif
294
295#ifdef CONFIG_FSTORE
296#warning "***FSTORE RAM BUILD***"
297        memcpy(&g_p_dsp->fstore, &s_fstore, sizeof(bfstore_t));
298#endif
299
300#ifdef CONFIG_FONTS_RAM
301#warning "***FONTS RAM BUILD***"
302#ifdef  CONFIG_CHINESE_FONTS_RAM
303        g_p_dsp->ui_comp.small_font = (unsigned char*)g_HDZB_75_16_mono;
304        g_p_dsp->ui_comp.small_font_size = (unsigned int)g_HDZB_75_16_mono_size;
305        g_p_dsp->ui_comp.medium_font = (unsigned char*)g_HDZB_75_24_mono;
306        g_p_dsp->ui_comp.medium_font_size = (unsigned int)g_HDZB_75_24_mono_size;
307#ifndef CONFIG_DTA_CABLE
308        g_p_dsp->ui_comp.large_font = (unsigned char*)g_HDZB_75_28_mono;
309        g_p_dsp->ui_comp.large_font_size = (unsigned int)g_HDZB_75_28_mono_size;
310#endif
311#else
312        g_p_dsp->ui_comp.small_font = (unsigned char*)g_FrancophilB_22_mono;
313        g_p_dsp->ui_comp.small_font_size = (unsigned int)g_FrancophilB_22_mono_size;
314        g_p_dsp->ui_comp.medium_font = (unsigned char*)g_FrancophilB_28_mono;
315        g_p_dsp->ui_comp.medium_font_size = (unsigned int)g_FrancophilB_28_mono_size;
316#ifndef CONFIG_DTA_CABLE
317        g_p_dsp->ui_comp.large_font = (unsigned char*)g_FrancophilB_40_mono;
318        g_p_dsp->ui_comp.large_font_size = (unsigned int)g_FrancophilB_40_mono_size;
319#endif
320#endif
321#endif
322
323        if ((ReadReg32(BUTTON_DATA_REG) & CH_UP_BUTTON_MASK) == CH_UP_BUTTON_MASK)
324        {
325                fupdate();
326        }
327        b_pwr_configure_chip();
328        bapp_init(&app);
329        bapp_run(&app);
330}
Note: See TracBrowser for help on using the repository browser.