当前位置: 首页>>代码示例>>C++>>正文


C++ enable_irq函数代码示例

本文整理汇总了C++中enable_irq函数的典型用法代码示例。如果您正苦于以下问题:C++ enable_irq函数的具体用法?C++ enable_irq怎么用?C++ enable_irq使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了enable_irq函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

void main()
{
    OLED_Init();           //初始化oled
    qd=1;
    ftm_pwm_init(FTM0,FTM_CH3,10000,0);
    ftm_pwm_init(FTM0,FTM_CH4,10000,0);
    ftm_pwm_init(FTM2,FTM_CH0,10000,0);
    ftm_pwm_init(FTM2,FTM_CH1,10000,0);
    adc_init (ADC1_SE10);
    adc_init (ADC1_SE11);
    adc_init (ADC1_SE12);
    adc_init (ADC1_SE13);                               //按键初始化
    gpio_init (PTA13, GPI,HIGH);//拨码开关初始化
    gpio_init (PTA19, GPI,HIGH);
    gpio_init (PTA24, GPI,HIGH);
    gpio_init (PTA25, GPI,HIGH);
    gpio_init (PTA26, GPI,HIGH);
    gpio_init (PTA27, GPI,HIGH);
    gpio_init (PTA28, GPI,HIGH);
    gpio_init (PTA29, GPI,HIGH);

    led_init (LED0);
    mpu6050_init();

    lptmr_delay_ms(1000);

    gyro_zero=ad_ave(100);

    gyro_zero1=ad_ave1(100);

    mpu6050_read();

    accel_accel=(accel_x-accel_zero)/16384.0;
    if(accel_accel>1)   accel_accel=1;
    if(accel_accel<-1)  accel_accel=-1;
    angle_fuse=180/pi*(asin(accel_accel));

    accel_accel1=(accel_y-accel_zero1)/16384.0;
    if(accel_accel1>1)   accel_accel1=1;
    if(accel_accel1<-1)  accel_accel1=-1;
    angle_fuse1=180/3.1415926*(asin(accel_accel1));

    pit_init_ms(PIT0, 5);                                //初始化PIT0,定时时间为: 5ms
    set_vector_handler(PIT0_VECTORn ,PIT0_IRQHandler);      //设置PIT0的中断服务函数为 PIT0_IRQHandler
    enable_irq (PIT0_IRQn);                                 //使能PIT0中断

    uart_init(UART3, 115200);
    while(aa<200);   //初始化 1秒


    DIP_switch();
    while(1)
    {


        //display[0]=angle_fuse;
        //display[1]=angle_fuse1;
        display[0]=angle_fuse3;



        oledplay();


        if(flag==1)
            mode1();
        else if (flag==2)
            mode2();
        else if (flag==3)
            mode3();
        else if (flag==4)
            mode4();



        vcan_sendware((unsigned char *)display, 20);

    }
}
开发者ID:chenxuuu,项目名称:15-nuedc-wind-pendulum,代码行数:79,代码来源:main.c

示例2: gpio_keypad_timer_func

static enum hrtimer_restart gpio_keypad_timer_func(struct hrtimer *timer)
{
    int out, in;
    int key_index;
    int gpio;
    struct gpio_kp *kp = container_of(timer, struct gpio_kp, timer);
    struct gpio_event_matrix_info *mi = kp->keypad_info;
    unsigned gpio_keypad_flags = mi->flags;
    unsigned polarity = !!(gpio_keypad_flags & GPIOKPF_ACTIVE_HIGH);

    out = kp->current_output;
    if (out == mi->noutputs) {
        out = 0;
        kp->last_key_state_changed = kp->key_state_changed;
        kp->key_state_changed = 0;
        kp->some_keys_pressed = 0;
    } else {
        key_index = out * mi->ninputs;
        for (in = 0; in < mi->ninputs; in++, key_index++) {
            gpio = mi->input_gpios[in];
            if (gpio_get_value(gpio) ^ !polarity) {
                if (kp->some_keys_pressed < 3)
                    kp->some_keys_pressed++;
                kp->key_state_changed |= !__test_and_set_bit(
                                             key_index, kp->keys_pressed);
            } else
                kp->key_state_changed |= __test_and_clear_bit(
                                             key_index, kp->keys_pressed);
        }
        gpio = mi->output_gpios[out];
        if (gpio_keypad_flags & GPIOKPF_DRIVE_INACTIVE)
            gpio_set_value(gpio, !polarity);
        else
            gpio_direction_input(gpio);
        out++;
    }
    kp->current_output = out;
    if (out < mi->noutputs) {
        gpio = mi->output_gpios[out];
        if (gpio_keypad_flags & GPIOKPF_DRIVE_INACTIVE)
            gpio_set_value(gpio, polarity);
        else
            gpio_direction_output(gpio, polarity);
        hrtimer_start(timer, mi->settle_time, HRTIMER_MODE_REL);
        return HRTIMER_NORESTART;
    }
    if (gpio_keypad_flags & GPIOKPF_DEBOUNCE) {
        if (kp->key_state_changed) {
            hrtimer_start(&kp->timer, mi->debounce_delay,
                          HRTIMER_MODE_REL);
            return HRTIMER_NORESTART;
        }
        kp->key_state_changed = kp->last_key_state_changed;
    }
    if (kp->key_state_changed) {
        if (gpio_keypad_flags & GPIOKPF_REMOVE_SOME_PHANTOM_KEYS)
            remove_phantom_keys(kp);
        key_index = 0;
        for (out = 0; out < mi->noutputs; out++)
            for (in = 0; in < mi->ninputs; in++, key_index++)
                report_key(kp, key_index, out, in);
    }
    if (!kp->use_irq || kp->some_keys_pressed) {
        hrtimer_start(timer, mi->poll_time, HRTIMER_MODE_REL);
        return HRTIMER_NORESTART;
    }

    /* No keys are pressed, reenable interrupt */
    for (out = 0; out < mi->noutputs; out++) {
        if (gpio_keypad_flags & GPIOKPF_DRIVE_INACTIVE)
            gpio_set_value(mi->output_gpios[out], polarity);
        else
            gpio_direction_output(mi->output_gpios[out], polarity);
    }
    for (in = 0; in < mi->ninputs; in++)
        enable_irq(gpio_to_irq(mi->input_gpios[in]));
    wake_unlock(&kp->wake_lock);
    return HRTIMER_NORESTART;
}
开发者ID:chunyenho,项目名称:RTS-hw2,代码行数:79,代码来源:gpio_matrix.c

示例3: fs_enet_netpoll

static void fs_enet_netpoll(struct net_device *dev)
{
       disable_irq(dev->irq);
       fs_enet_interrupt(dev->irq, dev);
       enable_irq(dev->irq);
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:6,代码来源:fs_enet-main.c

示例4: mstar_gflip_drv_resume

static int mstar_gflip_drv_resume(struct platform_device *dev)
{
    MDrv_GFLIP_Resume(&_gflip_regs_save);
    enable_irq(E_IRQ_GOP);
    return 0;
}
开发者ID:nightcap79,项目名称:kogan-tv-gpl,代码行数:6,代码来源:mdrv_gflip_io.c

示例5: msm_ehci_resume

static int msm_ehci_resume(struct msm_hcd *mhcd)
{
	struct msm_usb_host_platform_data *pdata;
	struct usb_hcd *hcd = mhcd_to_hcd(mhcd);
	unsigned long timeout;
	unsigned temp;
	int ret;

	pdata = mhcd->dev->platform_data;

	if (!atomic_read(&mhcd->in_lpm)) {
		dev_dbg(mhcd->dev, "%s called in !in_lpm\n", __func__);
		return 0;
	}

	if (mhcd->pmic_gpio_dp_irq_enabled) {
		disable_irq_wake(mhcd->pmic_gpio_dp_irq);
		disable_irq_nosync(mhcd->pmic_gpio_dp_irq);
		mhcd->pmic_gpio_dp_irq_enabled = 0;
	}
	wake_lock(&mhcd->wlock);

	/* Vote for TCXO when waking up the phy */
	ret = msm_xo_mode_vote(mhcd->xo_handle, MSM_XO_MODE_ON);
	if (ret)
		dev_err(mhcd->dev, "%s failed to vote for "
			"TCXO D0 buffer%d\n", __func__, ret);

	clk_prepare_enable(mhcd->core_clk);
	clk_prepare_enable(mhcd->iface_clk);

	if (!pdata->mpm_xo_wakeup_int)
		msm_ehci_config_vddcx(mhcd, 1);

	temp = readl_relaxed(USB_USBCMD);
	temp &= ~ASYNC_INTR_CTRL;
	temp &= ~ULPI_STP_CTRL;
	writel_relaxed(temp, USB_USBCMD);

	if (!(readl_relaxed(USB_PORTSC) & PORTSC_PHCD))
		goto skip_phy_resume;

	temp = readl_relaxed(USB_PORTSC) & ~PORTSC_PHCD;
	writel_relaxed(temp, USB_PORTSC);

	timeout = jiffies + usecs_to_jiffies(PHY_RESUME_TIMEOUT_USEC);
	while ((readl_relaxed(USB_PORTSC) & PORTSC_PHCD) ||
			!(readl_relaxed(USB_ULPI_VIEWPORT) & ULPI_SYNC_STATE)) {
		if (time_after(jiffies, timeout)) {
			/*This is a fatal error. Reset the link and PHY*/
			dev_err(mhcd->dev, "Unable to resume USB. Resetting the h/w\n");
			msm_hsusb_reset(mhcd);
			break;
		}
		udelay(1);
	}

skip_phy_resume:

	usb_hcd_resume_root_hub(hcd);
	atomic_set(&mhcd->in_lpm, 0);

	if (mhcd->async_int) {
		mhcd->async_int = false;
		pm_runtime_put_noidle(mhcd->dev);
		enable_irq(hcd->irq);
	}

	if (atomic_read(&mhcd->pm_usage_cnt)) {
		atomic_set(&mhcd->pm_usage_cnt, 0);
		pm_runtime_put_noidle(mhcd->dev);
	}

	dev_info(mhcd->dev, "EHCI USB exited from low power mode\n");

	return 0;
}
开发者ID:danielcbit,项目名称:android_kernel_amazon_bueller,代码行数:77,代码来源:ehci-msm2.c

示例6: wmt_plat_eirq_ctrl

INT32 wmt_plat_eirq_ctrl(ENUM_PIN_ID id, ENUM_PIN_STATE state)
{
#ifdef CONFIG_OF
	struct device_node *node;
	unsigned int irq_info[3] = { 0, 0, 0 };
#endif
	INT32 iret = -EINVAL;
	static INT32 bgf_irq_num = -1;
	static UINT32 bgf_irq_flag;
	/* TODO: [ChangeFeature][GeorgeKuo]: use another function to handle this, as done in gpio_ctrls */

	if ((PIN_STA_INIT != state)
	    && (PIN_STA_DEINIT != state)
	    && (PIN_STA_EINT_EN != state)
	    && (PIN_STA_EINT_DIS != state)) {
		WMT_PLAT_WARN_FUNC("WMT-PLAT:invalid PIN_STATE(%d) in eirq_ctrl for PIN(%d)\n", state, id);
		return -1;
	}

	switch (id) {
	case PIN_BGF_EINT:

		if (PIN_STA_INIT == state) {
#ifdef CONFIG_OF
			node = of_find_compatible_node(NULL, NULL, "mediatek,mt6735-consys");
			if (node) {
				bgf_irq_num = irq_of_parse_and_map(node, 0);
				/* get the interrupt line behaviour */
				if (of_property_read_u32_array(node, "interrupts", irq_info, ARRAY_SIZE(irq_info))) {
					WMT_PLAT_ERR_FUNC("get irq flags from DTS fail!!\n");
					return iret;
				}
				bgf_irq_flag = irq_info[2];
				WMT_PLAT_INFO_FUNC("get irq id(%d) and irq trigger flag(%d) from DT\n", bgf_irq_num,
						   bgf_irq_flag);
			} else {
				WMT_PLAT_ERR_FUNC("[%s] can't find CONSYS compatible node\n", __func__);
				return iret;
			}
#else
			bgf_irq_num = MT_CONN2AP_BTIF_WAKEUP_IRQ_ID;
			bgf_irq_flag = IRQF_TRIGGER_LOW;
#endif
			iret = request_irq(bgf_irq_num, wmt_plat_bgf_irq_isr, bgf_irq_flag, "BTIF_WAKEUP_IRQ", NULL);
			if (iret) {
				WMT_PLAT_ERR_FUNC("request_irq fail,irq_no(%d),iret(%d)\n", bgf_irq_num, iret);
				return iret;
			}
			gbgfIrqBle.counter = 1;

		} else if (PIN_STA_EINT_EN == state) {

			spin_lock_irqsave(&gbgfIrqBle.lock, gbgfIrqBle.flags);
			if (gbgfIrqBle.counter) {
				WMT_PLAT_DBG_FUNC("BGF INT has been enabled,counter(%d)\n", gbgfIrqBle.counter);
			} else {
				enable_irq(bgf_irq_num);
				gbgfIrqBle.counter++;
			}
			WMT_PLAT_DBG_FUNC("WMT-PLAT:BGFInt (en)\n");
			spin_unlock_irqrestore(&gbgfIrqBle.lock, gbgfIrqBle.flags);
		} else if (PIN_STA_EINT_DIS == state) {
			spin_lock_irqsave(&gbgfIrqBle.lock, gbgfIrqBle.flags);
			if (!gbgfIrqBle.counter) {
				WMT_PLAT_INFO_FUNC("BGF INT has been disabled,counter(%d)\n", gbgfIrqBle.counter);
			} else {
				disable_irq_nosync(bgf_irq_num);
				gbgfIrqBle.counter--;
			}
			WMT_PLAT_DBG_FUNC("WMT-PLAT:BGFInt (dis)\n");
			spin_unlock_irqrestore(&gbgfIrqBle.lock, gbgfIrqBle.flags);
		} else {
			free_irq(bgf_irq_num, NULL);
			/* de-init: nothing to do in ALPS, such as un-registration... */
		}
		iret = 0;
		break;

	default:
		WMT_PLAT_WARN_FUNC("WMT-PLAT:unsupported EIRQ(PIN_ID:%d) in eirq_ctrl\n", id);
		iret = -1;
		break;
	}

	return iret;
}
开发者ID:mohancm100,项目名称:android_kernel_lenovo_A7010a48,代码行数:86,代码来源:wmt_plat_alps.c

示例7: s3c2410_dma_start

static int s3c2410_dma_start(struct s3c2410_dma_chan *chan)
{
    unsigned long tmp;
    unsigned long flags;

    pr_debug("s3c2410_start_dma: channel=%d\n", chan->number);

    local_irq_save(flags);

    if (chan->state == S3C2410_DMA_RUNNING) {
        pr_debug("s3c2410_start_dma: already running (%d)\n", chan->state);
        local_irq_restore(flags);
        return 0;
    }

    chan->state = S3C2410_DMA_RUNNING;

    /* check wether there is anything to load, and if not, see
     * if we can find anything to load
     */

    if (chan->load_state == S3C2410_DMALOAD_NONE) {
        if (chan->next == NULL) {
            printk(KERN_ERR "dma%d: channel has nothing loaded\n",
                   chan->number);
            chan->state = S3C2410_DMA_IDLE;
            local_irq_restore(flags);
            return -EINVAL;
        }

        s3c2410_dma_loadbuffer(chan, chan->next);
    }

    dbg_showchan(chan);

    /* enable the channel */

    if (!chan->irq_enabled) {
        enable_irq(chan->irq);
        chan->irq_enabled = 1;
    }

    /* start the channel going */

    tmp = dma_rdreg(chan, S3C2410_DMA_DMASKTRIG);
    tmp &= ~S3C2410_DMASKTRIG_STOP;
    tmp |= S3C2410_DMASKTRIG_ON;
    dma_wrreg(chan, S3C2410_DMA_DMASKTRIG, tmp);

    pr_debug("dma%d: %08lx to DMASKTRIG\n", chan->number, tmp);

#if 0
    /* the dma buffer loads should take care of clearing the AUTO
     * reloading feature */
    tmp = dma_rdreg(chan, S3C2410_DMA_DCON);
    tmp &= ~S3C2410_DCON_NORELOAD;
    dma_wrreg(chan, S3C2410_DMA_DCON, tmp);
#endif

    s3c2410_dma_call_op(chan, S3C2410_DMAOP_START);

    dbg_showchan(chan);

    /* if we've only loaded one buffer onto the channel, then chec
     * to see if we have another, and if so, try and load it so when
     * the first buffer is finished, the new one will be loaded onto
     * the channel */

    if (chan->next != NULL) {
        if (chan->load_state == S3C2410_DMALOAD_1LOADED) {

            if (s3c2410_dma_waitforload(chan, __LINE__) == 0) {
                pr_debug("%s: buff not yet loaded, no more todo\n",
                         __func__);
            } else {
                chan->load_state = S3C2410_DMALOAD_1RUNNING;
                s3c2410_dma_loadbuffer(chan, chan->next);
            }

        } else if (chan->load_state == S3C2410_DMALOAD_1RUNNING) {
            s3c2410_dma_loadbuffer(chan, chan->next);
        }
    }


    local_irq_restore(flags);

    return 0;
}
开发者ID:chenhaifeng2016,项目名称:fastsocket,代码行数:89,代码来源:dma.c

示例8: c_entry


//.........这里部分代码省略.........

  /* Set virtual address of MMU table */
  cp15_set_vmmu_addr((void *)
                     (IRAM_BASE + (256 * 1024) - (16 * 1024)));

  /* Initialize interrupt system */
  int_initialize(0xFFFFFFFF);

  /* Install standard IRQ dispatcher at ARM IRQ vector */
  int_install_arm_vec_handler(IRQ_VEC, (PFV) lpc32xx_irq_handler);

  /* Install timer interrupts handlers as a IRQ interrupts */
  int_install_irq_handler(IRQ_TIMER0, (PFV) timer0_user_interrupt);
  int_install_irq_handler(IRQ_TIMER1, (PFV) timer1_user_interrupt);

  /* Open timers - this will enable the clocks for all timers when
     match control, match output, and capture control functions
     disabled. Default clock will be internal. */
  timer0dev = timer_open(TIMER_CNTR0, 0);
  timer1dev = timer_open(TIMER_CNTR1, 0);

  /******************************************************************/
  /* Setup timer 0 for a 1Hz match rate                            */

  /* Use a prescale count time of 100uS                             */
  pscale.ps_tick_val = 0; /* Use ps_us_val value */
  pscale.ps_us_val = 100; /* 100uS */
  timer_ioctl(timer0dev, TMR_SETUP_PSCALE, (INT_32) &pscale);

  /* Use a match count value of 10000 (10000 * 100uS = 1000mS (1Hz))  */
  msetup.timer_num = 0; /* Use match register set 0 (of 0..3) */
  msetup.use_match_int = TRUE; /* Generate match interrupt on match */
  msetup.stop_on_match = FALSE; /* Do not stop timer on match */
  msetup.reset_on_match = TRUE; /* Reset timer counter on match */
  msetup.match_tick_val = 9999; /* Match is when timer count is 10000 */
  timer_ioctl(timer0dev, TMR_SETUP_MATCH, (INT_32) &msetup);

  /* Clear any latched timer 0 interrupts and enable match
   interrupt */
  timer_ioctl(timer0dev, TMR_CLEAR_INTS,
              (TIMER_CNTR_MTCH_BIT(0) | TIMER_CNTR_MTCH_BIT(1) |
               TIMER_CNTR_MTCH_BIT(2) | TIMER_CNTR_MTCH_BIT(3) |
               TIMER_CNTR_CAPT_BIT(0) | TIMER_CNTR_CAPT_BIT(1) |
               TIMER_CNTR_CAPT_BIT(2) | TIMER_CNTR_CAPT_BIT(3)));
  /******************************************************************/

  /******************************************************************/
  /* Setup timer 1 for a 4.9Hz match rate                           */

  /* Use a prescale count time of 100uS                             */
  pscale.ps_tick_val = 0; /* Use ps_us_val value */
  pscale.ps_us_val = 10; /* 100uS */
  timer_ioctl(timer1dev, TMR_SETUP_PSCALE, (INT_32) &pscale);

  /* Use a match value of 490 (490 * 100uS)                         */
  msetup.timer_num = 0; /* Use match register set 0 (of 0..3) */
  msetup.use_match_int = TRUE; /* Generate match interrupt on match */
  msetup.stop_on_match = FALSE; /* Do not stop timer on match */
  msetup.reset_on_match = TRUE; /* Reset timer counter on match */
  msetup.match_tick_val = 489;
  timer_ioctl(timer1dev, TMR_SETUP_MATCH, (INT_32) &msetup);

  /* Clear any latched timer 1 interrupts and enable match
   interrupt */
  timer_ioctl(timer1dev, TMR_CLEAR_INTS,
              (TIMER_CNTR_MTCH_BIT(0) | TIMER_CNTR_MTCH_BIT(1) |
               TIMER_CNTR_MTCH_BIT(2) | TIMER_CNTR_MTCH_BIT(3) |
               TIMER_CNTR_CAPT_BIT(0) | TIMER_CNTR_CAPT_BIT(1) |
               TIMER_CNTR_CAPT_BIT(2) | TIMER_CNTR_CAPT_BIT(3)));
  /******************************************************************/

  /* Enable timers (starts counting) */
  msecs = 0;
  timer_ioctl(timer0dev, TMR_ENABLE, 1);
  timer_ioctl(timer1dev, TMR_ENABLE, 1);

  /* Enable timer interrupts in the interrupt controller */
  int_enable(IRQ_TIMER0);
  int_enable(IRQ_TIMER1);

  /* Enable IRQ interrupts in the ARM core */
  enable_irq();

  /* Loop for 20 seconds and let interrupts toggle the LEDs */
  while (msecs < (10 * 1000));

  /* Disable timer interrupts in the interrupt controller */
  int_disable(IRQ_TIMER0);
  int_disable(IRQ_TIMER1);

  /* Disable interrupts in ARM core */
  disable_irq_fiq();

  /* Close timers */
  timer_close(timer0dev);
  timer_close(timer1dev);


  return 1;
}
开发者ID:IgorSkl,项目名称:logikaMRZV,代码行数:101,代码来源:tmp.c

示例9: arc_enable_irq

/* These are pretty simple. We know the irq is never shared and the
   kernel does all the magic that's required. */
static void arc_enable_irq(struct parport *p)
{
	enable_irq(p->irq);
}
开发者ID:GunioRobot,项目名称:MI424WR_GEN2_Rev_E-F,代码行数:6,代码来源:parport_arc.c

示例10: insert_headset

static void insert_headset(void)
{
#ifdef FEATURE_AUD_HOOK_BTN
        unsigned long irq_flags;
#endif
		int voltage = 0; /* FIH-SW2-MM-AY-hsed_type-00 */

        H2W_DBG("");

        input_sync(hi->hs_input);
        msleep(100); 
                
#ifdef FEATURE_AUD_HOOK_BTN
        /* On some non-standard headset adapters (usually those without a
        * button) the btn line is pulled down at the same time as the detect
        * line. We can check here by sampling the button line, if it is
        * low then it is probably a bad adapter so ignore the button.
        * If the button is released then we stop ignoring the button, so that
        * the user can recover from the situation where a headset is plugged
        * in with button held down.
        */

        hi->ignore_btn = 1; /* FIH-SW2-MM-AY-TAP_Tapioca-00746_00 */

        if (bn_irq_enable==0) {
                
                /* Enable button irq */
                local_irq_save(irq_flags);
                
                enable_irq(hi->irq_btn);
                
                local_irq_restore(irq_flags);
                
                bn_irq_enable=1;

                irq_set_irq_wake(hi->irq_btn, 1);
        }
#endif
	/* FIH-SW2-MM-AY-hsed_type-00 [ */

	if (isCTIAheadset) { /* FIH-SW2-MM-AY-hsed_type-03 */
		pmic_hsed_enable(PM_HSED_CONTROLLER_0, PM_HSED_ENABLE_ALWAYS);
		msleep(130);
		proc_comm_get_hsed_voltage(2, &voltage, 0); //it will get the prior value, not the current value. Should not omit.
		msleep(70);
		proc_comm_get_hsed_voltage(2, &voltage, 0);
		H2W_DBG("aud_hs: voltage is %d\n ", voltage);
		/* FIH-SW2-MM-AY-hsed_type-01 [ */
		if (voltage > 1700) {
	        //do not change state to issue an UEVENT.
	        //it is a earphone jack plug.
	        mHeadphone = false;
               hi->ignore_btn = 1;
	        pmic_hsed_enable(PM_HSED_CONTROLLER_0, PM_HSED_ENABLE_OFF);
               /* MM-RC-HEADSET-MULTIBUTTON-DETECT[* */
               #ifdef FEATURE_AUD_HOOK_BTN
	        if (bn_irq_enable) {
       	        local_irq_save(irq_flags);
       	        disable_irq(hi->irq_btn);
       	        local_irq_restore(irq_flags);
       	        bn_irq_enable=0;
       	        irq_set_irq_wake(hi->irq_btn, 0);
	        }
               #endif
               /* MM-RC-HEADSET-MULTIBUTTON-DETECT]* */
	        switch_set_state(&hi->sdev, UNKNOWN_DEVICE); /* FIH-SW2-MM-AY-hsed_type-02 */
		} else if (voltage > 700 || voltage < 400) { /* FIH-SW2-MM-AY-hsed_type-01 ] *//* SW-MM-RC-CTIA-TTY* */
	        if (gpio_get_value(hi->cable_in1) == HS_PLUG_IN) {
       	        if (gpio_get_value(hi->cable_in2) == BTN_STATE_PRESSED) {
                    switch_set_state(&hi->sdev, NOMIC_HEADSET);
                    mHeadphone=true;
                    hi->ignore_btn = 1;
                    pmic_hsed_enable(PM_HSED_CONTROLLER_0, PM_HSED_ENABLE_OFF);
                    H2W_DBG("aud_hs:HEADPHONE is plugging\n ");
                } else {
                    switch_set_state(&hi->sdev, HEADSET);
                    mHeadphone=false;
			#ifdef FEATURE_AUD_HOOK_BTN 
                    irq_set_irq_type(hi->irq_btn, IRQF_TRIGGER_BTN_PRESSED);
			#endif 
                    msleep(300);
                    hi->ignore_btn = 0;
                    H2W_DBG("aud_hs:HEADSET is plugging\n ");
                }
	        }
		} else {
            mHeadphone = false;
            hi->ignore_btn = 1;
            pmic_hsed_enable(PM_HSED_CONTROLLER_0, PM_HSED_ENABLE_OFF);
            switch_set_state(&hi->sdev, NOT_SUPPORT);
		}
		H2W_DBG("switch_get_state= %d ",switch_get_state(&hi->sdev));
	} else {
        /* FIH-SW2-MM-AY-TAP-ControlHSED_BIAS1-01 [ */
        pmic_hsed_enable(PM_HSED_CONTROLLER_0, PM_HSED_ENABLE_ALWAYS);
        msleep(130); /* FIH-SW2-MM-AY-Tapioca_SS-00467-00 */
        /* FIH-SW2-MM-AY-TAP-ControlHSED_BIAS1-01 ] */
	    if (gpio_get_value(hi->cable_in1) == HS_PLUG_IN) { /* FIH-SW2-MM-AY-TAP_headset_00 */
	
       	    if (gpio_get_value(hi->cable_in2) == BTN_STATE_PRESSED) { /* FIH-SW2-MM-AY-TAP_headset_00 */
//.........这里部分代码省略.........
开发者ID:NoelMacwan,项目名称:SXDMesona,代码行数:101,代码来源:fih_headset.c

示例11: enable_timer

void enable_timer()
{
	init_system_clock(&real_tm);
	enable_irq(TIMER_IRQ);
	timefly = last_timefly = 0;
}
开发者ID:raywill,项目名称:maray,代码行数:6,代码来源:timer.c

示例12: init

static void init(void)
{
    system_init();
    kernel_init();
#ifdef APPLICATION
    paths_init();
#endif
    buffer_init();
    enable_irq();
    lcd_init();
#ifdef HAVE_REMOTE_LCD
    lcd_remote_init();
#endif
    font_init();
    show_logo();
    button_init();
    backlight_init();
#if (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO))
    sim_tasks_init();
#endif
#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
    notification_init();
#endif
    lang_init(core_language_builtin, language_strings, 
              LANG_LAST_INDEX_IN_ARRAY);
#ifdef DEBUG
    debug_init();
#endif
    /* Keep the order of this 3 (viewportmanager handles statusbars)
     * Must be done before any code uses the multi-screen API */
    gui_syncstatusbar_init(&statusbars);
    gui_sync_skin_init();
    sb_skin_init();
    viewportmanager_init();

    storage_init();
    settings_reset();
    settings_load(SETTINGS_ALL);
    settings_apply(true);
    init_dircache(true);
    init_dircache(false);
#ifdef HAVE_TAGCACHE
    init_tagcache();
#endif
    sleep(HZ/2);
    tree_mem_init();
    filetype_init();
    playlist_init();
    theme_init_buffer();

#if CONFIG_CODEC != SWCODEC
    mp3_init( global_settings.volume,
              global_settings.bass,
              global_settings.treble,
              global_settings.balance,
              global_settings.loudness,
              global_settings.avc,
              global_settings.channel_config,
              global_settings.stereo_width,
              global_settings.mdb_strength,
              global_settings.mdb_harmonics,
              global_settings.mdb_center,
              global_settings.mdb_shape,
              global_settings.mdb_enable,
              global_settings.superbass);

    /* audio_init must to know the size of voice buffer so init voice first */
    talk_init();
#endif /* CONFIG_CODEC != SWCODEC */

    scrobbler_init();
#if CONFIG_CODEC == SWCODEC && defined (HAVE_PITCHSCREEN)
    tdspeed_init();
#endif /* CONFIG_CODEC == SWCODEC */

    audio_init();
    button_clear_queue(); /* Empty the keyboard buffer */
    
    settings_apply_skins();
}
开发者ID:realtsiry,项目名称:rockbox4linux,代码行数:80,代码来源:main.c

示例13: msm_ehci_suspend

static int msm_ehci_suspend(struct msm_hcd *mhcd)
{
	struct msm_usb_host_platform_data *pdata;
	struct usb_hcd *hcd = mhcd_to_hcd(mhcd);
	unsigned long timeout;
	int ret;
	u32 portsc;

	pdata = mhcd->dev->platform_data;
	if (atomic_read(&mhcd->in_lpm)) {
		dev_dbg(mhcd->dev, "%s called in lpm\n", __func__);
		return 0;
	}

	disable_irq(hcd->irq);

	/* Set the PHCD bit, only if it is not set by the controller.
	 * PHY may take some time or even fail to enter into low power
	 * mode (LPM). Hence poll for 500 msec and reset the PHY and link
	 * in failure case.
	 */
	portsc = readl_relaxed(USB_PORTSC);
	if (!(portsc & PORTSC_PHCD)) {
		writel_relaxed(portsc | PORTSC_PHCD,
				USB_PORTSC);

		timeout = jiffies + usecs_to_jiffies(PHY_SUSPEND_TIMEOUT_USEC);
		while (!(readl_relaxed(USB_PORTSC) & PORTSC_PHCD)) {
			if (time_after(jiffies, timeout)) {
				dev_err(mhcd->dev, "Unable to suspend PHY\n");
				schedule_work(&mhcd->phy_susp_fail_work);
				return -ETIMEDOUT;
			}
			udelay(1);
		}
	}

	/*
	 * PHY has capability to generate interrupt asynchronously in low
	 * power mode (LPM). This interrupt is level triggered. So USB IRQ
	 * line must be disabled till async interrupt enable bit is cleared
	 * in USBCMD register. Assert STP (ULPI interface STOP signal) to
	 * block data communication from PHY.
	 */
	writel_relaxed(readl_relaxed(USB_USBCMD) | ASYNC_INTR_CTRL |
				ULPI_STP_CTRL, USB_USBCMD);

	/*
	 * Ensure that hardware is put in low power mode before
	 * clocks are turned OFF and VDD is allowed to minimize.
	 */
	mb();

	clk_disable_unprepare(mhcd->iface_clk);
	clk_disable_unprepare(mhcd->core_clk);

	/* usb phy does not require TCXO clock, hence vote for TCXO disable */
	ret = msm_xo_mode_vote(mhcd->xo_handle, MSM_XO_MODE_OFF);
	if (ret)
		dev_err(mhcd->dev, "%s failed to devote for "
			"TCXO D0 buffer%d\n", __func__, ret);

	if (!pdata->mpm_xo_wakeup_int)
		msm_ehci_config_vddcx(mhcd, 0);

	atomic_set(&mhcd->in_lpm, 1);
	enable_irq(hcd->irq);
	if (mhcd->pmic_gpio_dp_irq) {
		mhcd->pmic_gpio_dp_irq_enabled = 1;
		enable_irq_wake(mhcd->pmic_gpio_dp_irq);
		enable_irq(mhcd->pmic_gpio_dp_irq);
	}
	wake_unlock(&mhcd->wlock);

	dev_info(mhcd->dev, "EHCI USB in low power mode\n");

	return 0;
}
开发者ID:danielcbit,项目名称:android_kernel_amazon_bueller,代码行数:78,代码来源:ehci-msm2.c

示例14: lpc32xx_rtc_ioctl

static int lpc32xx_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct lpc32xx_rtc_priv *lpc32xx_rtc_dat = platform_get_drvdata(pdev);

	switch (cmd) {
	case RTC_AIE_ON:
		spin_lock_irq(&lpc32xx_rtc_dat->lock);

		if (!lpc32xx_rtc_dat->alarm_enabled)
		{
			enable_irq(lpc32xx_rtc_dat->irq);
			lpc32xx_rtc_dat->alarm_enabled = 1;
		}

		spin_unlock_irq(&lpc32xx_rtc_dat->lock);
		break;

	case RTC_AIE_OFF:
		spin_lock_irq(&lpc32xx_rtc_dat->lock);

		if (lpc32xx_rtc_dat->alarm_enabled)
		{
			disable_irq(lpc32xx_rtc_dat->irq);
			lpc32xx_rtc_dat->alarm_enabled = 0;
		}

		spin_unlock_irq(&lpc32xx_rtc_dat->lock);
		break;

	case RTC_PIE_ON:
		enable_irq(lpc32xx_rtc_dat->irq);
		break;

	case RTC_PIE_OFF:
		disable_irq(lpc32xx_rtc_dat->irq);
		break;

	case RTC_IRQP_READ:
		return put_user(1, (unsigned long __user *)arg);
		break;

	case RTC_IRQP_SET:
		/* Only 1Hz is supported */
		if (arg != 1)
			return -EINVAL;
		break;

	case RTC_EPOCH_READ:
		return put_user(epoch, (unsigned long __user *)arg);

	case RTC_EPOCH_SET:
		/* Doesn't support before 1900 */
		if (arg < 1900)
			return -EINVAL;
		epoch = arg;
		break;

	default:
		return -ENOIOCTLCMD;
	}

	return 0;
}
开发者ID:athurg,项目名称:linux_kernel,代码行数:64,代码来源:rtc-lpc32xx.c

示例15: do_wakeup

static void do_wakeup(struct work_struct *work)
{
    enable_irq(bp_wakeup_ap_irq);
}
开发者ID:Astralix,项目名称:EasyPad_971_Dual_Core,代码行数:4,代码来源:mw100.c


注:本文中的enable_irq函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。