Example #1
0
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;
}
Example #2
0
void lcd_setup( void )
/*****************************************************************************
*   Function : See module specification (.h-file).
*****************************************************************************/
{

	//Setup LCD pins
	SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOC;		// Enables clock for GPIOD
	SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOD;		// Enables clock for GPIOC

	GPIO_PORTC_DIR_R |= 0xF0;					// Set PC4:7 (LCD data pins) as outputs
	GPIO_PORTD_DIR_R |= 0x0C;					// Set PD2:3 (LCD_RS, LCD_EN) as outputs

	GPIO_PORTC_DEN_R |= 0xF0;					// Digital Enable PC4:7 (LCD data pins)
	GPIO_PORTD_DEN_R |= 0x0C;					// Digital Enable PD2:3 (LCD_RS, LCD_EN)

	// LCD initialize
	for( volatile INT32U i; i < 30000; i++ ); 	// Wait for more than 15 ms
	lcd_single_command(0x03);
	for( volatile INT32U i; i < 10000; i++ ); 	// Wait for more than 4.1 ms
	lcd_single_command( 0x03 );
	lcd_single_command( 0x03 );
	lcd_single_command( 0x02 );
	lcd_command( 0x28 ); 						// 4 bit mode, 2 lines, 5x8 font
	lcd_command( 0x08 );						// Display off
	lcd_command( 0x0C ); 						// Display on, hide cursor
	lcd_clear_display(); 						// Clear display, reset cursor position and direction
	lcd_command(0x06);							// Entry mode
}
Example #3
0
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();
    }
}
Example #4
0
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;
}
Example #5
0
int lcd_init(lcd_t *lcd, ssp_port_t ssp_port, pin_t cs, pin_t rs, pin_t rw, pin_t e)
{
    lcd->ssp = ssp_port.ssp;
    lcd->cs = cs;
    lcd->rs = rs;
    lcd->rw = rw;
    lcd->e = e;
    //lcd->type = COM8BITS;

    gpio_config(cs, pin_dir_write, pull_up);
    gpio_set(cs, 1);
    gpio_config(rs, pin_dir_write, pull_down);
    gpio_set(rs, 0);
    gpio_config(rw, pin_dir_write, pull_down);
    gpio_set(rw, 0);
    gpio_config(e, pin_dir_write, pull_down);    
    gpio_set(e, 0);

    ssp_config(ssp_port, 8 * 1000 * 1000);

    delay(lcd, 1000);

    lcd_clear_display(lcd);
    lcd_return_home(lcd);
    lcd_set_display(lcd,1, 1, 1);

    return 1;
}
Example #6
0
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();
    }
}
void power_off(void)
{
#if defined(HAVE_LCD_COLOR) && !defined(HAVE_LCD_SHUTDOWN)
    /* Clear the screen and backdrop to
    remove ghosting effect on shutdown */
    lcd_set_backdrop(NULL);
    lcd_set_background(LCD_WHITE);
    lcd_clear_display();
    lcd_update();
    sleep(HZ/16);
#endif

#ifndef BOOTLOADER
#ifdef IPOD_1G2G
    /* we cannot turn off the 1st gen/ 2nd gen yet. Need to figure out sleep mode. */
    system_reboot();
#else
    /* We don't turn off the ipod, we put it in a deep sleep */
    /* Clear latter part of iram (the part used by plugins/codecs) to ensure
     * that the OF behaves properly on boot. There is some kind of boot
     * failure flag there which otherwise may not be cleared.
     */
#if CONFIG_CPU == PP5022
    memset((void*)0x4000c000, 0, 0x14000);
#elif CONFIG_CPU == PP5020
    memset((void*)0x4000c000, 0, 0xc000);
#endif
    pcf50605_standby_mode();
#endif
#endif
}
Example #8
0
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;
}
static void show_logo(void)
{
    lcd_clear_display();
    lcd_puts(0, 0, "Rockbox");
    lcd_puts(0, 1, "Rescue boot");
    lcd_update();
}
static bool reset_settings(void)
{
    bool done=false;
    int line;
    int button;
 
    lcd_clear_display();

#ifdef HAVE_LCD_CHARCELLS
    line = 0;
#else
    line = 1;
    lcd_puts(0,0,str(LANG_RESET_ASK_RECORDER));
#endif
    lcd_puts(0,line,str(LANG_RESET_CONFIRM));
    lcd_puts(0,line+1,str(LANG_RESET_CANCEL));

    lcd_update();
     
    while(!done) {
        button = button_get(true);
        switch(button) {
            case SETTINGS_OK:
                settings_reset();
                settings_apply();
                lcd_clear_display();
                lcd_puts(0,1,str(LANG_RESET_DONE_CLEAR));
                done = true;
                break;

            case SETTINGS_CANCEL:
                lcd_clear_display();
                lcd_puts(0,1,str(LANG_RESET_DONE_CANCEL));
                done = true;
                break;

            default:
                if(default_event_handler(button) == SYS_USB_CONNECTED)
                    return true;
        }
    }

    lcd_puts(0,0,str(LANG_RESET_DONE_SETTING));
    lcd_update();
    sleep(HZ);
    return false;
}
Example #11
0
/* LCD init */
void lcd_init(void)
{
    lcd_clear_display();

    /* Call device specific init */
    lcd_init_device();
    scroll_init();
}
Example #12
0
static int boot_menu(void)
{
    const char* strings[] = {"Boot Rockbox", "Boot OF", "USB mode", "Reset Rockbox configuration"};
    int button, touch, poweroff_repeat = 0;
    unsigned int i;

    verbose = true;
    adc_init();

redraw:
    lcd_clear_display();
    for(i=0; i<ARRAYLEN(strings); i++)
    {
        lcd_drawrect(RECT_X, RECT_Y(i), RECT_WIDTH, RECT_HEIGHT);
        lcd_putsxy(TEXT_X(i), TEXT_Y(i), strings[i]);
    }
    lcd_update();

    while(1)
    {
        button = button_get_w_tmo(HZ/4);
        if(button & BUTTON_TOUCHSCREEN)
        {
            touch = button_get_data();
            unsigned int x = touch & 0xFFFF, y = touch >> 16;
            int found = -1;
            for(i=0; i<ARRAYLEN(strings); i++)
            {
                if(x > RECT_X && x < RECT_X+RECT_WIDTH &&
                   y > RECT_Y(i) && y < RECT_Y(i)+RECT_HEIGHT)
                {
                    found = i;
                    break;
                }
            }

            switch(found)
            {
                case 0:
                    reset_screen();
                    boot_rockbox();
                    break;
                case 1:
                    reset_screen();
                    boot_of();
                    break;
                case 2:
                    usb_mode();
                    break;
                case 3:
                    reset_configuration();
                    break;
            }

            if(found != -1)
                goto redraw;
        }
        else if(button & BUTTON_POWER)
Example #13
0
void reset_screen(void)
{
    lcd_clear_display();
    line = 0;
#ifdef HAVE_REMOTE_LCD
    lcd_remote_clear_display();
    remote_line = 0;
#endif
}
Example #14
0
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;
}
Example #15
0
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();
    }
}
Example #16
0
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();
    }
}
Example #17
0
/* LCD init */
void lcd_init(void)
{
    /* Initialise the viewport */
    lcd_set_viewport(NULL);

    lcd_clear_display();
    /* Call device specific init */
    lcd_init_device();
    scroll_init();
}
Example #18
0
static void usb_screen(void)
{
    lcd_clear_display();
    lcd_puts(0, 0, "USB mode");
    lcd_update();

    usb_acknowledge(SYS_USB_CONNECTED_ACK);
    while(usb_wait_for_disconnect_w_tmo(&button_queue, HZ)) {
    }
}
Example #19
0
BOOLEAN lcd_setup_sm( void )
/*****************************************************************************
*   Function : See module specification (.h-file).
*****************************************************************************/
{
	static INT8U lcd_setup_state  = LCD_SST_FIRST;
	static INT32U lcd_setup_timer = 0;
	BOOLEAN done = 0;

	switch ( lcd_setup_state )
	{
		case LCD_SST_FIRST:
			//Setup LCD pins
			SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOC;	// Enables clock for GPIOD
			SYSCTL_RCGC2_R |= SYSCTL_RCGC2_GPIOD;	// Enables clock for GPIOC

			GPIO_PORTC_DIR_R |= 0xF0;				// Set PC4:7 (LCD data pins) as outputs
			GPIO_PORTD_DIR_R |= 0x0C;				// Set PD2:3 (LCD_RS, LCD_EN) as outputs

			GPIO_PORTC_DEN_R |= 0xF0;				// Digital Enable PC4:7 (LCD data pins)
			GPIO_PORTD_DEN_R |= 0x0C;				// Digital Enable PD2:3 (LCD_RS, LCD_EN)

			lcd_setup_timer = 3;					// 15 ms if systick is 5 ms
			lcd_setup_state = LCD_SST_SECOND;
			break;
		case LCD_SST_SECOND:
			if( ! --lcd_setup_timer )
			{
				lcd_single_command(0x03);
				lcd_setup_state = LCD_SST_THIRD;
				break;								// No delay needed if systick is 5 ms
			}
			break;
		case LCD_SST_THIRD:
			lcd_single_command( 0x03 );
			lcd_single_command( 0x03 );
			lcd_single_command( 0x02 );
			lcd_command( 0x28 ); 						// 4 bit mode, 2 lines, 5x8 font
			lcd_command( 0x08 );						// Display off
			lcd_command( 0x0C ); 						// Display on, hide cursor
			lcd_clear_display(); 						// Clear display, reset cursor and entry mode
			done = 1;
			break;
		default:
			break;
	}

	return done;
}
Example #20
0
static void charging_screen(void)
{
    unsigned int button;
    const char* msg;

    ide_power_enable(false); /* power down the disk, else would be spinning */

    lcd_clear_display();

    do
    {
#ifdef ARCHOS_RECORDER
        if (charge_state == CHARGING)
            msg = "charging";
        else if (charge_state == TOPOFF)
            msg = "topoff charge";
        else if (charge_state == TRICKLE)
            msg = "trickle charge";
        else
            msg = "not charging";
#else
        msg = "charging";
#endif
        lcd_puts(0, 0, msg);
        {
            char buf[32];
            int battv = battery_voltage();
            snprintf(buf, sizeof(buf), "%d.%02dV %d%%",
                battv / 1000, (battv % 1000) / 10, battery_level());
            lcd_puts(0, 1, buf);
        }
        lcd_update();

        button = button_get_w_tmo(HZ/2);
#ifdef BUTTON_ON
        if (button == (BUTTON_ON | BUTTON_REL))
#else
        if (button == (BUTTON_RIGHT | BUTTON_REL))
#endif
            break; /* start */
        else
        {
            if (usb_detect() == USB_INSERTED)
                break;
            else if (!charger_inserted())
                power_off(); /* charger removed: power down */
        }
    } while (1);
}
Example #21
0
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;
}
Example #22
0
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();
    }
}
Example #23
0
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();
    }
}
Example #24
0
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 */
}
Example #25
0
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();
    }
}
Example #26
0
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;
}
void ata2501_test(void)
{
    char buf[100];
    ata2501_init();

    while (1) {
        unsigned short data;
        int line = 0;

        data = ata2501_read();
        lcd_clear_display();
        lcd_puts(0, line++, "ATA2501 test");

        bits(buf, data);
        lcd_puts(0, line++, buf);

        lcd_update();
        sleep(HZ/10);
    }
}
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;
}
Example #29
0
/* prompt user to plug USB and fix a problem */
static void prompt_usb(const char* msg1, const char* msg2)
{
    int button;
    lcd_clear_display();
    lcd_puts(0, 0, msg1);
    lcd_puts(0, 1, msg2);
#ifdef HAVE_LCD_BITMAP
    lcd_puts(0, 2, "Insert USB cable");
    lcd_puts(0, 3, "and fix it.");
#endif
    lcd_update();
    do
    {
        button = button_get(true);
        if (button == SYS_POWEROFF)
        {
            power_off();
        }
    } while (button != SYS_USB_CONNECTED);
    usb_screen();
    system_reboot();
}
Example #30
0
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();
    }
}