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

📄 userinit.c

📁 凌阳SPDA1000 MP3开发资料
💻 C
📖 第 1 页 / 共 2 页
字号:
//===========================================================
//   Project Name(项目名称):  SPCA755 rebuild
//   File Name(模块名称): userinit.c
//   Built Date(创建日期):2004-09-14
//   Abstract(模块描述): 用户初始化功能函数模块
//   Revision History(版本信息):
//   Rev      Date           Author       Comment(修改说明)
//   1.0      2004-09-14      XYQ         created
//============================================================
#include "..\userdefine.h"
#include "userinit.h"
#include "user.h"
#include "interrupt.h"
#include "main.h"
//================================================================================================
code U8 User_Dir[K_USER_DIR_NUM][12] = 
{
	'D','V','R',0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x10,
};//==================注意:目录名字母必须大写=====================================
#define USER_SETTING_CHECKSUM_LENTH	10
code U8 LogFileName[] = 
{
	'U','S','E','R','S','E','T',' ','L','O','G'
};


//***************************************** USB DESCRIPTOR ******************************************
//================================================================================================
code    U8   K_MSDC_DeviceDescriptor[] =
{
        //-------------------------------------------------------------------
        //TotalLength = 0x0012 byte
        //-------------------------------------------------------------------

        //Device (0x12 byte)
        0x12,                   //bLength: 0x12 byte
        0x01,                   //bDescriptorType: DEVICE
        0x10, 0x01,             //bcdUSB: version 1.10
        0x00,                   //bDeviceClass: independent interfaces
        0x00,                   //bDeviceSubClass: 0
        0x00,                   //bDeviceProtocol: class specific protocols NOT used on device basis
        0x40,                   //bMaxPacketSize0: maximum packet size for endpoint zero
        0xFC, 0x04,             //idVendor: vendor ID
        0x7A, 0x75,             //idProduct: product ID (for MSDC)
        0x00, 0x01,             //bcdDevice: device release number in BCD
        0x01,                   //iManufacturer: index of string
        0x02,                   //iProduct: index of string 
        0x00,                   //iSerialNumber: index of string
        0x01,                   //bNumConfigurations: 1 configuration
};

//================================================================================================
code    U8   K_ManufacturerString[] =
{
        //----------
        //0x20 Bytes
        //----------
        0x20,           //bLength
        0x03,           //bDescriptorType: STRING
         'S', 0x00,     //bString: Sunplus Co Ltd
         'u', 0x00,
         'n', 0x00,
         'p', 0x00,
         'l', 0x00,
         'u', 0x00,
         's', 0x00,
         ' ', 0x00,
         'C', 0x00,
         'o', 0x00,
         ' ', 0x00,
         'L', 0x00,
         't', 0x00,
         'd', 0x00,
         ' ', 0x00,
};
//================================================================================================
code    U8   K_ProductString[] =
{
        //----------
        //0x30 Bytes
        //----------
        0x30,           //bLength
        0x03,           //bDescriptorType: STRING
         'S', 0x00,     //bString: Sunplus SPCA755/SPCA757
         'u', 0x00,
         'n', 0x00,
         'p', 0x00,
         'l', 0x00,
         'u', 0x00,
         's', 0x00,
         ' ', 0x00,
         'M', 0x00,
         'u', 0x00,
         'l', 0x00,
         't', 0x00,
         'i', 0x00,
         'M', 0x00,
         'e', 0x00,
         'd', 0x00,
         'i', 0x00,
         'a', 0x00,
         ' ', 0x00,
         'd', 0x00,
         'i', 0x00,
         's', 0x00,
         'k', 0x00,
};
//================================================================================================
code    U8   K_SerialNumberString[] =
{
        //----------
        //0x1a Bytes
        //----------
        //----------
        0x12,           //bLength
        0x03,           //bDescriptorType: STRING
         '0', 0x00,     //bString: 01.00.00
         '1', 0x00,     
         '.', 0x00,
         '0', 0x00,
         '0', 0x00,
         '.', 0x00,
         '0', 0x00,
         '0', 0x00,
};
//================================================================================================
code    U8   K_ScsiVendorInformation[8] =//注意长度不能改动
{
         'S',  'u',  'n',  'p',  'l',  'u',  's', 0x20,
};
//================================================================================================
code    U8   K_ScsiProductIdentification[16] =//注意长度不能改动
{
         'M',  'u',  'l',  't',  'i',  'M',  'e',  'd',
         'i',  'a',  '-',  'D',  'i',  's',  'k', 0x20,
};
//================================================================================================
code    U8   K_ScsiProductRevisionLevel[4] =//注意长度不能改动
{
         '1',  '.',  '0',  '0',
};


//-----------------------------------------------------------------------------------
code U8 gc_CustomerID1 = 0x00;	
code U8 gc_CustomerID2 = 0x00;
code U8 gc_CustomerID3 = 0x00;
//----------------------------------------------------------------------------------
xdata U32 gdw_USER_DirClus[K_USER_DIR_NUM];
data U8  gc_SystemStateMode;
xdata U8  gc_KeyLockState;
xdata U8  gc_PLAY_DPC;
xdata U8  gc_DSP_Volume;
xdata U8  gc_PlayEQMode;
data U8  gc_UIMode;
xdata U8  G_Current_Contrast;
xdata U16 gw_Code;	
xdata U8 gc_UserBacklightLevel;//lyh add
xdata	U8	gc_LrcFileName_Exist;

//================================================================================================
void User_initialize(void);
void User_initialize2(void);
//void User_initialize3(void);//lyh add
void L2_ConfigureIO(void);
//===================================================================================================
void User_initialize2()
{	
	U8 i;
	gw_Code = SYS_VersionCode;
	gw_Code = USB_VersionCode;
	gw_Code = Nand_VersionCode;
	gw_Code = DSP_VersionCode;
	gw_Code = ID3_VersionCode;
	gw_Code = LRC_VersionCode;
	gw_Code = Dos_VersionCode;
	#ifdef SUPPORT_MLUN
	gw_Code = Mlun_VersionCode;
	#endif
	#ifdef SUPPORT_SELECTIVE_FUNC
	gw_Code = Selective_VersionCode;
	#endif
//	Usb_WriteProtectInitio(DbgP11);
	gc_SecondTimer = SECONDTIMER_VALUE;
    gc_basetimerx4= BASETIMERX4_VALUE;//lyh add

//	gc_CardTotal = K_CARD_TOTAL;
	gc_DSP_Volume = 21;	// Volume
	gc_PlayEQMode = 0;		// EQ
	gc_PLAY_DPC = 12;	// Speed control
	G_CurrentHZK = Language_GB2312;
	gc_UserBacklightLevel = 0; //lizhn debug

	gc_UIMode=0;			// UIMode = 0x00 is music file
							// UIMode = 0x01 is record file

	gc_LrcFileName_Exist = 0;

	gc_RECLowBattValue = K_REC_MINBATTERYVALUE;

	gc_SystemStateMode = SYSTEM_STATE0_IDLE;//default idle state
	gc_DispTime[0] = 0;
	gc_DispTime[1] = 0;
	gc_DispTime[2] = 0;
	MlunSequence[0] = 0;
	MlunSequence[1] = 1;

	gc_KeyLockState = 0;

	gc_KeyValue = 0;	
	#ifdef SUPPORT_MLUN
//	gb_MlunEnable = 1;
	#else
//	gb_MlunEnable = 0;
	#endif
	#if (K_CARD_TYPE == 0x03)
	 SMC_STORAGE_Initialize();
	if (gc_DOS_ErrorStatus = SD_STORAGE_Initialize())//try to initialize SD card  
	#endif
	{//if SD card is not exist		
		gc_DOS_ErrorStatus = SMC_STORAGE_Initialize();//try to initialize SMC
	}
	if (gc_DOS_ErrorStatus == 0)
	{		
		USER_FindDir(0,gdw_DOS_RootDirClus);//detect DVR dir
	}

    SPLC501_Init();
 //   SPLC501_Disp_MyMP3Logo();
    SPLC501_ShowCompanyLogo();
    SPLC501_Disp_TASOLogo();

	for(i=0;i<10;i++)
	{
		USER_DelayDTms(250);
	}
	
	if(!USB_PlugDetect())
	{
		//battery port power
//		if(LockPin_Locked)//xyq040210 locked  lss 060612
		if(0)//xyq040210 locked
		{
			unsigned char i;
		
			for(i=0;i<12;i++)
			{
				USER_DelayDTms(250);
			}
			POWER_CTRL_LOW;//DbgP30=0;//Low for Power Off

⌨️ 快捷键说明

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