int bcm2835_i2c_init(void) { struct bcm2835_i2c_ctrl *bcm2835_i2c = bcm2835_i2c_get_ctrl(); RegisterInterrupt(BCM2835_IRQ_ID_I2C, bcm2835_i2c_isr, bcm2835_i2c); bcm2835_i2c_debug_print_status(); return 0; }
/* * Setup the timer 0 to generate the tick interrupts at the required frequency. */ static void prvSetupTimerInterrupt( void ) { uint32_t ulCompareMatch; /* Calculate the match value required for our wanted tick rate. */ ulCompareMatch = 1000000 / configTICK_RATE_HZ; /* Protect against divide by zero. Using an if() statement still results in a warning - hence the #if. */ #if portPRESCALE_VALUE != 0 { ulCompareMatch /= ( portPRESCALE_VALUE + 1 ); } #endif DisableInterrupts(); pRegs->CTL = 0x003E0000; pRegs->LOD = ulCompareMatch; pRegs->RLD = ulCompareMatch; pRegs->DIV = portTIMER_PRESCALE; pRegs->CLI = 0; pRegs->CTL = 0x003E00A2; RegisterInterrupt(64, vTickISR, NULL); EnableInterrupt(64); EnableInterrupts(); }