⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 initio.c

📁 凌阳MP3 spSPCA755yuanma
💻 C
📖 第 1 页 / 共 2 页
字号:
/*++

Copyright (c) 2001 Sunplus Technology Co., Ltd.

Module Name:

        initio.c

Abstract:

        Module related to chip initialization

Environment:

        Keil C51 Compiler

Revision History:

        08/28/2001      Chi-Yeh Tsai    created

--*/

//=============================================================================
//Header file
//=============================================================================
#include "general.h"
#include "initio.h"
#include "main.h"
#include "storage.h"
#include "bulkout.h"
#include "usbmsdc2.h"
#if (MLUN_OPTION)
#include "usbMLUN.h"
#endif
#include "setmode.h"

#include "ctlsetup.h"
#include "cardlink.h"


#include "timer.h"
#include "uiflow.h"

#include "DSPui.h"
#include "L2_ADSP.h"
//#include "Dbgprint.h"
#include "SPL10.h"
#include "LCD1.h"
#include "doserr.h"

xdata USHORT G_UIStatus;
//=============================================================================
//Symbol
//=============================================================================
void INITIO_StorageInitialize(void);
//-----------------------------------------------------------------------------
//Constant
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//Constant
//-----------------------------------------------------------------------------
// WWW2 start
//-----------------------------------------------------------------------------
//Variable
//-----------------------------------------------------------------------------
xdata   UCHAR   G_log27c0;
//----playback.c--
//-----------------------------------------------------------------------------
//Variable
//-----------------------------------------------------------------------------
xdata UCHAR  G_SelCell;
xdata UCHAR  G_Playback_Mode;
xdata USHORT G_defaultPlayID;
xdata UCHAR G_IsKeyRelease;

xdata USHORT G_PlayBackPageCount;
xdata USHORT G_NowPlayFileIndex;
xdata UCHAR G_ChangePage;

//=============================================================================
//Program
//=============================================================================
//void UI_Initialize(void);

// public
//=============================================================================

//-----------------------------------------------------------------------------
//Variable
//-----------------------------------------------------------------------------

//version4.0@ada@0513 for Card Write Protect
xdata   UCHAR    G_Card_WriteProtect;

//chamber@1223
extern xdata    UCHAR   G_LCDTMoutCnt;

//=============================================================================
//Symbol
//=============================================================================

//-----------------------------------------------------------------------------
//Constant
//-----------------------------------------------------------------------------


//-----------------------------------------------------------------------------
//INITIO_Initialize
//-----------------------------------------------------------------------------
//patch3.2@ada@0401 For Date & Time Update
void INITIO_Initialize(void) USING_0
/*++
Routine Description:        initialize system
Arguments:                  none
Return Value:               none
--*/
{

#if (EVBoard_OPTION==0)
	//--- Make USB D+ is Disable for USB Token
	XBYTE[0x2038] |= 0x02;		// GPIO1 is Output
	XBYTE[0x2030] &= 0xFD;		// GPIO1 is Low,
	///---Patch@2.04.00@chamber@improve the USB stability !
	///--- The USB Ready is controlled by P1.3
	///---
	P1 &= 0xF7;			// P1.3 is Low!
                      // P1 & P3 are always drive
     XBYTE[0x2102] = 0xfd;
	///---End of Patch@2.04.00@chamber !
#endif
	INIT_RS232;
	DbgPrint("INITIO_Initialize: Enter\n");
//-------------------------
	INITIO_GlobalInitialize();
	DbgPrint("INITIO_Initialize: Global variables initialization OK\n");

//	UI_Initialize();
//	DbgPrint("INITIO_Initialize: UI initialization OK\n");

	//richie@0109 swap
	INITIO_CpuInitialize();
	DbgPrint("INITIO_Initialize: INITIO_CpuInitialize OK\n");
//------------------

	INITIO_UsbInitialize();
	DbgPrint("INITIO_Initialize: INITIO_UsbInitialize OK\n");


	//--- Make sure the NAND Power Control Pin is Turn-ON!!
  XBYTE[0x2038] |= 0x02;		// GPIO1 is Output Enable
	XBYTE[0x2030] &= 0xFD;		// GPIO1 = 0 for Turn-ON si2301(P-MOS)
                              // GPIO1 = 1 for Turn-OFF si2301(P-MOS)
	XBYTE[0x2102] = 0xfd;
//	DbgP12 = 0;		///

	G_LCDTMoutCnt= 0;
	LCD_Reset();
//-------------
	LCD10_Disp_NANDInit();
	LCD10_Disp_AllIcon();

	USER_DelayDT(4000);		// Delay 10mS for de-bounce

	INITIO_StorageInitialize();
	DbgPrint("INITIO_Initialize: INITIO_StorageInitialize OK\n");


/*
	for(i=0;i<K_NANDF_TOTAL_RESERVE_BUFFER;i++)
		printf("G_SMC_ReservePhyBlkAddr=%x\n",G_SMC_ReservePhyBlkAddr[i]);
*/

	//patch4.5@richie@mlun begin
	#if (MLUN_OPTION)
	MLUN_Initialize();
	#endif
		//patch4.5@richie@mlun end

	//if(DSP_Initialize())  DbgPrint("DSP Fail !! \n");
	DSP_Initialize();
	//*** DSP MIPS ***//
	//G_DSP_MIPSClock = L2K_DSP30MIPS;
	G_DSP_MIPSClock = L2K_DSP24MIPS;    // WWTEST
	L2_DSP_MIPSSelect(G_DSP_MIPSClock);

	TIMER0_Start();
	//DbgPrint("INITIO_Initialize: Exit\n");


//	if(!(XBYTE[0x240C]&0x04))
	if(!(XBYTE[0x2040]&0x01))
	{//USB port power
		_G_USB_or_Batt_Power=1;
	}else{
	//battery port power
		_G_USB_or_Batt_Power=0;
	}



}
//-----------------------------------------------------------------------------
//INITIO_GlobalInitialize
//-----------------------------------------------------------------------------
//ada@0401 For file system refreshing when back from mass storage
//patch3.3@cytsai@0417
void INITIO_GlobalInitialize(void) USING_0
/*++
Routine Description:        enable control of global switch
Arguments:                  none
Return Value:               none
--*/
{
	//USB state
	G_BulkSize = 0;
	G_BulkOutSize = 0;
	G_BulkDRAMAddr = 0;
	G_LastBulk = 0;

	//cytsai
	G_bRequestLock = 0;
	G_bRequestLog = 0;
	G_wIndexLock = 0;
	G_wValueLock = 0;
	//yichang@0430 for UI and playback
	G_IsKeyRelease  = 0;

	//patch4.5@richie@mlun begin
	#if (MLUN_OPTION)
	//patch4.5@richie@vender info begin
	//if G_ucMSDC_MLUN = 1, First LUN = Build in
	//if G_ucMSDC_MLUN = 2, First LUN = Card
	G_ucMSDC_MLUN = 1;
	//patch4.5@richie@vender info end
	#else
	G_ucMSDC_MLUN = 0;
	#endif
	//patch4.5@richie@mlun end
	//patch4.5@richie@vender info begin
	G_ucMSDC_CARD = K_MEDIA_CARD;
	G_ucMSDC_BUILT_IN = K_MEDIA_BUILT_IN;
	//patch4.5@richie@vender info end

	//yichang@0430 for UI and playback
	//G_UIStatus = K_UISTATUS_USBMODE_PCCAM;
	G_UIStatus = K_UISTATUS_USBMODE_MASS;
	//version4.0@ada@0513 for Card Write Protect
	G_Card_WriteProtect = 0;
	//-----
	//--- Initialize the Audio parameters before DSP_Initialize!!
	//-----
	G_DSP_Volume = 20;	// Volume
	G_Play_EQ = 0;		// EQ
	G_PLAY_DPC = 12;	// Speed control
	//---
        //============
        //Mode setup
        //============
	G_UIMODE = KUI_DVRD_MODE; //SGJM KUI_MP3_MODE;
	G_DSPPrimeMODE = KDSP_DVRD_MODE; //KDSP_MP3_MODE;
 	G_DSPMinorMODE = KDVR_ADPCM_4bit;
	G_RecMode = 0;  //adpcm
	//---- Defalut is Repeat ALL
	G_PLAY_SeqMode = 0;		// 0:Normal, 1:Repeat all, 2:Repeat 1
	_TClock = FALSE;
	//--
	//----
	//// ---- Initial I/O --
	XBYTE[0x2408] = 0x28; 	// FPGPIO 24 is input for LCD option Detect--------xyq021228
	                      	// FPGPIO 25 is input for LCD option Detect--------xyq021228
	                      	// FPGPIO 26 is input for USB Detect
                          	// FPGPIO 27 is output for USB enable-----------xyq021228
                          	// FPGPIO 28 is N.C. (default is input)
                          	// FPGPIO 29 is output for control audio opAMP
	/// GPIO configurations --
	XBYTE[0x2038] |= 0x02; 	// GPIO 0 is input for hold Detect ---------	chamber030113
	                      	// GPIO 1 is output for ext power Control -------	chamber030113
	                      	// GPIO 2 is input for Play and Wakeup ----	chamber030113
                          	// GPIO 3 is No Used(For susupend) --------	chamber030113
                          	// GPIO 4 is Used to Address 16    --------	chamber030113
                          	// GPIO 5 is used to Address 17    --------	chamber030113

/*#if (EVBoard_OPTION==1)
	G_LCDPanel_GroupNum = 0x02;//select LCD panel
#else
	G_LCDPanel_GroupNum = XBYTE[0x240C] & 0x03;//select LCD panel
#endif
*/	                     //0:customerA
	                     //1:customerB
	                     //2:sunplus spl10A demo board V1.1 (20 Key)
	                     //  SPL10 DEMO BOARD V1.3 (7 Key)
	                     //3:sunplus spca756a spl10 display board-A V1.0 (13 Key)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -