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

📄 ir_drv.c

📁 OSD显示,单片机实现,ICCAVR! 代码风格严谨,为高人所写.我仅为了上传换取资料
💻 C
📖 第 1 页 / 共 2 页
字号:
    #endif
#endif
	return rx;
}
#else
static inline BYTE Call_Ir_Fun(UINT16 rx)
{
	if(rx >= MAX_IR_MAP) // Out of MAP range?
        return 0;
    #ifdef TEST_VFD_PANNEL_AND_KEY//lijd 2005-5-8 13:53
	 if(Test_Front_Panel_flag==1)
	 {
	 	 TestIrData=(BYTE)rx;
	 	 if(Test_Stop_flag!=1)
	 	 {
		  	 if((rx!=0x11)&&(rx!=0x26))    return 0; 
		 }else if(Test_Stop_flag==1)
		 {
		 	 if(rx!=0x11)    return 0; 
		 }
	 }
     #endif 
    rx = ir_mapcode[(BYTE) rx]; 
    
    #ifdef DMA_DVD_SWITCH
    extern void DMA_DVD_Switch(UINT16 rx);
    DMA_DVD_Switch(rx);
    #endif
    
  
       
    #ifndef IR_TOOL
    printf("\n ir(705) rx = %x \n",rx);
    call_ir_func(rx);
    #endif

    #ifdef TONIC_DVD
    if(rx==IRC_KEYLOCK)
    ircmd_keylock();
    #endif

    return 0;
}    
#endif                

#ifdef USE_VFDPORT_TRANDATA //linrc add 2004-3-27 16:40
#define USE_VFDPORT_TRANDATA_return(); return IRC_NULL;
#else
#define USE_VFDPORT_TRANDATA_return();
#endif

#ifdef  SUPPORT_SPI
#define SUPPORT_SPI_return(); return IRC_NULL; 
#else
#define SUPPORT_SPI_return();
#endif

#ifdef TCL_VFD_GPIO//2004-3-22 12:49 lijd
#define call_SUPPORT_TCL_LED();   tcl_led();
#else
#define call_SUPPORT_TCL_LED();
#endif

static inline void NEXT_FORWARD_IN_A_KEY_short_time(UINT16 rx)
{
#ifdef NEXT_FORWARD_IN_A_KEY    	
    	if(bIrSkipState)
    	{
	    	bIrSkipCnt++;	    	
	    	if(bIrSkipCnt>5)
	    	{
	    		if(rep_ir_times==0)
	    		{
	    			
#ifdef NEW_NEXT_FORWARD_IN_A_KEY
		    		rx = IRC_PREV + bIrSkipState -1;
#else//#ifdef NEW_NEXT_FORWARD_IN_A_KEY
                    rx = IRC_BACKWARD + bIrSkipState -1;      
#endif//#ifdef NEW_NEXT_FORWARD_IN_A_KEY

		        	ircmd_pre_paser(rx);

                }
		    
		        bIrSkipState = 0;
	    	    bIrSkipCnt = 0;
	    	    rep_ir_times = 0;
	    	}
    	}
#else
    if(rx) {}    	
#endif//NEXT_FORWARD_IN_A_KEY
}

static inline void NEXT_FORWARD_IN_A_KEY_long_time(UINT16 rx)
{
#ifdef NEXT_FORWARD_IN_A_KEY	        		    
    bIrSkipCnt = 0;
    if(rep_ir_times<=2)
    {
       	rep_ir_times=2;
#ifdef NEW_NEXT_FORWARD_IN_A_KEY
       	rx = IRC_BACKWARD + bIrSkipState -1;
#else//NEW_NEXT_FORWARD_IN_A_KEY
       	rx = IRC_PREV + bIrSkipState -1;
#endif//NEW_NEXT_FORWARD_IN_A_KEY
       	//printf("run rx:%d \n",rx);
       	ircmd_pre_paser(rx);
    }else if(rep_ir_times>3)
	{
		rep_ir_times = 1;
	}
#else
  if(rx) {}
#endif	
}

/*
** FUNCTION
** polling_ir
**
** DESCRIPTION
** polling IR interface and store received IR command
** to IR receive queue
*/
BYTE polling_ir(void)
{
    UINT16 rx;    
    UINT16 unCustId;
    
    //... terry,2004/7/23 10:56PM
    USE_VFDPORT_TRANDATA_return();
    SUPPORT_SPI_return();
    ir_tcl_standby();
    call_SUPPORT_TCL_LED();    
    mon_ir();	

    rx = regs0->iop_data[IR_PORT];
    if (!(rx & IR_RDY))
    {
    	//printf("bIrSkipState:%d rep_ir_times:%d bIrSkipCnt:%d \n",bIrSkipState,rep_ir_times,bIrSkipCnt);
        NEXT_FORWARD_IN_A_KEY_short_time(rx);
        
#ifdef ANGLE_GOTO_IN_A_KEY    	
    	if(bIrSkipState1)
    	{
	    	bIrSkipCnt1++;	    	
	    	if(bIrSkipCnt1>5)
	    	{
	    		if(rep_ir_times==0)
	    		{
	    			//rx=IRC_ANGLE;
	    			rx=IRC_GOTO;
		        	ircmd_pre_paser(rx);

		        }
		        bIrSkipState1 = 0;
	    	    	bIrSkipCnt1 = 0;
	    	   	rep_ir_times = 0;
	    	}
    	}
#endif
        
#ifdef SLOW_ZOOM_IN_A_KEY    	
    if(bIrSkipState2)
    {
    	bIrSkipCnt2++;	    	
    	if(bIrSkipCnt2>5)
    	{
    	    if(rep_ir_times==0)
    	    {
    		    rx=IRC_ZOOM;
                ircmd_pre_paser(rx);
            }
            bIrSkipState2 = 0;
	        bIrSkipCnt2 = 0;
            rep_ir_times = 0;
    	}
    }
#endif
        
#ifdef QISHENG_DVD	// alan, 2003/9/7 06:30PM    	
    	if (pressed==IRC_PLAY)
    	{
    		if (not_rdy_times>=2)
    		{
	    		rep_ir_times=0;
	    		not_rdy_times=0;
	    		pressed=IRC_NULL;
	    		if(dvd_menu_play==1)
                {//terry,2003/9/12 02:35PM
                  if(IsPBCOn()||(cd_type_loaded==CDDVD))
                  {
                     ircmd_playmode_toggle();
                     return IRC_NULL;
                  }
                }
	    		return Call_Ir_Fun(0x55);	// call IRC_Play, at ir_mapcode position 0x55
	    	} else {
	    		not_rdy_times++;
	    	}
    	} else if (pressed==IRC_DEFAULT_SETUP)
    	{
    		rep_ir_times=0;
    		pressed=IRC_NULL;
    		return Call_Ir_Fun(0x56);	// call IRC_DEFAULT_SETUP, at ir_mapcode position 0x56
    	}
#endif
        return IRC_NULL;
    }
    else
    {
		//terry,2003/7/14 01:24PM
        if ((rep_ab_mode==REPEAT_FIND_B) && 
			(sys_cmd==(CMD_FUNC|CMD_FUNC_REPAB)) && 
			(cd_type_loaded != CDROM)) // Robert 2004/02/06
        {
			//when system(nav.c) post CMD_FUNC_REPAB to navigation, and navigation tries to exit MediaMain and enter again
			//In the meanwhile, rep_ab_mode can't be set to REPEAT_AB_IDLE
			//For VCD, system will playtrack and then correct s_msf
			//if rep_ab_mode==REPEAT_AB_IDLE, s_msf will not be corrected, and it will jump to the start of this track
			printf("waiting for navigator\n");
			return IRC_NULL;;
        }

        unCustId=IOP_IR_DATA();        
        
        regs0->iop_data[IR_PORT] = rx & (~IR_RDY);        
        #ifdef IR_TOOL
        if (watch_ir_id_value==1)
        	{
        watch_ir_custm_id(unCustId);        
        return IRC_NULL;  
        	}
        #else
        watch_ir_custm_id(unCustId);  
		#endif
	
        if(CHK_CUST_ID(unCustId))
        {
            show_ir_custid_err();
            return IRC_NULL;    
        }
        #ifdef ONLY_VOLUME_REPEAT  
        rx = TRANS_IR_CODE(rx); 
        #endif     
        if( (regs0->iop_data[IR_PORT])&IR_REPEAT )
        {
            rep_ir_times++;         

        	//printf("rep:%d bIrSkipState:%d\n",rep_ir_times,bIrSkipState);

#ifdef NEXT_FORWARD_IN_A_KEY	        		
        	if(bIrSkipState)
        	{//bw:1 ff:2
        	    NEXT_FORWARD_IN_A_KEY_long_time(rx);        	    	
	        	return;//0;//0 maybe wrong , but a non-void function must return a value
    	    }
#endif//NEXT_FORWARD_IN_A_KEY                     
#ifdef ANGLE_GOTO_IN_A_KEY	        		
        	if(bIrSkipState1)
        	{
        	    bIrSkipCnt1 = 0;
        	    if(rep_ir_times<=2)
        	    {
        	    	rep_ir_times=2;
			//rx=IRC_GOTO;
			rx=IRC_ANGLE;
        	    	//printf("run rx:%d \n",rx);
        	    	ircmd_pre_paser(rx);
        	    }
        	    else 
        	    	if(rep_ir_times>3)
	        	{
	        		rep_ir_times = 1;
	        	}	
	        	return;//0;//0 maybe wrong , but a non-void function must return a value
    	    }
#endif//ANGLE_GOTO_IN_A_KEY                     

#ifdef SLOW_ZOOM_IN_A_KEY	        		
    if(bIrSkipState2)
    {
        bIrSkipCnt2 = 0;
        if(rep_ir_times<=2)
        {
    	    rep_ir_times=2;
            rx=IRC_SLOW;
    	    ircmd_pre_paser(rx);
        }
        else if(rep_ir_times>3)
    	{
    	    rep_ir_times = 1;
    	}	
    	return;//0 maybe wrong , but a non-void function must return a value
    }
#endif

#ifdef QISHENG_DVD	// alan, 2003/9/7 06:31PM
		not_rdy_times=0;
		if (rep_ir_times>=4)
		{
		    /*if (irc_value==IRC_STOP)
		    {
				pressed=IRC_POWER;
            	irc_value=IRC_NULL;
			}*/
		    if (irc_value==IRC_DEFAULT_SETUP)
		    {
            	pressed=IRC_DEFAULT_SETUP;
            	irc_value=IRC_NULL;
			}
		}
#endif

#ifdef ONLY_VOLUME_REPEAT//wangap add 04/5/20
        if((ir_mapcode[(BYTE) rx]!=IRC_VOLUME_UP)&&(ir_mapcode[(BYTE) rx]!=IRC_VOLUME_DN))
            return IRC_NULL;
#elif defined(ONLY_COMPUND_KEY_REPEAT)&&defined(NEXT_FORWARD_IN_A_KEY)&&defined(ANGLE_GOTO_IN_A_KEY)
        if((ir_mapcode[(BYTE) rx]!=IRC_PREV)&&(ir_mapcode[(BYTE) rx]!=IRC_NEXT)&&(ir_mapcode[(BYTE) rx]!=IRC_ANGLE))
            return IRC_NULL;
#endif            
#ifdef IR_NO_REPEAT
            return IRC_NULL;
#endif
        }else
        {
            rep_ir_times=0;
        }
    }

    save_srn_start_t = get_rtc_val();
    
    #ifndef ONLY_VOLUME_REPEAT
    rx = TRANS_IR_CODE(rx);
    #endif
    #ifdef IR_TOOL
    adj_ir_rxcode(unCustId==IRAddr,&rx,0x10);
    #else
    adj_ir_rxcode(unCustId==IR_ADDR_PATT,&rx,0x10);
    #endif
    adj_ir_rxcode(unCustId==IR_ADDR_PATT2,&rx,0x15);
    #ifdef IR_TOOL
    	if (watch_ir_value==1)  
    		{
    watch_ir_id(rx);   
	    		return IRC_NULL;
    		}
   #else
    	watch_ir_id(rx); 
   #endif
#ifdef QISHENG_DVD	// alan, 2003/9/7 06:32PM
	if (pressed==IRC_NULL)
	{		
		irc_value = ir_mapcode[(BYTE) rx];
		/*if (irc_value==IRC_STOP) 
		{
			pressed=IRC_STOP;
			return IRC_NULL;
		}*/
		if (irc_value==IRC_DEFAULT_SETUP) 
		{
			pressed=IRC_PLAY;
			return IRC_NULL;
		}
	}
#endif

#ifdef BBK_DV961_DVD   // fengjl edit  4-2-5 19:56
    //NOTE:
    //need contious 3s to change video output.
    //zhaoyanhua add 03-10-22 21:36
    if(	  (ir_mapcode[(BYTE) rx]  == IRC_ONLY_P_SCAN)
#ifdef ONLY_VGA_KEY
       	||(ir_mapcode[(BYTE) rx]  == IRC_VGA)
#endif
    	||(ir_mapcode[(BYTE) rx]  == IRC_INTERLACE)	
    	)
    {
    	if(rep_ir_times <= 3)
    		return;
    }
#endif//BBK_DVD

#ifdef BOOMBOX_NOT_USE_SOME_IR_KEYS//nono 2003-11-17 1:02 for YILI.
    if(	  (ir_mapcode[(BYTE) rx]  == IRC_POWER)
       	||(ir_mapcode[(BYTE) rx]  == IRC_MUTE)
    	||(ir_mapcode[(BYTE) rx]  == IRC_VOLUME_UP)	
    	||(ir_mapcode[(BYTE) rx]  == IRC_VOLUME_DN)	
    	)
    {
    		return;
    }
#endif//BOOMBOX_NOT_USE_SOME_IR_KEYS

#ifdef PORTABLE_DVD		//rbhung for Portable DVD HOLD IR
#ifdef HOLD_KEY_DETECT
if(hold_state)
    return IRC_NULL;
#endif
#endif

#ifdef SYBER_NATIVE_DVD_TYPE	
	if((rx == 0x1c) ||(rx == 0x0b) || (rx == 0x07) ||(rx == 0x13)
		||(rx == 0x00) ||(rx == 0x40) || (rx == 0x14) || (rx == 0x47) || (rx == 0x48))
	    return 0;
#endif //Maoyong 2003/12/17 16:20 for mask syber DVD vol+-, stdby and so on

#ifdef SUPPORT_8202_DVB //Maoyong 2005-6-1 10:47
	#if defined(SUPPORT_DVB_GUI_NEW)&&defined(DVB_IR_3D_ON)
	if(Is_Dvb_State() && !(full_scrn&SOUND)) 
	#elif defined(SUPPORT_DVB_GUI_NEW)
	if(Is_Dvb_State()) //David for 8202/6600
	#endif	
	{
    	if(Dvb_ircmd_pre_parser(rx))
    		return 0;
    }
#endif //SUPPORT_8202_DVB

#ifdef DISPLAY_INDIVIDUAL_SPK_VOLUME//2005-4-19 10:23 zhoulin
    if(regs0->iop_data[3]&0x000f) 
    {   
		show_channel_msg( (regs0->iop_data[3]&0x000f), rx);
		regs0->iop_data[3]=0x0000;
        return 0;
    }
#endif    

    return Call_Ir_Fun(rx);

}

#ifdef  SUPPORT_SPI
#include "spi.c"
#endif

⌨️ 快捷键说明

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