int _backlight_init(void) { _backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING); /* set backlight on by default, since the screen is unreadable without it */ _backlight_on(); return true; }
bool _backlight_init(void) { _backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING); _backlight_on(); return true; /* Backlight always ON after boot. */ }
void _backlight_set_brightness(int brightness) { backlight_level = brightness_table[brightness]; if (brightness > 0) _backlight_on(); else _backlight_off(); }
bool _backlight_init(void) { pmu_write(0x2a, 6); pmu_write(0x28, 0x2e); pmu_write(0x2b, 20); _backlight_on(); return true; }
bool _backlight_init(void) { GPIO_SET_BITWISE(GPIOB_ENABLE, 0x0c); /* B02 and B03 enable */ GPIO_SET_BITWISE(GPIOB_OUTPUT_VAL, 0x08); /* B03 = 1 */ GPO32_ENABLE &= ~0x2000000; /* D01 disable, so pwm takes over */ DEV_EN |= DEV_PWM; /* PWM enable */ _backlight_on(); return true; }
void system_exception_wait(void) { /* make sure lcd and backlight are on */ lcd_update(); _backlight_on(); _backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING); /* wait until button release (if a button is pressed) */ while(button_read_device()); /* then wait until next button press */ while(!button_read_device()); }
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_on(); _backlight_set_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 }
void* main(void) { char filename[MAX_PATH]; int i; int btn; int rc; int num_partitions; struct partinfo* pinfo; #if !(CONFIG_STORAGE & STORAGE_SD) char buf[256]; unsigned short* identify_info; #endif int usb = USB_EXTRACTED; chksum_crc32gentab (); system_init(); kernel_init(); #ifdef HAVE_BOOTLOADER_USB_MODE /* loader must service interrupts */ enable_interrupt(IRQ_FIQ_STATUS); #endif lcd_init(); font_init(); show_logo(); adc_init(); #ifdef HAVE_BOOTLOADER_USB_MODE button_init_device(); #else button_init(); #endif #if defined(SANSA_E200) || defined(PHILIPS_SA9200) i2c_init(); _backlight_on(); #endif if (button_hold()) { verbose = true; lcd_clear_display(); printf("Hold switch on"); printf("Shutting down..."); sleep(HZ); power_off(); } btn = button_read_device(); /* Enable bootloader messages if any button is pressed */ #ifdef HAVE_BOOTLOADER_USB_MODE lcd_clear_display(); if (btn) verbose = true; #else if (btn) { lcd_clear_display(); verbose = true; } #endif lcd_setfont(FONT_SYSFIXED); printf("Rockbox boot loader"); printf("Version: " RBVERSION); printf(MODEL_NAME); i=storage_init(); #if !(CONFIG_STORAGE & STORAGE_SD) if (i==0) { identify_info=ata_get_identify(); /* Show model */ for (i=0; i < 20; i++) { ((unsigned short*)buf)[i]=htobe16(identify_info[i+27]); } buf[40]=0; for (i=39; i && buf[i]==' '; i--) { buf[i]=0; } printf(buf); } else { error(EATA, i, true); } #endif disk_init(IF_MV(0)); num_partitions = disk_mount_all(); if (num_partitions<=0) { error(EDISK,num_partitions, true); } /* Just list the first 2 partitions since we don't have any devices yet that have more than that */ for(i=0; i<NUM_PARTITIONS; i++) { pinfo = disk_partinfo(i); printf("Partition %d: 0x%02x %ld MB", i, pinfo->type, pinfo->size / 2048); } /* Now that storage is initialized, check for USB connection */ if ((btn & BOOTLOADER_BOOT_OF) == 0) { usb_pin_init(); usb = handle_usb(HZ*2); if (usb == USB_INSERTED) btn |= BOOTLOADER_BOOT_OF; } /* Try loading Rockbox, if that fails, fall back to the OF */ if((btn & BOOTLOADER_BOOT_OF) == 0) { printf("Loading Rockbox..."); snprintf(filename,sizeof(filename), BOOTDIR "/%s", BOOTFILE); rc = load_mi4(loadbuffer, filename, MAX_LOADSIZE); if (rc <= EFILE_EMPTY) { bool old_verbose = verbose; verbose = true; printf("Can't load " BOOTFILE ": "); printf(loader_strerror(rc)); verbose = old_verbose; btn |= BOOTLOADER_BOOT_OF; sleep(5*HZ); } else goto main_exit; } if(btn & BOOTLOADER_BOOT_OF) { /* Load original mi4 firmware in to a memory buffer called loadbuffer. The rest of the loading is done in crt0.S. 1) First try reading from the hidden partition (on Sansa only). 2) Next try a decrypted mi4 file in /System/OF.mi4 3) Finally, try a raw firmware binary in /System/OF.bin. It should be a mi4 firmware decrypted and header stripped using mi4code. */ printf("Loading original firmware..."); #if (CONFIG_STORAGE & STORAGE_SD) /* First try a (hidden) firmware partition */ printf("Trying firmware partition"); pinfo = disk_partinfo(1); if(pinfo->type == PARTITION_TYPE_OS2_HIDDEN_C_DRIVE) { rc = load_mi4_part(loadbuffer, pinfo, MAX_LOADSIZE, usb == USB_INSERTED); if (rc <= EFILE_EMPTY) { printf("Can't load from partition"); printf(loader_strerror(rc)); } else { goto main_exit; } } else { printf("No hidden partition found."); } #endif #if defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330) || defined(PHILIPS_SA9200) printf("Trying /System/OF.ebn"); rc=load_mi4(loadbuffer, "/System/OF.ebn", MAX_LOADSIZE); if (rc <= EFILE_EMPTY) { printf("Can't load /System/OF.ebn"); printf(loader_strerror(rc)); } else { goto main_exit; } #endif printf("Trying /System/OF.mi4"); rc=load_mi4(loadbuffer, "/System/OF.mi4", MAX_LOADSIZE); if (rc <= EFILE_EMPTY) { printf("Can't load /System/OF.mi4"); printf(loader_strerror(rc)); } else { #if defined(SAMSUNG_YH925) lcd_reset(); #endif goto main_exit; } printf("Trying /System/OF.bin"); rc=load_raw_firmware(loadbuffer, "/System/OF.bin", MAX_LOADSIZE); if (rc <= EFILE_EMPTY) { printf("Can't load /System/OF.bin"); printf(loader_strerror(rc)); } else { #if defined(SAMSUNG_YH925) lcd_reset(); #endif goto main_exit; } error(0, 0, true); } main_exit: #ifdef HAVE_BOOTLOADER_USB_MODE storage_close(); system_prepare_fw_start(); #endif return (void*)loadbuffer; }
/* The following function is just test/development code */ void show_debug_screen(void) { int button; int power_count = 0; int count = 0; bool do_power_off = false; lcd_puts_scroll(0,0,"+++ this is a very very long line to test scrolling. ---"); while (!do_power_off) { line = 1; button = button_get(false); /* Power-off if POWER button has been held for a time This loop is currently running at about 100 iterations/second */ if (button & POWEROFF_BUTTON) { power_count++; if (power_count > 100) do_power_off = true; } else { power_count = 0; } #if 0 if (button & BUTTON_SELECT){ _backlight_off(); } else{ _backlight_on(); } #endif printf("Btn: 0x%08x",button); #if 0 printf("Tick: %d",current_tick); printf("GPIOA: 0x%08x",GPIOA); printf("GPIOB: 0x%08x",GPIOB); printf("GPIOC: 0x%08x",GPIOC); printf("GPIOD: 0x%08x",GPIOD); printf("GPIOE: 0x%08x",GPIOE); #endif #if 0 int i; for (i = 0; i<4; i++) { printf("ADC%d: 0x%04x",i,adc_read(i)); } #endif count++; printf("Count: %d",count); lcd_update(); sleep(HZ/10); } lcd_clear_display(); line = 0; printf("POWER-OFF"); /* Power-off */ power_off(); printf("(NOT) POWERED OFF"); while (true); }
void* main(void) { #ifdef TCCBOOT int rc; unsigned char* loadbuffer = (unsigned char*)LOAD_ADDRESS; #endif system_init(); power_init(); kernel_init(); enable_irq(); lcd_init(); adc_init(); button_init(); backlight_init(); font_init(); lcd_setfont(FONT_SYSFIXED); show_logo(); _backlight_on(); /* Only load the firmware if TCCBOOT is defined - this ensures SDRAM_START is available for loading the firmware. Otherwise display the debug screen. */ #ifdef TCCBOOT printf("Rockbox boot loader"); printf("Version " RBVERSION); printf("ATA"); rc = storage_init(); if(rc) { reset_screen(); error(EATA, rc, true); } printf("mount"); rc = disk_mount_all(); if (rc<=0) { error(EDISK,rc, true); } rc = load_firmware(loadbuffer, BOOTFILE, MAX_LOAD_SIZE); if (rc <= EFILE_EMPTY) { error(EBOOTFILE,rc, true); } else { int(*kernel_entry)(void) = (void *) loadbuffer; disable_irq(); rc = kernel_entry(); } panicf("Boot failed!"); #else show_debug_screen(); #endif return 0; }