bool lcd_debug_screen(void) { lcd_setfont(FONT_SYSFIXED); while(1) { int button = get_action(CONTEXT_STD, HZ / 10); switch(button) { case ACTION_STD_NEXT: case ACTION_STD_PREV: case ACTION_STD_OK: case ACTION_STD_MENU: lcd_setfont(FONT_UI); return true; case ACTION_STD_CANCEL: lcd_setfont(FONT_UI); return false; } lcd_clear_display(); lcd_putsf(0, 0, "has power: %d", lcd_has_power); lcd_putsf(0, 1, "lcd kind: %d", lcd_kind); lcd_update(); yield(); } return true; }
bool dbg_hw_info_adc(void) { lcd_setfont(FONT_SYSFIXED); while(1) { int button = get_action(CONTEXT_STD, HZ / 25); switch(button) { case ACTION_STD_NEXT: case ACTION_STD_PREV: case ACTION_STD_OK: case ACTION_STD_MENU: lcd_setfont(FONT_UI); return true; case ACTION_STD_CANCEL: lcd_setfont(FONT_UI); return false; } lcd_clear_display(); /* add battery readout in mV, this it is not the direct output of a channel */ lcd_putsf(0, 0, "Battery(mV) %d", _battery_voltage()); for(unsigned i = 0; i < NUM_ADC_CHANNELS; i++) { lcd_putsf(0, i + 1, "%s %d", imx233_adc_channel_name[i], adc_read(i)); } lcd_update(); yield(); } }
bool dbg_hw_info_rtc(void) { lcd_setfont(FONT_SYSFIXED); while(1) { int button = get_action(CONTEXT_STD, HZ / 10); switch(button) { case ACTION_STD_NEXT: case ACTION_STD_PREV: case ACTION_STD_OK: case ACTION_STD_MENU: lcd_setfont(FONT_UI); return true; case ACTION_STD_CANCEL: lcd_setfont(FONT_UI); return false; } lcd_clear_display(); struct imx233_rtc_info_t info = imx233_rtc_get_info(); lcd_putsf(0, 0, "seconds: %lu", info.seconds); for(int i = 0; i < 6; i++) lcd_putsf(0, i + 1, "persistent%d: 0x%lx", i, info.persistent[i]); lcd_update(); yield(); } }
bool dbg_ports(void) { int line; lcd_setfont(FONT_SYSFIXED); while(1) { lcd_clear_display(); line = 0; _DEBUG_PRINTF("GPIO_PADR: %02x",(unsigned char)GPIO_PADR); _DEBUG_PRINTF("GPIO_PACON: %02x",(unsigned char)GPIO_PACON); _DEBUG_PRINTF("GPIO_PBDR: %02x",(unsigned char)GPIO_PBDR); _DEBUG_PRINTF("GPIO_PBCON: %02x",(unsigned char)GPIO_PBCON); _DEBUG_PRINTF("GPIO_PCDR: %02x",(unsigned char)GPIO_PCDR); _DEBUG_PRINTF("GPIO_PCCON: %02x",(unsigned char)GPIO_PCCON); _DEBUG_PRINTF("GPIO_PDDR: %02x",(unsigned char)GPIO_PDDR); _DEBUG_PRINTF("GPIO_PDCON: %02x",(unsigned char)GPIO_PDCON); _DEBUG_PRINTF("ADC0: %d", adc_read(0)); _DEBUG_PRINTF("ADC1: %d", adc_read(1)); _DEBUG_PRINTF("ADC2: %d", adc_read(2)); _DEBUG_PRINTF("ADC3: %d", adc_read(3)); lcd_update(); if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) break; } lcd_setfont(FONT_UI); return false; }
bool dbg_hw_info(void) { int line; lcd_clear_display(); lcd_setfont(FONT_SYSFIXED); while(1) { lcd_clear_display(); line = 0; /* _DEBUG_PRINTF statements can be added here to show debug info */ _DEBUG_PRINTF("SCU_ID: 0x%0x", SCU_ID); _DEBUG_PRINTF("SCU_PLLCON1: 0x%0x", SCU_PLLCON1); _DEBUG_PRINTF("SCU_PLLCON2: 0x%0x", SCU_PLLCON2); _DEBUG_PRINTF("SCU_PLLCON3: 0x%0x", SCU_PLLCON3); _DEBUG_PRINTF("SCU_DIVCON1: 0x%0x", SCU_DIVCON1); _DEBUG_PRINTF("SCU_CLKCFG: 0x%0x", SCU_CLKCFG); _DEBUG_PRINTF("SCU_CHIPCFG: 0x%0x", SCU_CHIPCFG); line++; _DEBUG_PRINTF("sd_debug_time_rd: %d", sd_debug_time_rd); _DEBUG_PRINTF("sd_debug_time_wr: %d", sd_debug_time_wr); lcd_update(); switch(button_get_w_tmo(HZ/20)) { case DEBUG_CANCEL: case BUTTON_REL: lcd_setfont(FONT_UI); return false; } } lcd_setfont(FONT_UI); return false; }
bool dbg_hw_info(void) { unsigned manu, id; /* flash IDs */ int got_id; /* flag if we managed to get the flash IDs */ int oldmode; /* saved memory guard mode */ int line = 0; oldmode = system_memory_guard(MEMGUARD_NONE); /* disable memory guard */ /* get flash ROM type */ got_id = dbg_flash_id(&manu, &id, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */ if (!got_id) got_id = dbg_flash_id(&manu, &id, 0x555, 0x2AA); /* try AMD, Macronix */ system_memory_guard(oldmode); /* re-enable memory guard */ lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); lcd_puts(0, line++, "[Hardware info]"); if (got_id) lcd_putsf(0, line++, "Flash: M=%04x D=%04x", manu, id); else lcd_puts(0, line++, "Flash: M=???? D=????"); /* unknown, sorry */ #ifdef IAUDIO_X5 { struct ds2411_id id; lcd_puts(0, ++line, "Serial Number:"); got_id = ds2411_read_id(&id); if (got_id == DS2411_OK) { lcd_putsf(0, ++line, " FC=%02x", (unsigned)id.family_code); lcd_putsf(0, ++line, " ID=%02X %02X %02X %02X %02X %02X", (unsigned)id.uid[0], (unsigned)id.uid[1], (unsigned)id.uid[2], (unsigned)id.uid[3], (unsigned)id.uid[4], (unsigned)id.uid[5]); lcd_putsf(0, ++line, " CRC=%02X", (unsigned)id.crc); } else { lcd_putsf(0, ++line, "READ ERR=%d", got_id); } } #endif lcd_update(); /* wait for exit */ while (button_get_w_tmo(HZ/10) != (DEBUG_CANCEL|BUTTON_REL)); lcd_setfont(FONT_UI); return false; }
bool dbg_hw_info_power(void) { lcd_setfont(FONT_SYSFIXED); while(1) { int button = get_action(CONTEXT_STD, HZ / 10); switch(button) { case ACTION_STD_NEXT: case ACTION_STD_PREV: case ACTION_STD_OK: case ACTION_STD_MENU: lcd_setfont(FONT_UI); return true; case ACTION_STD_CANCEL: lcd_setfont(FONT_UI); return false; } lcd_clear_display(); struct imx233_power_info_t info = imx233_power_get_info(POWER_INFO_ALL); int line = 0; unsigned trg, bo; bool en; int linreg; char buf[16]; lcd_putsf(0, line++, "name value bo linreg"); #define DISP_REGULATOR(name) \ imx233_power_get_regulator(REGULATOR_##name, &trg, &bo); \ imx233_power_get_regulator_linreg(REGULATOR_##name, &en, &linreg); \ if(en) snprintf(buf, sizeof(buf), "%d", linreg); \ else snprintf(buf, sizeof(buf), " "); \ lcd_putsf(0, line++, "%6s %4d %4d %s", #name, trg, bo, buf); \ DISP_REGULATOR(VDDD); DISP_REGULATOR(VDDA); DISP_REGULATOR(VDDIO); DISP_REGULATOR(VDDMEM); lcd_putsf(0, line++, "DC-DC: pll: %d freq: %d", info.dcdc_sel_pllclk, info.dcdc_freqsel); lcd_putsf(0, line++, "charge: %d mA stop: %d mA", info.charge_current, info.stop_current); lcd_putsf(0, line++, "charging: %d bat_adj: %d", info.charging, info.batt_adj); lcd_putsf(0, line++, "4.2: en: %d dcdc: %d", info._4p2_enable, info._4p2_dcdc); lcd_putsf(0, line++, "4.2: cmptrip: %d dropout: %d", info._4p2_cmptrip, info._4p2_dropout); lcd_putsf(0, line++, "5V: pwd_4.2_charge: %d", info._5v_pwd_charge_4p2); lcd_putsf(0, line++, "5V: chargelim: %d mA", info._5v_charge_4p2_limit); lcd_putsf(0, line++, "5V: dcdc: %d xfer: %d", info._5v_enable_dcdc, info._5v_dcdc_xfer); lcd_putsf(0, line++, "5V: thr: %d mV use: %d cmps: %d", info._5v_vbusvalid_thr, info._5v_vbusvalid_detect, info._5v_vbus_cmps); lcd_update(); yield(); } }
bool dbg_hw_info_pinctrl(void) { lcd_setfont(FONT_SYSFIXED); #ifdef IMX233_PINCTRL_DEBUG unsigned top_user = 0; #endif while(1) { int button = get_action(CONTEXT_STD, HZ / 10); switch(button) { case ACTION_STD_NEXT: #ifdef IMX233_PINCTRL_DEBUG top_user++; break; #endif case ACTION_STD_PREV: #ifdef IMX233_PINCTRL_DEBUG if(top_user > 0) top_user--; break; #endif case ACTION_STD_OK: case ACTION_STD_MENU: lcd_setfont(FONT_UI); return true; case ACTION_STD_CANCEL: lcd_setfont(FONT_UI); return false; } lcd_clear_display(); for(int i = 0; i < 4; i++) lcd_putsf(0, i, "DIN%d = 0x%08x", i, imx233_get_gpio_input_mask(i, 0xffffffff)); #ifdef IMX233_PINCTRL_DEBUG unsigned cur_line = 6; unsigned last_line = lcd_getheight() / font_get(lcd_getfont())->height; unsigned cur_idx = 0; for(int bank = 0; bank < 4; bank++) for(int pin = 0; pin < 32; pin++) { const char *owner = imx233_pinctrl_get_pin_use(bank, pin); if(owner == NULL) continue; if(cur_idx++ >= top_user && cur_line < last_line) lcd_putsf(0, cur_line++, "B%dP%02d %s", bank, pin, owner); } if(cur_idx < top_user) top_user = cur_idx - 1; #endif lcd_update(); yield(); } }
bool dbg_hw_info_ocotp(void) { lcd_setfont(FONT_SYSFIXED); unsigned top_user = 0; while(1) { int button = get_action(CONTEXT_STD, HZ / 10); switch(button) { case ACTION_STD_NEXT: top_user++; break; case ACTION_STD_PREV: if(top_user > 0) top_user--; break; case ACTION_STD_OK: case ACTION_STD_MENU: lcd_setfont(FONT_UI); return true; case ACTION_STD_CANCEL: lcd_setfont(FONT_UI); return false; } lcd_clear_display(); unsigned cur_line = 0; unsigned last_line = lcd_getheight() / font_get(lcd_getfont())->height; unsigned i = 0; for(i = 0; i < ARRAYLEN(dbg_ocotp); i++) { if(i >= top_user && cur_line < last_line) { lcd_putsf(0, cur_line, "%s", dbg_ocotp[i].name); lcd_putsf(8, cur_line++, "%x", imx233_ocotp_read(dbg_ocotp[i].addr)); } } if(i < top_user) top_user = i - 1; lcd_update(); yield(); } }
bool dbg_hw_info_dcp(void) { lcd_setfont(FONT_SYSFIXED); while(1) { int button = get_action(CONTEXT_STD, HZ / 10); switch(button) { case ACTION_STD_NEXT: case ACTION_STD_PREV: case ACTION_STD_OK: case ACTION_STD_MENU: lcd_setfont(FONT_UI); return true; case ACTION_STD_CANCEL: lcd_setfont(FONT_UI); return false; } lcd_clear_display(); struct imx233_dcp_info_t info = imx233_dcp_get_info(DCP_INFO_ALL); lcd_putsf(0, 0, "crypto: %d csc: %d", info.has_crypto, info.has_csc); lcd_putsf(0, 1, "keys: %d channels: %d", info.num_keys, info.num_channels); lcd_putsf(0, 2, "ciphers: 0x%lx hash: 0x%lx", info.ciphers, info.hashs); lcd_putsf(0, 3, "gather wr: %d otp rdy: %d ch0merged: %d", info.gather_writes, info.otp_key_ready, info.ch0_merged); lcd_putsf(0, 4, "ctx switching: %d caching: %d", info.context_switching, info.context_caching); lcd_putsf(0, 5, "ch irq ien en rdy pri sem cmdptr a"); int nr = HW_DCP_NUM_CHANNELS; for(int i = 0; i < nr; i++) { lcd_putsf(0, 6 + i, "%d %d %d %d %d %d %d 0x%08lx %d", i, info.channel[i].irq, info.channel[i].irq_en, info.channel[i].enable, info.channel[i].ready, info.channel[i].high_priority, info.channel[i].sema, info.channel[i].cmdptr, info.channel[i].acquired); } lcd_putsf(0, 6 + nr, "csc %d %d %d %d", info.csc.irq, info.csc.irq_en, info.csc.enable, info.csc.priority); lcd_update(); yield(); } }
void screen_helper_setfont(int font) { (void)font; #ifdef HAVE_LCD_BITMAP if (font == FONT_UI) font = global_status.font_id[SCREEN_MAIN]; lcd_setfont(font); #endif }
bool dbg_hw_info_icoll(void) { lcd_setfont(FONT_SYSFIXED); int first_irq = 0; int dbg_irqs_count = sizeof(dbg_irqs) / sizeof(dbg_irqs[0]); int line_count = lcd_getheight() / font_get(lcd_getfont())->height; while(1) { int button = get_action(CONTEXT_STD, HZ / 10); switch(button) { case ACTION_STD_NEXT: first_irq++; if(first_irq >= dbg_irqs_count) first_irq = dbg_irqs_count - 1; break; case ACTION_STD_PREV: first_irq--; if(first_irq < 0) first_irq = 0; break; case ACTION_STD_OK: case ACTION_STD_MENU: lcd_setfont(FONT_UI); return true; case ACTION_STD_CANCEL: lcd_setfont(FONT_UI); return false; } lcd_clear_display(); for(int i = first_irq, j = 0; i < dbg_irqs_count && j < line_count; i++, j++) { struct imx233_icoll_irq_info_t info = imx233_icoll_get_irq_info(dbg_irqs[i].src); lcd_putsf(0, j, "%s", dbg_irqs[i].name); if(info.enabled) lcd_putsf(10, j, "%d", info.freq); } lcd_update(); yield(); } }
bool dbg_hw_info_powermgmt(void) { lcd_setfont(FONT_SYSFIXED); while(1) { int button = get_action(CONTEXT_STD, HZ / 10); switch(button) { case ACTION_STD_NEXT: case ACTION_STD_PREV: case ACTION_STD_OK: case ACTION_STD_MENU: lcd_setfont(FONT_UI); return true; case ACTION_STD_CANCEL: lcd_setfont(FONT_UI); return false; } lcd_clear_display(); struct imx233_powermgmt_info_t info = imx233_powermgmt_get_info(); lcd_putsf(0, 0, "state: %s", info.state == CHARGE_STATE_DISABLED ? "disabled" : info.state == CHARGE_STATE_ERROR ? "error" : info.state == DISCHARGING ? "discharging" : info.state == TRICKLE ? "trickle" : info.state == TOPOFF ? "topoff" : info.state == CHARGING ? "charging" : "<unknown>"); lcd_putsf(0, 1, "charging tmo: %d", info.charging_timeout); lcd_putsf(0, 2, "topoff tmo: %d", info.topoff_timeout); lcd_putsf(0, 3, "4p2ilimit tmo: %d", info.incr_4p2_ilimit_timeout); lcd_update(); yield(); } }
bool dbg_hw_info_dma(void) { lcd_setfont(FONT_SYSFIXED); while(1) { int button = get_action(CONTEXT_STD, HZ / 25); switch(button) { case ACTION_STD_NEXT: case ACTION_STD_PREV: case ACTION_STD_OK: case ACTION_STD_MENU: lcd_setfont(FONT_UI); return true; case ACTION_STD_CANCEL: lcd_setfont(FONT_UI); return false; } lcd_clear_display(); lcd_putsf(0, 0, "S C name bar apb ahb una"); for(unsigned i = 0; i < ARRAYLEN(dbg_channels); i++) { struct imx233_dma_info_t info = imx233_dma_get_info(dbg_channels[i].chan, DMA_INFO_ALL); lcd_putsf(0, i + 1, "%c %c %4s %8x %3x %3x %3x", info.gated ? 'g' : info.freezed ? 'f' : ' ', !info.int_enabled ? '-' : info.int_error ? 'e' : info.int_cmdcomplt ? 'c' : ' ', dbg_channels[i].name, info.bar, info.apb_bytes, info.ahb_bytes, info.nr_unaligned); } lcd_update(); yield(); } }
bool dbg_ports(void) { int line; lcd_setfont(FONT_SYSFIXED); while(1) { lcd_clear_display(); line = 0; _DEBUG_PRINTF("GPIO 0: %08x",(unsigned int)PDAT(0)); _DEBUG_PRINTF("GPIO 1: %08x",(unsigned int)PDAT(1)); _DEBUG_PRINTF("GPIO 2: %08x",(unsigned int)PDAT(2)); _DEBUG_PRINTF("GPIO 3: %08x",(unsigned int)PDAT(3)); _DEBUG_PRINTF("GPIO 4: %08x",(unsigned int)PDAT(4)); _DEBUG_PRINTF("GPIO 5: %08x",(unsigned int)PDAT(5)); _DEBUG_PRINTF("GPIO 6: %08x",(unsigned int)PDAT(6)); _DEBUG_PRINTF("GPIO 7: %08x",(unsigned int)PDAT(7)); _DEBUG_PRINTF("GPIO 8: %08x",(unsigned int)PDAT(8)); _DEBUG_PRINTF("GPIO 9: %08x",(unsigned int)PDAT(9)); _DEBUG_PRINTF("GPIO 10: %08x",(unsigned int)PDAT(10)); _DEBUG_PRINTF("GPIO 11: %08x",(unsigned int)PDAT(11)); _DEBUG_PRINTF("GPIO 12: %08x",(unsigned int)PDAT(12)); _DEBUG_PRINTF("GPIO 13: %08x",(unsigned int)PDAT(13)); _DEBUG_PRINTF("GPIO 14: %08x",(unsigned int)PDAT(14)); _DEBUG_PRINTF("GPIO 15: %08x",(unsigned int)PDAT(15)); _DEBUG_PRINTF("USEC : %08x",(unsigned int)USEC_TIMER); lcd_update(); if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) break; } lcd_setfont(FONT_UI); return false; }
bool __dbg_hw_info(void) { int line = 0, i, button, oldline; bool done=false; char buf[100]; lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); /* Put all the static text before the while loop */ lcd_puts(0, line++, "[Hardware info]"); line++; oldline=line; while(!done) { line = oldline; button = button_get(false); button &= ~BUTTON_REPEAT; #ifdef BUTTON_SELECT if (button == BUTTON_SELECT) #else if (button == BUTTON_STOP) #endif done=true; snprintf(buf, sizeof(buf), "current tick: %08x Seconds running: %08d", (unsigned int)current_tick, (unsigned int)current_tick/100); lcd_puts(0, line++, buf); snprintf(buf, sizeof(buf), "GPIOA: 0x%08x GPIOB: 0x%08x", (unsigned int)GPIOA, (unsigned int)GPIOB); lcd_puts(0, line++, buf); snprintf(buf, sizeof(buf), "GPIOC: 0x%08x GPIOD: 0x%08x", (unsigned int)GPIOC, (unsigned int)GPIOD); lcd_puts(0, line++, buf); snprintf(buf, sizeof(buf), "GPIOE: 0x%08x", (unsigned int)GPIOE); lcd_puts(0, line++, buf); for (i = 0; i<4; i++) { snprintf(buf, sizeof(buf), "ADC%d: 0x%04x", i, adc_read(i)); lcd_puts(0, line++, buf); } lcd_update(); } return false; }
static void sig_handler(int sig, siginfo_t *siginfo, void *context) { /* safe guard variable - we call backtrace() only on first * UIE call. This prevent endless loop if backtrace() touches * memory regions which cause abort */ static bool triggered = false; lcd_set_backdrop(NULL); lcd_set_drawmode(DRMODE_SOLID); lcd_set_foreground(LCD_BLACK); lcd_set_background(LCD_WHITE); unsigned line = 0; lcd_setfont(FONT_SYSFIXED); lcd_set_viewport(NULL); lcd_clear_display(); /* get context info */ ucontext_t *uc = (ucontext_t *)context; unsigned long pc = uc->uc_mcontext.pc; unsigned long sp = uc->uc_mcontext.gregs[29]; lcd_putsf(0, line++, "%s at %08x", strsignal(sig), pc); if(sig == SIGILL || sig == SIGFPE || sig == SIGSEGV || sig == SIGBUS || sig == SIGTRAP) lcd_putsf(0, line++, "address 0x%08x", siginfo->si_addr); if(!triggered) { triggered = true; rb_backtrace(pc, sp, &line); } #ifdef ROCKBOX_HAS_LOGF lcd_putsf(0, line++, "logf:"); logf_panic_dump(&line); #endif lcd_update(); system_exception_wait(); /* If this returns, try to reboot */ system_reboot(); while (1); /* halt */ }
int show_logo( void ) { lcd_clear_display(); lcd_setfont(FONT_SYSFIXED); #ifdef SANSA_CLIP /* The top 16 lines of the Sansa Clip screen are yellow, and the bottom 48 are blue, so we reverse the usual positioning */ lcd_putsxy(TEXT_XPOS, 0, BOOT_VERSION); lcd_bitmap(rockboxlogo, 0, 16, BMPWIDTH_rockboxlogo, BMPHEIGHT_rockboxlogo); #else lcd_bitmap(rockboxlogo, 0, 10, BMPWIDTH_rockboxlogo, BMPHEIGHT_rockboxlogo); lcd_putsxy(TEXT_XPOS, LCD_HEIGHT-SYSFONT_HEIGHT, BOOT_VERSION); #endif lcd_update(); return 0; }
bool dbg_hw_info(void) { int line = 0, i, button, oldline; bool done=false; lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); /* Put all the static text before the while loop */ lcd_puts(0, line++, "[Hardware info]"); line++; oldline=line; while(!done) { line = oldline; button = button_get(false); button &= ~BUTTON_REPEAT; #ifdef BUTTON_SELECT if (button == BUTTON_SELECT) #else if (button == BUTTON_STOP) #endif done=true; lcd_putsf(0, line++, "current tick: %08lx Seconds running: %08ld", current_tick, current_tick/HZ); lcd_putsf(0, line++, "GPIOA: 0x%08lx GPIOB: 0x%08lx", GPIOA, GPIOB); lcd_putsf(0, line++, "GPIOC: 0x%08lx GPIOD: 0x%08lx", GPIOC, GPIOD); lcd_putsf(0, line++, "GPIOE: 0x%08lx", GPIOE); for (i = 0; i<4; i++) lcd_putsf(0, line++, "ADC%d: 0x%04x", i, adc_read(i)); lcd_update(); } return false; }
bool dbg_hw_info(void) { int line = 0, i, oldline; lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); /* Put all the static text before the while loop */ lcd_puts(0, line++, "[Hardware info]"); line++; oldline=line; while (1) { line = oldline; if (button_get_w_tmo(HZ/20) == (BUTTON_POWER|BUTTON_REL)) break; lcd_putsf(0, line++, "current tick: %08lx Seconds running: %08ld", current_tick, current_tick/HZ); lcd_putsf(0, line++, "GPIOA: 0x%08lx GPIOB: 0x%08lx", GPIOA, GPIOB); lcd_putsf(0, line++, "GPIOC: 0x%08lx GPIOD: 0x%08lx", GPIOC, GPIOD); lcd_putsf(0, line++, "GPIOE: 0x%08lx", GPIOE); for (i = 0; i<4; i++) lcd_putsf(0, line++, "ADC%d: 0x%04x", i, adc_read(i)); lcd_putsf(0, line++, "STS: 0x%08lx SRC: 0x%08lx", STS, SRC); lcd_update(); } return false; }
bool dbg_hw_info(void) { int line; int i; unsigned int state = 0; const unsigned int max_states=3; lcd_clear_display(); lcd_setfont(FONT_SYSFIXED); state=0; while(1) { lcd_clear_display(); line = 0; if(state == 0) { _DEBUG_PRINTF("CPU:"); _DEBUG_PRINTF("current_tick: %d", (unsigned int)current_tick); line++; _DEBUG_PRINTF("LCD type: %d", lcd_type); line++; } else if(state==1) { _DEBUG_PRINTF("PMU:"); for(i=0;i<7;i++) { char *device[] = {"(unknown)", "(unknown)", "(unknown)", "(unknown)", "(unknown)", "(unknown)", "(unknown)"}; _DEBUG_PRINTF("ldo%d %s: %dmV %s",i, pmu_read(0x2e + (i << 1))?" on":"off", 900 + pmu_read(0x2d + (i << 1))*100, device[i]); } _DEBUG_PRINTF("cpu voltage: %dmV",625 + pmu_read(0x1e)*25); _DEBUG_PRINTF("memory voltage: %dmV",625 + pmu_read(0x22)*25); line++; _DEBUG_PRINTF("charging: %s", charging_state() ? "true" : "false"); _DEBUG_PRINTF("backlight: %s", pmu_read(0x29) ? "on" : "off"); _DEBUG_PRINTF("brightness value: %d", pmu_read(0x28)); } else if(state==2) { _DEBUG_PRINTF("Audio DMA:"); _DEBUG_PRINTF(">%08X %08X %08X %08X %08X", DMAC0C0CONFIG, DMAC0C0SRCADDR, DMAC0C0DESTADDR, DMAC0C0NEXTLLI, DMAC0C0CONTROL); for(i = 0; i < PCM_LLICOUNT; i++) _DEBUG_PRINTF("%08X: %08X %08X %08X %08X", &pcm_lli[i], pcm_lli[i].srcaddr, pcm_lli[i].dstaddr, pcm_lli[i].nextlli, pcm_lli[i].control); _DEBUG_PRINTF("chunk: %08X %08X", pcm_chunksize, pcm_remaining); } else { state=0; } lcd_update(); switch(button_get_w_tmo(HZ/20)) { case BUTTON_SCROLL_BACK: if(state!=0) state--; break; case BUTTON_SCROLL_FWD: if(state!=max_states-1) { state++; } break; case DEBUG_CANCEL: case BUTTON_REL: lcd_setfont(FONT_UI); return false; } } lcd_setfont(FONT_UI); return false; }
bool __dbg_hw_info(void) { int line = 0, oldline; int button; #if defined(MROBE_500) int *address=0x0; #endif bool done=false; lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); /* Put all the static text befor the while loop */ lcd_puts(0, line++, "[Hardware info]"); lcd_puts(0, line++, "Clock info:"); #if LCD_WIDTH > 320 lcd_putsf(0, line++, "IO_CLK_PLLA: 0x%04x IO_CLK_PLLB: 0x%04x " "IO_CLK_SEL0: 0x%04x IO_CLK_SEL1: 0x%04x", IO_CLK_PLLA, IO_CLK_PLLB, IO_CLK_SEL0, IO_CLK_SEL1); lcd_putsf(0, line++, "IO_CLK_SEL2: 0x%04x IO_CLK_DIV0: 0x%04x " "IO_CLK_DIV1: 0x%04x IO_CLK_DIV2: 0x%04x", IO_CLK_SEL2, IO_CLK_DIV0, IO_CLK_DIV1, IO_CLK_DIV2); lcd_putsf(0, line++, "IO_CLK_DIV3: 0x%04x IO_CLK_DIV4: 0x%04x " "IO_CLK_BYP : 0x%04x IO_CLK_INV : 0x%04x", IO_CLK_DIV3, IO_CLK_DIV4, IO_CLK_BYP, IO_CLK_INV); lcd_putsf(0, line++, "IO_CLK_MOD0: 0x%04x IO_CLK_MOD1: 0x%04x " "IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x", IO_CLK_MOD0, IO_CLK_MOD1, IO_CLK_MOD2, IO_CLK_LPCTL0); #else lcd_putsf(0, line++, " IO_CLK_PLLA: 0x%04x IO_CLK_PLLB: 0x%04x", IO_CLK_PLLA, IO_CLK_PLLB); lcd_putsf(0, line++, " IO_CLK_SEL0: 0x%04x IO_CLK_SEL1: 0x%04x", IO_CLK_SEL0, IO_CLK_SEL1); lcd_putsf(0, line++, " IO_CLK_SEL2: 0x%04x IO_CLK_DIV0: 0x%04x", IO_CLK_SEL2, IO_CLK_DIV0); lcd_putsf(0, line++, " IO_CLK_DIV1: 0x%04x IO_CLK_DIV2: 0x%04x", IO_CLK_DIV1, IO_CLK_DIV2); lcd_putsf(0, line++, " IO_CLK_DIV3: 0x%04x IO_CLK_DIV4: 0x%04x", IO_CLK_DIV3, IO_CLK_DIV4); lcd_putsf(0, line++, " IO_CLK_BYP : 0x%04x IO_CLK_INV : 0x%04x", IO_CLK_BYP, IO_CLK_INV); lcd_putsf(0, line++, " IO_CLK_MOD0: 0x%04x IO_CLK_MOD1: 0x%04x ", IO_CLK_MOD0, IO_CLK_MOD1); lcd_putsf(0, line++, " IO_CLK_MOD2: 0x%04x IO_CLK_LPCTL0: 0x%04x ", IO_CLK_MOD2, IO_CLK_LPCTL0); #endif lcd_puts(0, line++, "Interrupt info:"); lcd_putsf(0, line++, " IO_INTC_EINT0: 0x%04x IO_INTC_EINT1: 0x%04x ", IO_INTC_EINT0, IO_INTC_EINT1); lcd_putsf(0, line++, " IO_INTC_EINT2: 0x%04x IO_INTC_IRQ0: 0x%04x ", IO_INTC_EINT2, IO_INTC_IRQ0); lcd_putsf(0, line++, " IO_INTC_IRQ1: 0x%04x IO_INTC_IRQ2: 0x%04x ", IO_INTC_IRQ1, IO_INTC_IRQ2); lcd_puts(0, line++, "Board revision:"); switch (IO_BUSC_REVR) { case 0x0010: lcd_puts(0, line++, " DM320 Rev. A"); break; case 0x0011: lcd_puts(0, line++, " DM320 Rev. B/C"); break; default: lcd_puts(0, line++, " Unknown DM320 Chip ID"); } #if defined(MROBE_500) line++; #endif oldline=line; while(!done) { line = oldline; #if defined(MROBE_500) button = button_get(false); button&=~BUTTON_REPEAT; if (button == BUTTON_POWER) done=true; if(button==BUTTON_RC_PLAY) address+=0x01; else if (button==BUTTON_RC_DOWN) address-=0x01; else if (button==BUTTON_RC_FF) address+=0x800; else if (button==BUTTON_RC_REW) address-=0x800; #else button = button_get(false); if(button & BUTTON_POWER) done = true; else if(button & BUTTON_LEFT) lcd_set_direct_fb(false); else if(button & BUTTON_RIGHT) lcd_set_direct_fb(true); lcd_puts(0, line++, "LCD info:"); lcd_putsf(0, line++, " LCD direct FB access? %s", (lcd_get_direct_fb() ? "yes" : "no")); line++; #endif lcd_puts(0, line++, "[Rockbox info]"); lcd_putsf(0, line++, "current tick: %08x Seconds running: %08d", (unsigned int)current_tick, (unsigned int)current_tick/100); #if defined(MROBE_500) lcd_putsf(0, line++, "Address: 0x%08x Data: 0x%08x", (unsigned int)address, *address); lcd_putsf(0, line++, "Address: 0x%08x Data: 0x%08x", (unsigned int)(address+1), *(address+1)); lcd_putsf(0, line++, "Address: 0x%08x Data: 0x%08x", (unsigned int)(address+2), *(address+2)); #endif lcd_update(); } return false; }
bool __dbg_ports(void) { #if defined(MROBE_500) int line = 0; int i; int button; bool done=false; lcd_setfont(FONT_SYSFIXED); lcd_clear_display(); while(!done) { line = 0; button = button_get(false); button&=~BUTTON_REPEAT; if (button == BUTTON_POWER) done=true; lcd_puts(0, line++, "[USB Information]"); lcd_putsf(0, line++, "TRN_CTRL: 0x%04x TRN_LNSTAT: 0x%04x", M66591_TRN_CTRL, M66591_TRN_LNSTAT); lcd_putsf(0, line++, "HSFS: 0x%04x TESTMODE: 0x%04x", M66591_HSFS, M66591_TESTMODE); lcd_putsf(0, line++, "PIN_CFG0: 0x%04x PIN_CFG1: 0x%04x", M66591_PIN_CFG0, M66591_PIN_CFG1); lcd_putsf(0, line++, "PIN_CFG2: 0x%04x", M66591_PIN_CFG2); lcd_putsf(0, line++, "DCP_CTRLEN: 0x%04x", M66591_DCP_CTRLEN); lcd_putsf(0, line++, "CPORT_CTRL0: 0x%04x CPORT_CTRL1: 0x%04x", M66591_CPORT_CTRL0, M66591_CPORT_CTRL1); lcd_putsf(0, line++, "CPORT_CTRL2: 0x%04x DPORT_CTRL0: 0x%04x", M66591_CPORT_CTRL2, M66591_DPORT_CTRL0); lcd_putsf(0, line++, "DPORT_CTRL1: 0x%04x DPORT_CTRL2: 0x%04x", M66591_DPORT_CTRL1, M66591_DPORT_CTRL2); lcd_putsf(0, line++, "INTCFG_MAIN: 0x%04x INTCFG_OUT: 0x%04x", M66591_INTCFG_MAIN, M66591_INTCFG_OUT); lcd_putsf(0, line++, "INTCFG_RDY: 0x%04x INTCFG_NRDY: 0x%04x", M66591_INTCFG_RDY, M66591_INTCFG_NRDY); lcd_putsf(0, line++, "INTCFG_EMP: 0x%04x INTSTAT_MAIN: 0x%04x", M66591_INTCFG_EMP, M66591_INTSTAT_MAIN); lcd_putsf(0, line++, "INTSTAT_RDY: 0x%04x INTSTAT_NRDY: 0x%04x", M66591_INTSTAT_RDY, M66591_INTSTAT_NRDY); lcd_putsf(0, line++, "INTSTAT_EMP: 0x%04x USB_ADDRESS: 0x%04x", M66591_INTSTAT_EMP, M66591_USB_ADDRESS); lcd_putsf(0, line++, "USB_REQ0: 0x%04x USB_REQ1: 0x%04x", M66591_USB_REQ0, M66591_USB_REQ1); lcd_putsf(0, line++, "USB_REQ2: 0x%04x USB_REQ3: 0x%04x", M66591_USB_REQ2, M66591_USB_REQ3); lcd_putsf(0, line++, "DCP_CNTMD: 0x%04x DCP_MXPKSZ: 0x%04x", M66591_DCP_CNTMD, M66591_DCP_MXPKSZ); lcd_putsf(0, line++, "DCPCTRL: 0x%04x", M66591_DCPCTRL); line++; for(i=1; i<6; i++) { M66591_PIPE_CFGWND=i; lcd_putsf(0, line++, "PIPE_CFGSEL:0x%04x PIPE_CFGWND: 0x%04x", M66591_PIPE_CFGSEL, M66591_PIPE_CFGWND); } line++; lcd_putsf(0, line++, "PIPECTRL1: 0x%04x PIPECTRL2: 0x%04x", M66591_PIPECTRL1, M66591_PIPECTRL2); lcd_putsf(0, line++, "PIPECTRL3: 0x%04x PIPECTRL4: 0x%04x", M66591_PIPECTRL3, M66591_PIPECTRL4); lcd_putsf(0, line++, "PIPECTRL5: 0x%04x PIPECTRL6: 0x%04x", M66591_PIPECTRL5, M66591_PIPECTRL6); lcd_putsf(0, line++, "GIO_BITSET0: 0x%04x GIO_BITSET1: 0x%04x", IO_GIO_BITSET0, IO_GIO_BITSET1); lcd_putsf(0, line++, "GIO_BITSET2: 0x%04x", IO_GIO_BITSET2); lcd_putsf(0, line++, "SDRAM_SDMODE: 0x%04x SDRAM_REFCTL: 0x%04x", IO_SDRAM_SDMODE, IO_SDRAM_REFCTL); lcd_putsf(0, line++, "EMIF_CS4CTRL1:0x%04x EMIF_CS4CTRL2:0x%04x", IO_EMIF_CS4CTRL1, IO_EMIF_CS4CTRL2); lcd_update(); } #endif return false; }
bool dbg_hw_info(void) { #ifndef HAVE_LCD_BITMAP int button; int currval = 0; #else int bitmask = HW_MASK; #endif int rom_version = ROM_VERSION; unsigned manu, id; /* flash IDs */ bool got_id; /* flag if we managed to get the flash IDs */ unsigned rom_crc = 0xffffffff; /* CRC32 of the boot ROM */ bool has_bootrom; /* flag for boot ROM present */ int oldmode; /* saved memory guard mode */ oldmode = system_memory_guard(MEMGUARD_NONE); /* disable memory guard */ /* get flash ROM type */ got_id = dbg_flash_id(&manu, &id, 0x5555, 0x2AAA); /* try SST, Atmel, NexFlash */ if (!got_id) got_id = dbg_flash_id(&manu, &id, 0x555, 0x2AA); /* try AMD, Macronix */ /* check if the boot ROM area is a flash mirror */ has_bootrom = (memcmp((char*)0, (char*)0x02000000, 64*1024) != 0); if (has_bootrom) /* if ROM and Flash different */ { /* calculate CRC16 checksum of boot ROM */ rom_crc = crc_32((unsigned char*)0x0000, 64*1024, 0xffffffff); } system_memory_guard(oldmode); /* re-enable memory guard */ lcd_clear_display(); #ifdef HAVE_LCD_BITMAP lcd_setfont(FONT_SYSFIXED); lcd_puts(0, 0, "[Hardware info]"); lcd_putsf(0, 1, "ROM: %d.%02d", rom_version/100, rom_version%100); lcd_putsf(0, 2, "Mask: 0x%04x", bitmask); if (got_id) lcd_putsf(0, 3, "Flash: M=%02x D=%02x", manu, id); else lcd_puts(0, 3, "Flash: M=?? D=??"); /* unknown, sorry */ if (has_bootrom) { if (rom_crc == 0x56DBA4EE) /* known Version 1 */ lcd_puts(0, 4, "Boot ROM: V1"); else lcd_putsf(0, 4, "ROMcrc: 0x%08x", rom_crc); } else { lcd_puts(0, 4, "Boot ROM: none"); } lcd_update(); /* wait for exit */ while (button_get_w_tmo(HZ/10) != (DEBUG_CANCEL|BUTTON_REL)); lcd_setfont(FONT_UI); #else /* !HAVE_LCD_BITMAP */ lcd_puts(0, 0, "[HW Info]"); while(1) { switch(currval) { case 0: lcd_putsf(0, 1, "ROM: %d.%02d", rom_version/100, rom_version%100); break; case 1: if (got_id) lcd_putsf(0, 1, "Flash:%02x,%02x", manu, id); else lcd_puts(0, 1, "Flash:??,??"); /* unknown, sorry */ break; case 2: if (has_bootrom) { if (rom_crc == 0x56DBA4EE) /* known Version 1 */ lcd_puts(0, 1, "BootROM: V1"); else if (rom_crc == 0x358099E8) lcd_puts(0, 1, "BootROM: V2"); /* alternative boot ROM found in one single player so far */ else lcd_putsf(0, 1, "R: %08x", rom_crc); } else lcd_puts(0, 1, "BootROM: no"); } lcd_update(); button = button_get_w_tmo(HZ/10); switch(button) { case BUTTON_STOP: return false; case BUTTON_LEFT: currval--; if(currval < 0) currval = 2; break; case BUTTON_RIGHT: currval++; if(currval > 2) currval = 0; break; } } #endif return false; }
bool dbg_ports(void) { int adc_battery_voltage; #ifndef HAVE_LCD_BITMAP int currval = 0; int button; #else int adc_battery_level; lcd_setfont(FONT_SYSFIXED); #endif lcd_clear_display(); while(1) { #ifdef HAVE_LCD_BITMAP lcd_putsf(0, 0, "PADR: %04x", (unsigned short)PADR); lcd_putsf(0, 1, "PBDR: %04x", (unsigned short)PBDR); lcd_putsf(0, 2, "AN0: %03x AN4: %03x", adc_read(0), adc_read(4)); lcd_putsf(0, 3, "AN1: %03x AN5: %03x", adc_read(1), adc_read(5)); lcd_putsf(0, 4, "AN2: %03x AN6: %03x", adc_read(2), adc_read(6)); lcd_putsf(0, 5, "AN3: %03x AN7: %03x", adc_read(3), adc_read(7)); battery_read_info(&adc_battery_voltage, &adc_battery_level); lcd_putsf(0, 6, "Batt: %d.%03dV %d%% ", adc_battery_voltage / 1000, adc_battery_voltage % 1000, adc_battery_level); lcd_update(); while (button_get_w_tmo(HZ/10) != (DEBUG_CANCEL|BUTTON_REL)); lcd_setfont(FONT_UI); #else /* !HAVE_LCD_BITMAP */ if (currval == 0) { lcd_putsf(0, 0, "PADR: %04x", (unsigned short)PADR); } else if (currval == 1) { lcd_putsf(0, 0, "PBDR: %04x", (unsigned short)PBDR); } else { int idx = currval - 2; /* idx < 7 */ lcd_putsf(0, 0, "AN%d: %03x", idx, adc_read(idx)); } battery_read_info(&adc_battery_voltage, NULL); lcd_putsf(0, 1, "Batt: %d.%03dV", adc_battery_voltage / 1000, adc_battery_voltage % 1000); lcd_update(); button = button_get_w_tmo(HZ/5); switch(button) { case BUTTON_STOP: return false; case BUTTON_LEFT: currval--; if(currval < 0) currval = 9; break; case BUTTON_RIGHT: currval++; if(currval > 9) currval = 0; break; } #endif } return false; }
void main(void) { unsigned char* loadbuffer; int buffer_size; int rc; int(*kernel_entry)(void); system_init(); kernel_init(); /* Need the kernel to sleep */ enable_interrupt(IRQ_FIQ_STATUS); lcd_init(); backlight_init(); button_init(); font_init(); adc_init(); lcd_setfont(FONT_SYSFIXED); /* These checks should only run if the bootloader is flashed */ if(GSTATUS3&0x02) { GSTATUS3&=0xFFFFFFFD; if(!(GPGDAT&BUTTON_POWER) && charger_inserted()) { while(!(GPGDAT&BUTTON_POWER) && charger_inserted()) { char msg[20]; if(charging_state()) { snprintf(msg,sizeof(msg),"Charging"); } else { snprintf(msg,sizeof(msg),"Charge Complete"); } reset_screen(); lcd_putsxy( (LCD_WIDTH - (SYSFONT_WIDTH * strlen(msg))) / 2, (LCD_HEIGHT - SYSFONT_HEIGHT) / 2, msg); lcd_update(); #if defined(HAVE_RTC_ALARM) /* Check if the alarm went off while charging */ if(rtc_check_alarm_flag()) { GSTATUS3=1; /* Normally this is set in crt0.s */ break; } #endif } if(!(GPGDAT&BUTTON_POWER) #if defined(HAVE_RTC_ALARM) && !GSTATUS3 #endif ) { shutdown(); } } if(button_hold()) { const char msg[] = "HOLD is enabled"; reset_screen(); lcd_putsxy( (LCD_WIDTH - (SYSFONT_WIDTH * strlen(msg))) / 2, (LCD_HEIGHT - SYSFONT_HEIGHT) / 2, msg); lcd_update(); sleep(2*HZ); shutdown(); } } power_init(); usb_init(); /* Enter USB mode without USB thread */ if(usb_detect() == USB_INSERTED) { const char msg[] = "Bootloader USB mode"; reset_screen(); lcd_putsxy( (LCD_WIDTH - (SYSFONT_WIDTH * strlen(msg))) / 2, (LCD_HEIGHT - SYSFONT_HEIGHT) / 2, msg); lcd_update(); storage_enable(false); sleep(HZ/20); usb_enable(true); while (usb_detect() == USB_INSERTED) sleep(HZ); usb_enable(false); reset_screen(); lcd_update(); } reset_screen(); /* Show debug messages if button is pressed */ if(button_read_device()&BUTTON_A) verbose = true; printf("Rockbox boot loader"); printf("Version %s", rbversion); sleep(50); /* ATA seems to error without this pause */ rc = storage_init(); if(rc) { reset_screen(); error(EATA, rc, true); } filesystem_init(); 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 <= EFILE_EMPTY) error(EBOOTFILE, rc, true); storage_close(); system_prepare_fw_start(); commit_discard_idcache(); kernel_entry = (void*) loadbuffer; rc = kernel_entry(); #if 0 /* Halt */ while (1) core_idle(); #else /* Return and restart */ #endif }
void main(void) { unsigned char* loadbuffer; int buffer_size; int rc; int(*kernel_entry)(void); /* Make sure interrupts are disabled */ set_irq_level(IRQ_DISABLED); set_fiq_status(FIQ_DISABLED); system_init(); kernel_init(); /* Now enable interrupts */ set_irq_level(IRQ_ENABLED); set_fiq_status(FIQ_ENABLED); lcd_init(); backlight_init(); font_init(); button_init(); usb_init(); power_init(); // enable_irq(); // enable_fiq(); adc_init(); lcd_setfont(FONT_SYSFIXED); /* Show debug messages if button is pressed */ // if(button_read_device()) verbose = true; printf("Rockbox boot loader"); printf("Version %s", rbversion); /* Enter USB mode without USB thread */ if(usb_detect() == USB_INSERTED) { const char msg[] = "Bootloader USB mode"; reset_screen(); lcd_putsxy( (LCD_WIDTH - (SYSFONT_WIDTH * strlen(msg))) / 2, (LCD_HEIGHT - SYSFONT_HEIGHT) / 2, msg); lcd_update(); ide_power_enable(true); storage_enable(false); sleep(HZ/20); usb_enable(true); while (usb_detect() == USB_INSERTED) { storage_spin(); /* Prevent the drive from spinning down */ sleep(HZ); } usb_enable(false); reset_screen(); lcd_update(); } sleep(50); printf("ATA"); rc = storage_init(); if(rc) { reset_screen(); error(EATA, rc, true); } printf("filesystem"); filesystem_init(); printf("mount"); rc = disk_mount_all(); if (rc<=0) { error(EDISK,rc, true); } printf("Loading firmware"); loadbuffer = (unsigned char*) 0x00900000; buffer_size = (unsigned char*)0x01900000 - loadbuffer; rc = load_firmware(loadbuffer, BOOTFILE, buffer_size); if(rc <= EFILE_EMPTY) error(EBOOTFILE, rc, true); kernel_entry = (void*) loadbuffer; rc = kernel_entry(); /* Should not get here! */ return rc; }
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 */ }
bool dbg_hw_info_clkctrl(void) { lcd_setfont(FONT_SYSFIXED); while(1) { int button = get_action(CONTEXT_STD, HZ / 10); switch(button) { case ACTION_STD_NEXT: case ACTION_STD_PREV: case ACTION_STD_OK: case ACTION_STD_MENU: lcd_setfont(FONT_UI); return true; case ACTION_STD_CANCEL: lcd_setfont(FONT_UI); return false; } lcd_clear_display(); /* 012345678901234567890123456789 */ lcd_putsf(0, 0, "name en by idiv fdiv frequency"); for(unsigned i = 0; i < ARRAYLEN(dbg_clk); i++) { #define c dbg_clk[i] lcd_putsf(0, i + 1, "%4s", c.name); if(c.has_enable) lcd_putsf(5, i + 1, "%2d", imx233_clkctrl_is_clock_enabled(c.clk)); if(c.has_bypass) lcd_putsf(8, i + 1, "%2d", imx233_clkctrl_get_bypass_pll(c.clk)); if(c.has_idiv && imx233_clkctrl_get_clock_divisor(c.clk) != 0) lcd_putsf(10, i + 1, "%4d", imx233_clkctrl_get_clock_divisor(c.clk)); if(c.has_fdiv && imx233_clkctrl_get_fractional_divisor(c.clk) != 0) lcd_putsf(16, i + 1, "%4d", imx233_clkctrl_get_fractional_divisor(c.clk)); if(c.has_freq) lcd_putsf(21, i + 1, "%9d", imx233_clkctrl_get_clock_freq(c.clk)); #undef c } int line = ARRAYLEN(dbg_clk) + 1; lcd_putsf(0, line, "as: %d/%d emi sync: %d", imx233_clkctrl_is_auto_slow_enabled(), 1 << imx233_clkctrl_get_auto_slow_divisor(), imx233_clkctrl_is_emi_sync_enabled()); line++; lcd_putsf(0, line, "as monitor: "); int x_off = 12; bool first = true; unsigned line_w = lcd_getwidth() / font_get_width(font_get(lcd_getfont()), ' '); for(unsigned i = 0; i < ARRAYLEN(dbg_as_monitor); i++) { if(!imx233_clkctrl_is_auto_slow_monitor_enabled(dbg_as_monitor[i].monitor)) continue; if(!first) { lcd_putsf(x_off, line, ", "); x_off += 2; } first = false; if((x_off + strlen(dbg_as_monitor[i].name)) > line_w) { x_off = 1; line++; } lcd_putsf(x_off, line, "%s", dbg_as_monitor[i].name); x_off += strlen(dbg_as_monitor[i].name); } line++; lcd_update(); yield(); } }
bool dbg_ports(void) { unsigned int gpio_out; unsigned int gpio1_out; unsigned int gpio_read; unsigned int gpio1_read; unsigned int gpio_function; unsigned int gpio1_function; unsigned int gpio_enable; unsigned int gpio1_enable; int adc_battery_voltage, adc_battery_level; int adc_buttons, adc_remote; int line; lcd_clear_display(); lcd_setfont(FONT_SYSFIXED); while(1) { line = 0; gpio_read = GPIO_READ; gpio1_read = GPIO1_READ; gpio_out = GPIO_OUT; gpio1_out = GPIO1_OUT; gpio_function = GPIO_FUNCTION; gpio1_function = GPIO1_FUNCTION; gpio_enable = GPIO_ENABLE; gpio1_enable = GPIO1_ENABLE; lcd_putsf(0, line++, "GPIO_READ: %08x", gpio_read); lcd_putsf(0, line++, "GPIO_OUT: %08x", gpio_out); lcd_putsf(0, line++, "GPIO_FUNC: %08x", gpio_function); lcd_putsf(0, line++, "GPIO_ENA: %08x", gpio_enable); lcd_putsf(0, line++, "GPIO1_READ: %08x", gpio1_read); lcd_putsf(0, line++, "GPIO1_OUT: %08x", gpio1_out); lcd_putsf(0, line++, "GPIO1_FUNC: %08x", gpio1_function); lcd_putsf(0, line++, "GPIO1_ENA: %08x", gpio1_enable); adc_buttons = adc_read(ADC_BUTTONS); adc_remote = adc_read(ADC_REMOTE); battery_read_info(&adc_battery_voltage, &adc_battery_level); #if defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IRIVER_H300_SERIES) lcd_putsf(0, line++, "ADC_BUTTONS (%c): %02x", button_scan_enabled() ? '+' : '-', adc_buttons); #else lcd_putsf(0, line++, "ADC_BUTTONS: %02x", adc_buttons); #endif #if defined(IAUDIO_X5) || defined(IAUDIO_M5) lcd_putsf(0, line++, "ADC_REMOTE (%c): %02x", remote_detect() ? '+' : '-', adc_remote); #else lcd_putsf(0, line++, "ADC_REMOTE: %02x", adc_remote); #endif #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES) lcd_putsf(0, line++, "ADC_REMOTEDETECT: %02x", adc_read(ADC_REMOTEDETECT)); #endif battery_read_info(&adc_battery_voltage, &adc_battery_level); lcd_putsf(0, line++, "Batt: %d.%03dV %d%% ", adc_battery_voltage / 1000, adc_battery_voltage % 1000, adc_battery_level); #if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES) lcd_putsf(0, line++, "remotetype: %d", remote_type()); #endif lcd_update(); if (button_get_w_tmo(HZ/10) == (DEBUG_CANCEL|BUTTON_REL)) { lcd_setfont(FONT_UI); return false; } } return false; }