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

📄 main.c

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

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

Module Name:

        main.c

Abstract:

        Module related to main routine

Environment:

        Keil C51 Compiler

Revision History:

        08/28/2001      Chi-Yeh Tsai    created

--*/

//=============================================================================
//Header file
//=============================================================================
#include "general.h"
#include "main.h"
#include "initio.h"
#include "setmode.h"
#include "storage.h"
#include "timer.h"
#include "bulkout.h"
#include "cardlink.h"
#include "ctlsetup.h"
#include "doslink.h"
#include "uiflow.h"
#include "L2_ADSP.h"
#include "DSPui.h"
#include "usbmsdc2.h"
#if (MLUN_OPTION)
#include "usbMLUN.h"
#endif
#include "SPL10.h"
#include "LCD1.h"
#include "dosusr.h"
#include "audiocodec.h"

#include "smcfunc.h"
#include "smcvar.h"


//=============================================================================
//Symbol
//=============================================================================
// WMP3
#if (SIMULATE == 1)
sbit   DbgP11   ;          /* Verify I/O Port 1 : */
sbit   DbgP12   ;          /* Verify I/O Port 2 : */
sbit   DbgP14   ;          /* Verify I/O Port 4 : */
sbit   DbgP15   ;          /* Verify I/O Port 5 : */
sbit   DbgP16   ;          /* Verify I/O Port 6 : */
sbit   DbgP17   ;          /* Verify I/O Port 7 : */


//-------------------------------------
UCHAR   bdata   MainLoop_Event = 0x00;
//-------------------------------------
sbit    _UIEvent        = 0;

//-------------------------------------
UCHAR   bdata  TimerLoop_Event = 0x01;
//-------------------------------------
sbit    _TClock         = 0;        
sbit    _SecBase        = 0;        

#else

//-------------------------------------
UCHAR   bdata   MainLoop_Event = 0x00;
//-------------------------------------
sbit    _UIEvent        = MainLoop_Event^0;

//--------------------------------------
UCHAR   bdata  TimerLoop_Event  = 0x01;
//--------------------------------------
sbit    _TClock         = TimerLoop_Event^0;       
sbit    _SecBase        = TimerLoop_Event^1;       

#endif

//=============================================================================
//Variable
//=============================================================================
bit     _G_DispUSBBSY;
bit     _G_Storage_Full;
bit     _G_USB_or_Batt_Power;
bit     _G_LowBatt_State;
bit     _G_Battery_ChargeFull;
bit     _G_USB_Setup_Ack;       //plug out USB clear it
bit     _G_USB_Setup_Interrupt1;      //UI remove MSDC clear it
bit     _G_USB_PowerPlug_Interrupt;
bit		_G_USB_LockTG0, _G_USB_LockTG1;
bit     _G_Disp_PC;
bit		G_FileLock;			//sgjm add         
bit		G_FileLockTemp;
bit		G_RecLeftTimeOn=0;
//bit flag
data    BIT     G_btSoftwareResetFlag = 0;
data    BIT     G_btStopStream = 0;
data    BIT     G_btEP0Intr;
data    BIT     G_btBulkIntr;
data  	BIT  	_G_USBConnect;
data    BIT     _G_ucSuspend;
data    BIT     _G_USBSuspendPermit;
data    BIT  	_GPlayPause;
data    BIT	_G_KeyScanTg;
data 	BIT	_G_Storage_Error;
data    UCHAR   MCUSTDAdress;
data    UCHAR	G_DSPPrimeMODE;
data    UCHAR   G_DSPMinorMODE;
//
//----------------------------------
//lock fields of USB device request
//----------------------------------
//patch4.5@richie@mlun begin
extern	xdata UCHAR G_ucMSDC_MLUN;
//patch4.5@richie@mlun end
//patch4.5@richie@vender info begin
xdata UCHAR	G_ucMSDC_CARD;
xdata UCHAR	G_ucMSDC_BUILT_IN;
//patch4.5@richie@vender info end
#if (USBVendor_OPTION==1)
//state	and	error code
xdata	UCHAR	G_ucState;
xdata	UCHAR	G_ucState2;	//cch@10/15
#endif

data    UCHAR   G_bRequestLock = 0;
data    UCHAR   G_bRequestLog = 0;
data    USHORT  G_wIndexLock = 0;
data    USHORT  G_wValueLock = 0;

xdata   UCHAR   G_UI_USBConnect;
xdata   UCHAR 	G_PLAY_DPC;
xdata   UCHAR   G_Play_EQ;
xdata   UCHAR 	G_STATE;
xdata   UCHAR   G_EVENT;
xdata   UCHAR 	G_DISPLAY_Min;
xdata   UCHAR   G_DISPLAY_Sec;
xdata   UCHAR   G_Time_SecBase;
xdata   UCHAR 	G_UIMODE;
xdata   UCHAR 	G_DSP_Volume;
xdata   UCHAR	G_PLAY_SeqMode;
//xdata   UCHAR   G_LCDPanel_GroupNum;
//xdata   UCHAR   G_Battery_GroupNum;
xdata   UCHAR   G_LowBatt_SecondCount;
xdata   UCHAR   G_Battery_Level;
xdata   UCHAR   G_AB_Cnt;
xdata   UCHAR   G_Powerstate;
//sgjm add
xdata  UCHAR 	G_RecMode;
xdata	UCHAR   G_SubMenu;
xdata	UCHAR	G_AppoMinute;
xdata	UCHAR	G_VOS;
xdata	UCHAR  	G_Scope;
xdata	UCHAR	G_DelMode;




xdata   USHORT  G_W_OldTime;
xdata   USHORT 	G_FileCurrentIndex;
xdata   ULONG   G_Mpeg_Status;
//---------------------
//type of storage used
//---------------------
xdata   UCHAR   G_ucStorageType;
//--------------------------------------------------------------
//command and data buffer of control pipe and bulk in/out pipes
//--------------------------------------------------------------
xdata   UCHAR   G_ucCtrlCommand[K_CtrlCommandSize];
xdata   UCHAR   G_ucCtrlData[K_CtrlDataSize];
xdata   UCHAR   G_ucStorCommand[K_StorCommandSize];
xdata   UCHAR   G_ucTempData[512];  // WWMP3
xdata   UCHAR   G_LCDTMoutCnt;
//-----------------------------------------------
//storage interface N belongs to which USB class
//-----------------------------------------------
xdata   UCHAR   G_ucPktStorIntrf; //current packet belongs to which storage interface
//-----------------------
//pointer to data buffer
//-----------------------
UCHAR   *G_pucCtrlDataPointer;  //for both CODE and DATA area
xdata   UCHAR   *G_pucStorDataPointer;
//--------------------
//L1 Global variables
//--------------------
data    BIT     _GOneTim=1;
xdata   ULONG   G_BulkSize;
xdata   ULONG   G_BulkOutSize;
xdata   ULONG   G_BulkDRAMAddr;
xdata   UCHAR   G_LastBulk;
xdata   ULONG   G_BulkFlash;
xdata   ULONG   G_BulkFlashAddr;
xdata   ULONG   G_BulkSRAMAddr;
xdata	ULONG	G_AccessRevBlockPhyAddr;									
xdata	UCHAR	Current_Dvr_Dir;	//hxd030516 add
//
										


#if ( SIMULATE == 1 ) // WWWW
xdata   UCHAR   G_ucStorData[K_DMA_MaxSize];
#else
xdata   UCHAR   G_ucStorData[K_DOS_SectorSize] _at_ 0x1400;    //ada@0118
#endif
xdata WORD G_SMC_ReservePhyBlkAddr[K_NANDF_TOTAL_RESERVE_BUFFER];


UCHAR   code    DSP_MenuMODE[] ={KDSP_MP3_MODE, KDSP_DVRD_MODE, KDSP_DVRE_MODE, NULL};  

//code  UCHAR     G_Battery_GroupValue[][4]={{2,3,4,5},{9,10,11,12}};
#if  (Auto_Repeat_OPTION==1)
data  bit       _G_StudyFunc;
unsigned char xdata G_StudyRepTimes;
unsigned char xdata G_VOXSensitiveLevel;
unsigned char xdata G_VOXDetectTime;
#endif

#if (USBVendor_OPTION==1)
extern data    BIT _GUSBOutReady;
#endif
extern data    BIT _GUSBInPVID;
extern code    UCHAR   K_DeviceDescriptor[];

//=============================================================================
//Program
//=============================================================================
//-----------------------------------------------------------------------------
//main
//-----------------------------------------------------------------------------
void main(void) USING_0
/*++

Routine Description:

        main routine

Arguments:

        none

Return Value:

        none

--*/
{
        XBYTE[0x2002] |= 0x01;   // DSP initialize --Reset !!
        XBYTE[0x2100] = 0x0f;   //SRAM enable, rompage/rampage enable

        spca757main();
}

//-----------------------------------------------------------------------------
//spca757main
//-----------------------------------------------------------------------------
void spca757main(void) USING_0
/*++

Routine Description:

        main routine

Arguments:

        none

Return Value:

        none

--*/
{
//	UCHAR i;



        XBYTE[0x2100] = 0x0f;   //SRAM enable, rompage/rampage enable
//        XBYTE[0x201a] = 0x0f;   // Disable GPIO[1..3],GPIO 0,4,5 is Still Useful in MaskCode
        XBYTE[0x201a] = 0x2f;   	
                          
	G_UI_USBConnect = K_UI_USB_DISCONNECT;		// Another Definition for MSDC's Subroutine
//	EA = 0;
//	EX0 = 0;

	INITIO_Initialize();
	//==initialize parameters==//

	


	//
	USR_ClearFile();
	G_FileCurrentIndex=0;		// Default the File index is 1
	UI_GetFileAttr();
	

 	G_Time_SecBase = 0;

	G_btSoftwareResetFlag = 0;

	G_end_of_file=TRUE;    //..
	_GPlayPause=FALSE;     //..

	//================
	//xyq add 021226
        //================
	G_Busy_Timer=0;//xyq 021217
	G_SPL_BlinkTimer=0;//xyq 021116
	G_SPL_BattBlinkTimer=0;
	G_LED_Blink_On_Timer=0;//xyq 021218
	G_Battery_Detect_Timer=0;//xyq 021218

⌨️ 快捷键说明

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