main.c
上传用户:super_houu
上传日期:2008-09-21
资源大小:4099k
文件大小:9k
- /* **************************************************************************************
- * Copyright (c) 2002 ZORAN Corporation, All Rights Reserved
- * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
- *
- * File: $Workfile: main.c $
- *
- * Description:
- * ============
- * program main
- *
- * Log:
- * ====
- * $Revision: 30 $
- * Last Modified by $Author: Johnk $ at $Modtime: 3/25/04 10:17p $
- ****************************************************************************************
- * Updates:
- ****************************************************************************************
- * $Log: /I76/I76_Common/I76_Reference/Main/main.c $
- *
- * 31 Jan.13,2005 15:25p JerryLin
- * Added I86_CHIP and I86_ADP_APOOGE_WDT specific
- *
- * 30 3/25/04 11:33p Johnk
- * merged the latest code for S1
- *
- * 29 3/22/04 8:20p Rond
- * added debug option for cache
- *
- * 28 3/01/04 6:27p Lotan
- * merge with Divx certification DB
- *
- * 27 2/27/04 5:19p Johnk
- * Merged the latest S1 changes
- *
- * 26 2/20/04 6:07p Glenl
- * Removed customer specific include path
- *
- * 25 2/03/04 3:45p Einavz
- * add support for checking main stack size
- *
- * 24 1/15/04 14:19 Hamadk
- * Added I77 power up
- *
- * 23 1/13/04 12:11 Hamadk
- * Merged with CES DB
- *
- * 22 11/15/03 7:08p Leslie
- * Replace old Video API Low Level Files with new ones
- *
- * 20 6/29/03 3:14p Rinata
- * replace "fp_set_display_type(VFD_FUTABA_STD);" with
- * "fp_set_display_type(Model_Macro.VFDType);" in order to be able to use
- * different front panel options.
- *
- * 19 03-05-29 18:17 Jerryc
- * support flash card
- *
- * 18 5/15/03 4:41p Rinata
- * Select VFD acording to player configuration
- *
- * 17 4/03/03 9:06p Hamadk
- * Added support for power off default state
- *
- * 16 2/27/03 9:50a Tomasp
- *
- * 15 2/26/03 9:46p Tomasp
- * Synchronization with ZCH database
- *
- * 15 03-02-24 14:27 Hannahh
- * Replace printf to debug
- *
- * 14 2/17/03 6:39p Rinata
- * add dac ak4356
- *
- * 13 2/10/03 6:45p Rinata
- * add front panel test
- *
- * 12 2/02/03 11:43a Tomasp
- * In aux mode do not run drive task.
- *
- * 11 1/23/03 4:27a Rinata
- * Change Dacs API name and add more Dacs support
- *
- * 10 1/07/03 4:46a Yarone
- * Added STEP B code
- *
- * 9 11/07/02 15:40 Yarone
- * change of version size
- *
- * 11 23/04/02 9:28 Nirm
- * - Added dependency in "Config.h".
- *
- * 10 2/18/02 14:58 Rinata
- * prepare low level directory
- *
- * 9 2/17/02 15:59 Rinata
- * remove code and files under not define I49_STEPA0
- *
- * 8 1/31/02 4:19a Tomasp
- * Code cleanup
- *
- * 7 19/01/02 13:02 Atai
- * Change error debug printing
- *
- * 6 1/15/02 2:33p Tomasp
- * - added include <embedded.h> file for enable(), original function from
- * rtos.c was renamed
- *
- * 5 10/01/02 18:37 Nirm
- * Corrected Include-Paths;
- * Moved Debug code under #ifdef _DEBUG.
- *
- * 4 2/01/02 20:16 Nirm
- * Corrected paths of included header-files.
- *
- * 3 12/26/01 16:52 Rinata
- *
- * 2 25/12/01 12:45 Atai
- * Code cleaning
- **************************************************************************************** */
- #include "Config.h" // Global Configuration - do not remove!
- #include <embedded.h>
- #include "IncludeSysDefs.h"
- #include "CPUV186tserio.h"
- #include "Kerneleventdef.h"
- #include "Kernelker_api.h"
- #include "KerneluITRONrtos.h"
- #include "MainMain.h"
- #include "PlaycoreTimingtiming.h"
- #include "Version.h"
- #ifdef I86_ADP_APOOGE_WDT
- #include "Decoderdecoder.h"
- #endif
- #ifdef _DEBUG
- #include "Debugdbgmain.h"
- #endif //_DEBUG
- #include "Decoderlow_levelDEC_LL_EnCoderAPI.h"
- #include "DriveDrv_API.h"
- #include "Customerdevicedacaudio_dac.h"
- #include "CustomerLib_SetupLib_Setup.h"
- #include "PlaycoreCoremainCoreNVG.h"
- #ifdef SUPPORT_FLASH_CARD
- #include "DriveFE_Manager.h"
- #endif
- #ifdef I77_COMPANION_CHIP
- #include "HDMIMonitorDetection.h"
- #ifdef EXINO2 //ZKR JK0320 : add
- #include "i77_io_hal.h"
- #else
- #include "Customer/Mercury_Reference/i77_io_hal.h"
- #endif
- #endif
- #ifdef AVI_DRM_SUPPORT
- extern void aviDrmGetHardwareKey(void);
- #endif
- extern int unsigned long gen_timer ( void );
- #ifdef I86_CHIP
- extern void I86_HAL_Init(void);
- #else
- extern void HAL_Init(void);
- #endif
- extern InitInterruptVectorTable (void);
- #if AUX_IN_ENABLE
- extern UINT8 g_bIsAuxModeOn;
- #endif
- #ifdef CHECK_STACK_SIZE
- extern UINT16 iMainStackSegment;
- #endif //CHECK_STACK_SIZE
- #ifdef _DEBUG
- typedef struct
- {
- UINT16 wAddress;
- UINT16 wData;
- } CBUS_PARAMETER;
- extern CONST CBUS_PARAMETER CBus_Start_Param[];
- #endif
- #ifdef FP_TESTING_ON_POWER_UP
- void enable_fp_test(void);
- #endif
- //Function to set the fp display from fp_lut.c- Onur
- void fp_set_display_type(BYTE fpdType);
- void main(void)
- {
- _disable();
- #ifdef _DEBUG
- // Download CBUS table in debug mode.
- // In release mode the table is downloaded by bootrom code
- {
- CONST CBUS_PARAMETER *wParam = CBus_Start_Param;
- while (wParam->wAddress != 0xFFFF)
- {
- #ifdef PDROM_EXTERNAL_SRAM
- if(0x0a2c == wParam->wAddress)
- //outport (wParam->wAddress,0x802F);
- outport (wParam->wAddress,0x800F);
- // 0x0a2c is XMI config register, we have to add byte access and uncache control
- // so modify cbus table value 0x0020 to 0x802F
- // hansj
- else
- ;// outport (wParam->wAddress,wParam->wData);
- wParam++;
- #else
- outport (wParam->wAddress,wParam->wData);
- wParam++;
- #endif
- }
- }
- #ifdef PDROM_EXTERNAL_SRAM
- //sram cs0 hansj 09/01/05
- outport(0x0a04,0x0); //XMIT00 reg
- outport(0x0a06,0x2); //XMITr10 reg
- outport(0x0a08,0x1); //XMITw10 reg
- outport(0x0a0a,0x1); //XMIT20 reg
- outport(0x0a0c,0x1); //XMIT30 reg
- #if 1 //flash cs1,hansj 01/18, if there is problem with different flash chip type, change 1->0
- outport(0x0a0e,0x0); //XMIT01 reg
- outport(0x0a10,0x5); //XMITr01 reg
- // outport(0x0a12,0x2);
- outport(0x0a14,0x1); //XMIT21
- outport(0x0a16,0x1); //XMIT31
- #endif
-
- #endif //PDROM_EXTERNAL_SRAM
- #endif
- #ifdef DEBUG_CACHE_ISSUES
- outport(MPCS,0x90b8);
- #endif
- InitInterruptVectorTable ();
- #ifdef I86_CHIP
- I86_HAL_Init();
- #else
- HAL_Init();
- #endif
- #ifdef I77_COMPANION_CHIP
- I77_PowerDown(FALSE); /* Power up I77 */
- I77_HALInit();
- #endif
- #ifdef _DEBUG
- init_serio();
- #if defined(_RT_TRACE) || defined(OUTPORT_TRACE_ON)
- RT_TraceInit();
- #endif
- #ifdef TM_TRACE
- TM_TraceInit();
- #endif
- #ifdef BG_PRINT
- InitBGPrint();
- #endif
- #else
- #ifdef D_RELEASE_TRACE_ENABLED // ZKR GL051004 : Enabled trace in release version.
- init_serio();
- #endif // D_RELEASE_TRACE_ENABLED
- #endif
- tr_printf(("n********************************************n"));
- tr_printf(("*** Welcome to Mercury ***n"));
- tr_printf(("*** CPU Software version %s ***n",g_pszVersionString));
- tr_printf(("*** SERVO Software version %s ***n",drv_get_version()));
- tr_printf(("********************************************nn"));
- #ifdef AVI_DRM_SUPPORT
- aviDrmGetHardwareKey();
- #endif
- #ifdef I86_ADP_APOOGE_WDT
- WDT_CheckResetSrc();
- #endif //I86_ADP_APOOGE_WDT
- #ifdef CHECK_STACK_SIZE
- asm {
- mov [iMainStackSegment],ss
- }
- #endif //CHECK_STACK_SIZE
-
- #ifdef I64_STEP_B_CPU_DSP_ROM_CONTROL
- #ifdef _DEBUG
- {
- UINT16 temp;
- temp=inport(0xa02);
- tr_printf(("before CPU_DSP_ROM_CONTROL : %04xn",temp));
- }
- #endif
- outport(0xa02,0);
- #ifdef _DEBUG
- {
- UINT16 temp;
- temp=inport(0xa02);
- tr_printf(("after CPU_DSP_ROM_CONTROL : %04xn",temp));
- }
- #endif
- #endif
- #ifdef SUPPORT_MULTI_DACS
- switch( HW_Macro.eDacType)
- {
- case CS4392:
- AudioDac_SetType( AUDIO_DAC_CS4392 );
- break;
- case AK4382A:
- AudioDac_SetType( AUDIO_DAC_AK4382 );
- break;
- case AK4356:
- AudioDac_SetType( AUDIO_DAC_AK4356 );
- break;
- case PCM1606:
- default:
- AudioDac_SetType( AUDIO_DAC_PCM1606 );
- break;
- }
- #endif
- #ifdef UPDATE_CD_WITH_PLAYER_SETTING
- //Select front panel display
- fp_set_display_type(Model_Macro.VFDType); //This will be changed with actual setting variable.
- #endif
- #ifdef FP_TESTING_ON_POWER_UP
- if( g_power_state == POWER_SEQUENCE_IN_ON_STATE )
- {
- // First time after connecting player to electricity
- enable_fp_test();
- }
- #endif
- kernel_init();
- #ifdef AUX_IN_ENABLE
- // do not run drive task in aux mode
- if (g_bIsAuxModeOn)
- {
- while (1)
- {
- usleep(100000L);
- }
- }
- #endif
- ir_init(); //add by wl102804
- #ifdef DEFAULT_POWER_OFF_STATE
- if ( g_power_state != POWER_SEQUENCE_ON_REQUESTED &&
- g_power_state != POWER_SEQUENCE_ON_EJECT )
- {
- DriveDriver_power_off_proc();
- }
- else
- #endif
- {
- #if defined(SUPPORT_FLASH_CARD)||defined(MACESTROLINK_SUPPORT)
- FEM_Task_Proc();
- #else
- #ifdef D_QSI_LOADER
- usleep(200000L);
- #endif
- DriveDriver_proc();
- #endif
- }
- }
- #ifdef _DEBUG_VERILOG
- void verilog_print(char *str)
- {
- while(1)
- {
- outport(0xffff, *(str++) );
- if( *str == 'n' )
- {
- outport(0xffff, *str);
- return;
- }
- }
- }
- #endif