void md_init_no_logo(void) { u08 force_setup; cli(); // disable interrupts hw_init(); #ifdef MOUSE_UART3 sbi(PORTD, 7); cbi(DDRD, 7); //!!!! mouse uart sbi(PORTD, 6); sbi(DDRD, 6); //!!!! mouse uart #endif sei(); // enable interrupts - the Donkey is off and running #ifdef TIME_CLOCK if(1) { //!!! for time clock maximum wrap test time.hours= 23; time.mins = 59; time.secs = 00; time.month = 12; time.day = 31; time.year = 2007; time.weekday = 6; time.adjust = 0; } #endif #ifdef PANEL_CODE lcd_init(); // initialize LCD hardware lcd_set_stdout(); // make printf() use bitmapped chars #endif #ifdef VCHAR_CODE // vchar_init(); // initialize vector characters // vchar_set_stdout(); // make printf use vector chars #endif lcd_backlight(0xFF); force_setup = 0; user_input_init(); #ifdef CKSUM_CODE check_flash(DELAY_FLAG); // verify FLASH checksum - can also add HALT_FLAG #endif #ifdef CKPT_CODE check_point(0); // see if last run produced a system RAM checkpoint dump to eeprom #endif void contrast_demo(void); //contrast_demo(); //zadc_demo(2); //sketch_a_etch(); //void gps_demo(void); //gps_demo(); //fill_screen(BLACK); //arc(80,40, 20, 30,170, 10); //arc(80,40, 10, 40,160, 1); //wait_until_touched(); //wait_while_touched(); #ifdef USER_INPUT delay_ms(10); // allow some time to pass // might be needed for first get_touch? if(get_touch(1) || MouseRB || MouseLB) { // if screen touched on powerup, force setup menus lcd_clear(); force_setup = 1; set_charsize(3); lcd_textPS(0, 0, "Setup"); set_charsize(1); // wait_while_touched(); // not a good idea. touch cal could be off delay_ms(2000); } calibrate_touch(force_setup); // calibrate touch screen if not already done misc_setup(force_setup); // setup backlight, etc, if not already done #ifdef UART0 // do com0 setup menu, if not already done or forced setup com_setup(0, force_setup); #endif #ifdef UART1 // do com1 setup menu, if not already done or forced setup com_setup(1, force_setup); #endif #endif // no user input device: set default com port parameters // if library build then do donkey splash screen for 2.5 seconds #ifdef LIBRARY_BUILD lcd_clear(); #endif #ifdef MENU_CODE MenuBeep = 1; #endif }
int main(void) { SNES_CIC_PAIR_REG->FIODIR = BV(SNES_CIC_PAIR_BIT); BITBAND(SNES_CIC_PAIR_REG->FIOSET, SNES_CIC_PAIR_BIT) = 1; /* LPC_GPIO2->FIODIR = BV(0) | BV(1) | BV(2); */ // LPC_GPIO0->FIODIR = BV(16); /* connect UART3 on P0[25:26] + SSP0 on P0[15:18] + MAT3.0 on P0[10] */ LPC_PINCON->PINSEL1 = BV(18) | BV(19) | BV(20) | BV(21) /* UART3 */ | BV(3) | BV(5); /* SSP0 (FPGA) except SS */ LPC_PINCON->PINSEL0 = BV(31); /* SSP0 */ /* | BV(13) | BV(15) | BV(17) | BV(19) SSP1 (SD) */ /* pull-down CIC data lines */ LPC_PINCON->PINMODE0 = BV(0) | BV(1) | BV(2) | BV(3); clock_disconnect(); power_init(); timer_init(); DBG_UART uart_init(); led_init(); readled(0); rdyled(1); writeled(0); /* do this last because the peripheral init()s change PCLK dividers */ clock_init(); // LPC_PINCON->PINSEL0 |= BV(20) | BV(21); /* MAT3.0 (FPGA clock) */ sdn_init(); DBG_BL printf("chksum=%08lx\n", *(uint32_t*)28); DBG_BL printf("\n\nsd2snes mk.2 bootloader\nver.: " VER "\ncpu clock: %ld Hz\n", CONFIG_CPU_FREQUENCY); DBG_BL printf("PCONP=%lx\n", LPC_SC->PCONP); /* setup timer (fpga clk) */ LPC_TIM3->CTCR=0; LPC_TIM3->EMR=EMC0TOGGLE; LPC_TIM3->MCR=MR0R; LPC_TIM3->MR0=1; LPC_TIM3->TCR=1; NVIC->ICER[0] = 0xffffffff; NVIC->ICER[1] = 0xffffffff; FLASH_RES res = flash_file((uint8_t*)"/sd2snes/firmware.img"); if(res == ERR_FLASHPREP || res == ERR_FLASHERASE || res == ERR_FLASH) { rdyled(0); writeled(1); } if(res == ERR_FILEHD || res == ERR_FILECHK) { rdyled(0); readled(1); } DBG_BL printf("flash result = %d\n", res); if(res != ERR_OK) { if((res = check_flash()) != ERR_OK) { DBG_BL printf("check_flash() failed with error %d, not booting.\n", res); while(1) { toggle_rdy_led(); delay_ms(500); } } } NVIC_DisableIRQ(RIT_IRQn); NVIC_DisableIRQ(UART_IRQ); SCB->VTOR=FW_START+0x00000100; chain = (void*)(*((uint32_t*)(FW_START+0x00000104))); uart_putc("0123456789abcdef"[((uint32_t)chain>>28)&15]); uart_putc("0123456789abcdef"[((uint32_t)chain>>24)&15]); uart_putc("0123456789abcdef"[((uint32_t)chain>>20)&15]); uart_putc("0123456789abcdef"[((uint32_t)chain>>16)&15]); uart_putc("0123456789abcdef"[((uint32_t)chain>>12)&15]); uart_putc("0123456789abcdef"[((uint32_t)chain>>8)&15]); uart_putc("0123456789abcdef"[((uint32_t)chain>>4)&15]); uart_putc("0123456789abcdef"[((uint32_t)chain)&15]); uart_putc('\n'); chain(); while(1); }