Exemplo n.º 1
0
void gpio_clear_irq_callback(enum gpio_port port, enum gpio_pin pin)
{
    gpio_irq_disable(port, pin);

    _g_gpio_irq_tbl[port].irq_cb[pin]    = RT_NULL;
    _g_gpio_irq_tbl[port].irq_arg[pin]   = RT_NULL;
}
Exemplo n.º 2
0
static void _netdev2_cc110x_rx_callback(void *arg)
{
    netdev2_t *netdev2 = (netdev2_t*) arg;
    cc110x_t *cc110x = &((netdev2_cc110x_t*) arg)->cc110x;
    gpio_irq_disable(cc110x->params.gdo2);
    netdev2->event_callback(netdev2, NETDEV2_EVENT_RX_COMPLETE, netdev2->isr_arg);
}
Exemplo n.º 3
0
static void _netdev_cc110x_rx_callback(void *arg)
{
    netdev_t *netdev = (netdev_t*) arg;
    cc110x_t *cc110x = &((netdev_cc110x_t*) arg)->cc110x;
    gpio_irq_disable(cc110x->params.gdo2);
    netdev->event_callback(netdev, NETDEV_EVENT_RX_COMPLETE);
}
Exemplo n.º 4
0
static void rk28_ts_suspend(android_early_suspend_t *h)
{
#if 0
    printk("XPT2046 driver suspend!!\n");
    gpio_irq_disable(PT2046_PENIRQ);
#endif

}
Exemplo n.º 5
0
static void
gpio_irq_shutdown(unsigned int irq)
{
	gpio_irq_disable(irq);

	irq -= gpio_irq_base;
	*VR4181_GPINTEN &= ~((u16)(1 << irq ));
}
Exemplo n.º 6
0
void gpio_ir_recv_handler(uint32_t id, uint32_t event) {

    uint32_t current_timestamp;
    IRSendRev *pIR;

    pIR = (IRSendRev *)id;

    gpio_irq_disable((gpio_irq_t *)(pIR->pGpioIrqRecv));

    current_timestamp = micros();

    switch(pIR->rcvstate) {
        case STATE_IDLE:
            if ((pIR->recv_wait_int) == IRQ_LOW) {
                pIR->rcvstate = STATE_MARK;
                pIR->prev_timestamp = current_timestamp;
            }
            break;
        case STATE_MARK:
            if ((pIR->recv_wait_int) == IRQ_HIGH) {
                // mark transition to space
                pIR->recv_buf[(pIR->recv_len)++] = current_timestamp - (pIR->prev_timestamp);
                pIR->prev_timestamp = current_timestamp;
                pIR->rcvstate = STATE_SPACE;
                gtimer_reload((gtimer_t *)(pIR->pTimerRecv), GAP);
                gtimer_start((gtimer_t *)(pIR->pTimerRecv));                
            }
            break;
        case STATE_SPACE:
            if ((pIR->recv_wait_int) == IRQ_LOW) {
                // space transition to mark
                gtimer_stop((gtimer_t *)(pIR->pTimerRecv));
                pIR->recv_buf[(pIR->recv_len)++] = current_timestamp - (pIR->prev_timestamp);
                pIR->prev_timestamp = current_timestamp;
                pIR->rcvstate = STATE_MARK;
            }
            break;
        case STATE_STOP:
            break;
    }

    if ((pIR->recv_wait_int) == IRQ_LOW )
    {
        // Change to listen to high level event
        (pIR->recv_wait_int) = IRQ_HIGH;
        gpio_irq_set((gpio_irq_t *)(pIR->pGpioIrqRecv), (gpio_irq_event)IRQ_HIGH, 1);
        gpio_irq_enable((gpio_irq_t *)(pIR->pGpioIrqRecv));
    }
    else if ((pIR->recv_wait_int) == IRQ_HIGH)
    {
        // Change to listen to low level event
        (pIR->recv_wait_int) = IRQ_LOW;
        gpio_irq_set((gpio_irq_t *)(pIR->pGpioIrqRecv), (gpio_irq_event)IRQ_LOW, 1);
        gpio_irq_enable((gpio_irq_t *)(pIR->pGpioIrqRecv));
    }

}
Exemplo n.º 7
0
static void encx24j600_isr(void *arg)
{
    encx24j600_t *dev = (encx24j600_t *) arg;

    /* disable interrupt line */
    gpio_irq_disable(dev->int_pin);

    /* call netdev2 hook */
    dev->netdev.event_callback((netdev2_t*) dev, NETDEV2_EVENT_ISR, dev->isr_arg);
}
void
sol_interrupt_scheduler_gpio_stop(gpio_t dev, void *handler)
{
    unsigned int state;

    state = irq_disable();
    gpio_irq_disable(dev);
    interrupt_scheduler_handler_free(handler);
    irq_restore(state);
}
Exemplo n.º 9
0
Arquivo: uart.c Projeto: agb861/STM32F
void Rx_irq_handler(void *arg)
{
  init_clocks();
    GPIO_CLK_INIT(USARTx_RX_GPIO_CLK, ENABLE);
  USARTx_CLK_INIT(USARTx_CLK, ENABLE);
  RCC_AHB1PeriphClockCmd(DMA_CLK_INIT,ENABLE);
  
  gpio_irq_disable(USARTx_RX_GPIO_PORT, USARTx_IRQ_PIN);
  mico_mcu_powersave_config(mxDisable);
  mico_rtos_set_semaphore(&wakeup);
}
Exemplo n.º 10
0
static irqreturn_t xpt2046_ts_interrupt(int irq,void *handle)
{
    struct XPT2046_TS_EVENT *ts_dev = handle;
    unsigned long flags;
    rk28printk("************>%s.....%s.....%d\n",__FILE__,__FUNCTION__,__LINE__);
    spin_lock_irqsave(&ts_dev->lock,flags);
    gpio_irq_disable(PT2046_PENIRQ);
    hrtimer_start(&ts_dev->timer,ktime_set(0,TS_POLL_DELAY),HRTIMER_MODE_REL);
    spin_unlock_irqrestore(&ts_dev->lock, flags);
    return IRQ_HANDLED;
}
Exemplo n.º 11
0
static irqreturn_t ak4183_isr(int irq,void *dev_id)
{
	struct AK4183_TS_EVENT *ts_dev = (struct AK4183_TS_EVENT *)dev_id;

	D("enter!\n");

	gpio_irq_disable(GPIOPortE_Pin3);

	schedule_delayed_work(&ts_dev->work, TP_POLL_DELAY);
	
	return IRQ_HANDLED;
}
Exemplo n.º 12
0
static void rk28_ps2_sent_start(void)
{
	g_host_sent_flag = 1;
	gpio_irq_disable(MOUSE_PS2_CLK_PIN);
	gpio_direction_output(MOUSE_PS2_CLK_PIN,GPIO_LOW);
	GPIOSetPinLevel(MOUSE_PS2_CLK_PIN,GPIO_LOW);
	udelay(100);
	gpio_direction_output(MOUSE_PS2_DATA_PIN,GPIO_LOW);
	GPIOSetPinLevel(MOUSE_PS2_DATA_PIN,GPIO_LOW);
	GPIOSetPinLevel(MOUSE_PS2_CLK_PIN,GPIO_HIGH);
	gpio_direction_input(MOUSE_PS2_CLK_PIN);
	gpio_irq_enable(MOUSE_PS2_CLK_PIN);
}
void RX_PIN_WAKEUP_handler(void *arg)
{
  (void)arg;
  mico_uart_t uart = *(mico_uart_t *)arg;
  
  RCC_AHB1PeriphClockCmd(uart_mapping[ uart ].pin_rx->peripheral_clock, ENABLE);
  uart_mapping[ uart ].usart_peripheral_clock_func ( uart_mapping[uart].usart_peripheral_clock,  ENABLE );
  uart_mapping[uart].rx_dma_peripheral_clock_func  ( uart_mapping[uart].rx_dma_peripheral_clock, ENABLE );
  
  gpio_irq_disable(uart_mapping[uart].pin_rx->bank, uart_mapping[uart].pin_rx->number);
  MicoMcuPowerSaveConfig(false);
  mico_rtos_set_semaphore(&uart_interfaces[uart].sem_wakeup);
}
Exemplo n.º 14
0
rt_err_t pin_irq_enable(struct rt_device *device, rt_base_t pin, rt_uint32_t enabled)
{
    if ((pin > PIN_NUM(pin_index)) || (pin_index[pin].magic != PIN_MAGIC))
    {
        dbg_log(DBG_ERROR, "pin:%d value wrongful\n", pin);
        return RT_ERROR;
    }

    if (enabled)
        gpio_irq_enable(pin_index[pin].pin_port, pin_index[pin].pin);
    else
        gpio_irq_disable(pin_index[pin].pin_port, pin_index[pin].pin);

    return RT_EOK;
}
Exemplo n.º 15
0
static int _init(netdev2_t *dev)
{
    DEBUG("%s:%u\n", __func__, __LINE__);

    cc110x_t *cc110x = &((netdev2_cc110x_t*) dev)->cc110x;

    gpio_init_int(cc110x->params.gdo2, GPIO_NOPULL, GPIO_BOTH,
            &_netdev2_cc110x_isr, (void*)dev);

    gpio_set(cc110x->params.gdo2);
    gpio_irq_disable(cc110x->params.gdo2);

    /* Switch to RX mode */
    cc110x_rd_set_mode(cc110x, RADIO_MODE_ON);

    return 0;
}
Exemplo n.º 16
0
/**
 * gpio irq release
 *
 * No longer interrupt when something occurs on the pin. NOTE: this function
 * does not change the GPIO push/pull setting nor does it change the
 * SYSCFG EXTICR registers. It also does not disable the NVIC interrupt enable
 * setting for the irq.
 *
 * @param pin
 */
void
gpio_irq_release(int pin)
{
    int index;
    uint32_t pin_mask;

    /* Disable the interrupt */
    gpio_irq_disable(pin);

    /* Clear any pending interrupts */
    pin_mask = GPIO_MASK(pin);
    EXTI_ClearFlag(pin_mask);

    /* Clear out the irq handler */
    index = GPIO_INDEX(pin);
    gpio_irq_handlers[index].arg = NULL;
    gpio_irq_handlers[index].isr = NULL;
}
Exemplo n.º 17
0
OSStatus host_platform_bus_deinit( void )
{
    GPIO_InitTypeDef gpio_init_structure;

    MCU_CLOCKS_NEEDED();

    /* Disable SPI and SPI DMA */
    SPI_Cmd( SPIX, DISABLE );
    SPI_I2S_DeInit( SPIX );
    SPI_I2S_DMACmd( SPIX, SPI_I2S_DMAReq_Tx | SPI_I2S_DMAReq_Rx, DISABLE );
    DMA_DeInit( SPIX_DMA_TX_STREAM );
    DMA_DeInit( SPIX_DMA_RX_STREAM );

    /* Clear GPIO_B[1:0] */
    MicoGpioFinalize( (mico_gpio_t)WL_GPIO0 );
    MicoGpioFinalize( (mico_gpio_t)WL_GPIO1 );

    /* Clear SPI slave select GPIOs */
    gpio_init_structure.GPIO_Mode = GPIO_Mode_AIN;
    gpio_init_structure.GPIO_OType = GPIO_OType_PP;
    gpio_init_structure.GPIO_Speed = GPIO_Speed_100MHz;
    gpio_init_structure.GPIO_Pin = ( 1 << SPI_BUS_CS_PIN );
    GPIO_Init( SPI_BUS_CS_BANK, &gpio_init_structure );

    /* Clear the SPI lines */
    gpio_init_structure.GPIO_Mode = GPIO_Mode_AIN;
    gpio_init_structure.GPIO_OType = GPIO_OType_PP;
    gpio_init_structure.GPIO_Speed = GPIO_Speed_100MHz;
    gpio_init_structure.GPIO_Pin = ( 1 << SPI_BUS_CLOCK_PIN ) | ( 1 << SPI_BUS_MISO_PIN ) | ( 1 << SPI_BUS_MOSI_PIN );
    GPIO_Init( SPI_BUS_CLOCK_BANK, &gpio_init_structure );

    gpio_irq_disable( SPI_IRQ_BANK, SPI_IRQ_PIN );

    /* Disable SPI_SLAVE Periph clock and DMA1 clock */
    RCC_APB1PeriphClockCmd( SPIX_CLK, DISABLE );
    RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_DMA1, DISABLE );
    RCC_APB2PeriphClockCmd( RCC_APB2Periph_SYSCFG, DISABLE );

    MCU_CLOCKS_NOT_NEEDED();

    return kNoErr;
}
Exemplo n.º 18
0
static void
gpio_irq_ack(unsigned int irq)
{
	u16 irqtype;
	u16 irqshift;

	gpio_irq_disable(irq);

	/* we clear interrupt if it is edge triggered */
	irq -= gpio_irq_base;
	if (irq < 8) {
		irqtype = *VR4181_GPINTTYPL;
		irqshift = 2 << (irq*2);
	} else {
		irqtype = *VR4181_GPINTTYPH;
		irqshift = 2 << ((irq-8)*2);
	}
	if ( ! (irqtype & irqshift) ) {
		*VR4181_GPINTSTAT = (u16) (1 << irq);
	}
}
Exemplo n.º 19
0
int _cc110x_set_state(netdev_t *dev, netdev_state_t state)
{
    if (dev != &cc110x_dev) {
        return -ENODEV;
    }

    switch (state) {
        case NETDEV_STATE_POWER_OFF:
            gpio_irq_disable(CC110X_GDO2);
            cc110x_switch_to_pwd();
            break;
        case NETDEV_STATE_RX_MODE:
            gpio_irq_enable(CC110X_GDO2);
            cc110x_setup_rx_mode();
            break;
        default:
            return -ENOTSUP;
    }

    return 0;
}
Exemplo n.º 20
0
void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable)
{
    gpio_cfg_t* cfg = &m_gpio_cfg[obj->ch];
    bool irq_enabled_before =
        (m_gpio_irq_enabled & ((gpio_mask_t)1 << obj->ch)) &&
        (cfg->irq_rise || cfg->irq_fall);

    if (event == IRQ_RISE) {
        cfg->irq_rise = enable ? true : false;
    }
    else if (event == IRQ_FALL) {
        cfg->irq_fall = enable ? true : false;
    }

    bool irq_enabled_after = cfg->irq_rise || cfg->irq_fall;

    if (irq_enabled_before != irq_enabled_after) {
        if (irq_enabled_after) {
            gpio_irq_enable(obj);
        } else {
            gpio_irq_disable(obj);
        }
    }
}
Exemplo n.º 21
0
/**
 * gpio irq init
 * 
 * Initialize an external interrupt on a gpio pin 
 * 
 * @param pin       Pin number to enable gpio.
 * @param handler   Interrupt handler
 * @param arg       Argument to pass to interrupt handler
 * @param trig      Trigger mode of interrupt
 * @param pull      Push/pull mode of input.
 * 
 * @return int 
 */
int
gpio_irq_init(int pin, gpio_irq_handler_t handler, void *arg,
              gpio_irq_trig_t trig, gpio_pull_t pull)
{
    int rc;
    int irqn;
    int index;
    uint32_t pin_mask;
    uint32_t mode;
    GPIO_InitTypeDef init_cfg;

    /* Configure the gpio for an external interrupt */
    rc = 0;
    switch (trig) {
    case GPIO_TRIG_NONE:
        rc = -1;
        break;
    case GPIO_TRIG_RISING:
        mode = GPIO_MODE_IT_RISING;
        break;
    case GPIO_TRIG_FALLING:
        mode = GPIO_MODE_IT_FALLING;
        break;
    case GPIO_TRIG_BOTH:
        mode = GPIO_MODE_IT_RISING_FALLING;
        break;
    case GPIO_TRIG_LOW:
        rc = -1;
        break;
    case GPIO_TRIG_HIGH:
        rc = -1;
        break;
    default:
        rc = -1;
        break;
    }

    /* Check to make sure no error has occurred */
    if (!rc) {
        /* Disable interrupt and clear any pending */
        gpio_irq_disable(pin);
        pin_mask = GPIO_MASK(pin);
        __HAL_GPIO_EXTI_CLEAR_FLAG(pin_mask);

        /* Set the gpio irq handler */
        index = GPIO_INDEX(pin);
        gpio_irq_handlers[index].isr = handler;
        gpio_irq_handlers[index].arg = arg;

        /* Configure the GPIO */
        init_cfg.Mode = mode;
        init_cfg.Pull = pull;
        rc = hal_gpio_init(pin, &init_cfg);
        if (!rc) {
            /* Enable interrupt vector in NVIC */
            irqn = hal_gpio_pin_to_irq(pin);
            hal_gpio_set_nvic(irqn);
        }
    }

    return rc;
}
Exemplo n.º 22
0
void at86rf231_disable_interrupts(void)
{
    gpio_irq_disable(SPI_0_IRQ0_GPIO);
}
Exemplo n.º 23
0
void InterruptIn::disable_irq() {
    gpio_irq_disable(&gpio_irq);
}
Exemplo n.º 24
0
void InterruptIn::disable_irq() {
    core_util_critical_section_enter();
    gpio_irq_disable(&gpio_irq);
    core_util_critical_section_exit();
}
Exemplo n.º 25
0
OSStatus mico_gpio_disable_IRQ( mico_gpio_t gpio )
{
  if(gpio == (mico_gpio_t)MICO_GPIO_UNUSED ) return kUnsupportedErr;
  
  return gpio_irq_disable( gpio_mapping[gpio].bank, gpio_mapping[gpio].number );
}
Exemplo n.º 26
0
/**
 * gpio irq init
 *
 * Initialize an external interrupt on a gpio pin
 *
 * @param pin       Pin number to enable gpio.
 * @param handler   Interrupt handler
 * @param arg       Argument to pass to interrupt handler
 * @param trig      Trigger mode of interrupt
 * @param pull      Push/pull mode of input.
 *
 * @return int
 */
int
gpio_irq_init(int pin, gpio_irq_handler_t handler, void *arg,
              gpio_irq_trig_t trig, enum gpio_pull pull)
{
    int rc;
    int irqn;
    int index;
    uint32_t pin_mask;
    EXTI_InitTypeDef exti_cfg;

    /* Configure the gpio for an external interrupt */
    rc = 0;

    pin_mask = GPIO_MASK(pin);
    index = GPIO_INDEX(pin);

    exti_cfg.EXTI_Line = index;
    exti_cfg.EXTI_Mode = EXTI_Mode_Interrupt;
    switch (trig) {
    case GPIO_TRIG_NONE:
        rc = -1;
        break;
    case GPIO_TRIG_RISING:
        exti_cfg.EXTI_Trigger = EXTI_Trigger_Rising;
        break;
    case GPIO_TRIG_FALLING:
        exti_cfg.EXTI_Trigger = EXTI_Trigger_Falling;
        break;
    case GPIO_TRIG_BOTH:
        exti_cfg.EXTI_Trigger = EXTI_Trigger_Rising_Falling;
        break;
    case GPIO_TRIG_LOW:
        rc = -1;
        break;
    case GPIO_TRIG_HIGH:
        rc = -1;
        break;
    default:
        rc = -1;
        break;
    }
    exti_cfg.EXTI_LineCmd = ENABLE;

    /* Check to make sure no error has occurred */
    if (!rc) {
        /* Disable interrupt and clear any pending */
        gpio_irq_disable(pin);
        EXTI_ClearFlag(pin_mask);

        gpio_init_in(pin, pull);

        /* Configure SYSCFG */
        RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);

        /* Configure EXTI */
        SYSCFG_EXTILineConfig(GPIO_PORT(pin), index);

        EXTI_Init(&exti_cfg);

        /* Set the gpio irq handler */
        gpio_irq_handlers[index].isr = handler;
        gpio_irq_handlers[index].arg = arg;

        /* Configure the GPIO */
        if (!rc) {
            /* Enable interrupt vector in NVIC */
            irqn = hal_gpio_pin_to_irq(pin);
            hal_gpio_set_nvic(irqn);
        }
    }

    return rc;
}
Exemplo n.º 27
0
static void ak4183_suspend(android_early_suspend_t *h)
{
	D("enter!\n");

	gpio_irq_disable(GPIOPortE_Pin3);
}