亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? nec_ir.c

?? ZORAN 962/966 SOURCE CODE,DVD chip
?? C
字號:
/* **************************************************************************************
 *  Copyright (c) 2002 ZORAN Corporation, All Rights Reserved
 *  THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF ZORAN CORPORATION
 *
 *  File: $Workfile: nec_ir.c $             
 *
 * Description:
 * ============
 * NEC IR implementation
 * 
 * Log:
 * ====
 * $Revision: 17 $
 * Last Modified by $Author: Rinata $ at $Modtime: 3/11/04 5:06p $ 
 ****************************************************************************************
 * Updates:
 ****************************************************************************************
 * $Log: /I76/I76_Common/I76_Reference/Remote/nec_ir/nec_ir.c $
 * 
 * 17    3/11/04 5:45p Rinata
 * cpu check remote signal after v8 wake it up when remote signal was
 * changed
 * 
 * 16    03-08-01 11:57 Wesleyj
 * remove video_mode_detect 
 * 
 * 15    7/09/03 6:05p Mikex
 * cancel transfer cpu_soft_reset() function on second standby key
 * pressed. The cpu_soft_reset() function will be transfered by core task.
 * 
 * 14    03-07-07 16:14 Ivany
 * Added a mapping table and condition for the keys which repeat-pressed
 * message should not be sent when is pressed.
 * 
 * 13    03-06-19 17:08 Wesleyj
 * add video_mode_detect charge  (Av in stat)
 * 
 * 12    03-06-17 18:28 Admin
 * Merge for ExinoII project
 * 
 * 11    03-05-19 18:54 Kennyz
 * Clear code.
 * 
 * 10    2/02/03 6:22p Lyncolnc
 * Added LONG_REPEAT_DELAY.
 * 
 * 12    17/07/02 20:25 Nirm
 * - Adjustments to timer_0 in order to increase timer-measurement
 * accuracy throughout the system.
 * 
 * 11    5/28/02 18:47 Rinata
 * FF and FB are not with valid repeat
 * 
 * 10    23/04/02 9:37 Nirm
 * - Added dependency in "Config.h".
 * 
 * 9     7/03/02 17:45 Nirm
 * Removed EMERGENCY_EJECT_ENABLED -> replaced by the Exceptioning
 * mechanism.
 * 
 * 8     18/02/02 11:01 Atai
 * make global to static
 * 
 * 7     2/17/02 12:21p Tomasp
 * Code clean up.
 * 
 * 6     1/28/02 19:55 Rinata
 * fix gen timer values for ir 
 * 
 * 5     9/01/02 16:58 Nirm
 * Corrected Include-Paths.
 * 
 * 4     1/06/02 15:46 Rinata
 * 
 * 3     1/01/02 19:10 Atai
 * Code cleaning
 * 
 * 2     25/12/01 12:29 Atai
 * Code cleaning
 **************************************************************************************** */

#include "Config.h"		// Global Configuration - do not remove!
#include "Kernel\ker_api.h"
#include "Kernel\eventdef.h"
#include "CPU\cpu_api.h"
#include "Playcore\Coremain\coremain.h"
#include "Playcore\Coremain\coredefs.h"
#include "Playcore\Coremain\coregdef.h"
#include "Devices\Remote\ir_api.h"
#include "Devices\Remote\ir_ll.h"
#include "UI_Manager\UI_Input\ui_input_ir.h"
#ifdef D_HOLD_SKIP_2S_AS_FAST_SCAN
#include "Kernel\Timers\Timers.h"
#endif
#ifdef I96_CPU_POWER_DOWN
#include "Dec_Power.h"
#endif


#ifdef  D_HOLD_STOP_3S_AS_EJECT_KEY		
#define IRKC_NULL		0xFF   
#define STOPKEY_DELAY	0x20   
#endif


#ifdef D_HOLD_SKIP_2S_AS_FAST_SCAN
//the time of 2 seconds for hold the skip key
#define SKIPKEY_DELAY  0x10 //counter value for about 2 seconds
//the time slice between two repeated skip key
#define HOLDSKIP_TIMEOUT_TIME 120 //millisecond

//the handler of the timer
static UINT8   hHoldSkipTimer = 0;
//used to remember we pressed skipf or skipr
static BYTE	lastSkipKey = 0xFF;
#endif //D_HOLD_SKIP_2S_AS_FAST_SCAN

extern CONST WORD g_ir_system_code;
extern CONST WORD g_ir_power_key_code;

#ifdef MODIFIED_FOR_T1_2002
extern const WORD g_ir_volume_up_key  ;//add for t1.
extern const WORD g_ir_volume_down_key  ;//
#endif

#ifdef I96_CPU_POWER_DOWN
extern BOOL bPowerUpKeyPressed;
extern BOOL bWakeFromPowerDown;
#endif

//the time increment for gen_time is 1.25us
#define IR_MARGIN		((WORD)130UL)
#define time_9000_us	((WORD)9000UL)
#define time_4500_us	((WORD)4500UL)
#define time_2250_us	((WORD)2250UL)
#define time_1125_us	((WORD)1125UL)

// State of the remote key decoder
#define IDLE		0
#define LEADER_ON	1
#define LEADER_OFF	2
#define CUSTOM		3
#define DATA1		4
#define DATA2		5

// Hoe many repeat message will ignire before send it to the FSM's
#ifdef LONG_REPEAT_DELAY
  #define REPEAT_DELAY 25
#else
  #define REPEAT_DELAY	5
#endif //LONG_REPEAT_DELAY

#ifdef	IR_NO_REPEAT_PULSE
	#define IR_INTERVAL		240/20
	BYTE	last_key = 0;
	BYTE	ir_interval = 0;
#endif
//<<<YY_ZCH 
#define	MAX_NO_REPEAT_PULSE_KEY_NUM            1
#define	IR_ENTER      0x73

CONST BYTE mkey_no_repeat_pluse[MAX_NO_REPEAT_PULSE_KEY_NUM]=
{
	IR_ENTER
};

#ifdef D_HOLD_SKIP_2S_AS_FAST_SCAN
/**********************************************************************************
 * Name			:	HoldSkipTimerIR
 * Purpose		:	The timeout function for hold skip key, when timeout happens, it will send out
 *                                the skip key user pressed.
 * Input			:   
 * Return Value	:
 * Description		:
 * Comments		:
**********************************************************************************/
#pragma argsused
static void HoldSkipTimerIR(UINT8 hTimer)
{
	send_remote_event((WORD)KEY_SOURCE_IR|lastSkipKey);
	timer_service_delete(hHoldSkipTimer);
}
#endif //D_HOLD_SKIP_2S_AS_FAST_SCAN

BOOL ir_need_no_repeat_pulse(BYTE uKey)
{
	int i;
	for(i=0;i < MAX_NO_REPEAT_PULSE_KEY_NUM;i++)
	{
		if(uKey == mkey_no_repeat_pluse[i])
			return TRUE;
	}
	//if(i == MAX_NO_REPEAT_PULSE_KEY_NUM)
	return FALSE;
}

//>>>YY_ZCH
static unsigned long time_count_old;

void ir_init(void)
{
	ir_interrupt_init( FALLING_EDGE );
	time_count_old = cpu_gen_timer();
}

void ir_isr( void )
{
	static BYTE		key;							// Hold the key code
	static BYTE		repeat_delay = REPEAT_DELAY;	// Repeat code counter
	static WORD		custom;							// Hold the custom (remote ID) code
	static BYTE		state = 0;						// State holder
	static BYTE		count;							// bits counter
	static BYTE		data1, data2;					// Temporary for holding the decoded data
	static BYTE		valid_repeat = 0;

#ifdef  D_HOLD_STOP_3S_AS_EJECT_KEY		
	static BYTE		lastkey = IRKC_NULL;
	static BYTE		stopkey_repeatDelay = REPEAT_DELAY;
#endif

#ifdef D_HOLD_SKIP_2S_AS_FAST_SCAN
	// 2 seconds timeout counter
	static BYTE		skipkey_repeatDealy = REPEAT_DELAY;
#endif

	unsigned long time_count, t0;	

#ifdef I96_CPU_POWER_DOWN
    if (bWakeFromPowerDown == TRUE)
    {
        DEC_PowerCpu(TRUE);       
    }
#endif

	time_count = cpu_gen_timer();	
	t0 = time_count - time_count_old;

   switch (state) {
	case IDLE:		
        
		time_count_old = time_count;
		ir_interrupt_set_edge(RISING_EDGE);
		state = LEADER_ON;
		break;
    case LEADER_ON:        
		time_count_old = time_count;
		ir_interrupt_set_edge(FALLING_EDGE);
        
		state =  ((t0>(time_9000_us-8*IR_MARGIN)) && (t0<(time_9000_us+8*IR_MARGIN))) ? LEADER_OFF:IDLE;
      
		break;
    case LEADER_OFF:    
		if (t0 > time_4500_us - (4*IR_MARGIN) && t0 < time_4500_us + (4*IR_MARGIN)) {
			state = CUSTOM;
			custom = 0;
			count = 0;
			repeat_delay = REPEAT_DELAY;
		} 
		else {
			if (t0 > time_2250_us - (2*IR_MARGIN) && t0 < time_2250_us + (2*IR_MARGIN)) {
#ifdef   D_HOLD_STOP_3S_AS_EJECT_KEY
				if(key == IRKC_STOP)
				{
					if(stopkey_repeatDelay)
						stopkey_repeatDelay--;
					else
					{
						if(lastkey != IRKC_EJECT)
						{
							send_remote_event((WORD)IRKC_EJECT&0x00FF);
							lastkey = IRKC_EJECT;         // Eject only once
							//lastkey = IRKC_STOP;      // Eject at STOPKEY_DELAY interval
							stopkey_repeatDelay = STOPKEY_DELAY;
						}     
					}
				}
				else
#endif //D_HOLD_STOP_3S_AS_EJECT_KEY
#ifdef D_HOLD_SKIP_2S_AS_FAST_SCAN
				if(IRKC_SKIPB == key || IRKC_SKIPF == key)
				{
					//reset the timer
					timer_service_enable(hHoldSkipTimer, TRUE);
					if(skipkey_repeatDealy)
					{
						skipkey_repeatDealy--;
					}
					else
					{
						//clear the timer
						timer_service_delete(hHoldSkipTimer);
						//translate the skip key to "hold" scan key
						if(IRKC_SKIPF == key)
						{
							send_remote_event((WORD)KEY_STATUS_HOLD|KEY_SOURCE_IR|IRKC_FASTF);
						}
						else
						{
							send_remote_event((WORD)KEY_STATUS_HOLD|KEY_SOURCE_IR|IRKC_FASTR);
						}							
					}
				}
				else
#endif //D_HOLD_SKIP_2S_AS_FAST_SCAN
				if (repeat_delay) {
					// Delay before sendnig the first repeat
					repeat_delay--;
				}
				else { // repeat last key
					if (valid_repeat) {//<<<YY_ZCH
						if(!ir_need_no_repeat_pulse(key))//>>>YY_ZCH 
						send_remote_event( (KEY_STATUS_HOLD|KEY_SOURCE_IR)|key );
					}
				}
			}

			ir_interrupt_set_edge(FALLING_EDGE);
			state = IDLE;
		}
		time_count_old = time_count;
		break;
    case CUSTOM:
		time_count_old = time_count;
		if (t0 > time_1125_us - IR_MARGIN && t0 < time_1125_us + IR_MARGIN) {
			custom <<= 1;	/* a zero bit */
		} 
		else {
			if (t0 > time_2250_us - (2*IR_MARGIN) && t0 < time_2250_us + (2*IR_MARGIN)) {
				custom = (custom << 1) | 1;	/* a one bit */
			} 
			else {
            {
				// Garbage ... ignored
				ir_interrupt_set_edge(FALLING_EDGE);
				state = IDLE;
				valid_repeat = 0;
				break;
            }
			}
		}

		/* count 16 'custom' bits */
		if (++count == 16) {
			if (custom != g_ir_system_code) {
				// Noise from other remote ... ignore
				ir_interrupt_set_edge(FALLING_EDGE);
				state = IDLE;
				valid_repeat = 0;
				break;
			}
			state = DATA1;
			time_count_old = time_count;
			count = 0;
			data1 = 0;
		}
		break;
    case DATA1:
		time_count_old = time_count;
		count++;
		if (t0 > time_1125_us - IR_MARGIN && t0 < time_1125_us + IR_MARGIN) {
			data1 <<= 1;	/* a zero bit */
		} 
		else {
			if (t0 > time_2250_us - (2*IR_MARGIN) && t0 < time_2250_us + (2*IR_MARGIN)) {
				data1 = (data1 << 1) | 1;	/* a one bit */
			} 
			else {
            {
				ir_interrupt_set_edge(FALLING_EDGE);
				state = IDLE;
				valid_repeat = 0;
				break;
            }
			}
		}
		if (count == 8) {
			state = DATA2;
			count = 0;
			data2 = 0;
		}
		break;
    case DATA2:
		time_count_old = time_count;
		count++;
		if (t0 > time_1125_us - IR_MARGIN && t0 < time_1125_us + IR_MARGIN) {
			data2 <<= 1;	/* a zero bit */
		} 
		else { 
			if (t0 > time_2250_us - (2*IR_MARGIN) && t0 < time_2250_us + (2*IR_MARGIN)) {
				data2 = (data2 << 1) | 1;	/* a one bit */
			} 
			else {
            {
				ir_interrupt_set_edge(FALLING_EDGE);
				state = IDLE;
				valid_repeat = 0;
				break;
            }
			}
		}
		if (count == 8) {      	
			ir_interrupt_set_edge(FALLING_EDGE);
			state = IDLE;
			if (data1 == (~data2 & 0xff)) 
			{ // Check if data is valid
				key = (0x00FF&data1);

/* Removed by NirM 07-Mar-02: Replaced by the Exceptioning mechanism
// Emergency eject
#ifdef EMERGENCY_EJECT_ENABLED
				if((key == IRKC_EJECT)
					&&((gcs.mstate == MST_LOADING)||(gcs.mstate == MST_DISC_READY)))
				{
					gcs.bEmergencyEject = TRUE;
				}
#endif
*/

#ifdef	IR_NO_REPEAT_PULSE
				if (((last_key&0x00FF) == key) && (ir_interval != 0)) {	/* If a key was pushed continuously. */
				}
				else {
#endif

					valid_repeat = 1;  //allow key repeat  
#ifdef D_HOLD_STOP_3S_AS_EJECT_KEY
					if(key == IRKC_STOP)
					{
						stopkey_repeatDelay = STOPKEY_DELAY;
						lastkey = IRKC_NULL;
					}       
#endif //D_HOLD_STOP_3S_AS_EJECT_KEY

#ifdef D_HOLD_SKIP_2S_AS_FAST_SCAN
					if(IRKC_SKIPF == key || IRKC_SKIPB == key)
					{
						lastSkipKey = key;
						skipkey_repeatDealy = SKIPKEY_DELAY;
						hHoldSkipTimer = timer_service_create(HoldSkipTimerIR, HOLDSKIP_TIMEOUT_TIME, TIMER_ONCE |TIMER_DISABLED);
						timer_service_enable(hHoldSkipTimer, TRUE);	
						//when press the skip key or press down the skip key first,
						//we just ignore it here. It will be sent out when "holdkey" timeout happens.
						break;
					}

#endif //D_HOLD_SKIP_2S_AS_FAST_SCAN

					if (key == (BYTE)(0x00FF&g_ir_power_key_code))	
					{ 
						switch(g_power_state)
						{
							case POWER_SEQUENCE_IN_ON_STATE:
								g_power_state = POWER_SEQUENCE_OFF_REQUESTED;
								break;

							case POWER_SEQUENCE_IN_OFF_STATE:
								g_power_state = POWER_SEQUENCE_ON_REQUESTED;
								break;

							case POWER_SEQUENCE_OFF_REQUESTED:
								g_power_state = POWER_SEQUENCE_ON_REQUESTED;
							//03-07-09	cpu_soft_reset();
						}
					}
#ifdef I96_CPU_POWER_DOWN
					if(	key == (BYTE)g_ir_power_key_code )
					{
						bPowerUpKeyPressed = TRUE;
					}
#endif
					send_remote_event(KEY_SOURCE_IR|key);



#ifdef	IR_NO_REPEAT_PULSE
					last_key = key;
					ir_interval = IR_INTERVAL;
				}
#endif
			}
		}
		break;
    }
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品中文字幕一区二区小辣椒| 91精品国产麻豆国产自产在线 | 欧美色欧美亚洲另类二区| 69堂精品视频| 亚洲欧美在线观看| 麻豆成人久久精品二区三区红 | 4hu四虎永久在线影院成人| 久久久噜噜噜久久中文字幕色伊伊 | 国产精品系列在线观看| 欧美久久久久久蜜桃| 中文字幕亚洲视频| 国产成人精品亚洲日本在线桃色 | 成人国产精品免费观看视频| 日韩手机在线导航| 日韩精品电影在线| 91福利国产精品| 久久久精品免费网站| 久久国产精品第一页| 欧美片在线播放| 亚洲精品乱码久久久久久久久| 大桥未久av一区二区三区中文| 日韩欧美在线1卡| 日本成人中文字幕| 欧美撒尿777hd撒尿| 亚洲激情自拍视频| 91精品办公室少妇高潮对白| 国产精品另类一区| 国产91色综合久久免费分享| 精品国产乱码久久久久久闺蜜| 日本伊人午夜精品| 日韩欧美综合一区| 狠狠色综合播放一区二区| 日韩精品最新网址| 极品少妇一区二区| 国产夜色精品一区二区av| 久久草av在线| 国产日韩欧美一区二区三区乱码| 久久99国产乱子伦精品免费| 精品日产卡一卡二卡麻豆| 久久99国产精品尤物| 久久久激情视频| 不卡av在线免费观看| 中文字幕日韩精品一区| 99re免费视频精品全部| 亚洲欧美电影一区二区| 色狠狠av一区二区三区| 图片区日韩欧美亚洲| 欧美成人性福生活免费看| 国产一区二区电影| 国产精品伦理一区二区| 色婷婷亚洲一区二区三区| 亚洲一区二区av在线| 日韩亚洲欧美中文三级| 国产精品亚洲一区二区三区在线| 国产精品国产三级国产普通话蜜臀 | 亚洲视频一二三区| 欧美日韩成人综合天天影院| 麻豆精品一区二区综合av| 中文字幕欧美国产| 欧美自拍偷拍一区| 精品亚洲国内自在自线福利| 亚洲私人影院在线观看| 欧美老肥妇做.爰bbww| 国产精品中文字幕欧美| 一区二区三区在线视频免费观看| 91精品啪在线观看国产60岁| 精品写真视频在线观看| 亚洲激情一二三区| 精品久久人人做人人爱| 色偷偷久久人人79超碰人人澡| 视频一区欧美精品| 国产精品系列在线| 欧美一区二区三区四区在线观看| 高清成人免费视频| 天天影视网天天综合色在线播放| 国产视频一区在线观看| 欧美在线三级电影| 国产成人一级电影| 五月综合激情婷婷六月色窝| 国产免费成人在线视频| 欧美一区二区三区四区高清| 丰满亚洲少妇av| 日本不卡高清视频| 依依成人综合视频| 国产午夜精品福利| 欧美大黄免费观看| 欧美日韩视频第一区| jiyouzz国产精品久久| 精品在线一区二区三区| 一区二区三区美女视频| 欧美国产精品专区| 精品处破学生在线二十三| 欧美日韩成人综合| 色久综合一二码| 成人av网址在线| 国产一区二区三区在线观看免费视频| 亚洲第一二三四区| 一片黄亚洲嫩模| 亚洲视频你懂的| 国产精品久久毛片| 国产亚洲一区二区在线观看| 日韩欧美激情在线| 欧美人妇做爰xxxⅹ性高电影 | 日韩丝袜美女视频| 在线播放视频一区| 欧美日韩欧美一区二区| 一本大道久久a久久综合婷婷 | 欧美三级乱人伦电影| 一本色道久久综合亚洲aⅴ蜜桃 | 亚洲一区二区三区中文字幕| 中文字幕在线一区| 国产精品高清亚洲| 亚洲日韩欧美一区二区在线| 国产精品灌醉下药二区| 国产精品午夜在线观看| 国产精品久久久久天堂| 中文字幕一区二区不卡| 国产精品久久久久久一区二区三区| 26uuu亚洲综合色| 久久久久久久久久久久久夜| ww亚洲ww在线观看国产| 欧美精品一区二区在线观看| 久久九九久精品国产免费直播| 久久精品综合网| 中文字幕永久在线不卡| 亚洲精品欧美在线| 日韩精品久久理论片| 蜜桃视频一区二区三区 | 久久精品夜色噜噜亚洲aⅴ| 久久精品一区二区三区四区| 国产肉丝袜一区二区| 专区另类欧美日韩| 亚洲国产精品一区二区www在线 | 日韩毛片高清在线播放| 亚洲妇熟xx妇色黄| 美女被吸乳得到大胸91| 国产999精品久久| 日本韩国欧美一区| 欧美丰满美乳xxx高潮www| 欧美一区二区在线看| 久久久不卡网国产精品一区| 亚洲日本护士毛茸茸| 性欧美疯狂xxxxbbbb| 国内精品自线一区二区三区视频| 亚洲成人资源在线| 国产真实乱对白精彩久久| jvid福利写真一区二区三区| 欧美在线观看18| 久久久亚洲精品一区二区三区| 综合中文字幕亚洲| 麻豆精品一区二区| av亚洲精华国产精华精| 91精品国产一区二区人妖| 国产欧美精品日韩区二区麻豆天美 | 毛片一区二区三区| 成人av在线播放网站| 欧美裸体一区二区三区| 欧美激情一区二区三区蜜桃视频| 亚洲在线免费播放| 国产黄人亚洲片| 欧美日韩aaaaaa| 国产精品久久看| 奇米影视7777精品一区二区| 99精品视频一区二区三区| 日韩免费性生活视频播放| 亚洲三级免费观看| 国产精品18久久久| 91精品国产日韩91久久久久久| 国产精品天天摸av网| 日本视频一区二区| 在线亚洲一区观看| 国产亚洲一区二区在线观看| 丝袜国产日韩另类美女| 99视频精品免费视频| 久久久亚洲综合| 免费成人在线观看| 欧美日韩精品免费观看视频| 国产精品久久久久毛片软件| 国内精品久久久久影院色| 91精品国产丝袜白色高跟鞋| 一区二区三区在线免费播放 | 激情文学综合网| 欧美乱妇20p| 亚洲一区二区在线观看视频| av电影在线不卡| 亚洲国产精品传媒在线观看| 国产在线精品一区二区| 欧美一级高清片| 日韩一区欧美二区| 欧美日韩国产小视频在线观看| 亚洲柠檬福利资源导航| av电影天堂一区二区在线观看| 国产亚洲欧美激情| 国产成人免费视频一区| 久久奇米777| 狠狠色丁香婷综合久久| 精品va天堂亚洲国产| 狠狠色2019综合网| 国产网站一区二区| 成人一区二区三区中文字幕|