Initial commit of the Samsung YP-R0 port.

This port is a hybrid native/RaaA port. It runs on a embedded linux system,
but is the only application. It therefore can implement lots of stuff that
native targets also implement, while leveraging the underlying linux kernel.

The port is quite advanced. User interface, audio playback, plugins work
mostly fine. Missing is e.g. power mangement and USB (see SamsungYPR0 wiki page).

Included in utils/ypr0tools are scripts and programs required to generate
a patched firmware. The patched firmware has the rootfs modified to load
Rockbox. It includes a early/safe USB mode.

This port needs a new toolchain, one that includes glibc headers and libraries.
rockboxdev.sh can generate it, but e.g. codesourcey and distro packages may
also work.

Most of the initial effort is done by Lorenzo Miori and others (on ABI),
including reverse engineering and patching of the original firmware,
initial drivers, and more. Big thanks to you.

Flyspray: FS#12348
Author: Lorenzo Miori, myself

Merry christmas to ypr0 owners! :)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31415 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2011-12-24 11:56:46 +00:00
parent 567e0ad93e
commit 249bba03f1
131 changed files with 6074 additions and 48 deletions

View file

@ -332,5 +332,7 @@ keymaps/keymap-hm60x.c
keymaps/keymap-hm801.c keymaps/keymap-hm801.c
#elif CONFIG_KEYPAD == SANSA_CONNECT_PAD #elif CONFIG_KEYPAD == SANSA_CONNECT_PAD
keymaps/keymap-sansa-connect.c keymaps/keymap-sansa-connect.c
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
keymaps/keymap-ypr0.c
#endif #endif

258
apps/keymaps/keymap-ypr0.c Normal file
View file

@ -0,0 +1,258 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id: keymap-sdl.c 28704 2010-11-29 11:28:53Z teru $
*
* Copyright (C) 2011 Lorenzo Miori
*
* 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.
*
****************************************************************************/
/* Button Code Definitions for Samsung YP-R0 target */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "config.h"
#include "action.h"
#include "button.h"
#include "settings.h"
/*
* The format of the list is as follows
* { Action Code, Button code, Prereq button code }
* if there's no need to check the previous button's value, use BUTTON_NONE
* Insert LAST_ITEM_IN_LIST at the end of each mapping
*/
static const struct button_mapping button_context_standard[] = {
{ ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
{ ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
{ ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_BACK|BUTTON_REL, BUTTON_BACK },
{ ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
{ ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
{ ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
{ ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
{ ACTION_STD_CONTEXT, BUTTON_MENU|BUTTON_REL, BUTTON_NONE },
{ ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_STD_KEYLOCK, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
LAST_ITEM_IN_LIST
}; /* button_context_standard */
static const struct button_mapping button_context_wps[] = {
{ ACTION_WPS_PLAY, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
{ ACTION_WPS_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_WPS_BROWSE, BUTTON_BACK|BUTTON_REL, BUTTON_BACK },
{ ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
/* NOTE: this is available only enabling AB-Repeat mode */
{ ACTION_WPS_HOTKEY, BUTTON_USER|BUTTON_REL, BUTTON_USER },
{ ACTION_WPSAB_SINGLE, BUTTON_USER|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_STD_KEYLOCK, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
{ ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
{ ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
{ ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
{ ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
{ ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
{ ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
{ ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
LAST_ITEM_IN_LIST
}; /* button_context_wps */
static const struct button_mapping button_context_list[] = {
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
}; /* button_context_list */
static const struct button_mapping button_context_tree[] = {
{ ACTION_TREE_WPS, BUTTON_USER|BUTTON_REPEAT, BUTTON_USER },
{ ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_TREE_HOTKEY, BUTTON_USER|BUTTON_REL, BUTTON_NONE },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
}; /* button_context_tree */
static const struct button_mapping button_context_settings[] = {
{ ACTION_SETTINGS_INC, BUTTON_RIGHT, BUTTON_NONE },
{ ACTION_SETTINGS_INCREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_SETTINGS_DEC, BUTTON_LEFT, BUTTON_NONE },
{ ACTION_SETTINGS_DECREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_TREE)
}; /* button_context_settings */
static const struct button_mapping button_context_yesno[] = {
{ ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
}; /* button_context_settings_yesno */
static const struct button_mapping button_context_colorchooser[] = { //check
{ ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
{ ACTION_STD_CANCEL, BUTTON_BACK, BUTTON_NONE },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
}; /* button_context_colorchooser */
static const struct button_mapping button_context_eq[] = {
{ ACTION_STD_CANCEL, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
}; /* button_context_eq */
/** Bookmark Screen **/
static const struct button_mapping button_context_bmark[] = {
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
}; /* button_context_bmark */
static const struct button_mapping button_context_time[] = {
{ ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
{ ACTION_SETTINGS_INCREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
{ ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_STD_PREV, BUTTON_LEFT, BUTTON_NONE },
{ ACTION_STD_PREVREPEAT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_STD_NEXT, BUTTON_RIGHT, BUTTON_NONE },
{ ACTION_STD_NEXTREPEAT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
}; /* button_context_time */
static const struct button_mapping button_context_quickscreen[] = {
{ ACTION_QS_TOP, BUTTON_UP, BUTTON_NONE },
{ ACTION_QS_TOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_QS_DOWN, BUTTON_DOWN, BUTTON_NONE },
{ ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_QS_LEFT, BUTTON_LEFT, BUTTON_NONE },
{ ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_QS_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
{ ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_STD_CANCEL, BUTTON_MENU, BUTTON_NONE },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
}; /* button_context_quickscreen */
static const struct button_mapping button_context_pitchscreen[] = {
{ ACTION_PS_INC_SMALL, BUTTON_UP, BUTTON_NONE },
{ ACTION_PS_INC_BIG, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE },
{ ACTION_PS_DEC_BIG, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_PS_SLOWER, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_PS_FASTER, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
{ ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
{ ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
{ ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
{ ACTION_PS_RESET, BUTTON_SELECT, BUTTON_NONE },
{ ACTION_PS_TOGGLE_MODE, BUTTON_USER, BUTTON_NONE },
{ ACTION_PS_EXIT, BUTTON_MENU|BUTTON_REL, BUTTON_NONE },
{ ACTION_PS_EXIT, BUTTON_BACK|BUTTON_REL, BUTTON_NONE },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
}; /* button_context_pitchcreen */
static const struct button_mapping button_context_keyboard[] = {
{ ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
{ ACTION_KBD_UP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
{ ACTION_KBD_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
{ ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
{ ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
{ ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE },
{ ACTION_KBD_ABORT, BUTTON_BACK|BUTTON_REL, BUTTON_BACK },
{ ACTION_KBD_DONE, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
{ ACTION_KBD_BACKSPACE, BUTTON_USER, BUTTON_NONE },
{ ACTION_KBD_PAGE_FLIP, BUTTON_POWER, BUTTON_NONE },
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
}; /* button_context_keyboard */
static const struct button_mapping button_context_radio[] = {
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
}; /* button_context_radio */
const struct button_mapping* get_context_mapping(int context)
{
switch (context)
{
case CONTEXT_STD:
return button_context_standard;
case CONTEXT_WPS:
return button_context_wps;
case CONTEXT_LIST:
return button_context_list;
case CONTEXT_MAINMENU:
case CONTEXT_TREE:
return button_context_tree;
case CONTEXT_SETTINGS:
return button_context_settings;
case CONTEXT_SETTINGS_COLOURCHOOSER:
return button_context_colorchooser;
case CONTEXT_SETTINGS_EQ:
return button_context_eq;
case CONTEXT_SETTINGS_TIME:
return button_context_time;
case CONTEXT_YESNOSCREEN:
return button_context_yesno;
case CONTEXT_FM:
return button_context_radio;
case CONTEXT_BOOKMARKSCREEN:
return button_context_bmark;
case CONTEXT_QUICKSCREEN:
return button_context_quickscreen;
case CONTEXT_PITCHSCREEN:
return button_context_pitchscreen;
case CONTEXT_KEYBOARD:
return button_context_keyboard;
}
return button_context_standard;
}

View file

@ -121,6 +121,8 @@ void* plugin_get_buffer(size_t *buffer_size);
/* on some platforms strcmp() seems to be a tricky define which /* on some platforms strcmp() seems to be a tricky define which
* breaks if we write down strcmp's prototype */ * breaks if we write down strcmp's prototype */
#undef strcmp #undef strcmp
#undef strncmp
#undef strchr
#ifdef PLUGIN #ifdef PLUGIN

View file

@ -1,3 +1,7 @@
#ifndef HAVE_TOUCHSCREEN
/* In devices running RockBox as an application, but having a keypad */
#include "SOURCES"
#else
/* plugins common to all models */ /* plugins common to all models */
credits.c credits.c
properties.c properties.c
@ -39,3 +43,5 @@ test_sampr.c
#endif #endif
test_viewports.c test_viewports.c
#endif /* HAVE_TEST_PLUGINS */ #endif /* HAVE_TEST_PLUGINS */
#endif /* HAVE_TOUCHSCREEN */

View file

@ -73,7 +73,7 @@ mikmod
#if defined(IRIVER_H300_SERIES) || defined(IRIVER_H100_SERIES) || \ #if defined(IRIVER_H300_SERIES) || defined(IRIVER_H100_SERIES) || \
(CONFIG_KEYPAD == SANSA_FUZE_PAD) || (CONFIG_KEYPAD == SANSA_E200_PAD) || \ (CONFIG_KEYPAD == SANSA_FUZE_PAD) || (CONFIG_KEYPAD == SANSA_E200_PAD) || \
(CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \ (CONFIG_KEYPAD == IPOD_4G_PAD) || (CONFIG_KEYPAD == IPOD_3G_PAD) || \
(CONFIG_KEYPAD == IPOD_1G2G_PAD) (CONFIG_KEYPAD == IPOD_1G2G_PAD || CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
/* PDBox is confirmed to run on these player models. */ /* PDBox is confirmed to run on these player models. */
pdbox pdbox
#endif #endif

View file

@ -1,4 +1,11 @@
/* For all targets with a bitmap display */ #ifndef HAVE_TOUCHSCREEN
/* This is for devices having a keypad, running RockBox as an application */
#include "SUBDIRS"
#else
/* For all targets with a bitmap display and a touchscreen
* In fact, most of the plugins aren't supposed to be used on a touch(mouse) device
*/
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
#ifdef HAVE_TAGCACHE #ifdef HAVE_TAGCACHE
@ -15,3 +22,4 @@ mikmod
#endif #endif
#endif /* CONFIG_CODEC == SWCODEC */ #endif /* CONFIG_CODEC == SWCODEC */
#endif /* HAVE_TOUCHSCREEN */

View file

@ -125,7 +125,8 @@
#define BATTERY_ON_TXT "SELECT - start" #define BATTERY_ON_TXT "SELECT - start"
#define BATTERY_OFF_TXT "POWER" #define BATTERY_OFF_TXT "POWER"
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD #elif CONFIG_KEYPAD == GIGABEAT_S_PAD \
|| CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define BATTERY_ON BUTTON_SELECT #define BATTERY_ON BUTTON_SELECT
#define BATTERY_OFF BUTTON_BACK #define BATTERY_OFF BUTTON_BACK

View file

@ -466,6 +466,22 @@ enum {
#define BJACK_RIGHT BUTTON_RIGHT #define BJACK_RIGHT BUTTON_RIGHT
#define BJACK_LEFT BUTTON_LEFT #define BJACK_LEFT BUTTON_LEFT
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define BJACK_SELECT_NAME "SELECT"
#define BJACK_STAY_NAME "MENU"
#define BJACK_QUIT_NAME "BACK"
#define BJACK_DOUBLE_NAME "USER"
#define BJACK_SELECT BUTTON_SELECT
#define BJACK_QUIT BUTTON_BACK
#define BJACK_MAX (BUTTON_LEFT|BUTTON_UP)
#define BJACK_MIN (BUTTON_RIGHT|BUTTON_DOWN)
#define BJACK_STAY BUTTON_MENU
#define BJACK_DOUBLEDOWN BUTTON_USER
#define BJACK_UP BUTTON_UP
#define BJACK_DOWN BUTTON_DOWN
#define BJACK_RIGHT BUTTON_RIGHT
#define BJACK_LEFT BUTTON_LEFT
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -127,7 +127,8 @@
#define BOUNCE_QUIT BUTTON_POWER #define BOUNCE_QUIT BUTTON_POWER
#define BOUNCE_MODE BUTTON_PLAY #define BOUNCE_MODE BUTTON_PLAY
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) \
|| (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define BOUNCE_LEFT BUTTON_LEFT #define BOUNCE_LEFT BUTTON_LEFT
#define BOUNCE_RIGHT BUTTON_RIGHT #define BOUNCE_RIGHT BUTTON_RIGHT
#define BOUNCE_UP BUTTON_UP #define BOUNCE_UP BUTTON_UP

View file

@ -158,7 +158,8 @@ CONFIG_KEYPAD == SANSA_CONNECT_PAD
#define UP BUTTON_SCROLL_UP #define UP BUTTON_SCROLL_UP
#define DOWN BUTTON_SCROLL_DOWN #define DOWN BUTTON_SCROLL_DOWN
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD #elif CONFIG_KEYPAD == GIGABEAT_S_PAD \
|| CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define QUIT BUTTON_BACK #define QUIT BUTTON_BACK
#define LEFT BUTTON_LEFT #define LEFT BUTTON_LEFT
#define RIGHT BUTTON_RIGHT #define RIGHT BUTTON_RIGHT

View file

@ -431,6 +431,17 @@ F3: equal to "="
#define CALCULATOR_CALC BUTTON_NEXT #define CALCULATOR_CALC BUTTON_NEXT
#define CALCULATOR_CLEAR BUTTON_PREV #define CALCULATOR_CLEAR BUTTON_PREV
#elif (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define CALCULATOR_LEFT BUTTON_LEFT
#define CALCULATOR_RIGHT BUTTON_RIGHT
#define CALCULATOR_UP BUTTON_UP
#define CALCULATOR_DOWN BUTTON_DOWN
#define CALCULATOR_QUIT BUTTON_BACK
#define CALCULATOR_INPUT BUTTON_SELECT
#define CALCULATOR_CALC BUTTON_MENU
#define CALCULATOR_CLEAR BUTTON_USER
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -308,6 +308,16 @@
#define CALENDAR_NEXT_MONTH BUTTON_NEXT #define CALENDAR_NEXT_MONTH BUTTON_NEXT
#define CALENDAR_PREV_MONTH BUTTON_PREV #define CALENDAR_PREV_MONTH BUTTON_PREV
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define CALENDAR_QUIT BUTTON_BACK
#define CALENDAR_SELECT BUTTON_SELECT
#define CALENDAR_NEXT_WEEK BUTTON_DOWN
#define CALENDAR_PREV_WEEK BUTTON_UP
#define CALENDAR_NEXT_DAY BUTTON_RIGHT
#define CALENDAR_PREV_DAY BUTTON_LEFT
#define CALENDAR_NEXT_MONTH BUTTON_POWER
#define CALENDAR_PREV_MONTH BUTTON_USER
#else #else
#error "No keypad setting." #error "No keypad setting."
#endif #endif

View file

@ -422,6 +422,16 @@
#define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT) #define CB_SCROLL_LEFT (BUTTON_LEFT|BUTTON_REPEAT)
#define CB_SCROLL_RIGHT (BUTTON_RIGHT|BUTTON_REPEAT) #define CB_SCROLL_RIGHT (BUTTON_RIGHT|BUTTON_REPEAT)
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define CB_SELECT BUTTON_SELECT
#define CB_UP BUTTON_UP
#define CB_DOWN BUTTON_DOWN
#define CB_LEFT BUTTON_LEFT
#define CB_RIGHT BUTTON_RIGHT
#define CB_PLAY BUTTON_USER
#define CB_LEVEL BUTTON_BACK
#define CB_MENU BUTTON_MENU
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -326,6 +326,16 @@
#define CHC_SETTINGS_OK BUTTON_SELECT #define CHC_SETTINGS_OK BUTTON_SELECT
#define CHC_SETTINGS_CANCEL BUTTON_LEFT #define CHC_SETTINGS_CANCEL BUTTON_LEFT
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define CHC_QUIT BUTTON_BACK
#define CHC_STARTSTOP BUTTON_SELECT
#define CHC_RESET BUTTON_USER
#define CHC_MENU BUTTON_MENU
#define CHC_SETTINGS_INC BUTTON_UP
#define CHC_SETTINGS_DEC BUTTON_DOWN
#define CHC_SETTINGS_OK BUTTON_SELECT
#define CHC_SETTINGS_CANCEL BUTTON_BACK
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -1193,6 +1193,18 @@ CONFIG_KEYPAD == MROBE500_PAD
#define CHIP8_KEY8 BUTTON_VOL_DOWN #define CHIP8_KEY8 BUTTON_VOL_DOWN
#define CHIP8_KEY9 BUTTON_VOL_UP #define CHIP8_KEY9 BUTTON_VOL_UP
#elif (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define CHIP8_OFF (BUTTON_BACK|BUTTON_REPEAT)
#define CHIP8_KEY1 BUTTON_MENU
#define CHIP8_KEY2 BUTTON_UP
#define CHIP8_KEY3 BUTTON_DOWN
#define CHIP8_KEY4 BUTTON_LEFT
#define CHIP8_KEY5 BUTTON_SELECT
#define CHIP8_KEY6 BUTTON_RIGHT
#define CHIP8_KEY7 BUTTON_BACK
#define CHIP8_KEY8 BUTTON_POWER
#define CHIP8_KEY9 BUTTON_USER
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -97,7 +97,8 @@ Still To do:
#define ACTION2 BUTTON_MENU #define ACTION2 BUTTON_MENU
#define ACTIONTEXT "UP" #define ACTIONTEXT "UP"
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD #elif CONFIG_KEYPAD == GIGABEAT_S_PAD \
|| CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define QUIT BUTTON_BACK #define QUIT BUTTON_BACK
#define ACTION BUTTON_SELECT #define ACTION BUTTON_SELECT
#define ACTION2 BUTTON_MENU #define ACTION2 BUTTON_MENU

View file

@ -83,7 +83,8 @@
#define CLIX_BUTTON_UP BUTTON_UP #define CLIX_BUTTON_UP BUTTON_UP
#define CLIX_BUTTON_DOWN BUTTON_DOWN #define CLIX_BUTTON_DOWN BUTTON_DOWN
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) || \
(CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define CLIX_BUTTON_QUIT BUTTON_BACK #define CLIX_BUTTON_QUIT BUTTON_BACK
#define CLIX_BUTTON_LEFT BUTTON_LEFT #define CLIX_BUTTON_LEFT BUTTON_LEFT
#define CLIX_BUTTON_RIGHT BUTTON_RIGHT #define CLIX_BUTTON_RIGHT BUTTON_RIGHT

View file

@ -329,6 +329,16 @@
#define CUBE_PAUSE BUTTON_DOWN #define CUBE_PAUSE BUTTON_DOWN
#define CUBE_HIGHSPEED BUTTON_LEFT #define CUBE_HIGHSPEED BUTTON_LEFT
#elif (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define CUBE_QUIT BUTTON_BACK
#define CUBE_NEXT BUTTON_RIGHT
#define CUBE_PREV BUTTON_LEFT
#define CUBE_INC BUTTON_UP
#define CUBE_DEC BUTTON_DOWN
#define CUBE_MODE BUTTON_MENU
#define CUBE_PAUSE BUTTON_USER
#define CUBE_HIGHSPEED BUTTON_SELECT
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -424,6 +424,17 @@ void I_ShutdownGraphics(void)
#define DOOMBUTTON_ENTER BUTTON_NEXT #define DOOMBUTTON_ENTER BUTTON_NEXT
#define DOOMBUTTON_WEAPON BUTTON_PREV #define DOOMBUTTON_WEAPON BUTTON_PREV
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define DOOMBUTTON_UP BUTTON_UP
#define DOOMBUTTON_DOWN BUTTON_DOWN
#define DOOMBUTTON_LEFT BUTTON_LEFT
#define DOOMBUTTON_RIGHT BUTTON_RIGHT
#define DOOMBUTTON_SHOOT BUTTON_SELECT
#define DOOMBUTTON_OPEN BUTTON_MENU
#define DOOMBUTTON_ESC BUTTON_BACK
#define DOOMBUTTON_ENTER BUTTON_POWER
#define DOOMBUTTON_WEAPON BUTTON_USER
#else #else
#error Keymap not defined! #error Keymap not defined!
#endif #endif

View file

@ -257,6 +257,15 @@ GREY_INFO_STRUCT
# define FFT_FREQ_SCALE BUTTON_DOWN # define FFT_FREQ_SCALE BUTTON_DOWN
# define FFT_QUIT BUTTON_POWER # define FFT_QUIT BUTTON_POWER
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
# define FFT_PREV_GRAPH BUTTON_LEFT
# define FFT_NEXT_GRAPH BUTTON_RIGHT
# define FFT_ORIENTATION BUTTON_USER
# define FFT_WINDOW BUTTON_MENU
# define FFT_AMP_SCALE BUTTON_SELECT
# define FFT_FREQ_SCALE BUTTON_DOWN
# define FFT_QUIT BUTTON_BACK
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -63,7 +63,8 @@
#elif (CONFIG_KEYPAD == GIGABEAT_PAD) || \ #elif (CONFIG_KEYPAD == GIGABEAT_PAD) || \
(CONFIG_KEYPAD == GIGABEAT_S_PAD) || \ (CONFIG_KEYPAD == GIGABEAT_S_PAD) || \
(CONFIG_KEYPAD == MROBE100_PAD) (CONFIG_KEYPAD == MROBE100_PAD) || \
(CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define BTN_MENU BUTTON_MENU #define BTN_MENU BUTTON_MENU
#define BTN_FIRE BUTTON_SELECT #define BTN_FIRE BUTTON_SELECT

View file

@ -380,6 +380,18 @@
#define FLIPIT_STEP_BY_STEP BUTTON_NEXT #define FLIPIT_STEP_BY_STEP BUTTON_NEXT
#define FLIPIT_TOGGLE BUTTON_SELECT #define FLIPIT_TOGGLE BUTTON_SELECT
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define FLIPIT_LEFT BUTTON_LEFT
#define FLIPIT_RIGHT BUTTON_RIGHT
#define FLIPIT_UP BUTTON_UP
#define FLIPIT_DOWN BUTTON_DOWN
#define FLIPIT_QUIT BUTTON_BACK
#define FLIPIT_SHUFFLE BUTTON_MENU
#define FLIPIT_SOLVE BUTTON_USER
#define FLIPIT_STEP_BY_STEP BUTTON_POWER
#define FLIPIT_TOGGLE BUTTON_SELECT
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -378,6 +378,18 @@
#define FRACTAL_PRECISION_DEC BUTTON_VOL_DOWN #define FRACTAL_PRECISION_DEC BUTTON_VOL_DOWN
#define FRACTAL_RESET BUTTON_PREV #define FRACTAL_RESET BUTTON_PREV
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define FRACTAL_QUIT BUTTON_BACK
#define FRACTAL_UP BUTTON_UP
#define FRACTAL_DOWN BUTTON_DOWN
#define FRACTAL_LEFT BUTTON_LEFT
#define FRACTAL_RIGHT BUTTON_RIGHT
#define FRACTAL_ZOOM_IN (BUTTON_MENU|BUTTON_REL)
#define FRACTAL_ZOOM_OUT (BUTTON_USER|BUTTON_REL)
#define FRACTAL_PRECISION_INC (BUTTON_MENU|BUTTON_REPEAT)
#define FRACTAL_PRECISION_DEC (BUTTON_USER|BUTTON_REPEAT)
#define FRACTAL_RESET BUTTON_POWER
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -364,6 +364,16 @@
#define GBN_BUTTON_PLAY BUTTON_SELECT #define GBN_BUTTON_PLAY BUTTON_SELECT
#define GBN_BUTTON_MENU BUTTON_POWER #define GBN_BUTTON_MENU BUTTON_POWER
#elif (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define GBN_BUTTON_UP BUTTON_UP
#define GBN_BUTTON_DOWN BUTTON_DOWN
#define GBN_BUTTON_LEFT BUTTON_LEFT
#define GBN_BUTTON_RIGHT BUTTON_RIGHT
#define GBN_BUTTON_RETREAT BUTTON_BACK
#define GBN_BUTTON_ADVANCE BUTTON_USER
#define GBN_BUTTON_PLAY BUTTON_SELECT
#define GBN_BUTTON_MENU BUTTON_MENU
#else #else
#error Unsupported keypad #error Unsupported keypad
#endif #endif

View file

@ -379,6 +379,18 @@
#define IMGVIEW_MENU BUTTON_POWER #define IMGVIEW_MENU BUTTON_POWER
#define IMGVIEW_SLIDE_SHOW BUTTON_NEXT #define IMGVIEW_SLIDE_SHOW BUTTON_NEXT
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define IMGVIEW_ZOOM_IN BUTTON_POWER
#define IMGVIEW_ZOOM_OUT BUTTON_USER
#define IMGVIEW_UP BUTTON_UP
#define IMGVIEW_DOWN BUTTON_DOWN
#define IMGVIEW_LEFT BUTTON_LEFT
#define IMGVIEW_RIGHT BUTTON_RIGHT
#define IMGVIEW_NEXT BUTTON_SELECT
#define IMGVIEW_PREVIOUS 0xFFFFFFA //not used
#define IMGVIEW_MENU BUTTON_MENU
#define IMGVIEW_QUIT BUTTON_BACK
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -122,7 +122,8 @@
#define RIGHT BUTTON_RIGHT #define RIGHT BUTTON_RIGHT
#define FIRE BUTTON_SELECT #define FIRE BUTTON_SELECT
#elif CONFIG_KEYPAD == GIGABEAT_PAD #elif CONFIG_KEYPAD == GIGABEAT_PAD \
|| CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define QUIT BUTTON_POWER #define QUIT BUTTON_POWER
#define LEFT BUTTON_LEFT #define LEFT BUTTON_LEFT

View file

@ -172,7 +172,8 @@ CONFIG_KEYPAD == SANSA_M200_PAD
#define HK_SELECT "PLAY" #define HK_SELECT "PLAY"
#define HK_CANCEL "POWER" #define HK_CANCEL "POWER"
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD #elif CONFIG_KEYPAD == GIGABEAT_S_PAD || \
CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define JEWELS_UP BUTTON_UP #define JEWELS_UP BUTTON_UP
#define JEWELS_DOWN BUTTON_DOWN #define JEWELS_DOWN BUTTON_DOWN
#define JEWELS_LEFT BUTTON_LEFT #define JEWELS_LEFT BUTTON_LEFT

View file

@ -57,7 +57,8 @@
# define LAMP_UP BUTTON_UP # define LAMP_UP BUTTON_UP
# define LAMP_DOWN BUTTON_DOWN # define LAMP_DOWN BUTTON_DOWN
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) || \
(CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
# define LAMP_LEFT BUTTON_LEFT # define LAMP_LEFT BUTTON_LEFT
# define LAMP_RIGHT BUTTON_RIGHT # define LAMP_RIGHT BUTTON_RIGHT
# define LAMP_UP BUTTON_UP # define LAMP_UP BUTTON_UP

View file

@ -116,7 +116,8 @@ const struct button_mapping pla_main_ctx[] =
|| (CONFIG_KEYPAD == SANSA_FUZE_PAD) \ || (CONFIG_KEYPAD == SANSA_FUZE_PAD) \
|| (CONFIG_KEYPAD == SAMSUNG_YH_PAD) \ || (CONFIG_KEYPAD == SAMSUNG_YH_PAD) \
|| (CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD) \ || (CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD) \
|| (CONFIG_KEYPAD == SANSA_CONNECT_PAD)) || (CONFIG_KEYPAD == SANSA_CONNECT_PAD) \
|| (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD))
{ PLA_UP, BUTTON_UP, BUTTON_NONE }, { PLA_UP, BUTTON_UP, BUTTON_NONE },
{ PLA_DOWN, BUTTON_DOWN, BUTTON_NONE }, { PLA_DOWN, BUTTON_DOWN, BUTTON_NONE },
{ PLA_LEFT, BUTTON_LEFT, BUTTON_NONE }, { PLA_LEFT, BUTTON_LEFT, BUTTON_NONE },
@ -278,7 +279,8 @@ const struct button_mapping pla_main_ctx[] =
{PLA_SELECT, BUTTON_SELECT, BUTTON_NONE}, {PLA_SELECT, BUTTON_SELECT, BUTTON_NONE},
{PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT}, {PLA_SELECT_REL, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT},
{PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE}, {PLA_SELECT_REPEAT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_NONE},
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) \
|| (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
{PLA_CANCEL, BUTTON_BACK, BUTTON_NONE}, {PLA_CANCEL, BUTTON_BACK, BUTTON_NONE},
{PLA_EXIT, BUTTON_MENU, BUTTON_NONE}, {PLA_EXIT, BUTTON_MENU, BUTTON_NONE},
{PLA_SELECT, BUTTON_SELECT, BUTTON_NONE}, {PLA_SELECT, BUTTON_SELECT, BUTTON_NONE},

View file

@ -25,6 +25,7 @@
#include "simple_viewer.h" #include "simple_viewer.h"
#include <ctype.h> #include <ctype.h>
struct view_info { struct view_info {
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
struct font* pf; struct font* pf;

View file

@ -123,7 +123,8 @@ const unsigned char rockbox16x7[] = {
#elif CONFIG_KEYPAD == MROBE500_PAD #elif CONFIG_KEYPAD == MROBE500_PAD
#define LP_QUIT BUTTON_POWER #define LP_QUIT BUTTON_POWER
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD #elif CONFIG_KEYPAD == GIGABEAT_S_PAD || \
CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define LP_QUIT BUTTON_BACK #define LP_QUIT BUTTON_BACK
#define LP_DEC_X BUTTON_LEFT #define LP_DEC_X BUTTON_LEFT
#define LP_INC_X BUTTON_RIGHT #define LP_INC_X BUTTON_RIGHT

View file

@ -1,5 +1,6 @@
#include "rocklibc.h" #include "rocklibc.h"
#undef strcspn
size_t strcspn(const char *s, const char *reject) size_t strcspn(const char *s, const char *reject)
{ {
size_t l=0; size_t l=0;

View file

@ -1,5 +1,6 @@
#include "rocklibc.h" #include "rocklibc.h"
#undef strpbrk
char *strpbrk(const char *s, const char *accept) { char *strpbrk(const char *s, const char *accept) {
register int i,l=strlen(accept); register int i,l=strlen(accept);
for (; *s; s++) for (; *s; s++)

View file

@ -101,7 +101,8 @@
#define MATRIX_SLEEP_LESS BUTTON_DOWN #define MATRIX_SLEEP_LESS BUTTON_DOWN
#define MATRIX_PAUSE BUTTON_SELECT #define MATRIX_PAUSE BUTTON_SELECT
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) || \
(CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define MATRIX_EXIT BUTTON_BACK #define MATRIX_EXIT BUTTON_BACK
#define MATRIX_SLEEP_MORE BUTTON_UP #define MATRIX_SLEEP_MORE BUTTON_UP
#define MATRIX_SLEEP_LESS BUTTON_DOWN #define MATRIX_SLEEP_LESS BUTTON_DOWN

View file

@ -233,6 +233,14 @@
#define BTN_DOWN BUTTON_DOWN #define BTN_DOWN BUTTON_DOWN
#define BTN_PLAY BUTTON_SELECT #define BTN_PLAY BUTTON_SELECT
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define BTN_QUIT BUTTON_BACK
#define BTN_RIGHT BUTTON_RIGHT
#define BTN_LEFT BUTTON_LEFT
#define BTN_UP BUTTON_UP
#define BTN_DOWN BUTTON_DOWN
#define BTN_PLAY BUTTON_USER
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -311,6 +311,16 @@ CONFIG_KEYPAD == MROBE500_PAD
# define MINESWP_DISCOVER BUTTON_SELECT # define MINESWP_DISCOVER BUTTON_SELECT
# define MINESWP_INFO BUTTON_PREV # define MINESWP_INFO BUTTON_PREV
#elif (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
# define MINESWP_LEFT BUTTON_LEFT
# define MINESWP_RIGHT BUTTON_RIGHT
# define MINESWP_UP BUTTON_UP
# define MINESWP_DOWN BUTTON_DOWN
# define MINESWP_QUIT BUTTON_BACK
# define MINESWP_TOGGLE BUTTON_USER
# define MINESWP_DISCOVER BUTTON_SELECT
# define MINESWP_INFO BUTTON_MENU
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -113,7 +113,8 @@
#elif CONFIG_KEYPAD == MROBE500_PAD #elif CONFIG_KEYPAD == MROBE500_PAD
#define MOSAIQUE_QUIT BUTTON_POWER #define MOSAIQUE_QUIT BUTTON_POWER
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD #elif CONFIG_KEYPAD == GIGABEAT_S_PAD || \
CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define MOSAIQUE_QUIT BUTTON_BACK #define MOSAIQUE_QUIT BUTTON_BACK
#define MOSAIQUE_SPEED BUTTON_SELECT #define MOSAIQUE_SPEED BUTTON_SELECT
#define MOSAIQUE_RESTART BUTTON_MENU #define MOSAIQUE_RESTART BUTTON_MENU

View file

@ -2394,7 +2394,8 @@ static void get_mp3_filename(const char *wav_name)
#define MP3ENC_DONE BUTTON_POWER #define MP3ENC_DONE BUTTON_POWER
#define MP3ENC_SELECT BUTTON_SELECT #define MP3ENC_SELECT BUTTON_SELECT
#elif CONFIG_KEYPAD == GIGABEAT_PAD #elif CONFIG_KEYPAD == GIGABEAT_PAD || \
CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define MP3ENC_PREV BUTTON_UP #define MP3ENC_PREV BUTTON_UP
#define MP3ENC_NEXT BUTTON_DOWN #define MP3ENC_NEXT BUTTON_DOWN
#define MP3ENC_DONE BUTTON_POWER #define MP3ENC_DONE BUTTON_POWER

View file

@ -248,6 +248,14 @@ struct mpeg_settings settings;
#define MPEG_START_TIME_DOWN BUTTON_DOWN #define MPEG_START_TIME_DOWN BUTTON_DOWN
#define MPEG_START_TIME_EXIT BUTTON_POWER #define MPEG_START_TIME_EXIT BUTTON_POWER
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define MPEG_START_TIME_SELECT BUTTON_SELECT
#define MPEG_START_TIME_LEFT BUTTON_LEFT
#define MPEG_START_TIME_RIGHT BUTTON_RIGHT
#define MPEG_START_TIME_UP BUTTON_UP
#define MPEG_START_TIME_DOWN BUTTON_DOWN
#define MPEG_START_TIME_EXIT BUTTON_BACK
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -362,6 +362,15 @@ CONFIG_KEYPAD == SANSA_M200_PAD
#define MPEG_RW BUTTON_LEFT #define MPEG_RW BUTTON_LEFT
#define MPEG_FF BUTTON_RIGHT #define MPEG_FF BUTTON_RIGHT
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define MPEG_MENU BUTTON_MENU
#define MPEG_PAUSE BUTTON_SELECT
#define MPEG_STOP BUTTON_POWER
#define MPEG_VOLDOWN BUTTON_DOWN
#define MPEG_VOLUP BUTTON_UP
#define MPEG_RW BUTTON_LEFT
#define MPEG_FF BUTTON_RIGHT
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -342,6 +342,17 @@
#define OSCILLOSCOPE_VOL_UP BUTTON_VOL_UP #define OSCILLOSCOPE_VOL_UP BUTTON_VOL_UP
#define OSCILLOSCOPE_VOL_DOWN BUTTON_VOL_DOWN #define OSCILLOSCOPE_VOL_DOWN BUTTON_VOL_DOWN
#elif (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define OSCILLOSCOPE_QUIT BUTTON_BACK
#define OSCILLOSCOPE_DRAWMODE BUTTON_USER
#define OSCILLOSCOPE_ADVMODE BUTTON_MENU
#define OSCILLOSCOPE_ORIENTATION BUTTON_POWER
#define OSCILLOSCOPE_PAUSE BUTTON_SELECT
#define OSCILLOSCOPE_SPEED_UP BUTTON_RIGHT
#define OSCILLOSCOPE_SPEED_DOWN BUTTON_LEFT
#define OSCILLOSCOPE_VOL_UP BUTTON_UP
#define OSCILLOSCOPE_VOL_DOWN BUTTON_DOWN
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -265,6 +265,17 @@
#define PACMAN_COIN BUTTON_VOL_DOWN #define PACMAN_COIN BUTTON_VOL_DOWN
#define PACMAN_MENU BUTTON_POWER #define PACMAN_MENU BUTTON_POWER
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define PACMAN_UP BUTTON_UP
#define PACMAN_DOWN BUTTON_DOWN
#define PACMAN_LEFT BUTTON_LEFT
#define PACMAN_RIGHT BUTTON_RIGHT
#define PACMAN_1UP BUTTON_SELECT
#define PACMAN_2UP BUTTON_POWER
#define PACMAN_COIN BUTTON_USER
#define PACMAN_MENU BUTTON_MENU
#else #else
#error Keymap not defined! #error Keymap not defined!

View file

@ -89,7 +89,9 @@ float rb_atan(float);
float rb_atan2(float, float); float rb_atan2(float, float);
float rb_sinh(float); float rb_sinh(float);
float rb_tan(float); float rb_tan(float);
#ifndef SIMULATOR //#ifndef SIMULATOR
/*FIXME: is it a correct replacement??? */
#if !(CONFIG_PLATFORM & PLATFORM_HOSTED)
typedef struct typedef struct
{ {
int quot; int quot;
@ -163,9 +165,12 @@ void pd_init(void);
#define atoi rb->atoi #define atoi rb->atoi
#define write rb->write #define write rb->write
#undef strncat
#define strncat rb_strncat #define strncat rb_strncat
#ifndef SIMULATOR //#ifndef SIMULATOR
/*FIXME: is it a correct replacement??? */
#if !(CONFIG_PLATFORM & PLATFORM_HOSTED)
#define floor rb_floor #define floor rb_floor
#define atof rb_atof #define atof rb_atof
#define atol rb_atol #define atol rb_atol
@ -186,6 +191,7 @@ void pd_init(void);
#endif #endif
#define ftoan rb_ftoan #define ftoan rb_ftoan
#undef strtok_r
#define strtok_r rb->strtok_r #define strtok_r rb->strtok_r
#define strstr rb->strcasestr #define strstr rb->strcasestr
@ -282,6 +288,15 @@ enum pd_key_id
#define PDPOD_WHEELLEFT (BUTTON_SCROLL_BACK) #define PDPOD_WHEELLEFT (BUTTON_SCROLL_BACK)
#define PDPOD_WHEELRIGHT (BUTTON_SCROLL_FWD) #define PDPOD_WHEELRIGHT (BUTTON_SCROLL_FWD)
#define PDPOD_ACTION (BUTTON_SELECT) #define PDPOD_ACTION (BUTTON_SELECT)
#elif (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define PDPOD_QUIT BUTTON_BACK
#define PDPOD_PLAY BUTTON_USER
#define PDPOD_PREVIOUS BUTTON_LEFT
#define PDPOD_NEXT BUTTON_RIGHT
#define PDPOD_MENU BUTTON_MENU
#define PDPOD_WHEELLEFT BUTTON_UP
#define PDPOD_WHEELRIGHT BUTTON_DOWN
#define PDPOD_ACTION BUTTON_SELECT
#else #else
#warning "No keys defined for this architecture!" #warning "No keys defined for this architecture!"
#endif #endif

View file

@ -510,6 +510,24 @@ CONFIG_KEYPAD == MROBE500_PAD
#define LVL_DOWN_TEXT "PREV" #define LVL_DOWN_TEXT "PREV"
#define SELECT_TEXT "SELECT" #define SELECT_TEXT "SELECT"
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define PEGBOX_SELECT BUTTON_SELECT
#define PEGBOX_QUIT BUTTON_BACK
#define PEGBOX_RESTART BUTTON_MENU
#define PEGBOX_LVL_UP BUTTON_USER
#define PEGBOX_LVL_DOWN BUTTON_POWER
#define PEGBOX_UP BUTTON_UP
#define PEGBOX_DOWN BUTTON_DOWN
#define PEGBOX_RIGHT BUTTON_RIGHT
#define PEGBOX_LEFT BUTTON_LEFT
#define SAVE_TEXT "PLAYPAUSE"
#define QUIT_TEXT "POWER"
#define RESTART_TEXT "BACK"
#define LVL_UP_TEXT "Vol+"
#define LVL_DOWN_TEXT "Vol-"
#define SELECT_TEXT "SELECT"
#else #else
#error Unsupported keymap! #error Unsupported keymap!
#endif #endif

View file

@ -244,6 +244,14 @@ CONFIG_KEYPAD == MROBE500_PAD
#define PONG_RIGHT_UP BUTTON_UP #define PONG_RIGHT_UP BUTTON_UP
#define PONG_RIGHT_DOWN BUTTON_RIGHT #define PONG_RIGHT_DOWN BUTTON_RIGHT
#elif (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define PONG_QUIT BUTTON_BACK
#define PONG_PAUSE BUTTON_SELECT
#define PONG_LEFT_UP BUTTON_UP
#define PONG_LEFT_DOWN BUTTON_DOWN
#define PONG_RIGHT_UP BUTTON_MENU
#define PONG_RIGHT_DOWN BUTTON_POWER
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -252,6 +252,15 @@
#define REVERSI_BUTTON_MAKE_MOVE BUTTON_PLAYPAUSE #define REVERSI_BUTTON_MAKE_MOVE BUTTON_PLAYPAUSE
#define REVERSI_BUTTON_MENU BUTTON_BACK #define REVERSI_BUTTON_MENU BUTTON_BACK
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define REVERSI_BUTTON_QUIT BUTTON_BACK
#define REVERSI_BUTTON_UP BUTTON_UP
#define REVERSI_BUTTON_DOWN BUTTON_DOWN
#define REVERSI_BUTTON_LEFT BUTTON_LEFT
#define REVERSI_BUTTON_RIGHT BUTTON_RIGHT
#define REVERSI_BUTTON_MAKE_MOVE BUTTON_SELECT
#define REVERSI_BUTTON_MENU BUTTON_MENU
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -379,6 +379,18 @@
#define ROCKBLOX_DROP BUTTON_SELECT #define ROCKBLOX_DROP BUTTON_SELECT
#define ROCKBLOX_RESTART BUTTON_VOL_DOWN #define ROCKBLOX_RESTART BUTTON_VOL_DOWN
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define ROCKBLOX_OFF BUTTON_BACK
#define ROCKBLOX_ROTATE_CCW BUTTON_POWER
#define ROCKBLOX_ROTATE_CW BUTTON_MENU
#define ROCKBLOX_ROTATE BUTTON_UP
#define ROCKBLOX_DOWN BUTTON_DOWN
#define ROCKBLOX_LEFT BUTTON_LEFT
#define ROCKBLOX_RIGHT BUTTON_RIGHT
#define ROCKBLOX_DROP BUTTON_SELECT
#define ROCKBLOX_RESTART BUTTON_USER
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -69,7 +69,8 @@
#define ONEDROCKBLOX_DOWN BUTTON_PLAY #define ONEDROCKBLOX_DOWN BUTTON_PLAY
#define ONEDROCKBLOX_QUIT BUTTON_POWER #define ONEDROCKBLOX_QUIT BUTTON_POWER
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) || \
(CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define ONEDROCKBLOX_DOWN BUTTON_SELECT #define ONEDROCKBLOX_DOWN BUTTON_SELECT
#define ONEDROCKBLOX_QUIT BUTTON_BACK #define ONEDROCKBLOX_QUIT BUTTON_BACK

View file

@ -342,6 +342,18 @@ static void setoptions (void)
options.SELECT = BUTTON_NEXT; options.SELECT = BUTTON_NEXT;
options.MENU = BUTTON_SELECT; options.MENU = BUTTON_SELECT;
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
options.UP = BUTTON_UP;
options.DOWN = BUTTON_DOWN;
options.LEFT = BUTTON_LEFT;
options.RIGHT = BUTTON_RIGHT;
options.A = BUTTON_SELECT;
options.B = BUTTON_BACK;
options.START = BUTTON_POWER;
options.SELECT = BUTTON_USER;
options.MENU = BUTTON_MENU;
#else #else
#error No Keymap Defined! #error No Keymap Defined!
#endif #endif

View file

@ -23,8 +23,6 @@
#include "plugin.h" #include "plugin.h"
#include "autoconf.h"
#define malloc(a) my_malloc(a) #define malloc(a) my_malloc(a)
void *my_malloc(size_t size); void *my_malloc(size_t size);

View file

@ -243,6 +243,17 @@
#define ROCKPAINT_LEFT BUTTON_LEFT #define ROCKPAINT_LEFT BUTTON_LEFT
#define ROCKPAINT_RIGHT BUTTON_RIGHT #define ROCKPAINT_RIGHT BUTTON_RIGHT
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define ROCKPAINT_QUIT BUTTON_BACK
#define ROCKPAINT_DRAW BUTTON_SELECT
#define ROCKPAINT_MENU BUTTON_MENU
#define ROCKPAINT_TOOLBAR BUTTON_USER
#define ROCKPAINT_TOOLBAR2 ( BUTTON_USER | BUTTON_REPEAT )
#define ROCKPAINT_UP BUTTON_UP
#define ROCKPAINT_DOWN BUTTON_DOWN
#define ROCKPAINT_LEFT BUTTON_LEFT
#define ROCKPAINT_RIGHT BUTTON_RIGHT
#else #else
#error "Please define keys for this keypad" #error "Please define keys for this keypad"
#endif #endif

View file

@ -136,7 +136,8 @@
#define PUZZLE_SHUFFLE BUTTON_REW #define PUZZLE_SHUFFLE BUTTON_REW
#define PUZZLE_PICTURE BUTTON_PLAY #define PUZZLE_PICTURE BUTTON_PLAY
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) || \
(CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define PUZZLE_QUIT BUTTON_BACK #define PUZZLE_QUIT BUTTON_BACK
#define PUZZLE_LEFT BUTTON_LEFT #define PUZZLE_LEFT BUTTON_LEFT
#define PUZZLE_RIGHT BUTTON_RIGHT #define PUZZLE_RIGHT BUTTON_RIGHT
@ -784,7 +785,8 @@ enum plugin_status plugin_start(
rb->lcd_putsxy(0, 18, "[OFF] to stop"); rb->lcd_putsxy(0, 18, "[OFF] to stop");
rb->lcd_putsxy(0, 28, "[REW] shuffle"); rb->lcd_putsxy(0, 28, "[REW] shuffle");
rb->lcd_putsxy(0, 38, "[PLAY] change pic"); rb->lcd_putsxy(0, 38, "[PLAY] change pic");
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD #elif CONFIG_KEYPAD == GIGABEAT_S_PAD || \
CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
rb->lcd_putsxy(0, 18, "[BACK] to stop"); rb->lcd_putsxy(0, 18, "[BACK] to stop");
rb->lcd_putsxy(0, 28, "[SELECT] shuffle"); rb->lcd_putsxy(0, 28, "[SELECT] shuffle");
rb->lcd_putsxy(0, 38, "[MENU] change pic"); rb->lcd_putsxy(0, 38, "[MENU] change pic");

View file

@ -130,7 +130,8 @@ dir is the current direction of the snake - 0=up, 1=right, 2=down, 3=left;
#define SNAKE_DOWN BUTTON_SCROLL_DOWN #define SNAKE_DOWN BUTTON_SCROLL_DOWN
#define SNAKE_PLAYPAUSE BUTTON_PLAY #define SNAKE_PLAYPAUSE BUTTON_PLAY
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) || \
(CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define SNAKE_QUIT BUTTON_BACK #define SNAKE_QUIT BUTTON_BACK
#define SNAKE_LEFT BUTTON_LEFT #define SNAKE_LEFT BUTTON_LEFT
#define SNAKE_RIGHT BUTTON_RIGHT #define SNAKE_RIGHT BUTTON_RIGHT

View file

@ -238,7 +238,8 @@ Head and Tail are stored
#define SNAKE2_PLAYPAUSE BUTTON_FF #define SNAKE2_PLAYPAUSE BUTTON_FF
#define SNAKE2_PLAYPAUSE_TEXT "FF" #define SNAKE2_PLAYPAUSE_TEXT "FF"
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) || \
(CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define SNAKE2_LEFT BUTTON_LEFT #define SNAKE2_LEFT BUTTON_LEFT
#define SNAKE2_RIGHT BUTTON_RIGHT #define SNAKE2_RIGHT BUTTON_RIGHT
#define SNAKE2_UP BUTTON_UP #define SNAKE2_UP BUTTON_UP

View file

@ -67,7 +67,8 @@
#define SNOW_QUIT (BUTTON_HOME|BUTTON_REPEAT) #define SNOW_QUIT (BUTTON_HOME|BUTTON_REPEAT)
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) || \ #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) || \
(CONFIG_KEYPAD == CREATIVEZVM_PAD) (CONFIG_KEYPAD == CREATIVEZVM_PAD) || \
(CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define SNOW_QUIT BUTTON_BACK #define SNOW_QUIT BUTTON_BACK
#elif (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD) || \ #elif (CONFIG_KEYPAD == PHILIPS_HDD1630_PAD) || \

View file

@ -526,6 +526,21 @@
#define BUTTON_SAVE (BUTTON_SELECT|BUTTON_REPEAT) #define BUTTON_SAVE (BUTTON_SELECT|BUTTON_REPEAT)
#define BUTTON_SAVE_NAME "SELECT LONG" #define BUTTON_SAVE_NAME "SELECT LONG"
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define SOKOBAN_LEFT BUTTON_LEFT
#define SOKOBAN_RIGHT BUTTON_RIGHT
#define SOKOBAN_UP BUTTON_UP
#define SOKOBAN_DOWN BUTTON_DOWN
#define SOKOBAN_MENU BUTTON_MENU
#define SOKOBAN_UNDO BUTTON_BACK
#define SOKOBAN_REDO BUTTON_USER
//#define SOKOBAN_LEVEL_DOWN (BUTTON_POWER|BUTTON_REL)
//#define SOKOBAN_LEVEL_REPEAT (BUTTON_CENTER|BUTTON_REPEAT)
//#define SOKOBAN_LEVEL_UP (BUTTON_MENU|BUTTON_REPEAT)
#define SOKOBAN_PAUSE BUTTON_SELECT
#define BUTTON_SAVE BUTTON_SELECT
#define BUTTON_SAVE_NAME "SELECT"
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -544,6 +544,24 @@ CONFIG_KEYPAD == MROBE500_PAD
# define HK_CUR2STACK "NEXT" # define HK_CUR2STACK "NEXT"
# define HK_REM2STACK "PREV" # define HK_REM2STACK "PREV"
#elif (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
# define SOL_QUIT BUTTON_BACK
# define SOL_UP BUTTON_UP
# define SOL_DOWN BUTTON_DOWN
# define SOL_LEFT BUTTON_LEFT
# define SOL_RIGHT BUTTON_RIGHT
# define SOL_MOVE_PRE BUTTON_SELECT
# define SOL_MOVE (BUTTON_SELECT | BUTTON_REL)
# define SOL_DRAW BUTTON_MENU
# define SOL_REM2CUR (BUTTON_USER | BUTTON_REPEAT)
# define SOL_CUR2STACK (BUTTON_SELECT | BUTTON_REPEAT)
# define SOL_REM2STACK BUTTON_POWER
# define HK_MOVE "Select"
# define HK_DRAW "Menu"
# define HK_REM2CUR "Long User"
# define HK_CUR2STACK "Long Select.."
# define HK_REM2STACK "Power"
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -278,6 +278,15 @@
#define AST_RIGHT BUTTON_RIGHT #define AST_RIGHT BUTTON_RIGHT
#define AST_FIRE BUTTON_SELECT #define AST_FIRE BUTTON_SELECT
#elif (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define AST_PAUSE BUTTON_MENU
#define AST_QUIT BUTTON_BACK
#define AST_THRUST BUTTON_UP
#define AST_HYPERSPACE BUTTON_DOWN
#define AST_LEFT BUTTON_LEFT
#define AST_RIGHT BUTTON_RIGHT
#define AST_FIRE BUTTON_SELECT
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -480,6 +480,23 @@
#define STAR_LEVEL_DOWN_NAME "Vol-" #define STAR_LEVEL_DOWN_NAME "Vol-"
#define STAR_LEVEL_REPEAT_NAME "PREV LONG" #define STAR_LEVEL_REPEAT_NAME "PREV LONG"
#elif (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define STAR_QUIT BUTTON_BACK
#define STAR_LEFT BUTTON_LEFT
#define STAR_RIGHT BUTTON_RIGHT
#define STAR_UP BUTTON_UP
#define STAR_DOWN BUTTON_DOWN
#define STAR_TOGGLE_CONTROL BUTTON_SELECT
#define STAR_LEVEL_UP BUTTON_MENU
#define STAR_LEVEL_DOWN BUTTON_POWER
#define STAR_LEVEL_REPEAT BUTTON_USER
#define STAR_TOGGLE_CONTROL_NAME "Select"
#define STAR_QUIT_NAME "Back"
#define STAR_LEVEL_UP_NAME "Menu"
#define STAR_LEVEL_DOWN_NAME "Power"
#define STAR_LEVEL_REPEAT_NAME "User"
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -78,7 +78,8 @@
#define STARFIELD_DECREASE_NB_STARS BUTTON_LEFT #define STARFIELD_DECREASE_NB_STARS BUTTON_LEFT
#define STARFIELD_TOGGLE_COLOR BUTTON_SELECT #define STARFIELD_TOGGLE_COLOR BUTTON_SELECT
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) || \
(CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define STARFIELD_QUIT BUTTON_BACK #define STARFIELD_QUIT BUTTON_BACK
#define STARFIELD_INCREASE_ZMOVE BUTTON_UP #define STARFIELD_INCREASE_ZMOVE BUTTON_UP
#define STARFIELD_DECREASE_ZMOVE BUTTON_DOWN #define STARFIELD_DECREASE_ZMOVE BUTTON_DOWN

View file

@ -72,7 +72,8 @@ static bool cancel;
#define STATS_STOP BUTTON_POWER #define STATS_STOP BUTTON_POWER
#define STATS_STOP_REMOTE BUTTON_RC_DOWN #define STATS_STOP_REMOTE BUTTON_RC_DOWN
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD #elif CONFIG_KEYPAD == GIGABEAT_S_PAD || \
CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define STATS_STOP BUTTON_BACK #define STATS_STOP BUTTON_BACK
#elif CONFIG_KEYPAD == MROBE100_PAD #elif CONFIG_KEYPAD == MROBE100_PAD

View file

@ -263,6 +263,14 @@
#define STOPWATCH_SCROLL_UP BUTTON_UP #define STOPWATCH_SCROLL_UP BUTTON_UP
#define STOPWATCH_SCROLL_DOWN BUTTON_DOWN #define STOPWATCH_SCROLL_DOWN BUTTON_DOWN
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define STOPWATCH_QUIT BUTTON_BACK
#define STOPWATCH_START_STOP BUTTON_SELECT
#define STOPWATCH_RESET_TIMER BUTTON_MENU
#define STOPWATCH_LAP_TIMER BUTTON_USER
#define STOPWATCH_SCROLL_UP BUTTON_UP
#define STOPWATCH_SCROLL_DOWN BUTTON_DOWN
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -329,6 +329,16 @@
#define SUDOKU_BUTTON_MENU BUTTON_SELECT #define SUDOKU_BUTTON_MENU BUTTON_SELECT
#define SUDOKU_BUTTON_POSSIBLE BUTTON_VOL_DOWN #define SUDOKU_BUTTON_POSSIBLE BUTTON_VOL_DOWN
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define SUDOKU_BUTTON_QUIT BUTTON_BACK
#define SUDOKU_BUTTON_UP BUTTON_UP
#define SUDOKU_BUTTON_DOWN BUTTON_DOWN
#define SUDOKU_BUTTON_LEFT BUTTON_LEFT
#define SUDOKU_BUTTON_RIGHT BUTTON_RIGHT
#define SUDOKU_BUTTON_MENU BUTTON_MENU
#define SUDOKU_BUTTON_TOGGLE BUTTON_SELECT
#define SUDOKU_BUTTON_POSSIBLE BUTTON_USER
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -120,7 +120,8 @@ char buf[255];
#define SUPERDOM_RIGHT BUTTON_RIGHT #define SUPERDOM_RIGHT BUTTON_RIGHT
#define SUPERDOM_CANCEL (BUTTON_HOME|BUTTON_REPEAT) #define SUPERDOM_CANCEL (BUTTON_HOME|BUTTON_REPEAT)
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD #elif CONFIG_KEYPAD == GIGABEAT_S_PAD || \
CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define SUPERDOM_OK BUTTON_SELECT #define SUPERDOM_OK BUTTON_SELECT
#define SUPERDOM_UP BUTTON_UP #define SUPERDOM_UP BUTTON_UP
#define SUPERDOM_DOWN BUTTON_DOWN #define SUPERDOM_DOWN BUTTON_DOWN

View file

@ -39,6 +39,8 @@
#define TESTCODEC_EXITBUTTON (BUTTON_REC | BUTTON_REPEAT) #define TESTCODEC_EXITBUTTON (BUTTON_REC | BUTTON_REPEAT)
#elif CONFIG_KEYPAD == RK27XX_GENERIC_PAD #elif CONFIG_KEYPAD == RK27XX_GENERIC_PAD
#define TESTCODEC_EXITBUTTON (BUTTON_M | BUTTON_REPEAT) #define TESTCODEC_EXITBUTTON (BUTTON_M | BUTTON_REPEAT)
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define TESTCODEC_EXITBUTTON BUTTON_BACK
#elif defined(HAVE_TOUCHSCREEN) #elif defined(HAVE_TOUCHSCREEN)
#define TESTCODEC_EXITBUTTON BUTTON_TOPLEFT #define TESTCODEC_EXITBUTTON BUTTON_TOPLEFT
#else #else

View file

@ -37,6 +37,8 @@
#define FPS_QUIT (BUTTON_REC|BUTTON_REPEAT) #define FPS_QUIT (BUTTON_REC|BUTTON_REPEAT)
#elif CONFIG_KEYPAD == RK27XX_GENERIC_PAD #elif CONFIG_KEYPAD == RK27XX_GENERIC_PAD
#define FPS_QUIT (BUTTON_M|BUTTON_REPEAT) #define FPS_QUIT (BUTTON_M|BUTTON_REPEAT)
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define FPS_QUIT BUTTON_BACK
#elif defined(BUTTON_OFF) #elif defined(BUTTON_OFF)
#define FPS_QUIT BUTTON_OFF #define FPS_QUIT BUTTON_OFF
#else #else

View file

@ -402,7 +402,7 @@ static void time_text(void) /* tests mono_bitmap performance */
/* plugin entry point */ /* plugin entry point */
enum plugin_status plugin_start(const void* parameter) enum plugin_status plugin_start(const void* parameter)
{ {
#ifndef SIMULATOR #ifdef HAVE_ADJUSTABLE_CPU_FREQ
int cpu_freq; int cpu_freq;
#endif #endif
@ -447,7 +447,7 @@ enum plugin_status plugin_start(const void* parameter)
6*4*DURATION/HZ); 6*4*DURATION/HZ);
init_rand_table(); init_rand_table();
#ifndef SIMULATOR #ifdef HAVE_ADJUSTABLE_CPU_FREQ
cpu_freq = *rb->cpu_frequency; /* remember CPU frequency */ cpu_freq = *rb->cpu_frequency; /* remember CPU frequency */
#endif #endif
@ -458,7 +458,7 @@ enum plugin_status plugin_start(const void* parameter)
time_fillrect(); time_fillrect();
time_text(); time_text();
#ifndef SIMULATOR #ifdef HAVE_ADJUSTABLE_CPU_FREQ
if (*rb->cpu_frequency != cpu_freq) if (*rb->cpu_frequency != cpu_freq)
rb->fdprintf(log_fd, "\nCPU: %s\n", "clock changed!"); rb->fdprintf(log_fd, "\nCPU: %s\n", "clock changed!");
else else

View file

@ -436,6 +436,16 @@
#define TV_LINE_DOWN BUTTON_SCROLL_FWD #define TV_LINE_DOWN BUTTON_SCROLL_FWD
#define TV_BOOKMARK (BUTTON_DOWN|BUTTON_SELECT) #define TV_BOOKMARK (BUTTON_DOWN|BUTTON_SELECT)
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define TV_QUIT BUTTON_BACK
#define TV_SCROLL_UP BUTTON_UP
#define TV_SCROLL_DOWN BUTTON_DOWN
#define TV_SCREEN_LEFT BUTTON_LEFT
#define TV_SCREEN_RIGHT BUTTON_RIGHT
#define TV_MENU BUTTON_MENU
#define TV_AUTOSCROLL BUTTON_USER
#define TV_BOOKMARK BUTTON_SELECT
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -338,6 +338,17 @@
#define LABEL_MENU "PREV" #define LABEL_MENU "PREV"
#define LABEL_VOLUME "VOL+/VOL-" #define LABEL_VOLUME "VOL+/VOL-"
#elif (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define VUMETER_QUIT BUTTON_BACK
#define VUMETER_HELP BUTTON_USER
#define VUMETER_MENU BUTTON_MENU
#define VUMETER_UP BUTTON_UP
#define VUMETER_DOWN BUTTON_DOWN
#define LABEL_HELP "User"
#define LABEL_QUIT "Back"
#define LABEL_MENU "Menu"
#define LABEL_VOLUME "Up/Down"
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -180,7 +180,8 @@ static long max_cycle;
#define BTN_QUIT BUTTON_POWER #define BTN_QUIT BUTTON_POWER
#define BTN_STOPRESET BUTTON_REW #define BTN_STOPRESET BUTTON_REW
#elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) #elif (CONFIG_KEYPAD == GIGABEAT_S_PAD) || \
(CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define BTN_DIR_UP BUTTON_UP #define BTN_DIR_UP BUTTON_UP
#define BTN_DIR_DOWN BUTTON_DOWN #define BTN_DIR_DOWN BUTTON_DOWN

View file

@ -277,6 +277,15 @@ CONFIG_KEYPAD == MROBE500_PAD
#define DOWN BUTTON_DOWN #define DOWN BUTTON_DOWN
#define PAUSE BUTTON_SELECT #define PAUSE BUTTON_SELECT
#elif (CONFIG_KEYPAD == SAMSUNG_YPR0_PAD)
#define QUIT BUTTON_BACK
#define LEFT BUTTON_LEFT
#define RIGHT BUTTON_RIGHT
#define UP BUTTON_UP
#define DOWN BUTTON_DOWN
#define PAUSE BUTTON_SELECT
#else #else
#error No keymap defined! #error No keymap defined!
#endif #endif

View file

@ -28,7 +28,8 @@
#define ZX_SELECT BUTTON_SELECT #define ZX_SELECT BUTTON_SELECT
#define ZX_MENU BUTTON_MENU #define ZX_MENU BUTTON_MENU
#elif CONFIG_KEYPAD == GIGABEAT_S_PAD #elif CONFIG_KEYPAD == GIGABEAT_S_PAD || \
CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define ZX_UP BUTTON_UP #define ZX_UP BUTTON_UP
#define ZX_DOWN BUTTON_DOWN #define ZX_DOWN BUTTON_DOWN
@ -226,6 +227,15 @@
#define ZX_LEFT BUTTON_LEFT #define ZX_LEFT BUTTON_LEFT
#define ZX_RIGHT BUTTON_RIGHT #define ZX_RIGHT BUTTON_RIGHT
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define ZX_MENU BUTTON_MENU
#define ZX_UP BUTTON_UP
#define ZX_DOWN BUTTON_DOWN
#define ZX_SELECT BUTTON_CENTER
#define ZX_LEFT BUTTON_LEFT
#define ZX_RIGHT BUTTON_RIGHT
#else #else
#error Keymap not defined! #error Keymap not defined!

View file

@ -225,6 +225,15 @@
#elif CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD #elif CONFIG_KEYPAD == SANSA_FUZEPLUS_PAD
#define KBD_SELECT BUTTON_CENTER
#define KBD_ABORT BUTTON_BACK
#define KBD_LEFT BUTTON_LEFT
#define KBD_RIGHT BUTTON_RIGHT
#define KBD_UP BUTTON_UP
#define KBD_DOWN BUTTON_DOWN
#elif CONFIG_KEYPAD == SAMSUNG_YPR0_PAD
#define KBD_SELECT BUTTON_SELECT #define KBD_SELECT BUTTON_SELECT
#define KBD_ABORT BUTTON_BACK #define KBD_ABORT BUTTON_BACK
#define KBD_LEFT BUTTON_LEFT #define KBD_LEFT BUTTON_LEFT

View file

@ -610,6 +610,7 @@ Desu Rozen
Olivier Kaloudoff Olivier Kaloudoff
Kessia Pinheiro Kessia Pinheiro
Jean-Louis Biasini Jean-Louis Biasini
Lorenzo Miori
The libmad team The libmad team
The wavpack team The wavpack team

View file

@ -14,8 +14,10 @@ target/hosted/cpuinfo-linux.c
#endif #endif
target/hosted/powermgmt.c target/hosted/powermgmt.c
#ifndef SAMSUNG_YPR0 /* uses as3514 rtc */
target/hosted/rtc.c target/hosted/rtc.c
#endif #endif
#endif
system.c system.c
usb.c usb.c
#ifdef ROCKBOX_HAS_LOGF #ifdef ROCKBOX_HAS_LOGF
@ -62,6 +64,26 @@ target/hosted/sdl/app/button-application.c
#endif #endif
#endif #endif
#ifdef SAMSUNG_YPR0
#if (CONFIG_RTC == RTC_AS3514)
drivers/rtc/rtc_as3514.c
#else
target/hosted/rtc.c
#endif
target/hosted/ypr0/button-ypr0.c
target/hosted/ypr0/kernel-ypr0.c
target/hosted/ypr0/lcd-ypr0.c
target/hosted/ypr0/system-ypr0.c
target/hosted/ypr0/fs-ypr0.c
target/hosted/ypr0/lc-ypr0.c
thread.c
#ifdef HAVE_BACKLIGHT
target/hosted/ypr0/backlight-ypr0.c
#endif
target/hosted/ypr0/ascodec-ypr0.c
target/hosted/ypr0/powermgmt-ypr0.c
#endif
/* Maemo specific files */ /* Maemo specific files */
#if (CONFIG_PLATFORM & PLATFORM_MAEMO) #if (CONFIG_PLATFORM & PLATFORM_MAEMO)
target/hosted/maemo/maemo-thread.c target/hosted/maemo/maemo-thread.c
@ -368,6 +390,10 @@ drivers/audio/aic3x.c
#elif defined (HAVE_DUMMY_CODEC) #elif defined (HAVE_DUMMY_CODEC)
drivers/audio/dummy_codec.c drivers/audio/dummy_codec.c
#endif /* defined(HAVE_*) */ #endif /* defined(HAVE_*) */
#else /* PLATFORM_HOSTED */
#if defined(SAMSUNG_YPR0) && defined(HAVE_AS3514)
drivers/audio/as3514.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
@ -377,6 +403,7 @@ target/hosted/maemo/pcm-gstreamer.c
target/hosted/sdl/pcm-sdl.c target/hosted/sdl/pcm-sdl.c
#endif /* (CONFIG_PLATFORM & PLATFORM_MAEMO) */ #endif /* (CONFIG_PLATFORM & PLATFORM_MAEMO) */
#endif /* CONFIG_CODEC == SWCODEC */ #endif /* CONFIG_CODEC == SWCODEC */
#endif
#endif /* (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(BOOTLOADER) */ #endif /* (CONFIG_PLATFORM & PLATFORM_NATIVE) && !defined(BOOTLOADER) */
/* CPU Specific - By class then particular chip if applicable */ /* CPU Specific - By class then particular chip if applicable */
@ -722,7 +749,7 @@ target/arm/ascodec-pp.c
# endif # endif
# if !defined(BOOTLOADER) || defined(CPU_PP) # if !defined(BOOTLOADER) || defined(CPU_PP)
target/arm/adc-as3514.c target/arm/adc-as3514.c
# ifndef SANSA_M200V4 # if !defined(SANSA_M200V4) && !defined(SAMSUNG_YPR0)
target/arm/powermgmt-ascodec.c target/arm/powermgmt-ascodec.c
# endif # endif
# endif # endif

View file

@ -23,6 +23,7 @@
#include <stdio.h> /* snprintf */ #include <stdio.h> /* snprintf */
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include "config.h"
#include "rbpaths.h" #include "rbpaths.h"
#include "file.h" /* MAX_PATH */ #include "file.h" /* MAX_PATH */
#include "logf.h" #include "logf.h"
@ -38,11 +39,17 @@
#undef mkdir #undef mkdir
#undef rmdir #undef rmdir
#if (CONFIG_PLATFORM & PLATFORM_ANDROID) #if (CONFIG_PLATFORM & PLATFORM_ANDROID)
#include "dir-target.h" #include "dir-target.h"
#define opendir opendir_android #define opendir opendir_android
#define mkdir mkdir_android #define mkdir mkdir_android
#define rmdir rmdir_android #define rmdir rmdir_android
#elif defined(SAMSUNG_YPR0)
#include "dir-target.h"
#define opendir opendir_ypr0
#define mkdir mkdir_ypr0
#define rmdir rmdir_ypr0
#elif (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA)) #elif (CONFIG_PLATFORM & (PLATFORM_SDL|PLATFORM_MAEMO|PLATFORM_PANDORA))
#define open sim_open #define open sim_open
#define remove sim_remove #define remove sim_remove
@ -59,6 +66,8 @@ extern int sim_rmdir(const char* name);
const char *rbhome; const char *rbhome;
#endif #endif
#if !defined(SAMSUNG_YPR0)
/* flags for get_user_file_path() */ /* flags for get_user_file_path() */
/* whether you need write access to that file/dir, especially true /* whether you need write access to that file/dir, especially true
* for runtime generated files (config.cfg) */ * for runtime generated files (config.cfg) */
@ -238,3 +247,28 @@ int app_rmdir(const char* name)
} }
return rmdir(fname); return rmdir(fname);
} }
#else
int app_open(const char *name, int o, ...)
{
if (o & O_CREAT)
{
int ret;
va_list ap;
va_start(ap, o);
ret = open(name, o, va_arg(ap, mode_t));
va_end(ap);
return ret;
}
return open(name, o);
}
int app_creat(const char* name, mode_t mode) { return creat(name, mode); }
int app_remove(const char *name) { return remove(name); }
int app_rename(const char *old, const char *new) { return rename(old,new); }
DIR *app_opendir(const char *name) { return opendir(name); }
int app_mkdir(const char* name) { return mkdir(name); }
int app_rmdir(const char* name) { return rmdir(name); }
#endif

View file

@ -78,6 +78,7 @@ const struct sound_settings_info audiohw_settings[] = {
#endif #endif
}; };
#ifndef SAMSUNG_YPR0
/* Shadow registers */ /* Shadow registers */
static uint8_t as3514_regs[AS3514_NUM_AUDIO_REGS]; /* 8-bit registers */ static uint8_t as3514_regs[AS3514_NUM_AUDIO_REGS]; /* 8-bit registers */
@ -110,7 +111,29 @@ static void as3514_write_masked(unsigned int reg, unsigned int bits,
{ {
as3514_write(reg, (as3514_regs[reg] & ~mask) | (bits & mask)); as3514_write(reg, (as3514_regs[reg] & ~mask) | (bits & mask));
} }
#else
static void as3514_write(unsigned int reg, unsigned int value)
{
ascodec_write(reg, value);
}
/* Helpers to set/clear bits */
static void as3514_set(unsigned int reg, unsigned int bits)
{
ascodec_write(reg, ascodec_read(reg) | bits);
}
static void as3514_clear(unsigned int reg, unsigned int bits)
{
ascodec_write(reg, ascodec_read(reg) & ~bits);
}
static void as3514_write_masked(unsigned int reg, unsigned int bits,
unsigned int mask)
{
ascodec_write(reg, (ascodec_read(reg) & ~mask) | (bits & mask));
}
#endif
/* convert tenth of dB volume to master volume register value */ /* convert tenth of dB volume to master volume register value */
int tenthdb2master(int db) int tenthdb2master(int db)
{ {
@ -145,8 +168,11 @@ int sound_val2phys(int setting, int value)
*/ */
void audiohw_preinit(void) void audiohw_preinit(void)
{ {
#ifndef SAMSUNG_YPR0
/* read all reg values */ /* read all reg values */
ascodec_readbytes(0x0, AS3514_NUM_AUDIO_REGS, as3514_regs); ascodec_readbytes(0x0, AS3514_NUM_AUDIO_REGS, as3514_regs);
#endif
#ifdef HAVE_AS3543 #ifdef HAVE_AS3543
@ -284,9 +310,14 @@ void audiohw_set_master_vol(int vol_l, int vol_r)
#if CONFIG_CPU == AS3525v2 #if CONFIG_CPU == AS3525v2
#define MIXER_MAX_VOLUME 0x1b #define MIXER_MAX_VOLUME 0x1b
#else /* lets leave the AS3514 alone until its better tested*/ #else /* lets leave the AS3514 alone until its better tested*/
#ifdef SAMSUNG_YPR0
#define MIXER_MAX_VOLUME 0x1a
#else
#define MIXER_MAX_VOLUME 0x16 #define MIXER_MAX_VOLUME 0x16
#endif #endif
#endif
#ifndef SAMSUNG_YPR0
if (vol_r <= MIXER_MAX_VOLUME) { if (vol_r <= MIXER_MAX_VOLUME) {
mix_r = vol_r; mix_r = vol_r;
hph_r = 0; hph_r = 0;
@ -302,7 +333,16 @@ void audiohw_set_master_vol(int vol_l, int vol_r)
mix_l = MIXER_MAX_VOLUME; mix_l = MIXER_MAX_VOLUME;
hph_l = vol_l - MIXER_MAX_VOLUME; hph_l = vol_l - MIXER_MAX_VOLUME;
} }
#else
/* Okay. This is shit coded indeed. It is just a test.
Some considerations: Samsung keeps DAC constantly to 0x1a volume. It modifies only the headphone amp volume
*/
mix_r = 0x1a;
mix_l = 0x1a;
hph_l = vol_l;
hph_r = vol_r;
#endif
as3514_write_masked(AS3514_DAC_R, mix_r, AS3514_VOL_MASK); as3514_write_masked(AS3514_DAC_R, mix_r, AS3514_VOL_MASK);
as3514_write_masked(AS3514_DAC_L, mix_l, AS3514_VOL_MASK); as3514_write_masked(AS3514_DAC_L, mix_l, AS3514_VOL_MASK);

View file

@ -141,11 +141,11 @@ void rtc_alarm_poweroff(void)
seconds = 24*3600; seconds = 24*3600;
seconds -= tm.tm_sec; seconds -= tm.tm_sec;
#ifndef SAMSUNG_YPR0
/* disable MCLK, it is a wakeup source and prevents proper shutdown */ /* disable MCLK, it is a wakeup source and prevents proper shutdown */
CGU_AUDIO = (2 << 0) | (1 << 11); CGU_AUDIO = (2 << 0) | (1 << 11);
CGU_PLLBSUP = (1 << 2) | (1 << 3); CGU_PLLBSUP = (1 << 2) | (1 << 3);
#endif
/* write wakeup register */ /* write wakeup register */
alarm.seconds = seconds; alarm.seconds = seconds;
alarm.enabled = true; alarm.enabled = true;

View file

@ -131,9 +131,14 @@ extern void audiohw_set_sampr_dividers(int fsel);
/* Headphone volume goes from -81.0 ... +6dB */ /* Headphone volume goes from -81.0 ... +6dB */
#define VOLUME_MIN -810 #define VOLUME_MIN -810
#else #else
#ifdef SAMSUNG_YPR0
/* Headphone volume goes from -40.5 ... +6dB */
#define VOLUME_MIN -405
#else
/* Headphone volume goes from -73.5 ... +6dB */ /* Headphone volume goes from -73.5 ... +6dB */
#define VOLUME_MIN -735 #define VOLUME_MIN -735
#endif #endif
#endif
#define VOLUME_MAX 60 #define VOLUME_MAX 60
/*** Audio Registers ***/ /*** Audio Registers ***/

View file

@ -28,4 +28,8 @@
#include "ascodec-target.h" #include "ascodec-target.h"
#endif #endif
#ifdef SAMSUNG_YPR0
#include "ascodec-target.h"
#endif
#endif #endif

View file

@ -79,7 +79,7 @@
#elif defined(HAVE_DUMMY_CODEC) #elif defined(HAVE_DUMMY_CODEC)
#include "dummy_codec.h" #include "dummy_codec.h"
#endif #endif
#if (CONFIG_PLATFORM & PLATFORM_HOSTED) #if (CONFIG_PLATFORM & (PLATFORM_ANDROID|PLATFORM_MAEMO|PLATFORM_PANDORA|PLATFORM_SDL))
/* #include <SDL_audio.h> gives errors in other code areas, /* #include <SDL_audio.h> gives errors in other code areas,
* we don't really need it here, so don't. but it should maybe be fixed */ * we don't really need it here, so don't. but it should maybe be fixed */
#ifndef SIMULATOR /* simulator gets values from the target .h files */ #ifndef SIMULATOR /* simulator gets values from the target .h files */

View file

@ -143,6 +143,7 @@
#define HM60X_PAD 50 #define HM60X_PAD 50
#define HM801_PAD 51 #define HM801_PAD 51
#define SANSA_CONNECT_PAD 52 #define SANSA_CONNECT_PAD 52
#define SAMSUNG_YPR0_PAD 53
/* CONFIG_REMOTE_KEYPAD */ /* CONFIG_REMOTE_KEYPAD */
#define H100_REMOTE 1 #define H100_REMOTE 1
@ -232,6 +233,7 @@
#define LCD_HX8340B 44 /* as used by the HiFiMAN HM-601/HM-602/HM-801 */ #define LCD_HX8340B 44 /* as used by the HiFiMAN HM-601/HM-602/HM-801 */
#define LCD_CONNECT 45 /* as used by the Sandisk Sansa Connect */ #define LCD_CONNECT 45 /* as used by the Sandisk Sansa Connect */
#define LCD_GIGABEATS 46 #define LCD_GIGABEATS 46
#define LCD_YPR0 47
/* LCD_PIXELFORMAT */ /* LCD_PIXELFORMAT */
#define HORIZONTAL_PACKING 1 #define HORIZONTAL_PACKING 1
@ -483,6 +485,8 @@ Lyre prototype 1 */
#include "config/nokian900.h" #include "config/nokian900.h"
#elif defined(PANDORA) #elif defined(PANDORA)
#include "config/pandora.h" #include "config/pandora.h"
#elif defined(SAMSUNG_YPR0)
#include "config/ypr0.h"
#else #else
/* no known platform */ /* no known platform */
#endif #endif
@ -580,6 +584,10 @@ Lyre prototype 1 */
#define CONFIG_BACKLIGHT_FADING BACKLIGHT_NO_FADING #define CONFIG_BACKLIGHT_FADING BACKLIGHT_NO_FADING
#endif #endif
#ifndef CONFIG_I2C
#define CONFIG_I2C I2C_NONE
#endif
#ifndef CONFIG_TUNER #ifndef CONFIG_TUNER
#define CONFIG_TUNER 0 #define CONFIG_TUNER 0
#endif #endif
@ -600,6 +608,14 @@ Lyre prototype 1 */
#define CONFIG_RTC 0 #define CONFIG_RTC 0
#endif #endif
#ifndef BATTERY_TYPES_COUNT
#define BATTERY_TYPES_COUNT 0
#endif
#ifndef BATTERY_CAPACITY_INC
#define BATTERY_CAPACITY_INC 0
#endif
#ifndef CONFIG_ORIENTATION #ifndef CONFIG_ORIENTATION
#if LCD_HEIGHT > LCD_WIDTH #if LCD_HEIGHT > LCD_WIDTH
#define CONFIG_ORIENTATION SCREEN_PORTRAIT #define CONFIG_ORIENTATION SCREEN_PORTRAIT

View file

@ -0,0 +1,168 @@
/*
* This config file is for the RockBox as application on the Samsung YP-R0 player.
* The target name for ifdefs is: SAMSUNG_YPR0; or CONFIG_PLATFORM & PLAFTORM_YPR0
*/
#define TARGET_TREE /* this target is using the target tree system */
/* We don't run on hardware directly */
/* YP-R0 need it too of course */
#define CONFIG_PLATFORM (PLATFORM_HOSTED)
/* For Rolo and boot loader */
#define MODEL_NUMBER 100
#define MODEL_NAME "Samsung YP-R0"
/* Indeed to check that */
/*TODO: R0 should charge battery automatically, no software stuff to manage that. Just to know about some as3543 registers, that should be set after loading samsung's afe.ko module
*/
/*TODO: implement USB data transfer management -> see safe mode script and think a way to implemtent it in the code */
#define USB_NONE
/* Hardware controlled charging with monitoring */
//#define CONFIG_CHARGING CHARGING_MONITOR
/* There is only USB charging */
//#define HAVE_USB_POWER
/* define this if you have a bitmap LCD display */
#define HAVE_LCD_BITMAP
/* define this if you have a colour LCD */
#define HAVE_LCD_COLOR
/* define this if the LCD needs to be shutdown */
/* TODO: Our framebuffer must be closed... */
#define HAVE_LCD_SHUTDOWN
/* define this if you want album art for this target */
#define HAVE_ALBUMART
/* define this to enable bitmap scaling */
#define HAVE_BMP_SCALING
/* define this to enable JPEG decoding */
#define HAVE_JPEG
/* define this if you have access to the quickscreen */
#define HAVE_QUICKSCREEN
/* define this if you have access to the pitchscreen */
#define HAVE_PITCHSCREEN
/* define this if you would like tagcache to build on this target */
#define HAVE_TAGCACHE
/* LCD dimensions
*
* overriden by configure for application builds */
#ifndef LCD_WIDTH
#define LCD_WIDTH 240
#endif
#ifndef LCD_HEIGHT
#define LCD_HEIGHT 320
#endif
#define LCD_DEPTH 16
/* Check that but should not matter */
#define LCD_PIXELFORMAT 565
/* YP-R0 has the backlight */
#define HAVE_BACKLIGHT
/* Define this for LCD backlight brightness available */
#define HAVE_BACKLIGHT_BRIGHTNESS
/* Main LCD backlight brightness range and defaults */
/* 0 is turned off. 31 is the real maximum for the ASCODEC DCDC but samsung doesn't use any value over 15, so it safer to don't go up too much */
#define MIN_BRIGHTNESS_SETTING 1
#define MAX_BRIGHTNESS_SETTING 15
#define DEFAULT_BRIGHTNESS_SETTING 4
/* Which backlight fading type? */
/* TODO: ASCODEC has an auto dim feature, so disabling the supply to leds should do the trick. But for now I tested SW fading only */
#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING
/* define this if you have RTC RAM available for settings */
/* TODO: in theory we could use that, ascodec offers us such a ram. we have also a small device, part of the nand of 1 MB size, that Samsung uses to store region code etc and it's almost unused space */
//#define HAVE_RTC_RAM
/* define this if you have a real-time clock */
//#define CONFIG_RTC APPLICATION
#define CONFIG_RTC RTC_AS3514
#define HAVE_RTC_ALARM
/* The number of bytes reserved for loadable codecs */
#define CODEC_SIZE 0x80000
/* The number of bytes reserved for loadable plugins */
#define PLUGIN_BUFFER_SIZE 0x100000
/* We can do AB-repeat -> we use User key, our hotkey */
#define AB_REPEAT_ENABLE
#define ACTION_WPSAB_SINGLE ACTION_WPS_HOTKEY
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
/* R0 KeyPad configuration for plugins */
#define CONFIG_KEYPAD SAMSUNG_YPR0_PAD
/* It's better to close /dev/r0Btn at shutdown */
#define BUTTON_DRIVER_CLOSE
/* The YPR0 has a as3534 codec and we use that to control the volume */
#define HAVE_AS3514
#define HAVE_AS3543
#define HAVE_SW_TONE_CONTROLS
/* TODO: Make use of the si4703 tuner hardware */
/* #define CONFIG_TUNER SI4700 */
/* #define HAVE_TUNER_PWR_CTRL*/
/*TODO: In R0 there is an interrupt for this (figure out ioctls)*/
/* #define HAVE_HEADPHONE_DETECTION */
/* Define current usage levels. */
/* TODO: to be filled with correct values after implementing power management */
#define CURRENT_NORMAL 88 /* 18 hours from a 1600 mAh battery */
#define CURRENT_BACKLIGHT 30 /* TBD */
#define CURRENT_RECORD 0 /* no recording yet */
/* TODO: We need to do battery handling */
//#define BATTERY_CAPACITY_DEFAULT 600 /* default battery capacity */
//#define BATTERY_CAPACITY_MIN 600 /* min. capacity selectable */
//#define BATTERY_CAPACITY_MAX 700 /* max. capacity selectable */
//#define BATTERY_CAPACITY_INC 50 /* capacity increment */
//#define BATTERY_TYPES_COUNT 1 /* only one type */
/* TODO: We possibly can only watch linux charging */
//#define CONFIG_CHARGING CHARGING_TARGET
//#define HAVE_RESET_BATTERY_FILTER
/* same dimensions as gigabeats */
#define CONFIG_LCD LCD_YPR0
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF
/* Define this if you have adjustable CPU frequency
* NOTE: We could do that on this device, but it's probably better
* to let linux do it (we set ondemand governor before loading Rockbox) */
/* #define HAVE_ADJUSTABLE_CPU_FREQ */
/* Define this to the CPU frequency */
#define CPU_FREQ 532000000
/* 0.8Vcore using 200 MHz */
/* #define CPUFREQ_DEFAULT 200000000 */
/* This is 400 MHz -> not so powersaving-ful */
/* #define CPUFREQ_NORMAL 400000000 */
/* Max IMX37 Cpu Frequency */
/* #define CPUFREQ_MAX CPU_FREQ */
/* TODO: my idea is to create a folder in the cramfs [/.rockbox], mounting it by the starter script as the current working directory, so no issues of any type keeping the rockbox folder as in all other players */
#define BOOTDIR "/.rockbox"

View file

@ -44,7 +44,7 @@
#define ROCKBOX_DIR_LEN (sizeof(ROCKBOX_DIR)-1) #define ROCKBOX_DIR_LEN (sizeof(ROCKBOX_DIR)-1)
#endif /* def __PCTOOL__ */ #endif /* def __PCTOOL__ */
#ifndef APPLICATION #if !defined(APPLICATION) || defined(SAMSUNG_YPR0)
/* make sure both are the same for native builds */ /* make sure both are the same for native builds */
#undef ROCKBOX_LIBRARY_PATH #undef ROCKBOX_LIBRARY_PATH
@ -57,6 +57,7 @@
#define PLAYLIST_CATALOG_DEFAULT_DIR "/Playlists" #define PLAYLIST_CATALOG_DEFAULT_DIR "/Playlists"
#define paths_init() #define paths_init()
#else /* application */ #else /* application */
#define PLUGIN_DIR ROCKBOX_LIBRARY_PATH "/rockbox/rocks" #define PLUGIN_DIR ROCKBOX_LIBRARY_PATH "/rockbox/rocks"
@ -80,7 +81,7 @@ extern void paths_init(void);
#define PLUGIN_DEMOS_DIR PLUGIN_DIR "/demos" #define PLUGIN_DEMOS_DIR PLUGIN_DIR "/demos"
#define VIEWERS_DIR PLUGIN_DIR "/viewers" #define VIEWERS_DIR PLUGIN_DIR "/viewers"
#ifdef APPLICATION #if defined(APPLICATION) && !defined(SAMSUNG_YPR0)
#define PLUGIN_DATA_DIR "/.rockbox/rocks.data" #define PLUGIN_DATA_DIR "/.rockbox/rocks.data"
#define PLUGIN_GAMES_DATA_DIR PLUGIN_DATA_DIR #define PLUGIN_GAMES_DATA_DIR PLUGIN_DATA_DIR
#define PLUGIN_APPS_DATA_DIR PLUGIN_DATA_DIR #define PLUGIN_APPS_DATA_DIR PLUGIN_DATA_DIR

View file

@ -74,7 +74,7 @@ typedef struct {
#if defined(APPLICATION) #if defined(APPLICATION)
#if (CONFIG_PLATFORM & PLATFORM_ANDROID) #if (CONFIG_PLATFORM & PLATFORM_ANDROID) || defined(SAMSUNG_YPR0)
#include "dir-target.h" #include "dir-target.h"
#endif #endif
# undef opendir_uncached # undef opendir_uncached

View file

@ -70,6 +70,11 @@ static struct mixer_channel * active_channels[PCM_MIXER_NUM_CHANNELS+1] IBSS_ATT
#define MAX_IDLE_FRAMES (NATIVE_FREQUENCY*3 / MIX_FRAME_SAMPLES) #define MAX_IDLE_FRAMES (NATIVE_FREQUENCY*3 / MIX_FRAME_SAMPLES)
static unsigned int idle_counter = 0; static unsigned int idle_counter = 0;
/* Cheapo buffer align macro to align to the 16-16 PCM size */
#define ALIGN_CHANNEL(start, size) \
({ start = (void *)(((uintptr_t)start + 3) & ~3); \
size &= ~3; })
#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #if (CONFIG_PLATFORM & PLATFORM_NATIVE)
/* Include any implemented CPU-optimized mixdown routines */ /* Include any implemented CPU-optimized mixdown routines */

View file

@ -235,7 +235,8 @@ static void set_prescaled_volume(void)
dsp_callback(DSP_CALLBACK_SET_SW_VOLUME, 0); dsp_callback(DSP_CALLBACK_SET_SW_VOLUME, 0);
#endif #endif
#ifndef HAVE_SDL_AUDIO /* ypr0 with sdl has separate volume controls */
#if !defined(HAVE_SDL_AUDIO) || defined(SAMSUNG_YPR0)
#if CONFIG_CODEC == MAS3507D #if CONFIG_CODEC == MAS3507D
dac_volume(tenthdb2reg(l), tenthdb2reg(r), false); dac_volume(tenthdb2reg(l), tenthdb2reg(r), false);
#elif defined(HAVE_UDA1380) || defined(HAVE_WM8975) || defined(HAVE_WM8758) \ #elif defined(HAVE_UDA1380) || defined(HAVE_WM8975) || defined(HAVE_WM8758) \
@ -670,7 +671,7 @@ void sound_set(int setting, int value)
&& !defined (HAVE_WM8711) && !defined (HAVE_WM8721) \ && !defined (HAVE_WM8711) && !defined (HAVE_WM8721) \
&& !defined (HAVE_WM8731) && !defined (HAVE_WM8978) \ && !defined (HAVE_WM8731) && !defined (HAVE_WM8978) \
&& !defined (HAVE_WM8750) && !defined (HAVE_WM8751) \ && !defined (HAVE_WM8750) && !defined (HAVE_WM8751) \
&& !defined(HAVE_AK4537)) || (CONFIG_PLATFORM & PLATFORM_HOSTED) && !defined(HAVE_AK4537)) || defined(SIMULATOR)
int sound_val2phys(int setting, int value) int sound_val2phys(int setting, int value)
{ {
#if CONFIG_CODEC == MAS3587F #if CONFIG_CODEC == MAS3587F

View file

@ -26,7 +26,7 @@
#include "string.h" #include "string.h"
#include "file.h" #include "file.h"
#if (CONFIG_PLATFORM & PLATFORM_NATIVE) #ifdef HAVE_ADJUSTABLE_CPU_FREQ
long cpu_frequency SHAREDBSS_ATTR = CPU_FREQ; long cpu_frequency SHAREDBSS_ATTR = CPU_FREQ;
#endif #endif

View file

@ -0,0 +1,518 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2010 Thomas Martitz
*
* 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.
*
****************************************************************************/
/*
* Based, but heavily modified, on the example given at
* http://www.alsa-project.org/alsa-doc/alsa-lib/_2test_2pcm_8c-example.html
*
* This driver uses the so-called unsafe async callback method and hardcoded device
* names. It fails when the audio device is busy by other apps.
*
* TODO: Rewrite this to do it properly with multithreading
*
* Alternatively, a version using polling in a tick task is provided. While
* supposedly safer, it appears to use more CPU (however I didn't measure it
* accurately, only looked at htop). At least, in this mode the "default"
* device works which doesnt break with other apps running.
* device works which doesnt break with other apps running.
*/
#include "autoconf.h"
#include <stdlib.h>
#include <stdbool.h>
#include <alsa/asoundlib.h>
#include "system.h"
#include "debug.h"
#include "kernel.h"
#include "pcm.h"
#include "pcm-internal.h"
#include "pcm_mixer.h"
#include "pcm_sampr.h"
#include <pthread.h>
#include <signal.h>
#define USE_ASYNC_CALLBACK
/* plughw:0,0 works with both, however "default" is recommended.
* default doesnt seem to work with async callback but doesn't break
* with multple applications running */
static char device[] = "plughw:0,0"; /* playback device */
static const snd_pcm_access_t access_ = SND_PCM_ACCESS_RW_INTERLEAVED; /* access mode */
static const snd_pcm_format_t format = SND_PCM_FORMAT_S16; /* sample format */
static const int channels = 2; /* count of channels */
static unsigned int rate = 44100; /* stream rate */
static snd_pcm_t *handle;
static snd_pcm_sframes_t buffer_size = MIX_FRAME_SAMPLES * 32; /* ~16k */
static snd_pcm_sframes_t period_size = MIX_FRAME_SAMPLES * 4; /* ~4k */
static short *frames;
static const char *pcm_data = 0;
static size_t pcm_size = 0;
#ifdef USE_ASYNC_CALLBACK
static snd_async_handler_t *ahandler;
static pthread_mutex_t pcm_mtx;
#else
static int recursion;
#endif
static int set_hwparams(snd_pcm_t *handle, unsigned sample_rate)
{
unsigned int rrate;
int err;
snd_pcm_hw_params_t *params;
snd_pcm_hw_params_alloca(&params);
/* choose all parameters */
err = snd_pcm_hw_params_any(handle, params);
if (err < 0)
{
printf("Broken configuration for playback: no configurations available: %s\n", snd_strerror(err));
return err;
}
/* set the interleaved read/write format */
err = snd_pcm_hw_params_set_access(handle, params, access_);
if (err < 0)
{
printf("Access type not available for playback: %s\n", snd_strerror(err));
return err;
}
/* set the sample format */
err = snd_pcm_hw_params_set_format(handle, params, format);
if (err < 0)
{
printf("Sample format not available for playback: %s\n", snd_strerror(err));
return err;
}
/* set the count of channels */
err = snd_pcm_hw_params_set_channels(handle, params, channels);
if (err < 0)
{
printf("Channels count (%i) not available for playbacks: %s\n", channels, snd_strerror(err));
return err;
}
/* set the stream rate */
rrate = sample_rate;
err = snd_pcm_hw_params_set_rate_near(handle, params, &rrate, 0);
if (err < 0)
{
printf("Rate %iHz not available for playback: %s\n", rate, snd_strerror(err));
return err;
}
if (rrate != sample_rate)
{
printf("Rate doesn't match (requested %iHz, get %iHz)\n", sample_rate, err);
return -EINVAL;
}
/* set the buffer size */
err = snd_pcm_hw_params_set_buffer_size_near(handle, params, &buffer_size);
if (err < 0)
{
printf("Unable to set buffer size %i for playback: %s\n", buffer_size, snd_strerror(err));
return err;
}
/* set the period size */
err = snd_pcm_hw_params_set_period_size_near (handle, params, &period_size, NULL);
if (err < 0)
{
printf("Unable to set period size %i for playback: %s\n", period_size, snd_strerror(err));
return err;
}
if (!frames)
frames = malloc(period_size * channels * sizeof(short));
/* write the parameters to device */
err = snd_pcm_hw_params(handle, params);
if (err < 0)
{
printf("Unable to set hw params for playback: %s\n", snd_strerror(err));
return err;
}
return 0;
}
/* Set sw params: playback start threshold and low buffer watermark */
static int set_swparams(snd_pcm_t *handle)
{
int err;
snd_pcm_sw_params_t *swparams;
snd_pcm_sw_params_alloca(&swparams);
/* get the current swparams */
err = snd_pcm_sw_params_current(handle, swparams);
if (err < 0)
{
printf("Unable to determine current swparams for playback: %s\n", snd_strerror(err));
return err;
}
/* start the transfer when the buffer is haalmost full */
err = snd_pcm_sw_params_set_start_threshold(handle, swparams, buffer_size / 2);
if (err < 0)
{
printf("Unable to set start threshold mode for playback: %s\n", snd_strerror(err));
return err;
}
/* allow the transfer when at least period_size samples can be processed */
err = snd_pcm_sw_params_set_avail_min(handle, swparams, period_size);
if (err < 0)
{
printf("Unable to set avail min for playback: %s\n", snd_strerror(err));
return err;
}
/* write the parameters to the playback device */
err = snd_pcm_sw_params(handle, swparams);
if (err < 0)
{
printf("Unable to set sw params for playback: %s\n", snd_strerror(err));
return err;
}
return 0;
}
/* copy pcm samples to a spare buffer, suitable for snd_pcm_writei() */
static bool fill_frames(void)
{
ssize_t copy_n, frames_left = period_size;
bool new_buffer = false;
while (frames_left > 0)
{
if (!pcm_size)
{
new_buffer = true;
pcm_play_get_more_callback((void **)&pcm_data, &pcm_size);
if (!pcm_size || !pcm_data)
return false;
}
copy_n = MIN((ssize_t)pcm_size, frames_left*4);
memcpy(&frames[2*(period_size-frames_left)], pcm_data, copy_n);
pcm_data += copy_n;
pcm_size -= copy_n;
frames_left -= copy_n/4;
if (new_buffer)
{
new_buffer = false;
pcm_play_dma_started_callback();
}
}
return true;
}
#ifdef USE_ASYNC_CALLBACK
static void async_callback(snd_async_handler_t *ahandler)
{
snd_pcm_t *handle = snd_async_handler_get_pcm(ahandler);
if (pthread_mutex_trylock(&pcm_mtx) != 0)
return;
#else
static void pcm_tick(void)
{
if (snd_pcm_state(handle) != SND_PCM_STATE_RUNNING)
return;
#endif
while (snd_pcm_avail_update(handle) >= period_size)
{
if (fill_frames())
{
int err = snd_pcm_writei(handle, frames, period_size);
if (err < 0 && err != period_size && err != -EAGAIN)
{
printf("Write error: written %i expected %li\n", err, period_size);
break;
}
}
else
{
DEBUGF("%s: No Data.\n", __func__);
break;
}
}
#ifdef USE_ASYNC_CALLBACK
pthread_mutex_unlock(&pcm_mtx);
#endif
}
static int async_rw(snd_pcm_t *handle)
{
int err;
snd_pcm_sframes_t sample_size;
short *samples;
#ifdef USE_ASYNC_CALLBACK
err = snd_async_add_pcm_handler(&ahandler, handle, async_callback, NULL);
if (err < 0)
{
DEBUGF("Unable to register async handler: %s\n", snd_strerror(err));
return err;
}
#endif
/* fill buffer with silence to initiate playback without noisy click */
sample_size = buffer_size;
samples = malloc(sample_size * channels * sizeof(short));
snd_pcm_format_set_silence(format, samples, sample_size);
err = snd_pcm_writei(handle, samples, sample_size);
free(samples);
if (err < 0)
{
DEBUGF("Initial write error: %s\n", snd_strerror(err));
return err;
}
if (err != (ssize_t)sample_size)
{
DEBUGF("Initial write error: written %i expected %li\n", err, sample_size);
return err;
}
if (snd_pcm_state(handle) == SND_PCM_STATE_PREPARED)
{
err = snd_pcm_start(handle);
if (err < 0)
{
DEBUGF("Start error: %s\n", snd_strerror(err));
return err;
}
}
return 0;
}
void cleanup(void)
{
free(frames);
frames = NULL;
snd_pcm_close(handle);
}
void pcm_play_dma_init(void)
{
int err;
if ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0)
{
printf("%s(): Cannot open device %s: %s\n", __func__, device, snd_strerror(err));
exit(EXIT_FAILURE);
return;
}
if ((err = snd_pcm_nonblock(handle, 1)))
printf("Could not set non-block mode: %s\n", snd_strerror(err));
if ((err = set_hwparams(handle, rate)) < 0)
{
printf("Setting of hwparams failed: %s\n", snd_strerror(err));
exit(EXIT_FAILURE);
}
if ((err = set_swparams(handle)) < 0)
{
printf("Setting of swparams failed: %s\n", snd_strerror(err));
exit(EXIT_FAILURE);
}
#ifdef USE_ASYNC_CALLBACK
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&pcm_mtx, &attr);
#else
tick_add_task(pcm_tick);
#endif
atexit(cleanup);
return;
}
void pcm_play_lock(void)
{
#ifdef USE_ASYNC_CALLBACK
pthread_mutex_lock(&pcm_mtx);
#else
if (recursion++ == 0)
tick_remove_task(pcm_tick);
#endif
}
void pcm_play_unlock(void)
{
#ifdef USE_ASYNC_CALLBACK
pthread_mutex_unlock(&pcm_mtx);
#else
if (--recursion == 0)
tick_add_task(pcm_tick);
#endif
}
static void pcm_dma_apply_settings_nolock(void)
{
snd_pcm_drop(handle);
set_hwparams(handle, pcm_sampr);
}
void pcm_dma_apply_settings(void)
{
pcm_play_lock();
pcm_dma_apply_settings_nolock();
pcm_play_unlock();
}
void pcm_play_dma_pause(bool pause)
{
snd_pcm_pause(handle, pause);
}
void pcm_play_dma_stop(void)
{
snd_pcm_drain(handle);
}
void pcm_play_dma_start(const void *addr, size_t size)
{
pcm_dma_apply_settings_nolock();
pcm_data = addr;
pcm_size = size;
while (1)
{
snd_pcm_state_t state = snd_pcm_state(handle);
switch (state)
{
case SND_PCM_STATE_RUNNING:
return;
case SND_PCM_STATE_XRUN:
{
DEBUGF("Trying to recover from error\n");
int err = snd_pcm_recover(handle, -EPIPE, 0);
if (err < 0)
DEBUGF("Recovery failed: %s\n", snd_strerror(err));
continue;
}
case SND_PCM_STATE_SETUP:
{
int err = snd_pcm_prepare(handle);
if (err < 0)
printf("Prepare error: %s\n", snd_strerror(err));
/* fall through */
}
case SND_PCM_STATE_PREPARED:
{ /* prepared state, we need to fill the buffer with silence before
* starting */
int err = async_rw(handle);
if (err < 0)
printf("Start error: %s\n", snd_strerror(err));
return;
}
case SND_PCM_STATE_PAUSED:
{ /* paused, simply resume */
pcm_play_dma_pause(0);
return;
}
case SND_PCM_STATE_DRAINING:
/* run until drained */
continue;
default:
DEBUGF("Unhandled state: %s\n", snd_pcm_state_name(state));
return;
}
}
}
size_t pcm_get_bytes_waiting(void)
{
return pcm_size;
}
const void * pcm_play_dma_get_peak_buffer(int *count)
{
uintptr_t addr = (uintptr_t)pcm_data;
*count = pcm_size / 4;
return (void *)((addr + 3) & ~3);
}
void pcm_play_dma_postinit(void)
{
}
void pcm_set_mixer_volume(int volume)
{
(void)volume;
}
#ifdef HAVE_RECORDING
void pcm_rec_lock(void)
{
}
void pcm_rec_unlock(void)
{
}
void pcm_rec_dma_init(void)
{
}
void pcm_rec_dma_close(void)
{
}
void pcm_rec_dma_start(void *start, size_t size)
{
(void)start;
(void)size;
}
void pcm_rec_dma_stop(void)
{
}
const void * pcm_rec_dma_get_peak_buffer(void)
{
return NULL;
}
void audiohw_set_recvol(int left, int right, int type)
{
(void)left;
(void)right;
(void)type;
}
#endif /* HAVE_RECORDING */

View file

@ -0,0 +1,25 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id: adc-target.h 29516 2011-03-05 15:31:52Z thomasjfox $
*
* Copyright (C) 2011 by Lorenzo Miori
*
* 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.
*
****************************************************************************/
#ifndef __ADC_TARGET_H__
#define __ADC_TARGET_H__
#endif /* __ADC_TARGET_H__ */

View file

@ -0,0 +1,92 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id: ascodec-target.h 26116 2010-05-17 20:53:25Z funman $
*
* Module wrapper for AS3543 audio codec, using /dev/afe (afe.ko) of Samsung YP-R0
*
* Copyright (c) 2011 Lorenzo Miori
*
* 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.
*
****************************************************************************/
#ifndef _ASCODEC_TARGET_H
#define _ASCODEC_TARGET_H
#include "as3514.h"
#include "kernel.h"
#include "adc.h"
#include "ascodec.h"
/* ioctl parameter struct */
struct codec_req_struct {
/* This works for every kind of afe.ko module requests */
unsigned char reg; /* Main register address */
unsigned char subreg; /* Set this only if you are reading/writing a PMU register*/
unsigned char value; /* To be read if reading a register; to be set if writing to a register */
};
int ascodec_init(void);
void ascodec_close(void);
int ascodec_write(unsigned int reg, unsigned int value);
int ascodec_read(unsigned int reg);
void ascodec_write_pmu(unsigned int index, unsigned int subreg, unsigned int value);
int ascodec_read_pmu(unsigned int index, unsigned int subreg);
void ascodec_set(unsigned int reg, unsigned int bits);
void ascodec_clear(unsigned int reg, unsigned int bits);
void ascodec_write_masked(unsigned int reg, unsigned int bits, unsigned int mask);
int ascodec_readbytes(unsigned int index, unsigned int len, unsigned char *data);
unsigned short adc_read(int channel);
void ascodec_lock(void);
void ascodec_unlock(void);
static inline bool ascodec_chg_status(void)
{
return ascodec_read(AS3514_IRQ_ENRD0) & CHG_STATUS;
}
static inline bool ascodec_endofch(void)
{
return ascodec_read(AS3514_IRQ_ENRD0) & CHG_ENDOFCH;
}
static inline void ascodec_monitor_endofch(void)
{
ascodec_write(AS3514_IRQ_ENRD0, IRQ_ENDOFCH);
}
static inline void ascodec_wait_adc_finished(void)
{
/*
* FIXME: not implemented
*
* If irqs are not available on the target platform,
* this should be most likely implemented by polling
* AS3514_IRQ_ENRD2 in the same way powermgmt-ascodec.c
* is polling IRQ_ENDOFCH.
*/
}
static inline void ascodec_write_charger(int value)
{
ascodec_write_pmu(AS3543_CHARGER, 1, value);
}
static inline int ascodec_read_charger(void)
{
return ascodec_read_pmu(AS3543_CHARGER, 1);
}
#endif /* !_ASCODEC_TARGET_H */

View file

@ -0,0 +1,206 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id: ascodec-target.h 26116 2010-05-17 20:53:25Z funman $
*
* Module wrapper for AS3543 audio codec, using /dev/afe (afe.ko) of Samsung YP-R0
*
* Copyright (c) 2011 Lorenzo Miori
*
* 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 "fcntl.h"
#include "unistd.h"
#include "stdio.h"
#include "string.h"
#include "sys/ioctl.h"
#include "stdlib.h"
#include "ascodec-target.h"
int afe_dev = -1;
/* Write to a normal register */
#define IOCTL_REG_WRITE 0x40034101
/* Write to a PMU register */
#define IOCTL_SUBREG_WRITE 0x40034103
/* Read from a normal register */
#define IOCTL_REG_READ 0x80034102
/* Read from a PMU register */
#define IOCTL_SUBREG_READ 0x80034103
static struct mutex as_mtx;
int ascodec_init(void) {
afe_dev = open("/dev/afe", O_RDWR);
mutex_init(&as_mtx);
return afe_dev;
}
void ascodec_close(void) {
if (afe_dev >= 0) {
close(afe_dev);
}
}
/* Read functions returns -1 if fail, otherwise the register's value if success */
/* Write functions return >= 0 if success, otherwise -1 if fail */
int ascodec_write(unsigned int reg, unsigned int value)
{
struct codec_req_struct y;
struct codec_req_struct *p;
p = &y;
p->reg = reg;
p->value = value;
return ioctl(afe_dev, IOCTL_REG_WRITE, p);
}
int ascodec_read(unsigned int reg)
{
int retval = -1;
struct codec_req_struct y;
struct codec_req_struct *p;
p = &y;
p->reg = reg;
retval = ioctl(afe_dev, IOCTL_REG_READ, p);
if (retval >= 0)
return p->value;
else
return retval;
}
void ascodec_write_pmu(unsigned int index, unsigned int subreg,
unsigned int value)
{
struct codec_req_struct y;
struct codec_req_struct *p;
p = &y;
p->reg = index;
p->subreg = subreg;
p->value = value;
ioctl(afe_dev, IOCTL_SUBREG_WRITE, p);
}
int ascodec_read_pmu(unsigned int index, unsigned int subreg)
{
int retval = -1;
struct codec_req_struct y;
struct codec_req_struct *p;
p = &y;
p->reg = index;
p->subreg = subreg;
retval = ioctl(afe_dev, IOCTL_SUBREG_READ, p);
if (retval >= 0)
return p->value;
else
return retval;
}
/* Helpers to set/clear bits */
void ascodec_set(unsigned int reg, unsigned int bits)
{
ascodec_write(reg, ascodec_read(reg) | bits);
}
void ascodec_clear(unsigned int reg, unsigned int bits)
{
ascodec_write(reg, ascodec_read(reg) & ~bits);
}
void ascodec_write_masked(unsigned int reg, unsigned int bits,
unsigned int mask)
{
ascodec_write(reg, (ascodec_read(reg) & ~mask) | (bits & mask));
}
/*FIXME: doesn't work */
int ascodec_readbytes(unsigned int index, unsigned int len, unsigned char *data)
{
unsigned int i;
for (i=index; i<len; i++) {
data[i] = ascodec_read(i);
printf("Register %i: value=%i\n",index,data[i]);
}
printf("TOTAL: %i\n", i);
return i;
}
/*
* NOTE:
* After the conversion to interrupts, ascodec_(lock|unlock) are only used by
* adc-as3514.c to protect against other threads corrupting the result by using
* the ADC at the same time.
*
* Concurrent ascodec_(async_)?(read|write) calls are instead protected
* by the R0's Kernel I2C driver for ascodec (mutexed), so it's automatically safe
*/
void ascodec_lock(void)
{
mutex_lock(&as_mtx);
}
void ascodec_unlock(void)
{
mutex_unlock(&as_mtx);
}
/* Read 10-bit channel data */
unsigned short adc_read(int channel)
{
unsigned short data = 0;
if ((unsigned)channel >= NUM_ADC_CHANNELS)
return 0;
ascodec_lock();
/* Select channel */
ascodec_write(AS3514_ADC_0, (channel << 4));
unsigned char buf[2];
/*
* The AS3514 ADC will trigger an interrupt when the conversion
* is finished, if the corresponding enable bit in IRQ_ENRD2
* is set.
* Previously the code did not wait and this apparently did
* not pose any problems, but this should be more correct.
* Without the wait the data read back may be completely or
* partially (first one of the two bytes) stale.
*/
/*FIXME: not implemented*/
ascodec_wait_adc_finished();
/* Read data */
ascodec_readbytes(AS3514_ADC_0, 2, buf);
data = (((buf[0] & 0x3) << 8) | buf[1]);
ascodec_unlock();
return data;
}
void adc_init(void)
{
}

View file

@ -0,0 +1,29 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id: backlight-target.h 19322 2008-12-04 04:16:53Z jethead71 $
*
* Copyright (C) 2011 by Lorenzo Miori
*
* 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.
*
****************************************************************************/
#ifndef BACKLIGHT_TARGET_H
#define BACKLIGHT_TARGET_H
bool _backlight_init(void);
void _backlight_on(void);
void _backlight_off(void);
void _backlight_set_brightness(int brightness);
#endif /* BACKLIGHT_TARGET_H */

View file

@ -0,0 +1,89 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id: backlight-gigabeat-s.c 25800 2010-05-04 10:07:53Z jethead71 $
*
* Copyright (C) 2011 by Lorenzo Miori
*
* 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 "config.h"
#include "system.h"
#include "backlight.h"
#include "backlight-target.h"
#include "lcd.h"
#include "as3514.h"
#include "ascodec-target.h"
#include <fcntl.h>
#include "unistd.h"
static bool backlight_on_status = true; /* Is on or off? */
/*TODO: see if LCD sleep could be implemented in a better way -> ie using a rockbox feature */
/* Turn off LCD power supply */
static void _backlight_lcd_sleep(void)
{
int fp = open("/sys/class/graphics/fb0/blank", O_RDWR);
write(fp, "1", 1);
close(fp);
}
/* Turn on LCD screen */
static void _backlight_lcd_power(void)
{
int fp = open("/sys/class/graphics/fb0/blank", O_RDWR);
write(fp, "0", 1);
close(fp);
}
bool _backlight_init(void)
{
/* We have nothing to do */
return true;
}
void _backlight_on(void)
{
if (!backlight_on_status)
{
/* Turn on lcd power before backlight */
_backlight_lcd_power();
/* Original app sets this to 0xb1 when backlight is on... */
ascodec_write_pmu(AS3543_BACKLIGHT, 0x1, 0xb1);
}
backlight_on_status = true;
}
void _backlight_off(void)
{
if (backlight_on_status) {
/* Disabling the DCDC15 completely, keeps brightness register value */
ascodec_write_pmu(AS3543_BACKLIGHT, 0x1, 0x00);
/* Turn off lcd power then */
_backlight_lcd_sleep();
}
backlight_on_status = false;
}
void _backlight_set_brightness(int brightness)
{
/* Just another check... */
if (brightness > MAX_BRIGHTNESS_SETTING)
brightness = MAX_BRIGHTNESS_SETTING;
if (brightness < MIN_BRIGHTNESS_SETTING)
brightness = MIN_BRIGHTNESS_SETTING;
ascodec_write_pmu(AS3543_BACKLIGHT, 0x3, brightness << 3 & 0xf8);
}

View file

@ -0,0 +1,53 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id: button-target.h 29248 2011-02-08 20:05:25Z thomasjfox $
*
* Copyright (C) 2011 by Lorenzo Miori
*
* 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.
*
****************************************************************************/
#ifndef _BUTTON_TARGET_H_
#define _BUTTON_TARGET_H_
#include <stdbool.h>
#include "config.h"
void button_init_device(void);
void button_close_device(void);
int button_read_device(void);
/* Logical buttons key codes */
#define BUTTON_UP 0x00000001
#define BUTTON_DOWN 0x00000002
#define BUTTON_LEFT 0x00000004
#define BUTTON_RIGHT 0x00000008
#define BUTTON_USER 0x00000010
#define BUTTON_MENU 0x00000020
#define BUTTON_BACK 0x00000040
#define BUTTON_POWER 0x00000080
#define BUTTON_SELECT 0x00000100
#define BUTTON_MAIN 0x1FF /* all buttons */
/* No remote */
#define BUTTON_REMOTE 0
/* Software power-off */
#define POWEROFF_BUTTON BUTTON_POWER
/* About 3 seconds */
#define POWEROFF_COUNT 10
#endif /* _BUTTON_TARGET_H_ */

View file

@ -0,0 +1,103 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id: button-sdl.c 30482 2011-09-08 14:53:28Z kugel $
*
* Copyright (C) 2011 Lorenzo Miori
*
* 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 <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h> /* EXIT_SUCCESS */
#include "config.h"
#include "button.h"
#include "kernel.h"
#include "system.h"
#include "button-target.h"
/* R0 physical key codes */
enum ypr0_buttons {
R0BTN_NONE = BUTTON_NONE,
R0BTN_POWER = 1,
R0BTN_UP,
R0BTN_DOWN,
R0BTN_RIGHT,
R0BTN_LEFT,
R0BTN_CENTRAL,
R0BTN_MENU,
R0BTN_BACK,
R0BTN_3DOTS = 11,
};
static int r0_btn_fd = 0;
/* Samsung keypad driver doesn't allow multiple key combinations :( */
static enum ypr0_buttons r0_read_key(void)
{
unsigned char keys;
if (r0_btn_fd < 0)
return 0;
if (read(r0_btn_fd, &keys, 1))
return keys;
return 0;
}
/* Conversion from physical keypress code to logic key code */
static int key_to_button(enum ypr0_buttons keyboard_button)
{
switch (keyboard_button)
{
default: return BUTTON_NONE;
case R0BTN_POWER: return BUTTON_POWER;
case R0BTN_UP: return BUTTON_UP;
case R0BTN_DOWN: return BUTTON_DOWN;
case R0BTN_RIGHT: return BUTTON_RIGHT;
case R0BTN_LEFT: return BUTTON_LEFT;
case R0BTN_CENTRAL: return BUTTON_SELECT;
case R0BTN_MENU: return BUTTON_MENU;
case R0BTN_BACK: return BUTTON_BACK;
case R0BTN_3DOTS: return BUTTON_USER;
}
}
int button_read_device(void)
{
return key_to_button(r0_read_key());
}
/* Open the keypad device: it is offered by r0Btn.ko module */
void button_init_device(void)
{
r0_btn_fd = open("/dev/r0Btn", O_RDONLY);
if (r0_btn_fd < 0)
printf("/dev/r0Btn open error!");
}
#ifdef BUTTON_DRIVER_CLOSE
/* I'm not sure it's called at shutdown...give a check! */
void button_close_device(void)
{
if (r0_btn_fd >= 0) {
close(r0_btn_fd);
printf("/dev/r0Btn closed!");
}
}
#endif /* BUTTON_DRIVER_CLOSE */

View file

@ -0,0 +1,56 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2010 by Thomas Martitz
*
* 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.
*
****************************************************************************/
#ifndef __DIR_TARGET_H__
#define __DIR_TARGET_H__
#include <dirent.h>
/* including unistd.h is too noisy */
extern int rmdir(const char* name);
#define dirent_uncached dirent
#define DIR_UNCACHED DIR
#define opendir_uncached _opendir
#define readdir_uncached _readdir
#define closedir_uncached _closedir
#define mkdir_uncached _mkdir
#define rmdir_uncached rmdir
#define dirent_ypr0 dirent
#define DIR_ypr0 DIR
#define opendir_ypr0 _opendir
#define readdir_ypr0 _readdir
#define closedir_ypr0 _closedir
#define mkdir_ypr0 _mkdir
#define rmdir_ypr0 rmdir
extern DIR* _opendir(const char* name);
extern int _mkdir(const char* name);
extern int _closedir(DIR* dir);
extern struct dirent *_readdir(DIR* dir);
extern void fat_size(unsigned long *size, unsigned long *free);
#define DIRFUNCTIONS_DEFINED
#define DIRENT_DEFINED
#define DIR_DEFINED
#endif /* __DIR_TARGET_H__ */

View file

@ -0,0 +1,141 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2010 by Thomas Martitz
*
* 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 <stdlib.h>
#include <sys/stat.h> /* stat() */
#include <stdio.h> /* snprintf */
#include <string.h> /* size_t */
#include <dirent.h>
#include <time.h> /* localtime() */
#include "system-target.h"
#include "dir-target.h"
#include "file.h"
#include "dir.h"
#include "rbpaths.h"
long filesize(int fd)
{
struct stat buf;
if (!fstat(fd, &buf))
return buf.st_size;
else
return -1;
}
/* do we really need this in the app? */
void fat_size(unsigned long* size, unsigned long* free)
{
*size = *free = 0;
}
#undef opendir
#undef closedir
#undef mkdir
#undef readdir
/* need to wrap around DIR* because we need to save the parent's
* directory path in order to determine dirinfo */
struct __dir {
DIR *dir;
char *path;
};
DIR* _opendir(const char *name)
{
char *buf = malloc(sizeof(struct __dir) + strlen(name)+1);
if (!buf)
return NULL;
struct __dir *this = (struct __dir*)buf;
this->path = buf+sizeof(struct __dir);
/* definitely fits due to strlen() */
strcpy(this->path, name);
this->dir = opendir(name);
if (!this->dir)
{
free(buf);
return NULL;
}
return (DIR*)this;
}
int _mkdir(const char *name)
{
return mkdir(name, 0777);
}
int _closedir(DIR *dir)
{
struct __dir *this = (struct __dir*)dir;
int ret = closedir(this->dir);
free(this);
return ret;
}
struct dirent* _readdir(DIR* dir)
{
struct __dir *d = (struct __dir*)dir;
return readdir(d->dir);
}
struct dirinfo dir_get_info(DIR* _parent, struct dirent *dir)
{
struct __dir *parent = (struct __dir*)_parent;
struct stat s;
struct tm *tm = NULL;
struct dirinfo ret;
char path[MAX_PATH];
snprintf(path, sizeof(path), "%s/%s", parent->path, dir->d_name);
memset(&ret, 0, sizeof(ret));
if (!stat(path, &s))
{
if (S_ISDIR(s.st_mode))
{
ret.attribute = ATTR_DIRECTORY;
}
ret.size = s.st_size;
tm = localtime(&(s.st_mtime));
}
if (!lstat(path, &s) && S_ISLNK(s.st_mode))
{
ret.attribute |= ATTR_LINK;
}
if (tm)
{
ret.wrtdate = ((tm->tm_year - 80) << 9) |
((tm->tm_mon + 1) << 5) |
tm->tm_mday;
ret.wrttime = (tm->tm_hour << 11) |
(tm->tm_min << 5) |
(tm->tm_sec >> 1);
}
return ret;
}

View file

@ -0,0 +1,25 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id: i2c-target.h 29516 2011-03-05 15:31:52Z thomasjfox $
*
* Copyright (C) 2010 by Thomas Martitz
*
* 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.
*
****************************************************************************/
#ifndef __I2C_TARGET_H__
#define __I2C_TARGET_H__
#endif /* __I2C_TARGET_H__ */

View file

@ -0,0 +1,163 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (c) 2010 Thomas Martitz
*
* 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 <time.h>
#include <signal.h>
#include <errno.h>
#include <unistd.h>
#include <pthread.h>
#include "config.h"
#include "system.h"
#include "button.h"
#include "audio.h"
#include "panic.h"
#include "timer.h"
static pthread_cond_t wfi_cond = PTHREAD_COND_INITIALIZER;
static pthread_mutex_t wfi_mtx = PTHREAD_MUTEX_INITIALIZER;
/*
* call tick tasks and wake the scheduler up */
void timer_signal(union sigval arg)
{
(void)arg;
call_tick_tasks();
interrupt();
}
/*
* wait on the sem which the signal handler posts to save cpu time (aka sleep)
*
* other mechanisms could use them as well */
void wait_for_interrupt(void)
{
pthread_cond_wait(&wfi_cond, &wfi_mtx);
}
/*
* Wakeup the kernel, if sleeping (shall not be called from a signal handler) */
void interrupt(void)
{
pthread_cond_signal(&wfi_cond);
}
/*
* setup a hrtimer to send a signal to our process every tick
*/
union sigval tick_arg = {
.sival_int = 0,
};
void tick_start(unsigned int interval_in_ms)
{
int ret = 0;
timer_t timerid;
struct itimerspec ts;
sigevent_t sigev;
/* initializing in the declaration causes some weird warnings */
memset(&sigev, 0, sizeof(sigevent_t));
sigev.sigev_notify = SIGEV_THREAD,
sigev.sigev_notify_function = timer_signal;
ts.it_value.tv_sec = ts.it_interval.tv_sec = 0;
ts.it_value.tv_nsec = ts.it_interval.tv_nsec = interval_in_ms*1000*1000;
/* add the timer */
ret |= timer_create(CLOCK_REALTIME, &sigev, &timerid);
ret |= timer_settime(timerid, 0, &ts, NULL);
/* Grab the mutex already now and leave it to this thread. We don't
* care about race conditions when signaling the condition (because
* they are not critical), but a mutex is necessary due to the API */
pthread_mutex_lock(&wfi_mtx);
if (ret != 0)
panicf("%s(): %s\n", __func__, strerror(errno));
}
#define cycles_to_microseconds(cycles) \
((int)((1000000*cycles)/TIMER_FREQ))
static timer_t timer_tid;
static int timer_prio = -1;
void (*global_unreg_callback)(void);
void (*global_timer_callback)(void);
static void timer_cb(union sigval arg)
{
(void)arg;
if (global_timer_callback)
global_timer_callback();
}
bool timer_register(int reg_prio, void (*unregister_callback)(void),
long cycles, void (*timer_callback)(void))
{
int ret = 0;
struct itimerspec ts;
sigevent_t sigev;
long in_us = cycles_to_microseconds(cycles);
if (reg_prio <= timer_prio || in_us <= 0)
return false;
if (timer_prio >= 0 && global_unreg_callback)
global_unreg_callback();
/* initializing in the declaration causes some weird warnings */
memset(&sigev, 0, sizeof(sigevent_t));
sigev.sigev_notify = SIGEV_THREAD,
sigev.sigev_notify_function = timer_cb;
ts.it_value.tv_sec = ts.it_interval.tv_sec = in_us / 1000000;
ts.it_value.tv_nsec = ts.it_interval.tv_nsec = (in_us%1000000)*1000;
/* add the timer */
ret |= timer_create(CLOCK_REALTIME, &sigev, &timer_tid);
ret |= timer_settime(timer_tid, 0, &ts, NULL);
global_timer_callback = timer_callback;
global_unreg_callback = unregister_callback;
timer_prio = reg_prio;
return ret == 0;
}
bool timer_set_period(long cycles)
{
struct itimerspec ts;
long in_us = cycles_to_microseconds(cycles);
ts.it_value.tv_sec = ts.it_interval.tv_sec = in_us / 1000000;
ts.it_value.tv_nsec = ts.it_interval.tv_nsec = (in_us%1000000)*1000;
return timer_settime(timer_tid, 0, &ts, NULL) == 0;
}
void timer_unregister(void)
{
timer_delete(timer_tid);
timer_prio = -1;
}

Some files were not shown because too many files have changed in this diff Show more