void platform_init_interrupts(void) { unsigned int i; // reset the controller *REG32(INTC_SYSCONFIG) = 0x2; // start a reset while ((*REG32(INTC_SYSSTATUS) & 0x1) == 0) ; // mask all interrupts *REG32(INTC_MIR(0)) = 0xffffffff; *REG32(INTC_MIR(1)) = 0xffffffff; *REG32(INTC_MIR(2)) = 0xffffffff; // set up each of the interrupts for (i = 0; i < INT_VECTORS; i++) { // set each vector up as high priority IRQ *REG32(INTC_ILR(i)) = 0; //*ICReg(i / 32, INTCON_ILR_BASE + 4*(i%32)) = ((level_trigger[i/32] & (1<<(i%32))) ? (1<<1) : (0<<1)) | 0; } // disable the priority threshold *REG32(INTC_THRESHOLD) = 0xff; // clear any pending sw interrupts *REG32(INTC_ISR_CLEAR(0)) = 0xffffffff; *REG32(INTC_ISR_CLEAR(1)) = 0xffffffff; *REG32(INTC_ISR_CLEAR(2)) = 0xffffffff; // globally unmask interrupts *REG32(INTC_CONTROL) = 3; // reset and enable the controller }
/** * \brief This API assigns a priority to an interrupt and routes it to * either IRQ or to FIQ. Priority 0 is the highest priority level * Among the host interrupts, FIQ has more priority than IRQ. * * \param intrNum - Interrupt number * \param priority - Interrupt priority level * \param hostIntRoute - The host interrupt IRQ/FIQ to which the interrupt * is to be routed. * 'priority' can take any value from 0 to 127, 0 being the highest and * 127 being the lowest priority. * * 'hostIntRoute' can take one of the following values \n * AINTC_HOSTINT_ROUTE_IRQ - To route the interrupt to IRQ \n * AINTC_HOSTINT_ROUTE_FIQ - To route the interrupt to FIQ * * \return None. * **/ void IntPrioritySet(unsigned int intrNum, unsigned int priority, unsigned int hostIntRoute) { HWREG(SOC_AINTC_REGS + INTC_ILR(intrNum)) = ((priority << INTC_ILR_PRIORITY_SHIFT) & INTC_ILR_PRIORITY) | hostIntRoute ; }