📄 irstandby.c
字号:
*
* Description: check the customer code and get remote control key code
*
* Arguments:
* unsigned long int: IN, the code read from IRQ
*
* Return Value:
* unsigned long int: remote control key code
*
*----------------------------------------------------------------------*/
//BYTE IR_Check_Code_standby(unsigned long int IR_KeyCode)
BYTE IR_Check_Code_standby(void)
{
//unsigned char IR_byte3_standby, IR_byte2_standby, IR_byte1_standby, IR_byte0_standby;
IR_byte3_standby = 0;
IR_byte2_standby = 0;
IR_byte1_standby = 0;
IR_byte0_standby = 0;
IR_byte0_standby = BYTE0(IR_code_standby);
// if (IR_byte0_standby == IR_Custom_Code1_standby) //30124-01jf
if (IR_byte0_standby == IR_Custom_Code1) //30124-01jf
{
IR_byte1_standby = BYTE1(IR_code_standby);
// if (IR_byte1_standby == IR_Custom_Code2_standby) //30124-01jf
if (IR_byte1_standby == IR_Custom_Code2) //30124-01jf
{
IR_byte2_standby = BYTE2(IR_code_standby);
IR_byte3_standby = ~BYTE3(IR_code_standby);
if (IR_byte2_standby == IR_byte3_standby)
{
return IR_byte2_standby;
}
}
}
IR_Error_Flag_standby = 1;
return 0;
}
/*void PowerStandby_FrontEnd_Proc(void)
{
while (1)
{}
}*/
/* just for H/W reset use servo DSP I/O PIN start
void ReStartUP()
{
// WrReg_STB(0x077,0x01);
Addr_STB=0x077;
Value_STB=0x01;
WrReg_STB();
// SetM3323BYTE_STB(0x75,0x78); //enable dmctr power down
index_STB=0x75;
data_STB=0x78;
SetM3323BYTE_STB(); //enable dmctr power down
}
//void WrReg_STB(WORD Addr_STB,BYTE Value_STB)
void WrReg_STB()
{
// BYTE *M3323ByteReg;
M3323ByteReg_STB =(BYTE *)(0xDF001000+Addr_STB);
*M3323ByteReg_STB=Value_STB;
}
//void SetM3323BYTE_STB(WORD index_STB, BYTE data_STB)
void SetM3323BYTE_STB()
{
// volatile BYTE *M3323ByteReg;
// PRINTF("SetM3323B, index=%x, data=%x\n", index, data);
M3323ByteReg_STB_volatile = (volatile BYTE *)(0xDF000000+index_STB);
*M3323ByteReg_STB_volatile = data_STB;
}
just for H/W reset use servo DSP I/O PIN end*/
void STB_main(void) //30210-01jf modify this whole function
{
// KEYPAD keyPad_STB={0,0xff,0xff};//0124
p_key_STB=&keyPad_STB;//0124
//alert_STB("111111111111111 \n\r\0");
if(StandbyMode == 0) // normal mode ==> standby mode
{
//alert_STB("222222222222222 \n\r\0");
StandbyMode = 1;
dis_dsp();
DisInt();
StandbyCodeFillCache();
//alert_STB("333333333333333 \n\r\0");
asm volatile(".set noreorder
li $9,0xfffff000; # for cache, sp_offset_mask == 0xfffff000
and $29,$29,$9; # sp is not stored
subu $29, 4;
move $8,$29;
sub $8,1024;
Download_sp_to_D_cache_Loop:
lw $9, 0($8); # Pickup a word content
addiu $8, 4; # Increment source address
bne $29, $8, Download_sp_to_D_cache_Loop; # Not at end? Continue with clear
nop; # Delay slot
jal Servo_ADC_Audio_TVDAC_MPEG_CPU_powerdown;
nop
Clear_Intrupt: #Allow_Nested_Int
li $8, 0xFF101000 # GPIO Base
lw $9, 0x0($8) # Read GPIODAT
and $9, $9, 0x1fffffff # mask for GPIO29
or $9, $9, 0x40000000
sw $9, 0x0($8) # clear IP2
or $9, $9, 0x20000000
sw $9, 0x0($8) # mask for GPIO30:IPSEL
EnIRInt:
mfc0 $8, $12
or $8, 0x00000401 #enable ir_mask and interrupt_enable(IE)
and $8, 0xFFFF24F9 #disable watch_dog_mask, EXL and ERL
mtc0 $8, $12
and $8,0x0
PowerStandby_FrontEnd_Proc2:
la $4,p_key_STB #0124
lw $4,0($4) #0124
jal FpReceiveKey_standby #0124
nop
j PowerStandby_FrontEnd_Proc2
nop
.set reorder
"
::);
//PowerStandby_FrontEnd_Proc();
}
}
#if 0 //30210-01jf modify this whole function
void STB_main(void)
{
//alert_STB("111111111111111 \n\r\0");
if(StandbyMode == 0) // normal mode ==> standby mode
{
//alert_STB("222222222222222 \n\r\0");
StandbyMode = 1;
//dis_dsp();
DisInt();
StandbyCodeFillCache();
//alert_STB("333333333333333 \n\r\0");
asm volatile(".set noreorder
li $9,0xfffff000; # for cache, sp_offset_mask == 0xfffff000
nop;
nop;
and $29,$29,$9; # sp is not stored
nop;
nop;
subu $29, 4;
nop;
nop;
move $8,$29;
sub $8,1024;
nop;
nop;
Download_sp_to_D_cache_Loop:
lw $9, 0($8); # Pickup a word content
nop;
nop;
addiu $8, 4; # Increment source address
nop;
nop;
bne $29, $8, Download_sp_to_D_cache_Loop; # Not at end? Continue with clear
nop; # Delay slot
nop;
jal Servo_ADC_Audio_TVDAC_MPEG_CPU_powerdown;
nop
nop
Clear_Intrupt: #Allow_Nested_Int
li $8, 0xFF101000 # GPIO Base
lw $9, 0x0($8) # Read GPIODAT
nop
and $9, $9, 0x1fffffff # mask for GPIO29
or $9, $9, 0x40000000
sw $9, 0x0($8) # clear IP2
or $9, $9, 0x20000000
sw $9, 0x0($8) # mask for GPIO30:IPSEL
EnIRInt:
mfc0 $8, $12
nop
or $8, 0x00000401 #enable ir_mask and interrupt_enable(IE)
and $8, 0xFFFF24F9 #disable watch_dog_mask, EXL and ERL
mtc0 $8, $12
nop
nop
and $8,0x0
PowerStandby_FrontEnd_Proc2:
nop
nop
j PowerStandby_FrontEnd_Proc2
nop
nop
.set reorder //30210-01jf
"
::);
//PowerStandby_FrontEnd_Proc();
}
}
#endif //if 0 //30210-01jf modify this whole function
void Ready_to_WakeUp_Standby(void) //30210-01jf
{
asm volatile(".set noreorder
Clear_Intrupt7: #Allow_Nested_Int
li $8, 0xFF101000 # GPIO Base
lw $9, 0x0($8) # Read GPIODAT
and $9, $9, 0x1fffffff # mask for GPIO29
or $9, $9, 0x40000000
sw $9, 0x0($8) # clear IP2
or $9, $9, 0x20000000
sw $9, 0x0($8) # mask for GPIO30:IPSEL
EnIRInt7:
mfc0 $8, $12
#and $8,0xFFFF0000
or $8, 0x00000401 #enable ir_mask and interrupt_enable(IE)
and $8, 0xFFFF24F9 #Enable watch_dog_mask, disable EXL and ERL
mtc0 $8, $12
################# 1 before HWreset must to do Servo Power ON
#//20030620 Tom Yang for standby removed li $3, 0xDF010000 # set uP wait delay
#//20030620 Tom Yang for standby removed li $2, 0xC000
#//20030620 Tom Yang for standby removed sw $2, 0($3)
#//20030620 Tom Yang for standby removed li $3, 0xDF001000
#//20030620 Tom Yang for standby removed li $2, 0x0
#//20030620 Tom Yang for standby removed sb $2, 0x138($3)
#//20030620 Tom Yang for standby removed li $2, 0x0
#//20030620 Tom Yang for standby removed sb $2, 0x139($3)
#//20030620 Tom Yang for standby removed li $2, 0x0
#//20030620 Tom Yang for standby removed sb $2, 0x88($3)
#//20030620 Tom Yang for standby removed lb $2, 0x138($3)
#//20030620 Tom Yang for standby removed lb $2, 0x139($3)
#//20030620 Tom Yang for standby removed lb $2, 0x88($3)
j WakeUp_Standby
nop
.set reorder
"
::);
}
///////////////// 30210-01jf add the copies of function which are needed in standby ////////
/*----------------------------------------------------------------------
* Function_Name: VfdGetKeys_standby
*
* Description:
*
* Arguments:
*
* Return Value:
* DWORD - key-map of 32 keys. (This chip should have 48 keys at most!)
*----------------------------------------------------------------------*/
void FpReceiveKey_standby(KEYPAD* key)
{
BYTE temp;
#if (_TA != 302)
if (key->count > 2)
{
key->count=0;
key->code = PnlGetKey_STB();
//if ((key->code != 0xff) && (key->code != 0xfe) && (key->code != key->lastcode) )
//{
// if(bOpen&&(key->code==C_KEY_PLAY||key->code==C_KEY_ENTERPLAY))
// key->code=C_KEY_OPEN;
// if( ((key->code==C_KEY_PLAY)||(key->code==C_KEY_OPEN))&&(MachineState==C_MACHINE_ST_STDBY) )//0124
// {
//bbb();//for debug
// key->code=C_KEY_POWER;//0124
// }
if ( key->code == C_KEY_POWER )
{
temp = (*(TDR));//30216-01jf
*(TDR) = temp |0x08;//30216-01jf
Ready_to_WakeUp_Standby();
}
//}/*end: if ((key->code != 0xff) && (key->code != key->lastcode) )*/
}/*end: if (key->count>XX)*/
else
key->count++;
key->lastcode=key->code;
#endif
}
/*------------------------------------------------------------------\
| Function_Name: |
| void PnlGetKey_STB() |
| |
| Description: get the input key from panel |
| |
| Arguments: |
| |
| Return Value: |
| unsigned long : key code which the user pressed on panel |
| |
\------------------------------------------------------------------*/
unsigned long PnlGetKey_STB()
{
DWORD key ;
BYTE temp;//30216-01jf
DWORD CurKey;
BOOL _key_power_standby,_key_pause_standby,_key_open_standby;
_key_power_standby = _key_pause_standby = _key_open_standby = 0;
///////////////////////////////////////30213-11jf 30213jeff //////////////
#if (_TA == 301)//30216-01jf
SET_GPIO_W_standby(VFD0|VFD1);
SET_GPIO_R_standby(VFD2|VFD3|VFD4);
SET_GPIO_HI_standby(VFD0);
SET_GPIO_LOW_standby(VFD1);
if( GET_GPIO_DATA_standby(VFD2) )
{
_key_count_standby++ ;
if( _key_count_standby >= 2)
{
_key_count_standby = 0;
_key_power_standby=1;
}
else
{
SET_GPIO_HI_standby(VFD1);
SET_GPIO_LOW_standby(VFD0);
return C_KEY_0;
}
}
else if( GET_GPIO_DATA_standby(VFD4) )//30216-01jf
{
temp = (*(TDR));//30216-01jf
*(TDR) = temp &0xfd;//30216-01jf
_key_pause_standby=1;//30216-01jf
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -