static void ctrl_sam3ucfg_cb(void) { switch(udd_g_ctrlreq.req.wValue & 0xFF) { /* Turn on slow clock */ case 0x01: osc_enable(OSC_MAINCK_XTAL); osc_wait_ready(OSC_MAINCK_XTAL); pmc_switch_mck_to_mainck(CONFIG_SYSCLK_PRES); break; /* Turn off slow clock */ case 0x02: pmc_switch_mck_to_pllack(CONFIG_SYSCLK_PRES); break; /* Jump to ROM-resident bootloader */ case 0x03: /* Turn off connected stuff */ board_power(0); /* Clear ROM-mapping bit. */ efc_perform_command(EFC0, EFC_FCMD_CGPB, 1); /* Disconnect USB (will kill connection) */ udc_detach(); /* With knowledge that I will rise again, I lay down my life. */ while (RSTC->RSTC_SR & RSTC_SR_SRCMP); RSTC->RSTC_CR |= RSTC_CR_KEY(0xA5) | RSTC_CR_PERRST | RSTC_CR_PROCRST; while(1); break; #ifdef PLATFORMCW1180 /* 0xA0 starts CW1180 Specific Commands */ case 0xA0: enable_lcd(); redraw_background(); break; #endif /* Oh well, sucks to be you */ default: break; } }
/** * Initialize the lcd */ void lcd_init() { enable_lcd(); setPin( LCD_PORT, LCD_RST, 0 ); setPin( LCD_PORT, LCD_RST, 1 ); ROM_SysCtlDelay( 500 ); spi_command( SLEEPOUT ); spi_command( BSTRON ); spi_command( COLMOD ); spi_command( MADCTL ); spi_data( 0xC0 ); spi_command( SETCON ); spi_data( 0x40 ); spi_command( DISPON ); setPin( LCD_PORT, LCD_CS, 0 ); lcd_clear(); }
int arch_early_init_r(void) { enable_lcd(); return 0; }