From 180cef835bf40d0081895773aaa637ac926bb0ac Mon Sep 17 00:00:00 2001 From: Marcin Bukat Date: Mon, 5 Nov 2018 13:01:55 +0100 Subject: [PATCH] xDuoo X3II and X20 port Provided by Roman Stolyarov Integration, Refactoring, and Upstreaming by Solomon Peachy X3II confirmed working by forum tester, X20 is nearly identical. This includes bootloader, main firmware, and the flash image patcher. Eventual Todo: * Further refactor AGPTek Rocker & xduoo hiby bootloaders * Further refactor AGPTek Rocker & xduoo hosted platform code Change-Id: I34a674051d368efcc75d1d18c725971fe46c3eee --- apps/SOURCES | 4 + apps/bitmaps/native/SOURCES | 4 + apps/bitmaps/native/hibyicon.130x130x16.bmp | Bin 0 -> 51016 bytes apps/keymaps/keymap-xduoox20.c | 213 +++++++ apps/keymaps/keymap-xduoox3ii.c | 213 +++++++ apps/plugins/battery_bench.c | 12 + apps/plugins/blackjack.c | 32 + apps/plugins/brickmania.c | 20 + apps/plugins/calculator.c | 22 + apps/plugins/calendar.c | 20 + apps/plugins/chessbox/chessbox_pgn.h | 28 + apps/plugins/chessclock.c | 20 + apps/plugins/chip8.c | 16 + apps/plugins/chopper.c | 10 + apps/plugins/clix.c | 16 + apps/plugins/cube.c | 20 + apps/plugins/doom/i_video.c | 22 + apps/plugins/fft/fft.c | 18 + apps/plugins/flipit.c | 24 + apps/plugins/fractals/fractal.h | 24 + apps/plugins/goban/goban.h | 24 + apps/plugins/imageviewer/imageviewer_button.h | 30 + apps/plugins/invadrox.c | 14 + apps/plugins/jewels.c | 20 + apps/plugins/lib/keymaps.h | 16 + apps/plugins/lib/pluginlib_actions.c | 30 + apps/plugins/midi/midiplay.c | 16 + apps/plugins/minesweeper.c | 26 + apps/plugins/mp3_encoder.c | 13 + apps/plugins/mpegplayer/mpeg_settings.c | 20 + apps/plugins/mpegplayer/mpegplayer.c | 18 + apps/plugins/oscilloscope.c | 29 + apps/plugins/pacbox/pacbox.h | 19 + apps/plugins/pegbox.c | 34 ++ apps/plugins/pong.c | 16 + apps/plugins/reversi/reversi-gui.h | 22 + apps/plugins/rockblox.c | 24 + apps/plugins/rockboy/rockboy.c | 20 + apps/plugins/sliding_puzzle.c | 19 + apps/plugins/snake.c | 16 + apps/plugins/snake2.c | 18 + apps/plugins/sokoban.c | 32 + apps/plugins/solitaire.c | 38 ++ apps/plugins/spacerocks.c | 18 + apps/plugins/star.c | 32 + apps/plugins/stopwatch.c | 16 + apps/plugins/sudoku/sudoku.h | 28 + apps/plugins/text_viewer/tv_button.h | 24 + apps/plugins/vu_meter.c | 22 + apps/plugins/wormlet.c | 18 + apps/plugins/xobox.c | 18 + apps/plugins/zxbox/keymaps.h | 16 + apps/plugins/zxbox/zxbox_keyb.c | 18 + bootloader/SOURCES | 2 + bootloader/rocker_linux.c | 4 +- bootloader/xduoo_linux.c | 555 ++++++++++++++++++ firmware/SOURCES | 40 +- firmware/asm/SOURCES | 2 +- firmware/drivers/audio/xduoolinux_codec.c | 122 ++++ firmware/export/audiohw.h | 2 + firmware/export/config.h | 6 + firmware/export/config/agptekrocker.h | 2 +- firmware/export/config/xduoox20.h | 126 ++++ firmware/export/config/xduoox3ii.h | 126 ++++ firmware/export/rbpaths.h | 2 +- firmware/export/xduoolinux_codec.h | 7 + .../hosted/{agptek => }/backlight-target.h | 0 .../backlight-agptek.c => backlight-unix.c} | 0 firmware/target/hosted/filesystem-app.c | 6 +- firmware/target/hosted/rtc.c | 2 +- firmware/target/hosted/sdl/sim-ui-defines.h | 16 +- firmware/target/hosted/{agptek => }/sysfs.c | 0 firmware/target/hosted/{agptek => }/sysfs.h | 0 .../system-agptek.c => system-hosted.c} | 0 firmware/target/hosted/xduoo/adc-target.h | 0 firmware/target/hosted/xduoo/button-target.h | 46 ++ firmware/target/hosted/xduoo/button-xduoo.c | 202 +++++++ firmware/target/hosted/xduoo/debug-xduoo.c | 6 + firmware/target/hosted/xduoo/lcd-target.h | 32 + firmware/target/hosted/xduoo/lcd-xduoo.c | 140 +++++ firmware/target/hosted/xduoo/power-xduoo.c | 74 +++ firmware/target/hosted/xduoo/power-xduoo.h | 31 + .../target/hosted/xduoo/powermgmt-xduoo.c | 70 +++ firmware/target/hosted/xduoo/system-target.h | 28 + firmware/target/hosted/xduoo/usb-xduoo.c | 118 ++++ firmware/target/hosted/xduoo/xduoo.make | 52 ++ tools/configure | 92 ++- tools/root.make | 6 + 88 files changed, 3334 insertions(+), 45 deletions(-) create mode 100644 apps/bitmaps/native/hibyicon.130x130x16.bmp create mode 100644 apps/keymaps/keymap-xduoox20.c create mode 100644 apps/keymaps/keymap-xduoox3ii.c create mode 100644 bootloader/xduoo_linux.c create mode 100644 firmware/drivers/audio/xduoolinux_codec.c create mode 100644 firmware/export/config/xduoox20.h create mode 100644 firmware/export/config/xduoox3ii.h create mode 100644 firmware/export/xduoolinux_codec.h rename firmware/target/hosted/{agptek => }/backlight-target.h (100%) rename firmware/target/hosted/{agptek/backlight-agptek.c => backlight-unix.c} (100%) rename firmware/target/hosted/{agptek => }/sysfs.c (100%) rename firmware/target/hosted/{agptek => }/sysfs.h (100%) rename firmware/target/hosted/{agptek/system-agptek.c => system-hosted.c} (100%) create mode 100644 firmware/target/hosted/xduoo/adc-target.h create mode 100644 firmware/target/hosted/xduoo/button-target.h create mode 100644 firmware/target/hosted/xduoo/button-xduoo.c create mode 100644 firmware/target/hosted/xduoo/debug-xduoo.c create mode 100644 firmware/target/hosted/xduoo/lcd-target.h create mode 100644 firmware/target/hosted/xduoo/lcd-xduoo.c create mode 100644 firmware/target/hosted/xduoo/power-xduoo.c create mode 100644 firmware/target/hosted/xduoo/power-xduoo.h create mode 100644 firmware/target/hosted/xduoo/powermgmt-xduoo.c create mode 100644 firmware/target/hosted/xduoo/system-target.h create mode 100644 firmware/target/hosted/xduoo/usb-xduoo.c create mode 100644 firmware/target/hosted/xduoo/xduoo.make diff --git a/apps/SOURCES b/apps/SOURCES index 67fe678287..20e6fa9d2d 100644 --- a/apps/SOURCES +++ b/apps/SOURCES @@ -323,4 +323,8 @@ keymaps/keymap-dx50.c keymaps/keymap-agptekrocker.c #elif CONFIG_KEYPAD == XDUOO_X3_PAD keymaps/keymap-xduoox3.c +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +keymaps/keymap-xduoox3ii.c +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +keymaps/keymap-xduoox20.c #endif diff --git a/apps/bitmaps/native/SOURCES b/apps/bitmaps/native/SOURCES index ea726d4c07..f74f289214 100644 --- a/apps/bitmaps/native/SOURCES +++ b/apps/bitmaps/native/SOURCES @@ -48,6 +48,10 @@ toolsicon.130x130x16.bmp hibyicon.70x70x16.bmp rockboxicon.70x70x16.bmp toolsicon.70x70x16.bmp +#elif (defined(XDUOO_X3II) || defined(XDUOO_X20)) +hibyicon.130x130x16.bmp +rockboxicon.130x130x16.bmp +toolsicon.130x130x16.bmp #endif #endif diff --git a/apps/bitmaps/native/hibyicon.130x130x16.bmp b/apps/bitmaps/native/hibyicon.130x130x16.bmp new file mode 100644 index 0000000000000000000000000000000000000000..0c31b90e2804aadeb8f711846c23ecef61c330e4 GIT binary patch literal 51016 zcmeI52b>h;`N!|z?tlZ1ayzp#J2QJU0may3i81zGqG%K)DzV4dyP{DOd&C|K_LzUH zpfM_TkaF~nAXY4~MFVp5w*T+%ox5dkc5iQiqnM9;mix@@O?ltv_w?s^-`VTX14b8_ ze>?KCC;$Ic`@guzG2eIO?;Tr*|IHWt=rOvcb9GIZpFSIj0uUbvii$c_*SMooX=GwYc_FMHd!2?Jv?2#Aegi=Inxju8bjdesbJK6f5@la^E182M|ppJ zC2{NE#EnlSu74_V^OK2N2k{Nx`-5k2j$b{W^95Ik&&(8e(>+6J*_1?OQ^O%-{n3kq zsfNWrO$9Sj{_CH655D7GaldoS+3~%PvA5jS3VO!kU1AkZtYwE-X+^B0b?v9Lt-h&n zV|J&Qzd2_*dmZicIorML9`B)d{8vAf6wT3{1MnQZWYZCnO$CSf!SEk~(Tl|T&}nwc zfAbsfw&&d6T^|4WewNcMR@ypNRHjd}R<>tattF(<}b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}H~;_u literal 0 HcmV?d00001 diff --git a/apps/keymaps/keymap-xduoox20.c b/apps/keymaps/keymap-xduoox20.c new file mode 100644 index 0000000000..3b1b01b7fa --- /dev/null +++ b/apps/keymaps/keymap-xduoox20.c @@ -0,0 +1,213 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2018 by Roman Stolyarov + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +/* Button Code Definitions for xDuoo X20 target */ + +#include "config.h" +#include "action.h" +#include "button.h" +#include "settings.h" + +/* {Action Code, Button code, Prereq button code } */ + +/* + * The format of the list is as follows + * { Action Code, Button code, Prereq button code } + * if there's no need to check the previous button's value, use BUTTON_NONE + * Insert LAST_ITEM_IN_LIST at the end of each mapping + */ +static const struct button_mapping button_context_standard[] = { + { ACTION_STD_PREV, BUTTON_PREV, BUTTON_NONE }, + { ACTION_STD_PREVREPEAT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_NEXT, BUTTON_NEXT, BUTTON_NONE }, + { ACTION_STD_NEXTREPEAT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, + { ACTION_STD_CANCEL, BUTTON_HOME|BUTTON_REL, BUTTON_HOME }, + { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, + { ACTION_STD_MENU, BUTTON_OPTION|BUTTON_REL, BUTTON_OPTION }, + + LAST_ITEM_IN_LIST +}; /* button_context_standard */ + +static const struct button_mapping button_context_wps[] = { + { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, + { ACTION_WPS_SKIPPREV, BUTTON_PREV|BUTTON_REL, BUTTON_PREV }, + { ACTION_WPS_SEEKBACK, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_STOPSEEK, BUTTON_PREV|BUTTON_REL, BUTTON_PREV|BUTTON_REPEAT }, + { ACTION_WPS_SKIPNEXT, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT }, + { ACTION_WPS_SEEKFWD, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_STOPSEEK, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT|BUTTON_REPEAT }, + { ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_BROWSE, BUTTON_HOME|BUTTON_REL, BUTTON_HOME }, + { ACTION_WPS_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, + { ACTION_WPS_MENU, BUTTON_OPTION|BUTTON_REL, BUTTON_OPTION }, + { ACTION_WPS_QUICKSCREEN, BUTTON_OPTION|BUTTON_REPEAT, BUTTON_OPTION }, + { ACTION_WPS_HOTKEY, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME }, + + LAST_ITEM_IN_LIST +}; /* button_context_wps */ + +static const struct button_mapping button_context_list[] = { + { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_list */ + +/** Bookmark Screen **/ +static const struct button_mapping button_context_bmark[] = { + { ACTION_BMS_DELETE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST) +}; /* button_context_bmark */ + +/** Keyboard **/ +static const struct button_mapping button_context_keyboard[] = { + { ACTION_KBD_LEFT, BUTTON_PREV, BUTTON_NONE }, + { ACTION_KBD_LEFT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_RIGHT, BUTTON_NEXT, BUTTON_NONE }, + { ACTION_KBD_RIGHT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_DOWN, BUTTON_OPTION, BUTTON_NONE }, + { ACTION_KBD_DOWN, BUTTON_OPTION|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_LEFT, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_KBD_CURSOR_LEFT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_RIGHT, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_KBD_CURSOR_RIGHT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_BACKSPACE, BUTTON_HOME, BUTTON_NONE }, + { ACTION_KBD_BACKSPACE, BUTTON_HOME|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_SELECT, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, + { ACTION_KBD_DONE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, + { ACTION_KBD_ABORT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, + + LAST_ITEM_IN_LIST +}; /* button_context_keyboard */ + +/** Pitchscreen **/ +static const struct button_mapping button_context_pitchscreen[] = { + { ACTION_PS_INC_SMALL, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_PS_INC_BIG, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_DEC_SMALL, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_PS_DEC_BIG, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_NUDGE_LEFT, BUTTON_PREV, BUTTON_NONE }, + { ACTION_PS_NUDGE_LEFTOFF, BUTTON_PREV|BUTTON_REL, BUTTON_NONE }, + { ACTION_PS_NUDGE_RIGHT, BUTTON_NEXT, BUTTON_NONE }, + { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_NEXT|BUTTON_REL, BUTTON_NONE }, + { ACTION_PS_TOGGLE_MODE, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE }, + { ACTION_PS_RESET, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, + { ACTION_PS_EXIT, BUTTON_HOME|BUTTON_REL, BUTTON_HOME }, + { ACTION_PS_SLOWER, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_FASTER, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_pitchscreen */ + +/** Quickscreen **/ +static const struct button_mapping button_context_quickscreen[] = { + { ACTION_QS_TOP, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_QS_TOP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_DOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_QS_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_LEFT, BUTTON_PREV, BUTTON_NONE }, + { ACTION_QS_LEFT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_RIGHT, BUTTON_NEXT, BUTTON_NONE }, + { ACTION_QS_RIGHT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_CANCEL, BUTTON_HOME|BUTTON_REL, BUTTON_HOME }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_quickscreen */ + +/** Settings - General Mappings **/ +static const struct button_mapping button_context_settings[] = { + { ACTION_SETTINGS_RESET, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, + { ACTION_STD_PREV, BUTTON_PREV, BUTTON_NONE }, + { ACTION_STD_PREVREPEAT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_NEXT, BUTTON_NEXT, BUTTON_NONE }, + { ACTION_STD_NEXTREPEAT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, + { ACTION_STD_CANCEL, BUTTON_HOME|BUTTON_REL, BUTTON_HOME }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_settings */ + +static const struct button_mapping button_context_settings_vol_is_inc[] = { + { ACTION_SETTINGS_INC, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_SETTINGS_INCREPEAT,BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_SETTINGS_DEC, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_SETTINGS_DECREPEAT,BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_settings_right_is_inc */ + +/** Tree **/ +static const struct button_mapping button_context_tree[] = { + { ACTION_TREE_WPS, BUTTON_OPTION|BUTTON_REL, BUTTON_OPTION }, + { ACTION_TREE_HOTKEY, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME }, + { ACTION_STD_MENU, BUTTON_OPTION|BUTTON_REPEAT, BUTTON_OPTION }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST) +}; /* button_context_tree */ + +/** Yes/No Screen **/ +static const struct button_mapping button_context_yesnoscreen[] = { + { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_settings_yesnoscreen */ + +/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */ +const struct button_mapping* get_context_mapping(int context) +{ + switch (context) + { + case CONTEXT_LIST: + return button_context_list; + case CONTEXT_STD: + return button_context_standard; + case CONTEXT_BOOKMARKSCREEN: + return button_context_bmark; + case CONTEXT_KEYBOARD: + return button_context_keyboard; + case CONTEXT_PITCHSCREEN: + return button_context_pitchscreen; + case CONTEXT_QUICKSCREEN: + return button_context_quickscreen; + case CONTEXT_SETTINGS: + return button_context_settings; + case CONTEXT_SETTINGS_TIME: + case CONTEXT_SETTINGS_COLOURCHOOSER: + case CONTEXT_SETTINGS_EQ: + case CONTEXT_SETTINGS_RECTRIGGER: + return button_context_settings_vol_is_inc; + case CONTEXT_TREE: + case CONTEXT_MAINMENU: + return button_context_tree; + case CONTEXT_WPS: + return button_context_wps; + case CONTEXT_YESNOSCREEN: + return button_context_yesnoscreen; + } + return button_context_standard; +} diff --git a/apps/keymaps/keymap-xduoox3ii.c b/apps/keymaps/keymap-xduoox3ii.c new file mode 100644 index 0000000000..d30efaed2c --- /dev/null +++ b/apps/keymaps/keymap-xduoox3ii.c @@ -0,0 +1,213 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2018 by Roman Stolyarov + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +/* Button Code Definitions for xDuoo X3ii target */ + +#include "config.h" +#include "action.h" +#include "button.h" +#include "settings.h" + +/* {Action Code, Button code, Prereq button code } */ + +/* + * The format of the list is as follows + * { Action Code, Button code, Prereq button code } + * if there's no need to check the previous button's value, use BUTTON_NONE + * Insert LAST_ITEM_IN_LIST at the end of each mapping + */ +static const struct button_mapping button_context_standard[] = { + { ACTION_STD_PREV, BUTTON_PREV, BUTTON_NONE }, + { ACTION_STD_PREVREPEAT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_NEXT, BUTTON_NEXT, BUTTON_NONE }, + { ACTION_STD_NEXTREPEAT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, + { ACTION_STD_CANCEL, BUTTON_HOME|BUTTON_REL, BUTTON_HOME }, + { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, + { ACTION_STD_MENU, BUTTON_OPTION|BUTTON_REL, BUTTON_OPTION }, + + LAST_ITEM_IN_LIST +}; /* button_context_standard */ + +static const struct button_mapping button_context_wps[] = { + { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, + { ACTION_WPS_SKIPPREV, BUTTON_PREV|BUTTON_REL, BUTTON_PREV }, + { ACTION_WPS_SEEKBACK, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_STOPSEEK, BUTTON_PREV|BUTTON_REL, BUTTON_PREV|BUTTON_REPEAT }, + { ACTION_WPS_SKIPNEXT, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT }, + { ACTION_WPS_SEEKFWD, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_STOPSEEK, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT|BUTTON_REPEAT }, + { ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_WPS_BROWSE, BUTTON_HOME|BUTTON_REL, BUTTON_HOME }, + { ACTION_WPS_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, + { ACTION_WPS_MENU, BUTTON_OPTION|BUTTON_REL, BUTTON_OPTION }, + { ACTION_WPS_QUICKSCREEN, BUTTON_OPTION|BUTTON_REPEAT, BUTTON_OPTION }, + { ACTION_WPS_HOTKEY, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME }, + + LAST_ITEM_IN_LIST +}; /* button_context_wps */ + +static const struct button_mapping button_context_list[] = { + { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_list */ + +/** Bookmark Screen **/ +static const struct button_mapping button_context_bmark[] = { + { ACTION_BMS_DELETE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST) +}; /* button_context_bmark */ + +/** Keyboard **/ +static const struct button_mapping button_context_keyboard[] = { + { ACTION_KBD_LEFT, BUTTON_PREV, BUTTON_NONE }, + { ACTION_KBD_LEFT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_RIGHT, BUTTON_NEXT, BUTTON_NONE }, + { ACTION_KBD_RIGHT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_DOWN, BUTTON_OPTION, BUTTON_NONE }, + { ACTION_KBD_DOWN, BUTTON_OPTION|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_LEFT, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_KBD_CURSOR_LEFT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_CURSOR_RIGHT, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_KBD_CURSOR_RIGHT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_BACKSPACE, BUTTON_HOME, BUTTON_NONE }, + { ACTION_KBD_BACKSPACE, BUTTON_HOME|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_KBD_SELECT, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, + { ACTION_KBD_DONE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY }, + { ACTION_KBD_ABORT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, + + LAST_ITEM_IN_LIST +}; /* button_context_keyboard */ + +/** Pitchscreen **/ +static const struct button_mapping button_context_pitchscreen[] = { + { ACTION_PS_INC_SMALL, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_PS_INC_BIG, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_DEC_SMALL, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_PS_DEC_BIG, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_NUDGE_LEFT, BUTTON_PREV, BUTTON_NONE }, + { ACTION_PS_NUDGE_LEFTOFF, BUTTON_PREV|BUTTON_REL, BUTTON_NONE }, + { ACTION_PS_NUDGE_RIGHT, BUTTON_NEXT, BUTTON_NONE }, + { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_NEXT|BUTTON_REL, BUTTON_NONE }, + { ACTION_PS_TOGGLE_MODE, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE }, + { ACTION_PS_RESET, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, + { ACTION_PS_EXIT, BUTTON_HOME|BUTTON_REL, BUTTON_HOME }, + { ACTION_PS_SLOWER, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_PS_FASTER, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_pitchscreen */ + +/** Quickscreen **/ +static const struct button_mapping button_context_quickscreen[] = { + { ACTION_QS_TOP, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_QS_TOP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_DOWN, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_QS_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_LEFT, BUTTON_PREV, BUTTON_NONE }, + { ACTION_QS_LEFT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_QS_RIGHT, BUTTON_NEXT, BUTTON_NONE }, + { ACTION_QS_RIGHT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_CANCEL, BUTTON_HOME|BUTTON_REL, BUTTON_HOME }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_quickscreen */ + +/** Settings - General Mappings **/ +static const struct button_mapping button_context_settings[] = { + { ACTION_SETTINGS_RESET, BUTTON_POWER|BUTTON_REL, BUTTON_POWER }, + { ACTION_STD_PREV, BUTTON_PREV, BUTTON_NONE }, + { ACTION_STD_PREVREPEAT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_NEXT, BUTTON_NEXT, BUTTON_NONE }, + { ACTION_STD_NEXTREPEAT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY }, + { ACTION_STD_CANCEL, BUTTON_HOME|BUTTON_REL, BUTTON_HOME }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_settings */ + +static const struct button_mapping button_context_settings_vol_is_inc[] = { + { ACTION_SETTINGS_INC, BUTTON_VOL_UP, BUTTON_NONE }, + { ACTION_SETTINGS_INCREPEAT,BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE }, + { ACTION_SETTINGS_DEC, BUTTON_VOL_DOWN, BUTTON_NONE }, + { ACTION_SETTINGS_DECREPEAT,BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_settings_right_is_inc */ + +/** Tree **/ +static const struct button_mapping button_context_tree[] = { + { ACTION_TREE_WPS, BUTTON_OPTION|BUTTON_REL, BUTTON_OPTION }, + { ACTION_TREE_HOTKEY, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME }, + { ACTION_STD_MENU, BUTTON_OPTION|BUTTON_REPEAT, BUTTON_OPTION }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST) +}; /* button_context_tree */ + +/** Yes/No Screen **/ +static const struct button_mapping button_context_yesnoscreen[] = { + { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE }, + + LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD) +}; /* button_context_settings_yesnoscreen */ + +/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */ +const struct button_mapping* get_context_mapping(int context) +{ + switch (context) + { + case CONTEXT_LIST: + return button_context_list; + case CONTEXT_STD: + return button_context_standard; + case CONTEXT_BOOKMARKSCREEN: + return button_context_bmark; + case CONTEXT_KEYBOARD: + return button_context_keyboard; + case CONTEXT_PITCHSCREEN: + return button_context_pitchscreen; + case CONTEXT_QUICKSCREEN: + return button_context_quickscreen; + case CONTEXT_SETTINGS: + return button_context_settings; + case CONTEXT_SETTINGS_TIME: + case CONTEXT_SETTINGS_COLOURCHOOSER: + case CONTEXT_SETTINGS_EQ: + case CONTEXT_SETTINGS_RECTRIGGER: + return button_context_settings_vol_is_inc; + case CONTEXT_TREE: + case CONTEXT_MAINMENU: + return button_context_tree; + case CONTEXT_WPS: + return button_context_wps; + case CONTEXT_YESNOSCREEN: + return button_context_yesnoscreen; + } + return button_context_standard; +} diff --git a/apps/plugins/battery_bench.c b/apps/plugins/battery_bench.c index 21b2ce4963..f24ad579e8 100644 --- a/apps/plugins/battery_bench.c +++ b/apps/plugins/battery_bench.c @@ -298,6 +298,18 @@ #define BATTERY_ON_TXT "PLAY - start" #define BATTERY_OFF_TXT "POWER" +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define BATTERY_ON BUTTON_PLAY +#define BATTERY_OFF BUTTON_POWER +#define BATTERY_ON_TXT "Play - start" +#define BATTERY_OFF_TXT "POWER" + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define BATTERY_ON BUTTON_PLAY +#define BATTERY_OFF BUTTON_POWER +#define BATTERY_ON_TXT "Play - start" +#define BATTERY_OFF_TXT "POWER" + #else #error No keymap defined! #endif diff --git a/apps/plugins/blackjack.c b/apps/plugins/blackjack.c index 52881f0af2..4511d3fad5 100644 --- a/apps/plugins/blackjack.c +++ b/apps/plugins/blackjack.c @@ -589,6 +589,38 @@ enum { #define BJACK_RIGHT BUTTON_NEXT #define BJACK_LEFT BUTTON_PREV +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define BJACK_SELECT_NAME "PLAY" +#define BJACK_STAY_NAME "NEXT" +#define BJACK_QUIT_NAME "POWER" +#define BJACK_DOUBLE_NAME "PREV" +#define BJACK_SELECT BUTTON_PLAY +#define BJACK_QUIT BUTTON_POWER +#define BJACK_MAX BUTTON_VOL_UP +#define BJACK_MIN BUTTON_VOL_DOWN +#define BJACK_STAY BUTTON_NEXT +#define BJACK_DOUBLEDOWN BUTTON_PREV +#define BJACK_UP BUTTON_HOME +#define BJACK_DOWN BUTTON_OPTION +#define BJACK_RIGHT BUTTON_NEXT +#define BJACK_LEFT BUTTON_PREV + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define BJACK_SELECT_NAME "PLAY" +#define BJACK_STAY_NAME "NEXT" +#define BJACK_QUIT_NAME "POWER" +#define BJACK_DOUBLE_NAME "PREV" +#define BJACK_SELECT BUTTON_PLAY +#define BJACK_QUIT BUTTON_POWER +#define BJACK_MAX BUTTON_VOL_UP +#define BJACK_MIN BUTTON_VOL_DOWN +#define BJACK_STAY BUTTON_NEXT +#define BJACK_DOUBLEDOWN BUTTON_PREV +#define BJACK_UP BUTTON_HOME +#define BJACK_DOWN BUTTON_OPTION +#define BJACK_RIGHT BUTTON_NEXT +#define BJACK_LEFT BUTTON_PREV + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define BJACK_SELECT_NAME "PLAY" #define BJACK_STAY_NAME "NEXT" diff --git a/apps/plugins/brickmania.c b/apps/plugins/brickmania.c index f7c9f9adf2..c5d74bcf37 100644 --- a/apps/plugins/brickmania.c +++ b/apps/plugins/brickmania.c @@ -342,6 +342,26 @@ CONFIG_KEYPAD == SANSA_CONNECT_PAD #define UP BUTTON_HOME #define DOWN BUTTON_OPTION +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define QUIT BUTTON_POWER +#define LEFT BUTTON_PREV +#define RIGHT BUTTON_NEXT +#define ALTLEFT BUTTON_VOL_DOWN +#define ALTRIGHT BUTTON_VOL_UP +#define SELECT BUTTON_PLAY +#define UP BUTTON_HOME +#define DOWN BUTTON_OPTION + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define QUIT BUTTON_POWER +#define LEFT BUTTON_PREV +#define RIGHT BUTTON_NEXT +#define ALTLEFT BUTTON_VOL_DOWN +#define ALTRIGHT BUTTON_VOL_UP +#define SELECT BUTTON_PLAY +#define UP BUTTON_HOME +#define DOWN BUTTON_OPTION + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define QUIT BUTTON_POWER #define LEFT BUTTON_HOME diff --git a/apps/plugins/calculator.c b/apps/plugins/calculator.c index a4a29ff6ac..be5087967c 100644 --- a/apps/plugins/calculator.c +++ b/apps/plugins/calculator.c @@ -536,6 +536,28 @@ F3: equal to "=" #define CALCULATOR_CALC (BUTTON_PLAY|BUTTON_REPEAT) #define CALCULATOR_CLEAR (BUTTON_POWER|BUTTON_REPEAT) +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define CALCULATOR_LEFT BUTTON_PREV +#define CALCULATOR_RIGHT BUTTON_NEXT +#define CALCULATOR_UP BUTTON_HOME +#define CALCULATOR_DOWN BUTTON_OPTION +#define CALCULATOR_QUIT BUTTON_POWER +#define CALCULATOR_INPUT_CALC_PRE (BUTTON_OPTION|BUTTON_REPEAT) +#define CALCULATOR_INPUT (BUTTON_PLAY|BUTTON_REL) +#define CALCULATOR_CALC (BUTTON_PLAY|BUTTON_REPEAT) +#define CALCULATOR_CLEAR (BUTTON_POWER|BUTTON_REPEAT) + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define CALCULATOR_LEFT BUTTON_PREV +#define CALCULATOR_RIGHT BUTTON_NEXT +#define CALCULATOR_UP BUTTON_HOME +#define CALCULATOR_DOWN BUTTON_OPTION +#define CALCULATOR_QUIT BUTTON_POWER +#define CALCULATOR_INPUT_CALC_PRE (BUTTON_OPTION|BUTTON_REPEAT) +#define CALCULATOR_INPUT (BUTTON_PLAY|BUTTON_REL) +#define CALCULATOR_CALC (BUTTON_PLAY|BUTTON_REPEAT) +#define CALCULATOR_CLEAR (BUTTON_POWER|BUTTON_REPEAT) + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define CALCULATOR_LEFT BUTTON_HOME #define CALCULATOR_RIGHT BUTTON_VOL_DOWN diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c index 56f9bde193..af550685cc 100644 --- a/apps/plugins/calendar.c +++ b/apps/plugins/calendar.c @@ -423,6 +423,26 @@ #define CALENDAR_NEXT_MONTH BUTTON_VOL_UP #define CALENDAR_PREV_MONTH BUTTON_VOL_DOWN +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define CALENDAR_QUIT BUTTON_POWER +#define CALENDAR_SELECT BUTTON_PLAY +#define CALENDAR_NEXT_WEEK BUTTON_OPTION +#define CALENDAR_PREV_WEEK BUTTON_HOME +#define CALENDAR_NEXT_DAY BUTTON_NEXT +#define CALENDAR_PREV_DAY BUTTON_PREV +#define CALENDAR_NEXT_MONTH BUTTON_VOL_UP +#define CALENDAR_PREV_MONTH BUTTON_VOL_DOWN + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define CALENDAR_QUIT BUTTON_POWER +#define CALENDAR_SELECT BUTTON_PLAY +#define CALENDAR_NEXT_WEEK BUTTON_OPTION +#define CALENDAR_PREV_WEEK BUTTON_HOME +#define CALENDAR_NEXT_DAY BUTTON_NEXT +#define CALENDAR_PREV_DAY BUTTON_PREV +#define CALENDAR_NEXT_MONTH BUTTON_VOL_UP +#define CALENDAR_PREV_MONTH BUTTON_VOL_DOWN + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define CALENDAR_QUIT BUTTON_POWER #define CALENDAR_SELECT BUTTON_PLAY diff --git a/apps/plugins/chessbox/chessbox_pgn.h b/apps/plugins/chessbox/chessbox_pgn.h index 3c4d5357a5..9d37953c6f 100644 --- a/apps/plugins/chessbox/chessbox_pgn.h +++ b/apps/plugins/chessbox/chessbox_pgn.h @@ -572,6 +572,34 @@ #define CB_SCROLL_LEFT (BUTTON_PREV|BUTTON_REPEAT) #define CB_SCROLL_RIGHT (BUTTON_NEXT|BUTTON_REPEAT) +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define CB_SELECT BUTTON_PLAY +#define CB_UP BUTTON_HOME +#define CB_DOWN BUTTON_OPTION +#define CB_LEFT BUTTON_PREV +#define CB_RIGHT BUTTON_NEXT +#define CB_PLAY BUTTON_VOL_UP +#define CB_LEVEL BUTTON_VOL_DOWN +#define CB_MENU BUTTON_POWER +#define CB_SCROLL_UP (BUTTON_HOME|BUTTON_REPEAT) +#define CB_SCROLL_DOWN (BUTTON_OPTION|BUTTON_REPEAT) +#define CB_SCROLL_LEFT (BUTTON_PREV|BUTTON_REPEAT) +#define CB_SCROLL_RIGHT (BUTTON_NEXT|BUTTON_REPEAT) + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define CB_SELECT BUTTON_PLAY +#define CB_UP BUTTON_HOME +#define CB_DOWN BUTTON_OPTION +#define CB_LEFT BUTTON_PREV +#define CB_RIGHT BUTTON_NEXT +#define CB_PLAY BUTTON_VOL_UP +#define CB_LEVEL BUTTON_VOL_DOWN +#define CB_MENU BUTTON_POWER +#define CB_SCROLL_UP (BUTTON_HOME|BUTTON_REPEAT) +#define CB_SCROLL_DOWN (BUTTON_OPTION|BUTTON_REPEAT) +#define CB_SCROLL_LEFT (BUTTON_PREV|BUTTON_REPEAT) +#define CB_SCROLL_RIGHT (BUTTON_NEXT|BUTTON_REPEAT) + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define CB_SELECT BUTTON_PLAY #define CB_UP BUTTON_PREV diff --git a/apps/plugins/chessclock.c b/apps/plugins/chessclock.c index 6b07e1bab5..d93777860b 100644 --- a/apps/plugins/chessclock.c +++ b/apps/plugins/chessclock.c @@ -422,6 +422,26 @@ #define CHC_SETTINGS_OK BUTTON_PLAY #define CHC_SETTINGS_CANCEL BUTTON_POWER +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define CHC_QUIT BUTTON_POWER +#define CHC_STARTSTOP BUTTON_PLAY +#define CHC_RESET BUTTON_OPTION +#define CHC_MENU BUTTON_HOME +#define CHC_SETTINGS_INC BUTTON_NEXT +#define CHC_SETTINGS_DEC BUTTON_PREV +#define CHC_SETTINGS_OK BUTTON_PLAY +#define CHC_SETTINGS_CANCEL BUTTON_POWER + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define CHC_QUIT BUTTON_POWER +#define CHC_STARTSTOP BUTTON_PLAY +#define CHC_RESET BUTTON_OPTION +#define CHC_MENU BUTTON_HOME +#define CHC_SETTINGS_INC BUTTON_NEXT +#define CHC_SETTINGS_DEC BUTTON_PREV +#define CHC_SETTINGS_OK BUTTON_PLAY +#define CHC_SETTINGS_CANCEL BUTTON_POWER + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define CHC_QUIT BUTTON_POWER #define CHC_STARTSTOP BUTTON_PLAY diff --git a/apps/plugins/chip8.c b/apps/plugins/chip8.c index 58d80a2ccf..7c2be3f7e7 100644 --- a/apps/plugins/chip8.c +++ b/apps/plugins/chip8.c @@ -1291,6 +1291,22 @@ CONFIG_KEYPAD == MROBE500_PAD #define CHIP8_KEY6 BUTTON_NEXT #define CHIP8_KEY8 BUTTON_OPTION +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define CHIP8_OFF BUTTON_POWER +#define CHIP8_KEY2 BUTTON_HOME +#define CHIP8_KEY4 BUTTON_PREV +#define CHIP8_KEY5 BUTTON_PLAY +#define CHIP8_KEY6 BUTTON_NEXT +#define CHIP8_KEY8 BUTTON_OPTION + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define CHIP8_OFF BUTTON_POWER +#define CHIP8_KEY2 BUTTON_HOME +#define CHIP8_KEY4 BUTTON_PREV +#define CHIP8_KEY5 BUTTON_PLAY +#define CHIP8_KEY6 BUTTON_NEXT +#define CHIP8_KEY8 BUTTON_OPTION + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define CHIP8_OFF BUTTON_POWER #define CHIP8_KEY2 BUTTON_NEXT diff --git a/apps/plugins/chopper.c b/apps/plugins/chopper.c index 249cfe9715..71e24deb8f 100644 --- a/apps/plugins/chopper.c +++ b/apps/plugins/chopper.c @@ -214,6 +214,16 @@ CONFIG_KEYPAD == MROBE500_PAD #define ACTION BUTTON_PLAY #define ACTIONTEXT "PLAY" +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define QUIT BUTTON_POWER +#define ACTION BUTTON_PLAY +#define ACTIONTEXT "PLAY" + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define QUIT BUTTON_POWER +#define ACTION BUTTON_PLAY +#define ACTIONTEXT "PLAY" + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define QUIT BUTTON_POWER #define ACTION BUTTON_PLAY diff --git a/apps/plugins/clix.c b/apps/plugins/clix.c index c6364b14b4..e80fdeab8b 100644 --- a/apps/plugins/clix.c +++ b/apps/plugins/clix.c @@ -284,6 +284,22 @@ #define CLIX_BUTTON_RIGHT BUTTON_NEXT #define CLIX_BUTTON_CLICK BUTTON_PLAY +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define CLIX_BUTTON_QUIT BUTTON_POWER +#define CLIX_BUTTON_UP BUTTON_HOME +#define CLIX_BUTTON_DOWN BUTTON_OPTION +#define CLIX_BUTTON_LEFT BUTTON_PREV +#define CLIX_BUTTON_RIGHT BUTTON_NEXT +#define CLIX_BUTTON_CLICK BUTTON_PLAY + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define CLIX_BUTTON_QUIT BUTTON_POWER +#define CLIX_BUTTON_UP BUTTON_HOME +#define CLIX_BUTTON_DOWN BUTTON_OPTION +#define CLIX_BUTTON_LEFT BUTTON_PREV +#define CLIX_BUTTON_RIGHT BUTTON_NEXT +#define CLIX_BUTTON_CLICK BUTTON_PLAY + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define CLIX_BUTTON_QUIT BUTTON_POWER #define CLIX_BUTTON_UP BUTTON_PREV diff --git a/apps/plugins/cube.c b/apps/plugins/cube.c index cad57f9ed6..78fd333773 100644 --- a/apps/plugins/cube.c +++ b/apps/plugins/cube.c @@ -423,6 +423,26 @@ #define CUBE_PAUSE BUTTON_HOME #define CUBE_HIGHSPEED BUTTON_PLAY +#elif (CONFIG_KEYPAD == XDUOO_X3II_PAD) +#define CUBE_QUIT BUTTON_POWER +#define CUBE_NEXT BUTTON_NEXT +#define CUBE_PREV BUTTON_PREV +#define CUBE_INC BUTTON_VOL_UP +#define CUBE_DEC BUTTON_VOL_DOWN +#define CUBE_MODE BUTTON_OPTION +#define CUBE_PAUSE BUTTON_HOME +#define CUBE_HIGHSPEED BUTTON_PLAY + +#elif (CONFIG_KEYPAD == XDUOO_X20_PAD) +#define CUBE_QUIT BUTTON_POWER +#define CUBE_NEXT BUTTON_NEXT +#define CUBE_PREV BUTTON_PREV +#define CUBE_INC BUTTON_VOL_UP +#define CUBE_DEC BUTTON_VOL_DOWN +#define CUBE_MODE BUTTON_OPTION +#define CUBE_PAUSE BUTTON_HOME +#define CUBE_HIGHSPEED BUTTON_PLAY + #elif (CONFIG_KEYPAD == IHIFI_770_PAD) #define CUBE_QUIT BUTTON_POWER #define CUBE_NEXT BUTTON_NEXT diff --git a/apps/plugins/doom/i_video.c b/apps/plugins/doom/i_video.c index 41194670bf..9f367d7d76 100644 --- a/apps/plugins/doom/i_video.c +++ b/apps/plugins/doom/i_video.c @@ -566,6 +566,28 @@ void I_ShutdownGraphics(void) #define DOOMBUTTON_ENTER BUTTON_PLAY #define DOOMBUTTON_WEAPON BUTTON_VOL_UP +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define DOOMBUTTON_UP BUTTON_HOME +#define DOOMBUTTON_DOWN BUTTON_OPTION +#define DOOMBUTTON_LEFT BUTTON_PREV +#define DOOMBUTTON_RIGHT BUTTON_NEXT +#define DOOMBUTTON_SHOOT BUTTON_PLAY +#define DOOMBUTTON_OPEN (BUTTON_HOME | BUTTON_POWER) +#define DOOMBUTTON_ESC BUTTON_POWER +#define DOOMBUTTON_ENTER BUTTON_PLAY +#define DOOMBUTTON_WEAPON BUTTON_VOL_UP + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define DOOMBUTTON_UP BUTTON_HOME +#define DOOMBUTTON_DOWN BUTTON_OPTION +#define DOOMBUTTON_LEFT BUTTON_PREV +#define DOOMBUTTON_RIGHT BUTTON_NEXT +#define DOOMBUTTON_SHOOT BUTTON_PLAY +#define DOOMBUTTON_OPEN (BUTTON_HOME | BUTTON_POWER) +#define DOOMBUTTON_ESC BUTTON_POWER +#define DOOMBUTTON_ENTER BUTTON_PLAY +#define DOOMBUTTON_WEAPON BUTTON_VOL_UP + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define DOOMBUTTON_UP BUTTON_PREV #define DOOMBUTTON_DOWN BUTTON_NEXT diff --git a/apps/plugins/fft/fft.c b/apps/plugins/fft/fft.c index d56e37f9e2..0f4e33759d 100644 --- a/apps/plugins/fft/fft.c +++ b/apps/plugins/fft/fft.c @@ -343,6 +343,24 @@ GREY_INFO_STRUCT # define FFT_AMP_SCALE BUTTON_PLAY # define FFT_QUIT BUTTON_POWER +#elif (CONFIG_KEYPAD == XDUOO_X3II_PAD) +# define FFT_PREV_GRAPH BUTTON_PREV +# define FFT_NEXT_GRAPH BUTTON_NEXT +# define FFT_ORIENTATION BUTTON_HOME +# define FFT_FREQ_SCALE BUTTON_OPTION +# define FFT_WINDOW (BUTTON_HOME|BUTTON_POWER) +# define FFT_AMP_SCALE BUTTON_PLAY +# define FFT_QUIT BUTTON_POWER + +#elif (CONFIG_KEYPAD == XDUOO_X20_PAD) +# define FFT_PREV_GRAPH BUTTON_PREV +# define FFT_NEXT_GRAPH BUTTON_NEXT +# define FFT_ORIENTATION BUTTON_HOME +# define FFT_FREQ_SCALE BUTTON_OPTION +# define FFT_WINDOW (BUTTON_HOME|BUTTON_POWER) +# define FFT_AMP_SCALE BUTTON_PLAY +# define FFT_QUIT BUTTON_POWER + #elif (CONFIG_KEYPAD == IHIFI_770_PAD) # define FFT_PREV_GRAPH BUTTON_PREV # define FFT_NEXT_GRAPH BUTTON_NEXT diff --git a/apps/plugins/flipit.c b/apps/plugins/flipit.c index c108939a95..7d1257ef94 100644 --- a/apps/plugins/flipit.c +++ b/apps/plugins/flipit.c @@ -494,6 +494,30 @@ #define FLIPIT_STEP_BY_STEP (BUTTON_HOME | BUTTON_PLAY) #define FLIPIT_TOGGLE BUTTON_PLAY +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD + +#define FLIPIT_LEFT BUTTON_PREV +#define FLIPIT_RIGHT BUTTON_NEXT +#define FLIPIT_UP BUTTON_HOME +#define FLIPIT_DOWN BUTTON_OPTION +#define FLIPIT_QUIT BUTTON_POWER +#define FLIPIT_SHUFFLE (BUTTON_HOME | BUTTON_PREV) +#define FLIPIT_SOLVE (BUTTON_HOME | BUTTON_NEXT) +#define FLIPIT_STEP_BY_STEP (BUTTON_HOME | BUTTON_PLAY) +#define FLIPIT_TOGGLE BUTTON_PLAY + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD + +#define FLIPIT_LEFT BUTTON_PREV +#define FLIPIT_RIGHT BUTTON_NEXT +#define FLIPIT_UP BUTTON_HOME +#define FLIPIT_DOWN BUTTON_OPTION +#define FLIPIT_QUIT BUTTON_POWER +#define FLIPIT_SHUFFLE (BUTTON_HOME | BUTTON_PREV) +#define FLIPIT_SOLVE (BUTTON_HOME | BUTTON_NEXT) +#define FLIPIT_STEP_BY_STEP (BUTTON_HOME | BUTTON_PLAY) +#define FLIPIT_TOGGLE BUTTON_PLAY + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define FLIPIT_LEFT BUTTON_HOME diff --git a/apps/plugins/fractals/fractal.h b/apps/plugins/fractals/fractal.h index 5a56a39b13..679782d37a 100644 --- a/apps/plugins/fractals/fractal.h +++ b/apps/plugins/fractals/fractal.h @@ -496,6 +496,30 @@ #define FRACTAL_PRECISION_DEC (BUTTON_PLAY | BUTTON_PREV) #define FRACTAL_RESET (BUTTON_HOME | BUTTON_POWER) +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define FRACTAL_QUIT BUTTON_POWER +#define FRACTAL_UP BUTTON_HOME +#define FRACTAL_DOWN BUTTON_OPTION +#define FRACTAL_LEFT BUTTON_PREV +#define FRACTAL_RIGHT BUTTON_NEXT +#define FRACTAL_ZOOM_IN BUTTON_VOL_UP +#define FRACTAL_ZOOM_OUT BUTTON_VOL_DOWN +#define FRACTAL_PRECISION_INC (BUTTON_PLAY | BUTTON_NEXT) +#define FRACTAL_PRECISION_DEC (BUTTON_PLAY | BUTTON_PREV) +#define FRACTAL_RESET (BUTTON_HOME | BUTTON_POWER) + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define FRACTAL_QUIT BUTTON_POWER +#define FRACTAL_UP BUTTON_HOME +#define FRACTAL_DOWN BUTTON_OPTION +#define FRACTAL_LEFT BUTTON_PREV +#define FRACTAL_RIGHT BUTTON_NEXT +#define FRACTAL_ZOOM_IN BUTTON_VOL_UP +#define FRACTAL_ZOOM_OUT BUTTON_VOL_DOWN +#define FRACTAL_PRECISION_INC (BUTTON_PLAY | BUTTON_NEXT) +#define FRACTAL_PRECISION_DEC (BUTTON_PLAY | BUTTON_PREV) +#define FRACTAL_RESET (BUTTON_HOME | BUTTON_POWER) + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define FRACTAL_QUIT BUTTON_POWER #define FRACTAL_UP BUTTON_PREV diff --git a/apps/plugins/goban/goban.h b/apps/plugins/goban/goban.h index 9f03937078..e04b4c2447 100644 --- a/apps/plugins/goban/goban.h +++ b/apps/plugins/goban/goban.h @@ -464,6 +464,30 @@ #define GBN_BUTTON_CONTEXT BUTTON_PLAY | BUTTON_REPEAT #define GBN_BUTTON_NEXT_VAR BUTTON_HOME | BUTTON_POWER +#elif (CONFIG_KEYPAD == XDUOO_X3II_PAD) +#define GBN_BUTTON_UP BUTTON_HOME +#define GBN_BUTTON_DOWN BUTTON_OPTION +#define GBN_BUTTON_LEFT BUTTON_PREV +#define GBN_BUTTON_RIGHT BUTTON_NEXT +#define GBN_BUTTON_RETREAT BUTTON_VOL_DOWN +#define GBN_BUTTON_ADVANCE BUTTON_VOL_UP +#define GBN_BUTTON_MENU BUTTON_POWER +#define GBN_BUTTON_PLAY BUTTON_PLAY | BUTTON_REL +#define GBN_BUTTON_CONTEXT BUTTON_PLAY | BUTTON_REPEAT +#define GBN_BUTTON_NEXT_VAR BUTTON_HOME | BUTTON_POWER + +#elif (CONFIG_KEYPAD == XDUOO_X20_PAD) +#define GBN_BUTTON_UP BUTTON_HOME +#define GBN_BUTTON_DOWN BUTTON_OPTION +#define GBN_BUTTON_LEFT BUTTON_PREV +#define GBN_BUTTON_RIGHT BUTTON_NEXT +#define GBN_BUTTON_RETREAT BUTTON_VOL_DOWN +#define GBN_BUTTON_ADVANCE BUTTON_VOL_UP +#define GBN_BUTTON_MENU BUTTON_POWER +#define GBN_BUTTON_PLAY BUTTON_PLAY | BUTTON_REL +#define GBN_BUTTON_CONTEXT BUTTON_PLAY | BUTTON_REPEAT +#define GBN_BUTTON_NEXT_VAR BUTTON_HOME | BUTTON_POWER + #elif (CONFIG_KEYPAD == IHIFI_770_PAD) #define GBN_BUTTON_UP BUTTON_PREV diff --git a/apps/plugins/imageviewer/imageviewer_button.h b/apps/plugins/imageviewer/imageviewer_button.h index 5ffef12a62..e37febc76a 100644 --- a/apps/plugins/imageviewer/imageviewer_button.h +++ b/apps/plugins/imageviewer/imageviewer_button.h @@ -510,6 +510,36 @@ #define IMGVIEW_MENU BUTTON_POWER #define IMGVIEW_SLIDE_SHOW (BUTTON_HOME|BUTTON_POWER) +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define IMGVIEW_ZOOM_PRE BUTTON_PLAY +#define IMGVIEW_ZOOM_IN (BUTTON_PLAY | BUTTON_REL) +#define IMGVIEW_ZOOM_OUT (BUTTON_PLAY | BUTTON_REPEAT) +#define IMGVIEW_UP BUTTON_HOME +#define IMGVIEW_DOWN BUTTON_OPTION +#define IMGVIEW_LEFT BUTTON_PREV +#define IMGVIEW_RIGHT BUTTON_NEXT +#define IMGVIEW_NEXT BUTTON_VOL_UP +#define IMGVIEW_NEXT_REPEAT (BUTTON_VOL_UP|BUTTON_REPEAT) +#define IMGVIEW_PREVIOUS BUTTON_VOL_DOWN +#define IMGVIEW_PREVIOUS_REPEAT (BUTTON_VOL_DOWN|BUTTON_REPEAT) +#define IMGVIEW_MENU BUTTON_POWER +#define IMGVIEW_SLIDE_SHOW (BUTTON_HOME|BUTTON_POWER) + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define IMGVIEW_ZOOM_PRE BUTTON_PLAY +#define IMGVIEW_ZOOM_IN (BUTTON_PLAY | BUTTON_REL) +#define IMGVIEW_ZOOM_OUT (BUTTON_PLAY | BUTTON_REPEAT) +#define IMGVIEW_UP BUTTON_HOME +#define IMGVIEW_DOWN BUTTON_OPTION +#define IMGVIEW_LEFT BUTTON_PREV +#define IMGVIEW_RIGHT BUTTON_NEXT +#define IMGVIEW_NEXT BUTTON_VOL_UP +#define IMGVIEW_NEXT_REPEAT (BUTTON_VOL_UP|BUTTON_REPEAT) +#define IMGVIEW_PREVIOUS BUTTON_VOL_DOWN +#define IMGVIEW_PREVIOUS_REPEAT (BUTTON_VOL_DOWN|BUTTON_REPEAT) +#define IMGVIEW_MENU BUTTON_POWER +#define IMGVIEW_SLIDE_SHOW (BUTTON_HOME|BUTTON_POWER) + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define IMGVIEW_ZOOM_PRE BUTTON_PLAY #define IMGVIEW_ZOOM_IN (BUTTON_PLAY | BUTTON_REL) diff --git a/apps/plugins/invadrox.c b/apps/plugins/invadrox.c index d3feb236cc..8cf4d67f3e 100644 --- a/apps/plugins/invadrox.c +++ b/apps/plugins/invadrox.c @@ -272,6 +272,20 @@ CONFIG_KEYPAD == MROBE500_PAD #define QUIT BUTTON_POWER #define FIRE BUTTON_MENU +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD + +#define QUIT BUTTON_POWER +#define LEFT BUTTON_HOME +#define RIGHT BUTTON_VOL_DOWN +#define FIRE BUTTON_VOL_UP + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD + +#define QUIT BUTTON_POWER +#define LEFT BUTTON_HOME +#define RIGHT BUTTON_VOL_DOWN +#define FIRE BUTTON_VOL_UP + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define QUIT BUTTON_POWER diff --git a/apps/plugins/jewels.c b/apps/plugins/jewels.c index bc0bc73183..38121a480c 100644 --- a/apps/plugins/jewels.c +++ b/apps/plugins/jewels.c @@ -387,6 +387,26 @@ CONFIG_KEYPAD == MROBE500_PAD #define HK_SELECT "PLAY" #define HK_CANCEL "POWER" +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define JEWELS_UP BUTTON_HOME +#define JEWELS_DOWN BUTTON_OPTION +#define JEWELS_LEFT BUTTON_PREV +#define JEWELS_RIGHT BUTTON_NEXT +#define JEWELS_SELECT BUTTON_PLAY +#define JEWELS_CANCEL BUTTON_POWER +#define HK_SELECT "PLAY" +#define HK_CANCEL "POWER" + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define JEWELS_UP BUTTON_HOME +#define JEWELS_DOWN BUTTON_OPTION +#define JEWELS_LEFT BUTTON_PREV +#define JEWELS_RIGHT BUTTON_NEXT +#define JEWELS_SELECT BUTTON_PLAY +#define JEWELS_CANCEL BUTTON_POWER +#define HK_SELECT "PLAY" +#define HK_CANCEL "POWER" + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define JEWELS_UP BUTTON_PREV #define JEWELS_DOWN BUTTON_NEXT diff --git a/apps/plugins/lib/keymaps.h b/apps/plugins/lib/keymaps.h index e240a0989e..e3de03f222 100644 --- a/apps/plugins/lib/keymaps.h +++ b/apps/plugins/lib/keymaps.h @@ -223,6 +223,22 @@ #define BTN_FIRE BUTTON_PLAY #define BTN_PAUSE BUTTON_POWER +#elif (CONFIG_KEYPAD == XDUOO_X3II_PAD) +#define BTN_UP BUTTON_VOL_UP +#define BTN_DOWN BUTTON_VOL_DOWN +#define BTN_LEFT BUTTON_PREV +#define BTN_RIGHT BUTTON_NEXT +#define BTN_FIRE BUTTON_PLAY +#define BTN_PAUSE BUTTON_POWER + +#elif (CONFIG_KEYPAD == XDUOO_X20_PAD) +#define BTN_UP BUTTON_VOL_UP +#define BTN_DOWN BUTTON_VOL_DOWN +#define BTN_LEFT BUTTON_PREV +#define BTN_RIGHT BUTTON_NEXT +#define BTN_FIRE BUTTON_PLAY +#define BTN_PAUSE BUTTON_POWER + #elif (CONFIG_KEYPAD == IHIFI_770_PAD) #define BTN_UP BUTTON_PREV #define BTN_DOWN BUTTON_NEXT diff --git a/apps/plugins/lib/pluginlib_actions.c b/apps/plugins/lib/pluginlib_actions.c index 97b5a1e1bf..0834e020f4 100644 --- a/apps/plugins/lib/pluginlib_actions.c +++ b/apps/plugins/lib/pluginlib_actions.c @@ -237,6 +237,24 @@ const struct button_mapping pla_main_ctx[] = { PLA_DOWN_REPEAT, BUTTON_OPTION|BUTTON_REPEAT, BUTTON_NONE }, { PLA_LEFT_REPEAT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, { PLA_RIGHT_REPEAT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, +#elif (CONFIG_KEYPAD == XDUOO_X3II_PAD) + { PLA_UP, BUTTON_HOME, BUTTON_NONE }, + { PLA_DOWN, BUTTON_OPTION, BUTTON_NONE }, + { PLA_LEFT, BUTTON_PREV, BUTTON_NONE }, + { PLA_RIGHT, BUTTON_NEXT, BUTTON_NONE }, + { PLA_UP_REPEAT, BUTTON_HOME|BUTTON_REPEAT, BUTTON_NONE }, + { PLA_DOWN_REPEAT, BUTTON_OPTION|BUTTON_REPEAT, BUTTON_NONE }, + { PLA_LEFT_REPEAT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, + { PLA_RIGHT_REPEAT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, +#elif (CONFIG_KEYPAD == XDUOO_X20_PAD) + { PLA_UP, BUTTON_HOME, BUTTON_NONE }, + { PLA_DOWN, BUTTON_OPTION, BUTTON_NONE }, + { PLA_LEFT, BUTTON_PREV, BUTTON_NONE }, + { PLA_RIGHT, BUTTON_NEXT, BUTTON_NONE }, + { PLA_UP_REPEAT, BUTTON_HOME|BUTTON_REPEAT, BUTTON_NONE }, + { PLA_DOWN_REPEAT, BUTTON_OPTION|BUTTON_REPEAT, BUTTON_NONE }, + { PLA_LEFT_REPEAT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE }, + { PLA_RIGHT_REPEAT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE }, #elif (CONFIG_KEYPAD == IHIFI_770_PAD) { PLA_UP, BUTTON_PREV, BUTTON_NONE }, { PLA_DOWN, BUTTON_NEXT, BUTTON_NONE }, @@ -480,6 +498,18 @@ const struct button_mapping pla_main_ctx[] = {PLA_SELECT, BUTTON_PLAY, BUTTON_NONE}, {PLA_SELECT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY}, {PLA_SELECT_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE}, +#elif (CONFIG_KEYPAD == XDUOO_X3II_PAD) + {PLA_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_POWER}, + {PLA_EXIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE}, + {PLA_SELECT, BUTTON_PLAY, BUTTON_NONE}, + {PLA_SELECT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY}, + {PLA_SELECT_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE}, +#elif (CONFIG_KEYPAD == XDUOO_X20_PAD) + {PLA_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_POWER}, + {PLA_EXIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE}, + {PLA_SELECT, BUTTON_PLAY, BUTTON_NONE}, + {PLA_SELECT_REL, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY}, + {PLA_SELECT_REPEAT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE}, #elif (CONFIG_KEYPAD == IHIFI_770_PAD) {PLA_CANCEL, BUTTON_POWER|BUTTON_REL, BUTTON_POWER}, {PLA_EXIT, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE}, diff --git a/apps/plugins/midi/midiplay.c b/apps/plugins/midi/midiplay.c index 8e867e5173..e6e2b4bf51 100644 --- a/apps/plugins/midi/midiplay.c +++ b/apps/plugins/midi/midiplay.c @@ -301,6 +301,22 @@ #define MIDI_VOL_DOWN BUTTON_VOL_DOWN #define MIDI_PLAYPAUSE BUTTON_PLAY +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define MIDI_QUIT BUTTON_POWER +#define MIDI_FFWD BUTTON_NEXT +#define MIDI_REWIND BUTTON_PREV +#define MIDI_VOL_UP BUTTON_VOL_UP +#define MIDI_VOL_DOWN BUTTON_VOL_DOWN +#define MIDI_PLAYPAUSE BUTTON_PLAY + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define MIDI_QUIT BUTTON_POWER +#define MIDI_FFWD BUTTON_NEXT +#define MIDI_REWIND BUTTON_PREV +#define MIDI_VOL_UP BUTTON_VOL_UP +#define MIDI_VOL_DOWN BUTTON_VOL_DOWN +#define MIDI_PLAYPAUSE BUTTON_PLAY + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define MIDI_QUIT BUTTON_POWER #define MIDI_FFWD BUTTON_VOL_DOWN diff --git a/apps/plugins/minesweeper.c b/apps/plugins/minesweeper.c index 956ba128d5..917f90dcd0 100644 --- a/apps/plugins/minesweeper.c +++ b/apps/plugins/minesweeper.c @@ -417,6 +417,32 @@ CONFIG_KEYPAD == MROBE500_PAD # define MINESWP_DISCOVER2 BUTTON_VOL_UP # define MINESWP_INFO (BUTTON_PLAY | BUTTON_OPTION) +#elif (CONFIG_KEYPAD == XDUOO_X3II_PAD) +# define MINESWP_LEFT BUTTON_PREV +# define MINESWP_RIGHT BUTTON_NEXT +# define MINESWP_UP BUTTON_HOME +# define MINESWP_DOWN BUTTON_OPTION +# define MINESWP_QUIT BUTTON_POWER +# define MINESWP_TOGGLE_PRE BUTTON_PLAY +# define MINESWP_TOGGLE (BUTTON_PLAY | BUTTON_REL) +# define MINESWP_TOGGLE2 BUTTON_VOL_DOWN +# define MINESWP_DISCOVER (BUTTON_PLAY | BUTTON_REPEAT) +# define MINESWP_DISCOVER2 BUTTON_VOL_UP +# define MINESWP_INFO (BUTTON_PLAY | BUTTON_OPTION) + +#elif (CONFIG_KEYPAD == XDUOO_X20_PAD) +# define MINESWP_LEFT BUTTON_PREV +# define MINESWP_RIGHT BUTTON_NEXT +# define MINESWP_UP BUTTON_HOME +# define MINESWP_DOWN BUTTON_OPTION +# define MINESWP_QUIT BUTTON_POWER +# define MINESWP_TOGGLE_PRE BUTTON_PLAY +# define MINESWP_TOGGLE (BUTTON_PLAY | BUTTON_REL) +# define MINESWP_TOGGLE2 BUTTON_VOL_DOWN +# define MINESWP_DISCOVER (BUTTON_PLAY | BUTTON_REPEAT) +# define MINESWP_DISCOVER2 BUTTON_VOL_UP +# define MINESWP_INFO (BUTTON_PLAY | BUTTON_OPTION) + #elif (CONFIG_KEYPAD == IHIFI_770_PAD) # define MINESWP_LEFT BUTTON_HOME # define MINESWP_RIGHT BUTTON_VOL_DOWN diff --git a/apps/plugins/mp3_encoder.c b/apps/plugins/mp3_encoder.c index d147120cd4..3b912ba606 100644 --- a/apps/plugins/mp3_encoder.c +++ b/apps/plugins/mp3_encoder.c @@ -2562,6 +2562,19 @@ CONFIG_KEYPAD == MROBE500_PAD #define MP3ENC_DONE BUTTON_POWER #define MP3ENC_SELECT BUTTON_PLAY +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define MP3ENC_PREV BUTTON_HOME +#define MP3ENC_NEXT BUTTON_OPTION +#define MP3ENC_DONE BUTTON_POWER +#define MP3ENC_SELECT BUTTON_PLAY + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define MP3ENC_PREV BUTTON_HOME +#define MP3ENC_NEXT BUTTON_OPTION +#define MP3ENC_DONE BUTTON_POWER +#define MP3ENC_SELECT BUTTON_PLAY + + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define MP3ENC_PREV BUTTON_PREV #define MP3ENC_NEXT BUTTON_NEXT diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c index 8427db12b4..d5d7c7c019 100644 --- a/apps/plugins/mpegplayer/mpeg_settings.c +++ b/apps/plugins/mpegplayer/mpeg_settings.c @@ -316,6 +316,26 @@ struct mpeg_settings settings; #define MPEG_START_TIME_RIGHT2 BUTTON_VOL_DOWN #define MPEG_START_TIME_EXIT BUTTON_POWER +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define MPEG_START_TIME_SELECT BUTTON_PLAY +#define MPEG_START_TIME_LEFT BUTTON_PREV +#define MPEG_START_TIME_RIGHT BUTTON_NEXT +#define MPEG_START_TIME_UP BUTTON_HOME +#define MPEG_START_TIME_DOWN BUTTON_OPTION +#define MPEG_START_TIME_LEFT2 BUTTON_VOL_UP +#define MPEG_START_TIME_RIGHT2 BUTTON_VOL_DOWN +#define MPEG_START_TIME_EXIT BUTTON_POWER + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define MPEG_START_TIME_SELECT BUTTON_PLAY +#define MPEG_START_TIME_LEFT BUTTON_PREV +#define MPEG_START_TIME_RIGHT BUTTON_NEXT +#define MPEG_START_TIME_UP BUTTON_HOME +#define MPEG_START_TIME_DOWN BUTTON_OPTION +#define MPEG_START_TIME_LEFT2 BUTTON_VOL_UP +#define MPEG_START_TIME_RIGHT2 BUTTON_VOL_DOWN +#define MPEG_START_TIME_EXIT BUTTON_POWER + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define MPEG_START_TIME_SELECT BUTTON_PLAY #define MPEG_START_TIME_LEFT BUTTON_HOME diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index 39ea484ff2..eed1fab6d7 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c @@ -450,6 +450,24 @@ CONFIG_KEYPAD == SANSA_M200_PAD #define MPEG_RW BUTTON_PREV #define MPEG_FF BUTTON_NEXT +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define MPEG_MENU BUTTON_PLAY +#define MPEG_STOP BUTTON_POWER +#define MPEG_PAUSE BUTTON_HOME +#define MPEG_VOLDOWN BUTTON_VOL_DOWN +#define MPEG_VOLUP BUTTON_VOL_UP +#define MPEG_RW BUTTON_PREV +#define MPEG_FF BUTTON_NEXT + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define MPEG_MENU BUTTON_PLAY +#define MPEG_STOP BUTTON_POWER +#define MPEG_PAUSE BUTTON_HOME +#define MPEG_VOLDOWN BUTTON_VOL_DOWN +#define MPEG_VOLUP BUTTON_VOL_UP +#define MPEG_RW BUTTON_PREV +#define MPEG_FF BUTTON_NEXT + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define MPEG_MENU BUTTON_PLAY #define MPEG_STOP BUTTON_POWER diff --git a/apps/plugins/oscilloscope.c b/apps/plugins/oscilloscope.c index f4711d4e0e..6702add139 100644 --- a/apps/plugins/oscilloscope.c +++ b/apps/plugins/oscilloscope.c @@ -518,6 +518,35 @@ #define OSCILLOSCOPE_VOL_DOWN BUTTON_VOL_DOWN #define NEED_LASTBUTTON +#elif (CONFIG_KEYPAD == XDUOO_X3II_PAD) +#define OSCILLOSCOPE_QUIT BUTTON_POWER +#define OSCILLOSCOPE_DRAWMODE_PRE BUTTON_PLAY +#define OSCILLOSCOPE_DRAWMODE (BUTTON_PLAY | BUTTON_REL) +#define OSCILLOSCOPE_ORIENTATION_PRE BUTTON_PLAY +#define OSCILLOSCOPE_ORIENTATION (BUTTON_PLAY | BUTTON_REPEAT) +#define OSCILLOSCOPE_ADVMODE BUTTON_HOME +#define OSCILLOSCOPE_PAUSE BUTTON_OPTION +#define OSCILLOSCOPE_SPEED_UP BUTTON_NEXT +#define OSCILLOSCOPE_SPEED_DOWN BUTTON_PREV +#define OSCILLOSCOPE_VOL_UP BUTTON_VOL_UP +#define OSCILLOSCOPE_VOL_DOWN BUTTON_VOL_DOWN +#define NEED_LASTBUTTON + +#elif (CONFIG_KEYPAD == XDUOO_X20_PAD) +#define OSCILLOSCOPE_QUIT BUTTON_POWER +#define OSCILLOSCOPE_DRAWMODE_PRE BUTTON_PLAY +#define OSCILLOSCOPE_DRAWMODE (BUTTON_PLAY | BUTTON_REL) +#define OSCILLOSCOPE_ORIENTATION_PRE BUTTON_PLAY +#define OSCILLOSCOPE_ORIENTATION (BUTTON_PLAY | BUTTON_REPEAT) +#define OSCILLOSCOPE_ADVMODE BUTTON_HOME +#define OSCILLOSCOPE_PAUSE BUTTON_OPTION +#define OSCILLOSCOPE_SPEED_UP BUTTON_NEXT +#define OSCILLOSCOPE_SPEED_DOWN BUTTON_PREV +#define OSCILLOSCOPE_VOL_UP BUTTON_VOL_UP +#define OSCILLOSCOPE_VOL_DOWN BUTTON_VOL_DOWN +#define NEED_LASTBUTTON + + #elif (CONFIG_KEYPAD == IHIFI_770_PAD) #define OSCILLOSCOPE_QUIT BUTTON_POWER #define OSCILLOSCOPE_DRAWMODE_PRE BUTTON_PLAY diff --git a/apps/plugins/pacbox/pacbox.h b/apps/plugins/pacbox/pacbox.h index 0e3de62dfa..78a171467a 100644 --- a/apps/plugins/pacbox/pacbox.h +++ b/apps/plugins/pacbox/pacbox.h @@ -364,6 +364,25 @@ #define PACMAN_1UP BUTTON_VOLUP #define PACMAN_COIN BUTTON_VOLDOWN +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define PACMAN_UP BUTTON_PREV +#define PACMAN_DOWN BUTTON_NEXT +#define PACMAN_LEFT BUTTON_HOME +#define PACMAN_RIGHT BUTTON_VOL_DOWN +#define PACMAN_MENU BUTTON_POWER +#define PACMAN_1UP BUTTON_VOL_UP +#define PACMAN_COIN BUTTON_PLAY + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define PACMAN_UP BUTTON_PREV +#define PACMAN_DOWN BUTTON_NEXT +#define PACMAN_LEFT BUTTON_HOME +#define PACMAN_RIGHT BUTTON_VOL_DOWN +#define PACMAN_MENU BUTTON_POWER +#define PACMAN_1UP BUTTON_VOL_UP +#define PACMAN_COIN BUTTON_PLAY + + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define PACMAN_UP BUTTON_PREV #define PACMAN_DOWN BUTTON_NEXT diff --git a/apps/plugins/pegbox.c b/apps/plugins/pegbox.c index cc2e8e3f23..b638f2feeb 100644 --- a/apps/plugins/pegbox.c +++ b/apps/plugins/pegbox.c @@ -660,6 +660,40 @@ CONFIG_KEYPAD == MROBE500_PAD #define LVL_UP_TEXT "VOL+" #define LVL_DOWN_TEXT "VOL-" +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define PEGBOX_SELECT BUTTON_PLAY +#define PEGBOX_QUIT BUTTON_POWER +#define PEGBOX_RESTART (BUTTON_POWER | BUTTON_HOME) +#define PEGBOX_LVL_UP BUTTON_VOL_UP +#define PEGBOX_LVL_DOWN BUTTON_VOL_DOWN +#define PEGBOX_UP BUTTON_HOME +#define PEGBOX_DOWN BUTTON_OPTION +#define PEGBOX_RIGHT BUTTON_NEXT +#define PEGBOX_LEFT BUTTON_PREV + +#define SELECT_TEXT "PLAY" +#define QUIT_TEXT "POWER" +#define RESTART_TEXT "HOME" +#define LVL_UP_TEXT "VOL+" +#define LVL_DOWN_TEXT "VOL-" + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define PEGBOX_SELECT BUTTON_PLAY +#define PEGBOX_QUIT BUTTON_POWER +#define PEGBOX_RESTART (BUTTON_POWER | BUTTON_HOME) +#define PEGBOX_LVL_UP BUTTON_VOL_UP +#define PEGBOX_LVL_DOWN BUTTON_VOL_DOWN +#define PEGBOX_UP BUTTON_HOME +#define PEGBOX_DOWN BUTTON_OPTION +#define PEGBOX_RIGHT BUTTON_NEXT +#define PEGBOX_LEFT BUTTON_PREV + +#define SELECT_TEXT "PLAY" +#define QUIT_TEXT "POWER" +#define RESTART_TEXT "HOME" +#define LVL_UP_TEXT "VOL+" +#define LVL_DOWN_TEXT "VOL-" + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define PEGBOX_SELECT BUTTON_PLAY #define PEGBOX_QUIT BUTTON_POWER diff --git a/apps/plugins/pong.c b/apps/plugins/pong.c index cb3006d7c4..3656a35fd2 100644 --- a/apps/plugins/pong.c +++ b/apps/plugins/pong.c @@ -317,6 +317,22 @@ CONFIG_KEYPAD == MROBE500_PAD #define PONG_RIGHT_UP BUTTON_HOME #define PONG_RIGHT_DOWN BUTTON_NEXT +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define PONG_QUIT BUTTON_POWER +#define PONG_PAUSE BUTTON_PLAY +#define PONG_LEFT_UP BUTTON_PREV +#define PONG_LEFT_DOWN BUTTON_OPTION +#define PONG_RIGHT_UP BUTTON_HOME +#define PONG_RIGHT_DOWN BUTTON_NEXT + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define PONG_QUIT BUTTON_POWER +#define PONG_PAUSE BUTTON_PLAY +#define PONG_LEFT_UP BUTTON_PREV +#define PONG_LEFT_DOWN BUTTON_OPTION +#define PONG_RIGHT_UP BUTTON_HOME +#define PONG_RIGHT_DOWN BUTTON_NEXT + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define PONG_QUIT BUTTON_POWER #define PONG_PAUSE BUTTON_PREV diff --git a/apps/plugins/reversi/reversi-gui.h b/apps/plugins/reversi/reversi-gui.h index cba34d2814..4ec6bcb67b 100644 --- a/apps/plugins/reversi/reversi-gui.h +++ b/apps/plugins/reversi/reversi-gui.h @@ -339,6 +339,28 @@ #define REVERSI_BUTTON_MENU BUTTON_PLAY #define REVERSI_BUTTON_MENU_LONGPRESS +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define REVERSI_BUTTON_QUIT BUTTON_POWER +#define REVERSI_BUTTON_UP BUTTON_HOME +#define REVERSI_BUTTON_DOWN BUTTON_OPTION +#define REVERSI_BUTTON_LEFT BUTTON_PREV +#define REVERSI_BUTTON_RIGHT BUTTON_NEXT +#define REVERSI_BUTTON_MAKE_MOVE BUTTON_PLAY +#define REVERSI_BUTTON_MAKE_MOVE_SHORTPRESS +#define REVERSI_BUTTON_MENU BUTTON_PLAY +#define REVERSI_BUTTON_MENU_LONGPRESS + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define REVERSI_BUTTON_QUIT BUTTON_POWER +#define REVERSI_BUTTON_UP BUTTON_HOME +#define REVERSI_BUTTON_DOWN BUTTON_OPTION +#define REVERSI_BUTTON_LEFT BUTTON_PREV +#define REVERSI_BUTTON_RIGHT BUTTON_NEXT +#define REVERSI_BUTTON_MAKE_MOVE BUTTON_PLAY +#define REVERSI_BUTTON_MAKE_MOVE_SHORTPRESS +#define REVERSI_BUTTON_MENU BUTTON_PLAY +#define REVERSI_BUTTON_MENU_LONGPRESS + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define REVERSI_BUTTON_QUIT BUTTON_POWER #define REVERSI_BUTTON_UP BUTTON_PREV diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c index 13eb593775..e2fedab200 100644 --- a/apps/plugins/rockblox.c +++ b/apps/plugins/rockblox.c @@ -492,6 +492,30 @@ #define ROCKBLOX_DROP (BUTTON_PLAY|BUTTON_REL) #define ROCKBLOX_RESTART (BUTTON_PLAY|BUTTON_REPEAT) +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD + +#define ROCKBLOX_OFF BUTTON_POWER +#define ROCKBLOX_ROTATE_CCW BUTTON_HOME +#define ROCKBLOX_ROTATE_CCW2 BUTTON_VOL_DOWN +#define ROCKBLOX_ROTATE_CW BUTTON_VOL_UP +#define ROCKBLOX_DOWN BUTTON_OPTION +#define ROCKBLOX_LEFT BUTTON_PREV +#define ROCKBLOX_RIGHT BUTTON_NEXT +#define ROCKBLOX_DROP (BUTTON_PLAY|BUTTON_REL) +#define ROCKBLOX_RESTART (BUTTON_PLAY|BUTTON_REPEAT) + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD + +#define ROCKBLOX_OFF BUTTON_POWER +#define ROCKBLOX_ROTATE_CCW BUTTON_HOME +#define ROCKBLOX_ROTATE_CCW2 BUTTON_VOL_DOWN +#define ROCKBLOX_ROTATE_CW BUTTON_VOL_UP +#define ROCKBLOX_DOWN BUTTON_OPTION +#define ROCKBLOX_LEFT BUTTON_PREV +#define ROCKBLOX_RIGHT BUTTON_NEXT +#define ROCKBLOX_DROP (BUTTON_PLAY|BUTTON_REL) +#define ROCKBLOX_RESTART (BUTTON_PLAY|BUTTON_REPEAT) + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define ROCKBLOX_OFF BUTTON_POWER diff --git a/apps/plugins/rockboy/rockboy.c b/apps/plugins/rockboy/rockboy.c index 8886793ab7..f188dc1e24 100644 --- a/apps/plugins/rockboy/rockboy.c +++ b/apps/plugins/rockboy/rockboy.c @@ -433,6 +433,26 @@ static void setoptions (void) options.SELECT = BUTTON_VOL_UP; options.MENU = BUTTON_POWER; +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD + options.UP = BUTTON_PREV; + options.DOWN = BUTTON_NEXT; + + options.A = BUTTON_HOME; + options.B = BUTTON_OPTION; + options.START = BUTTON_VOL_DOWN; + options.SELECT = BUTTON_VOL_UP; + options.MENU = BUTTON_POWER; + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD + options.UP = BUTTON_PREV; + options.DOWN = BUTTON_NEXT; + + options.A = BUTTON_HOME; + options.B = BUTTON_OPTION; + options.START = BUTTON_VOL_DOWN; + options.SELECT = BUTTON_VOL_UP; + options.MENU = BUTTON_POWER; + #elif CONFIG_KEYPAD == IHIFI_770_PAD options.UP = BUTTON_PREV; options.DOWN = BUTTON_NEXT; diff --git a/apps/plugins/sliding_puzzle.c b/apps/plugins/sliding_puzzle.c index 0ea36c84b8..9b863906ce 100644 --- a/apps/plugins/sliding_puzzle.c +++ b/apps/plugins/sliding_puzzle.c @@ -340,6 +340,25 @@ CONFIG_KEYPAD == MROBE500_PAD #define PUZZLE_SHUFFLE (BUTTON_HOME | BUTTON_POWER) #define PUZZLE_PICTURE BUTTON_PLAY +#elif (CONFIG_KEYPAD == XDUOO_X3II_PAD) +#define PUZZLE_QUIT BUTTON_POWER +#define PUZZLE_LEFT BUTTON_PREV +#define PUZZLE_RIGHT BUTTON_NEXT +#define PUZZLE_UP BUTTON_HOME +#define PUZZLE_DOWN BUTTON_OPTION +#define PUZZLE_SHUFFLE (BUTTON_HOME | BUTTON_POWER) +#define PUZZLE_PICTURE BUTTON_PLAY + +#elif (CONFIG_KEYPAD == XDUOO_X20_PAD) +#define PUZZLE_QUIT BUTTON_POWER +#define PUZZLE_LEFT BUTTON_PREV +#define PUZZLE_RIGHT BUTTON_NEXT +#define PUZZLE_UP BUTTON_HOME +#define PUZZLE_DOWN BUTTON_OPTION +#define PUZZLE_SHUFFLE (BUTTON_HOME | BUTTON_POWER) +#define PUZZLE_PICTURE BUTTON_PLAY + + #elif (CONFIG_KEYPAD == IHIFI_770_PAD) #define PUZZLE_QUIT BUTTON_POWER #define PUZZLE_LEFT BUTTON_HOME diff --git a/apps/plugins/snake.c b/apps/plugins/snake.c index 2518316bdd..ae1e4350ad 100644 --- a/apps/plugins/snake.c +++ b/apps/plugins/snake.c @@ -297,6 +297,22 @@ dir is the current direction of the snake - 0=up, 1=right, 2=down, 3=left; #define SNAKE_DOWN BUTTON_OPTION #define SNAKE_PLAYPAUSE BUTTON_PLAY +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define SNAKE_QUIT BUTTON_POWER +#define SNAKE_LEFT BUTTON_PREV +#define SNAKE_RIGHT BUTTON_NEXT +#define SNAKE_UP BUTTON_HOME +#define SNAKE_DOWN BUTTON_OPTION +#define SNAKE_PLAYPAUSE BUTTON_PLAY + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define SNAKE_QUIT BUTTON_POWER +#define SNAKE_LEFT BUTTON_PREV +#define SNAKE_RIGHT BUTTON_NEXT +#define SNAKE_UP BUTTON_HOME +#define SNAKE_DOWN BUTTON_OPTION +#define SNAKE_PLAYPAUSE BUTTON_PLAY + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define SNAKE_QUIT BUTTON_POWER #define SNAKE_LEFT BUTTON_HOME diff --git a/apps/plugins/snake2.c b/apps/plugins/snake2.c index 9ea79504e4..a9f0942806 100644 --- a/apps/plugins/snake2.c +++ b/apps/plugins/snake2.c @@ -428,6 +428,24 @@ CONFIG_KEYPAD == MROBE500_PAD #define SNAKE2_PLAYPAUSE BUTTON_PLAY #define SNAKE2_PLAYPAUSE_TEXT "PLAY" +#elif (CONFIG_KEYPAD == XDUOO_X3II_PAD) +#define SNAKE2_LEFT BUTTON_PREV +#define SNAKE2_RIGHT BUTTON_NEXT +#define SNAKE2_UP BUTTON_HOME +#define SNAKE2_DOWN BUTTON_OPTION +#define SNAKE2_QUIT BUTTON_POWER +#define SNAKE2_PLAYPAUSE BUTTON_PLAY +#define SNAKE2_PLAYPAUSE_TEXT "PLAY" + +#elif (CONFIG_KEYPAD == XDUOO_X20_PAD) +#define SNAKE2_LEFT BUTTON_PREV +#define SNAKE2_RIGHT BUTTON_NEXT +#define SNAKE2_UP BUTTON_HOME +#define SNAKE2_DOWN BUTTON_OPTION +#define SNAKE2_QUIT BUTTON_POWER +#define SNAKE2_PLAYPAUSE BUTTON_PLAY +#define SNAKE2_PLAYPAUSE_TEXT "PLAY" + #elif (CONFIG_KEYPAD == IHIFI_770_PAD) #define SNAKE2_LEFT BUTTON_HOME #define SNAKE2_RIGHT BUTTON_VOL_DOWN diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c index 17971ec4db..450c881d1e 100644 --- a/apps/plugins/sokoban.c +++ b/apps/plugins/sokoban.c @@ -667,6 +667,38 @@ #define BUTTON_SAVE BUTTON_PLAY #define BUTTON_SAVE_NAME "PLAY" +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define SOKOBAN_LEFT BUTTON_PREV +#define SOKOBAN_RIGHT BUTTON_NEXT +#define SOKOBAN_UP BUTTON_HOME +#define SOKOBAN_DOWN BUTTON_OPTION +#define SOKOBAN_MENU BUTTON_POWER +#define SOKOBAN_UNDO_PRE BUTTON_PLAY +#define SOKOBAN_UNDO (BUTTON_PLAY | BUTTON_REL) +#define SOKOBAN_REDO (BUTTON_POWER | BUTTON_PLAY) +#define SOKOBAN_LEVEL_DOWN BUTTON_VOL_DOWN +#define SOKOBAN_LEVEL_REPEAT (BUTTON_PLAY | BUTTON_NEXT) +#define SOKOBAN_LEVEL_UP BUTTON_VOL_UP +#define SOKOBAN_PAUSE BUTTON_PLAY +#define BUTTON_SAVE BUTTON_PLAY +#define BUTTON_SAVE_NAME "PLAY" + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define SOKOBAN_LEFT BUTTON_PREV +#define SOKOBAN_RIGHT BUTTON_NEXT +#define SOKOBAN_UP BUTTON_HOME +#define SOKOBAN_DOWN BUTTON_OPTION +#define SOKOBAN_MENU BUTTON_POWER +#define SOKOBAN_UNDO_PRE BUTTON_PLAY +#define SOKOBAN_UNDO (BUTTON_PLAY | BUTTON_REL) +#define SOKOBAN_REDO (BUTTON_POWER | BUTTON_PLAY) +#define SOKOBAN_LEVEL_DOWN BUTTON_VOL_DOWN +#define SOKOBAN_LEVEL_REPEAT (BUTTON_PLAY | BUTTON_NEXT) +#define SOKOBAN_LEVEL_UP BUTTON_VOL_UP +#define SOKOBAN_PAUSE BUTTON_PLAY +#define BUTTON_SAVE BUTTON_PLAY +#define BUTTON_SAVE_NAME "PLAY" + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define SOKOBAN_LEFT BUTTON_HOME #define SOKOBAN_RIGHT BUTTON_VOL_DOWN diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c index 1ee79bb86a..dd4c8d3447 100644 --- a/apps/plugins/solitaire.c +++ b/apps/plugins/solitaire.c @@ -706,6 +706,44 @@ CONFIG_KEYPAD == MROBE500_PAD # define HK_CUR2STACK "DBL PLAY" # define HK_REM2STACK "NEXT" +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +# define SOL_QUIT BUTTON_POWER +# define SOL_UP BUTTON_HOME +# define SOL_DOWN BUTTON_OPTION +# define SOL_LEFT BUTTON_PREV +# define SOL_RIGHT BUTTON_NEXT +# define SOL_MOVE_PRE BUTTON_PLAY +# define SOL_MOVE (BUTTON_PLAY | BUTTON_REL) +# define SOL_DRAW (BUTTON_POWER | BUTTON_REPEAT) +# define SOL_REM2CUR BUTTON_VOL_DOWN +# define SOL_CUR2STACK_PRE BUTTON_PLAY +# define SOL_CUR2STACK (BUTTON_PLAY | BUTTON_REPEAT) +# define SOL_REM2STACK BUTTON_VOL_UP +# define HK_MOVE "PLAY" +# define HK_DRAW "DBL HOME" +# define HK_REM2CUR "PREV" +# define HK_CUR2STACK "DBL PLAY" +# define HK_REM2STACK "NEXT" + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +# define SOL_QUIT BUTTON_POWER +# define SOL_UP BUTTON_HOME +# define SOL_DOWN BUTTON_OPTION +# define SOL_LEFT BUTTON_PREV +# define SOL_RIGHT BUTTON_NEXT +# define SOL_MOVE_PRE BUTTON_PLAY +# define SOL_MOVE (BUTTON_PLAY | BUTTON_REL) +# define SOL_DRAW (BUTTON_POWER | BUTTON_REPEAT) +# define SOL_REM2CUR BUTTON_VOL_DOWN +# define SOL_CUR2STACK_PRE BUTTON_PLAY +# define SOL_CUR2STACK (BUTTON_PLAY | BUTTON_REPEAT) +# define SOL_REM2STACK BUTTON_VOL_UP +# define HK_MOVE "PLAY" +# define HK_DRAW "DBL HOME" +# define HK_REM2CUR "PREV" +# define HK_CUR2STACK "DBL PLAY" +# define HK_REM2STACK "NEXT" + #elif CONFIG_KEYPAD == IHIFI_770_PAD # define SOL_QUIT BUTTON_POWER # define SOL_UP BUTTON_PREV diff --git a/apps/plugins/spacerocks.c b/apps/plugins/spacerocks.c index 15d4039b4d..98c6d1a032 100644 --- a/apps/plugins/spacerocks.c +++ b/apps/plugins/spacerocks.c @@ -363,6 +363,24 @@ #define AST_RIGHT BUTTON_NEXT #define AST_FIRE BUTTON_PLAY +#elif (CONFIG_KEYPAD == XDUOO_X3II_PAD) +#define AST_PAUSE BUTTON_VOL_UP +#define AST_QUIT BUTTON_POWER +#define AST_THRUST BUTTON_HOME +#define AST_HYPERSPACE BUTTON_OPTION +#define AST_LEFT BUTTON_PREV +#define AST_RIGHT BUTTON_NEXT +#define AST_FIRE BUTTON_PLAY + +#elif (CONFIG_KEYPAD == XDUOO_X20_PAD) +#define AST_PAUSE BUTTON_VOL_UP +#define AST_QUIT BUTTON_POWER +#define AST_THRUST BUTTON_HOME +#define AST_HYPERSPACE BUTTON_OPTION +#define AST_LEFT BUTTON_PREV +#define AST_RIGHT BUTTON_NEXT +#define AST_FIRE BUTTON_PLAY + #elif (CONFIG_KEYPAD == IHIFI_770_PAD) #define AST_PAUSE BUTTON_PLAY #define AST_QUIT BUTTON_POWER diff --git a/apps/plugins/star.c b/apps/plugins/star.c index fdf67bec4c..43036e2808 100644 --- a/apps/plugins/star.c +++ b/apps/plugins/star.c @@ -639,6 +639,38 @@ #define STAR_LEVEL_DOWN_NAME "PLAY + PREV" #define STAR_LEVEL_REPEAT_NAME "PLAY + OPTION" +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define STAR_QUIT BUTTON_POWER +#define STAR_LEFT BUTTON_PREV +#define STAR_RIGHT BUTTON_NEXT +#define STAR_UP BUTTON_HOME +#define STAR_DOWN BUTTON_OPTION +#define STAR_TOGGLE_CONTROL BUTTON_PLAY +#define STAR_LEVEL_UP (BUTTON_PLAY | BUTTON_NEXT) +#define STAR_LEVEL_DOWN (BUTTON_PLAY | BUTTON_PREV) +#define STAR_LEVEL_REPEAT (BUTTON_PLAY | BUTTON_OPTION) +#define STAR_TOGGLE_CONTROL_NAME "PLAY" +#define STAR_QUIT_NAME "POWER" +#define STAR_LEVEL_UP_NAME "PLAY + NEXT" +#define STAR_LEVEL_DOWN_NAME "PLAY + PREV" +#define STAR_LEVEL_REPEAT_NAME "PLAY + OPTION" + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define STAR_QUIT BUTTON_POWER +#define STAR_LEFT BUTTON_PREV +#define STAR_RIGHT BUTTON_NEXT +#define STAR_UP BUTTON_HOME +#define STAR_DOWN BUTTON_OPTION +#define STAR_TOGGLE_CONTROL BUTTON_PLAY +#define STAR_LEVEL_UP (BUTTON_PLAY | BUTTON_NEXT) +#define STAR_LEVEL_DOWN (BUTTON_PLAY | BUTTON_PREV) +#define STAR_LEVEL_REPEAT (BUTTON_PLAY | BUTTON_OPTION) +#define STAR_TOGGLE_CONTROL_NAME "PLAY" +#define STAR_QUIT_NAME "POWER" +#define STAR_LEVEL_UP_NAME "PLAY + NEXT" +#define STAR_LEVEL_DOWN_NAME "PLAY + PREV" +#define STAR_LEVEL_REPEAT_NAME "PLAY + OPTION" + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define STAR_QUIT BUTTON_POWER #define STAR_LEFT BUTTON_HOME diff --git a/apps/plugins/stopwatch.c b/apps/plugins/stopwatch.c index 5e83859d89..a806e4e830 100644 --- a/apps/plugins/stopwatch.c +++ b/apps/plugins/stopwatch.c @@ -321,6 +321,22 @@ #define STOPWATCH_SCROLL_UP BUTTON_HOME #define STOPWATCH_SCROLL_DOWN BUTTON_OPTION +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define STOPWATCH_QUIT BUTTON_POWER +#define STOPWATCH_START_STOP BUTTON_NEXT +#define STOPWATCH_RESET_TIMER BUTTON_PREV +#define STOPWATCH_LAP_TIMER BUTTON_PLAY +#define STOPWATCH_SCROLL_UP BUTTON_HOME +#define STOPWATCH_SCROLL_DOWN BUTTON_OPTION + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define STOPWATCH_QUIT BUTTON_POWER +#define STOPWATCH_START_STOP BUTTON_NEXT +#define STOPWATCH_RESET_TIMER BUTTON_PREV +#define STOPWATCH_LAP_TIMER BUTTON_PLAY +#define STOPWATCH_SCROLL_UP BUTTON_HOME +#define STOPWATCH_SCROLL_DOWN BUTTON_OPTION + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define STOPWATCH_QUIT BUTTON_POWER #define STOPWATCH_START_STOP BUTTON_NEXT diff --git a/apps/plugins/sudoku/sudoku.h b/apps/plugins/sudoku/sudoku.h index 62ec80dba8..2bee868de9 100644 --- a/apps/plugins/sudoku/sudoku.h +++ b/apps/plugins/sudoku/sudoku.h @@ -437,6 +437,34 @@ #define SUDOKU_BUTTON_MENU (BUTTON_POWER | BUTTON_REL) #define SUDOKU_BUTTON_POSSIBLE (BUTTON_HOME | BUTTON_POWER) +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define SUDOKU_BUTTON_QUIT_PRE BUTTON_POWER +#define SUDOKU_BUTTON_QUIT (BUTTON_POWER | BUTTON_REPEAT) +#define SUDOKU_BUTTON_UP BUTTON_HOME +#define SUDOKU_BUTTON_DOWN BUTTON_OPTION +#define SUDOKU_BUTTON_LEFT BUTTON_PREV +#define SUDOKU_BUTTON_RIGHT BUTTON_NEXT +#define SUDOKU_BUTTON_TOGGLEBACK BUTTON_VOL_DOWN +#define SUDOKU_BUTTON_TOGGLE BUTTON_VOL_UP +#define SUDOKU_BUTTON_ALTTOGGLE BUTTON_PLAY +#define SUDOKU_BUTTON_MENU_PRE BUTTON_POWER +#define SUDOKU_BUTTON_MENU (BUTTON_POWER | BUTTON_REL) +#define SUDOKU_BUTTON_POSSIBLE (BUTTON_HOME | BUTTON_POWER) + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define SUDOKU_BUTTON_QUIT_PRE BUTTON_POWER +#define SUDOKU_BUTTON_QUIT (BUTTON_POWER | BUTTON_REPEAT) +#define SUDOKU_BUTTON_UP BUTTON_HOME +#define SUDOKU_BUTTON_DOWN BUTTON_OPTION +#define SUDOKU_BUTTON_LEFT BUTTON_PREV +#define SUDOKU_BUTTON_RIGHT BUTTON_NEXT +#define SUDOKU_BUTTON_TOGGLEBACK BUTTON_VOL_DOWN +#define SUDOKU_BUTTON_TOGGLE BUTTON_VOL_UP +#define SUDOKU_BUTTON_ALTTOGGLE BUTTON_PLAY +#define SUDOKU_BUTTON_MENU_PRE BUTTON_POWER +#define SUDOKU_BUTTON_MENU (BUTTON_POWER | BUTTON_REL) +#define SUDOKU_BUTTON_POSSIBLE (BUTTON_HOME | BUTTON_POWER) + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define SUDOKU_BUTTON_QUIT_PRE BUTTON_POWER #define SUDOKU_BUTTON_QUIT (BUTTON_POWER | BUTTON_REPEAT) diff --git a/apps/plugins/text_viewer/tv_button.h b/apps/plugins/text_viewer/tv_button.h index da6453ff8d..6ee8f9bbf1 100644 --- a/apps/plugins/text_viewer/tv_button.h +++ b/apps/plugins/text_viewer/tv_button.h @@ -562,6 +562,30 @@ #define TV_LINE_DOWN BUTTON_OPTION #define TV_BOOKMARK (BUTTON_OPTION | BUTTON_PLAY) +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define TV_QUIT BUTTON_POWER +#define TV_SCROLL_UP BUTTON_VOL_UP +#define TV_SCROLL_DOWN BUTTON_VOL_DOWN +#define TV_SCREEN_LEFT BUTTON_PREV +#define TV_SCREEN_RIGHT BUTTON_NEXT +#define TV_MENU BUTTON_PLAY +#define TV_AUTOSCROLL (BUTTON_POWER | BUTTON_HOME) +#define TV_LINE_UP BUTTON_HOME +#define TV_LINE_DOWN BUTTON_OPTION +#define TV_BOOKMARK (BUTTON_OPTION | BUTTON_PLAY) + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define TV_QUIT BUTTON_POWER +#define TV_SCROLL_UP BUTTON_VOL_UP +#define TV_SCROLL_DOWN BUTTON_VOL_DOWN +#define TV_SCREEN_LEFT BUTTON_PREV +#define TV_SCREEN_RIGHT BUTTON_NEXT +#define TV_MENU BUTTON_PLAY +#define TV_AUTOSCROLL (BUTTON_POWER | BUTTON_HOME) +#define TV_LINE_UP BUTTON_HOME +#define TV_LINE_DOWN BUTTON_OPTION +#define TV_BOOKMARK (BUTTON_OPTION | BUTTON_PLAY) + /* Xuelin 770/770c keys */ #elif CONFIG_KEYPAD == IHIFI_770_PAD #define TV_QUIT BUTTON_POWER diff --git a/apps/plugins/vu_meter.c b/apps/plugins/vu_meter.c index eaa92d4b48..33ad38d72c 100644 --- a/apps/plugins/vu_meter.c +++ b/apps/plugins/vu_meter.c @@ -432,6 +432,28 @@ #define LABEL_MENU "PLAY" #define LABEL_VOLUME "VOL UP/DN" +#elif (CONFIG_KEYPAD == XDUOO_X3II_PAD) +#define VUMETER_QUIT BUTTON_POWER +#define VUMETER_HELP BUTTON_HOME +#define VUMETER_MENU BUTTON_PLAY +#define VUMETER_UP BUTTON_VOL_UP +#define VUMETER_DOWN BUTTON_VOL_DOWN +#define LABEL_HELP "HOME" +#define LABEL_QUIT "POWER" +#define LABEL_MENU "PLAY" +#define LABEL_VOLUME "VOL UP/DN" + +#elif (CONFIG_KEYPAD == XDUOO_X20_PAD) +#define VUMETER_QUIT BUTTON_POWER +#define VUMETER_HELP BUTTON_HOME +#define VUMETER_MENU BUTTON_PLAY +#define VUMETER_UP BUTTON_VOL_UP +#define VUMETER_DOWN BUTTON_VOL_DOWN +#define LABEL_HELP "HOME" +#define LABEL_QUIT "POWER" +#define LABEL_MENU "PLAY" +#define LABEL_VOLUME "VOL UP/DN" + #elif (CONFIG_KEYPAD == IHIFI_770_PAD) #define VUMETER_QUIT BUTTON_POWER #define VUMETER_HELP BUTTON_HOME diff --git a/apps/plugins/wormlet.c b/apps/plugins/wormlet.c index 9adfc97b81..d342511419 100644 --- a/apps/plugins/wormlet.c +++ b/apps/plugins/wormlet.c @@ -402,6 +402,24 @@ CONFIG_KEYPAD == MROBE500_PAD #define BTN_QUIT BUTTON_POWER #define BTN_STOPRESET (BUTTON_HOME | BUTTON_POWER) +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define BTN_DIR_UP BUTTON_HOME +#define BTN_DIR_DOWN BUTTON_OPTION +#define BTN_DIR_LEFT BUTTON_PREV +#define BTN_DIR_RIGHT BUTTON_NEXT +#define BTN_STARTPAUSE BUTTON_PLAY +#define BTN_QUIT BUTTON_POWER +#define BTN_STOPRESET (BUTTON_HOME | BUTTON_POWER) + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define BTN_DIR_UP BUTTON_HOME +#define BTN_DIR_DOWN BUTTON_OPTION +#define BTN_DIR_LEFT BUTTON_PREV +#define BTN_DIR_RIGHT BUTTON_NEXT +#define BTN_STARTPAUSE BUTTON_PLAY +#define BTN_QUIT BUTTON_POWER +#define BTN_STOPRESET (BUTTON_HOME | BUTTON_POWER) + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define BTN_DIR_UP BUTTON_PREV #define BTN_DIR_DOWN BUTTON_NEXT diff --git a/apps/plugins/xobox.c b/apps/plugins/xobox.c index 8acdf85015..9643641569 100644 --- a/apps/plugins/xobox.c +++ b/apps/plugins/xobox.c @@ -351,6 +351,24 @@ CONFIG_KEYPAD == MROBE500_PAD #define DOWN BUTTON_OPTION #define PAUSE BUTTON_PLAY +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD + +#define QUIT BUTTON_POWER +#define LEFT BUTTON_PREV +#define RIGHT BUTTON_NEXT +#define UP BUTTON_HOME +#define DOWN BUTTON_OPTION +#define PAUSE BUTTON_PLAY + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD + +#define QUIT BUTTON_POWER +#define LEFT BUTTON_PREV +#define RIGHT BUTTON_NEXT +#define UP BUTTON_HOME +#define DOWN BUTTON_OPTION +#define PAUSE BUTTON_PLAY + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define QUIT BUTTON_POWER diff --git a/apps/plugins/zxbox/keymaps.h b/apps/plugins/zxbox/keymaps.h index ce527c561e..53dd9e8d88 100644 --- a/apps/plugins/zxbox/keymaps.h +++ b/apps/plugins/zxbox/keymaps.h @@ -290,6 +290,22 @@ #define ZX_UP BUTTON_HOME #define ZX_DOWN BUTTON_OPTION +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD +#define ZX_SELECT BUTTON_PLAY +#define ZX_MENU BUTTON_POWER +#define ZX_LEFT BUTTON_PREV +#define ZX_RIGHT BUTTON_NEXT +#define ZX_UP BUTTON_HOME +#define ZX_DOWN BUTTON_OPTION + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD +#define ZX_SELECT BUTTON_PLAY +#define ZX_MENU BUTTON_POWER +#define ZX_LEFT BUTTON_PREV +#define ZX_RIGHT BUTTON_NEXT +#define ZX_UP BUTTON_HOME +#define ZX_DOWN BUTTON_OPTION + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define ZX_SELECT BUTTON_PLAY #define ZX_MENU BUTTON_POWER diff --git a/apps/plugins/zxbox/zxbox_keyb.c b/apps/plugins/zxbox/zxbox_keyb.c index b3f1ca70e8..4a26accc8a 100644 --- a/apps/plugins/zxbox/zxbox_keyb.c +++ b/apps/plugins/zxbox/zxbox_keyb.c @@ -287,6 +287,24 @@ #define KBD_UP BUTTON_HOME #define KBD_DOWN BUTTON_OPTION +#elif CONFIG_KEYPAD == XDUOO_X3II_PAD + +#define KBD_SELECT BUTTON_PLAY +#define KBD_ABORT BUTTON_POWER +#define KBD_LEFT BUTTON_PREV +#define KBD_RIGHT BUTTON_NEXT +#define KBD_UP BUTTON_HOME +#define KBD_DOWN BUTTON_OPTION + +#elif CONFIG_KEYPAD == XDUOO_X20_PAD + +#define KBD_SELECT BUTTON_PLAY +#define KBD_ABORT BUTTON_POWER +#define KBD_LEFT BUTTON_PREV +#define KBD_RIGHT BUTTON_NEXT +#define KBD_UP BUTTON_HOME +#define KBD_DOWN BUTTON_OPTION + #elif CONFIG_KEYPAD == IHIFI_770_PAD #define KBD_SELECT BUTTON_PLAY diff --git a/bootloader/SOURCES b/bootloader/SOURCES index ce73724f69..82ddcb80b9 100644 --- a/bootloader/SOURCES +++ b/bootloader/SOURCES @@ -78,6 +78,8 @@ mpio_hd200_hd300.c nwz_linux.c #elif defined(AGPTEK_ROCKER) rocker_linux.c +#elif (defined(XDUOO_X3II) || defined(XDUOO_X20)) +xduoo_linux.c #elif defined(RK27_GENERIC) || defined(HM60X) || defined(HM801) \ || defined(MA9) || defined(MA9C) || defined(MA8) || defined(MA8C) \ || defined(IHIFI760) || defined(IHIFI960) || defined(IHIFI800) \ diff --git a/bootloader/rocker_linux.c b/bootloader/rocker_linux.c index cb0e5b66e5..80b3bfbab5 100644 --- a/bootloader/rocker_linux.c +++ b/bootloader/rocker_linux.c @@ -12,7 +12,7 @@ * * Based on Rockbox iriver bootloader by Linus Nielsen Feltzing * and the ipodlinux bootloader by Daniel Palffy and Bernard Leach - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 @@ -464,7 +464,7 @@ static int open_log(void) return fd; close(fd); /* move file */ - rename("/mnt/sd_0/rockbox.log", "/mnt_sd0/rockbox.log.1"); + rename("/mnt/sd_0/rockbox.log", "/mnt_sd_0/rockbox.log.1"); /* re-open the file, truncate in case the move was unsuccessful */ return open("/mnt/sd_0/rockbox.log", O_RDWR | O_CREAT | O_APPEND | O_TRUNC); } diff --git a/bootloader/xduoo_linux.c b/bootloader/xduoo_linux.c new file mode 100644 index 0000000000..1071c6dc9b --- /dev/null +++ b/bootloader/xduoo_linux.c @@ -0,0 +1,555 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * + * Copyright (C) 2016 by Amaury Pouly + * 2018 by Marcin Bukat + * 2018 by Roman Stolyarov + * + * Based on Rockbox iriver bootloader by Linus Nielsen Feltzing + * and the ipodlinux bootloader by Daniel Palffy and Bernard Leach + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "system.h" +#include "lcd.h" +#include "backlight.h" +#include "button-target.h" +#include "button.h" +#include "../kernel/kernel-internal.h" +#include "core_alloc.h" +#include "filesystem-app.h" +#include "lcd.h" +#include "font.h" +#include "power.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "version.h" + +/* all images must have the following size */ +#define ICON_WIDTH 130 +#define ICON_HEIGHT 130 + +/* images */ +#include "bitmaps/rockboxicon.h" +#include "bitmaps/hibyicon.h" +#include "bitmaps/toolsicon.h" + +/* don't issue an error when parsing the file for dependencies */ +#if defined(BMPWIDTH_rockboxicon) && (BMPWIDTH_rockboxicon != ICON_WIDTH || \ + BMPHEIGHT_rockboxicon != ICON_HEIGHT) +#error rockboxicon has the wrong resolution +#endif +#if defined(BMPWIDTH_hibyicon) && (BMPWIDTH_hibyicon != ICON_WIDTH || \ + BMPHEIGHT_hibyicon != ICON_HEIGHT) +#error hibyicon has the wrong resolution +#endif +#if defined(BMPWIDTH_toolsicon) && (BMPWIDTH_toolsicon != ICON_WIDTH || \ + BMPHEIGHT_toolsicon != ICON_HEIGHT) +#error toolsicon has the wrong resolution +#endif + +#ifndef BUTTON_UP +#define BUTTON_UP BUTTON_PREV +#endif +#ifndef BUTTON_DOWN +#define BUTTON_DOWN BUTTON_NEXT +#endif +#ifndef BUTTON_ENTER +#define BUTTON_ENTER BUTTON_PLAY +#endif + +/* return icon y position (x is always centered) */ +static int get_icon_y(void) +{ + int h; + lcd_getstringsize("X", NULL, &h); + return ((LCD_HEIGHT - ICON_HEIGHT)/2) - h; +} + +/* Important Note: this bootloader is carefully written so that in case of + * error, the OF is run. This seems like the safest option since the OF is + * always there and might do magic things. */ + +enum boot_mode +{ + BOOT_ROCKBOX, + BOOT_TOOLS, + BOOT_OF, + BOOT_COUNT, + BOOT_USB, /* special */ + BOOT_STOP, /* power down/suspend */ +}; + +static void display_text_center(int y, const char *text) +{ + int width; + lcd_getstringsize(text, &width, NULL); + lcd_putsxy(LCD_WIDTH / 2 - width / 2, y, text); +} + +static void display_text_centerf(int y, const char *format, ...) +{ + char buf[1024]; + va_list ap; + va_start(ap, format); + + vsnprintf(buf, sizeof(buf), format, ap); + display_text_center(y, buf); +} + +/* get timeout before taking action if the user doesn't touch the device */ +static int get_inactivity_tmo(void) +{ +#if defined(HAS_BUTTON_HOLD) + if(button_hold()) + return 5 * HZ; /* Inactivity timeout when on hold */ + else +#endif + return 10 * HZ; /* Inactivity timeout when not on hold */ +} + +/* return action on idle timeout */ +static enum boot_mode inactivity_action(enum boot_mode cur_selection) +{ +#if defined(HAS_BUTTON_HOLD) + if(button_hold()) + return BOOT_STOP; /* power down/suspend */ + else +#endif + return cur_selection; /* return last choice */ +} + +/* we store the boot mode in a file in /tmp so we can reload it between 'boots' + * (since the mostly suspends instead of powering down) */ +static enum boot_mode load_boot_mode(enum boot_mode mode) +{ + int fd = open("/data/rb_bl_mode.txt", O_RDONLY); + if(fd >= 0) + { + read(fd, &mode, sizeof(mode)); + close(fd); + } + return mode; +} + +static void save_boot_mode(enum boot_mode mode) +{ + int fd = open("/data/rb_bl_mode.txt", O_RDWR | O_CREAT | O_TRUNC); + if(fd >= 0) + { + write(fd, &mode, sizeof(mode)); + close(fd); + } +} + +static enum boot_mode get_boot_mode(void) +{ + /* load previous mode, or start with rockbox if none */ + enum boot_mode init_mode = load_boot_mode(BOOT_ROCKBOX); + /* wait for user action */ + enum boot_mode mode = init_mode; + int last_activity = current_tick; +#if defined(HAS_BUTTON_HOLD) + bool hold_status = button_hold(); +#endif + while(true) + { + /* on usb detect, return to usb + * FIXME this is a hack, we need proper usb detection */ + if(power_input_status() & POWER_INPUT_USB_CHARGER) + { + /* save last choice */ + save_boot_mode(mode); + return BOOT_USB; + } + /* inactivity detection */ + int timeout = last_activity + get_inactivity_tmo(); + if(TIME_AFTER(current_tick, timeout)) + { + /* save last choice */ + save_boot_mode(mode); + return inactivity_action(mode); + } + /* redraw */ + lcd_clear_display(); + /* display top text */ +#if defined(HAS_BUTTON_HOLD) + if(button_hold()) + { + lcd_set_foreground(LCD_RGBPACK(255, 0, 0)); + display_text_center(0, "ON HOLD!"); + } + else +#endif + { + lcd_set_foreground(LCD_RGBPACK(255, 201, 0)); + display_text_center(0, "SELECT PLAYER"); + } + lcd_set_foreground(LCD_RGBPACK(255, 201, 0)); + /* display icon */ + const struct bitmap *icon = (mode == BOOT_OF) ? &bm_hibyicon : + (mode == BOOT_ROCKBOX) ? &bm_rockboxicon : &bm_toolsicon; + lcd_bmp(icon, (LCD_WIDTH - ICON_WIDTH) / 2, get_icon_y()); + /* display bottom description */ + const char *desc = (mode == BOOT_OF) ? "HIBY PLAYER" : + (mode == BOOT_ROCKBOX) ? "ROCKBOX" : "TOOLS"; + + int desc_height; + lcd_getstringsize(desc, NULL, &desc_height); + display_text_center(LCD_HEIGHT - 3*desc_height, desc); + + /* display arrows */ + int arrow_width, arrow_height; + lcd_getstringsize("<", &arrow_width, &arrow_height); + int arrow_y = get_icon_y() + ICON_HEIGHT / 2 - arrow_height / 2; + lcd_putsxy(arrow_width / 2, arrow_y, "<"); + lcd_putsxy(LCD_WIDTH - 3 * arrow_width / 2, arrow_y, ">"); + + lcd_set_foreground(LCD_RGBPACK(0, 255, 0)); + display_text_centerf(LCD_HEIGHT - arrow_height * 3 / 2, "timeout in %d sec", + (timeout - current_tick + HZ - 1) / HZ); + + lcd_update(); + + /* wait for a key */ + int btn = button_get_w_tmo(HZ / 10); + +#if defined(HAS_BUTTON_HOLD) + /* record action, changing HOLD counts as action */ + if(btn & BUTTON_MAIN || hold_status != button_hold()) + last_activity = current_tick; + + hold_status = button_hold(); +#else + if(btn & BUTTON_MAIN) + last_activity = current_tick; +#endif + /* ignore release, allow repeat */ + if(btn & BUTTON_REL) + continue; + if(btn & BUTTON_REPEAT) + btn &= ~BUTTON_REPEAT; + /* play -> stop loop and return mode */ + if(btn == BUTTON_ENTER) + break; + /* left/right/up/down: change mode */ + if(btn == BUTTON_UP || btn == BUTTON_VOL_UP) + mode = (mode + BOOT_COUNT - 1) % BOOT_COUNT; + if(btn == BUTTON_DOWN || btn == BUTTON_VOL_DOWN) + mode = (mode + 1) % BOOT_COUNT; + } + + /* save mode */ + save_boot_mode(mode); + return mode; +} + +void error_screen(const char *msg) +{ + lcd_clear_display(); + lcd_putsf(0, 0, msg); + lcd_update(); +} + +int choice_screen(const char *title, bool center, int nr_choices, const char *choices[]) +{ + int choice = 0; + int max_len = 0; + int h; + lcd_getstringsize("x", NULL, &h); + for(int i = 0; i < nr_choices; i++) + { + int len = strlen(choices[i]); + if(len > max_len) + max_len = len; + } + char *buf = malloc(max_len + 10); + int top_y = 2 * h; + int nr_lines = (LCD_HEIGHT - top_y) / h; + while(true) + { + /* make sure choice is visible */ + int offset = choice - nr_lines / 2; + if(offset < 0) + offset = 0; + lcd_clear_display(); + /* display top text */ + lcd_set_foreground(LCD_RGBPACK(255, 201, 0)); + display_text_center(0, title); + int line = 0; + for(int i = 0; i < nr_choices && line < nr_lines; i++) + { + if(i < offset) + continue; + if(i == choice) + lcd_set_foreground(LCD_RGBPACK(255, 0, 0)); + else + lcd_set_foreground(LCD_RGBPACK(255, 201, 0)); + sprintf(buf, "%s", choices[i]); + if(center) + display_text_center(top_y + h * line, buf); + else + lcd_putsxy(0, top_y + h * line, buf); + line++; + } + + lcd_update(); + + /* wait for a key */ + int btn = button_get_w_tmo(HZ / 10); + /* ignore release, allow repeat */ + if(btn & BUTTON_REL) + continue; + if(btn & BUTTON_REPEAT) + btn &= ~BUTTON_REPEAT; + /* play -> stop loop and return mode */ + if(btn == BUTTON_ENTER) + { + free(buf); + return btn == BUTTON_ENTER ? choice : -1; + } + /* left/right/up/down: change mode */ + if(btn == BUTTON_UP || btn == BUTTON_VOL_UP) + choice = (choice + nr_choices - 1) % nr_choices; + if(btn == BUTTON_DOWN || btn == BUTTON_VOL_DOWN) + choice = (choice + 1) % nr_choices; + } +} + +void run_file(const char *name) +{ + char *dirname = "/mnt/sd_0/"; + char *buf = malloc(strlen(dirname) + strlen(name) + 1); + sprintf(buf, "%s%s", dirname, name); + + lcd_clear_display(); + lcd_set_foreground(LCD_RGBPACK(255, 201, 0)); + lcd_putsf(0, 0, "Running %s", name); + lcd_update(); + + pid_t pid = fork(); + if(pid == 0) + { + execlp("sh", "sh", buf, NULL); + _exit(42); + } + int status; + waitpid(pid, &status, 0); + if(WIFEXITED(status)) + { + lcd_set_foreground(LCD_RGBPACK(255, 201, 0)); + lcd_putsf(0, 1, "program returned %d", WEXITSTATUS(status)); + } + else + { + lcd_set_foreground(LCD_RGBPACK(255, 0, 0)); + lcd_putsf(0, 1, "an error occured: %x", status); + } + lcd_set_foreground(LCD_RGBPACK(255, 0, 0)); + lcd_putsf(0, 3, "Press any key or wait"); + lcd_update(); + /* wait a small time */ + sleep(HZ); + /* ignore event */ + while(button_get(false) != 0) {} + /* wait for any key or timeout */ + button_get_w_tmo(4 * HZ); +} + +void run_script_menu(void) +{ + const char **entries = NULL; + int nr_entries = 0; + DIR *dir = opendir("/mnt/sd_0"); + struct dirent *ent; + while((ent = readdir(dir))) + { + if(ent->d_type != DT_REG) + continue; + entries = realloc(entries, (nr_entries + 1) * sizeof(const char *)); + entries[nr_entries++] = strdup(ent->d_name); + } + closedir(dir); + int idx = choice_screen("RUN SCRIPT", false, nr_entries, entries); + if(idx >= 0) + run_file(entries[idx]); + for(int i = 0; i < nr_entries; i++) + free((char *)entries[i]); + free(entries); +} + +static void adb(int start) +{ + pid_t pid = fork(); + if(pid == 0) + { + execlp("/etc/init.d/K90adb", "K90adb", start ? "start" : "stop", NULL); + _exit(42); + } + int status; + waitpid(pid, &status, 0); +#if 0 + if(WIFEXITED(status)) + { + lcd_set_foreground(LCD_RGBPACK(255, 201, 0)); + lcd_putsf(0, 1, "program returned %d", WEXITSTATUS(status)); + } + else + { + lcd_set_foreground(LCD_RGBPACK(255, 0, 0)); + lcd_putsf(0, 1, "an error occured: %x", status); + } +#endif +} + +static void tools_screen(void) +{ + const char *choices[] = {"ADB start", "ADB stop", "Run script", "Restart", "Shutdown"}; + int choice = choice_screen("TOOLS MENU", true, 5, choices); + if(choice == 0) + { + /* run service menu */ + printf("Starting ADB service...\n"); + fflush(stdout); + adb(1); + } + else if(choice == 1) + { + printf("Stopping ADB service...\n"); + fflush(stdout); + adb(0); + } + else if(choice == 2) + { + run_script_menu(); + } + else if(choice == 3) + system_reboot(); + else if(choice == 4) + power_off(); +} + +#if 0 +/* open log file */ +static int open_log(void) +{ + /* open regular log file */ + int fd = open("/mnt/sd_0/rockbox.log", O_RDWR | O_CREAT | O_APPEND); + /* get its size */ + struct stat stat; + if(fstat(fd, &stat) != 0) + return fd; /* on error, don't do anything */ + /* if file is too large, rename it and start a new log file */ + if(stat.st_size < 1000000) + return fd; + close(fd); + /* move file */ + rename("/mnt/sd_0/rockbox.log", "/mnt/sd_0/rockbox.log.1"); + /* re-open the file, truncate in case the move was unsuccessful */ + return open("/mnt/sd_0/rockbox.log", O_RDWR | O_CREAT | O_APPEND | O_TRUNC); +} +#endif + +int main(int argc, char **argv) +{ + (void) argc; + (void) argv; +#if 0 + /* redirect stdout and stderr to have error messages logged somewhere on the + * user partition */ + int fd = open_log(); + if(fd >= 0) + { + dup2(fd, fileno(stdout)); + dup2(fd, fileno(stderr)); + close(fd); + } + /* print version */ + printf("Rockbox boot loader\n"); + printf("Version: %s\n", rbversion); + printf("%s\n", MODEL_NAME); +#endif + + system_init(); + core_allocator_init(); + kernel_init(); + paths_init(); + lcd_init(); + font_init(); + button_init(); + backlight_init(); + backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING); + + /* try to load the extra font we install on the device */ + //int font_id = font_load("/usr/rockbox/fonts/20-Terminus-Bold.fnt"); + //if(font_id >= 0) + // lcd_setfont(font_id); + + /* run all tools menu */ + while(true) + { + enum boot_mode mode = get_boot_mode(); + if(mode == BOOT_USB || mode == BOOT_OF) + { +#if 0 + fflush(stdout); + fflush(stderr); + close(fileno(stdout)); + close(fileno(stderr)); +#endif + /* for now the only way we have to trigger USB mode it to run the OF */ + /* boot OF */ + execvp("/usr/bin/hiby_player", argv); + error_screen("Cannot boot OF"); + sleep(5 * HZ); + } + else if(mode == BOOT_TOOLS) + { + tools_screen(); + } + else if(mode == BOOT_ROCKBOX) + { + fflush(stdout); +#if defined(XDUOO_X3II) + system("/bin/cp /mnt/sd_0/.rockbox/rockbox.x3ii /tmp"); + execl("/tmp/rockbox.x3ii", "rockbox.x3ii", NULL); +#elif defined(XDUOO_X20) + system("/bin/cp /mnt/sd_0/.rockbox/rockbox.x20 /tmp"); + execl("/tmp/rockbox.x20", "rockbox.x20", NULL); +#endif + printf("execvp failed: %s\n", strerror(errno)); + /* fallback to OF in case of failure */ + error_screen("Cannot boot Rockbox"); + sleep(5 * HZ); + } + else + { + printf("suspend\n"); +// nwz_power_suspend(); + } + } + /* if we reach this point, everything failed, so return an error so that + * sysmgrd knows something is wrong */ + return 1; +} diff --git a/firmware/SOURCES b/firmware/SOURCES index 89f4f52895..7be6010ab7 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -113,25 +113,37 @@ target/hosted/sonynwz/nvp-nwz.c target/hosted/sonynwz/nwz-db.c #endif -#if defined(AGPTEK_ROCKER) && !defined(SIMULATOR) +#if ((defined(AGPTEK_ROCKER) || defined(XDUOO_X3II) || defined(XDUOO_X20)) && !defined(SIMULATOR)) drivers/lcd-memframe.c -target/hosted/backtrace-glibc.c -target/hosted/kernel-unix.c -target/hosted/filesystem-unix.c -target/hosted/lc-unix.c target/hosted/alsa-controls.c target/hosted/pcm-alsa.c -target/hosted/agptek/sysfs.c -target/hosted/agptek/backlight-agptek.c +target/hosted/backtrace-glibc.c +target/hosted/filesystem-unix.c +target/hosted/kernel-unix.c +target/hosted/lc-unix.c +target/hosted/sysfs.c +target/hosted/backlight-unix.c +target/hosted/system-hosted.c +#endif + +#if defined(AGPTEK_ROCKER) && !defined(SIMULATOR) target/hosted/agptek/button-agptek.c target/hosted/agptek/debug-agptek.c target/hosted/agptek/lcd-agptek.c target/hosted/agptek/power-agptek.c target/hosted/agptek/powermgmt-agptek.c -target/hosted/agptek/system-agptek.c target/hosted/agptek/usb-agptek.c #endif +#if ((defined(XDUOO_X3II)||defined(XDUOO_X20)) && !defined(SIMULATOR)) +target/hosted/xduoo/button-xduoo.c +target/hosted/xduoo/debug-xduoo.c +target/hosted/xduoo/lcd-xduoo.c +target/hosted/xduoo/power-xduoo.c +target/hosted/xduoo/powermgmt-xduoo.c +target/hosted/xduoo/usb-xduoo.c +#endif + #if defined(SAMSUNG_YPR0) && !defined(SIMULATOR) drivers/adc-as3514.c #if (CONFIG_RTC == RTC_AS3514) @@ -502,6 +514,8 @@ target/hosted/alsa-controls.c target/hosted/pcm-alsa.c #elif defined(HAVE_ROCKER_CODEC) && !defined(SIMULATOR) drivers/audio/rocker_codec.c +#elif defined(HAVE_XDUOO_LINUX_CODEC) && !defined(SIMULATOR) +drivers/audio/xduoolinux_codec.c #elif defined(HAVE_SDL_AUDIO) drivers/audio/sdl.c #if CONFIG_CODEC == SWCODEC @@ -584,7 +598,7 @@ target/arm/ipod/powermgmt-ipod-pcf.c target/arm/pp/i2c-pp.c #elif CONFIG_I2C == I2C_PNX0101 target/arm/pnx0101/i2c-pnx0101.c -#elif CONFIG_I2C == I2C_TCC780X || CONFIG_I2C == I2C_TCC77X +#elif CONFIG_I2C == I2C_TCC780X || CONFIG_I2C == I2C_TCC77X target/arm/i2c-telechips.c #elif CONFIG_I2C == I2C_S3C2440 target/arm/s3c2440/i2c-s3c2440.c @@ -837,9 +851,9 @@ drivers/isp1583.c target/arm/rk27xx/usb-drv-rk27xx.c #endif #else /* !defined(HAVE_USBSTACK) */ -#if CONFIG_USBOTG == USBOTG_ISP1362 +#if CONFIG_USBOTG == USBOTG_ISP1362 drivers/isp1362.c -#elif CONFIG_USBOTG == USBOTG_M5636 +#elif CONFIG_USBOTG == USBOTG_M5636 drivers/m5636.c #endif #endif /* !defined(HAVE_USBSTACK) */ @@ -1415,7 +1429,7 @@ target/arm/pnx0101/iriver-ifp7xx/button-ifp7xx.c target/arm/pnx0101/iriver-ifp7xx/lcd-ifp7xx.c target/arm/pnx0101/iriver-ifp7xx/power-ifp7xx.c target/arm/pnx0101/iriver-ifp7xx/powermgmt-ifp7xx.c -target/arm/pnx0101/iriver-ifp7xx/usb-ifp7xx.c +target/arm/pnx0101/iriver-ifp7xx/usb-ifp7xx.c #ifndef BOOTLOADER target/arm/pnx0101/pcm-pnx0101.c #endif /* BOOTLOADER */ @@ -1989,7 +2003,7 @@ target/hosted/ibasso/dx90/button-dx90.c #ifdef WIN32 asm/mempcpy.c target/hosted/filesystem-win32.c -#else /* !WIN32 */ +#else /* !WIN32 */ target/hosted/filesystem-unix.c #endif /* WIN32 */ target/hosted/sdl/load_code-sdl.c diff --git a/firmware/asm/SOURCES b/firmware/asm/SOURCES index eba5bd2cb6..085b6351a5 100644 --- a/firmware/asm/SOURCES +++ b/firmware/asm/SOURCES @@ -15,7 +15,7 @@ mempcpy.c defined(CREATIVE_ZVx) || defined(SANSA_CONNECT) || defined(SANSA_FUZEPLUS) || \ defined(COWON_D2) || defined(MINI2440) || defined(SAMSUNG_YPR0) || \ defined(SAMSUNG_YPR1) || defined(DX50) || defined(DX90) || (defined(MROBE_500) && !defined(LCD_USE_DMA)) || \ - defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI) || defined(SONY_NWZ_LINUX) || defined(AGPTEK_ROCKER)) && \ + defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI) || defined(SONY_NWZ_LINUX) || defined(AGPTEK_ROCKER) || defined(XDUOO_X3II) || defined(XDUOO_X20)) && \ !defined(SIMULATOR) #if LCD_DEPTH >= 24 lcd-as-memframe-24bit.c diff --git a/firmware/drivers/audio/xduoolinux_codec.c b/firmware/drivers/audio/xduoolinux_codec.c new file mode 100644 index 0000000000..5db4902e5f --- /dev/null +++ b/firmware/drivers/audio/xduoolinux_codec.c @@ -0,0 +1,122 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * + * Copyright (c) 2018 Marcin Bukat + * Copyright (c) 2018 Roman Stolyarov + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "config.h" +#include "audio.h" +#include "audiohw.h" +#include "system.h" +#include "kernel.h" +#include "panic.h" +#include "sysfs.h" +#include "alsa-controls.h" + +static int fd_hw; + +static void hw_open(void) +{ + fd_hw = open("/dev/snd/controlC0", O_RDWR); + if(fd_hw < 0) + panicf("Cannot open '/dev/snd/controlC0'"); +} + +static void hw_close(void) +{ + close(fd_hw); +} + +void audiohw_preinit(void) +{ + alsa_controls_init(); + hw_open(); +} + +void audiohw_postinit(void) +{ + long int ps = 2; // headset + int status = 0; + + const char * const sysfs_lo_switch = "/sys/class/switch/lineout/state"; + const char * const sysfs_hs_switch = "/sys/class/switch/headset/state"; +#ifdef XDUOO_X20 + const char * const sysfs_bal_switch = "/sys/class/switch/balance/state"; +#endif + +#if defined(XDUOO_X3II) + alsa_controls_set_bool("AK4490 Soft Mute", true); +#endif + + sysfs_get_int(sysfs_lo_switch, &status); + if (status) ps = 1; // lineout + + sysfs_get_int(sysfs_hs_switch, &status); + if (status) ps = 2; // headset + +#ifdef XDUOO_X20 + sysfs_get_int(sysfs_bal_switch, &status); + if (status) ps = 3; // balance +#endif + + /* Output port switch */ + alsa_controls_set_ints("Output Port Switch", 1, &ps); + +#if defined(XDUOO_X3II) + alsa_controls_set_bool("AK4490 Soft Mute", false); +#endif +} + +void audiohw_close(void) +{ + hw_close(); + alsa_controls_close(); +} + +void audiohw_set_frequency(int fsel) +{ + (void)fsel; +} + +void audiohw_set_volume(int vol_l, int vol_r) +{ + long int vol_l_hw = -vol_l/5; + long int vol_r_hw = -vol_r/5; + + alsa_controls_set_ints("Left Playback Volume", 1, &vol_l_hw); + alsa_controls_set_ints("Right Playback Volume", 1, &vol_r_hw); +} + +void audiohw_set_filter_roll_off(int value) +{ + /* 0 = fast (sharp); + 1 = slow; + 2 = fast2 + 3 = slow2 + 4 = NOS ? */ + long int value_hw = value; +#if defined(XDUOO_X3II) + alsa_controls_set_ints("AK4490 Digital Filter", 1, &value_hw); +#elif defined(XDUOO_X20) + alsa_controls_set_ints("ES9018_K2M Digital Filter", 1, &value_hw); +#else + (void)value; +#endif +} diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h index 458fba3412..00bb15812d 100644 --- a/firmware/export/audiohw.h +++ b/firmware/export/audiohw.h @@ -224,6 +224,8 @@ struct sound_settings_info #include "codec-dx90.h" #elif defined(HAVE_ROCKER_CODEC) #include "rocker_codec.h" +#elif defined(HAVE_XDUOO_LINUX_CODEC) +#include "rocker_codec.h" #endif /* convert caps into defines */ diff --git a/firmware/export/config.h b/firmware/export/config.h index a41cceff59..c55d489c26 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -171,6 +171,8 @@ #define XDUOO_X3_PAD 66 #define IHIFI_770_PAD 67 #define IHIFI_800_PAD 68 +#define XDUOO_X3II_PAD 69 +#define XDUOO_X20_PAD 70 /* CONFIG_REMOTE_KEYPAD */ #define H100_REMOTE 1 @@ -624,6 +626,10 @@ Lyre prototype 1 */ #include "config/agptekrocker.h" #elif defined(XDUOO_X3) #include "config/xduoox3.h" +#elif defined(XDUOO_X3II) +#include "config/xduoox3ii.h" +#elif defined(XDUOO_X20) +#include "config/xduoox20.h" #else /* no known platform */ #endif diff --git a/firmware/export/config/agptekrocker.h b/firmware/export/config/agptekrocker.h index 172e079721..372287f4b5 100644 --- a/firmware/export/config/agptekrocker.h +++ b/firmware/export/config/agptekrocker.h @@ -3,7 +3,7 @@ */ /* For Rolo and boot loader */ -#define MODEL_NUMBER 103//??? +#define MODEL_NUMBER 105 #define MODEL_NAME "Agptek Rocker" diff --git a/firmware/export/config/xduoox20.h b/firmware/export/config/xduoox20.h new file mode 100644 index 0000000000..d451ba31f4 --- /dev/null +++ b/firmware/export/config/xduoox20.h @@ -0,0 +1,126 @@ +/* + * This config file is for the xDuoo X20 + */ + +/* For Rolo and boot loader */ +#define MODEL_NUMBER 111 + +#define MODEL_NAME "xDuoo X20" + +/* LCD dimensions */ +#define LCD_WIDTH 240 +#define LCD_HEIGHT 320 +/* sqrt(240^2 + 320^2) / 2.4 = 166 */ +#define LCD_DPI 166 + +#ifndef SIMULATOR +#define CONFIG_PLATFORM (PLATFORM_HOSTED) +#endif + +/* define this if you have a bitmap LCD display */ +#define HAVE_LCD_BITMAP + +/* define this if you have a colour LCD */ +#define HAVE_LCD_COLOR + +#define HAVE_LCD_ENABLE + +/* Define this if the LCD can shut down */ +#define HAVE_LCD_SHUTDOWN + +/* define this if you want album art for this target */ +#define HAVE_ALBUMART + +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + +/* define this if you have access to the quickscreen */ +#define HAVE_QUICKSCREEN + +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + +#define LCD_DEPTH 32 +/* Check that but should not matter */ +#define LCD_PIXELFORMAT XRGB8888 + +#define HAVE_BACKLIGHT +#define HAVE_BACKLIGHT_BRIGHTNESS + +/* Main LCD backlight brightness range and defaults: the backlight driver + * has levels from 0 to 2555. But 0 is off so start at 1. + */ +#define MIN_BRIGHTNESS_SETTING 1 +#define MAX_BRIGHTNESS_SETTING 255 +#define DEFAULT_BRIGHTNESS_SETTING 70 + +/* Which backlight fading type? */ +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING + +/* define this if you have a real-time clock */ +#define CONFIG_RTC APPLICATION + +/* The number of bytes reserved for loadable codecs */ +#define CODEC_SIZE 0x80000 + +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0x100000 + +/* Define this if you do software codec */ +#define CONFIG_CODEC SWCODEC + +#define HAVE_HEADPHONE_DETECTION + +/* KeyPad configuration for plugins */ +#define CONFIG_KEYPAD XDUOO_X20_PAD + +/* Define this if a programmable hotkey is mapped */ +#define HAVE_HOTKEY + +/* define this if the target has volume keys which can be used in the lists */ +#define HAVE_VOLUME_IN_LIST + +#ifndef SIMULATOR +/* We have usb power and can detect usb but it is handled by Linux */ +#define HAVE_USB_POWER + +#endif + +#define CONFIG_BATTERY_MEASURE PERCENTAGE_MEASURE + +/* Linux controlls charging, we can monitor */ +#define CONFIG_CHARGING CHARGING_MONITOR + +/* define this if the hardware can be powered off while charging */ +#define HAVE_POWEROFF_WHILE_CHARGING + +/* same dimensions as gigabeats */ +#define CONFIG_LCD LCD_INGENIC_LINUX + +/* Define this if you have a software controlled poweroff */ +#define HAVE_SW_POWEROFF + +/* Define this to the CPU frequency */ +#define CPU_FREQ 504000000 + +/* No special storage */ +#define CONFIG_STORAGE STORAGE_HOSTFS +#define HAVE_STORAGE_FLUSH + +/* Battery */ +#define BATTERY_TYPES_COUNT 1 + +/* Audio codec */ +#define HAVE_XDUOO_LINUX_CODEC + +/* We don't have hardware controls */ +#define HAVE_SW_TONE_CONTROLS + +/* Battery */ +#define BATTERY_CAPACITY_DEFAULT 2400 /* default battery capacity */ +#define BATTERY_CAPACITY_MIN 2400 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 2400 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 0 /* capacity increment */ diff --git a/firmware/export/config/xduoox3ii.h b/firmware/export/config/xduoox3ii.h new file mode 100644 index 0000000000..af63c4f97b --- /dev/null +++ b/firmware/export/config/xduoox3ii.h @@ -0,0 +1,126 @@ +/* + * This config file is for the xDuoo X3ii + */ + +/* For Rolo and boot loader */ +#define MODEL_NUMBER 110 + +#define MODEL_NAME "xDuoo X3ii" + +/* LCD dimensions */ +#define LCD_WIDTH 240 +#define LCD_HEIGHT 320 +/* sqrt(240^2 + 320^2) / 2.4 = 166 */ +#define LCD_DPI 166 + +#ifndef SIMULATOR +#define CONFIG_PLATFORM (PLATFORM_HOSTED) +#endif + +/* define this if you have a bitmap LCD display */ +#define HAVE_LCD_BITMAP + +/* define this if you have a colour LCD */ +#define HAVE_LCD_COLOR + +#define HAVE_LCD_ENABLE + +/* Define this if the LCD can shut down */ +#define HAVE_LCD_SHUTDOWN + +/* define this if you want album art for this target */ +#define HAVE_ALBUMART + +/* define this to enable bitmap scaling */ +#define HAVE_BMP_SCALING + +/* define this to enable JPEG decoding */ +#define HAVE_JPEG + +/* define this if you have access to the quickscreen */ +#define HAVE_QUICKSCREEN + +/* define this if you would like tagcache to build on this target */ +#define HAVE_TAGCACHE + +#define LCD_DEPTH 32 +/* Check that but should not matter */ +#define LCD_PIXELFORMAT XRGB8888 + +#define HAVE_BACKLIGHT +#define HAVE_BACKLIGHT_BRIGHTNESS + +/* Main LCD backlight brightness range and defaults: the backlight driver + * has levels from 0 to 2555. But 0 is off so start at 1. + */ +#define MIN_BRIGHTNESS_SETTING 1 +#define MAX_BRIGHTNESS_SETTING 255 +#define DEFAULT_BRIGHTNESS_SETTING 70 + +/* Which backlight fading type? */ +#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING + +/* define this if you have a real-time clock */ +#define CONFIG_RTC APPLICATION + +/* The number of bytes reserved for loadable codecs */ +#define CODEC_SIZE 0x80000 + +/* The number of bytes reserved for loadable plugins */ +#define PLUGIN_BUFFER_SIZE 0x100000 + +/* Define this if you do software codec */ +#define CONFIG_CODEC SWCODEC + +#define HAVE_HEADPHONE_DETECTION + +/* KeyPad configuration for plugins */ +#define CONFIG_KEYPAD XDUOO_X3II_PAD + +/* Define this if a programmable hotkey is mapped */ +#define HAVE_HOTKEY + +/* define this if the target has volume keys which can be used in the lists */ +#define HAVE_VOLUME_IN_LIST + +#ifndef SIMULATOR +/* We have usb power and can detect usb but it is handled by Linux */ +#define HAVE_USB_POWER + +#endif + +#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE + +/* Linux controlls charging, we can monitor */ +#define CONFIG_CHARGING CHARGING_MONITOR + +/* define this if the hardware can be powered off while charging */ +#define HAVE_POWEROFF_WHILE_CHARGING + +/* same dimensions as gigabeats */ +#define CONFIG_LCD LCD_INGENIC_LINUX + +/* Define this if you have a software controlled poweroff */ +#define HAVE_SW_POWEROFF + +/* Define this to the CPU frequency */ +#define CPU_FREQ 504000000 + +/* No special storage */ +#define CONFIG_STORAGE STORAGE_HOSTFS +#define HAVE_STORAGE_FLUSH + +/* Battery */ +#define BATTERY_TYPES_COUNT 1 + +/* Audio codec */ +#define HAVE_XDUOO_LINUX_CODEC + +/* We don't have hardware controls */ +#define HAVE_SW_TONE_CONTROLS + +/* Battery */ +#define BATTERY_CAPACITY_DEFAULT 2000 /* default battery capacity */ +#define BATTERY_CAPACITY_MIN 2000 /* min. capacity selectable */ +#define BATTERY_CAPACITY_MAX 2000 /* max. capacity selectable */ +#define BATTERY_CAPACITY_INC 0 /* capacity increment */ diff --git a/firmware/export/rbpaths.h b/firmware/export/rbpaths.h index 165dd37494..b95f1614eb 100644 --- a/firmware/export/rbpaths.h +++ b/firmware/export/rbpaths.h @@ -42,7 +42,7 @@ #if !defined(APPLICATION) || defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) || \ defined(DX50) || defined(DX90) || defined(SONY_NWZ_LINUX) || \ - defined(AGPTEK_ROCKER) + defined(AGPTEK_ROCKER) || defined(XDUOO_X3II) || defined(XDUOO_X20) #if defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) #define HOME_DIR "/mnt/media0" diff --git a/firmware/export/xduoolinux_codec.h b/firmware/export/xduoolinux_codec.h new file mode 100644 index 0000000000..ccd49f09aa --- /dev/null +++ b/firmware/export/xduoolinux_codec.h @@ -0,0 +1,7 @@ +#ifndef __XDUOOLINUX_CODEC__ +#define __XDUOOLINUX_CODEC__ + +#define AUDIOHW_CAPS (FILTER_ROLL_OFF_CAP) +AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -127, 0, -30) +AUDIOHW_SETTING(FILTER_ROLL_OFF, "", 0, 1, 0, 4, 0) +#endif diff --git a/firmware/target/hosted/agptek/backlight-target.h b/firmware/target/hosted/backlight-target.h similarity index 100% rename from firmware/target/hosted/agptek/backlight-target.h rename to firmware/target/hosted/backlight-target.h diff --git a/firmware/target/hosted/agptek/backlight-agptek.c b/firmware/target/hosted/backlight-unix.c similarity index 100% rename from firmware/target/hosted/agptek/backlight-agptek.c rename to firmware/target/hosted/backlight-unix.c diff --git a/firmware/target/hosted/filesystem-app.c b/firmware/target/hosted/filesystem-app.c index d9fcd64e2d..b49412ea48 100644 --- a/firmware/target/hosted/filesystem-app.c +++ b/firmware/target/hosted/filesystem-app.c @@ -36,8 +36,7 @@ #include "rbpaths.h" #include "logf.h" - -#if defined(AGPTEK_ROCKER) && !defined(BOOTLOADER) +#if (defined(AGPTEK_ROCKER) || defined(XDUOO_X3II) || defined(XDUOO_X20)) && !defined(BOOTLOADER) #define PIVOT_ROOT "/mnt/sd_0" #endif @@ -52,7 +51,8 @@ static const char rbhome[] = HOME_DIR; #endif #if !(defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) || defined(DX50) || \ - defined(SONY_NWZ_LINUX) || defined(DX90) || defined(AGPTEK_ROCKER)) && \ + defined(SONY_NWZ_LINUX) || defined(DX90) || defined(AGPTEK_ROCKER) || \ + defined(XDUOO_X3II) || defined(XDUOO_X20)) && \ !defined(__PCTOOL__) /* Special dirs are user-accessible (and user-writable) dirs which take priority * over the ones where Rockbox is installed to. Classic example would be diff --git a/firmware/target/hosted/rtc.c b/firmware/target/hosted/rtc.c index 178e797a8d..488531c77c 100644 --- a/firmware/target/hosted/rtc.c +++ b/firmware/target/hosted/rtc.c @@ -42,7 +42,7 @@ int rtc_read_datetime(struct tm *tm) int rtc_write_datetime(const struct tm *tm) { -#if defined(AGPTEK_ROCKER) && !defined(WIN32) +#if !defined(WIN32) struct timeval tv; struct tm *tm_time; diff --git a/firmware/target/hosted/sdl/sim-ui-defines.h b/firmware/target/hosted/sdl/sim-ui-defines.h index 99ae062595..1e96383682 100644 --- a/firmware/target/hosted/sdl/sim-ui-defines.h +++ b/firmware/target/hosted/sdl/sim-ui-defines.h @@ -521,6 +521,7 @@ #define UI_HEIGHT 380 #define UI_LCD_POSX 29 #define UI_LCD_POSY 25 + #elif defined(XDUOO_X3) #define UI_TITLE "xDuoo X3" #define UI_WIDTH 192 /* width of GUI window */ @@ -528,6 +529,20 @@ #define UI_LCD_POSX 34 #define UI_LCD_POSY 73 +#elif defined(XDUOO_X3II) +#define UI_TITLE "xDuoo X3ii" +#define UI_WIDTH 322 /* width of GUI window */ +#define UI_HEIGHT 609 /* height of GUI window */ +#define UI_LCD_POSX 43 +#define UI_LCD_POSY 62 + +#elif defined(XDUOO_X20) +#define UI_TITLE "xDuoo X20" +#define UI_WIDTH 322 /* width of GUI window */ +#define UI_HEIGHT 609 /* height of GUI window */ +#define UI_LCD_POSX 43 +#define UI_LCD_POSY 62 + #elif defined(IHIFI770) #define UI_TITLE "iHiFi 770" #define UI_WIDTH 382 /* width of GUI window */ @@ -554,4 +569,3 @@ #endif #endif /* #ifndef __UISDL_H__ */ - diff --git a/firmware/target/hosted/agptek/sysfs.c b/firmware/target/hosted/sysfs.c similarity index 100% rename from firmware/target/hosted/agptek/sysfs.c rename to firmware/target/hosted/sysfs.c diff --git a/firmware/target/hosted/agptek/sysfs.h b/firmware/target/hosted/sysfs.h similarity index 100% rename from firmware/target/hosted/agptek/sysfs.h rename to firmware/target/hosted/sysfs.h diff --git a/firmware/target/hosted/agptek/system-agptek.c b/firmware/target/hosted/system-hosted.c similarity index 100% rename from firmware/target/hosted/agptek/system-agptek.c rename to firmware/target/hosted/system-hosted.c diff --git a/firmware/target/hosted/xduoo/adc-target.h b/firmware/target/hosted/xduoo/adc-target.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/firmware/target/hosted/xduoo/button-target.h b/firmware/target/hosted/xduoo/button-target.h new file mode 100644 index 0000000000..6cca5c22a0 --- /dev/null +++ b/firmware/target/hosted/xduoo/button-target.h @@ -0,0 +1,46 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2018 by Roman Stolyarov + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef _BUTTON_TARGET_H_ +#define _BUTTON_TARGET_H_ + +#define HAS_BUTTON_HOLD + +/* Main unit's buttons */ +#define BUTTON_POWER 0x00000001 +#define BUTTON_HOME 0x00000002 +#define BUTTON_OPTION 0x00000004 +#define BUTTON_PREV 0x00000008 +#define BUTTON_NEXT 0x00000010 +#define BUTTON_PLAY 0x00000020 +#define BUTTON_VOL_UP 0x00000040 +#define BUTTON_VOL_DOWN 0x00000080 + +#define BUTTON_LEFT 0 +#define BUTTON_RIGHT 0 + +#define BUTTON_MAIN (BUTTON_POWER | BUTTON_HOME | BUTTON_OPTION | BUTTON_PREV | \ + BUTTON_NEXT | BUTTON_PLAY | BUTTON_VOL_UP | BUTTON_VOL_DOWN) + +/* Software power-off */ +#define POWEROFF_BUTTON BUTTON_POWER +#define POWEROFF_COUNT 25 + +#endif /* _BUTTON_TARGET_H_ */ + diff --git a/firmware/target/hosted/xduoo/button-xduoo.c b/firmware/target/hosted/xduoo/button-xduoo.c new file mode 100644 index 0000000000..9fd1392b89 --- /dev/null +++ b/firmware/target/hosted/xduoo/button-xduoo.c @@ -0,0 +1,202 @@ +/*************************************************************************** + * __________ __ ___ + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2017 Marcin Bukat + * Copyright (C) 2018 Roman Stolyarov + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include +//#include +#include +#include +#include +#include +#include +#include +#include + +#include "sysfs.h" +#include "button.h" +#include "button-target.h" +#include "panic.h" + +#include "kernel.h" +#include "backlight.h" +#include "backlight-target.h" + +static bool soft_hold = false; +#ifndef BOOTLOADER +static unsigned soft_hold_counter = 0; +#define SOFT_HOLD_BUTTON BUTTON_POWER +#define SOFT_HOLD_CNTMAX_1 (HZ) +#define SOFT_HOLD_CNTMAX_2 (HZ*2) +#endif + +#define NR_POLL_DESC 3 +static struct pollfd poll_fds[NR_POLL_DESC]; + +static int button_map(int keycode) +{ + switch(keycode) + { + case KEY_BACK: + return BUTTON_HOME; + + case KEY_MENU: + return BUTTON_OPTION; + + case KEY_UP: + return BUTTON_PREV; + + case KEY_DOWN: + return BUTTON_NEXT; + + case KEY_ENTER: + return BUTTON_PLAY; + + case KEY_VOLUMEUP: + return BUTTON_VOL_UP; + + case KEY_VOLUMEDOWN: + return BUTTON_VOL_DOWN; + + case KEY_POWER: + return BUTTON_POWER; + + default: + return 0; + } +} + +void button_init_device(void) +{ + const char * const input_devs[] = { + "/dev/input/event0", + "/dev/input/event1", + "/dev/input/event2" + }; + + for(int i = 0; i < NR_POLL_DESC; i++) + { + int fd = open(input_devs[i], O_RDWR); + + if(fd < 0) + { + panicf("Cannot open input device: %s\n", input_devs[i]); + } + + poll_fds[i].fd = fd; + poll_fds[i].events = POLLIN; + poll_fds[i].revents = 0; + } +} + +int button_read_device(void) +{ + static int button_bitmap = 0; + struct input_event event; + + /* check if there are any events pending and process them */ + while(poll(poll_fds, NR_POLL_DESC, 0)) + { + for(int i = 0; i < NR_POLL_DESC; i++) + { + /* read only if non-blocking */ + if(poll_fds[i].revents & POLLIN) + { + int size = read(poll_fds[i].fd, &event, sizeof(event)); + if(size == (int)sizeof(event)) + { + int keycode = event.code; + /* event.value == 1 means press + * event.value == 0 means release + */ + bool press = event.value ? true : false; + + /* map linux event code to rockbox button bitmap */ + if(press) + { + button_bitmap |= button_map(keycode); + } + else + { + button_bitmap &= ~button_map(keycode); + } + } + } + } + } + +#ifndef BOOTLOADER + if (button_bitmap == SOFT_HOLD_BUTTON) { + soft_hold_counter++; + if (soft_hold_counter == SOFT_HOLD_CNTMAX_1) { + soft_hold = !soft_hold; + backlight_hold_changed(soft_hold); + } + else + if (soft_hold_counter == SOFT_HOLD_CNTMAX_2) { + soft_hold = false; + backlight_hold_changed(soft_hold); + } + } else { + soft_hold_counter = 0; + } + + if((soft_hold) && (button_bitmap != SOFT_HOLD_BUTTON)) { + return BUTTON_NONE; + } +#endif + + return button_bitmap; +} + +bool headphones_inserted(void) +{ + int status = 0; + const char * const sysfs_lo_switch = "/sys/class/switch/lineout/state"; + const char * const sysfs_hs_switch = "/sys/class/switch/headset/state"; +#ifdef XDUOO_X20 + const char * const sysfs_bal_switch = "/sys/class/switch/balance/state"; +#endif + + sysfs_get_int(sysfs_lo_switch, &status); + if (status) return true; + + sysfs_get_int(sysfs_hs_switch, &status); + if (status) return true; + +#ifdef XDUOO_X20 + sysfs_get_int(sysfs_bal_switch, &status); + if (status) return true; +#endif + + return false; +} + +void button_close_device(void) +{ + /* close descriptors */ + for(int i = 0; i < NR_POLL_DESC; i++) + { + close(poll_fds[i].fd); + } +} + +bool button_hold(void) +{ + return soft_hold; +} diff --git a/firmware/target/hosted/xduoo/debug-xduoo.c b/firmware/target/hosted/xduoo/debug-xduoo.c new file mode 100644 index 0000000000..33f3ac4b97 --- /dev/null +++ b/firmware/target/hosted/xduoo/debug-xduoo.c @@ -0,0 +1,6 @@ +#include + +bool debug_hw_info(void) +{ + return false; +} diff --git a/firmware/target/hosted/xduoo/lcd-target.h b/firmware/target/hosted/xduoo/lcd-target.h new file mode 100644 index 0000000000..bb9b77771b --- /dev/null +++ b/firmware/target/hosted/xduoo/lcd-target.h @@ -0,0 +1,32 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2016 Amaury Pouly + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#ifndef __LCD_TARGET_H__ +#define __LCD_TARGET_H__ + +/* needs special ioctl() to redraw updated framebuffer content */ +#define LCD_OPTIMIZED_UPDATE +#define LCD_OPTIMIZED_UPDATE_RECT + +extern fb_data *framebuffer; /* see lcd-xduoo.c */ +#define LCD_FRAMEBUF_ADDR(col, row) (framebuffer + (row)*LCD_WIDTH + (col)) + +extern void lcd_set_active(bool active); +#endif /* __LCD_TARGET_H__ */ diff --git a/firmware/target/hosted/xduoo/lcd-xduoo.c b/firmware/target/hosted/xduoo/lcd-xduoo.c new file mode 100644 index 0000000000..4b3148da03 --- /dev/null +++ b/firmware/target/hosted/xduoo/lcd-xduoo.c @@ -0,0 +1,140 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2017 Marcin Bukat + * Copyright (C) 2016 Amaury Pouly + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include "lcd.h" +#include "lcd-target.h" +#include "backlight-target.h" +#include "sysfs.h" +#include "panic.h" + +static int fd = -1; +static struct fb_var_screeninfo vinfo; +fb_data *framebuffer = 0; /* global variable, see lcd-target.h */ + +void lcd_init_device(void) +{ + const char * const fb_dev = "/dev/fb0"; + fd = open(fb_dev, O_RDWR); + if(fd < 0) + { + panicf("Cannot open framebuffer: %s\n", fb_dev); + } + + /* get fixed and variable information */ + struct fb_fix_screeninfo finfo; + if(ioctl(fd, FBIOGET_FSCREENINFO, &finfo) < 0) + { + panicf("Cannot read framebuffer fixed information"); + } + + if(ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0) + { + panicf("Cannot read framebuffer variable information"); + } + +#if 0 + /* check resolution and framebuffer size */ + if(vinfo.xres != LCD_WIDTH || vinfo.yres != LCD_HEIGHT || vinfo.bits_per_pixel != LCD_DEPTH) + { + panicf("Unexpected framebuffer resolution: %dx%dx%d\n", vinfo.xres, + vinfo.yres, vinfo.bits_per_pixel); + } +#endif + /* Note: we use a framebuffer size of width*height*bbp. We cannot trust the + * values returned by the driver for line_length */ + + /* map framebuffer */ + framebuffer = mmap(0, FRAMEBUFFER_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + if((void *)framebuffer == MAP_FAILED) + { + panicf("Cannot map framebuffer"); + } + +#ifdef HAVE_LCD_ENABLE + lcd_set_active(true); +#endif +} + +#ifdef HAVE_LCD_SHUTDOWN +void lcd_shutdown(void) +{ + munmap(framebuffer, FRAMEBUFFER_SIZE); + close(fd); +} +#endif + +void lcd_enable(bool on) +{ + const char * const sysfs_fb_blank = "/sys/class/graphics/fb0/blank"; + + if (lcd_active() != on) + { + sysfs_set_int(sysfs_fb_blank, on ? 0 : 1); + lcd_set_active(on); + + if (on) + { + send_event(LCD_EVENT_ACTIVATION, NULL); + } + } +} + +static void redraw(void) +{ + ioctl(fd, FBIOPAN_DISPLAY, &vinfo); +} + +extern void lcd_copy_buffer_rect(fb_data *dst, const fb_data *src, + int width, int height); + +void lcd_update(void) +{ + /* Copy the Rockbox framebuffer to the second framebuffer */ + lcd_copy_buffer_rect(LCD_FRAMEBUF_ADDR(0, 0), FBADDR(0,0), + LCD_WIDTH*LCD_HEIGHT, 1); + redraw(); +} + +void lcd_update_rect(int x, int y, int width, int height) +{ + fb_data *dst = LCD_FRAMEBUF_ADDR(x, y); + fb_data * src = FBADDR(x,y); + + /* Copy part of the Rockbox framebuffer to the second framebuffer */ + if (width < LCD_WIDTH) + { + /* Not full width - do line-by-line */ + lcd_copy_buffer_rect(dst, src, width, height); + } + else + { + /* Full width - copy as one line */ + lcd_copy_buffer_rect(dst, src, LCD_WIDTH*height, 1); + } + redraw(); +} diff --git a/firmware/target/hosted/xduoo/power-xduoo.c b/firmware/target/hosted/xduoo/power-xduoo.c new file mode 100644 index 0000000000..97a8dd4779 --- /dev/null +++ b/firmware/target/hosted/xduoo/power-xduoo.c @@ -0,0 +1,74 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2017 by Marcin Bukat + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include +#include +#include +#include +#include + +#include "system.h" +#include "power-xduoo.h" +#include "power.h" +#include "panic.h" +#include "sysfs.h" + +const char * const sysfs_bat_voltage = + "/sys/class/power_supply/battery/voltage_now"; + +const char * const sysfs_bat_capacity = + "/sys/class/power_supply/battery/capacity"; + +const char * const sysfs_bat_status = + "/sys/class/power_supply/battery/status"; + +const char * const sysfs_pow_supply = + "/sys/class/power_supply/usb/present"; + +unsigned int xduoo_power_input_status(void) +{ + int present = 0; + sysfs_get_int(sysfs_pow_supply, &present); + + return present ? POWER_INPUT_USB_CHARGER : POWER_INPUT_NONE; +} + +bool xduoo_power_charging_status(void) +{ + char buf[12] = {0}; + sysfs_get_string(sysfs_bat_status, buf, sizeof(buf)); + + return (strncmp(buf, "Charging", 8) == 0); +} + +unsigned int xduoo_power_get_battery_voltage(void) +{ + int battery_voltage; + sysfs_get_int(sysfs_bat_voltage, &battery_voltage); + + return battery_voltage/1000; +} + +unsigned int xduoo_power_get_battery_capacity(void) +{ + int battery_capacity; + sysfs_get_int(sysfs_bat_capacity, &battery_capacity); + + return battery_capacity; +} diff --git a/firmware/target/hosted/xduoo/power-xduoo.h b/firmware/target/hosted/xduoo/power-xduoo.h new file mode 100644 index 0000000000..d573865ed2 --- /dev/null +++ b/firmware/target/hosted/xduoo/power-xduoo.h @@ -0,0 +1,31 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2017 by Marcin Bukat + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef _POWER_XDUOO_H_ +#define _POWER_XDUOO_H_ + +#include +#include "config.h" + +unsigned int xduoo_power_input_status(void); +bool xduoo_power_charging_status(void); +unsigned int xduoo_power_get_battery_voltage(void); +unsigned int xduoo_power_get_battery_capacity(void); +#endif /* _POWER_XDUOO_H_ */ + diff --git a/firmware/target/hosted/xduoo/powermgmt-xduoo.c b/firmware/target/hosted/xduoo/powermgmt-xduoo.c new file mode 100644 index 0000000000..30001934ba --- /dev/null +++ b/firmware/target/hosted/xduoo/powermgmt-xduoo.c @@ -0,0 +1,70 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2017 Marcin Bukat + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#include "powermgmt.h" +#include "power.h" +#include "power-xduoo.h" + +const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = +{ + 3470 +}; + +/* the OF shuts down at this voltage */ +const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = +{ + 3400 +}; + +/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ +const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = +{ + { 3400, 3639, 3697, 3723, 3757, 3786, 3836, 3906, 3980, 4050, 4159 } +}; + +/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ +const unsigned short const percent_to_volt_charge[11] = +{ + 3485, 3780, 3836, 3857, 3890, 3930, 3986, 4062, 4158, 4185, 4196 +}; + +unsigned int power_input_status(void) +{ + /* POWER_INPUT_USB_CHARGER, POWER_INPUT_NONE */ + return xduoo_power_input_status(); +} + +#if defined(XDUOO_X3II) +int _battery_voltage(void) +{ + return xduoo_power_get_battery_voltage(); +} +#endif + +#if defined(XDUOO_X20) +int _battery_level(void) +{ + return xduoo_power_get_battery_capacity(); +} +#endif + +bool charging_state(void) +{ + return xduoo_power_charging_status(); +} diff --git a/firmware/target/hosted/xduoo/system-target.h b/firmware/target/hosted/xduoo/system-target.h new file mode 100644 index 0000000000..830f19fde4 --- /dev/null +++ b/firmware/target/hosted/xduoo/system-target.h @@ -0,0 +1,28 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2017 Marcin Bukat + * Copyright (C) 2016 Amaury Pouly + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ +#ifndef __SYSTEM_TARGET_H__ +#define __SYSTEM_TARGET_H__ + +#include "kernel-unix.h" +#include "system-hosted.h" + +#define NEED_GENERIC_BYTESWAPS +#endif /* __SYSTEM_TARGET_H__ */ diff --git a/firmware/target/hosted/xduoo/usb-xduoo.c b/firmware/target/hosted/xduoo/usb-xduoo.c new file mode 100644 index 0000000000..19248ad262 --- /dev/null +++ b/firmware/target/hosted/xduoo/usb-xduoo.c @@ -0,0 +1,118 @@ +/*************************************************************************** + * __________ __ ___ + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * + * Copyright (C) 2018 by Marcin Bukat + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include +#include +#include +#include "config.h" +#include "disk.h" +#include "usb.h" +#include "sysfs.h" +#include "power.h" +#include "power-xduoo.h" + +static bool adb_mode = false; + +/* TODO: implement usb detection properly */ +int usb_detect(void) +{ + return power_input_status() == POWER_INPUT_USB_CHARGER ? USB_INSERTED : USB_EXTRACTED; +} + +void usb_enable(bool on) +{ + /* Ignore usb enable/disable when ADB is enabled so we can fireup adb shell + * without entering ums mode + */ + if (!adb_mode) + { + sysfs_set_int("/sys/class/android_usb/android0/enable", on ? 1 : 0); + } +} + +/* This is called by usb thread after usb extract in order to return + * regular FS access + * + * returns the # of successful mounts +*/ +int disk_mount_all(void) +{ + const char *dev[] = {"/dev/mmcblk0p1", "/dev/mmcblk0"}; + const char *fs[] = {"vfat", "exfat"}; + + sysfs_set_string("/sys/class/android_usb/android0/f_mass_storage/lun/file", ""); + + for (int i=0; i<2; i++) + { + for (int j=0; j<2; j++) + { + if (mount(dev[i], "/mnt/sd_0", fs[j], 0, NULL) == 0) + { + return 1; + } + } + } + + return 0; +} + +/* This is called by usb thread after all threads ACKs usb inserted message + * + * returns the # of successful unmounts + */ +int disk_unmount_all(void) +{ + if (umount("/mnt/sd_0") == 0) + { + sysfs_set_string("/sys/class/android_usb/android0/f_mass_storage/lun/file", "/dev/mmcblk0"); + return 1; + } + + return 0; +} + +void usb_init_device(void) +{ + char functions[32] = {0}; + + /* Check if ADB was activated in bootloader */ + sysfs_get_string("/sys/class/android_usb/android0/functions", functions, sizeof(functions)); + adb_mode = (strstr(functions, "adb") == NULL) ? false : true; + + usb_enable(false); + + if (adb_mode) + { + sysfs_set_string("/sys/class/android_usb/android0/functions", "mass_storage,adb"); + sysfs_set_string("/sys/class/android_usb/android0/idVendor", "18D1"); + sysfs_set_string("/sys/class/android_usb/android0/idProduct", "D002"); + } + else + { + sysfs_set_string("/sys/class/android_usb/android0/functions", "mass_storage"); + sysfs_set_string("/sys/class/android_usb/android0/idVendor", "C502"); + sysfs_set_string("/sys/class/android_usb/android0/idProduct", "0029"); + } + + sysfs_set_string("/sys/class/android_usb/android0/iManufacturer", "Rockbox.org"); + sysfs_set_string("/sys/class/android_usb/android0/iProduct", "Rockbox media player"); + sysfs_set_string("/sys/class/android_usb/android0/iSerial", "0123456789ABCDEF"); + sysfs_set_string("/sys/class/android_usb/android0/f_mass_storage/inquiry_string", "xDuoo 0100"); +} diff --git a/firmware/target/hosted/xduoo/xduoo.make b/firmware/target/hosted/xduoo/xduoo.make new file mode 100644 index 0000000000..5c37d27412 --- /dev/null +++ b/firmware/target/hosted/xduoo/xduoo.make @@ -0,0 +1,52 @@ +# __________ __ ___. +# Open \______ \ ____ ____ | | _\_ |__ _______ ___ +# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +# \/ \/ \/ \/ \/ +# $Id$ +# + +INCLUDES += -I$(FIRMDIR)/include -I$(FIRMDIR)/export $(TARGET_INC) -I$(BUILDDIR) -I$(APPSDIR) + +SIMFLAGS += $(INCLUDES) $(DEFINES) -DHAVE_CONFIG_H $(GCCOPTS) + +# bootloader build is sligtly different +ifneq (,$(findstring bootloader,$(APPSDIR))) + +SRC += $(call preprocess, $(APPSDIR)/SOURCES) +CLEANOBJS += $(BUILDDIR)/bootloader.* + +endif #bootloader + +.SECONDEXPANSION: # $$(OBJ) is not populated until after this + +ifneq (,$(findstring bootloader,$(APPSDIR))) +# bootloader build + +$(BUILDDIR)/bootloader.elf : $$(OBJ) $(FIRMLIB) $(CORE_LIBS) + $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -o $@ $(OBJ) \ + -L$(BUILDDIR)/firmware -lfirmware \ + -L$(BUILDDIR)/lib $(call a2lnk,$(CORE_LIBS)) \ + $(LDOPTS) $(GLOBAL_LDOPTS) -Wl,--gc-sections -Wl,-Map,$(BUILDDIR)/bootloader.map + +$(BUILDDIR)/$(BINARY): $(BUILDDIR)/bootloader.elf + $(call PRINTS,OC $(@F))$(call objcopy,$^,$@) + +else +# rockbox app build + +$(BUILDDIR)/rockbox.elf : $$(OBJ) $(FIRMLIB) $(VOICESPEEXLIB) $(CORE_LIBS) + $(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -o $@ $(OBJ) \ + -L$(BUILDDIR)/firmware -lfirmware \ + -L$(RBCODEC_BLD)/codecs $(call a2lnk, $(VOICESPEEXLIB)) \ + -L$(BUILDDIR)/lib $(call a2lnk,$(CORE_LIBS)) \ + $(LDOPTS) $(GLOBAL_LDOPTS) -Wl,-Map,$(BUILDDIR)/rockbox.map + +$(BUILDDIR)/rockbox.x3ii : $(BUILDDIR)/rockbox.elf + $(call PRINTS,OC $(@F))$(call objcopy,$^,$@) + +$(BUILDDIR)/rockbox.x20 : $(BUILDDIR)/rockbox.elf + $(call PRINTS,OC $(@F))$(call objcopy,$^,$@) + +endif diff --git a/tools/configure b/tools/configure index f6fc50d905..4b2b1ce829 100755 --- a/tools/configure +++ b/tools/configure @@ -888,7 +888,6 @@ mipsellinuxcc () { SHARED_LDFLAG="-shared" SHARED_CFLAGS='-fPIC -fvisibility=hidden' endian="little" - app_type="rocker" thread_support="HAVE_SIGALTSTACK_THREADS" # Include path @@ -1244,7 +1243,7 @@ voiceconfig () { exit 4 fi fi - + echo "Using $ENCODER for encoding voice clips" # Read custom encoder options from command line @@ -1392,7 +1391,7 @@ ARG_ARM_THUMB= ARG_PREFIX="$PREFIX" ARG_THREAD_SUPPORT= ARG_32BIT= -err= +err= for arg in "$@"; do case "$arg" in --ccache) ARG_CCACHE=1;; @@ -1565,6 +1564,8 @@ cat <