diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2021-03-28 12:07:30 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2021-03-28 12:08:31 -0400 |
commit | 058a9ec9453fed05872d10c72913bbc7034d32d8 (patch) | |
tree | 38557eecf09fa2056783e00206ce91a8972b08c9 | |
parent | afd8361d080e892829aacae196b9a8ced3a16894 (diff) | |
download | rockbox-058a9ec9453fed05872d10c72913bbc7034d32d8.tar.gz rockbox-058a9ec9453fed05872d10c72913bbc7034d32d8.zip |
Add M3K native to the simulator
Change-Id: If3e877d2df189e44076631fd571cf6aa70ce6ca8
-rw-r--r-- | apps/debug_menu.c | 4 | ||||
-rw-r--r-- | firmware/export/config/fiiom3k.h | 8 | ||||
-rw-r--r-- | firmware/target/hosted/sdl/sim-ui-defines.h | 8 | ||||
-rw-r--r-- | uisimulator/bitmaps/UI-fiiom3k.bmp | bin | 0 -> 676310 bytes | |||
-rw-r--r-- | uisimulator/buttonmap/SOURCES | 2 | ||||
-rw-r--r-- | uisimulator/buttonmap/fiio-m3k.c | 97 |
6 files changed, 117 insertions, 2 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index f7e179b040..42d16a4e82 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -2495,7 +2495,7 @@ static bool dbg_boot_data(void) | |||
2495 | } | 2495 | } |
2496 | #endif /* defined(HAVE_BOOTDATA) && !defined(SIMULATOR) */ | 2496 | #endif /* defined(HAVE_BOOTDATA) && !defined(SIMULATOR) */ |
2497 | 2497 | ||
2498 | #ifdef FIIO_M3K | 2498 | #if defined(FIIO_M3K) && !defined(SIMULATOR) |
2499 | /* Note: this is temporary and should NOT be merged, ensure it is removed */ | 2499 | /* Note: this is temporary and should NOT be merged, ensure it is removed */ |
2500 | static int fiio_debug_menu_action_callback(int action, struct gui_synclist *lists) | 2500 | static int fiio_debug_menu_action_callback(int action, struct gui_synclist *lists) |
2501 | { | 2501 | { |
@@ -2648,7 +2648,7 @@ static const struct { | |||
2648 | #if defined(HAVE_BOOTDATA) && !defined(SIMULATOR) | 2648 | #if defined(HAVE_BOOTDATA) && !defined(SIMULATOR) |
2649 | {"Boot data", dbg_boot_data }, | 2649 | {"Boot data", dbg_boot_data }, |
2650 | #endif | 2650 | #endif |
2651 | #ifdef FIIO_M3K | 2651 | #if defined(FIIO_M3K) && !defined(SIMULATOR) |
2652 | {"FiiO debug menu", dbg_fiio_menu}, | 2652 | {"FiiO debug menu", dbg_fiio_menu}, |
2653 | #endif | 2653 | #endif |
2654 | }; | 2654 | }; |
diff --git a/firmware/export/config/fiiom3k.h b/firmware/export/config/fiiom3k.h index 68186d7aaf..1afdbdaa36 100644 --- a/firmware/export/config/fiiom3k.h +++ b/firmware/export/config/fiiom3k.h | |||
@@ -10,7 +10,11 @@ | |||
10 | /* CPU defines */ | 10 | /* CPU defines */ |
11 | #define CONFIG_CPU X1000 | 11 | #define CONFIG_CPU X1000 |
12 | #define X1000_EXCLK_FREQ 24000000 | 12 | #define X1000_EXCLK_FREQ 24000000 |
13 | |||
14 | #ifndef SIMULATOR | ||
13 | #define TIMER_FREQ X1000_EXCLK_FREQ | 15 | #define TIMER_FREQ X1000_EXCLK_FREQ |
16 | #endif | ||
17 | |||
14 | #define CPU_FREQ 1008000000 | 18 | #define CPU_FREQ 1008000000 |
15 | #define CPUFREQ_MAX CPU_FREQ | 19 | #define CPUFREQ_MAX CPU_FREQ |
16 | /* TODO: figure out if this does in fact affect power consumption. */ | 20 | /* TODO: figure out if this does in fact affect power consumption. */ |
@@ -88,11 +92,13 @@ | |||
88 | /* TODO: implement HAVE_RTC_ALARM */ | 92 | /* TODO: implement HAVE_RTC_ALARM */ |
89 | 93 | ||
90 | /* Power management */ | 94 | /* Power management */ |
95 | #ifndef SIMULATOR | ||
91 | #define HAVE_AXP173 | 96 | #define HAVE_AXP173 |
92 | #define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE | 97 | #define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE |
93 | #define CONFIG_CHARGING CHARGING_MONITOR | 98 | #define CONFIG_CHARGING CHARGING_MONITOR |
94 | #define HAVE_SW_POWEROFF | 99 | #define HAVE_SW_POWEROFF |
95 | #define HAVE_POWEROFF_WHILE_CHARGING | 100 | #define HAVE_POWEROFF_WHILE_CHARGING |
101 | #endif | ||
96 | 102 | ||
97 | /* Only one battery type */ | 103 | /* Only one battery type */ |
98 | #define BATTERY_CAPACITY_DEFAULT 1100 | 104 | #define BATTERY_CAPACITY_DEFAULT 1100 |
@@ -102,7 +108,9 @@ | |||
102 | #define BATTERY_TYPES_COUNT 1 | 108 | #define BATTERY_TYPES_COUNT 1 |
103 | 109 | ||
104 | /* USB is still TODO. */ | 110 | /* USB is still TODO. */ |
111 | #ifndef SIMULATOR | ||
105 | #define USB_NONE | 112 | #define USB_NONE |
113 | #endif | ||
106 | 114 | ||
107 | /* Rockbox capabilities */ | 115 | /* Rockbox capabilities */ |
108 | #define HAVE_FAT16SUPPORT | 116 | #define HAVE_FAT16SUPPORT |
diff --git a/firmware/target/hosted/sdl/sim-ui-defines.h b/firmware/target/hosted/sdl/sim-ui-defines.h index 55ef96b984..c3ae7c0551 100644 --- a/firmware/target/hosted/sdl/sim-ui-defines.h +++ b/firmware/target/hosted/sdl/sim-ui-defines.h | |||
@@ -535,6 +535,14 @@ | |||
535 | #define UI_LCD_POSX 45 | 535 | #define UI_LCD_POSX 45 |
536 | #define UI_LCD_POSY 50 | 536 | #define UI_LCD_POSY 50 |
537 | 537 | ||
538 | #elif defined(FIIO_M3K) || defined(FIIO_M3K_LINUX) | ||
539 | #define UI_TITLE "FiiO M3K" | ||
540 | #define UI_WIDTH 287 /* width of GUI window */ | ||
541 | #define UI_HEIGHT 589 /* height of GUI window */ | ||
542 | #define UI_LCD_POSX 25 | ||
543 | #define UI_LCD_POSY 15 | ||
544 | |||
545 | |||
538 | #elif defined(SIMULATOR) | 546 | #elif defined(SIMULATOR) |
539 | #error no UI defines | 547 | #error no UI defines |
540 | #endif | 548 | #endif |
diff --git a/uisimulator/bitmaps/UI-fiiom3k.bmp b/uisimulator/bitmaps/UI-fiiom3k.bmp new file mode 100644 index 0000000000..118424ef5f --- /dev/null +++ b/uisimulator/bitmaps/UI-fiiom3k.bmp | |||
Binary files differ | |||
diff --git a/uisimulator/buttonmap/SOURCES b/uisimulator/buttonmap/SOURCES index dfcfe87b42..fec71b5b09 100644 --- a/uisimulator/buttonmap/SOURCES +++ b/uisimulator/buttonmap/SOURCES | |||
@@ -87,5 +87,7 @@ xduoo-x20.c | |||
87 | ihifi2.c | 87 | ihifi2.c |
88 | #elif CONFIG_KEYPAD == EROSQ_PAD | 88 | #elif CONFIG_KEYPAD == EROSQ_PAD |
89 | erosq.c | 89 | erosq.c |
90 | #elif CONFIG_KEYPAD == FIIO_M3K_PAD | ||
91 | fiio-m3k.c | ||
90 | #endif | 92 | #endif |
91 | #endif /* SIMULATOR */ | 93 | #endif /* SIMULATOR */ |
diff --git a/uisimulator/buttonmap/fiio-m3k.c b/uisimulator/buttonmap/fiio-m3k.c new file mode 100644 index 0000000000..402de33bfb --- /dev/null +++ b/uisimulator/buttonmap/fiio-m3k.c | |||
@@ -0,0 +1,97 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2021 by Solomon Peachy | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | |||
22 | |||
23 | #include <SDL.h> | ||
24 | #include "button.h" | ||
25 | #include "buttonmap.h" | ||
26 | |||
27 | int key_to_button(int keyboard_button) | ||
28 | { | ||
29 | int new_btn = BUTTON_NONE; | ||
30 | switch (keyboard_button) | ||
31 | { | ||
32 | case SDLK_KP4: | ||
33 | case SDLK_LEFT: | ||
34 | new_btn = BUTTON_LEFT; | ||
35 | break; | ||
36 | case SDLK_KP6: | ||
37 | case SDLK_RIGHT: | ||
38 | new_btn = BUTTON_RIGHT; | ||
39 | break; | ||
40 | case SDLK_KP8: | ||
41 | case SDLK_UP: | ||
42 | new_btn = BUTTON_UP; | ||
43 | break; | ||
44 | case SDLK_KP2: | ||
45 | case SDLK_DOWN: | ||
46 | new_btn = BUTTON_DOWN; | ||
47 | break; | ||
48 | case SDLK_ESCAPE: | ||
49 | new_btn = BUTTON_POWER; | ||
50 | break; | ||
51 | case SDLK_KP_PLUS: | ||
52 | case SDLK_EQUALS: | ||
53 | new_btn = BUTTON_VOL_UP; | ||
54 | break; | ||
55 | case SDLK_KP_MINUS: | ||
56 | case SDLK_MINUS: | ||
57 | new_btn = BUTTON_VOL_DOWN; | ||
58 | break; | ||
59 | case SDLK_KP_PERIOD: | ||
60 | case SDLK_INSERT: | ||
61 | new_btn = BUTTON_MENU; | ||
62 | break; | ||
63 | case SDL_BUTTON_WHEELUP: | ||
64 | new_btn = BUTTON_SCROLL_BACK; | ||
65 | break; | ||
66 | case SDL_BUTTON_WHEELDOWN: | ||
67 | new_btn = BUTTON_SCROLL_FWD; | ||
68 | break; | ||
69 | case SDLK_BACKSPACE: | ||
70 | new_btn = BUTTON_BACK; | ||
71 | |||
72 | case SDLK_KP_ENTER: | ||
73 | case SDLK_RETURN: | ||
74 | new_btn = BUTTON_SELECT; | ||
75 | break; | ||
76 | case SDLK_SPACE: | ||
77 | case SDLK_KP5: | ||
78 | new_btn = BUTTON_PLAY; | ||
79 | break; | ||
80 | } | ||
81 | return new_btn; | ||
82 | } | ||
83 | |||
84 | struct button_map bm[] = { | ||
85 | { SDLK_ESCAPE, 12, 55, 15, "Power" }, | ||
86 | { SDLK_KP_MINUS, 12, 125, 15, "Volume -" }, | ||
87 | { SDLK_KP_PLUS, 12, 188, 15, "Volume +" }, | ||
88 | { SDLK_SPACE, 12, 255, 15, "Play" }, | ||
89 | { SDLK_UP, 146, 394, 20, "Up" }, | ||
90 | { SDLK_RETURN, 146, 438, 20, "Select" }, | ||
91 | { SDLK_DOWN, 146, 510, 20, "Down" }, | ||
92 | { SDLK_INSERT, 68, 368, 20, "Menu" }, | ||
93 | { SDLK_LEFT, 68, 532, 20, "Left" }, | ||
94 | { SDLK_RIGHT, 224, 532, 20, "Right" }, | ||
95 | { SDLK_BACKSPACE, 224, 368, 20, "Back" }, | ||
96 | { 0, 0, 0, 0, "None" } | ||
97 | }; | ||