Пример #1
0
static xcpt_t up_irqbuttonx(int irq, xcpt_t irqhandler, xcpt_t *store)
{
  xcpt_t oldhandler;
  irqstate_t flags;

  /* Disable interrupts until we are done.  This guarantees that the following
   * operations are atomic.
   */

  flags = irqsave();

  /* Get the old button interrupt handler and save the new one */

  oldhandler = *store;
  *store = irqhandler;

  /* Configure the interrupt */

  sam3u_gpioirq(irq);
  (void)irq_attach(irq, irqhandler);
  sam3u_gpioirqenable(irq);
  irqrestore(flags);

  /* Return the old button handler (so that it can be restored) */

  return oldhandler;
}
Пример #2
0
static void tsc_enable(FAR struct ads7843e_config_s *state, bool enable)
{
  /* Attach and enable, or detach and disable */

  ivdbg("IRQ:%d enable:%d\n", SAM3U_TCS_IRQ, enable);
  if (enable)
    {
      sam3u_gpioirqenable(SAM3U_TCS_IRQ);
    }
  else
    {
      sam3u_gpioirqdisable(SAM3U_TCS_IRQ);
    }
}
Пример #3
0
void up_enable_irq(int irq)
{
  uint32_t regaddr;
  uint32_t regval;
  uint32_t bit;

  if (sam3u_irqinfo(irq, &regaddr, &bit) == 0)
    {
      /* Set the appropriate bit in the register to enable the interrupt */

      regval  = getreg32(regaddr);
      regval |= bit;
      putreg32(regval, regaddr);
    }
#ifdef CONFIG_GPIO_IRQ
  else
    {
      /* Maybe it is a (derived) GPIO IRQ */

      sam3u_gpioirqenable(irq);
    }
#endif
  sam3u_dumpnvic("enable", irq);
}