diff --git a/apps/keymaps/keymap-e200.c b/apps/keymaps/keymap-e200.c index 1c90e46..8155adf 100644 --- a/apps/keymaps/keymap-e200.c +++ b/apps/keymaps/keymap-e200.c @@ -32,10 +32,10 @@ #include "settings.h" * Insert LAST_ITEM_IN_LIST at the end of each mapping */ const struct button_mapping button_context_standard[] = { - { ACTION_STD_PREV, BUTTON_SCROLL_UP, BUTTON_NONE }, - { ACTION_STD_PREVREPEAT, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_STD_NEXT, BUTTON_SCROLL_DOWN, BUTTON_NONE }, - { ACTION_STD_NEXTREPEAT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE }, + { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_STD_MENU, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, @@ -55,21 +55,21 @@ const struct button_mapping button_conte const struct button_mapping button_context_wps[] = { { ACTION_WPS_PLAY, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, { ACTION_WPS_STOP, BUTTON_SELECT|BUTTON_REPEAT,BUTTON_SELECT }, - { ACTION_WPS_SKIPPREV, BUTTON_UP|BUTTON_REL, BUTTON_UP}, - { ACTION_WPS_SEEKBACK, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_WPS_STOPSEEK, BUTTON_UP|BUTTON_REL, BUTTON_UP|BUTTON_REPEAT }, - { ACTION_WPS_SKIPNEXT, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN }, - { ACTION_WPS_SEEKFWD, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_WPS_STOPSEEK, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN|BUTTON_REPEAT }, + { ACTION_WPS_SKIPPREV, BUTTON_SCROLL_UP|BUTTON_REL, BUTTON_SCROLL_UP}, + { ACTION_WPS_SEEKBACK, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_STOPSEEK, BUTTON_SCROLL_UP|BUTTON_REL, BUTTON_SCROLL_UP|BUTTON_REPEAT }, + { ACTION_WPS_SKIPNEXT, BUTTON_SCROLL_DOWN|BUTTON_REL, BUTTON_SCROLL_DOWN }, + { ACTION_WPS_SEEKFWD, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_STOPSEEK, BUTTON_SCROLL_DOWN|BUTTON_REL, BUTTON_SCROLL_DOWN|BUTTON_REPEAT }, - { ACTION_WPS_ABSETB_NEXTDIR, BUTTON_POWER|BUTTON_DOWN, BUTTON_POWER }, - { ACTION_WPS_ABSETA_PREVDIR, BUTTON_POWER|BUTTON_UP, BUTTON_POWER }, + { ACTION_WPS_ABSETB_NEXTDIR, BUTTON_POWER|BUTTON_SCROLL_DOWN, BUTTON_POWER }, + { ACTION_WPS_ABSETA_PREVDIR, BUTTON_POWER|BUTTON_SCROLL_UP, BUTTON_POWER }, { ACTION_WPSAB_RESET, BUTTON_POWER|BUTTON_SELECT, BUTTON_POWER }, - { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE }, - { ACTION_WPS_VOLDOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT,BUTTON_NONE }, - { ACTION_WPS_VOLUP, BUTTON_SCROLL_UP, BUTTON_NONE }, - { ACTION_WPS_VOLUP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT,BUTTON_NONE }, + { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE }, + { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_WPS_BROWSE, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, { ACTION_WPS_CONTEXT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_RIGHT }, @@ -82,10 +82,10 @@ const struct button_mapping button_conte }; /* button_context_wps */ const struct button_mapping button_context_settings[] = { - { ACTION_SETTINGS_INC, BUTTON_SCROLL_UP, BUTTON_NONE }, - { ACTION_SETTINGS_INCREPEAT,BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_SETTINGS_DEC, BUTTON_SCROLL_DOWN, BUTTON_NONE }, - { ACTION_SETTINGS_DECREPEAT,BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE }, + { ACTION_SETTINGS_INCREPEAT,BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_SETTINGS_DECREPEAT,BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE }, { ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE }, @@ -96,8 +96,8 @@ const struct button_mapping button_conte }; /* button_context_settings */ const struct button_mapping button_context_list[] = { - { ACTION_LISTTREE_PGUP, BUTTON_UP|BUTTON_REL, BUTTON_UP }, - { ACTION_LISTTREE_PGDOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN }, + { ACTION_LISTTREE_PGUP, BUTTON_SCROLL_UP|BUTTON_REL, BUTTON_SCROLL_UP }, + { ACTION_LISTTREE_PGDOWN, BUTTON_SCROLL_DOWN|BUTTON_REL, BUTTON_SCROLL_DOWN }, LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) }; /* button_context_list */ @@ -110,24 +110,24 @@ const struct button_mapping button_conte }; /* button_context_tree */ const struct button_mapping button_context_listtree_scroll_without_combo[] = { - { ACTION_TREE_ROOT_INIT, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP }, - { ACTION_TREE_PGLEFT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_TREE_PGRIGHT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_TREE_ROOT_INIT, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_SCROLL_UP }, + { ACTION_TREE_PGLEFT, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_TREE_PGRIGHT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), }; /* button_context_listtree_scroll_without_combo */ const struct button_mapping button_context_listtree_scroll_with_combo[] = { - { ACTION_LISTTREE_PGUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP }, - { ACTION_LISTTREE_PGDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN }, - { ACTION_TREE_PGLEFT, BUTTON_UP|BUTTON_SELECT, BUTTON_SELECT }, - { ACTION_TREE_PGLEFT, BUTTON_UP|BUTTON_REL, BUTTON_UP|BUTTON_SELECT }, - { ACTION_TREE_PGLEFT, BUTTON_UP|BUTTON_SELECT, BUTTON_UP|BUTTON_REL }, - { ACTION_TREE_ROOT_INIT, BUTTON_UP|BUTTON_SELECT|BUTTON_REPEAT, BUTTON_UP|BUTTON_SELECT }, - { ACTION_TREE_PGLEFT, BUTTON_UP|BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_TREE_PGRIGHT, BUTTON_DOWN|BUTTON_SELECT, BUTTON_SELECT }, - { ACTION_TREE_PGRIGHT, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN|BUTTON_SELECT }, - { ACTION_TREE_PGRIGHT, BUTTON_DOWN|BUTTON_SELECT, BUTTON_DOWN|BUTTON_REL }, - { ACTION_TREE_PGRIGHT, BUTTON_DOWN|BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_LISTTREE_PGUP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_SCROLL_UP }, + { ACTION_LISTTREE_PGDOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_SCROLL_DOWN }, + { ACTION_TREE_PGLEFT, BUTTON_SCROLL_UP|BUTTON_SELECT, BUTTON_SELECT }, + { ACTION_TREE_PGLEFT, BUTTON_SCROLL_UP|BUTTON_REL, BUTTON_SCROLL_UP|BUTTON_SELECT }, + { ACTION_TREE_PGLEFT, BUTTON_SCROLL_UP|BUTTON_SELECT, BUTTON_SCROLL_UP|BUTTON_REL }, + { ACTION_TREE_ROOT_INIT, BUTTON_SCROLL_UP|BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SCROLL_UP|BUTTON_SELECT }, + { ACTION_TREE_PGLEFT, BUTTON_SCROLL_UP|BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_TREE_PGRIGHT, BUTTON_SCROLL_DOWN|BUTTON_SELECT, BUTTON_SELECT }, + { ACTION_TREE_PGRIGHT, BUTTON_SCROLL_DOWN|BUTTON_REL, BUTTON_SCROLL_DOWN|BUTTON_SELECT }, + { ACTION_TREE_PGRIGHT, BUTTON_SCROLL_DOWN|BUTTON_SELECT, BUTTON_SCROLL_DOWN|BUTTON_REL }, + { ACTION_TREE_PGRIGHT, BUTTON_SCROLL_DOWN|BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE }, LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), }; /* button_context_listtree_scroll_with_combo */ @@ -137,27 +137,27 @@ const struct button_mapping button_conte }; /* button_context_settings_yesno */ const struct button_mapping button_context_quickscreen[] = { - { ACTION_QS_DOWNINV, BUTTON_SCROLL_UP, BUTTON_NONE }, - { ACTION_QS_DOWNINV, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_QS_DOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE }, - { ACTION_QS_DOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_QS_LEFT, BUTTON_UP, BUTTON_NONE }, - { ACTION_QS_LEFT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_QS_RIGHT, BUTTON_DOWN, BUTTON_NONE }, - { ACTION_QS_RIGHT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_DOWNINV, BUTTON_UP, BUTTON_NONE }, + { ACTION_QS_DOWNINV, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_DOWN, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_LEFT, BUTTON_SCROLL_UP, BUTTON_NONE }, + { ACTION_QS_LEFT, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_RIGHT, BUTTON_SCROLL_DOWN, BUTTON_NONE }, + { ACTION_QS_RIGHT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD), }; /* button_context_quickscreen */ const struct button_mapping button_context_settings_right_is_inc[] = { - { ACTION_SETTINGS_INC, BUTTON_SCROLL_UP, BUTTON_NONE }, - { ACTION_SETTINGS_INCREPEAT, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_SETTINGS_DEC, BUTTON_SCROLL_DOWN, BUTTON_NONE }, - { ACTION_SETTINGS_DECREPEAT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT,BUTTON_NONE }, - { ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE }, - { ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE }, - { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE }, + { ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT,BUTTON_NONE }, + { ACTION_STD_PREV, BUTTON_SCROLL_UP, BUTTON_NONE }, + { ACTION_STD_PREVREPEAT, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_NEXT, BUTTON_SCROLL_DOWN, BUTTON_NONE }, + { ACTION_STD_NEXTREPEAT, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE }, { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE }, { ACTION_NONE, BUTTON_LEFT, BUTTON_NONE }, @@ -167,14 +167,14 @@ const struct button_mapping button_conte }; /* button_context_settings_right_is_inc */ const struct button_mapping button_context_pitchscreen[] = { - { ACTION_PS_INC_SMALL, BUTTON_SCROLL_UP, BUTTON_NONE }, - { ACTION_PS_INC_BIG, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_PS_DEC_SMALL, BUTTON_SCROLL_DOWN, BUTTON_NONE }, - { ACTION_PS_DEC_BIG, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_PS_NUDGE_LEFT, BUTTON_UP, BUTTON_NONE }, - { ACTION_PS_NUDGE_LEFTOFF, BUTTON_UP|BUTTON_REL, BUTTON_NONE }, - { ACTION_PS_NUDGE_RIGHT, BUTTON_DOWN, BUTTON_NONE }, - { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE }, + { ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE }, + { ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_NUDGE_LEFT, BUTTON_SCROLL_UP, BUTTON_NONE }, + { ACTION_PS_NUDGE_LEFTOFF, BUTTON_SCROLL_UP|BUTTON_REL, BUTTON_NONE }, + { ACTION_PS_NUDGE_RIGHT, BUTTON_SCROLL_DOWN, BUTTON_NONE }, + { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_SCROLL_DOWN|BUTTON_REL, BUTTON_NONE }, { ACTION_PS_RESET, BUTTON_SELECT, BUTTON_NONE }, { ACTION_PS_EXIT, BUTTON_LEFT, BUTTON_NONE }, @@ -186,19 +186,19 @@ const struct button_mapping button_conte { ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, { ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_KBD_SELECT, BUTTON_UP|BUTTON_REL, BUTTON_UP }, + { ACTION_KBD_SELECT, BUTTON_SCROLL_UP|BUTTON_REL, BUTTON_SCROLL_UP }, { ACTION_KBD_DONE, BUTTON_SELECT, BUTTON_NONE }, - { ACTION_KBD_ABORT, BUTTON_DOWN, BUTTON_NONE }, - { ACTION_KBD_UP, BUTTON_SCROLL_UP, BUTTON_NONE }, - { ACTION_KBD_UP, BUTTON_SCROLL_UP|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_KBD_DOWN, BUTTON_SCROLL_DOWN, BUTTON_NONE }, - { ACTION_KBD_DOWN, BUTTON_SCROLL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_ABORT, BUTTON_SCROLL_DOWN, BUTTON_NONE }, + { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE }, + { ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, LAST_ITEM_IN_LIST }; /* button_context_keyboard */ const struct button_mapping button_context_bmark[] = { - { ACTION_BMS_DELETE, BUTTON_UP, BUTTON_NONE }, + { ACTION_BMS_DELETE, BUTTON_SCROLL_UP, BUTTON_NONE }, { ACTION_BMS_SELECT, BUTTON_RIGHT, BUTTON_NONE }, { ACTION_BMS_EXIT, BUTTON_LEFT, BUTTON_NONE }, LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD), diff --git a/apps/plugins/bitmaps/native/SOURCES b/apps/plugins/bitmaps/native/SOURCES index be8f2b6..1e71da0 100644 --- a/apps/plugins/bitmaps/native/SOURCES +++ b/apps/plugins/bitmaps/native/SOURCES @@ -253,6 +253,10 @@ #if (LCD_WIDTH >= 240) && (LCD_HEIGHT >= sudoku_start.320x240x16.bmp sudoku_normal.320x240x16.bmp sudoku_inverse.320x240x16.bmp +#elif (LCD_WIDTH == 176) && (LCD_HEIGHT == 220) && (LCD_DEPTH == 16) +sudoku_start.176x220x16.bmp +sudoku_normal.176x220x16.bmp +sudoku_inverse.176x220x16.bmp #endif #endif diff --git a/apps/plugins/sudoku/SOURCES b/apps/plugins/sudoku/SOURCES index 8b344bd..7cce555 100644 --- a/apps/plugins/sudoku/SOURCES +++ b/apps/plugins/sudoku/SOURCES @@ -1,5 +1,3 @@ -#if !defined(SANSA_E200) sudoku.c generator.c templates.c -#endif diff --git a/apps/plugins/sudoku/sudoku.c b/apps/plugins/sudoku/sudoku.c index a6ccfb9..112d2c1 100644 --- a/apps/plugins/sudoku/sudoku.c +++ b/apps/plugins/sudoku/sudoku.c @@ -129,8 +129,7 @@ #elif ((LCD_HEIGHT==128) && (LCD_WIDTH== #define CELL_WIDTH 12 #define CELL_HEIGHT 12 -#elif ((LCD_HEIGHT==176) && (LCD_WIDTH==220)) || \ - ((LCD_HEIGHT==220) && (LCD_WIDTH==176)) +#elif ((LCD_HEIGHT==176) && (LCD_WIDTH==220)) /* Iriver h300, iPod Color/Photo - 220x176, 9 cells @ 16x16 with 14 border lines */ /* Internal dimensions of a cell */ @@ -158,6 +157,13 @@ #if (LCD_HEIGHT>=320) && (LCD_WIDTH>=240 #define CELL_WIDTH 24 #define CELL_HEIGHT 24 +#elif (LCD_HEIGHT==220) && (LCD_WIDTH==176) +/* Sansa */ + +/* Internal dimensions of a cell */ +#define CELL_WIDTH 16 +#define CELL_HEIGHT 16 + #else #error SUDOKU: Unsupported LCD size #endif diff --git a/apps/plugins/sudoku/sudoku.h b/apps/plugins/sudoku/sudoku.h index 0bb80a0..6f5d1d1 100644 --- a/apps/plugins/sudoku/sudoku.h +++ b/apps/plugins/sudoku/sudoku.h @@ -102,12 +102,12 @@ #define SUDOKU_BUTTON_POSSIBLE BUTTON_FF #elif (CONFIG_KEYPAD == SANSA_E200_PAD) #define SUDOKU_BUTTON_QUIT BUTTON_POWER -#define SUDOKU_BUTTON_UP BUTTON_UP -#define SUDOKU_BUTTON_DOWN BUTTON_DOWN +#define SUDOKU_BUTTON_UP BUTTON_SCROLL_UP +#define SUDOKU_BUTTON_DOWN BUTTON_SCROLL_DOWN #define SUDOKU_BUTTON_LEFT BUTTON_LEFT #define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT #define SUDOKU_BUTTON_TOGGLE BUTTON_SELECT -#define SUDOKU_BUTTON_MENU (BUTTON_SELECT|BUTTON_REPEAT) +#define SUDOKU_BUTTON_MENU BUTTON_DOWN #define SUDOKU_BUTTON_POSSIBLE BUTTON_REC #elif diff --git a/bootloader/e200.c b/bootloader/e200.c index c88290b..f03fb4a 100644 --- a/bootloader/e200.c +++ b/bootloader/e200.c @@ -5,10 +5,13 @@ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ - * $Id: e200.c,v 1.5 2006-10-16 17:21:30 dan_a Exp $ + * $Id: h10.c,v 1.4 2006-08-28 08:11:32 barrywardell Exp $ * - * Copyright (C) 2006 Daniel Stenberg + * Copyright (C) 2006 by Barry Wardell * + * Based on Rockbox iriver bootloader by Linus Nielsen Feltzing + * and the ipodlinux bootloader by Daniel Palffy and Bernard Leach + * * All files in this archive are subject to the GNU General Public License. * See the file COPYING in the source tree root for full license agreement. * @@ -32,63 +35,252 @@ #include "disk.h" #include "font.h" #include "adc.h" #include "backlight.h" +#include "button.h" #include "panic.h" #include "power.h" #include "file.h" -static inline void blink(void) +/* Size of the buffer to store the loaded Rockbox/Sansa image */ +#define MAX_LOADSIZE (10*1024*1024) + +/* A buffer to load the iriver firmware or Rockbox into */ +unsigned char loadbuffer[MAX_LOADSIZE]; + +char version[] = APPSVERSION; + +/* To store the original state of the GPIOs. +We only use A-F in the bootloader */ +unsigned long gpio_en[7]; +unsigned long gpio_output_en[7]; + +#define DRAM_START 0x10000000 + +int line=0; + +/* Save the initial GPIO status from the Sansa bootloader */ +void gpio_save(void) { - volatile unsigned int* ptr; - int i; - ptr = (volatile unsigned int*)0x70000020; + int i = 0; + gpio_en[i] = GPIOA_ENABLE; + gpio_output_en[i++] = GPIOA_OUTPUT_EN; + gpio_en[i] = GPIOB_ENABLE; + gpio_output_en[i++] = GPIOB_OUTPUT_EN; + gpio_en[i] = GPIOC_ENABLE; + gpio_output_en[i++] = GPIOC_OUTPUT_EN; + gpio_en[i] = GPIOD_ENABLE; + gpio_output_en[i++] = GPIOD_OUTPUT_EN; + gpio_en[i] = GPIOE_ENABLE; + gpio_output_en[i++] = GPIOE_OUTPUT_EN; + gpio_en[i] = GPIOF_ENABLE; + gpio_output_en[i++] = GPIOF_OUTPUT_EN; + gpio_en[i] = GPIOG_ENABLE; + gpio_output_en[i++] = GPIOG_OUTPUT_EN; +} + +/* Restore the GPIO status */ +void gpio_restore(void) +{ + int i = 0; + GPIOA_ENABLE = gpio_en[i]; + GPIOA_OUTPUT_EN = gpio_output_en[i++]; + GPIOB_ENABLE = gpio_en[i]; + GPIOB_OUTPUT_EN = gpio_output_en[i++]; + GPIOC_ENABLE = gpio_en[i]; + GPIOC_OUTPUT_EN = gpio_output_en[i++]; + GPIOD_ENABLE = gpio_en[i]; + GPIOD_OUTPUT_EN = gpio_output_en[i++]; + GPIOE_ENABLE = gpio_en[i]; + GPIOE_OUTPUT_EN = gpio_output_en[i++]; + GPIOF_ENABLE = gpio_en[i]; + GPIOF_OUTPUT_EN = gpio_output_en[i++]; + GPIOG_ENABLE = gpio_en[i]; + GPIOG_OUTPUT_EN = gpio_output_en[i++]; +} + +/* Load original iriver firmware. This function expects a file called + "/System/Original.mi4" on the player. It should be decrypted + and have the header stripped using mi4code. It reads the file in to a memory + buffer called buf. The rest of the loading is done in main() and crt0.S +*/ +int load_iriver(unsigned char* buf) +{ + int fd; + int rc; + int len; + + fd = open("/.rockbox/OF.bin", O_RDONLY); + + len = filesize(fd); + + if (len > MAX_LOADSIZE) + return -6; - *ptr &= ~(1 << 13); - for(i = 0; i < 0xfffff; i++) + rc = read(fd, buf, len); + if(rc < len) + return -4; + + close(fd); + gpio_restore(); + return len; +} + +/* Load Rockbox firmware (rockbox.h10) */ +int load_rockbox(unsigned char* buf) +{ + int fd; + int rc; + int len; + unsigned long chksum; + char model[5]; + unsigned long sum; + int i; + char str[80]; + + fd = open("/.rockbox/" BOOTFILE, O_RDONLY); + if(fd < 0) { + fd = open("/" BOOTFILE, O_RDONLY); + if(fd < 0) + return -1; } - *ptr |= (1 << 13); - for(i = 0; i < 0xfffff; i++) - { + + len = filesize(fd) - 8; + + snprintf(str, sizeof(str), "Length: %x", len); + lcd_puts(0, line++ ,str); + lcd_update(); + + if (len > MAX_LOADSIZE) + return -6; + + lseek(fd, FIRMWARE_OFFSET_FILE_CRC, SEEK_SET); + + rc = read(fd, &chksum, 4); + chksum=betoh32(chksum); /* Rockbox checksums are big-endian */ + if(rc < 4) + return -2; + + snprintf(str, sizeof(str), "Checksum: %x", chksum); + lcd_puts(0, line++ ,str); + lcd_update(); + + rc = read(fd, model, 4); + if(rc < 4) + return -3; + + model[4] = 0; + + snprintf(str, sizeof(str), "Model name: %s", model); + lcd_puts(0, line++ ,str); + lcd_update(); + + lseek(fd, FIRMWARE_OFFSET_FILE_DATA, SEEK_SET); + + rc = read(fd, buf, len); + if(rc < len) + return -4; + + close(fd); + + sum = MODEL_NUMBER; + + for(i = 0;i < len;i++) { + sum += buf[i]; } + + /* I don't know why my checksums aren't matching. Figure this out before committing. Hack around it for now */ + sum += 4; + + snprintf(str, sizeof(str), "Sum: %x", sum); + lcd_puts(0, line++ ,str); + lcd_update(); + + if(sum != chksum) + return -5; + + return len; } -static inline void slow_blink(void) +void* main(void) { - volatile unsigned int* ptr; + char buf[256]; int i; - ptr = (volatile unsigned int*)0x70000020; + int rc; + unsigned short* identify_info; + struct partinfo* pinfo; - *ptr &= ~(1 << 13); - for(i = 0; i < (0xfffff); i++) - { - } - for(i = 0; i < (0xfffff); i++) - { - } - for(i = 0; i < (0xfffff); i++) - { - } + gpio_save(); + system_init(); + kernel_init(); + lcd_init(); + font_init(); - *ptr |= (1 << 13); - for(i = 0; i < (0xfffff); i++) - { + line=0; + + lcd_setfont(FONT_SYSFIXED); + + lcd_puts(0, line++, "Rockbox boot loader"); + snprintf(buf, sizeof(buf), "Version: 20%s", version); + lcd_puts(0, line++, buf); + snprintf(buf, sizeof(buf), "iriver H10"); + lcd_puts(0, line++, buf); + lcd_update(); + + i=ata_init(); + 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; + } + lcd_puts(0, line++, buf); + lcd_update(); + } else { + snprintf(buf, sizeof(buf), "ATA: %d", i); + lcd_puts(0, line++, buf); + lcd_update(); } - for(i = 0; i < (0xfffff); i++) + + disk_init(); + rc = disk_mount_all(); + if (rc<=0) { + lcd_puts(0, line++, "No partition found"); + lcd_update(); } - for(i = 0; i < (0xfffff); i++) + + pinfo = disk_partinfo(0); + snprintf(buf, sizeof(buf), "Partition 0: 0x%02x %ld MB", + pinfo->type, pinfo->size / 2048); + lcd_puts(0, line++, buf); + lcd_update(); + + i=button_read_device(); + if(i==BUTTON_LEFT) { + lcd_puts(0, line, "Loading iriver firmware..."); + lcd_update(); + rc=load_iriver(loadbuffer); + } else { + lcd_puts(0, line, "Loading Rockbox..."); + lcd_update(); + rc=load_rockbox(loadbuffer); } -} -static inline unsigned long get_pc(void) -{ - unsigned long pc; - asm volatile ( - "mov %0, pc\n" - : "=r"(pc) - ); - return pc; + if (rc < 0) { + snprintf(buf, sizeof(buf), "Rockbox error: %d",rc); + lcd_puts(0, line++, buf); + lcd_update(); + while(1) {} + } + + memcpy((void*)DRAM_START,loadbuffer,rc); + + return (void*)DRAM_START; } /* These functions are present in the firmware library, but we reimplement @@ -100,62 +292,7 @@ void reset_poweroff_timer(void) int dbg_ports(void) { - unsigned int gpio_a, gpio_b, gpio_c, gpio_d; - unsigned int gpio_e, gpio_f, gpio_g, gpio_h; - unsigned int gpio_i, gpio_j, gpio_k, gpio_l; - - char buf[128]; - int line; - - lcd_setmargins(0, 0); - lcd_clear_display(); - lcd_setfont(FONT_SYSFIXED); - - while(1) - { - gpio_a = GPIOA_INPUT_VAL; - gpio_b = GPIOB_INPUT_VAL; - gpio_c = GPIOC_INPUT_VAL; - - gpio_g = GPIOG_INPUT_VAL; - gpio_h = GPIOH_INPUT_VAL; - gpio_i = GPIOI_INPUT_VAL; - - line = 0; - snprintf(buf, sizeof(buf), "GPIO_A: %02x GPIO_G: %02x", gpio_a, gpio_g); - lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "GPIO_B: %02x GPIO_H: %02x", gpio_b, gpio_h); - lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "GPIO_C: %02x GPIO_I: %02x", gpio_c, gpio_i); - lcd_puts(0, line++, buf); - line++; - - gpio_d = GPIOD_INPUT_VAL; - gpio_e = GPIOE_INPUT_VAL; - gpio_f = GPIOF_INPUT_VAL; - - gpio_j = GPIOJ_INPUT_VAL; - gpio_k = GPIOK_INPUT_VAL; - gpio_l = GPIOL_INPUT_VAL; - - snprintf(buf, sizeof(buf), "GPIO_D: %02x GPIO_J: %02x", gpio_d, gpio_j); - lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "GPIO_E: %02x GPIO_K: %02x", gpio_e, gpio_k); - lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "GPIO_F: %02x GPIO_L: %02x", gpio_f, gpio_l); - lcd_puts(0, line++, buf); - line++; - snprintf(buf, sizeof(buf), "ADC_1: %02x", adc_read(ADC_0)); - lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "ADC_2: %02x", adc_read(ADC_1)); - lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "ADC_3: %02x", adc_read(ADC_2)); - lcd_puts(0, line++, buf); - snprintf(buf, sizeof(buf), "ADC_4: %02x", adc_read(ADC_3)); - lcd_puts(0, line++, buf); - lcd_update(); - } - return 0; + return 0; } void mpeg_stop(void) @@ -173,18 +310,3 @@ void usb_wait_for_disconnect(void) void sys_poweroff(void) { } - -void system_reboot(void) -{ - -} - -void main(void) -{ - kernel_init(); - adc_init(); - lcd_init_device(); - - dbg_ports(); -} - diff --git a/firmware/export/config-e200.h b/firmware/export/config-e200.h index 1bbdd60..c33873d 100644 --- a/firmware/export/config-e200.h +++ b/firmware/export/config-e200.h @@ -36,7 +36,7 @@ #define CONFIG_CODEC SWCODEC /* define this if you have a real-time clock */ #ifndef BOOTLOADER -#define CONFIG_RTC RTC_E8564 /* TODO: figure this out */ +#define CONFIG_RTC RTC_E8564 /* TODO: figure this out */ #endif /* Define this if you have a software controlled poweroff */ diff --git a/firmware/target/arm/crt0-pp.S b/firmware/target/arm/crt0-pp.S index 0f915d5..a9c3781 100644 --- a/firmware/target/arm/crt0-pp.S +++ b/firmware/target/arm/crt0-pp.S @@ -163,6 +163,12 @@ #ifndef STUB #endif /* !STUB */ #endif /* !BOOTLOADER */ +#ifdef BOOTLOADER + ldr r1, =CACHE_CTRL + mov r2, #0x0 + str r2, [r1] +#endif + /* Initialise bss section to zero */ ldr r2, =_edata ldr r3, =_end @@ -252,6 +258,14 @@ start_loc: mov r3, #WAKE str r3, [r4] + nop + nop + nop + nop + nop + nop + nop + /* jump to start location */ mov pc, r0 diff --git a/firmware/target/arm/sandisk/sansa-e200/usb-target.h b/firmware/target/arm/sandisk/sansa-e200/usb-target.h index e14c106..341770b 100644 --- a/firmware/target/arm/sandisk/sansa-e200/usb-target.h +++ b/firmware/target/arm/sandisk/sansa-e200/usb-target.h @@ -22,4 +22,3 @@ #define USB_TARGET_H bool usb_init_device(void); #endif - diff --git a/tools/configure b/tools/configure index 7b4f9d2..a7c2b80 100755 --- a/tools/configure +++ b/tools/configure @@ -1097,10 +1097,11 @@ EOF target="-DSANSA_E200" memory=32 # supposedly arm7tdmicc - tool="$rootdir/tools/mkmi4.sh e200" + #tool="$rootdir/tools/mkmi4.sh e200" + tool="$rootdir/tools/scramble -add=e200" bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" bmp2rb_native="$rootdir/tools/bmp2rb -f 4" - output="PP5022.mi4" + output="rockbox.e200" appextra="recorder:gui" archosrom="" flash="" diff --git a/tools/scramble.c b/tools/scramble.c index e7de1cb..31b5d6b 100644 --- a/tools/scramble.c +++ b/tools/scramble.c @@ -207,6 +207,8 @@ int main (int argc, char** argv) modelnum = 14; else if(!strcmp(&argv[1][5], "tpj2")) modelnum = 15; + else if(!strcmp(&argv[1][5], "e200")) + modelnum = 16; else { fprintf(stderr, "unsupported model: %s\n", &argv[1][5]); return 2;