int main(void) { /* initialize LED and debug unit */ led_init(); sysirq_init(); AT91F_DBGU_Init(); AT91F_PIOA_CfgPMC(); wdt_init(); pit_init(); blinkcode_init(); /* initialize USB */ req_ctx_init(); usbcmd_gen_init(); udp_open(); /* call application specific init function */ _init_func(); // Enable User Reset and set its minimal assertion to 960 us AT91C_BASE_RSTC->RSTC_RMR = AT91C_RSTC_URSTEN | (0x4 << 8) | (unsigned int)(0xA5 << 24); #ifdef DEBUG_CLOCK_PA6 AT91F_PMC_EnablePCK(AT91C_BASE_PMC, 0, AT91C_PMC_CSS_PLL_CLK); AT91F_PIO_CfgPeriph(AT91C_BASE_PIOA, 0, AT91C_PA6_PCK0); #endif /* switch on first led */ led_switch(2, 1); DEBUGPCRF("entering main (idle) loop"); while (1) { /* Call application specific main idle function */ _main_func(); dbgu_rb_flush(); /* restart watchdog timer */ wdt_restart(); #ifdef CONFIG_IDLE //cpu_idle(); #endif } }
static inline void prvSetupHardware (void) { /* When using the JTAG debugger the hardware is not always initialised to the correct default state. This line just ensures that this does not cause all interrupts to be masked at the start. */ AT91C_BASE_AIC->AIC_EOICR = 0; /* Enable the peripheral clock. */ AT91C_BASE_PMC->PMC_PCER = 1 << AT91C_ID_PIOA; AT91C_BASE_PMC->PMC_PCER = 1 << AT91C_ID_PIOB; /* initialize environment variables */ AT91F_DBGU_Init(); env_init(); if(!env_load()) { env.e.mode=0; env.e.reader_id=1; env_store(); } }