diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 55454e0b94..5224dbe267 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -2594,7 +2594,7 @@ static const struct { #endif { "Skin Engine RAM usage", dbg_skin_engine }, #endif -#if (CONFIG_PLATFORM & PLATFORM_NATIVE) || defined(SONY_NWZ_LINUX) +#if (CONFIG_PLATFORM & PLATFORM_NATIVE) || (defined(SONY_NWZ_LINUX) && !defined(SIMULATOR)) { "View HW info", dbg_hw_info }, #endif #if (CONFIG_PLATFORM & PLATFORM_NATIVE) diff --git a/firmware/SOURCES b/firmware/SOURCES index 8ec17f7ec6..c29b5318d5 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -95,12 +95,11 @@ target/hosted/samsungypr/radio-ypr.c #endif #endif -#ifdef SONY_NWZ_LINUX +#if defined(SONY_NWZ_LINUX) && !defined(SIMULATOR) target/hosted/backtrace-glibc.c target/hosted/kernel-unix.c target/hosted/filesystem-unix.c target/hosted/lc-unix.c -target/hosted/pcm-alsa.c target/hosted/sonynwz/lcd-nwz.c target/hosted/sonynwz/button-nwz.c target/hosted/sonynwz/system-nwz.c @@ -467,6 +466,7 @@ target/hosted/pcm-alsa.c #elif defined(HAVE_NWZ_LINUX_CODEC) drivers/audio/nwzlinux-codec.c target/hosted/alsa-controls.c +target/hosted/pcm-alsa.c #elif defined(HAVE_SDL_AUDIO) drivers/audio/sdl.c #if CONFIG_CODEC == SWCODEC diff --git a/firmware/export/config/sonynwzlinux.h b/firmware/export/config/sonynwzlinux.h index 4c66651e6b..4d95ef9cdd 100644 --- a/firmware/export/config/sonynwzlinux.h +++ b/firmware/export/config/sonynwzlinux.h @@ -2,7 +2,9 @@ * This config file is for the Sony NWZ Linux based targets */ +#ifndef SIMULATOR #define CONFIG_PLATFORM (PLATFORM_HOSTED) +#endif /* define this if you have a bitmap LCD display */ #define HAVE_LCD_BITMAP @@ -64,10 +66,17 @@ #define CONFIG_KEYPAD SONY_NWZ_PAD #define HAS_BUTTON_HOLD +/** Non-simulator section **/ +#ifndef SIMULATOR /* We have usb power and can detect usb but it is handled by Linux */ #define HAVE_USB_POWER #define USB_NONE +/* Audio codec */ +#define HAVE_NWZ_LINUX_CODEC + +#endif /* SIMULATOR */ + #define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE /* Linux controlls charging, we can monitor */ @@ -92,9 +101,6 @@ /* Battery */ #define BATTERY_TYPES_COUNT 1 -/* Audio codec */ -#define HAVE_NWZ_LINUX_CODEC - /* special define to be use in various places */ #define SONY_NWZ_LINUX diff --git a/firmware/export/hostfs.h b/firmware/export/hostfs.h index a24d009ca9..fa916870f3 100644 --- a/firmware/export/hostfs.h +++ b/firmware/export/hostfs.h @@ -60,6 +60,9 @@ extern int hostfs_driver_type(int drive); # define hostfs_driver_type(drive) (STORAGE_NAND_NUM) # elif (CONFIG_STORAGE & STORAGE_RAMDISK) # define hostfs_driver_type(drive) (STORAGE_RAMDISK_NUM) +/* we may have hostfs without application when building sims for applications! */ +# elif (CONFIG_STORAGE & STORAGE_HOSTFS) +# define hostfs_driver_type(drive) (STORAGE_HOSTFS_NUM) # else # error Unknown storage driver # endif /* CONFIG_STORAGE */ diff --git a/firmware/target/hosted/sdl/sim-ui-defines.h b/firmware/target/hosted/sdl/sim-ui-defines.h index 8f2a112cf9..d14f70bf99 100644 --- a/firmware/target/hosted/sdl/sim-ui-defines.h +++ b/firmware/target/hosted/sdl/sim-ui-defines.h @@ -508,6 +508,13 @@ #define UI_LCD_POSX 46 #define UI_LCD_POSY 40 +#elif defined(SONY_NWZA860) +#define UI_TITLE "Sony NWZ-A860 Series" +#define UI_WIDTH 390 /* width of GUI window */ +#define UI_HEIGHT 690/* height of GUI window */ +#define UI_LCD_POSX 78 +#define UI_LCD_POSY 92 + #elif defined(SIMULATOR) #error no UI defines #endif diff --git a/uisimulator/bitmaps/UI-sonynwza860.bmp b/uisimulator/bitmaps/UI-sonynwza860.bmp new file mode 100644 index 0000000000..c8b9b6335c Binary files /dev/null and b/uisimulator/bitmaps/UI-sonynwza860.bmp differ diff --git a/uisimulator/buttonmap/SOURCES b/uisimulator/buttonmap/SOURCES index 7f361959f4..6acbd94624 100644 --- a/uisimulator/buttonmap/SOURCES +++ b/uisimulator/buttonmap/SOURCES @@ -81,5 +81,7 @@ sony-nwz.c samsung-ypr0.c #elif CONFIG_KEYPAD == CREATIVE_ZEN_PAD creative-zen.c +#elif CONFIG_KEYPAD == SONY_NWZA860_PAD +sony-nwza860.c #endif #endif /* SIMULATOR */ diff --git a/uisimulator/buttonmap/sony-nwza860.c b/uisimulator/buttonmap/sony-nwza860.c new file mode 100644 index 0000000000..c117c0afb0 --- /dev/null +++ b/uisimulator/buttonmap/sony-nwza860.c @@ -0,0 +1,65 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2017 by 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 "button.h" +#include "buttonmap.h" + +int key_to_button(int keyboard_button) +{ + int new_btn = BUTTON_NONE; + switch (keyboard_button) + { + case SDLK_F1: + new_btn = BUTTON_REW; + break; + case SDLK_F2: + new_btn = BUTTON_FF; + break; + case SDLK_KP_PLUS: + new_btn = BUTTON_VOL_UP; + break; + case SDLK_KP_MINUS: + new_btn = BUTTON_VOL_DOWN; + break; + case SDLK_KP1: + case SDLK_HOME: + case SDLK_BACKSPACE: + new_btn = BUTTON_BACK; + break; + case SDLK_F3: + new_btn = BUTTON_PLAY; + break; + } + printf("btn: %d -> %x\n", keyboard_button, new_btn); + return new_btn; +} + +struct button_map bm[] = { + { SDLK_F1, 368, 490, 30, "Rewind" }, + { SDLK_F2, 368, 384, 30, "Fast Forward" }, + { SDLK_BACKSPACE, 197, 651, 50, "Home" }, + { SDLK_F3, 368, 435, 30, "Play" }, + { SDLK_KP_MINUS, 368, 166, 30, "Volume -" }, + { SDLK_KP_PLUS, 368, 226, 30, "Volume +" }, + { 0, 0, 0, 0, "None" } +};