static void wdt_handler(Event* event, void* opaque) { EnterCriticalSection(); if(wdt_enabled) { SET_REG(WDT_CTRL, WDT_CLR | WDT_ENABLE | ((PRESCALE & WDT_PRE_MASK) << WDT_PRE_SHIFT) | ((CLOCK_CS & WDT_CS_MASK) << WDT_CS_SHIFT)); event_readd(event, period); ++count; } else { // shouldn't be necessary wdt_disable(); wdt_disabled = TRUE; } LeaveCriticalSection(); }
void testEventHandler(Event* event, void* opaque) { printf("Hello iBoot! Up time: %Ld seconds\r\n", timer_get_system_microtime() / 1000000); printf("ClockFrequency: %u Hz\r\n", (unsigned int) ClockFrequency); printf("MemoryFrequency: %u Hz\r\n", (unsigned int) MemoryFrequency); printf("BusFrequency: %u Hz\r\n", (unsigned int) BusFrequency); printf("UnknownFrequency: %u Hz\r\n", (unsigned int) UnknownFrequency); printf("PeripheralFrequency: %u Hz\r\n", (unsigned int) PeripheralFrequency); printf("Unknown2Frequency: %u Hz\r\n", (unsigned int) Unknown2Frequency); printf("FixedFrequency: %u Hz\r\n", (unsigned int) FixedFrequency); printf("TimebaseFrequency: %u Hz\r\n", (unsigned int) TimebaseFrequency); printf("PLL0 Frequency: %u Hz\r\n", (unsigned int) PLLFrequencies[0]); printf("PLL1 Frequency: %u Hz\r\n", (unsigned int) PLLFrequencies[1]); printf("PLL2 Frequency: %u Hz\r\n", (unsigned int) PLLFrequencies[2]); printf("PLL3 Frequency: %u Hz\r\n", (unsigned int) PLLFrequencies[3]); void* x = malloc(32214); malloc_stats(); free(x); printf("\n\n"); event_readd(event, 0); }