int str71x_xticonfig(int irq, bool rising) { uint8_t regval; int bit; int ndx; int ret = -EINVAL; /* Configure one of the 16 lines as an interrupt source */ if (irq >= STR71X_IRQ_FIRSTXTI && irq <= NR_IRQS) { /* Make sure that the interrupt is disabled */ str71x_disable_xtiirq(irq); /* Decide if we use the lower or upper regiser */ bit = irq - STR71X_IRQ_FIRSTXTI; ndx = 0; if (bit > 7) { /* Select the high register */ bit -= 8; ndx = 1; } /* Set the rising or trailing edge */ regval = getreg8(g_xtiregs[ndx].tr); if (rising) { regval |= (1 << bit); } else { regval &= ~(1 << bit); } putreg8(regval, g_xtiregs[ndx].tr); /* Return success */ ret = OK; } return ret; }
void up_disable_irq(int irq) { uint32_t reg32; if ((unsigned)irq < STR71X_NBASEIRQS) { /* Mask the IRQ by clearing the associated bit in the IER register */ reg32 = getreg32(STR71X_EIC_IER); reg32 &= ~(1 << irq); putreg32(reg32, STR71X_EIC_IER); } #ifdef CONFIG_STR71X_XTI else if ((unsigned)irq < NR_IRQS) { str71x_disable_xtiirq(irq); } #endif /* CONFIG_STR71X_XTI */ }