Add simulator support for the A860

This requires a few changes unrelated to the A860 because configure unsets
APPLICATION but the NWZ is an application!

Change-Id: Id91aa23193383ac95886b281653da5286edd9caf
This commit is contained in:
Amaury Pouly 2017-09-16 23:29:50 +02:00
parent ac57f96838
commit a0fca0c7bf
8 changed files with 89 additions and 6 deletions

View file

@ -2594,7 +2594,7 @@ static const struct {
#endif #endif
{ "Skin Engine RAM usage", dbg_skin_engine }, { "Skin Engine RAM usage", dbg_skin_engine },
#endif #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 }, { "View HW info", dbg_hw_info },
#endif #endif
#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #if (CONFIG_PLATFORM & PLATFORM_NATIVE)

View file

@ -95,12 +95,11 @@ target/hosted/samsungypr/radio-ypr.c
#endif #endif
#endif #endif
#ifdef SONY_NWZ_LINUX #if defined(SONY_NWZ_LINUX) && !defined(SIMULATOR)
target/hosted/backtrace-glibc.c target/hosted/backtrace-glibc.c
target/hosted/kernel-unix.c target/hosted/kernel-unix.c
target/hosted/filesystem-unix.c target/hosted/filesystem-unix.c
target/hosted/lc-unix.c target/hosted/lc-unix.c
target/hosted/pcm-alsa.c
target/hosted/sonynwz/lcd-nwz.c target/hosted/sonynwz/lcd-nwz.c
target/hosted/sonynwz/button-nwz.c target/hosted/sonynwz/button-nwz.c
target/hosted/sonynwz/system-nwz.c target/hosted/sonynwz/system-nwz.c
@ -467,6 +466,7 @@ target/hosted/pcm-alsa.c
#elif defined(HAVE_NWZ_LINUX_CODEC) #elif defined(HAVE_NWZ_LINUX_CODEC)
drivers/audio/nwzlinux-codec.c drivers/audio/nwzlinux-codec.c
target/hosted/alsa-controls.c target/hosted/alsa-controls.c
target/hosted/pcm-alsa.c
#elif defined(HAVE_SDL_AUDIO) #elif defined(HAVE_SDL_AUDIO)
drivers/audio/sdl.c drivers/audio/sdl.c
#if CONFIG_CODEC == SWCODEC #if CONFIG_CODEC == SWCODEC

View file

@ -2,7 +2,9 @@
* This config file is for the Sony NWZ Linux based targets * This config file is for the Sony NWZ Linux based targets
*/ */
#ifndef SIMULATOR
#define CONFIG_PLATFORM (PLATFORM_HOSTED) #define CONFIG_PLATFORM (PLATFORM_HOSTED)
#endif
/* define this if you have a bitmap LCD display */ /* define this if you have a bitmap LCD display */
#define HAVE_LCD_BITMAP #define HAVE_LCD_BITMAP
@ -64,10 +66,17 @@
#define CONFIG_KEYPAD SONY_NWZ_PAD #define CONFIG_KEYPAD SONY_NWZ_PAD
#define HAS_BUTTON_HOLD #define HAS_BUTTON_HOLD
/** Non-simulator section **/
#ifndef SIMULATOR
/* We have usb power and can detect usb but it is handled by Linux */ /* We have usb power and can detect usb but it is handled by Linux */
#define HAVE_USB_POWER #define HAVE_USB_POWER
#define USB_NONE #define USB_NONE
/* Audio codec */
#define HAVE_NWZ_LINUX_CODEC
#endif /* SIMULATOR */
#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE #define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
/* Linux controlls charging, we can monitor */ /* Linux controlls charging, we can monitor */
@ -92,9 +101,6 @@
/* Battery */ /* Battery */
#define BATTERY_TYPES_COUNT 1 #define BATTERY_TYPES_COUNT 1
/* Audio codec */
#define HAVE_NWZ_LINUX_CODEC
/* special define to be use in various places */ /* special define to be use in various places */
#define SONY_NWZ_LINUX #define SONY_NWZ_LINUX

View file

@ -60,6 +60,9 @@ extern int hostfs_driver_type(int drive);
# define hostfs_driver_type(drive) (STORAGE_NAND_NUM) # define hostfs_driver_type(drive) (STORAGE_NAND_NUM)
# elif (CONFIG_STORAGE & STORAGE_RAMDISK) # elif (CONFIG_STORAGE & STORAGE_RAMDISK)
# define hostfs_driver_type(drive) (STORAGE_RAMDISK_NUM) # 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 # else
# error Unknown storage driver # error Unknown storage driver
# endif /* CONFIG_STORAGE */ # endif /* CONFIG_STORAGE */

View file

@ -508,6 +508,13 @@
#define UI_LCD_POSX 46 #define UI_LCD_POSX 46
#define UI_LCD_POSY 40 #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) #elif defined(SIMULATOR)
#error no UI defines #error no UI defines
#endif #endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 790 KiB

View file

@ -81,5 +81,7 @@ sony-nwz.c
samsung-ypr0.c samsung-ypr0.c
#elif CONFIG_KEYPAD == CREATIVE_ZEN_PAD #elif CONFIG_KEYPAD == CREATIVE_ZEN_PAD
creative-zen.c creative-zen.c
#elif CONFIG_KEYPAD == SONY_NWZA860_PAD
sony-nwza860.c
#endif #endif
#endif /* SIMULATOR */ #endif /* SIMULATOR */

View file

@ -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 <SDL.h>
#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" }
};