summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2017-09-10 21:55:35 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2017-09-17 00:03:02 +0200
commitac57f96838b53e574477d13bf41bc54711a70c21 (patch)
treedcd4c1d96593458c59375c2160c3ffaeb27329e5
parentf22ccabac339925dbb004bd035307480fca9d2f7 (diff)
downloadrockbox-ac57f96838b53e574477d13bf41bc54711a70c21.tar.gz
rockbox-ac57f96838b53e574477d13bf41bc54711a70c21.zip
Add support for the NWZ-A860
Change-Id: Ibf0c5168ac31d4ba2aeaa86cbeca37a1011b75fa
-rw-r--r--apps/SOURCES2
-rw-r--r--apps/keymaps/keymap-nwza860.c289
-rw-r--r--bootloader/nwz_linux.c17
-rw-r--r--firmware/export/config.h3
-rw-r--r--firmware/export/config/sonynwza860.h24
-rw-r--r--firmware/target/hosted/sonynwz/button-nwz.c25
-rw-r--r--firmware/target/hosted/sonynwz/button-target.h39
-rw-r--r--rbutil/mknwzboot/mknwzboot.c1
-rwxr-xr-xtools/configure25
-rw-r--r--tools/scramble.c4
10 files changed, 419 insertions, 10 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index 521b920f69..666bf69f60 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -305,6 +305,8 @@ keymaps/keymap-zen.c
305keymaps/keymap-ma.c 305keymaps/keymap-ma.c
306#elif CONFIG_KEYPAD == SONY_NWZ_PAD 306#elif CONFIG_KEYPAD == SONY_NWZ_PAD
307keymaps/keymap-nwz.c 307keymaps/keymap-nwz.c
308#elif CONFIG_KEYPAD == SONY_NWZA860_PAD
309keymaps/keymap-nwza860.c
308#elif CONFIG_KEYPAD == SAMSUNG_YPZ5_PAD 310#elif CONFIG_KEYPAD == SAMSUNG_YPZ5_PAD
309keymaps/keymap-ypz5.c 311keymaps/keymap-ypz5.c
310#elif CONFIG_KEYPAD == IHIFI_PAD 312#elif CONFIG_KEYPAD == IHIFI_PAD
diff --git a/apps/keymaps/keymap-nwza860.c b/apps/keymaps/keymap-nwza860.c
new file mode 100644
index 0000000000..f1a3bb6f85
--- /dev/null
+++ b/apps/keymaps/keymap-nwza860.c
@@ -0,0 +1,289 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright © Amaury Pouly 2017
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#include "config.h"
23#include "action.h"
24#include "button.h"
25#include "settings.h"
26
27/* {Action Code, Button code, Prereq button code } */
28
29/*
30 * The format of the list is as follows
31 * { Action Code, Button code, Prereq button code }
32 * if there's no need to check the previous button's value, use BUTTON_NONE
33 * Insert LAST_ITEM_IN_LIST at the end of each mapping
34 */
35static const struct button_mapping button_context_standard[] = {
36 { ACTION_STD_PREV, BUTTON_FF, BUTTON_NONE },
37 { ACTION_STD_PREVREPEAT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
38 { ACTION_STD_NEXT, BUTTON_REW, BUTTON_NONE },
39 { ACTION_STD_NEXTREPEAT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
40
41 { ACTION_STD_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
42
43 { ACTION_STD_MENU, BUTTON_BACK, BUTTON_NONE },
44 { ACTION_STD_MENU, BUTTON_BACK|BUTTON_REPEAT, BUTTON_NONE },
45 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
46
47 LAST_ITEM_IN_LIST
48}; /* button_context_standard */
49
50static const struct button_mapping button_context_wps[] = {
51 { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
52 { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
53
54 { ACTION_WPS_SKIPNEXT, BUTTON_FF|BUTTON_REL, BUTTON_RIGHT },
55 { ACTION_WPS_SEEKFWD, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
56 { ACTION_WPS_SKIPPREV, BUTTON_REW|BUTTON_REL, BUTTON_LEFT },
57 { ACTION_WPS_SEEKBACK, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
58 { ACTION_WPS_STOPSEEK, BUTTON_REW|BUTTON_REL, BUTTON_REW|BUTTON_REPEAT },
59 { ACTION_WPS_STOPSEEK, BUTTON_FF|BUTTON_REL, BUTTON_FF|BUTTON_REPEAT },
60
61 { ACTION_WPS_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
62 { ACTION_WPS_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
63 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
64 { ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
65
66 { ACTION_WPS_MENU, BUTTON_BACK|BUTTON_REPEAT, BUTTON_NONE },
67 { ACTION_WPS_BROWSE, BUTTON_BACK|BUTTON_REL, BUTTON_BACK },
68
69 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
70}; /* button_context_wps */
71
72static const struct button_mapping button_context_keyboard[] = {
73 LAST_ITEM_IN_LIST
74}; /* button_context_keyboard */
75
76static const struct button_mapping button_context_quickscreen[] = {
77 { ACTION_STD_CANCEL, BUTTON_PLAY, BUTTON_NONE },
78 { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
79
80 LAST_ITEM_IN_LIST
81}; /* button_context_quickscreen */
82
83static const struct button_mapping button_context_tree[] = {
84 { ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
85 { ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
86
87 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
88}; /* button_context_tree */
89
90static const struct button_mapping button_context_list[] = {
91 { ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
92 { ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
93 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
94 { ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
95
96 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
97}; /* button_context_list */
98
99#ifdef CONFIG_TUNER
100static const struct button_mapping button_context_radio[] = {
101 { ACTION_FM_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
102 { ACTION_FM_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
103
104 { ACTION_FM_EXIT, BUTTON_BACK, BUTTON_NONE },
105
106 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
107}; /* button_context_radio */
108#endif
109
110#ifdef HAVE_RECORDING
111static const struct button_mapping button_context_recscreen[] = {
112 { ACTION_REC_PAUSE, BUTTON_PLAY, BUTTON_NONE },
113 { ACTION_SETTINGS_INC, BUTTON_FF, BUTTON_NONE },
114 { ACTION_SETTINGS_INCREPEAT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
115 { ACTION_SETTINGS_DEC, BUTTON_REW, BUTTON_NONE },
116 { ACTION_SETTINGS_DECREPEAT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
117
118 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
119}; /* button_context_recscreen */
120#endif
121
122static const struct button_mapping button_context_settings[] = {
123 { ACTION_SETTINGS_INC, BUTTON_VOL_UP, BUTTON_NONE },
124 { ACTION_SETTINGS_INCREPEAT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
125 { ACTION_SETTINGS_DEC, BUTTON_VOL_DOWN, BUTTON_NONE },
126 { ACTION_SETTINGS_DECREPEAT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
127
128 { ACTION_SETTINGS_RESET, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
129
130 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
131}; /* button_context_settings */
132
133static const struct button_mapping button_context_settings_right_is_inc[] = {
134
135 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
136}; /* button_context_settings */
137
138static const struct button_mapping button_context_time[] = {
139
140 { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
141 { ACTION_STD_OK, BUTTON_PLAY, BUTTON_NONE },
142
143 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
144}; /* button_context_time */
145
146static const struct button_mapping button_context_colorchooser[] = {
147 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
148 { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
149
150 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
151}; /* button_context_colorchooser */
152
153static const struct button_mapping button_context_eq[] = {
154 { ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
155 { ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
156
157 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
158}; /* button_context_eq */
159
160/* Bookmark Screen */
161static const struct button_mapping button_context_bmark[] = {
162 { ACTION_BMS_DELETE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
163
164 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
165}; /* button_context_bmark */
166
167static const struct button_mapping button_context_pitchscreen[] = {
168 { ACTION_PS_RESET, BUTTON_PLAY, BUTTON_NONE },
169 { ACTION_PS_EXIT, BUTTON_BACK, BUTTON_NONE },
170
171 LAST_ITEM_IN_LIST
172}; /* button_context_pitchcreen */
173
174static const struct button_mapping button_context_yesno[] = {
175 { ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE },
176
177 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
178}; /* button_context_yesno */
179
180#ifdef USB_ENABLE_HID
181static const struct button_mapping button_context_usb_hid[] = {
182
183 LAST_ITEM_IN_LIST
184}; /* button_context_usb_hid */
185
186static const struct button_mapping button_context_usb_hid_mode_multimedia[] = {
187
188 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
189 { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
190 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP, BUTTON_NONE },
191 { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
192 { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_BACK|BUTTON_REL, BUTTON_BACK },
193 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
194 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
195 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_REW|BUTTON_REL, BUTTON_LEFT },
196 { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_FF|BUTTON_REL, BUTTON_RIGHT },
197
198 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
199}; /* button_context_usb_hid_mode_multimedia */
200
201static const struct button_mapping button_context_usb_hid_mode_presentation[] = {
202 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
203 { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
204 { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_REW|BUTTON_REL, BUTTON_REW },
205 { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_FF|BUTTON_REL, BUTTON_FF },
206 { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
207 { ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
208 { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_PLAY, BUTTON_PLAY },
209 { ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
210
211 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
212}; /* button_context_usb_hid_mode_presentation */
213
214static const struct button_mapping button_context_usb_hid_mode_browser[] = {
215
216 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
217}; /* button_context_usb_hid_mode_browser */
218
219#ifdef HAVE_USB_HID_MOUSE
220static const struct button_mapping button_context_usb_hid_mode_mouse[] = {
221 LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
222}; /* button_context_usb_hid_mode_mouse */
223#endif
224#endif
225
226const struct button_mapping* target_get_context_mapping(int context)
227{
228 switch (context)
229 {
230 case CONTEXT_STD:
231 return button_context_standard;
232 case CONTEXT_MAINMENU:
233 return button_context_tree;
234 case CONTEXT_SETTINGS:
235 return button_context_settings;
236 case CONTEXT_WPS:
237 return button_context_wps;
238 case CONTEXT_YESNOSCREEN:
239 return button_context_yesno;
240 case CONTEXT_SETTINGS_TIME:
241 return button_context_time;
242 case CONTEXT_KEYBOARD:
243 case CONTEXT_MORSE_INPUT:
244 return button_context_keyboard;
245#ifdef CONFIG_TUNER
246 case CONTEXT_FM:
247 return button_context_radio;
248#endif
249 case CONTEXT_LIST:
250 return button_context_list;
251 case CONTEXT_TREE:
252 return button_context_tree;
253 case CONTEXT_SETTINGS_EQ:
254 return button_context_eq;
255#ifdef HAVE_RECORDING
256 case CONTEXT_RECSCREEN:
257 return button_context_recscreen;
258#endif
259 case CONTEXT_QUICKSCREEN:
260 return button_context_quickscreen;
261 case CONTEXT_BOOKMARKSCREEN:
262 return button_context_bmark;
263 case CONTEXT_PITCHSCREEN:
264 return button_context_pitchscreen;
265 case CONTEXT_SETTINGS_COLOURCHOOSER:
266 return button_context_colorchooser;
267 case CONTEXT_SETTINGS_RECTRIGGER:
268 return button_context_settings_right_is_inc;
269 case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
270 return button_context_settings_right_is_inc;
271#ifdef USB_ENABLE_HID
272 case CONTEXT_USB_HID:
273 return button_context_usb_hid;
274 case CONTEXT_USB_HID_MODE_MULTIMEDIA:
275 return button_context_usb_hid_mode_multimedia;
276 case CONTEXT_USB_HID_MODE_PRESENTATION:
277 return button_context_usb_hid_mode_presentation;
278 case CONTEXT_USB_HID_MODE_BROWSER:
279 return button_context_usb_hid_mode_browser;
280#ifdef HAVE_USB_HID_MOUSE
281 case CONTEXT_USB_HID_MODE_MOUSE:
282 return button_context_usb_hid_mode_mouse;
283#endif
284#endif
285 default:
286 return button_context_standard;
287 }
288 return button_context_standard;
289}
diff --git a/bootloader/nwz_linux.c b/bootloader/nwz_linux.c
index 7fe635bf76..cac9909d2d 100644
--- a/bootloader/nwz_linux.c
+++ b/bootloader/nwz_linux.c
@@ -63,6 +63,15 @@
63#error toolsicon has the wrong resolution 63#error toolsicon has the wrong resolution
64#endif 64#endif
65 65
66/* the A860 does not have left/right/up/down but it has rew/ff so pretend we
67 * always have rew/ff */
68#ifndef BUTTON_REW
69#define BUTTON_REW BUTTON_LEFT
70#endif
71#ifndef BUTTON_FF
72#define BUTTON_FF BUTTON_RIGHT
73#endif
74
66/* buffer for Sony image, filled from NVP */ 75/* buffer for Sony image, filled from NVP */
67unsigned short sonyicon[ICON_WIDTH * ICON_HEIGHT]; 76unsigned short sonyicon[ICON_WIDTH * ICON_HEIGHT];
68const struct bitmap bm_sonyicon = 77const struct bitmap bm_sonyicon =
@@ -257,9 +266,9 @@ enum boot_mode get_boot_mode(void)
257 if(btn == BUTTON_PLAY) 266 if(btn == BUTTON_PLAY)
258 break; 267 break;
259 /* left/right/up/down: change mode */ 268 /* left/right/up/down: change mode */
260 if(btn == BUTTON_LEFT || btn == BUTTON_DOWN) 269 if(btn == BUTTON_LEFT || btn == BUTTON_DOWN || btn == BUTTON_REW)
261 mode = (mode + BOOT_COUNT - 1) % BOOT_COUNT; 270 mode = (mode + BOOT_COUNT - 1) % BOOT_COUNT;
262 if(btn == BUTTON_RIGHT || btn == BUTTON_UP) 271 if(btn == BUTTON_RIGHT || btn == BUTTON_UP || btn == BUTTON_FF)
263 mode = (mode + 1) % BOOT_COUNT; 272 mode = (mode + 1) % BOOT_COUNT;
264 } 273 }
265 274
@@ -340,9 +349,9 @@ int choice_screen(const char *title, bool center, int nr_choices, const char *ch
340 return btn == BUTTON_PLAY ? choice : -1; 349 return btn == BUTTON_PLAY ? choice : -1;
341 } 350 }
342 /* left/right/up/down: change mode */ 351 /* left/right/up/down: change mode */
343 if(btn == BUTTON_LEFT || btn == BUTTON_UP) 352 if(btn == BUTTON_LEFT || btn == BUTTON_UP || btn == BUTTON_REW)
344 choice = (choice + nr_choices - 1) % nr_choices; 353 choice = (choice + nr_choices - 1) % nr_choices;
345 if(btn == BUTTON_RIGHT || btn == BUTTON_DOWN) 354 if(btn == BUTTON_RIGHT || btn == BUTTON_DOWN || btn == BUTTON_FF)
346 choice = (choice + 1) % nr_choices; 355 choice = (choice + 1) % nr_choices;
347 } 356 }
348} 357}
diff --git a/firmware/export/config.h b/firmware/export/config.h
index f98ccbd853..abe815d70d 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -165,6 +165,7 @@
165#define SAMSUNG_YPR1_PAD 61 165#define SAMSUNG_YPR1_PAD 61
166#define SAMSUNG_YH92X_PAD 62 166#define SAMSUNG_YH92X_PAD 62
167#define DX50_PAD 63 167#define DX50_PAD 63
168#define SONY_NWZA860_PAD 64 /* The NWZ-A860 is too different (touchscreen) */
168 169
169/* CONFIG_REMOTE_KEYPAD */ 170/* CONFIG_REMOTE_KEYPAD */
170#define H100_REMOTE 1 171#define H100_REMOTE 1
@@ -594,6 +595,8 @@ Lyre prototype 1 */
594#include "config/sonynwa20.h" 595#include "config/sonynwa20.h"
595#elif defined(SONY_NWZE470) 596#elif defined(SONY_NWZE470)
596#include "config/sonynwze470.h" 597#include "config/sonynwze470.h"
598#elif defined(SONY_NWZA860)
599#include "config/sonynwza860.h"
597#else 600#else
598/* no known platform */ 601/* no known platform */
599#endif 602#endif
diff --git a/firmware/export/config/sonynwza860.h b/firmware/export/config/sonynwza860.h
new file mode 100644
index 0000000000..f61dd7a4dd
--- /dev/null
+++ b/firmware/export/config/sonynwza860.h
@@ -0,0 +1,24 @@
1/*
2 * This config file is for the Sony NWZ-A860 series
3 */
4
5/* For Rolo and boot loader */
6#define MODEL_NUMBER 107
7
8#define MODEL_NAME "Sony NWZ-A860 Series"
9
10/* LCD dimensions */
11#define LCD_WIDTH 240
12#define LCD_HEIGHT 400
13/* sqrt(240^2 + 400^2) / 2.8 = 166 */
14#define LCD_DPI 166
15
16/* this device has a touchscreen */
17#define HAVE_TOUCHSCREEN
18#define HAVE_BUTTON_DATA
19
20#include "sonynwzlinux.h"
21
22/* override keypad */
23#undef CONFIG_KEYPAD
24#define CONFIG_KEYPAD SONY_NWZA860_PAD
diff --git a/firmware/target/hosted/sonynwz/button-nwz.c b/firmware/target/hosted/sonynwz/button-nwz.c
index 3be74fc924..2fb23e1471 100644
--- a/firmware/target/hosted/sonynwz/button-nwz.c
+++ b/firmware/target/hosted/sonynwz/button-nwz.c
@@ -18,7 +18,7 @@
18 * 18 *
19 ****************************************************************************/ 19 ****************************************************************************/
20#include "button.h" 20#include "button.h"
21#define LOGF_ENABLE 21//#define LOGF_ENABLE
22#include "logf.h" 22#include "logf.h"
23#include "panic.h" 23#include "panic.h"
24#include "backlight.h" 24#include "backlight.h"
@@ -192,6 +192,19 @@ static void open_input_device(const char *path)
192 poll_nfds++; 192 poll_nfds++;
193} 193}
194 194
195#if defined(SONY_NWZA860)
196/* keycode -> rockbox button mapping */
197static int button_map[NWZ_KEY_MASK + 1] =
198{
199 [0 ... NWZ_KEY_MASK] = 0,
200 [NWZ_KEY_PLAY] = BUTTON_PLAY,
201 [NWZ_KEY_RIGHT] = BUTTON_FF,
202 [NWZ_KEY_LEFT] = BUTTON_REW,
203 [NWZ_KEY_VOL_DOWN] = BUTTON_VOL_DOWN,
204 [NWZ_KEY_VOL_UP] = BUTTON_VOL_UP,
205 [NWZ_KEY_BACK] = BUTTON_BACK,
206};
207#else /* SONY_NWZA860 */
195/* keycode -> rockbox button mapping */ 208/* keycode -> rockbox button mapping */
196static int button_map[NWZ_KEY_MASK + 1] = 209static int button_map[NWZ_KEY_MASK + 1] =
197{ 210{
@@ -214,6 +227,7 @@ static int button_map[NWZ_KEY_MASK + 1] =
214 [NWZ_KEY_AD1_6] = 0, 227 [NWZ_KEY_AD1_6] = 0,
215 [NWZ_KEY_AD1_7] = 0, 228 [NWZ_KEY_AD1_7] = 0,
216}; 229};
230#endif /* SONY_NWZA860 */
217 231
218static void handle_key(struct input_event evt) 232static void handle_key(struct input_event evt)
219{ 233{
@@ -296,11 +310,16 @@ int button_read_device(
296#endif 310#endif
297 } 311 }
298 } 312 }
313 int btns = button_bitmap;
299#ifdef HAVE_TOUCHSCREEN 314#ifdef HAVE_TOUCHSCREEN
315 /* WARNING we must call touchscreen_to_pixels even if there is no touch,
316 * otherwsise *data is not filled with the last position and it breaks
317 * everything */
318 int touch_bitmap = touchscreen_to_pixels(touch_x, touch_y, data);
300 if(touch_detect) 319 if(touch_detect)
301 button_bitmap |= touchscreen_to_pixels(touch_x, touch_y, data); 320 btns |= touch_bitmap;
302#endif 321#endif
303 return hold_status ? 0 : button_bitmap; 322 return hold_status ? 0 : btns;
304} 323}
305 324
306void nwz_button_reload_after_suspend(void) 325void nwz_button_reload_after_suspend(void)
diff --git a/firmware/target/hosted/sonynwz/button-target.h b/firmware/target/hosted/sonynwz/button-target.h
index 6cf915b4ad..5070728236 100644
--- a/firmware/target/hosted/sonynwz/button-target.h
+++ b/firmware/target/hosted/sonynwz/button-target.h
@@ -24,6 +24,40 @@
24#include <stdbool.h> 24#include <stdbool.h>
25#include "config.h" 25#include "config.h"
26 26
27/* The NWZ-A860 is completely different, it has a touchscreen and some but not
28 * all keys of the other others */
29#if defined(SONY_NWZA860)
30
31/* Main unit's buttons */
32#define BUTTON_BACK 0x00000001 /* HOME */
33#define BUTTON_PLAY 0x00000002
34#define BUTTON_REW 0x00000004
35#define BUTTON_FF 0x00000008
36#define BUTTON_VOL_DOWN 0x00000010
37#define BUTTON_VOL_UP 0x00000020
38/* For compatibility */
39#define BUTTON_LEFT BUTTON_MIDLEFT
40#define BUTTON_RIGHT BUTTON_MIDRIGHT
41#define BUTTON_UP BUTTON_TOPMIDDLE
42#define BUTTON_DOWN BUTTON_BOTTOMMIDDLE
43
44/* Touch Screen Area Buttons */
45#define BUTTON_TOPLEFT 0x00000040
46#define BUTTON_TOPMIDDLE 0x00000080
47#define BUTTON_TOPRIGHT 0x00000100
48#define BUTTON_MIDLEFT 0x00000200
49#define BUTTON_CENTER 0x00000400
50#define BUTTON_MIDRIGHT 0x00000800
51#define BUTTON_BOTTOMLEFT 0x00001000
52#define BUTTON_BOTTOMMIDDLE 0x00002000
53#define BUTTON_BOTTOMRIGHT 0x00004000
54
55#define BUTTON_MAIN 0x7fff
56
57#define POWEROFF_BUTTON BUTTON_BACK
58
59#else /* SONY_NWZA860 */
60
27/* Main unit's buttons */ 61/* Main unit's buttons */
28#define BUTTON_POWER 0x00000001 62#define BUTTON_POWER 0x00000001
29#define BUTTON_BACK 0x00000002 63#define BUTTON_BACK 0x00000002
@@ -37,8 +71,11 @@
37 71
38#define BUTTON_MAIN 0x000001ff 72#define BUTTON_MAIN 0x000001ff
39 73
74#define POWEROFF_BUTTON BUTTON_POWER
75
76#endif /* SONY_NWZA860 */
77
40/* Software power-off */ 78/* Software power-off */
41#define POWEROFF_BUTTON BUTTON_POWER
42#define POWEROFF_COUNT 10 79#define POWEROFF_COUNT 10
43 80
44/* force driver to reload button state (useful after suspend) */ 81/* force driver to reload button state (useful after suspend) */
diff --git a/rbutil/mknwzboot/mknwzboot.c b/rbutil/mknwzboot/mknwzboot.c
index 6fd20b26b4..73792c31cc 100644
--- a/rbutil/mknwzboot/mknwzboot.c
+++ b/rbutil/mknwzboot/mknwzboot.c
@@ -50,6 +50,7 @@ static const struct nwz_model_desc_t nwz_models[] =
50 { "Sony NWZ-E580 Series", "e580", 102, "nwz-e580" }, 50 { "Sony NWZ-E580 Series", "e580", 102, "nwz-e580" },
51 { "Sony NWZ-A10 Series", "a10", 104, "nwz-a10" }, 51 { "Sony NWZ-A10 Series", "a10", 104, "nwz-a10" },
52 { "Sony NW-A20 Series", "a20", 106, "nw-a20" }, 52 { "Sony NW-A20 Series", "a20", 106, "nw-a20" },
53 { "Sony NWZ-A860 Series", "a860", 107, "nwz-a860" },
53}; 54};
54 55
55#define NR_NWZ_MODELS (sizeof(nwz_models) / sizeof(nwz_models[0])) 56#define NR_NWZ_MODELS (sizeof(nwz_models) / sizeof(nwz_models[0]))
diff --git a/tools/configure b/tools/configure
index bfc581f6c0..52eef68008 100755
--- a/tools/configure
+++ b/tools/configure
@@ -1512,7 +1512,7 @@ cat <<EOF
1512 208) Samsung YP-R1 231) 960 225) NWZ-E580 series 1512 208) Samsung YP-R1 231) 960 225) NWZ-E580 series
1513 226) NWZ-A10 series 1513 226) NWZ-A10 series
1514 ==iBasso== 227) NW-A20 series 1514 ==iBasso== 227) NW-A20 series
1515 232) DX50 1515 232) DX50 228) NWZ-A860 series
1516 233) DX90 1516 233) DX90
1517 1517
1518EOF 1518EOF
@@ -4007,6 +4007,29 @@ fi
4007 sonynwzcc 4007 sonynwzcc
4008 ;; 4008 ;;
4009 4009
4010 228|sonynwza860)
4011 application="yes"
4012 target_id=103
4013 modelname="sonynwza860"
4014 target="SONY_NWZA860"
4015 memory=16
4016 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
4017 bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
4018 tool="cp"
4019 output="rockbox.sony"
4020 boottool="$rootdir/tools/scramble -add=a860"
4021 bootoutput="bootloader-nwza860.sony"
4022 appextra="gui:recorder"
4023 plugins=""
4024 swcodec="yes"
4025 toolset=$genericbitmaptools
4026 t_cpu="hosted"
4027 t_manufacturer="sonynwz"
4028 t_model="nwza860"
4029 uname=`uname`
4030 sonynwzcc
4031 ;;
4032
4010 230|ihifi760) 4033 230|ihifi760)
4011 target_id=92 4034 target_id=92
4012 modelname="ihifi760" 4035 modelname="ihifi760"
diff --git a/tools/scramble.c b/tools/scramble.c
index 935eae002f..5ff45b3e44 100644
--- a/tools/scramble.c
+++ b/tools/scramble.c
@@ -130,7 +130,7 @@ void usage(void)
130 "\t 747p, x777, nn2g, m244, cli+, fuz2, hd20, hd30,\n" 130 "\t 747p, x777, nn2g, m244, cli+, fuz2, hd20, hd30,\n"
131 "\t ip6g, rk27, clzp, zxf2, zxf3, fuz+, e370, e360,\n" 131 "\t ip6g, rk27, clzp, zxf2, zxf3, fuz+, e370, e360,\n"
132 "\t zxfi, zmoz, zen, zenv, ypz5, zxfs, e450, e460,\n" 132 "\t zxfi, zmoz, zen, zenv, ypz5, zxfs, e450, e460,\n"
133 "\t e470,e580,a10,a20)\n"); 133 "\t e470,e580,a10,a20,a860)\n");
134 printf("\nNo option results in Archos standard player/recorder format.\n"); 134 printf("\nNo option results in Archos standard player/recorder format.\n");
135 135
136 exit(1); 136 exit(1);
@@ -395,6 +395,8 @@ int main (int argc, char** argv)
395 modelnum = 104; 395 modelnum = 104;
396 else if (!strcmp(&argv[1][5], "a20")) /* Sony NW-A20 series */ 396 else if (!strcmp(&argv[1][5], "a20")) /* Sony NW-A20 series */
397 modelnum = 106; 397 modelnum = 106;
398 else if (!strcmp(&argv[1][5], "a860")) /* Sony NWZ-A860 series */
399 modelnum = 107;
398 else { 400 else {
399 fprintf(stderr, "unsupported model: %s\n", &argv[1][5]); 401 fprintf(stderr, "unsupported model: %s\n", &argv[1][5]);
400 return 2; 402 return 2;