📄 joetoevb.c
字号:
//DigTV9 is Flash Light Charge Ready(low active)
//DigTV10 is Sensor Power(high active)
//DigTV11 is Ready/Busy LED(high active)
XBYTE[0x2b07] = 0x00; //Mshutter is Self Timer LED(high active)
//turnkey_patch2.2@ada@suspend current begin
//XBYTE[0x2008] |= 0x10; //Mshutter output enable
//turnkey_patch2.2@ada@suspend current end
#if (TURNKEY_OPTION == 1)
XBYTE[0x2030] = 0x00; //GPIO drive 0
XBYTE[0x2031] = 0x00;
XBYTE[0x2032] = 0x00;
XBYTE[0x2033] = 0x00;
XBYTE[0x2034] = 0x00;
XBYTE[0x2035] = 0x00;
/*
XBYTE[0x2400] = 0x00; //FMGPIO drive 0
XBYTE[0x2401] = 0x00;
XBYTE[0x2402] = 0x00;
XBYTE[0x2403] = 0x00;
XBYTE[0x2404] = 0x00;
XBYTE[0x2405] = 0xFF;
XBYTE[0x2406] = 0xFF;
XBYTE[0x2407] = 0xFF;
XBYTE[0x2408] = 0xFF;
XBYTE[0x2D00] = 0x00; //TVGPIO drive 0
XBYTE[0x2D71] = 0x00;
XBYTE[0x2D72] = 0x00;
XBYTE[0x2D73] = 0x00;
XBYTE[0x2D74] = 0xFF;
XBYTE[0x2D75] = 0xFF;
XBYTE[0x2D76] = 0xFF;
*/
XBYTE[0x2050] = 0x00; //GPIO rising event interrupt
XBYTE[0x2051] = 0x00;
XBYTE[0x2052] = 0x00;
XBYTE[0x2053] = 0x00;
XBYTE[0x2054] = 0x00;
XBYTE[0x2055] = 0x00;
XBYTE[0x2048] = 0x00;
XBYTE[0x2049] = 0x00;
XBYTE[0x204A] = 0x00;
XBYTE[0x204B] = 0x00;
XBYTE[0x204C] = 0x00;
XBYTE[0x204D] = 0x00;
XBYTE[0x2058] = 0x00; //GPIO falling event interrupt
XBYTE[0x2059] = 0x00;
XBYTE[0x205A] = 0x00;
XBYTE[0x205B] = 0x00;
XBYTE[0x205C] = 0x00;
XBYTE[0x205D] = 0x00;
XBYTE[0x2078] = 0x00;
XBYTE[0x2079] = 0x00;
XBYTE[0x207A] = 0x00;
XBYTE[0x207B] = 0x00;
XBYTE[0x207C] = 0x00;
XBYTE[0x207D] = 0x00;
/*
XBYTE[0x2418] = 0x00; //FMGPIO rising/falling event interrupt
XBYTE[0x2419] = 0x00;
XBYTE[0x241A] = 0x00;
XBYTE[0x241B] = 0x00;
XBYTE[0x241C] = 0x00;
XBYTE[0x241D] = 0x00;
XBYTE[0x241F] = 0x00;
XBYTE[0x2410] = 0xFF;
XBYTE[0x2411] = 0xFF;
XBYTE[0x2412] = 0xFF;
XBYTE[0x2413] = 0xFF;
XBYTE[0x2415] = 0xFF;
XBYTE[0x2416] = 0xFF;
XBYTE[0x2417] = 0xFF;
XBYTE[0x2DC1] = 0x00; //TVGPIO rising/falling event interrupt
XBYTE[0x2DC2] = 0x00;
XBYTE[0x2DC3] = 0x00;
XBYTE[0x2DC4] = 0x00;
XBYTE[0x2DC5] = 0x00;
XBYTE[0x2DC6] = 0x00;
XBYTE[0x2DD1] = 0xFF;
XBYTE[0x2DD2] = 0xFF;
XBYTE[0x2DD3] = 0xFF;
XBYTE[0x2DD4] = 0xFF;
XBYTE[0x2DD5] = 0xFF;
XBYTE[0x2DD6] = 0xFF;
*/
#else
XBYTE[0x2030] = 0x00; //GPIO drive 0
XBYTE[0x2031] = 0x40;
XBYTE[0x2032] = 0x00;
XBYTE[0x2033] = 0x00;
XBYTE[0x2034] = 0x20;
XBYTE[0x2035] = 0x00;
/* XBYTE[0x2400] = 0x00; //FMGPIO drive 0
XBYTE[0x2401] = 0x00;
XBYTE[0x2402] = 0x00;
XBYTE[0x2403] = 0x00;
XBYTE[0x2404] = 0x00;
XBYTE[0x2405] = 0xFF;
XBYTE[0x2406] = 0xFF;
XBYTE[0x2407] = 0xFF;
XBYTE[0x2408] = 0xFF;
*/
/* XBYTE[0x2D00] = 0x00; //TVGPIO drive 0
XBYTE[0x2D71] = 0x00;
XBYTE[0x2D72] = 0x00;
XBYTE[0x2D73] = 0x00;
XBYTE[0x2D74] = 0xFF;
XBYTE[0x2D75] = 0xFF;
XBYTE[0x2D76] = 0xFF;
*/
XBYTE[0x2050] = 0x00; //GPIO rising event interrupt
XBYTE[0x2051] = 0x00;
XBYTE[0x2052] = 0x00;
XBYTE[0x2053] = 0x00;
XBYTE[0x2054] = 0x00;
XBYTE[0x2055] = 0x00;
XBYTE[0x2048] = 0x00;
XBYTE[0x2049] = 0x00;
XBYTE[0x204A] = 0x00;
XBYTE[0x204B] = 0x00;
XBYTE[0x204C] = 0x00;
XBYTE[0x204D] = 0x00;
XBYTE[0x2058] = 0x00; //GPIO falling event interrupt
XBYTE[0x2059] = 0x00;
XBYTE[0x205A] = 0x00;
XBYTE[0x205B] = 0x00;
XBYTE[0x205C] = 0x00;
XBYTE[0x205D] = 0x00;
XBYTE[0x2078] = 0x00;
XBYTE[0x2079] = 0x00;
XBYTE[0x207A] = 0x00;
XBYTE[0x207B] = 0x00;
XBYTE[0x207C] = 0x00;
XBYTE[0x207D] = 0x00;
/* XBYTE[0x2418] = 0x00; //FMGPIO rising/falling event interrupt
XBYTE[0x2419] = 0x00;
XBYTE[0x241A] = 0x00;
XBYTE[0x241B] = 0x00;
XBYTE[0x241C] = 0x00;
XBYTE[0x241D] = 0x00;
XBYTE[0x241F] = 0x00;
XBYTE[0x2410] = 0xFF;
XBYTE[0x2411] = 0xFF;
XBYTE[0x2412] = 0xFF;
XBYTE[0x2413] = 0xFF;
XBYTE[0x2415] = 0xFF;
XBYTE[0x2416] = 0xFF;
XBYTE[0x2417] = 0xFF;
*/
/* XBYTE[0x2DC1] = 0x00; //TVGPIO rising/falling event interrupt
XBYTE[0x2DC2] = 0x00;
XBYTE[0x2DC3] = 0x00;
XBYTE[0x2DC4] = 0x00;
XBYTE[0x2DC5] = 0x00;
XBYTE[0x2DC6] = 0x00;
XBYTE[0x2DD1] = 0xFF;
XBYTE[0x2DD2] = 0xFF;
XBYTE[0x2DD3] = 0xFF;
XBYTE[0x2DD4] = 0xFF;
XBYTE[0x2DD5] = 0xFF;
XBYTE[0x2DD6] = 0xFF;
*/
#endif
UI_UIResumeDetectIntrEnable(K_UIResumeIntrEnable,K_GpioHigh2LowEvent);//wendy@2004/9/2
L2_Wait(200);
XBYTE[0x2004] = 0x05; //resume length 5ms
//patch5.06@Joe@2003.7.4 19:09 modify begin
/*
if (Mode == 0x01)
{
XBYTE[0x2003] = 0x03; //suspend and reset CPU when resume
}
else
{
XBYTE[0x2003] = 0x01; //suspend and don't reset CPU when resume
}
*/
G_KeepPressPowerOn = 0;
while(G_KeepPressPowerOn == 0)
{
XBYTE[0x2003] = 0x00;
if (Mode == 0x01)
{
XBYTE[0x2003] = 0x03; //suspend and reset CPU when resume
}
else
{
XBYTE[0x2003] = 0x01; //suspend and don't reset CPU when resume
}
// if (PWR_DET != 0)//wendy@2004/6/1
// {
L2_Wait(1000);
// if (PWR_DET != 0)//wendy@2004/6/1
// {
// G_KeepPressPowerOn = 1;
// }
// }
}
//patch5.06@Joe@2003.7.4 19:10 modify end
MemStretch = tmp;
// return
//PRINT_L2(" L2_Suspend: Exit\n");
//DbgPrint("L2_Suspend_UI: Exit\n");
return(status);
}
//-----------------------------------------------------------------------------
//L2_Resume
//-----------------------------------------------------------------------------
/*
routine description:
Resume the operation of the SPCA533. It clears the related interrupt and puts
all the IO pins back to the normal operation states. In firmware coding,
this function must be called right after the Suspend function.
arguments:
none
return value:
none
*/
void L2_Resume_UI(void) USING_0
{
//body
//PRINT_L2(" L2_Resume: Enter\n");
//#################################################################################################
//The complete resume process for turnkey. USB plugging out and pushing Menu key can wake up the
//camera system.
//#################################################################################################
UCHAR tmp;
UCHAR i;
//DbgPrint("L2_Resume_UI: Enter\n");
//body
//PRINT_L2(" L2_Resume: Enter\n");
tmp = MemStretch;
MemStretch = 0x01;
//patch5.03@Joe@2003.4.2 10:02 add begin
G_AutoPowerOffCount = 0;
L2_SetGPIOBit(14,0); //Power on //Davis:patch5.0.0.5_2005/Jul/19
//patch5.03@Joe@2003.4.2 10:03 add end
XBYTE[0x2003] = 0x00; //clear swsuspend
XBYTE[0x20D0] &= 0xfd; //UI resume interrupt disable
XBYTE[0x2530] = 0x00; //USB SRAM test enable
XBYTE[0x2532] = 0x00; //USB SRAM page selection
L2_EnterExitSelfRefresh(1); //SDRAM exit self-refresh
UI_UIResumeDetectIntrEnable(K_UIResumeIntrEnable,K_GpioHigh2LowEvent);//wendy@2004/9/2
//Return FMGPIO state
/* for (i = 0; i < 8; i++)
{
XBYTE[0x2401 + i] = FmGpioState[i];
}
*/
L2_FlashMode(G_Card_Type,K_MEDIA_NONE,1);
//Return TVGPIO state
for (i = 0; i < 6; i++)
{
XBYTE[0x2D71 + i] = TvGpioState[i];
}
//patch5.03@Joe@2003.4.3 17:05 mask for dead when turn off dispaly begin
//XBYTE[0x2001] = 0x01; //power on TV encode
//patch5.03@Joe@2003.4.3 17:05 mask for dead when turn off dispaly end
// UI_SensorPowerOnOff(1);
XBYTE[0x2080] = 0x01; //power on TGPLL
//turnkey_patch2.2@ada@suspend current begin
DELAY_1ms();
for (i = 0; i < 5; i++)
{
XBYTE[0x2007 + i] = TGOeState[i];
}
//turnkey_patch2.2@ada@suspend current end
// 533@patch5.06@Joe@2003.11.3 15:55 mask begin
/*
XBYTE[0x201c] = 0x00; //TV Encoder 1X & 2X clock selection
DELAY_1ms();
*/
// 533@patch5.06@Joe@2003.11.3 15:56 mask end
//L2_InitGlobal(0); //Davis@2004/9/3
//UI_Save_NAND_UiParameters();//Davis@2004/9/2
MemStretch = tmp;
UI_PowerOnOffDetect(0);//wendy@2004/9/3
/* L2_InitFront(0);
//patch5.06@Joe@2003.7.4 19:05 add begin
L1_InitPowerOn();
FOSDtoDRAM(K_FOSD_Start_Bank, K_FOSD_Total_Bank, K_SDRAM_CharFontBufAddr);
GOSDtoDRAM(K_GRAFFONT_Width, K_GRAFFONT_Height, K_GOSD_Start_Bank, K_GOSD_Total_Bank, K_SDRAM_GrafFontBufAddr);
UI_ClearFOSD(25, 8, 0x00);
// UI_DisplayOpenLog();//wendy@2004/6/1
DELAY_1s();
//patch5.06@Joe@2003.7.4 19:05 add end
//patch5.06@Joe@2003.11.04 19:05 add begin
INITIO_StorageInitialize();
//patch5.06@Joe@2003.11.04 19:05 add end
if((G_UIStatus & 0xff00) == K_UISTATUS_DSC_PREVIEW)
{
UI_PreviewInit();
}
if((G_UIStatus & 0xff00) == K_UISTATUS_DSC_PLAY)
{
Playback_Initial();
//printf("2:G_DSPHsize=%d,G_DSPVsize=%d\n",G_DSPHsize,G_DSPVsize);
}
// return
//PRINT_L2(" L2_Resume: Exit\n");
//DbgPrint("L2_Resume_UI: Exit\n");
return;
*/
}
//=============================================================================
//UI_UIResumeDetectIntrEnable
//=============================================================================
void UI_UIResumeDetectIntrEnable(UCHAR IntrEnable, UCHAR Edge) USING_0
{
#if(TURNKEY_OPTION == 1)
//Set GPIO22 (DET A) as the UI resume pin and GPIO21(SCAN C) must be high
if (IntrEnable)
{
if (Edge == K_GpioHigh2LowEvent) //Falling event
{
XBYTE[0x2059] |= 0x40;
XBYTE[0x2051] &= 0xBF;
}
else
{
if (Edge == K_GpioLow2HighEvent) //Rising event
{
XBYTE[0x205a] &= 0xBF;
XBYTE[0x2052] |= 0x40;
}
}
}
else
{
XBYTE[0x2051] &= 0xBF;
XBYTE[0x2059] &= 0xBF;
}
#else
//Set GPIO26 (ROW 2) as the UI resume pin and P3.4(COL 1) must be high
if (IntrEnable)
{
if (Edge == K_GpioHigh2LowEvent) //Falling event
{
XBYTE[0x205b] |= 0x04;
XBYTE[0x2053] &= 0xFB;
}
else if (Edge == K_GpioLow2HighEvent) //Rising event
{
XBYTE[0x205b] &= 0xFB;
XBYTE[0x2053] |= 0x04;
}
}
else
{
XBYTE[0x2053] &= 0xFB;
XBYTE[0x205b] &= 0xFB;
}
#endif
}
//=============================================================================
//UI_UsbDPlusPullHigh
//=============================================================================
void UI_UsbDPlusPullHigh(UCHAR On) USING_0
{
#if(TURNKEY_OPTION == 1)
XBYTE[0x201a] &= 0xf7;
L2_ConfigGPIOBit(11,1);
if (On == K_DPlusPullHighResistorOn)
{
//turnkey_patch2.2@ada@Delay for multi-lun begin
#if (MLUN_OPTION)
if (G_UIStatus == K_UISTATUS_USBMODE_MASS)
{
DELAY_1s();
}
#endif
//turnkey_patch2.2@ada@Delay for multi-lun end
XBYTE[0x2005] |= 0x01; //Enable USB transceiver
L2_SetGPIOBit(11,1);
}
else
{
XBYTE[0x2005] &= 0xfe; //Disable USB transceiver
L2_SetGPIOBit(11,0);
}
#else
L2_ConfigGPIOBit(24,1);
if (On == K_DPlusPullHighResistorOn)
{
//turnkey_patch2.2@ada@Delay for multi-lun begin
#if (MLUN_OPTION)
if (G_UIStatus == K_UISTATUS_USBMODE_MASS)
{
DELAY_1s();
}
#endif
//turnkey_patch2.2@ada@Delay for multi-lun end
XBYTE[0x2005] |= 0x01; //Enable USB transceiver
L2_SetGPIOBit(24,1);
}
else
{
XBYTE[0x2005] &= 0xfe; //Disable USB transceiver
L2_SetGPIOBit(24,0);
}
#endif
}
//=============================================================================
//UI_SetCPUPort
//=============================================================================
void UI_SetCPUPort(void) USING_0
{
if (L2K_CPUInternal == 1)
{
XBYTE[0x2c02] = L2K_P1OE; // P1 & P3 are always drive
#if(TURNKEY_OPTION == 1)
XBYTE[0x2c03] = 0xc7; // P3_0 is input for RXD
// P3_3 is input for LBO
// P3_4 is input for PWR_DET
// P3_5 is input for VIDEO_DET
#else
XBYTE[0x2c03] = L2K_P3OE;
#endif
//P3 = 0xff;
//turnkey_patch2.2@ada@suspend current begin
P1 = 0x00;
//turnkey_patch2.2@ada@suspend current end
}
else
{
XBYTE[0x2c02] = 0x00;
XBYTE[0x2c03] = 0x00;
}
if (L2K_CPUP1 == 1)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -