Exemplo n.º 1
0
static void remote_repeat_sr(unsigned long data)
{
	struct remote *remote_data = (struct remote *)data;
	u32 status;
	u32 timer_period;

	status = am_remote_read_reg(AM_IR_DEC_STATUS);
	switch (status & REMOTE_HW_DECODER_STATUS_MASK) {
	case REMOTE_HW_DECODER_STATUS_OK:
		remote_send_key(remote_data->input, (remote_data->cur_keycode >> 16) & 0xff, 0);
		repeat_flag = 0;
		break;
	default:
		am_remote_set_mask(AM_IR_DEC_REG1, 1);	//reset ir deocoder
		am_remote_clear_mask(AM_IR_DEC_REG1, 1);

		if (remote_data->repeat_tick != 0) {	//new key coming in.
			timer_period = jiffies + 10;	//timer peroid waiting for a stable state.
		} else {	//repeat key check
			if (remote_data->repeat_enable) {
				remote_send_key(remote_data->input, (remote_data->cur_keycode >> 16) & 0xff, 2);
			}
			timer_period = jiffies + msecs_to_jiffies(remote_data->repeat_peroid);
		}
		mod_timer(&remote_data->repeat_timer, timer_period);
		remote_data->repeat_tick = 0;
		break;
	}
static void ir_fiq_interrupt(void)
{
    int pulse_width;
    unsigned int current_jiffies = jiffies;

    if(current_jiffies - last_jiffies > 10)//means a new key
    {   
        //dbg("it is a new ir key\n");
        rec_idx = 0;
        rec_win.winNum = 0;
        last_jiffies = current_jiffies;
        return;//ignore first falling or rising edge
    }
    
    last_jiffies = current_jiffies;
    
    pulse_width = ( (am_remote_read_reg(AM_IR_DEC_REG1)) & 0x1FFF0000 ) >> 16 ;

    rec_idx++;
    if(rec_idx >= MAX_PLUSE)
        return;
    
    rec_win.winNum = rec_idx;
    rec_win.winArray[rec_idx-1] = (pulse_width<<1);
    //dbg("idx[%d]window width[%d]\n", rec_idx-1, pulse_width);
}