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

📄 vfd_portable.c

📁 mp3 player program please read carefully.
💻 C
📖 第 1 页 / 共 3 页
字号:
/*
----->included by vfd_io_util.c
----->only for portable dvd use.
----->did it on 07/25
*/

#ifdef EASTWIN
extern UINT8  safe_on;
#endif

#ifdef MUSTEK_K100D_MODEL//by justin 2005/09/30
extern int IunTestPin84;
#endif

#ifdef SUPPORT_8202_DVB
#include "..\dvb_h\dvb_func.h"
extern UINT8 Dvb_ircmd_pre_parser(BYTE rx __attribute__((unused)));
#endif

#ifdef REM_JPEG_DECODE_STATE
extern BYTE jpeg_in_decode;
#endif

#ifdef BAT_DETECT//shenyj add 2006-9-12 02:37下午
void check_bat_detect_gpio(void)
{
    if(GPIO_I_GET(LOWBAT_DET_GPIO))
    {	   
        if(lowbat_timer)
		ClearOsdMsg(1);
    	lowbat_timer = 0;
    }
    else
    {             
    	if(lowbat_timer<6000)
    	{
    	    int flag;
    	    flag=lowbat_timer/70;
    		if(flag%3!=1)
    		{
    		    PrintOsdMsg(STR_OS_LOWBAT,REGION1,0,0);
    	    }
    	    else
    	    {
    	        ClearOsdMsg(1); 
    	    }
    		lowbat_timer++;
        }	
    	else
    	{   	
	        #ifdef WHEN_BAT_LOW_POWER_OFF 
            ircmd_power();	
            #endif
    	}	
    }
}
#endif

#ifdef EASTWIN
void check_portable_gpio(void)
{
    UINT16 temp=0;
    
    #ifdef TFT_VIDEO_INOUT
    static BYTE AVin_step = 0;
    
    INT_EXT_GPIO_INIT();
   
    switch (GPIO_I_GET(INT_EXT_VIDEO_GPIO))
    {
      case 0://8210 input video to TFT
        if((system_state == SYSTEM_OPEN) && (AVin_step == 1))
        {//just now system was interrupted in reading disc 
              if(CDOpened())
              {
                call_ir_func(IRC_EJECT);
                AVin_step = 0;
                //printf("i am going to read disc.......\n");
              }
        }
        else if((system_state == SYSTEM_STOP) && (AVin_step == 2))
        {//just now system was interrupted in normal playing state
                ircmd_play();
                AVin_step = 0;
                //printf("i am going to play disc.......\n");
        }
        #ifdef HOLD_KEY_DETECT//shenyj add 2006-9-12 03:06下午
        if(hold_state == 2)
          hold_state = 0;
         #endif 
      break;
      case 1://External AV input to TFT
        if(system_state == SYSTEM_READ_TITLE)
        {//in reading disc and 
            if(!CDOpened())
            {
              AVin_step = 1;
              call_ir_func(IRC_EJECT);
              //printf("video in when reading disc,then i go into open state\n");
            } 
            
        }
        else if(system_state == SYSTEM_BROWSE)
        {
            if(play_state != VCD_STATE_STOP)
            {
                AVin_step = 2;
                ircmd_stop();
                #ifdef STOP_LOADER
                stop_loader();
                #endif
                //printf("video in when playing disc,then i go into stop state\n");
            }
        } 
        #ifdef HOLD_KEY_DETECT//shenyj add 2006-9-12 03:06下午
        if(hold_state == 0)
          hold_state = 2;       
        #endif
      break;
      
    }
    
    if(!AVin_step)
    {
    #endif //end #ifdef TFT_VIDEO_INOUT
    
    #ifdef SUNPLUS_8202P_DEMOBOARD
    regs0->sft_cfg4 &= ~((0x03)<<2);    //Enable GPIO2,3 For COVER & TFT SW
    #endif
    
    #ifdef TFT_VIDEO_INOUT
    }
    #endif //end #ifdef TFT_VIDEO_INOUT

    #ifdef TFT_VIDEO_INOUT 
    if(!AVin_step)
    {
    #endif //end #ifdef TFT_VIDEO_INOUT 
    #ifdef HOLD_KEY_DETECT    
    temp=regs0->gpio_in[HOLD_GPIO / 16] & (1 << (HOLD_GPIO % 16));  //get gpio37(HOLD)
    if(temp)
        hold_state=1;
    else
        hold_state=0;           
    #endif
    
    temp=regs0->gpio_in[TFT_SW_GPIO / 16] & (1 << (TFT_SW_GPIO % 16));  //get gpio44(TFT_SW)

    if(temp)						// lcd panel open
    {
    	if(!bINVERTER_POWER)
    	{
    		INVERTER_POWER_ON();			
    		bINVERTER_POWER = 1;
    		bPOWER_LED_FLASH = 0;
    	}		
    }
    else									// lcd panel close
    {
    	if(bINVERTER_POWER)
    	{
    		INVERTER_POWER_OFF();			
    		bINVERTER_POWER = 0;
    		bPOWER_LED_FLASH = 1;
    	}   	
    }
    
    if(bINVERTER_POWER)						// lcd panel open
    {
		if(!bAMP_IS_ON && bPOWER_ON_MUTE_EXE)
		{
    		ENABLE_AMP();
    		bAMP_IS_ON = 1;
    	}
    }
    else									// lcd panel close
    {
		if(EAR_DETECT())			// earphone no plug in 
    	{
    		if(bAMP_IS_ON)
			{
    			DISABLE_AMP();
    			bAMP_IS_ON = 0;
    		}
    	} 
    	else						// earphone plug in 
    	{	if(!bAMP_IS_ON && bPOWER_ON_MUTE_EXE)
			{
    			ENABLE_AMP();
    			bAMP_IS_ON = 1;
    		}							
    	} 
    }
    
    #ifdef POWER_ON_MUTE
    if(!bPOWER_ON_MUTE_EXE)
    {
    	if(power_on_mute_timer >100 )	// power on to mute off time around 4.5S 
    	{
    		AUDIO_MUTE_OFF();
    		bPOWER_ON_MUTE_EXE = 1;
    		power_on_mute_timer = 0;
    	}
    	power_on_mute_timer++;
    }
    #endif    
    
    #ifdef POWER_LED_FLASH
    if(bPOWER_LED_FLASH)
    {
    	if( power_led_flash_timer < 100 )
    	{
    		power_led_flash_timer ++;
    		POWER_LED_ON();	   	
    	}    	
    	else
    	{
    		if((power_led_flash_timer>=100) & (power_led_flash_timer<=200))
            {
    			power_led_flash_timer ++;    		
    			POWER_LED_OFF();
    		}
    		else
    		    power_led_flash_timer = 0;
    	}	
    }
    else
    {
    	power_led_flash_timer = 0;
    	POWER_LED_OFF();
    }  
    #endif // end of POWER_LED_FLASH
      
    
    #ifdef TFT_VIDEO_INOUT
    }
    #endif //end #ifdef TFT_VIDEO_INOUT
        
    // Eastwin change to GPIO 18
    temp = regs0->gpio_in[LOWBAT_DET_GPIO / 16] & (1 << (LOWBAT_DET_GPIO % 16));
    if(!temp)	  
    {   
        bIS_LOWBAT = 0;			// Kevin Sep 10,04 
        if(bLOWBAT_DISP)
        {
        	bLOWBAT_DISP = 0;
        	ClearOsdMsg(2);
        	lowbat_timer=0;
        } 
    }
    else
    {
        bIS_LOWBAT = 1;			// Kevin Sep 10,04 		
        if (safe_on==1)			// Kevin Sep 10,04 
        	safe_srn_off();
        if(lowbat_timer<100)
        {
            PrintOsdMsg(STR_OS_LOWBAT,REGION2,0,0);
            lowbat_timer++;
            bLOWBAT_DISP = 1;
        }   
        else
        {
            if((lowbat_timer>=100) & (lowbat_timer<150))
            {
                ClearOsdMsg(2);
                lowbat_timer++;
                bLOWBAT_DISP = 0;
            }   
            else
            {    
                lowbat_timer = 0;
                bLOWBAT_DISP = 1;
            }
        }   
    }   
}

#elif defined (MALATA_GPS_DVD)// liulifeng add for malata gps portable dvd  2005-09-21
 void check_portable_gpio(void)
{
	UINT16 temp=0;
	
	#ifdef CHECK_PORTABLE_OPCLSW
    regs0->sft_cfg4 &= ~((0x03)<<2);    //Enable GPIO2,3 For COVER & TFT SW
    temp=GPIO_I_GET(3);  //get gpio16(COVER_SW)

    if(temp)
    {
      if(!CDOpened())
      {
        call_ir_func(IRC_EJECT);
        PrintOsdMsg(STR_OS_OPEN,REGION1,0,0);
      }   
    }
    else
    {
        if(CDOpened())
          call_ir_func(IRC_EJECT);
    }
	#endif    
 }

#else

void check_portable_gpio(void)
{
	UINT16 temp __UNUSED =0;
	
	#ifdef SUPPORT_SYS_POWER_ON_WAITING_MCUINFO //tianye 200607
       if(!flag_check_mcu_info)
       {
	   return;
       }
 	#endif//end=> #ifdef  SUPPORT_SYS_POWER_ON_WAITING_MCUINFO
	
	#ifdef REM_JPEG_DECODE_STATE
    if(jpeg_in_decode)
        return;
    #endif
  
    #ifdef TFT_VIDEO_INOUT
    static BYTE AVin_step = 0;
    
    INT_EXT_GPIO_INIT();
   
    switch (GPIO_I_GET(INT_EXT_VIDEO_GPIO))
    {
    case 0://8210 input video to TFT
        if((system_state == SYSTEM_OPEN) && (AVin_step == 1))
        {//just now system was interrupted in reading disc 
              if(CDOpened())
              {
                call_ir_func(IRC_EJECT);
                AVin_step = 0;
                //printf("i am going to read disc.......\n");
              }
        }
        else if((system_state == SYSTEM_STOP) && (AVin_step == 2))
        {//just now system was interrupted in normal playing state
                ircmd_play();
                AVin_step = 0;
                //printf("i am going to play disc.......\n");
        }
        #ifdef HOLD_KEY_DETECT//shenyj add 2006-9-12 03:06下午
        if(hold_state == 2)
            hold_state = 0;
        #endif 
        break;
    case 1://External AV input to TFT
        if(system_state == SYSTEM_READ_TITLE)
        {//in reading disc and 
            if(!CDOpened())
            {
              AVin_step = 1;
              call_ir_func(IRC_EJECT);
              //printf("video in when reading disc,then i go into open state\n");
            } 
            
        }
        else if(system_state == SYSTEM_BROWSE)
        {
            if(play_state != VCD_STATE_STOP)
            {
                AVin_step = 2;
                ircmd_stop();
                #ifdef STOP_LOADER
                stop_loader();
                #endif
                //printf("video in when playing disc,then i go into stop state\n");
            }
        } 
        #ifdef HOLD_KEY_DETECT//shenyj add 2006-9-12 03:06下午
        if(hold_state == 0)
            hold_state = 2;       
        #endif
        break;
    }
    
    if(!AVin_step)
    {
    #endif //end #ifdef TFT_VIDEO_INOUT
    
        #ifdef FIX_GAME_RETURN_OSD_ERR//tianye 200607
		extern  UINT32 Is_Dvb_State();
        #endif//end=> #ifdef FIX_GAME_RETURN_OSD_ERR	
	  
        #ifdef  DVB_DVD_8202
	    if((system_state!=SYSTEM_TS)
	       #ifdef IR_SWITCH_DVD_USB_CARD_AVIN_DVB
		   &&(source_play_mode==DVD_PLAY_MODE)
           #endif
	     #ifdef  FIX_GAME_RETURN_OSD_ERR//tianye 200607
                 &&(! Is_Dvb_State())
	      #endif//end=> #ifdef  FIX_GAME_RETURN_OSD_ERR
	   
	       ) 
	    {
        #endif

            #ifdef CHECK_PORTABLE_OPCLSW //Jack moved to here 06/04/11
            
            #ifdef IC_8202R //shenyj add 2007-7-6 10:39
            regs0->gpio_first[0]|= (0x1<<15);    //Set Pin128 as GPIO15
            GPIO_M_SET(PDVD_OPCLSW_GPIO,1);
            GPIO_E_SET(PDVD_OPCLSW_GPIO,0);
            #endif
            #if defined(SUNPLUS_8202P_DEMOBOARD)||defined(DVB_DVD_8202)
            regs0->sft_cfg4 &= ~((0x03)<<2);    //Enable GPIO2,3 For COVER & TFT SW
            #endif

            #if defined(MUSTEK_K100D_MODEL)
            GPIO_E_SET(DOOR_SENSE_GPIO,0);
            GPIO_E_SET(OPEN_TRAY_GPIO, 1);
            GPIO_E_SET(EJECT_KEY_GPIO, 0);
  
		    if(!(GPIO_I_GET(DOOR_SENSE_GPIO)))//关门状态
		    {	
			    #ifdef IR_SWITCH_DVD_USB_CARD_AVIN_DVB
			    if(source_play_mode == DVD_PLAY_MODE)
			    #endif
			    {			
				    if(!(GPIO_I_GET(EJECT_KEY_GPIO)))//eject键按下停机	//if(!GPIO_I_GET(3))//eject键按下停机
				    {	
				        #ifndef ADD_AUDIO_PLAY_WHEN_OPEN
				        GPIO_MUTE();// by justin 2005/11/01
				        #endif
			            //safe_srn_forceOFF();
			            //safe_srn_off();//xiaminmin050811     
			            //by justin 2005/09/26  get it away about saverscreen  by justin
			            if((full_scrn&SETUP) || (full_scrn&CUSTM))
			            { 
			                ExitSetupPage(1); // if in setup page ,exit it and open the door
			            }//xiaminmin050909
						else
						    osd_tog_region(0,OSD_OFF);
                        
                        t_disp = old_t_disp = 0;
						
						call_ir_func(IRC_EJECT);
           				PrintOsdMsg(STR_OS_OPEN,REGION1,0,0);
                        //bDoorStatus=1;
						if(system_state==SYSTEM_NODISC)//(system_state==SYSTEM_STOP))//||(pre_stop==0))//xiaminmin0580808
						{					
							delay_srv_10ms(50);//out 200ms plus
							GPIO_E_SET(OPEN_TRAY_GPIO, 1);  //GPIO_E_SET(7, 1); liutao 0126 for gpio modify
							GPIO_O_SET(OPEN_TRAY_GPIO, 0); //GPIO_O_SET(7, 0);
							GPIO_O_SET(OPEN_TRAY_GPIO, 1); //GPIO_O_SET(7, 1);//电磁阀动作
							delay_srv_10ms(20);//out 200ms plus
							GPIO_O_SET(OPEN_TRAY_GPIO, 0);  //GPIO_O_SET(7, 0);//电磁阀复位
						}
						else
						{
							extern void watchdog_renew(int n);
							watchdog_renew(WATCHDOG_RENEW_TIME);
							delay_srv_10ms(350);//xiaminmin050701
							GPIO_E_SET(OPEN_TRAY_GPIO, 1);  //GPIO_E_SET(7, 1); liutao 0126 for gpio modify
							GPIO_O_SET(OPEN_TRAY_GPIO, 0); //GPIO_O_SET(7, 0);
							GPIO_O_SET(OPEN_TRAY_GPIO, 1); //GPIO_O_SET(7, 1);//电磁阀动作
							delay_srv_10ms(20);//out 200ms plus
							GPIO_O_SET(OPEN_TRAY_GPIO, 0);  //GPIO_O_SET(7, 0);//电磁阀复位							
							watchdog_renew(WATCHDOG_RENEW_TIME);	
						}	
				        /*
						if(user_mute==1)
						{
						    ircmd_mute();
						}*/
						delay_srv_10ms(50);//out 200ms plus
					    GPIO_DEMUTE();   // by justin 2005/11/01
	                }	
		            else
		            {		
				        if(CDOpened())
             		        call_ir_func(IRC_EJECT);	
			        }
		        }
	        }	
		    else
		    {		
			    delay_srv_10ms(1);//防止开门时光头发光	
			    GPIO_MUTE();	 // by justin 2005/11/01
		    }
    
            #else//not K100D

            temp=GPIO_I_GET(PDVD_OPCLSW_GPIO);
    
            if(temp)
            {
                if(!CDOpened())
                {

⌨️ 快捷键说明

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