/**************************************************************************** * General purpose debug function ****************************************************************************/ void uart_printf (const char *format, ...) { static bool debug_uart_init = false; va_list ap; if (!debug_uart_init) { uart_init_device(DEBUG_UART_PORT); debug_uart_init = true; } va_start(ap, format); vuprintf(uart_push, NULL, format, ap); va_end(ap); }
int main(void) { unsigned char* loadbuffer; int buffer_size; int rc; int(*kernel_entry)(void); led_init(); clear_leds(LED_ALL); /* NB: something in system_init() prevents H-JTAG from downloading */ /* system_init(); */ kernel_init(); /* enable_interrupt(IRQ_FIQ_STATUS); */ backlight_init(); lcd_init(); lcd_setfont(FONT_SYSFIXED); button_init(); dma_init(); uart_init(); uart_init_device(DEBUG_UART_PORT); /* mini2440_test(); */ /* Show debug messages if button is pressed */ int touch_data; if(button_read_device(&touch_data) & BUTTON_MENU) verbose = true; printf("Rockbox boot loader"); printf("Version " RBVERSION); rc = storage_init(); if(rc) { reset_screen(); error(EATA, rc, true); } disk_init(IF_MD(0)); rc = disk_mount_all(); if (rc<=0) { error(EDISK,rc, true); } printf("Loading firmware"); /* Flush out anything pending first */ commit_discard_idcache(); loadbuffer = (unsigned char*) 0x31000000; buffer_size = (unsigned char*)0x31400000 - loadbuffer; rc = load_firmware(loadbuffer, BOOTFILE, buffer_size); if(rc <= 0) error(EBOOTFILE, rc, true); printf("Loaded firmware %d\n", rc); /* storage_close(); */ system_prepare_fw_start(); commit_discard_idcache(); kernel_entry = (void*) loadbuffer; rc = kernel_entry(); /* end stop - should not get here */ led_flash(LED_ALL, LED_NONE); while (1); /* avoid warning */ }
/**************************************************************************** * serial driver API ****************************************************************************/ void serial_setup (void) { uart_init(); uart_init_device(DEBUG_UART_PORT); }