ir_parser.c

来自「OSD显示,单片机实现,ICCAVR! 代码风格严谨,为高人所写.我仅为了上传换」· C语言 代码 · 共 1,847 行 · 第 1/4 页

C
1,847
字号
/*****************************************************************************
** FILE
** ir_parse.c
**
** DESCRIPTION
** process IR keys and send to ir_cmd_xxx for actual process
**
**   creater: Terry
**
**
**
****************************************************************************/

#include "config.h"
#include "regmap.h"
#include "global.h"

#ifdef PMP_UI    //////////////////////yangli   2005/5/20
#include "fsNAV.h"
#endif


#include "cfont.h"
#include "func.h"
#include "sio.h"
#include "ircmd.h"
#include "ircode.h"
#include "user_init.h"
#include "iop.h"
#include "atapi_if.h"
#include "macro.h"
#include "osd.h"
#include "bitop.h"
#include "timer.h"
#include "kernel.h"
#include "memcfg.h"
#ifdef SUPPORT_MIDI
#include "fsmidi.h"                //ouyang  2004.08.13 take apart the function of "up" key
#ifdef SUPPORT_MIDI_MENU_SEL     xlluo 2004.11.23
#include "fsmidiUI.h"
#endif
#endif
#ifdef AD_TCL//2004-3-22 13:11 lijd
#include "user_if.h"
#endif
#ifdef NEWSTYLE_WINDOW
#include "vpp.h"
#include "osd_arc.h"
#endif
#ifdef EASTWIN
#include "gpio.h"//tulijuan040908
#endif

#ifdef TAS3001_AMP
#include "ti3001.h"
#endif

#ifdef TAS5026_AMP
#include "ti5026.h"
#endif

#ifdef DIVX_DRM
#include "DRM_UI.h"
#endif

//#define ssc_watch_ir_code   1

#ifndef DVDRELEASE
#define IR_DBG  //terry,2004/2/19 05:04PM,pls don't mark it.
#define MONE_DSP24_SHOW_CODEC_NAME_BY_ANGLE_KEY       // 2004/12/21 yltseng
#endif

#ifdef JPG_EFFECT
#include "jpegeffect.h"
#endif

#ifdef SUPPORT_REP_READ
#include "read.h"
#endif

#ifdef SUPPORT_DISPLAY_MENU
#include "setup_def.h"
#endif

#ifdef QSI_SHOW_ERR_RATE
#include "uart.h"
#endif

#ifdef SUPPORT_RECEIVER  //chenzhao20050620
#include "amp_gui.h"
#endif

#ifdef NEW_PARENTAL_GUI//zhaoyanhua add 2004-2-9 13:02
extern BYTE new_parental_gui;
#elif defined(MODIFY_PARENTAL_GUI)
extern BYTE parental_gui_flag;
#endif//NEW_PARENTAL_GUI

#if defined(NEW_PARENTAL_GUI)||defined(MODIFY_PARENTAL_GUI) 
extern void ExitParentalGUI(void);
#endif

#define CLS_ERR_KEY

#ifdef PRE_NEXT_FLAG        
UINT8 PRE_FLAG;
UINT8 NEXT_FLAG;
#endif  //axel, for invalid IRC_NEXT in bad discs 2004/7/12 

//extern void osd_restore();
extern BYTE Is_JPEG_STATE();
extern UINT32 save_srn_start_t;
extern int is_dvd_prohibit_key(void);
extern int is_menu(void); // in cderr.c
extern void init_ir_num(void);
extern void osdshow(UINT8 r,char *buf);

#ifdef TP6317_PANNEL   //yaowh add 04-10-25
   BYTE TP6317_Power = 0 ;
#endif

#ifdef NEW_UART_COMMAND            //lijinhai for fuss new request
extern BYTE nCurrentVolMode;
#endif

#ifdef NEWSTYLE_WINDOW
extern void exit_browse_func(void);
#endif

#ifdef JPG_EFFECT
extern void FSGUI_Menu(void);
#endif

#ifdef SUPPORT_TUNER
extern void tuner_key(BYTE key);
#endif

#ifdef DOUBLE_TITLE //susu add 2003-8-27 13:55
extern void exit_double_title(void);
#endif

#ifdef  ROTARY_VOLUME
extern void RotaryStateChk(void);
#endif

extern BYTE setup_IsSettingPassword(void);

#ifdef HELP_BMP_GUI
    #define HELP_PAGE_COUNT 4
#else
    #define HELP_PAGE_COUNT 3
#endif

void ircmd_null(){}

#ifdef QSI_PLATFORM //qsi: added by johnson 20040812
extern void spi_cmd_switch_media_to_card(void);
extern void spi_cmd_switch_media_to_dvd(void);

void ircmd_card_cd_select(void)
{
#ifdef SUPPORT_CARD_STORAGE
    if( source_type_now == source_disc)
    {
        spi_cmd_switch_media_to_card();
    }
    else
    {
        spi_cmd_switch_media_to_dvd();
    }
#endif
}
#endif

//nono 5-5-9 12:48 move it to irc_function_name_tbl.c
#include "irc_function_name_tbl.c"

//nono 5-5-9 12:48 move it to irc_function_name_tbl_spi_qsi.c
#include "irc_function_name_tbl_spi_qsi.c"


//Marked by maoyong 2004-9-24 10:50, now just use a function to set proc func pointer

#ifdef SUPPORT_NESGAME
BYTE Game_GetBreakIr(BYTE i)
{
    switch(i)
    {
        case 0:return IR_EJECT;
        case 1:return IR_POWER;
        case 2:return IR_STOP;
        case 3:return IR_RETURN;
        case 4:return IR_POWER2; 
        case 5:return IR_RETURN2;        
        case 6:return IR_VOLUME_DOWN;
        case 7:return IR_VOLUME_UP;
        default: return 0xff;//terry,2004/2/2 04:35PM
    }
}

#ifdef SUPPORT_IR_GAME
BYTE Game_GetControlIr(BYTE i)
{
    switch(i)
    {
        case 0:return IR_RIGHT;
        case 1:return IR_LEFT;
        case 2:return IR_DOWN;
        case 3:return IR_UP;
        case 4:return IR_START; //terry,mark it,2004/2/2 04:35PM
        case 5:return IR_SELECT;
        case 6:return IR_A_KEY;
        case 7:return IR_B_KEY;
        case 8:return IR_RIGHT_UP;
        case 9:return IR_LEFT_UP;
        case 10:return IR_RIGHT_DOWN;
        case 11:return IR_LEFT_DOWN;        
        case 12:return IR_RIGHT2;
        case 13:return IR_LEFT2;
        case 14:return IR_DOWN2;
        case 15:return IR_UP2;
        case 16:return IR_START2; //terry,mark it,2004/2/2 04:35PM
        case 17:return IR_SELECT2;
        case 18:return IR_A_KEY2;
        case 19:return IR_B_KEY2;        
        default: return 0xff;//terry,2004/2/2 04:35PM
    }
}
#endif

#endif


//nono 5-5-9 12:37 move to ir_inv_tbl_include.c
#include "ir_inv_tbl_include.c"

int user_input_pwd=0;

void cancel_rep(void)
{
     
     if((rep_mode != REPEAT_IDLE)||(rep_ab_mode != REPEAT_AB_IDLE))
     {
        OSD1000ISP_STATUS(OSDISP_REP_IDLE, OSDIR_REPEAT);

        //2005.3.23, joshua, this string is too long for osd region2 on 16m platform
        #ifdef OP_PLAYMODE//libing 2005-5-26 20:45
        	PrintOsdMsg(STR_OS_REP_CNL,REGION2,1,0);
        #endif	
        #ifndef  SDRAM_16Mb_Mode
            PrintOsdMsg(STR_OS_REP_CNL,REGION2,1,0);
        #endif
        
        rep_mode    = REPEAT_IDLE;
        rep_ab_mode= REPEAT_AB_IDLE;
     }
}

#ifdef NEW_STYLE_SETUP
extern UINT8 logo_type;//NEW STYLE SETUP FOR GBM 
#endif//NEW_STYLE_SETUP

#if defined( SUPPORT_FONT_UTIL ) && defined( SUPPORT_MULTI_FONT_SWITCH )   // 2005/03/10 yltseng
#include "fsNav.h"
#include "fsGUI.h"
#include "LanguageUtil.h"

static UINT8   s_uiNeedReadFileInformation = FALSE;

void ReadFileInformation()
{
    if( !s_uiNeedReadFileInformation )
        return;

    #define FSJPEG_BUF_OFFSET  ( ( sizeof( FSJPEGDATA ) >> 2 ) << 2 )
    
    FSJPEGDATA* pTmp = (FSJPEGDATA*) ( (UINT32)pFsJpeg + FSJPEG_BUF_OFFSET );
    memcpy( pTmp, pFsJpeg, sizeof( FSJPEGDATA ) );

    int iRes = 0;
    ReadFile( &iRes );

    memcpy( pFsJpeg, pTmp, sizeof( FSJPEGDATA ) );
    
    s_uiNeedReadFileInformation = FALSE;
}

static inline   ChangeFontByAngleKey( BYTE rx )
{
    if( rx == IRC_ANGLE )
    {
        if( cd_type_loaded == CDROM )
        {
            NextFont();

            s_uiNeedReadFileInformation = TRUE;
            
            if( !IsOtherStatePlayMode() )
            {
            	#ifndef PMP_UI
                ReadFileInformation();
                #endif                             
                extern BYTE JPEG_Preview_drawed;
    
                if( ( IsOtherStatePlayMode() && GetCurrentFileType() == CDROM_MP4 ) ||
                    ( ( pFsJpeg->gifsFuncBtn == FS_FUNC_JPEG ) && 
                      ( ( pFsJpeg->gifsState == FS_STATE_JPEG ) 
#if defined( FS_BMP_GUI ) || defined( NEW_MP3_GUI )
                        || ( pFsJpeg->g_nJpegMode == JPEG_THUMBNAIL_MODE )
#endif
                      ) ) )
                {
                    // do nothing
                }
                else
                {
                    if( Is_JPEG_STATE() && JPEG_Preview_drawed == JPEG_PREVIEW_IN_DIR_AREA )
                        FSGUI_Menu();
                   #ifdef PMP_UI
                     FSGUI_Refresh_PMP();
                     FSGUI_DirList(pFsJpeg->hdd_dir_current);
                     ShowHL(); 
                   #else
                    FSGUI_Refresh();
                   #endif
                   
                   
                    
                        
                }
            }
        }
        else
        {
            s_uiNeedReadFileInformation = FALSE;
        }
    }
}
#else
#define ChangeFontByAngleKey( rx )
#endif

#ifdef MONE_DSP24_SHOW_CODEC_NAME_BY_ANGLE_KEY  // 2005/02/18 yltseng
static inline void ShowDSPCodecNameByAngleKey( BYTE rx )
{
    if( rx == IRC_ANGLE )
    {     
        extern void DSP_GetCodecIDString( char* pBuf );
        extern void DSP_GetCodecVersionString( char* pBuf );
        
        char aID[32];
        DSP_GetCodecIDString( aID );
    
        char aVer[4];
        DSP_GetCodecVersionString( aVer );
        
        char aBuf[36];
        psprintf( aBuf, "%s %s", aID, aVer );
        
        psprintf(linebuf, "dsp info : %s\n", aBuf );
        io_write_wait(linebuf);
        ConvertLowerCaseToUpperCase( aBuf );
        osdshow( REGION1, aBuf );
    }
}
#else
#define ShowDSPCodecNameByAngleKey( rx )
#endif

static inline UINT32 RejectBySWD( BYTE rx __attribute__((unused)))
{
    BYTE res;
    res = FALSE;
    #ifdef SUPPORT_PLAY_SWD
    extern BYTE SWD_CheckIrcmd(BYTE rx);

    if( START_POLLING_SWD )
    {
        res = SWD_CheckIrcmd(rx);
    }
    #endif

    return res;
}
extern BYTE GetCurrentFileType();
void ircmd_pre_paser(BYTE rx)
{
    UINT8 need_run_cmd=1,display_again=0;//terry,0513 
    UINT32 invalid=ir_invalid_state[rx];
    #ifdef IR_DBG
    //printf("ir pre-parser in\n");    
    #endif
	
#if 0//ef SUPPORT_SMF	//add by xjliu for input device of flash driver 05-06-29
	extern UINT16 FlashKeyValue;
	if (FlashKeyValue == 0 && FlashIsEnable)//(FlashIsEnable)
	{
		switch(rx)
		   {
		        case IRC_UP:
				printf("xjliu:UP\n");
				FlashKeyValue = 1;
				//break;
				return;
		        case IRC_DOWN:
				printf("xjliu:DOWN\n");
				FlashKeyValue = 2;
				//break;
				return;
		        case IRC_LEFT:
				printf("xjliu:LEFT\n");
				FlashKeyValue = 3;
				//break;
				return;
		        case IRC_RIGHT:
				printf("xjliu:RIGHT\n");
				FlashKeyValue = 4;
				//break;
				return;
		        case IRC_TITLEMENU:
				printf("xjliu:SPACE\n");
				FlashKeyValue = 5;
				//break;
				return;
		        case IRC_RETURN:
				printf("xjliu:ENTER\n");
				FlashKeyValue = 6;
				//break;
				return;
			 case IRC_STOP:
			 	printf("xjliu:STOP flash\n");
			 	FlashKeyValue = 7;
			 	return;
			 case IRC_EJECT:
			 case IRC_POWER:
			 	break;
		        default:
				return;
		   }
	}
    #endif
   
    #ifdef OP_PLAYMODE//libing 2005-4-13 01:10
       if(full_scrn==OP_MENU)
    {
        if(!((rx==IRC_SELECT)||(rx==IRC_UP)||(rx==IRC_DOWN)
        ||(rx==IRC_LEFT)||(rx==IRC_RIGHT)||(rx==IRC_MODE)))
        {            	
            	exit_op_menu();
            	 
     }
    }
    #endif
   
   #ifdef FILE_MODE_WRITE//added by wangwei,2005-1-25 16:21
   if(rx == IRC_FM_WRITE)
        play_state = VCD_STATE_NORMAL;
   #endif

#ifdef SUPPORT_MIDI_MENU_SEL
   printf("polling_rotary bHoldInput %d\n",bHoldInput);
        //may be I should set a critical section      

⌨️ 快捷键说明

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