Example #1
0
bool backlight_hw_init(void)
{
    /* Enable button LEDs: P3.2 (menu/back), P3.3 (cursor), P4.2 (middle) */
    PCON3 = (PCON3 & ~0x0000FF00) | 0x00001100;
    PCON4 = (PCON4 & ~0x00000F00) | 0x00000100;
    buttonlight_hw_off();

    /* enable timer clock */
    PWRCON &= ~(1 << 4);

    /* configure timer */
    TACMD = (1 << 1);   /* TA_CLR */
    TACON = (0 << 13) | /* TA_INT1_EN */
            (0 << 12) | /* TA_INT0_EN */
            (1 << 11) | /* TA_START */
            (3 << 8) |  /* TA_CS = PCLK / 64 */
            (1 << 4);   /* TA_MODE_SEL = PWM mode */
    TADATA1 = 256;      /* set PWM period */
    TAPRE = 20;         /* prescaler */
    TACMD = (1 << 0);   /* TA_EN */
   
    backlight_hw_on();

    return true;
}
Example #2
0
void system_exception_wait(void)
{
    backlight_hw_on();
    backlight_hw_brightness(DEFAULT_BRIGHTNESS_SETTING);
    /* wait until button press and release */
    while(button_read_device() != 0) {}
    while(button_read_device() == 0) {}
    while(button_read_device() != 0) {}
    while(button_read_device() == 0) {}
}
Example #3
0
void main(void)
{
    system_init();
    kernel_init();
    disable_irq();

    while(1)
    {
       backlight_hw_on();
       buttonlight_hw_off();
       sleep(HZ/4);
       backlight_hw_off();
       buttonlight_hw_on();
       sleep(HZ/4);
    }
}
Example #4
0
void system_exception_wait(void)
{
    /* stop hadrware watchdog, IRQs are stopped */
    imx233_rtc_enable_watchdog(false);
    /* make sure lcd and backlight are on */
    lcd_update();
    backlight_hw_on();
    backlight_hw_brightness(DEFAULT_BRIGHTNESS_SETTING);
    /* wait until button release (if a button is pressed)
     * NOTE at this point, interrupts are off so that rules out touchpad and
     * ADC, so we are pretty much left with PSWITCH only. If other buttons are
     * wanted, it is possible to implement a busy polling version of button
     * reading for GPIO and ADC in button-imx233 but this is not done at the
     * moment. */
    while(imx233_power_read_pswitch() != 0) {}
    while(imx233_power_read_pswitch() == 0) {}
    while(imx233_power_read_pswitch() != 0) {}
}
Example #5
0
void system_exception_wait(void)
{
    /* stop hadrware watchdog, IRQs are stopped */
    imx233_rtc_enable_watchdog(false);
    /* make sure lcd and backlight are on */
    lcd_update();
    backlight_hw_on();
    backlight_hw_brightness(DEFAULT_BRIGHTNESS_SETTING);
    /* wait until button release (if a button is pressed) */
#ifdef HAVE_BUTTON_DATA
    int data;
    while(button_read_device(&data));
    /* then wait until next button press */
    while(!button_read_device(&data));
#else
    while(button_read_device());
    /* then wait until next button press */
    while(!button_read_device());
#endif
}
Example #6
0
bool backlight_hw_init(void)
{
    backlight_hw_on();
    backlight_hw_brightness(DEFAULT_BRIGHTNESS_SETTING);
    return true;
}
void* main(void)
{
    int i;
    int btn;
    int num_partitions;
    int crc32;
    char sector[512];
    struct partinfo pinfo;

    system_init();
    kernel_init();
    lcd_init();
    font_init();
    button_init();
    i2c_init();
    backlight_hw_on();
    
    lcd_set_foreground(LCD_WHITE);
    lcd_set_background(LCD_BLACK);
    lcd_clear_display();

    btn = button_read_device();
    verbose = true;

    lcd_setfont(FONT_SYSFIXED);

    printf("Rockbox e200R installer");
    printf("Version: %s", rbversion);
    printf(MODEL_NAME);
    printf("");

    i=storage_init();
    filesystem_init();
    num_partitions = disk_mount_all();

    if (num_partitions<=0)
    {
        error(EDISK, num_partitions, true);
    }

    disk_partinfo(1, &pinfo);

#if 0 /* not needed in release builds */
    printf("--- Partition info ---");
    printf("start: %x", pinfo.start);
    printf("size: %x", pinfo.size);
    printf("type: %x", pinfo.type);
    printf("reading: %x", (START_SECTOR_OF_ROM + ROMSECTOR_TO_HACK)*512);
#endif

    storage_read_sectors(pinfo.start + START_SECTOR_OF_ROM + ROMSECTOR_TO_HACK,
                         1 , sector);
    crc32 = chksum_crc32 (sector, 512);

#if 0 /* not needed in release builds */
    printf("--- Hack Status ---");
    printf("Sector checksum: %x", crc32);
#endif

    if (crc32 == PATCHED_CRC32)
    {
        /* Bootloader already patched */
        printf("Already unlocked");
        printf("Proceed to Step 2");
    } else if ((crc32 == KNOWN_CRC32) && 
                !memcmp(&sector[HACK_OFFSET], knownBytes, 
                sizeof(knownBytes)/sizeof(*knownBytes)))
    {
        /* E200R bootloader detected - patch it */
        memcpy(&sector[HACK_OFFSET], changedBytes,
                sizeof(changedBytes)/sizeof(*changedBytes));
        storage_write_sectors(
                        pinfo.start + START_SECTOR_OF_ROM + ROMSECTOR_TO_HACK,
                        1 , sector);
        printf("Firmware unlocked");
        printf("Proceed to Step 2");
    } else if (is_e200(crc32))
    {
        printf("Vanilla E200 detected!");
        printf("Please install using");
        printf("Sansapatcher");
    }
    else
    {
        printf("Unknown bootloader");
        printf("Rockbox installer cannot");
        printf("continue");
    }

    /* Turn button lights off */
    GPIOG_OUTPUT_VAL &=~0x80;

    printf("");

    if (button_hold())
        printf("Release Hold and");

    printf("Press any key to shutdown");

    while(button_read_device() == BUTTON_NONE);

    power_off();

    return NULL;
}