summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenzo Miori <memoryS60@gmail.com>2013-09-16 00:02:28 +0200
committerFrank Gevaerts <frank@gevaerts.be>2013-09-29 14:15:48 +0200
commit9a8ed6ba35959f049ec85d8be6ec498fdbb67bb6 (patch)
tree68eb6b6cf52826ffb279b382f2cf389a7466a798
parentd13e5b964e56fb15dcc3990d2e424f4ffdd3db8b (diff)
downloadrockbox-9a8ed6ba35959f049ec85d8be6ec498fdbb67bb6.tar.gz
rockbox-9a8ed6ba35959f049ec85d8be6ec498fdbb67bb6.zip
Simulator for Samsung YP-R0
Enable simulator for the target ypr0 to be built and used. Change-Id: I1b080f07ab90f5c4856881d08ad70e1053bbb0c0 Reviewed-on: http://gerrit.rockbox.org/618 Reviewed-by: Frank Gevaerts <frank@gevaerts.be>
-rw-r--r--firmware/SOURCES4
-rw-r--r--firmware/export/config/samsungypr0.h21
-rw-r--r--firmware/target/hosted/sdl/sim-ui-defines.h7
-rwxr-xr-xtools/configure8
-rw-r--r--uisimulator/bitmaps/UI-samsungypr0.bmpbin0 -> 526456 bytes
-rw-r--r--uisimulator/buttonmap/SOURCES2
-rw-r--r--uisimulator/buttonmap/samsung-ypr0.c81
7 files changed, 114 insertions, 9 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 86bf746df9..884e1102e2 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -14,7 +14,7 @@ powermgmt.c
14target/hosted/cpuinfo-linux.c 14target/hosted/cpuinfo-linux.c
15#endif 15#endif
16 16
17#ifndef SAMSUNG_YPR0 /* uses as3514 rtc */ 17#if !defined(SAMSUNG_YPR0) || defined(SIMULATOR) /* uses as3514 rtc */
18target/hosted/rtc.c 18target/hosted/rtc.c
19#endif 19#endif
20 20
@@ -74,7 +74,7 @@ target/hosted/sdl/app/button-application.c
74#endif 74#endif
75#endif 75#endif
76 76
77#ifdef SAMSUNG_YPR0 77#if defined(SAMSUNG_YPR0) && !defined(SIMULATOR)
78drivers/adc-as3514.c 78drivers/adc-as3514.c
79drivers/lcd-memframe.c 79drivers/lcd-memframe.c
80#if (CONFIG_RTC == RTC_AS3514) 80#if (CONFIG_RTC == RTC_AS3514)
diff --git a/firmware/export/config/samsungypr0.h b/firmware/export/config/samsungypr0.h
index 970879772f..c1266f4732 100644
--- a/firmware/export/config/samsungypr0.h
+++ b/firmware/export/config/samsungypr0.h
@@ -5,16 +5,15 @@
5 5
6/* We don't run on hardware directly */ 6/* We don't run on hardware directly */
7/* YP-R0 need it too of course */ 7/* YP-R0 need it too of course */
8#ifndef SIMULATOR
8#define CONFIG_PLATFORM (PLATFORM_HOSTED) 9#define CONFIG_PLATFORM (PLATFORM_HOSTED)
10#endif
9 11
10/* For Rolo and boot loader */ 12/* For Rolo and boot loader */
11#define MODEL_NUMBER 100 13#define MODEL_NUMBER 100
12 14
13#define MODEL_NAME "Samsung YP-R0" 15#define MODEL_NAME "Samsung YP-R0"
14 16
15/*TODO: implement USB data transfer management -> see safe mode script and think a way to implemtent it in the code */
16#define USB_NONE
17
18/* define this if you have a bitmap LCD display */ 17/* define this if you have a bitmap LCD display */
19#define HAVE_LCD_BITMAP 18#define HAVE_LCD_BITMAP
20 19
@@ -90,6 +89,12 @@
90#define CONFIG_KEYPAD SAMSUNG_YPR0_PAD 89#define CONFIG_KEYPAD SAMSUNG_YPR0_PAD
91#define BUTTON_DRIVER_CLOSE 90#define BUTTON_DRIVER_CLOSE
92 91
92/** Non-simulator section **/
93#ifndef SIMULATOR
94
95/*TODO: implement USB data transfer management -> see safe mode script and think a way to implemtent it in the code */
96#define USB_NONE
97
93/* The YPR0 has a as3534 codec */ 98/* The YPR0 has a as3534 codec */
94#define HAVE_AS3514 99#define HAVE_AS3514
95#define HAVE_AS3543 100#define HAVE_AS3543
@@ -109,6 +114,12 @@
109/* We have a GPIO pin that detects this */ 114/* We have a GPIO pin that detects this */
110#define HAVE_HEADPHONE_DETECTION 115#define HAVE_HEADPHONE_DETECTION
111 116
117/* Define current usage levels. */
118#define CURRENT_NORMAL 24 /* ~25h, on 600mAh that's about 24mA */
119#define CURRENT_BACKLIGHT 62 /* ~6,5h -> 92mA. Minus 24mA normal that gives us 68mA */
120
121#endif /* SIMULATOR */
122
112/* FIXME 123/* FIXME
113 * Lot of people reports bad battery life and funny charging times. 124 * Lot of people reports bad battery life and funny charging times.
114 * Check what's going on... 125 * Check what's going on...
@@ -120,10 +131,6 @@
120#define BATTERY_CAPACITY_INC 0 /* capacity increment */ 131#define BATTERY_CAPACITY_INC 0 /* capacity increment */
121#define BATTERY_TYPES_COUNT 1 /* only one type */ 132#define BATTERY_TYPES_COUNT 1 /* only one type */
122 133
123/* Define current usage levels. */
124#define CURRENT_NORMAL 24 /* ~25h, on 600mAh that's about 24mA */
125#define CURRENT_BACKLIGHT 62 /* ~6,5h -> 92mA. Minus 24mA normal that gives us 68mA */
126
127#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE 134#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
128 135
129/* Linux controlls charging, we can monitor */ 136/* Linux controlls charging, we can monitor */
diff --git a/firmware/target/hosted/sdl/sim-ui-defines.h b/firmware/target/hosted/sdl/sim-ui-defines.h
index de250735e2..b238520aac 100644
--- a/firmware/target/hosted/sdl/sim-ui-defines.h
+++ b/firmware/target/hosted/sdl/sim-ui-defines.h
@@ -473,6 +473,13 @@
473#define UI_WIDTH LCD_WIDTH 473#define UI_WIDTH LCD_WIDTH
474#define UI_HEIGHT LCD_HEIGHT 474#define UI_HEIGHT LCD_HEIGHT
475 475
476#elif defined(SAMSUNG_YPR0)
477#define UI_TITLE "Samsung YP-R0"
478#define UI_WIDTH 313 /* width of GUI window */
479#define UI_HEIGHT 560 /* height of GUI window */
480#define UI_LCD_POSX 36
481#define UI_LCD_POSY 37
482
476#elif defined(SIMULATOR) 483#elif defined(SIMULATOR)
477#error no UI defines 484#error no UI defines
478#endif 485#endif
diff --git a/tools/configure b/tools/configure
index 4e548eea91..8491ffdb35 100755
--- a/tools/configure
+++ b/tools/configure
@@ -3701,6 +3701,14 @@ if [ -z "$debug" ]; then
3701 GCCOPTS="$GCCOPTS $GCCOPTIMIZE" 3701 GCCOPTS="$GCCOPTS $GCCOPTIMIZE"
3702fi 3702fi
3703 3703
3704# if building a simulator for an hosted port, APPLICATION
3705# define clashes with SIMULATOR define
3706
3707if [ "yes" = "$simulator" ]; then
3708 echo Unsetting APPLICATION define for SIMULATOR build
3709 unset application
3710fi
3711
3704if [ "yes" = "$application" ]; then 3712if [ "yes" = "$application" ]; then
3705 echo Building Rockbox as an Application 3713 echo Building Rockbox as an Application
3706 extradefines="$extradefines -DAPPLICATION" 3714 extradefines="$extradefines -DAPPLICATION"
diff --git a/uisimulator/bitmaps/UI-samsungypr0.bmp b/uisimulator/bitmaps/UI-samsungypr0.bmp
new file mode 100644
index 0000000000..ad82b41a11
--- /dev/null
+++ b/uisimulator/bitmaps/UI-samsungypr0.bmp
Binary files differ
diff --git a/uisimulator/buttonmap/SOURCES b/uisimulator/buttonmap/SOURCES
index de9cf51467..bc6e62bcd6 100644
--- a/uisimulator/buttonmap/SOURCES
+++ b/uisimulator/buttonmap/SOURCES
@@ -75,5 +75,7 @@ creative-zenxfi2.c
75sansa-connect.c 75sansa-connect.c
76#elif CONFIG_KEYPAD == SONY_NWZ_PAD 76#elif CONFIG_KEYPAD == SONY_NWZ_PAD
77sony-nwz.c 77sony-nwz.c
78#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
79samsung-ypr0.c
78#endif 80#endif
79#endif /* SIMULATOR */ 81#endif /* SIMULATOR */
diff --git a/uisimulator/buttonmap/samsung-ypr0.c b/uisimulator/buttonmap/samsung-ypr0.c
new file mode 100644
index 0000000000..8936c98296
--- /dev/null
+++ b/uisimulator/buttonmap/samsung-ypr0.c
@@ -0,0 +1,81 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2013 by Lorenzo Miori
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 2
14 * of the License, or (at your option) any later version.
15 *
16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17 * KIND, either express or implied.
18 *
19 ****************************************************************************/
20
21
22#include <SDL.h>
23#include "button.h"
24#include "buttonmap.h"
25
26int key_to_button(int keyboard_button)
27{
28 int new_btn = BUTTON_NONE;
29 switch (keyboard_button)
30 {
31 case SDLK_KP4:
32 case SDLK_LEFT:
33 new_btn = BUTTON_LEFT;
34 break;
35 case SDLK_KP6:
36 case SDLK_RIGHT:
37 new_btn = BUTTON_RIGHT;
38 break;
39 case SDLK_KP8:
40 case SDLK_UP:
41 new_btn = BUTTON_UP;
42 break;
43 case SDLK_KP2:
44 case SDLK_DOWN:
45 new_btn = BUTTON_DOWN;
46 break;
47 case SDLK_PAGEUP:
48 case SDLK_KP9:
49 new_btn = BUTTON_MENU;
50 break;
51 case SDLK_KP7:
52 new_btn = BUTTON_BACK;
53 break;
54 case SDLK_KP5:
55 case SDLK_SPACE:
56 case SDLK_KP_ENTER:
57 case SDLK_RETURN:
58 new_btn = BUTTON_SELECT;
59 break;
60 case SDLK_KP3:
61 new_btn = BUTTON_POWER;
62 break;
63 case SDLK_KP1:
64 new_btn = BUTTON_USER;
65 break;
66 }
67 return new_btn;
68}
69
70struct button_map bm[] = {
71 { SDLK_KP7, 66, 423, 25, "Back" },
72 { SDLK_KP8, 152, 406, 25, "Up" },
73 { SDLK_KP9, 249, 429, 25, "Menu" },
74 { SDLK_KP4, 105, 451, 25, "Left" },
75 { SDLK_KP5, 155, 450, 25, "Select" },
76 { SDLK_KP6, 208, 449, 25, "Right" },
77 { SDLK_KP1, 65, 484, 25, "User" },
78 { SDLK_KP2, 154, 501, 25, "Down" },
79 { SDLK_KP3, 248, 484, 25, "Power" },
80 { 0, 0, 0, 0, "None" }
81};