From a61196fd3ae5ebd71134da8eb10e3189403c116f Mon Sep 17 00:00:00 2001 From: Mark Arigo Date: Fri, 19 Jun 2009 03:23:38 +0000 Subject: [PATCH] Philips SA9200: Working touchpad and button lights! Also, improvements to the keymap (still needs work). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21346 a1c6a512-1295-4272-9138-f99709370657 --- apps/keymaps/keymap-sa9200.c | 301 +++++++++--------- apps/lang/english.lang | 22 +- firmware/SOURCES | 3 + firmware/drivers/synaptics-mep.c | 20 ++ firmware/export/config-sa9200.h | 8 + firmware/export/usb.h | 6 +- .../arm/philips/sa9200/backlight-sa9200.c | 23 +- .../arm/philips/sa9200/backlight-target.h | 3 + .../target/arm/philips/sa9200/button-sa9200.c | 79 +++-- .../target/arm/philips/sa9200/button-target.h | 10 +- .../target/arm/philips/sa9200/power-sa9200.c | 40 ++- 11 files changed, 330 insertions(+), 185 deletions(-) diff --git a/apps/keymaps/keymap-sa9200.c b/apps/keymaps/keymap-sa9200.c index c77f3e9bb4..bf693600c8 100644 --- a/apps/keymaps/keymap-sa9200.c +++ b/apps/keymaps/keymap-sa9200.c @@ -53,22 +53,22 @@ static const struct button_mapping button_context_standard[] = { { ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_STD_CANCEL, BUTTON_REW, BUTTON_NONE }, + { ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE }, { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, - { ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, - - { ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU }, - { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, - - { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, { ACTION_STD_OK, BUTTON_FFWD, BUTTON_NONE }, + { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, + + { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, + { ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU }, + { ACTION_STD_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, LAST_ITEM_IN_LIST }; /* button_context_standard */ static const struct button_mapping button_context_wps[] = { - { ACTION_WPS_PLAY, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, + { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, { ACTION_WPS_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, { ACTION_WPS_SKIPNEXT, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD }, @@ -76,45 +76,43 @@ static const struct button_mapping button_context_wps[] = { { ACTION_WPS_SEEKBACK, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_WPS_SEEKFWD, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_STOPSEEK, BUTTON_REW|BUTTON_REL, BUTTON_REW|BUTTON_REPEAT }, { ACTION_WPS_STOPSEEK, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD|BUTTON_REPEAT }, - { ACTION_WPS_ABSETB_NEXTDIR, BUTTON_RIGHT|BUTTON_FFWD, BUTTON_NONE }, - { ACTION_WPS_ABSETA_PREVDIR, BUTTON_RIGHT|BUTTON_REW, BUTTON_NONE }, - { ACTION_WPS_ABRESET, BUTTON_RIGHT|BUTTON_SELECT, BUTTON_NONE }, + { ACTION_WPS_ABSETB_NEXTDIR,BUTTON_POWER|BUTTON_RIGHT, BUTTON_POWER }, + { ACTION_WPS_ABSETA_PREVDIR,BUTTON_POWER|BUTTON_LEFT, BUTTON_POWER }, + { ACTION_WPS_ABRESET, BUTTON_POWER|BUTTON_UP, BUTTON_POWER }, { ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE }, { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE }, { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, - { ACTION_WPS_PITCHSCREEN, BUTTON_RIGHT|BUTTON_UP, BUTTON_RIGHT }, - { ACTION_WPS_PITCHSCREEN, BUTTON_RIGHT|BUTTON_DOWN, BUTTON_RIGHT }, - - { ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU }, { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU }, - { ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT }, + { ACTION_WPS_BROWSE, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT }, - { ACTION_WPS_ID3SCREEN, BUTTON_RIGHT|BUTTON_MENU, BUTTON_NONE }, - { ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT }, + { ACTION_WPS_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, + { ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU }, + { ACTION_WPS_PITCHSCREEN, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_ID3SCREEN, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, LAST_ITEM_IN_LIST }; /* button_context_wps */ static const struct button_mapping button_context_list[] = { - { ACTION_LISTTREE_PGUP, BUTTON_RIGHT|BUTTON_UP, BUTTON_RIGHT }, - { ACTION_LISTTREE_PGUP, BUTTON_UP|BUTTON_REL, BUTTON_RIGHT|BUTTON_UP }, - { ACTION_LISTTREE_PGUP, BUTTON_RIGHT|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_LISTTREE_PGDOWN, BUTTON_RIGHT|BUTTON_DOWN, BUTTON_RIGHT }, - { ACTION_LISTTREE_PGDOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_RIGHT|BUTTON_DOWN }, - { ACTION_LISTTREE_PGDOWN, BUTTON_RIGHT|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_LISTTREE_PGUP, BUTTON_VOL_UP|BUTTON_UP, BUTTON_VOL_UP }, + { ACTION_LISTTREE_PGDOWN, BUTTON_VOL_DOWN|BUTTON_DOWN, BUTTON_VOL_DOWN }, + #ifdef HAVE_VOLUME_IN_LIST { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, #endif @@ -123,170 +121,181 @@ static const struct button_mapping button_context_list[] = { }; /* button_context_list */ static const struct button_mapping button_context_tree[] = { - { ACTION_TREE_WPS, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, - { ACTION_TREE_STOP, BUTTON_POWER, BUTTON_NONE }, - { ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, - { ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_TREE_WPS, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_TREE_STOP, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST) }; /* button_context_tree */ static const struct button_mapping button_context_listtree_scroll_with_combo[] = { - { ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE }, - { ACTION_TREE_PGLEFT, BUTTON_RIGHT|BUTTON_REW, BUTTON_RIGHT }, - { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REL, BUTTON_RIGHT|BUTTON_REW }, - { ACTION_TREE_PGLEFT, BUTTON_RIGHT|BUTTON_REW, BUTTON_REW|BUTTON_REL }, - { ACTION_TREE_ROOT_INIT, BUTTON_RIGHT|BUTTON_REW|BUTTON_REPEAT, BUTTON_RIGHT|BUTTON_REW }, - { ACTION_TREE_PGLEFT, BUTTON_RIGHT|BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_FFWD, BUTTON_RIGHT }, - { ACTION_TREE_PGRIGHT, BUTTON_FFWD|BUTTON_REL, BUTTON_RIGHT|BUTTON_FFWD }, - { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_FFWD, BUTTON_FFWD|BUTTON_REL }, - { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_TREE_ROOT_INIT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_TREE_PGLEFT, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_TREE_PGRIGHT, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), }; static const struct button_mapping button_context_listtree_scroll_without_combo[] = { { ACTION_NONE, BUTTON_REW, BUTTON_NONE }, - { ACTION_STD_CANCEL, BUTTON_REW|BUTTON_REL, BUTTON_REW }, - { ACTION_TREE_ROOT_INIT, BUTTON_REW|BUTTON_REPEAT, BUTTON_REW }, - { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_TREE_PGLEFT, BUTTON_REW|BUTTON_REL, BUTTON_REW|BUTTON_REPEAT }, { ACTION_NONE, BUTTON_FFWD, BUTTON_NONE }, + { ACTION_STD_OK, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD }, - { ACTION_TREE_PGRIGHT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_TREE_PGRIGHT, BUTTON_FFWD|BUTTON_REL, BUTTON_FFWD|BUTTON_REPEAT }, + { ACTION_STD_CANCEL, BUTTON_REW|BUTTON_REL, BUTTON_REW }, + { ACTION_TREE_ROOT_INIT, BUTTON_MENU, BUTTON_NONE }, + + { ACTION_TREE_PGLEFT, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT }, + + { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT }, + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE), }; static const struct button_mapping button_context_settings[] = { - { 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_REW, BUTTON_NONE }, - { ACTION_STD_PREVREPEAT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_STD_NEXT, BUTTON_FFWD, BUTTON_NONE }, - { ACTION_STD_NEXTREPEAT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_SETTINGS_RESET, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, + { ACTION_SETTINGS_RESET, BUTTON_PLAY, 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_REW, BUTTON_NONE }, + { ACTION_STD_PREVREPEAT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_STD_NEXT, BUTTON_FFWD, BUTTON_NONE }, + { ACTION_STD_NEXTREPEAT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE }, LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) }; /* button_context_settings */ static const struct button_mapping button_context_settings_right_is_inc[] = { - { ACTION_SETTINGS_INC, BUTTON_FFWD, BUTTON_NONE }, - { ACTION_SETTINGS_INCREPEAT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_SETTINGS_DEC, BUTTON_REW, BUTTON_NONE }, - { ACTION_SETTINGS_DECREPEAT, BUTTON_REW|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_RESET, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_SETTINGS_INC, BUTTON_FFWD, BUTTON_NONE }, + { ACTION_SETTINGS_INCREPEAT,BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_SETTINGS_DEC, BUTTON_REW, BUTTON_NONE }, + { ACTION_SETTINGS_DECREPEAT,BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE }, LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) }; /* button_context_settingsgraphical */ static const struct button_mapping button_context_yesno[] = { - { ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE }, + { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE }, + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) }; /* button_context_settings_yesno */ -static const struct button_mapping button_context_colorchooser[] = { - { ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE }, - LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS), -}; /* button_context_colorchooser */ - -static const struct button_mapping button_context_eq[] = { - { ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE }, - LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS), -}; /* button_context_eq */ - /** Bookmark Screen **/ static const struct button_mapping button_context_bmark[] = { - { ACTION_BMS_DELETE, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_BMS_DELETE, BUTTON_RIGHT, BUTTON_NONE }, LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST), }; /* button_context_bmark */ -static const struct button_mapping button_context_time[] = { - { ACTION_STD_CANCEL, BUTTON_POWER, BUTTON_NONE }, - { ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE }, - LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS), -}; /* button_context_time */ - static const struct button_mapping button_context_quickscreen[] = { - { 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_REW, BUTTON_NONE }, - { ACTION_QS_LEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_QS_RIGHT, BUTTON_FFWD, BUTTON_NONE }, - { ACTION_QS_RIGHT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_STD_CANCEL, BUTTON_MENU, BUTTON_NONE }, + { ACTION_NONE, BUTTON_REW, BUTTON_NONE }, + { ACTION_STD_CANCEL, BUTTON_MENU, BUTTON_NONE }, - LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) + { ACTION_QS_DOWNINV, BUTTON_UP|BUTTON_REL, BUTTON_NONE }, + { ACTION_QS_DOWNINV, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE }, + { ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_QS_LEFT, BUTTON_REW|BUTTON_REL, BUTTON_NONE }, + { ACTION_QS_LEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_QS_RIGHT, BUTTON_FFWD|BUTTON_REL, BUTTON_NONE }, + { ACTION_QS_RIGHT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD), }; /* button_context_quickscreen */ static const struct button_mapping button_context_pitchscreen[] = { - { 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_REW, BUTTON_NONE }, - { ACTION_PS_NUDGE_LEFTOFF, BUTTON_REW|BUTTON_REL, BUTTON_NONE }, - { ACTION_PS_NUDGE_RIGHT, BUTTON_FFWD, BUTTON_NONE }, - { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_FFWD|BUTTON_REL, BUTTON_NONE }, - { ACTION_PS_TOGGLE_MODE, BUTTON_MENU, BUTTON_NONE }, - { ACTION_PS_RESET, BUTTON_RIGHT, BUTTON_NONE }, - { ACTION_PS_EXIT, BUTTON_POWER, BUTTON_NONE }, - { ACTION_PS_SLOWER, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_PS_FASTER, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_RESET, BUTTON_PLAY, BUTTON_NONE }, + { ACTION_PS_EXIT, BUTTON_MENU, BUTTON_NONE }, + { ACTION_PS_EXIT, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_PS_EXIT, BUTTON_POWER, BUTTON_NONE }, - LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) + { 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_REW, BUTTON_NONE }, + { ACTION_PS_NUDGE_LEFTOFF, BUTTON_REW|BUTTON_REL, BUTTON_NONE }, + + { ACTION_PS_NUDGE_RIGHT, BUTTON_FFWD, BUTTON_NONE }, + { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_FFWD|BUTTON_REL, BUTTON_NONE }, + + { ACTION_PS_SLOWER, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_FASTER, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD), }; /* button_context_pitchcreen */ static const struct button_mapping button_context_keyboard[] = { - { ACTION_KBD_LEFT, BUTTON_REW, BUTTON_NONE }, - { ACTION_KBD_LEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_KBD_RIGHT, BUTTON_FFWD, BUTTON_NONE }, - { ACTION_KBD_RIGHT, BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_KBD_CURSOR_LEFT, BUTTON_RIGHT|BUTTON_REW, BUTTON_NONE }, - { ACTION_KBD_CURSOR_LEFT, BUTTON_RIGHT|BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_KBD_CURSOR_RIGHT, BUTTON_RIGHT|BUTTON_FFWD, BUTTON_NONE }, - { ACTION_KBD_CURSOR_RIGHT, BUTTON_RIGHT|BUTTON_FFWD|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE }, - { ACTION_KBD_PAGE_FLIP, BUTTON_RIGHT|BUTTON_MENU, BUTTON_NONE }, - { ACTION_KBD_DONE, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT }, - { ACTION_KBD_ABORT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, - { ACTION_KBD_BACKSPACE, BUTTON_MENU, BUTTON_NONE }, - { ACTION_KBD_BACKSPACE, BUTTON_MENU|BUTTON_REPEAT, 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 }, - { ACTION_KBD_MORSE_INPUT, BUTTON_RIGHT|BUTTON_POWER, BUTTON_NONE }, - { ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE }, + { ACTION_KBD_SELECT, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE }, + { ACTION_KBD_DONE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE }, + + { ACTION_KBD_LEFT, BUTTON_REW, BUTTON_NONE }, + { ACTION_KBD_LEFT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_KBD_RIGHT, BUTTON_FFWD, BUTTON_NONE }, + { ACTION_KBD_RIGHT, BUTTON_FFWD|BUTTON_REPEAT, 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 }, + + { ACTION_KBD_CURSOR_LEFT, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_KBD_CURSOR_RIGHT, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_KBD_BACKSPACE, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_KBD_BACKSPACE, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_KBD_PAGE_FLIP, BUTTON_VOL_DOWN, BUTTON_NONE }, + + { ACTION_KBD_MORSE_INPUT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_MORSE_SELECT, BUTTON_MENU|BUTTON_REL, BUTTON_NONE }, LAST_ITEM_IN_LIST }; /* button_context_keyboard */ #ifdef HAVE_USBSTACK static const struct button_mapping button_context_usb_hid[] = { - { ACTION_USB_HID_PLAY, BUTTON_RIGHT, BUTTON_NONE }, - { ACTION_USB_HID_STOP, BUTTON_POWER, BUTTON_NONE }, - { ACTION_USB_HID_SKIPPREV, BUTTON_REW, BUTTON_NONE }, - { ACTION_USB_HID_SKIPNEXT, BUTTON_FFWD, BUTTON_NONE }, - { ACTION_USB_HID_VOLUP, BUTTON_UP, BUTTON_NONE }, - { ACTION_USB_HID_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, - { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_VOLDOWN, BUTTON_DOWN, BUTTON_NONE }, - { ACTION_USB_HID_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, - { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, - { ACTION_USB_HID_MUTE, BUTTON_SELECT, BUTTON_NONE }, - { ACTION_USB_HID_MENU, BUTTON_MENU, BUTTON_NONE }, + { ACTION_USB_HID_PLAY, BUTTON_PLAY, BUTTON_NONE }, + { ACTION_USB_HID_STOP, BUTTON_LEFT, BUTTON_NONE }, + { ACTION_USB_HID_STOP, BUTTON_POWER, BUTTON_NONE }, + + { ACTION_USB_HID_SKIPPREV, BUTTON_REW, BUTTON_NONE }, + { ACTION_USB_HID_SKIPNEXT, BUTTON_FFWD, BUTTON_NONE }, + + { ACTION_USB_HID_VOLUP, BUTTON_UP, BUTTON_NONE }, + { ACTION_USB_HID_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_USB_HID_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_USB_HID_VOLDOWN, BUTTON_DOWN, BUTTON_NONE }, + { ACTION_USB_HID_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_USB_HID_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + + { ACTION_USB_HID_MUTE, BUTTON_RIGHT, BUTTON_NONE }, + { ACTION_USB_HID_MENU, BUTTON_MENU, BUTTON_NONE }, LAST_ITEM_IN_LIST }; /* button_context_usb_hid */ @@ -298,43 +307,47 @@ const struct button_mapping* get_context_mapping(int context) { case CONTEXT_STD: return button_context_standard; + case CONTEXT_WPS: return button_context_wps; case CONTEXT_LIST: return button_context_list; + case CONTEXT_MAINMENU: case CONTEXT_TREE: if (global_settings.hold_lr_for_scroll_in_list) return button_context_listtree_scroll_without_combo; else return button_context_listtree_scroll_with_combo; + case CONTEXT_CUSTOM|CONTEXT_TREE: return button_context_tree; + case CONTEXT_SETTINGS_TIME: case CONTEXT_SETTINGS: return button_context_settings; + case CONTEXT_CUSTOM|CONTEXT_SETTINGS: - return button_context_settings_right_is_inc; - case CONTEXT_SETTINGS_COLOURCHOOSER: - return button_context_colorchooser; case CONTEXT_SETTINGS_EQ: - return button_context_eq; - - case CONTEXT_SETTINGS_TIME: - return button_context_time; + return button_context_settings_right_is_inc; case CONTEXT_YESNOSCREEN: return button_context_yesno; + case CONTEXT_BOOKMARKSCREEN: return button_context_bmark; + case CONTEXT_QUICKSCREEN: return button_context_quickscreen; + case CONTEXT_PITCHSCREEN: return button_context_pitchscreen; + case CONTEXT_KEYBOARD: return button_context_keyboard; + #ifdef HAVE_USBSTACK case CONTEXT_USB_HID: return button_context_usb_hid; diff --git a/apps/lang/english.lang b/apps/lang/english.lang index da09e3c49a..987833a6f2 100644 --- a/apps/lang/english.lang +++ b/apps/lang/english.lang @@ -334,13 +334,13 @@ *: "PLAY = Yes" h100,h120,h300: "NAVI = Yes" - yh*,ipod*,x5,m5,gigabeat*,e200*,c200,h10,h10_5gb,mrobe100,sa9200: "SELECT = Yes" + yh*,ipod*,x5,m5,gigabeat*,e200*,c200,h10,h10_5gb,mrobe100: "SELECT = Yes" player: "(PLAY/STOP)" *: "PLAY = Yes" h100,h120,h300: "NAVI = Yes" - yh*,ipod*,x5,m5,gigabeat*,e200*,c200,h10,h10_5gb,mrobe100,sa9200: "SELECT = Yes" + yh*,ipod*,x5,m5,gigabeat*,e200*,c200,h10,h10_5gb,mrobe100: "SELECT = Yes" player: "(PLAY/STOP)" @@ -2457,14 +2457,16 @@ h100,h120,h300: "Building database... %d found (STOP to return)" ipod*: "Building database... %d found (PREV to return)" x5,m5,gigabeat*,mrobe100: "Building database... %d found (LEFT to return)" - h10,h10_5gb,e200*,c200,sa9200: "Building database... %d found (PREV to return)" + h10,h10_5gb,e200*,c200: "Building database... %d found (PREV to return)" + sa9200: "Building database... %d found (REW to return)" *: "Building database... %d found (OFF to return)" h100,h120,h300: "Building database... %d found (STOP to return)" ipod*: "Building database... %d found (PREV to return)" x5,m5,gigabeat*,mrobe100: "Building database... %d found (LEFT to return)" - h10,h10_5gb,e200*,c200,sa9200: "Building database... %d found (PREV to return)" + h10,h10_5gb,e200*,c200: "Building database... %d found (PREV to return)" + sa9200: "Building database... %d found (REW to return)" *: "entries found for database" @@ -4216,13 +4218,15 @@ *: none rtc: "ON = Set" h100,h120,h300: "NAVI = Set" - ipod*,x5,m5,h10,h10_5gb,e200*,c200,gigabeat*,mrobe100,sa9200: "SELECT = Set" + ipod*,x5,m5,h10,h10_5gb,e200*,c200,gigabeat*,mrobe100: "SELECT = Set" + sa9200: "PLAY = Set" *: none rtc: "ON = Set" h100,h120,h300: "NAVI = Set" - ipod*,x5,m5,h10,h10_5gb,e200*,c200,gigabeat*,mrobe100,sa9200: "SELECT = Set" + ipod*,x5,m5,h10,h10_5gb,e200*,c200,gigabeat*,mrobe100: "SELECT = Set" + sa9200: "PLAY = Set" *: none @@ -4237,23 +4241,25 @@ *: none rtc: "OFF = Revert" h100,h120,h300: "STOP = Revert" - ipod*,c200,sa9200: "MENU = Revert" + ipod*,c200: "MENU = Revert" x5,m5: "RECORD = Revert" h10,h10_5gb,e200*: "PREV = Revert" gigabeatf: "POWER = Revert" mrobe100: "DISPLAY = Revert" gigabeats: "BACK = Revert" + sa9200: "LEFT = Revert" *: none rtc: "OFF = Revert" h100,h120,h300: "STOP = Revert" - ipod*,c200,sa9200: "MENU = Revert" + ipod*,c200: "MENU = Revert" x5,m5: "RECORD = Revert" h10,h10_5gb,e200*: "PREV = Revert" gigabeatf: "POWER = Revert" mrobe100: "DISPLAY = Revert" gigabeats: "BACK = Revert" + sa9200: "LEFT = Revert" *: none diff --git a/firmware/SOURCES b/firmware/SOURCES index 78f13a9444..bba9ef1dc5 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -547,6 +547,9 @@ target/arm/sandisk/audio-c200_e200.c #ifdef PHILIPS_SA9200 #ifndef SIMULATOR +#ifndef BOOTLOADER +drivers/synaptics-mep.c +#endif /* BOOTLOADER */ target/arm/adc-as3514.c target/arm/ascodec-pp.c target/arm/ata-sd-pp.c diff --git a/firmware/drivers/synaptics-mep.c b/firmware/drivers/synaptics-mep.c index 64b63397f7..f4b5a99aa7 100644 --- a/firmware/drivers/synaptics-mep.c +++ b/firmware/drivers/synaptics-mep.c @@ -73,6 +73,26 @@ #define DATA_LO GPIO_SET_BITWISE(GPIOA_OUTPUT_EN, 0x10);\ GPIO_CLEAR_BITWISE(GPIOA_OUTPUT_VAL, 0x10) #define DATA_CL GPIO_CLEAR_BITWISE(GPIOA_OUTPUT_EN, 0x10) + +#elif defined(PHILIPS_SA9200) +#define INT_ENABLE GPIO_CLEAR_BITWISE(GPIOD_INT_LEV, 0x2);\ + GPIO_SET_BITWISE(GPIOD_INT_EN, 0x2) +#define INT_DISABLE GPIO_CLEAR_BITWISE(GPIOD_INT_EN, 0x2);\ + GPIO_SET_BITWISE(GPIOD_INT_CLR, 0x2) + +#define ACK (GPIOD_INPUT_VAL & 0x8) +#define ACK_HI GPIO_SET_BITWISE(GPIOD_OUTPUT_VAL, 0x8) +#define ACK_LO GPIO_CLEAR_BITWISE(GPIOD_OUTPUT_VAL, 0x8) + +#define CLK ((GPIOD_INPUT_VAL & 0x2) >> 1) +#define CLK_HI GPIO_SET_BITWISE(GPIOD_OUTPUT_VAL, 0x2) +#define CLK_LO GPIO_CLEAR_BITWISE(GPIOD_OUTPUT_VAL, 0x2) + +#define DATA ((GPIOD_INPUT_VAL & 0x10) >> 4) +#define DATA_HI GPIO_CLEAR_BITWISE(GPIOD_OUTPUT_EN, 0x10) +#define DATA_LO GPIO_CLEAR_BITWISE(GPIOD_OUTPUT_VAL, 0x10);\ + GPIO_SET_BITWISE(GPIOD_OUTPUT_EN, 0x10) +#define DATA_CL GPIO_CLEAR_BITWISE(GPIOD_OUTPUT_EN, 0x10) #endif #define LO 0 diff --git a/firmware/export/config-sa9200.h b/firmware/export/config-sa9200.h index e35c27e15e..37c0b50035 100755 --- a/firmware/export/config-sa9200.h +++ b/firmware/export/config-sa9200.h @@ -59,6 +59,9 @@ #define CONFIG_KEYPAD PHILIPS_SA9200_PAD +/* define this if the target has volume keys which can be used in the lists */ +#define HAVE_VOLUME_IN_LIST + /* Define this if you do software codec */ #define CONFIG_CODEC SWCODEC @@ -99,6 +102,11 @@ /* Which backlight fading type? */ #define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING +/* define this if you have a light associated with the buttons */ +#define HAVE_BUTTON_LIGHT +/* Can't control the brightness on all the buttons */ +/* #define HAVE_BUTTONLIGHT_BRIGHTNESS */ + /* define this if you have a flash memory storage */ #define HAVE_FLASH_STORAGE diff --git a/firmware/export/usb.h b/firmware/export/usb.h index 557639c622..2707541bff 100644 --- a/firmware/export/usb.h +++ b/firmware/export/usb.h @@ -77,10 +77,12 @@ enum { #elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \ (CONFIG_KEYPAD == SANSA_C200_PAD) || \ (CONFIG_KEYPAD == SANSA_CLIP_PAD) || \ - (CONFIG_KEYPAD == SANSA_FUZE_PAD) || \ - (CONFIG_KEYPAD == PHILIPS_SA9200_PAD) + (CONFIG_KEYPAD == SANSA_FUZE_PAD) #define USBPOWER_BUTTON BUTTON_SELECT #define USBPOWER_BTN_IGNORE BUTTON_POWER +#elif (CONFIG_KEYPAD == PHILIPS_SA9200_PAD) +#define USBPOWER_BUTTON BUTTON_PLAY +#define USBPOWER_BTN_IGNORE BUTTON_POWER #elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD #define USBPOWER_BUTTON BUTTON_PLAYLIST #define USBPOWER_BTN_IGNORE BUTTON_POWER diff --git a/firmware/target/arm/philips/sa9200/backlight-sa9200.c b/firmware/target/arm/philips/sa9200/backlight-sa9200.c index a0acaa0abd..22aae1ae6b 100644 --- a/firmware/target/arm/philips/sa9200/backlight-sa9200.c +++ b/firmware/target/arm/philips/sa9200/backlight-sa9200.c @@ -21,10 +21,10 @@ #include "config.h" #include "backlight-target.h" #include "system.h" -#include "lcd.h" #include "backlight.h" #include "ascodec.h" #include "as3514.h" +#include "synaptics-mep.h" void _backlight_set_brightness(int brightness) { @@ -51,12 +51,29 @@ void _backlight_off(void) #endif } +#ifdef HAVE_BUTTON_LIGHT + +#define BUTTONLIGHT_MASK 0x7f +#define BUTTONLIGHT_MAX 0x0f +static unsigned short buttonlight_status = 0; + void _buttonlight_on(void) { - /* TODO */ + if (!buttonlight_status) + { + touchpad_set_buttonlights(BUTTONLIGHT_MASK, BUTTONLIGHT_MAX); + GPIOD_OUTPUT_VAL &= ~(0x40 | 0x20 | 0x04); /* REW/FFWD/MENU */ + buttonlight_status = 1; + } } void _buttonlight_off(void) { - /* TODO */ + if (buttonlight_status) + { + touchpad_set_buttonlights(BUTTONLIGHT_MASK, 0); + GPIOD_OUTPUT_VAL |= (0x40 | 0x20 | 0x04); /* REW/FFWD/MENU */ + buttonlight_status = 0; + } } +#endif diff --git a/firmware/target/arm/philips/sa9200/backlight-target.h b/firmware/target/arm/philips/sa9200/backlight-target.h index 21fad6d22e..9d695e5a22 100644 --- a/firmware/target/arm/philips/sa9200/backlight-target.h +++ b/firmware/target/arm/philips/sa9200/backlight-target.h @@ -27,6 +27,9 @@ void _backlight_off(void); void _backlight_set_brightness(int brightness); int __backlight_is_on(void); +#ifdef HAVE_BUTTON_LIGHT void _buttonlight_on(void); void _buttonlight_off(void); #endif + +#endif diff --git a/firmware/target/arm/philips/sa9200/button-sa9200.c b/firmware/target/arm/philips/sa9200/button-sa9200.c index d965966075..be37111ecb 100755 --- a/firmware/target/arm/philips/sa9200/button-sa9200.c +++ b/firmware/target/arm/philips/sa9200/button-sa9200.c @@ -22,12 +22,59 @@ #include "system.h" #include "button.h" #include "backlight.h" +#include "synaptics-mep.h" +#define LOGF_ENABLE +#include "logf.h" + +static int int_btn = BUTTON_NONE; + +#ifndef BOOTLOADER void button_init_device(void) { - /* TODO...for now, hardware initialisation is done by the c200 bootloader */ + /* The touchpad is powered on and initialized in power-sa9200.c + since it needs to be ready for both buttons and button lights. */ } +/* + * Button interrupt handler + */ +void button_int(void) +{ + char data[4]; + int val; + + int_btn = BUTTON_NONE; + + val = touchpad_read_device(data, 4); + + if (val == MEP_BUTTON_HEADER) + { + /* Buttons packet */ + if (data[1] & 0x1) int_btn |= BUTTON_FFWD; + if (data[1] & 0x2) int_btn |= BUTTON_RIGHT; + if (data[1] & 0x4) int_btn |= BUTTON_LEFT; + if (data[1] & 0x8) int_btn |= BUTTON_REW; + if (data[2] & 0x1) int_btn |= BUTTON_MENU; + } + else if (val == MEP_ABSOLUTE_HEADER) + { + /* Absolute packet - the finger is on the vertical strip. + Position ranges from 1-4095, with 1 at the bottom. */ + val = ((data[1] >> 4) << 8) | data[2]; /* position */ + + if ((val > 0) && (val <= 1365)) + int_btn |= BUTTON_DOWN; + else if ((val > 1365) && (val <= 2730)) + int_btn |= BUTTON_PLAY; + else if ((val > 2730) && (val <= 4095)) + int_btn |= BUTTON_UP; + } +} +#else +void button_init_device(void){} +#endif /* bootloader */ + bool button_hold(void) { return !(GPIOL_INPUT_VAL & 0x40); @@ -38,32 +85,14 @@ bool button_hold(void) */ int button_read_device(void) { - int btn = BUTTON_NONE; - static bool hold_button = false; - bool hold_button_old; + int btn = int_btn; - /* Hold */ - hold_button_old = hold_button; - hold_button = button_hold(); + if (button_hold()) + return BUTTON_NONE; -#ifndef BOOTLOADER - if (hold_button != hold_button_old) - backlight_hold_changed(hold_button); -#endif - - /* device buttons */ - if (!hold_button) - { -#if 0 - if (!(GPIOB_INPUT_VAL & 0x20)) btn |= BUTTON_POWER; - if (!(GPIOF_INPUT_VAL & 0x10)) btn |= BUTTON_VOL_UP; - if (!(GPIOF_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN; -#endif - /* A hack until the touchpad works */ - if (!(GPIOB_INPUT_VAL & 0x20)) btn |= BUTTON_SELECT; - if (!(GPIOF_INPUT_VAL & 0x10)) btn |= BUTTON_UP; - if (!(GPIOF_INPUT_VAL & 0x04)) btn |= BUTTON_DOWN; - } + if (!(GPIOB_INPUT_VAL & 0x20)) btn |= BUTTON_POWER; + if (!(GPIOF_INPUT_VAL & 0x10)) btn |= BUTTON_VOL_UP; + if (!(GPIOF_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN; return btn; } diff --git a/firmware/target/arm/philips/sa9200/button-target.h b/firmware/target/arm/philips/sa9200/button-target.h index 0d691506d2..6259aa0737 100755 --- a/firmware/target/arm/philips/sa9200/button-target.h +++ b/firmware/target/arm/philips/sa9200/button-target.h @@ -25,15 +25,23 @@ #include #include "config.h" +#define MEP_BUTTON_HEADER 0x1a +#define MEP_BUTTON_ID 0x09 +#define MEP_ABSOLUTE_HEADER 0x0b + #define HAS_BUTTON_HOLD bool button_hold(void); void button_init_device(void); int button_read_device(void); +#ifndef BOOTLOADER +void button_int(void); +#endif + /* Main unit's buttons */ #define BUTTON_POWER 0x00000001 -#define BUTTON_SELECT 0x00000002 +#define BUTTON_PLAY 0x00000002 #define BUTTON_MENU 0x00000004 #define BUTTON_LEFT 0x00000008 #define BUTTON_RIGHT 0x00000010 diff --git a/firmware/target/arm/philips/sa9200/power-sa9200.c b/firmware/target/arm/philips/sa9200/power-sa9200.c index cf9468cb1d..5da1fc5fc4 100644 --- a/firmware/target/arm/philips/sa9200/power-sa9200.c +++ b/firmware/target/arm/philips/sa9200/power-sa9200.c @@ -22,14 +22,50 @@ #include #include "system.h" #include "cpu.h" -#include "i2c-pp.h" -#include "tuner.h" #include "ascodec.h" #include "as3514.h" #include "power.h" +#include "synaptics-mep.h" +#include "logf.h" void power_init(void) { +#ifndef BOOTLOADER + /* Power on and initialize the touchpad here because we need it for + both buttons and button lights */ + DEV_INIT2 &= ~0x800; + + char byte = ascodec_read(AS3514_CVDD_DCDC3); + byte = (byte & ~0x18) | 0x08; + ascodec_write(AS3514_CVDD_DCDC3, byte); + + /* LEDs for REW, FFWD, MENU */ + GPIOD_ENABLE |= (0x40 | 0x20 | 0x04); + GPIOD_OUTPUT_VAL |= (0x40 | 0x20 | 0x04); + GPIOD_OUTPUT_EN |= (0x40 | 0x20 | 0x04); + udelay(20000); + + GPIOL_ENABLE |= 0x10; + GPIOL_OUTPUT_VAL &= ~0x10; + GPIOL_OUTPUT_EN |= 0x10; + udelay(100000); + + /* enable DATA, ACK, CLK lines */ + GPIOD_ENABLE |= (0x10 | 0x08 | 0x02); + + GPIOD_OUTPUT_EN |= 0x08; /* ACK */ + GPIOD_OUTPUT_VAL |= 0x08; /* high */ + + GPIOD_OUTPUT_EN &= ~0x02; /* CLK */ + + GPIOD_OUTPUT_EN |= 0x10; /* DATA */ + GPIOD_OUTPUT_VAL |= 0x10; /* high */ + + if (!touchpad_init()) + { + logf("touchpad not ready"); + } +#endif } void power_off(void)