u_int32 get_active_gpio_int(void) { u_int32 uStatus; u_int32 uEnabled; u_int32 uBitPos = 0; u_int32 uLoop; LPREG lpIntStatus; LPREG lpIntEnable; /* Check each GPIO register in turn starting with the main (lowest) one */ for(uLoop = 0; uLoop < NUM_GPI_BANKS; uLoop++) { lpIntStatus = (LPREG)(GPI_INT_REG + (uLoop * GPI_BANK_SIZE)); lpIntEnable = (LPREG)(GPI_INT_ENABLE_REG + (uLoop * GPI_BANK_SIZE)); uStatus = *lpIntStatus; uEnabled = *lpIntEnable; uBitPos = find_lowest_bit(uStatus & uEnabled); if(uBitPos != 0xffffffff) break; } if(uBitPos != 0xffffffff) return(uBitPos + (uLoop * 32)); else return 0xffffffff; }
// Find lowest-numbered register from mask, or BAD if mask is empty. OptoReg::Name find_first_elem() const { int base, bits; # define BODY(I) if( (bits = _A[I]) != 0 ) base = I<<_LogWordBits; else FORALL_BODY # undef BODY { base = OptoReg::Bad; bits = 1<<0; } return OptoReg::Name(base + find_lowest_bit(bits)); }
u_int32 get_active_timer_int(void) { u_int32 uStatus; u_int32 uBitPos; /* Take a look at the timer interrupt status register */ uStatus = *lpTimerIntStatus; /* Mask off unused bits */ uStatus &= ((1 << NUM_TIM_BANKS) - 1); uBitPos = find_lowest_bit(uStatus); return(uBitPos); }
u_int32 get_active_exp_int(void) { u_int32 uStatus; u_int32 uEnabled; u_int32 uBitPos; /* Get current enabled mask and status of expansion interrupt */ uStatus = *lpIntExpStatus; #if RTOS == NUP uEnabled = intExpEnable; /* NUP disable the int exp in BSP_IRQ_Handler */ #else uEnabled = *lpIntExpEnable; #endif uBitPos = find_lowest_bit(uStatus & uEnabled); return(uBitPos); }