📄 main.c
字号:
MAIN_EventPostDpc();
break;
#endif
//---------------------------------------------------
// 0x5X - General Storage Related Function
//---------------------------------------------------
case 0x50:
//-------------------------------------------
//0x50 - Format
//-------------------------------------------
MAIN_EventPreDpc();
// WWW3 start
// G_wIndexLock, Bit 0, 1 is physical format, 0 is logical format. It is suggested
// that always select physical format for nand and smc card
// for safty unless customer request faster format time.
// Bit 7, 1 is create DCIM and 100Media directory, no dir created.
// When this is on, it is no need to call M_card_Initialize
// again for all M_card_Initialize action have been included
// in format action.
// Bit 6, 1 is select optimized format, 0 is what card original
// Optimized means bigger cluster size or cluster size equals
// block size of smc and nand flash.
//
// So 0xC0 is fastest logical format, 0x01 is slowest physical format.
sts = STORAGE_Format(0xc1);
if (sts)
{
//DbgPrint("STORAGE_Format: OK\n");
sts = STORAGE_Initialize(sts);
///if (sts)
/// DbgPrint("STORAGE_Initialize: OK\n");
///else
/// DbgPrint("STORAGE_Initialize: Fail\n");
}
else
{
///DbgPrint("STORAGE_Format: Fail\n");
if (G_Card_Type != K_MEDIA_BUILT_IN)
{
// if external card format fail, change back to internal
// flash
G_Card_Type = K_MEDIA_BUILT_IN;
G_ucStorageType = K_MEDIA_BUILT_IN;
sts = STORAGE_Initialize(TRUE);
///if (sts)
/// DbgPrint("STORAGE_Initialize for built in flash: OK\n");
///else
/// DbgPrint("STORAGE_Initialize for built in flash: Fail\n");
}
}
// WWW3 end
MAIN_EventPostDpc();
break;
case 0x51:
//-------------------------------------------
//0x51 - Capture Object
// G_wIndexLock = 0 - Capture One Image (JPEG)
// 1 - Capture Audio Stream (WAV)
// 2 - Capture Video Stream (AVI)
// 3 - Capture Audio/Video Stream (AVI)
//-------------------------------------------
MAIN_EventPreDpc();
SENSOR_CaptureAeAwbAf();
// WWW3 start
sts = STORAGE_CaptureObject(G_wIndexLock);
/*
if (sts == TRUE)
DbgPrint("STORAGE_CaptureObject: OK\n");
else
DbgPrint("STORAGE_CaptureObject: Fail\n");
*/
// WWW3 end
MAIN_EventPostDpc();
break;
case 0x52:
//-------------------------------------------
//0x52 - Delete Object
// G_wValueLock = 0 - Delete All Object
// otherwise - Delete Object of Index
//-------------------------------------------
MAIN_EventPreDpc();
// WWW3 start
sts = STORAGE_DeleteObject(G_wValueLock);
if (G_wValueLock == 0)
{
/*
if (sts == TRUE)
DbgPrint("STORAGE_DeleteObject All: OK\n");
else
DbgPrint("STORAGE_DeleteObject All: Fail\n");
*/
}
else
{
/*
if (sts == TRUE)
DbgPrint("STORAGE_DeleteObject: OK\n");
else
DbgPrint("STORAGE_DeleteObject: Fail\n");
*/
}
// WWW3 end
MAIN_EventPostDpc();
break;
case 0x53:
//-------------------------------------------
//0x53 - Playback Object
// G_wIndexLock = 0 - Playback Nine Thumbnail
// 1 - Playback Four Thumbnail
// 2 - Playback One Image
// 3 - Playback Image Slide
// 4 - Playback Video
// G_wValueLock = Index of Object
//-------------------------------------------
MAIN_EventPreDpc();
STORAGE_PlaybackObject(G_wIndexLock, G_wValueLock);
MAIN_EventPostDpc();
break;
case 0x54:
//-------------------------------------------
//0x54 - Upload Object
// G_wIndexLock = 0 - Get Object Count
// 1 - Get Object FDBs
// 2 - Upload One Object
// G_wValueLock = Index of Object
//-------------------------------------------
MAIN_EventPreDpc();
if (G_wIndexLock)
STORAGE_UploadObject(G_wIndexLock, G_wValueLock);
MAIN_EventPostDpc();
break;
//patch4.3@richie@md0603 begin
case 0x55:
//-------------------------------------------
//0x55 - Mulitple Directory
// G_wIndexLock = 0 - Get Dir Count
// 1 - Get Dir Data
// 2 - Get Now Dir Index
// 3 - Set New Dir Index
// G_wValueLock
//-------------------------------------------
MAIN_EventPreDpc();
#if (SINGLE_DIRECTORY == 0)
if (G_wIndexLock == 1)
STORAGE_GetDirData();
else if (G_wIndexLock == 3)
USR_ChangeCurrentDir(G_wValueLock);
#endif
MAIN_EventPostDpc();
break;
//patch4.3@richie@md0603 end
// WWW3 start
case 0x5A: // switch card, TEST
MAIN_EventPreDpc();
G_Card_Type = G_wIndexLock;
G_ucStorageType = 0xff;
sts = STORAGE_Detect();
UI_Buzzer();//wendy@2004/8/26
//patch4.4@richie@dsi begin
//restore G_DOS_SDRAM_FAT1Addr
#if ( DOSRAM_OPTION == 1 )
if (G_Card_Type == K_MEDIA_DOSRAM)
{
if (G_ulDRAMSTORFAT1AddrTemp != 0xFFFFFFFF)
{
G_DOS_SDRAM_FAT1Addr = G_ulDRAMSTORFAT1AddrTemp;
}
}
#endif
//patch4.4@richie@dsi end
if (sts)
{
sts = STORAGE_Initialize(TRUE);
if (sts == FALSE)
{
sts = STORAGE_Format(0xc1);
if (sts)
sts = STORAGE_Initialize(sts);
}
}
MAIN_EventPostDpc();
break;
// WWW3 end
// wyeo@0521, patch 4.2
#if (NANDF_OPTION == 1 && CARD_OPTION == 1)
#if K_TEST_RESERVE_BLOCK
// TEST reserve block
case 0x5B:
MAIN_EventPreDpc();
sts = TestReserveBlock();
MAIN_EventPostDpc();
break;
#endif
#endif
//patch4.5@richie@partial file upload begin
case 0x60:
//-------------------------------------------
//0x60 - Upload Patrial Files
//-------------------------------------------
MAIN_EventPreDpc();
printf("MAIN Partial File\n");
printf("MAIN arg1 = %lx,arg2 = %lx,arg3 = %lx\n",G_ArgBuf[0],G_ArgBuf[1],G_ArgBuf[2]);
STORAGE_UploadObject(0x0004, G_ArgBuf[2]);
MAIN_EventPostDpc();
break;
//patch4.5@richie@partial file upload end
//patch4.5@richie@checksum isp begin
#if (ISPCHECKSUM_OPTION)
case 0x66:
//-------------------------------------------
//0x66 - CheckSum input
// G_wValueLock = CheckSum
//-------------------------------------------
MAIN_EventPreDpc();
// printf("CheckSum=%x\n",G_wValueLock);
G_usISPCheckSum = G_wValueLock;
printf("G_usISPCheckSum=%x\n",G_usISPCheckSum);
MAIN_EventPostDpc();
break;
#endif
//patch4.5@richie@checksum isp end
case 0xfd:
//-------------------------------------------
// L1_Function
//-------------------------------------------
MAIN_EventPreDpc();
switch(G_L1_ModuleID)
{
case 0x00:
App_DoL1Function_System(G_L1_FuncID, G_ArgBuf);
break;
case 0x01:
App_DoL1Function_Preview(G_L1_FuncID, G_ArgBuf);
break;
case 0x02:
App_DoL1Function_Playback(G_L1_FuncID, G_ArgBuf);
break;
case 0x03:
App_DoL1Function_Audio(G_L1_FuncID, G_ArgBuf);
break;
case 0x04:
App_DoL1Function_PC(G_L1_FuncID, G_ArgBuf);
break;
case 0x05:
App_DoL1Function_OSD(G_L1_FuncID, G_ArgBuf);
break;
case 0x06:
App_DoL1Function_FileSystem(G_L1_FuncID, G_ArgBuf);
break;
case 0x07:
App_DoL1Function_Storage(G_L1_FuncID, G_ArgBuf);
break;
case 0x0f:
App_DoL1Function_Test(G_L1_FuncID, G_ArgBuf);
break;
default:
break;
}
MAIN_EventPostDpc();
break; // case 0xfd
case 0xfe:
//-------------------------------------------
// L2_Function
//-------------------------------------------
MAIN_EventPreDpc();
switch(G_L2_ModuleID) // Module ID
{
case 0x00:
App_DoL2Function_Global(G_L2_FuncID, G_ArgBuf);
break;
case 0x01:
App_DoL2Function_Front(G_L2_FuncID, G_ArgBuf);
break;
case 0x02:
App_DoL2Function_CDSP(G_L2_FuncID, G_ArgBuf);
break;
case 0x03:
App_DoL2Function_SDRAM(G_L2_FuncID, G_ArgBuf);
break;
case 0x04:
App_DoL2Function_DMAC(G_L2_FuncID, G_ArgBuf);
break;
case 0x05:
App_DoL2Function_CPU(G_L2_FuncID, G_ArgBuf);
break;
case 0x06:
App_DoL2Function_FM(G_L2_FuncID, G_ArgBuf);
break;
case 0x07:
App_DoL2Function_Audio(G_L2_FuncID, G_ArgBuf);
break;
case 0x08:
App_DoL2Function_LCDTV(G_L2_FuncID, G_ArgBuf);
break;
case 0x09:
App_DoL2Function_USB(G_L2_FuncID, G_ArgBuf);
break;
case 0x0f:
App_DoL2Function_Misc(G_L2_FuncID, G_ArgBuf);
break;
default:
break;
}
MAIN_EventPostDpc();
break; // case 0xfe
default:
break;
}
MAIN_PostDpc();
}
}
//-----------------------------------------------------------------------------
//MAIN_PreDpc
//-----------------------------------------------------------------------------
void MAIN_PreDpc(void) USING_0
/*++
Routine Description:
pre-processing before deferred procedure call
Arguments:
none
Return Value:
none
--*/
{
//patch4.4@richie@sus begin
//if suspend intr then do suspend
// UCHAR temp;
//Joe@2003.3.4 9:13 add begin
UCHAR FOSD_H_num, FOSD_V_num;
UI_GetFOSDSize(&FOSD_H_num, &FOSD_V_num);
//Joe@2003.3.4 9:13 add end
//L2_SetGPIOBit(14,1); //POWER_CTRL
//Joe@2003.3.24 19:57 mask begin
/*if (G_ucSuspend == 1)
{
G_ucSuspend = 0;
//wait power stable
L2_Wait(10);
XBYTE[0x2038] &= 0xfd;
temp = XBYTE[0x2040];
//Joe@2003.3.24 9:10 modify begin
//if ((temp & 0x02) == 0x00)
if(G_UI_USBConnect == K_UI_USB_CONNECT)
//Joe@2003.3.24 9:10 modify end
{
//printf("Suspend\n");
L2_Suspend(0);
P1 = 0x54;
L2_Resume();
//printf("Resume\n");
G_ucSuspend = 0;
Card_InactiveCard();// patch4.4-9@wyeo@select nand, sdram as default
}
}
*/
//Joe@2003.3.24 19:58 mask end
//patch4.4@richie@sus end
//wendy@2004/9/29
/*if((G_UIStatusH&0xff00)==K_UISTATUS_DSC_PREVIEW)
{
UI_PrintOSDString("1",2, 2, 2);
DELAY_1s();
}*/
//wendy@2004/9/29
//patch4.3@richie@zo
if (G_usZoomOSDTimer != 0)
{
G_usZoomOSDTimer--;
if (((G_usZoomOSDTimer == 0)&&(G_UIStatusH!= K_UISTATUS_DSC_PCCAM))&&((G_UIStatusH&0x00ff)==0))//wendy@2004/4/21
{
//Joe@2003.3.12 15:34 modify begin
//UI_PrintOSDString(" ", 0, 0, 2);
UI_PrintOSDString(" ", FOSD_H_num/2-5, FOSD_V_num/2, 2);
//Joe@2003.3.12 15:34 modify end
}
}
#if (POWER_OPTION == 1)
if (P3 & 0x01) //USB disconnected
{
POWER_UiSuspendPolling();
}
else //USB connected
{
POWER_UsbSuspendPolling();
}
#endif
//Joe@2003.3.3 20:05 add begin
UI_TVOutDetect();
if (LB3)
{
UI_FlashLight_Charge();//wendy@2004/8/14
}
else
{
if ((G_KeyState == K_UI_BUTTON_FLASH) && (G_KeyScan == 1))
{
G_KeyScan = 0;
G_KeyState = K_UI_BUTTON_NULL;
}
UI_BusyLed(0);
G_FlashChargingCount = 0;
G_FlashCharging = 0;
G_Refresh_Status_OSD = 0;
if (G_FlashStatus != K_FlashLightOff)
{
G_FlashStatus = K_FlashLightOff;
UI_BusyLed(0);//wendy@2004/9/9
UI_PrintOSDString(LOW_BATTERY[G_Language], FOSD_H_num / 2 - 5, FOSD_H_num / 2 , UI_MENU_BG_COLOR_ON | UI_MENU_DEHIGHLIGHT_COLOR);
UI_FlashLight_Power(0);//hx@2003.5.6...add because zihuan
UI_Buzzer();
DELAY_100ms();
UI_Buzzer();
DELAY_100ms();
UI_Buzzer();
DELAY_1s();
UI_PrintOSDString(" ", FOSD_H_num / 2 - 5, FOSD_V_num / 2 , UI_MENU_BLINKING | UI_MENU_DEHIGHLIGHT_COLOR);
//Flash light disable icon
if(G_UIStatusH== K_UISTATUS_DSC_PREVIEW)//wendy2004/1/15
{
L2_SetFOSDIndex(0, FOSD_H_num-9, G_FlashStatus*2 + 0x12);
L2_SetFOSDAttr(0, FOSD_H_num-9, UI_MENU_TITLE_TEXT_COLOR);
L2_SetFOSDIndex(0, FOSD_H_num-8, G_FlashStatus*2 + 0x13);
L2_SetFOSDAttr(0, FOSD_H_num-8, UI_MENU_TITLE_TEXT_COLOR);
}
}
}
#if (MLUN_OPTION ==1 )
UI_CardHotInsertionDetect();
#endif
//patch4.2@ada@0527 for key scan
if ((G_UI_USBConnect == K_UI_USB_DISCONNECT) || (G_Timer0Stop == 0))
{
//Joe@2003.3.3 20:05 add begin
UI_PowerOnOffDetect(0);
UI_LowPowerDetect(); //WENDY BUG
#if (MLUN_OPTION ==0 )
UI_CardHotInsertionDetect();
#endif
UI_AutoPowerOffDetect(); //wendy@2004/8/15 //Davis@2004/9/3
UI_TimeOutCancelMenu(10);//wendy@2004/8/15
if (G_KeyScan)
{
G_KeyScan = 0;
TIMER0_Stop();
P1 = 0x00;
L1_UICtrl();
P1 = 0xFF;
if (G_UI_USBConnect == K_UI_USB_DISCONNECT)
{
TIMER0_Start();
}
}
}
else
{
//Joe@2003.2.25 9:55 add begin
G_AutoPowerOffCount = 0;
//Joe@2003.2.25 9:55 add end
G_MainLoopCount++;
if (G_MainLoopCount >= 100)
{
G_MainLoopCount = 0;
UI_Keypad_Scan();
P1 = 0x00;
L1_UICtrl();
P1 = 0xFF;
if (G_UI_USBConnect == K_UI_USB_DISCONNECT)
{
G_MainLoopCount = 0;
TIMER0_Start();
}
}
}
//richie@mi 0409
//if (G_ui_status != K_UI_mass_storage)
if((G_UIStatus & 0xff00) != K_UISTATUS_USBMODE_MASS) //yichang@replace
{
if(G_SensorPowerOnOff==1)//davis2004/11/26 add
SENSOR_OrdinaryAeAwbAf();
//richie@isp0426
if (G_ISP == 0)
{
L2_BulkInOut(); //USB bulk in/out processing in main loop
}
//richie@isp0426
//patch4.3@richie@je0531
if ((G_ISP == 1) && (G_ucISPCheck1 == 0x55) && (G_ucISPCheck2 == 0xAA))
{
ULONG dSize = 0;
USHORT bi;
//patch4.3@richie@je0531
UCHAR tmp1,tmp2,tmp3,tmp4;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -