summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2010-01-18 19:05:20 +0000
committerFrank Gevaerts <frank@gevaerts.be>2010-01-18 19:05:20 +0000
commit553626a9582a266f99134f735759e63da0a44714 (patch)
tree7b336d379e61c632ad0ff775bca2f5d37a80775d
parent39e51cc66e0f9d2afc82515958c1719fdac43332 (diff)
downloadrockbox-553626a9582a266f99134f735759e63da0a44714.tar.gz
rockbox-553626a9582a266f99134f735759e63da0a44714.tar.bz2
rockbox-553626a9582a266f99134f735759e63da0a44714.zip
Add initial Packard Bell Vibe 500 port, by Szymon Dziok
Author: Szymon Dziok Flyspray: FS#10912 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24276 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/SOURCES2
-rw-r--r--apps/debug_menu.c3
-rw-r--r--apps/keymaps/keymap-vibe500.c338
-rw-r--r--bootloader/SOURCES3
-rw-r--r--bootloader/pb_vibe500.c83
-rw-r--r--docs/CREDITS1
-rw-r--r--firmware/SOURCES16
-rw-r--r--firmware/drivers/synaptics-mep.c26
-rw-r--r--firmware/export/config.h4
-rw-r--r--firmware/export/config/vibe500.h193
-rw-r--r--firmware/export/usb.h3
-rw-r--r--firmware/target/arm/adc-pp5020.c8
-rw-r--r--firmware/target/arm/i2c-pp.c3
-rw-r--r--firmware/target/arm/pbell/app.lds198
-rw-r--r--firmware/target/arm/pbell/boot.lds64
-rw-r--r--firmware/target/arm/pbell/vibe500/adc-target.h35
-rw-r--r--firmware/target/arm/pbell/vibe500/backlight-target.h38
-rw-r--r--firmware/target/arm/pbell/vibe500/backlight-vibe500.c87
-rw-r--r--firmware/target/arm/pbell/vibe500/button-target.h65
-rw-r--r--firmware/target/arm/pbell/vibe500/button-vibe500.c114
-rw-r--r--firmware/target/arm/pbell/vibe500/lcd-as-vibe500.S556
-rw-r--r--firmware/target/arm/pbell/vibe500/lcd-vibe500.c503
-rw-r--r--firmware/target/arm/pbell/vibe500/power-vibe500.c103
-rw-r--r--firmware/target/arm/pbell/vibe500/powermgmt-vibe500.c57
-rw-r--r--firmware/target/arm/pbell/vibe500/usb-target.h29
-rw-r--r--firmware/target/arm/system-pp502x.c12
-rw-r--r--firmware/target/arm/usb-fw-pp502x.c6
-rw-r--r--firmware/target/arm/wmcodec-pp.c3
-rwxr-xr-xtools/configure27
29 files changed, 2573 insertions, 7 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index 00ba4a267d..f99c2bc640 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -261,4 +261,6 @@ keymaps/keymap-ondavx767.c
keymaps/keymap-yh8xx_yh9xx.c
#elif CONFIG_KEYPAD == MINI2440_PAD
keymaps/keymap-mini2440.c
+#elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
+keymaps/keymap-vibe500.c
#endif
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 5162fc5cca..aba3964369 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -984,6 +984,9 @@ static bool dbg_spdif(void)
#elif (CONFIG_KEYPAD == SAMSUNG_YH_PAD)
# define DEBUG_CANCEL BUTTON_PLAY
+#elif (CONFIG_KEYPAD == PBELL_VIBE500_PAD)
+# define DEBUG_CANCEL BUTTON_CANCEL
+
#endif /* key definitions */
/* Test code!!! */
diff --git a/apps/keymaps/keymap-vibe500.c b/apps/keymaps/keymap-vibe500.c
new file mode 100644
index 0000000000..5a779d2841
--- /dev/null
+++ b/apps/keymaps/keymap-vibe500.c
@@ -0,0 +1,338 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id:$
+ *
+ * Copyright (C) 2009 by Szymon Dziok
+ *
+ * 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 the Packard Bell Vibe 500 target */
+/* This needs from someone with the actual 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_NONE },
+ { ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_STD_NEXTREPEAT, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_STD_CANCEL, BUTTON_PREV, BUTTON_NONE },
+ { ACTION_STD_CANCEL, BUTTON_CANCEL|BUTTON_REL, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_NEXT, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_OK|BUTTON_REL, BUTTON_OK },
+ { ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
+ { ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
+ { ACTION_STD_CONTEXT, BUTTON_OK|BUTTON_REPEAT, BUTTON_OK },
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_standard */
+
+static const struct button_mapping button_context_wps[] = {
+ { ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
+ { ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
+ { ACTION_WPS_SKIPPREV, BUTTON_PREV|BUTTON_REL, BUTTON_PREV },
+ { ACTION_WPS_SEEKBACK, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_WPS_STOPSEEK, BUTTON_PREV|BUTTON_REL, BUTTON_PREV|BUTTON_REPEAT },
+ { ACTION_WPS_SKIPNEXT, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT },
+ { ACTION_WPS_SEEKFWD, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_WPS_STOPSEEK, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT|BUTTON_REPEAT },
+ { ACTION_WPS_VOLDOWN, BUTTON_UP, BUTTON_NONE },
+ { ACTION_WPS_VOLDOWN, BUTTON_UP, BUTTON_NONE },
+ { ACTION_WPS_VOLUP, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_WPS_VOLUP, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_WPS_BROWSE, BUTTON_OK|BUTTON_REL, BUTTON_OK },
+ { ACTION_WPS_CONTEXT, BUTTON_OK|BUTTON_REPEAT, BUTTON_OK },
+ { ACTION_WPS_VIEW_PLAYLIST, BUTTON_OK|BUTTON_PLAY, BUTTON_NONE },
+ { ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
+ { ACTION_WPS_MENU, BUTTON_CANCEL|BUTTON_REL, BUTTON_MENU },
+ { ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_wps */
+
+static const struct button_mapping button_context_tree[] = {
+ { ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
+ { ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
+
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
+}; /* button_context_tree */
+
+static const struct button_mapping button_context_tree_scroll_lr[] = {
+ { ACTION_NONE, BUTTON_PREV, BUTTON_NONE },
+ { ACTION_STD_CANCEL, BUTTON_PREV|BUTTON_REL, BUTTON_PREV },
+ { ACTION_TREE_ROOT_INIT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_PREV },
+ { ACTION_TREE_PGLEFT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_TREE_PGLEFT, BUTTON_PREV|BUTTON_REL, BUTTON_PREV|BUTTON_REPEAT },
+ { ACTION_NONE, BUTTON_NEXT, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT },
+ { ACTION_TREE_PGRIGHT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_TREE_PGRIGHT, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT|BUTTON_REPEAT },
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
+}; /* button_context_tree_scroll_lr */
+
+static const struct button_mapping button_context_settings[] = {
+ { ACTION_SETTINGS_INC, BUTTON_UP, BUTTON_NONE },
+ { ACTION_SETTINGS_INCREPEAT, BUTTON_UP, BUTTON_NONE },
+ { ACTION_SETTINGS_DEC, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_SETTINGS_DECREPEAT, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_STD_PREV, BUTTON_PREV, BUTTON_NONE },
+ { ACTION_STD_PREVREPEAT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_STD_NEXT, BUTTON_NEXT, BUTTON_NONE },
+ { ACTION_STD_NEXTREPEAT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_STD_OK, BUTTON_OK|BUTTON_REL, BUTTON_NONE },
+ { ACTION_STD_CANCEL, BUTTON_CANCEL|BUTTON_REL, BUTTON_CANCEL },
+
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
+}; /* button_context_settings */
+
+static const struct button_mapping button_context_yesno[] = {
+ { ACTION_YESNO_ACCEPT, BUTTON_OK, BUTTON_NONE },
+ LAST_ITEM_IN_LIST
+}; /* button_context_yesno */
+
+static const struct button_mapping button_context_bmark[] = {
+ { ACTION_BMS_DELETE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
+}; /* button_context_bmark */
+
+static const struct button_mapping button_context_quickscreen[] = {
+ { ACTION_QS_TOP, BUTTON_MENU, BUTTON_NONE },
+ { ACTION_QS_TOP, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_QS_DOWN, BUTTON_PLAY, BUTTON_NONE },
+ { ACTION_QS_DOWN, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_QS_LEFT, BUTTON_PREV, BUTTON_NONE },
+ { ACTION_QS_LEFT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_QS_RIGHT, BUTTON_NEXT, BUTTON_NONE },
+ { ACTION_QS_RIGHT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_STD_CANCEL, BUTTON_CANCEL, 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_NONE },
+ { ACTION_PS_DEC_SMALL, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_PS_DEC_BIG, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_PS_NUDGE_LEFT, BUTTON_PREV, BUTTON_NONE },
+ { ACTION_PS_NUDGE_LEFTOFF, BUTTON_PREV|BUTTON_REL, BUTTON_NONE },
+ { ACTION_PS_NUDGE_RIGHT, BUTTON_NEXT, BUTTON_NONE },
+ { ACTION_PS_NUDGE_RIGHTOFF, BUTTON_NEXT|BUTTON_REL, BUTTON_NONE },
+ { ACTION_PS_TOGGLE_MODE, BUTTON_PLAY, BUTTON_NONE },
+ { ACTION_PS_RESET, BUTTON_MENU, BUTTON_NONE },
+ { ACTION_PS_EXIT, BUTTON_CANCEL, BUTTON_NONE },
+ { ACTION_PS_SLOWER, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_PS_FASTER, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
+}; /* button_context_pitchscreen */
+
+static const struct button_mapping button_context_keyboard[] = {
+ { ACTION_KBD_LEFT, BUTTON_PREV, BUTTON_NONE },
+ { ACTION_KBD_LEFT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_KBD_RIGHT, BUTTON_NEXT, BUTTON_NONE },
+ { ACTION_KBD_RIGHT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_KBD_SELECT, BUTTON_OK, BUTTON_NONE },
+ { ACTION_KBD_DONE, BUTTON_PLAY, BUTTON_NONE },
+ { ACTION_KBD_ABORT, BUTTON_CANCEL|BUTTON_REL, BUTTON_CANCEL },
+ { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
+ { ACTION_KBD_UP, BUTTON_UP, BUTTON_NONE },
+ { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_KBD_DOWN, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_KBD_MORSE_INPUT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
+ { ACTION_KBD_MORSE_SELECT, BUTTON_OK|BUTTON_REL, BUTTON_NONE },
+ LAST_ITEM_IN_LIST
+}; /* button_context_keyboard */
+
+#ifdef HAVE_RECORDING
+const struct button_mapping button_context_recscreen[] = {
+
+ { ACTION_REC_NEWFILE, BUTTON_REC|BUTTON_REL, BUTTON_REC },
+ { ACTION_STD_MENU, BUTTON_OK|BUTTON_REPEAT, BUTTON_OK },
+ { ACTION_REC_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
+ { ACTION_STD_CANCEL, BUTTON_CANCEL, BUTTON_NONE },
+ { ACTION_STD_NEXT, BUTTON_UP, BUTTON_NONE },
+ { ACTION_STD_NEXT, BUTTON_UP, BUTTON_NONE },
+ { ACTION_STD_PREV, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_STD_PREV, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_SETTINGS_INC, BUTTON_NEXT, BUTTON_NONE },
+ { ACTION_SETTINGS_INCREPEAT, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_SETTINGS_DEC, BUTTON_PREV, BUTTON_NONE },
+ { ACTION_SETTINGS_DECREPEAT, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_recscreen */
+#endif
+
+#ifdef USB_ENABLE_HID
+static const struct button_mapping button_context_usb_hid[] = {
+ { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_REC|BUTTON_NEXT|BUTTON_REL, BUTTON_REC|BUTTON_NEXT },
+ { ACTION_USB_HID_MODE_SWITCH_NEXT, BUTTON_REC|BUTTON_NEXT|BUTTON_REPEAT, BUTTON_REC|BUTTON_NEXT },
+ { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_REC|BUTTON_PREV|BUTTON_REL, BUTTON_REC|BUTTON_PREV },
+ { ACTION_USB_HID_MODE_SWITCH_PREV, BUTTON_REC|BUTTON_PREV|BUTTON_REPEAT, BUTTON_REC|BUTTON_PREV },
+
+ LAST_ITEM_IN_LIST
+}; /* button_context_usb_hid */
+
+static const struct button_mapping button_context_usb_hid_mode_multimedia[] = {
+ { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MULTIMEDIA_VOLUME_DOWN, BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MULTIMEDIA_VOLUME_UP, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MULTIMEDIA_VOLUME_MUTE, BUTTON_CANCEL|BUTTON_REL, BUTTON_CANCEL },
+ { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_PLAY_PAUSE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
+ { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
+ { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
+ { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_PREV, BUTTON_PREV|BUTTON_REL, BUTTON_PREV },
+ { ACTION_USB_HID_MULTIMEDIA_PLAYBACK_TRACK_NEXT, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT },
+
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
+}; /* button_context_usb_hid_mode_multimedia */
+
+static const struct button_mapping button_context_usb_hid_mode_presentation[] = {
+ { ACTION_USB_HID_PRESENTATION_SLIDESHOW_START, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
+ { ACTION_USB_HID_PRESENTATION_SLIDESHOW_LEAVE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
+ { ACTION_USB_HID_PRESENTATION_SLIDE_PREV, BUTTON_PREV|BUTTON_REL, BUTTON_PREV },
+ { ACTION_USB_HID_PRESENTATION_SLIDE_NEXT, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT },
+ { ACTION_USB_HID_PRESENTATION_SLIDE_FIRST, BUTTON_PREV|BUTTON_REPEAT, BUTTON_PREV },
+ { ACTION_USB_HID_PRESENTATION_SLIDE_LAST, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NEXT },
+ { ACTION_USB_HID_PRESENTATION_SCREEN_BLACK, BUTTON_CANCEL|BUTTON_REL, BUTTON_CANCEL },
+ { ACTION_USB_HID_PRESENTATION_SCREEN_WHITE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
+ { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_PRESENTATION_LINK_PREV, BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_PRESENTATION_LINK_NEXT, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_PRESENTATION_MOUSE_CLICK, BUTTON_OK|BUTTON_REL, BUTTON_OK },
+ { ACTION_USB_HID_PRESENTATION_MOUSE_OVER, BUTTON_OK|BUTTON_REPEAT, BUTTON_OK },
+
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
+}; /* button_context_usb_hid_mode_presentation */
+
+static const struct button_mapping button_context_usb_hid_mode_browser[] = {
+ { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_BROWSER_SCROLL_UP, BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_BROWSER_SCROLL_DOWN, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_BROWSER_SCROLL_PAGE_UP, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
+ { ACTION_USB_HID_BROWSER_SCROLL_PAGE_DOWN, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
+ { ACTION_USB_HID_BROWSER_ZOOM_IN, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
+ { ACTION_USB_HID_BROWSER_ZOOM_OUT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
+ { ACTION_USB_HID_BROWSER_ZOOM_RESET, BUTTON_CANCEL|BUTTON_REL, BUTTON_CANCEL },
+ { ACTION_USB_HID_BROWSER_TAB_PREV, BUTTON_PREV|BUTTON_REL, BUTTON_PREV },
+ { ACTION_USB_HID_BROWSER_TAB_NEXT, BUTTON_NEXT|BUTTON_REL, BUTTON_NEXT },
+ { ACTION_USB_HID_BROWSER_TAB_CLOSE, BUTTON_CANCEL|BUTTON_REL, BUTTON_CANCEL },
+ { ACTION_USB_HID_BROWSER_HISTORY_BACK, BUTTON_PREV|BUTTON_REPEAT, BUTTON_PREV },
+ { ACTION_USB_HID_BROWSER_HISTORY_FORWARD, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NEXT },
+ { ACTION_USB_HID_BROWSER_VIEW_FULL_SCREEN, BUTTON_OK|BUTTON_REL, BUTTON_OK },
+
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
+}; /* button_context_usb_hid_mode_browser */
+
+#ifdef HAVE_USB_HID_MOUSE
+static const struct button_mapping button_context_usb_hid_mode_mouse[] = {
+ { ACTION_USB_HID_MOUSE_UP, BUTTON_OK, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_UP_REP, BUTTON_OK|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_DOWN, BUTTON_CANCEL, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_DOWN_REP, BUTTON_CANCEL|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LEFT, BUTTON_PREV, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_LEFT_REP, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RIGHT, BUTTON_NEXT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_RIGHT_REP, BUTTON_NEXT|BUTTON_REPEAT, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT, BUTTON_MENU, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_BUTTON_LEFT_REL, BUTTON_MENU|BUTTON_REL, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_UP, BUTTON_UP, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_DOWN, BUTTON_NONE },
+ { ACTION_USB_HID_MOUSE_WHEEL_SCROLL_DOWN, BUTTON_DOWN, BUTTON_NONE },
+
+ LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_USB_HID)
+}; /* button_context_usb_hid_mode_mouse */
+#endif
+#endif
+
+/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
+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_TREE:
+ case CONTEXT_MAINMENU:
+ if (global_settings.hold_lr_for_scroll_in_list)
+ return button_context_tree_scroll_lr;
+ /* else fall through to CUSTOM|CONTEXT_TREE */
+ case CONTEXT_CUSTOM|CONTEXT_TREE:
+ return button_context_tree;
+
+ case CONTEXT_LIST:
+ return button_context_standard;
+
+ case CONTEXT_SETTINGS_EQ:
+ case CONTEXT_SETTINGS_COLOURCHOOSER:
+ case CONTEXT_SETTINGS_TIME:
+ case CONTEXT_SETTINGS:
+ case CONTEXT_SETTINGS_RECTRIGGER:
+ return button_context_settings;
+ case CONTEXT_YESNOSCREEN:
+ return button_context_yesno;
+ 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;
+#ifdef HAVE_RECORDING
+ case CONTEXT_RECSCREEN:
+ return button_context_recscreen;
+#endif
+#ifdef USB_ENABLE_HID
+ case CONTEXT_USB_HID:
+ return button_context_usb_hid;
+ case CONTEXT_USB_HID_MODE_MULTIMEDIA:
+ return button_context_usb_hid_mode_multimedia;
+ case CONTEXT_USB_HID_MODE_PRESENTATION:
+ return button_context_usb_hid_mode_presentation;
+ case CONTEXT_USB_HID_MODE_BROWSER:
+ return button_context_usb_hid_mode_browser;
+#ifdef HAVE_USB_HID_MOUSE
+ case CONTEXT_USB_HID_MODE_MOUSE:
+ return button_context_usb_hid_mode_mouse;
+#endif
+#endif
+ default:
+ return button_context_standard;
+ }
+ return button_context_standard;
+}
diff --git a/bootloader/SOURCES b/bootloader/SOURCES
index 04b48f8471..b4d3b82a05 100644
--- a/bootloader/SOURCES
+++ b/bootloader/SOURCES
@@ -60,4 +60,7 @@ show_logo.c
#elif defined(MINI2440)
mini2440.c
show_logo.c
+#elif defined(PBELL_VIBE500)
+pb_vibe500.c
+show_logo.c
#endif
diff --git a/bootloader/pb_vibe500.c b/bootloader/pb_vibe500.c
new file mode 100644
index 0000000000..70da0d32cc
--- /dev/null
+++ b/bootloader/pb_vibe500.c
@@ -0,0 +1,83 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2009 by Szymon Dziok
+ *
+ * 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.
+ *
+ ****************************************************************************/
+
+/*
+The bootloader does nothing and it's not needed (it was used to test different
+stuff only), because the original bootloader stored in the flash has ability to
+boot three different images in the SYSTEM directory:
+jukebox.mi4 - when Power is pressed,
+blupd.mi4 - when Power+C combo is used,
+tester.mi4 - when Power+OK combo is used.
+
+So we can use it to dual boot (for example renaming original jukebox.mi4 to
+tester.mi4 and the rockbox.mi4 to jukebox.mi4).
+*/
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+
+#include "config.h"
+
+#include "inttypes.h"
+#include "cpu.h"
+#include "system.h"
+#include "lcd.h"
+#include "kernel.h"
+#include "thread.h"
+#include "storage.h"
+#include "fat.h"
+#include "disk.h"
+#include "font.h"
+#include "backlight.h"
+#include "backlight-target.h"
+#include "button.h"
+#include "panic.h"
+#include "power.h"
+#include "file.h"
+#include "common.h"
+#include "i2c.h"
+
+/* #define UNK_01 (*(volatile unsigned long*)(0x7000a010)) */
+
+char version[] = APPSVERSION;
+
+extern int show_logo(void);
+
+void main(void)
+{
+ system_init();
+ kernel_init();
+ disable_irq();
+ lcd_init();
+
+ show_logo();
+ sleep(HZ*2);
+
+ while(1)
+ {
+ /* Power off bit */
+ if ((button_read_device()&BUTTON_POWER)!=0)
+ GPIO_CLEAR_BITWISE(GPIOB_OUTPUT_VAL,0x80);
+ }
+}
diff --git a/docs/CREDITS b/docs/CREDITS
index fda147f387..e767eae2a0 100644
--- a/docs/CREDITS
+++ b/docs/CREDITS
@@ -519,6 +519,7 @@ Simon Zhukovsky
Daniel Kluz
Phinitnun Chanasabaeng
Tse-Hsien Chiang
+Szymon Dziok
The libmad team
The wavpack team
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 540ec8b1f4..56ab680417 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -1553,3 +1553,19 @@ target/arm/s5l8700/yps3/nand-yps3.c
target/arm/s5l8700/yps3/power-yps3.c
#endif /* SAMSUNG_YPS3 */
+#ifdef PBELL_VIBE500
+drivers/synaptics-mep.c
+target/arm/ata-as-arm.S
+target/arm/ata-pp5020.c
+target/arm/wmcodec-pp.c
+target/arm/i2s-pp.c
+target/arm/adc-pp5020.c
+target/arm/pbell/vibe500/lcd-vibe500.c
+target/arm/pbell/vibe500/button-vibe500.c
+target/arm/pbell/vibe500/power-vibe500.c
+target/arm/pbell/vibe500/backlight-vibe500.c
+target/arm/pbell/vibe500/lcd-as-vibe500.S
+target/arm/pbell/vibe500/powermgmt-vibe500.c
+target/arm/usb-fw-pp502x.c
+#endif
+
diff --git a/firmware/drivers/synaptics-mep.c b/firmware/drivers/synaptics-mep.c
index 937a5f64b1..9c12351f42 100644
--- a/firmware/drivers/synaptics-mep.c
+++ b/firmware/drivers/synaptics-mep.c
@@ -53,7 +53,8 @@
GPIO_CLEAR_BITWISE(GPIOD_OUTPUT_VAL, 0x4)
#define DATA_CL GPIO_CLEAR_BITWISE(GPIOD_OUTPUT_EN, 0x4)
-#elif defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330)
+#elif defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330) || \
+ defined(PBELL_VIBE500)
#define INT_ENABLE GPIO_CLEAR_BITWISE(GPIOA_INT_LEV, 0x20);\
GPIO_SET_BITWISE(GPIOA_INT_EN, 0x20)
#define INT_DISABLE GPIO_CLEAR_BITWISE(GPIOA_INT_EN, 0x20);\
@@ -586,7 +587,26 @@ int touchpad_set_buttonlights(int led_mask, char brightness)
if (syn_status)
{
syn_enable_int(false);
-
+#if defined(PBELL_VIBE500)
+ /* In Packard Bell Vibe 500 leds are controlled through the MEP parameters 0x62 - 0x63
+ There is no 0x31 order - grup led control */
+
+ /* Make sure we have a led_block_mask = 0 - obtained experimentally */
+ data[0] = 0x03; /* header - addr:0,global:0,control:0,len:3 */
+ data[1] = 0x63; /* parameter nr: 0x23 (-0x40) - led_block_mask */
+ data[2] = 0x00; /* par_hi = 0 */
+ data[3] = 0x00; /* par_lo = 0 */
+ syn_send(data,4);
+ val = syn_read(data, 1); /* get the simple ACK = 0x18 */
+
+ /* Turn on/off the lights (there is no brightness control) - obtained experimentally */
+ data[0] = 0x03; /* header - addr:0,global:0,control:0,len:3 */
+ data[1] = 0x62; /* parameter nr: 0x22 (-0x40) - led_mask */
+ data[2] = 0x00; /* par_hi = 0 */
+ data[3] = (led_mask & 0x0f) | (brightness&0); /* par_lo = led_mask */
+ syn_send(data,4);
+ val = syn_read(data, 1); /* get the simple ACK = 0x18 */
+#else
/* turn on all touchpad leds */
data[0] = 0x05;
data[1] = 0x31;
@@ -598,7 +618,7 @@ int touchpad_set_buttonlights(int led_mask, char brightness)
/* device responds with a single-byte ACK packet */
val = syn_read(data, 2);
-
+#endif
syn_enable_int(true);
}
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 2b7c6d8663..81e83b09f4 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -116,6 +116,7 @@
#define SAMSUNG_YPS3_PAD 40
#define MINI2440_PAD 41
#define PHILIPS_HDD6330_PAD 42
+#define PBELL_VIBE500_PAD 43
/* CONFIG_REMOTE_KEYPAD */
#define H100_REMOTE 1
@@ -197,6 +198,7 @@
#define LCD_NANO2G 36 /* as used by the iPod Nano 2nd Generation */
#define LCD_MINI2440 37 /* as used by the Mini2440 */
#define LCD_HDD6330 38 /* as used by the Philips HDD6330 */
+#define LCD_VIBE500 39 /* as used by the Packard Bell Vibe 500 */
/* LCD_PIXELFORMAT */
#define HORIZONTAL_PACKING 1
@@ -402,6 +404,8 @@ Lyre prototype 1 */
#include "config/samsungyh925.h"
#elif defined(SAMSUNG_YPS3)
#include "config/samsungyps3.h"
+#elif defined(PBELL_VIBE500)
+#include "config/vibe500.h"
#else
/* no known platform */
#endif
diff --git a/firmware/export/config/vibe500.h b/firmware/export/config/vibe500.h
new file mode 100644
index 0000000000..2d0b4505dc
--- /dev/null
+++ b/firmware/export/config/vibe500.h
@@ -0,0 +1,193 @@
+/*
+ * This config file is for Packard Bell Vibe 500
+ */
+#define TARGET_TREE /* this target is using the target tree system */
+
+/* For Rolo and boot loader */
+#define MODEL_NUMBER 67
+
+#define MODEL_NAME "Packard Bell Vibe 500"
+
+#define CONFIG_STORAGE STORAGE_ATA
+
+/* define this if you have recording possibility */
+/* line-in, microphone - but not yet :-/ */
+/*#define HAVE_RECORDING*/
+
+/* Define bitmask of input sources - recordable bitmask can be defined
+ explicitly if different */
+/*#define INPUT_SRC_CAPS (SRC_CAP_MIC | SRC_CAP_LINEIN | SRC_CAP_FMRADIO)*/
+
+/* define the bitmask of hardware sample rates */
+#define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | SAMPR_CAP_11)
+
+/* define the bitmask of recording sample rates */
+#define REC_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | SAMPR_CAP_11)
+
+/* define this if you have a bitmap LCD display */
+#define HAVE_LCD_BITMAP
+
+/* define this if you can flip your LCD */
+#define HAVE_LCD_FLIP
+
+/* define this if you can ivert the colours on your LCD */
+#define HAVE_LCD_INVERT
+
+/* define this if you have a colour LCD */
+#define HAVE_LCD_COLOR
+
+/* 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 */
+#define LCD_WIDTH 160
+#define LCD_HEIGHT 128
+#define LCD_DEPTH 16 /* 65536 colors */
+#define LCD_PIXELFORMAT RGB565SWAPPED /* rgb565 */
+
+#ifndef BOOTLOADER
+/* Define this if your LCD can be enabled/disabled */
+#define HAVE_LCD_ENABLE
+
+/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE
+ should be defined as well. */
+#define HAVE_LCD_SLEEP
+#define HAVE_LCD_SLEEP_SETTING
+#endif
+
+#define CONFIG_KEYPAD PBELL_VIBE500_PAD
+
+/* Define this if you do software codec */
+#define CONFIG_CODEC SWCODEC
+
+/* define this if you have a real-time clock */
+/* RTC is individual - Philips 8563T - not yet implemented */
+/*#define CONFIG_RTC RTC_S5L8700
+#define CONFIG_RTC RTC_S35390A*/
+
+/* that needs spinups and can cause skips when shaked */
+#define HAVE_DISK_STORAGE
+
+/* Define this if you have a software controlled poweroff */
+#define HAVE_SW_POWEROFF
+
+/* The number of bytes reserved for loadable codecs */
+#define CODEC_SIZE 0x100000
+
+/* The number of bytes reserved for loadable plugins */
+#define PLUGIN_BUFFER_SIZE 0x80000
+
+/* Define the type of audio codec */
+#define HAVE_WM8731
+
+/* WM8731 has no tone controls, so we use the software ones */
+#define HAVE_SW_TONE_CONTROLS
+
+#define AB_REPEAT_ENABLE 1
+#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
+
+/* Define this for LCD backlight available */
+#define HAVE_BACKLIGHT
+#define HAVE_BACKLIGHT_BRIGHTNESS
+
+/* Main LCD backlight brightness range and defaults */
+#define MIN_BRIGHTNESS_SETTING 1
+#define MAX_BRIGHTNESS_SETTING 16
+#define DEFAULT_BRIGHTNESS_SETTING 10
+
+/* define this if you have a light associated with the buttons */
+#define HAVE_BUTTON_LIGHT
+#define HAVE_BUTTONLIGHT_BRIGHTNESS /* for compatibility */
+
+#define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */
+#define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */
+#define BATTERY_CAPACITY_MAX 1500 /* max. capacity selectable */
+#define BATTERY_CAPACITY_INC 50 /* capacity increment */
+#define BATTERY_TYPES_COUNT 1 /* only one type */
+
+/* Hardware controlled charging, software can monitor plug and charge state */
+#define CONFIG_CHARGING CHARGING_SIMPLE
+
+/* define this if the unit can be powered or charged via USB */
+#define HAVE_USB_POWER
+
+/* Define this if you have a PortalPlayer PP5020 */
+#define CONFIG_CPU PP5020
+
+/* Define this if you want to use the PP5022 i2c interface */
+#define CONFIG_I2C I2C_PP5020
+
+/* define this if the hardware can be powered off while charging */
+/* It is possible to do it (OF seems to do that) but the method is unknown yet */
+/* #define HAVE_POWEROFF_WHILE_CHARGING */
+
+/* The start address index for ROM builds */
+#define ROM_START 0x00000000
+
+/* The size of the flash ROM */
+#define FLASH_SIZE 0x80000
+
+/* Define this to the CPU frequency */
+#define CPU_FREQ 75000000
+
+#define CONFIG_LCD LCD_VIBE500
+
+/* Define this if your LCD can set contrast */
+#define HAVE_LCD_CONTRAST
+#define MIN_CONTRAST_SETTING 0
+#define MAX_CONTRAST_SETTING 16
+#define DEFAULT_CONTRAST_SETTING 10 /* OF */
+
+/* We're able to shut off power to the HDD */
+#define HAVE_ATA_POWER_OFF
+
+/* Offset ( in the firmware file's header ) to the file length */
+#define FIRMWARE_OFFSET_FILE_LENGTH 0
+
+/* Offset ( in the firmware file's header ) to the file CRC */
+#define FIRMWARE_OFFSET_FILE_CRC 0
+
+/* Offset ( in the firmware file's header ) to the real data */
+#define FIRMWARE_OFFSET_FILE_DATA 8
+
+/* USB On-the-go */
+#define CONFIG_USBOTG USBOTG_ARC
+
+/* enable these for the experimental usb stack */
+#define HAVE_USBSTACK
+#define USE_ROCKBOX_USB
+#define USB_VENDOR_ID 0x0409
+#define USB_PRODUCT_ID 0x8038
+#define HAVE_USB_HID_MOUSE
+
+/* Define this if you have adjustable CPU frequency */
+#define HAVE_ADJUSTABLE_CPU_FREQ
+
+/* define this if the device has larger sectors when accessed via USB */
+/* (only relevant in disk.c, fat.c now always supports large virtual sectors) */
+/* #define MAX_LOG_SECTOR_SIZE 2048 */
+
+/* define this if the hard drive uses large physical sectors (ATA-7 feature) */
+/* and doesn't handle them in the drive firmware */
+/* #define MAX_PHYS_SECTOR_SIZE 1024 */
+
+#define BOOTFILE_EXT "mi4"
+#define BOOTFILE "rockbox." BOOTFILE_EXT
+#define BOOTDIR "/.system"
+
+#define ICODE_ATTR_TREMOR_NOT_MDCT
diff --git a/firmware/export/usb.h b/firmware/export/usb.h
index 59c0004416..e725f0aff4 100644
--- a/firmware/export/usb.h
+++ b/firmware/export/usb.h
@@ -98,6 +98,9 @@ enum {
#elif CONFIG_KEYPAD == ONDAVX747_PAD
#define USBPOWER_BUTTON BUTTON_VOL_UP
#define USBPOWER_BTN_IGNORE BUTTON_VOL_DOWN
+#elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
+#define USBPOWER_BUTTON BUTTON_REC
+#define USBPOWER_BTN_IGNORE BUTTON_POWER
#endif
#endif /* HAVE_USB_POWER */
diff --git a/firmware/target/arm/adc-pp5020.c b/firmware/target/arm/adc-pp5020.c
index d4b4ff5b02..2d75a7e25f 100644
--- a/firmware/target/arm/adc-pp5020.c
+++ b/firmware/target/arm/adc-pp5020.c
@@ -31,6 +31,10 @@
#define ADC_DATA_2 (*(volatile unsigned long*)(0x7000ad24))
#define ADC_INIT (*(volatile unsigned long*)(0x7000ad2c))
+#if defined(PBELL_VIBE500)
+#define ADC_UNK (*(volatile unsigned long*)(0x7000002c))
+#endif
+
static unsigned short adcdata[NUM_ADC_CHANNELS];
/* Scan ADC so that adcdata[channel] gets updated. */
@@ -94,6 +98,10 @@ static void adc_tick(void)
/* Figured out from how the OF does things */
void adc_init(void)
{
+#if defined(PBELL_VIBE500)
+ ADC_UNK |= 0x1000;
+#endif
+
#if defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330)
ADC_INIT = 0;
#else
diff --git a/firmware/target/arm/i2c-pp.c b/firmware/target/arm/i2c-pp.c
index 9b92e3b8f1..58740b5c66 100644
--- a/firmware/target/arm/i2c-pp.c
+++ b/firmware/target/arm/i2c-pp.c
@@ -270,7 +270,8 @@ void i2c_init(void)
#if CONFIG_I2C == I2C_PP5020
outl(0x0, 0x600060a4);
#if defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330) || \
- defined(SAMSUNG_YH820) || defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925)
+ defined(SAMSUNG_YH820) || defined(SAMSUNG_YH920) || \
+ defined(SAMSUNG_YH925) || defined(PBELL_VIBE500)
outl(inl(0x600060a4) | 0x20, 0x600060a4);
outl(inl(0x7000c020) | 0x3, 0x7000c020);
outl(0x55, 0x7000c02c);
diff --git a/firmware/target/arm/pbell/app.lds b/firmware/target/arm/pbell/app.lds
new file mode 100644
index 0000000000..22468192eb
--- /dev/null
+++ b/firmware/target/arm/pbell/app.lds
@@ -0,0 +1,198 @@
+#include "config.h"
+
+ENTRY(start)
+
+OUTPUT_FORMAT(elf32-littlearm)
+OUTPUT_ARCH(arm)
+STARTUP(target/arm/crt0-pp.o)
+
+#define PLUGINSIZE PLUGIN_BUFFER_SIZE
+#define CODECSIZE CODEC_SIZE
+
+#ifdef DEBUG
+#define STUBOFFSET 0x10000
+#else
+#define STUBOFFSET 0
+#endif
+
+#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE - STUBOFFSET - CODECSIZE
+
+#define DRAMORIG 0x00000000 + STUBOFFSET
+#define IRAMORIG 0x40000000
+#define IRAMSIZE 0xc000
+
+#ifdef CPU_PP502x
+#define NOCACHE_BASE 0x10000000
+#else
+#define NOCACHE_BASE 0x28000000
+#endif
+
+#define CACHEALIGN_SIZE 16
+
+/* End of the audio buffer, where the codec buffer starts */
+#define ENDAUDIOADDR (DRAMORIG + DRAMSIZE)
+
+/* Where the codec buffer ends, and the plugin buffer starts */
+#define ENDADDR (ENDAUDIOADDR + CODECSIZE)
+
+MEMORY
+{
+ DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
+ IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
+}
+
+SECTIONS
+{
+ .text :
+ {
+ loadaddress = .;
+ _loadaddress = .;
+ . = ALIGN(0x200);
+ *(.init.text)
+ *(.text*)
+ *(.glue_7)
+ *(.glue_7t)
+ . = ALIGN(0x4);
+ } > DRAM
+
+ .rodata :
+ {
+ *(.rodata) /* problems without this, dunno why */
+ *(.rodata*)
+ *(.rodata.str1.1)
+ *(.rodata.str1.4)
+ . = ALIGN(0x4);
+
+ /* Pseudo-allocate the copies of the data sections */
+ _datacopy = .;
+ } > DRAM
+
+ /* TRICK ALERT! For RAM execution, we put the .data section at the
+ same load address as the copy. Thus, we don't waste extra RAM
+ when we don't actually need the copy. */
+ .data : AT ( _datacopy )
+ {
+ _datastart = .;
+ *(.data*)
+ . = ALIGN(0x4);
+ _dataend = .;
+ } > DRAM
+
+#if NOCACHE_BASE != 0
+ /* .ncdata section is placed at uncached physical alias address and is
+ * loaded at the proper cached virtual address - no copying is
+ * performed in the init code */
+ .ncdata . + NOCACHE_BASE :
+ {
+ . = ALIGN(CACHEALIGN_SIZE);
+ *(.ncdata*)
+ . = ALIGN(CACHEALIGN_SIZE);
+ } AT> DRAM
+#endif
+
+ /DISCARD/ :
+ {
+ *(.eh_frame)
+ }
+
+ .vectors 0x0 :
+ {
+ _vectorsstart = .;
+ *(.vectors);
+ _vectorsend = .;
+ } AT> DRAM
+
+ _vectorscopy = LOADADDR(.vectors);
+ _noloaddram = LOADADDR(.vectors);
+
+ .ibss IRAMORIG (NOLOAD) :
+ {
+ _iedata = .;
+ *(.qharray)
+ *(.ibss)
+ . = ALIGN(0x4);
+ _iend = .;
+ } > IRAM
+
+ .iram _iend :
+ {
+ _iramstart = .;
+ *(.icode)
+ *(.irodata)
+ *(.idata)
+ . = ALIGN(0x4);
+ _iramend = .;
+ } > IRAM AT> DRAM
+
+ _iramcopy = LOADADDR(.iram);
+
+ .idle_stacks (NOLOAD) :
+ {
+ *(.idle_stacks)
+#if NUM_CORES > 1
+ cpu_idlestackbegin = .;
+ . += IDLE_STACK_SIZE;
+ cpu_idlestackend = .;
+#endif
+ cop_idlestackbegin = .;
+ . += IDLE_STACK_SIZE;
+ cop_idlestackend = .;
+ } > IRAM
+
+ .stack (NOLOAD) :
+ {
+ *(.stack)
+ stackbegin = .;
+ . += 0x2000;
+ stackend = .;
+ } > IRAM
+
+ /* .bss and .ncbss are treated as a single section to use one init loop to
+ * zero it - note "_edata" and "_end" */
+ .bss _noloaddram (NOLOAD) :
+ {
+ _edata = .;
+ *(.bss*)
+ *(COMMON)
+ . = ALIGN(0x4);
+ } > DRAM
+
+#if NOCACHE_BASE != 0
+ .ncbss . + NOCACHE_BASE (NOLOAD):
+ {
+ . = ALIGN(CACHEALIGN_SIZE);
+ *(.ncbss*)
+ . = ALIGN(CACHEALIGN_SIZE);
+ } AT> DRAM
+#endif
+
+ /* This will be aligned by preceding alignments */
+ .endaddr . - NOCACHE_BASE (NOLOAD) :
+ {
+ _end = .;
+ } > DRAM
+
+ .audiobuf (NOLOAD) :
+ {
+ _audiobuffer = .;
+ audiobuffer = .;
+ } > DRAM
+
+ .audiobufend ENDAUDIOADDR (NOLOAD) :
+ {
+ audiobufend = .;
+ _audiobufend = .;
+ } > DRAM
+
+ .codec ENDAUDIOADDR (NOLOAD) :
+ {
+ codecbuf = .;
+ _codecbuf = .;
+ }
+
+ .plugin ENDADDR (NOLOAD) :
+ {
+ _pluginbuf = .;
+ pluginbuf = .;
+ }
+}
diff --git a/firmware/target/arm/pbell/boot.lds b/firmware/target/arm/pbell/boot.lds
new file mode 100644
index 0000000000..ccc68c0916
--- /dev/null
+++ b/firmware/target/arm/pbell/boot.lds
@@ -0,0 +1,64 @@
+#include "config.h"
+
+ENTRY(start)
+OUTPUT_FORMAT(elf32-littlearm)
+OUTPUT_ARCH(arm)
+STARTUP(target/arm/crt0-pp-bl.o)
+
+#define DRAMSIZE (MEMORYSIZE * 0x100000)
+
+#define DRAMORIG 0x10000000
+#define IRAMORIG 0x40000000
+#define IRAMSIZE 0x18000
+#define FLASHORIG 0x001f0000
+#define FLASHSIZE 2M
+
+MEMORY
+{
+ DRAM : ORIGIN = DRAMORIG, LENGTH = DRAMSIZE
+ IRAM : ORIGIN = IRAMORIG, LENGTH = IRAMSIZE
+}
+
+SECTIONS
+{
+ . = IRAMORIG;
+
+ .text : {
+ *(.init.text)
+ *(.text*)
+ *(.glue_7)
+ *(.glue_7t)
+ } > IRAM
+
+ .data : {
+ *(.icode)
+ *(.irodata)
+ *(.idata)
+ *(.data*)
+ *(.ncdata*)
+ *(.rodata*)
+ _dataend = . ;
+ } > IRAM
+
+ .stack : {
+ *(.stack)
+ _stackbegin = .;
+ stackbegin = .;
+ . += 0x2000;
+ _stackend = .;
+ stackend = .;
+ } > IRAM
+
+ /* The bss section is too large for IRAM - we just move it 16MB into the
+ DRAM */
+
+ . = DRAMORIG;
+ .bss . + (16*1024*1024) : {
+ _edata = .;
+ *(.bss*);
+ *(.ibss);
+ *(COMMON)
+ *(.ncbss*);
+ _end = .;
+ } > DRAM
+}
diff --git a/firmware/target/arm/pbell/vibe500/adc-target.h b/firmware/target/arm/pbell/vibe500/adc-target.h
new file mode 100644
index 0000000000..79a3f2d8ab
--- /dev/null
+++ b/firmware/target/arm/pbell/vibe500/adc-target.h
@@ -0,0 +1,35 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id:$
+ *
+ * Copyright (C) 2009 by Szymon Dziok
+ *
+ * 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_
+
+#define NUM_ADC_CHANNELS 1
+
+#define ADC_BATTERY 0
+#define ADC_UNKNOWN_1 1
+#define ADC_UNKNOWN_2 2
+#define ADC_UNKNOWN_3 3
+#define ADC_UNREG_POWER ADC_BATTERY /* For compatibility */
+
+/* Force a scan now */
+unsigned short adc_scan(int channel);
+
+#endif
diff --git a/firmware/target/arm/pbell/vibe500/backlight-target.h b/firmware/target/arm/pbell/vibe500/backlight-target.h
new file mode 100644
index 0000000000..7fd6d877fb
--- /dev/null
+++ b/firmware/target/arm/pbell/vibe500/backlight-target.h
@@ -0,0 +1,38 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id:$
+ *
+ * Copyright (C) 2009 by Szymon Dziok
+ *
+ * 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
+
+#define _backlight_init() true
+void _backlight_on(void);
+void _backlight_off(void);
+
+#ifdef HAVE_BACKLIGHT_BRIGHTNESS
+void _backlight_set_brightness(int brightness);
+#endif
+
+#ifdef HAVE_BUTTON_LIGHT
+void _buttonlight_on(void);
+void _buttonlight_off(void);
+void _buttonlight_set_brightness(int brightness);
+#endif
+
+#endif /* BACKLIGHT_TARGET.H */
diff --git a/firmware/target/arm/pbell/vibe500/backlight-vibe500.c b/firmware/target/arm/pbell/vibe500/backlight-vibe500.c
new file mode 100644
index 0000000000..727370633b
--- /dev/null
+++ b/firmware/target/arm/pbell/vibe500/backlight-vibe500.c
@@ -0,0 +1,87 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id:$
+ *
+ * Copyright (C) 2009 by Szymon Dziok
+ * Based on the Iriver H10 and the Philips HD1630 code.
+ *
+ * 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 "cpu.h"
+#include "system.h"
+#include "backlight.h"
+#include "backlight-target.h"
+#include "lcd.h"
+#include "synaptics-mep.h"
+
+void _backlight_on(void)
+{
+#ifdef HAVE_LCD_ENABLE
+ lcd_enable(true); /* power on lcd + visible display */
+#endif
+ GPIO_SET_BITWISE(GPIOJ_OUTPUT_VAL, 0x01);
+}
+
+void _backlight_off(void)
+{
+ GPIO_CLEAR_BITWISE(GPIOJ_OUTPUT_VAL, 0x01);
+#ifdef HAVE_LCD_ENABLE
+ lcd_enable(false); /* power off visible display */
+#endif
+}
+
+#ifdef HAVE_BACKLIGHT_BRIGHTNESS
+static const int brightness_vals[16] =
+ {255,237,219,201,183,165,147,130,112,94,76,58,40,22,5,0};
+
+void _backlight_set_brightness(int brightness)
+{
+ /* From PB Vibe Bootloader and OF */
+ DEV_INIT1&=0xFFFF3F3F;
+ DEV_INIT1+=0x4000;
+ DEV_EN |= 0x20000;
+ outl(0x80000000 | (brightness_vals[brightness-1] << 16), 0x7000a010);
+}
+#endif
+
+#ifdef HAVE_BUTTON_LIGHT
+static unsigned short buttonlight_status = 0;
+
+void _buttonlight_on(void)
+{
+ if (!buttonlight_status)
+ {
+ touchpad_set_buttonlights(0x0f, 0);
+ buttonlight_status = 1;
+ }
+}
+
+void _buttonlight_off(void)
+{
+ if (buttonlight_status)
+ {
+ touchpad_set_buttonlights(0x00, 0);
+ buttonlight_status = 0;
+ }
+}
+
+void _buttonlight_set_brightness(int brightness)
+{
+ /* no brightness control, but lights stays on - for compatibility */
+ touchpad_set_buttonlights(0x0f, brightness);
+ buttonlight_status = 1;
+}
+#endif
diff --git a/firmware/target/arm/pbell/vibe500/button-target.h b/firmware/target/arm/pbell/vibe500/button-target.h
new file mode 100644
index 0000000000..8190b4313b
--- /dev/null
+++ b/firmware/target/arm/pbell/vibe500/button-target.h
@@ -0,0 +1,65 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id:$
+ *
+ * Copyright (C) 2009 by Szymon Dziok
+ *
+ * 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"
+
+#define MEP_BUTTON_HEADER 0x19
+#define MEP_BUTTON_ID 0x09
+#define MEP_ABSOLUTE_HEADER 0x0b
+
+#define HAS_BUTTON_HOLD
+
+bool button_hold(void);
+void button_init_device(void);
+int button_read_device(void);
+
+#ifndef BOOTLOADER
+void button_int(void);
+#endif
+
+
+#define BUTTON_POWER 0x00000001
+#define BUTTON_MENU 0x00000002
+#define BUTTON_PLAY 0x00000004
+#define BUTTON_PREV 0x00000008
+#define BUTTON_NEXT 0x00000010
+#define BUTTON_REC 0x00000020 /* RECORD */
+#define BUTTON_UP 0x00000040 /* Scrollstrip up move */
+#define BUTTON_DOWN 0x00000080 /* Scrollstrip down move */
+#define BUTTON_OK 0x00000100
+#define BUTTON_CANCEL 0x00000200
+
+/* there are no LEFT/RIGHT buttons, but other parts of the code expect them */
+#define BUTTON_LEFT 0x00000400
+#define BUTTON_RIGHT 0x00000800
+
+#define BUTTON_MAIN 0x00000fff
+
+#define BUTTON_REMOTE 0
+
+#define POWEROFF_BUTTON BUTTON_POWER
+#define POWEROFF_COUNT 10
+
+#endif /* _BUTTON_TARGET_H_ */
+
diff --git a/firmware/target/arm/pbell/vibe500/button-vibe500.c b/firmware/target/arm/pbell/vibe500/button-vibe500.c
new file mode 100644
index 0000000000..c95e996ef8
--- /dev/null
+++ b/firmware/target/arm/pbell/vibe500/button-vibe500.c
@@ -0,0 +1,114 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id:$
+ *
+ * Copyright (C) 2009 Szymon Dziok
+ * Based on the Iriver H10 and the Philips HD1630 code
+ *
+ * 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 "system.h"
+#include "button.h"
+#include "backlight.h"
+#include "synaptics-mep.h"
+
+static int int_btn = BUTTON_NONE;
+static int old_pos = -1;
+
+void button_init_device(void)
+{
+}
+
+/*
+ * Button interrupt handler
+ */
+void button_int(void)
+{
+ char data[4];
+ int val;
+
+ int_btn = BUTTON_NONE;
+
+ val = touchpad_read_device(data, 4);
+
+ if (val == MEP_BUTTON_HEADER)
+ {
+ /* Buttons packet */
+ if (data[1] & 0x1)
+ int_btn |= BUTTON_MENU;
+ if (data[1] & 0x2)
+ int_btn |= BUTTON_PLAY;
+ if (data[1] & 0x4)
+ int_btn |= BUTTON_NEXT;
+ if (data[1] & 0x8)
+ int_btn |= BUTTON_PREV;
+ }
+ else if (val == MEP_ABSOLUTE_HEADER)
+ {
+ /* Absolute packet - the finger is on the vertical strip.
+ Position ranges from 1-4095, with 1 at the bottom. */
+ val = ((data[1] >> 4) << 8) | data[2]; /* position */
+
+ if (val > 0)
+ {
+ int scr_pos = val >> 8; /* split the scrollstrip into 16 regions */
+ if ((old_pos<scr_pos)&&(old_pos!=-1)) int_btn = BUTTON_DOWN;
+ if ((old_pos>scr_pos)&&(old_pos!=-1)) int_btn = BUTTON_UP;
+ old_pos = scr_pos;
+ }
+ else old_pos=-1;
+ }
+}
+
+int button_read_device(void)
+{
+ int buttons = int_btn;
+ unsigned char state;
+ static bool hold_button = false;
+ bool hold_button_old;
+
+ hold_button_old = hold_button;
+ hold_button = button_hold();
+
+#ifndef BOOTLOADER
+ if (hold_button != hold_button_old)
+ {
+ backlight_hold_changed(hold_button);
+ }
+#endif
+
+ /* device buttons */
+ if (!hold_button)
+ {
+ /* Read Record, OK, C */
+ state = GPIOA_INPUT_VAL;
+ if ((state & 0x01)==0) buttons|=BUTTON_REC;
+ if ((state & 0x40)==0) buttons|=BUTTON_OK;
+ if ((state & 0x08)==0) buttons|=BUTTON_CANCEL;
+
+ /* Read POWER button */
+ if ((GPIOD_INPUT_VAL & 0x40)==0) buttons|=BUTTON_POWER;
+ }
+ else return BUTTON_NONE;
+ return buttons;
+}
+
+bool button_hold(void)
+{
+ /* GPIOK 01000000B - HOLD when bit not set */
+ return (GPIOK_INPUT_VAL & 0x40)?false:true;
+}
+
diff --git a/firmware/target/arm/pbell/vibe500/lcd-as-vibe500.S b/firmware/target/arm/pbell/vibe500/lcd-as-vibe500.S
new file mode 100644
index 0000000000..06e78d2aa1
--- /dev/null
+++ b/firmware/target/arm/pbell/vibe500/lcd-as-vibe500.S
@@ -0,0 +1,556 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id:$
+ *
+ * Copyright (C) 2007-2008 by Michael Sevakis
+ * Adapted for the Packard Bell Vibe 500 by Szymon Dziok
+ *
+ * Packard Bell Vibe 500 LCD assembly routines
+ *
+ * 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 "cpu.h"
+
+/****************************************************************************
+ * void lcd_write_yuv_420_lines(unsigned char const * const src[3],
+ * int width,
+ * int stride);
+ *
+ * |R| |1.000000 -0.000001 1.402000| |Y'|
+ * |G| = |1.000000 -0.334136 -0.714136| |Pb|
+ * |B| |1.000000 1.772000 0.000000| |Pr|
+ * Scaled, normalized, rounded and tweaked to yield RGB 565:
+ * |R| |74 0 101| |Y' - 16| >> 9
+ * |G| = |74 -24 -51| |Cb - 128| >> 8
+ * |B| |74 128 0| |Cr - 128| >> 9
+ *
+ * Write four RGB565 pixels in the following order on each loop:
+ * 1 3 + > down
+ * 2 4 \/ left
+ */
+ .section .icode, "ax", %progbits
+ .align 2
+ .global lcd_write_yuv420_lines
+ .type lcd_write_yuv420_lines, %function
+lcd_write_yuv420_lines:
+ @ r0 = yuv_src
+ @ r1 = width
+ @ r2 = stride
+ stmfd sp!, { r4-r11, lr } @ save non-scratch
+ ldmia r0, { r4, r5, r6 } @ r4 = yuv_src[0] = Y'_p
+ @ r5 = yuv_src[1] = Cb_p
+ @ r6 = yuv_src[2] = Cr_p
+ @
+ ldr r0, =LCD1_BASE @
+ @
+ sub r2, r2, #1 @ Adjust stride because of increment
+10: @ loop line @
+ ldrb r7, [r4], #1 @ r7 = *Y'_p++;
+ ldrb r8, [r5], #1 @ r8 = *Cb_p++;
+ ldrb r9, [r6], #1 @ r9 = *Cr_p++;
+ @
+ sub r7, r7, #16 @ r7 = Y = (Y' - 16)*74
+ add r12, r7, r7, asl #2 @ actually (Y' - 16)*37 and shift right
+ add r7, r12, r7, asl #5 @ by one less when adding - same for all
+ @
+ sub r8, r8, #128 @ Cb -= 128
+ sub r9, r9, #128 @ Cr -= 128
+ @
+ add r10, r9, r9, asl #1 @ r10 = Cr*51 + Cb*24
+ add r10, r10, r10, asl #4 @
+ add r10, r10, r8, asl #3 @
+ add r10, r10, r8, asl #4 @
+ @
+ add r11, r9, r9, asl #2 @ r9 = Cr*101
+ add r11, r11, r9, asl #5 @
+ add r9, r11, r9, asl #6 @
+ @
+ add r8, r8, #2 @ r8 = bu = (Cb*128 + 128) >> 8
+ mov r8, r8, asr #2 @
+ add r9, r9, #256 @ r9 = rv = (r8 + 256) >> 9
+ mov r9, r9, asr #9 @
+ rsb r10, r10, #128 @ r10 = guv = (-r9 + 128) >> 8
+ mov r10, r10, asr #8 @
+ @ compute R, G, and B
+ add r3, r8, r7, asr #8 @ r3 = b = (Y >> 9) + bu
+ add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv
+ add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv
+ @
+ orr r12, r3, r11 @ check if clamping is needed...
+ orr r12, r12, r7, asr #1 @ ...at all
+ cmp r12, #31 @
+ bls 15f @ no clamp @
+ cmp r3, #31 @ clamp b
+ mvnhi r3, r3, asr #31 @
+ andhi r3, r3, #31 @
+ cmp r11, #31 @ clamp r
+ mvnhi r11, r11, asr #31 @
+ andhi r11, r11, #31 @
+ cmp r7, #63 @ clamp g
+ mvnhi r7, r7, asr #31 @
+ andhi r7, r7, #63 @
+15: @ no clamp @
+ @
+ ldrb r12, [r4, r2] @ r12 = Y' = *(Y'_p + stride)
+ @
+ orr r3, r3, r11, lsl #11 @ r3 = b | (r << 11)
+ orr r3, r3, r7, lsl #5 @ r3 |= (g << 5)
+ @
+ movs r7, r3, lsr #8 @ store pixel
+20: @
+ ldr r11, [r0] @
+ tst r11, #LCD1_BUSY_MASK @
+ bne 20b @
+ str r7, [r0, #0x10] @
+25: @
+ ldr r11, [r0] @
+ tst r11, #LCD1_BUSY_MASK @
+ bne 25b @
+ str r3, [r0, #0x10] @
+ @
+ sub r7, r12, #16 @ r7 = Y = (Y' - 16)*74
+ add r12, r7, r7, asl #2 @
+ add r7, r12, r7, asl #5 @
+ @ compute R, G, and B
+ add r3, r8, r7, asr #8 @ r3 = b = (Y >> 9) + bu
+ add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv
+ add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv
+ @
+ orr r12, r3, r11 @ check if clamping is needed...
+ orr r12, r12, r7, asr #1 @ ...at all
+ cmp r12, #31 @
+ bls 15f @ no clamp @
+ cmp r3, #31 @ clamp b
+ mvnhi r3, r3, asr #31 @
+ andhi r3, r3, #31 @
+ cmp r11, #31 @ clamp r
+ mvnhi r11, r11, asr #31 @
+ andhi r11, r11, #31 @
+ cmp r7, #63 @ clamp g
+ mvnhi r7, r7, asr #31 @
+ andhi r7, r7, #63 @
+15: @ no clamp @
+ @
+ ldrb r12, [r4], #1 @ r12 = Y' = *(Y'_p++)
+ @
+ orr r3, r3, r11, lsl #11 @ r3 = b | (r << 11)
+ orr r3, r3, r7, lsl #5 @ r3 |= (g << 5)
+ @
+ movs r7, r3, lsr #8 @ store pixel
+20: @
+ ldr r11, [r0] @
+ tst r11, #LCD1_BUSY_MASK @
+ bne 20b @
+ str r7, [r0, #0x10] @
+25: @
+ ldr r11, [r0] @
+ tst r11, #LCD1_BUSY_MASK @
+ bne 25b @
+ str r3, [r0, #0x10] @
+ @
+ sub r7, r12, #16 @ r7 = Y = (Y' - 16)*74
+ add r12, r7, r7, asl #2 @
+ add r7, r12, r7, asl #5 @
+ @ compute R, G, and B
+ add r3, r8, r7, asr #8 @ r3 = b = (Y >> 9) + bu
+ add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv
+ add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv
+ @
+ orr r12, r3, r11 @ check if clamping is needed...
+ orr r12, r12, r7, asr #1 @ ...at all
+ cmp r12, #31 @
+ bls 15f @ no clamp @
+ cmp r3, #31 @ clamp b
+ mvnhi r3, r3, asr #31 @
+ andhi r3, r3, #31 @
+ cmp r11, #31 @ clamp r
+ mvnhi r11, r11, asr #31 @
+ andhi r11, r11, #31 @
+ cmp r7, #63 @ clamp g
+ mvnhi r7, r7, asr #31 @
+ andhi r7, r7, #63 @
+15: @ no clamp @
+ @
+ ldrb r12, [r4, r2] @ r12 = Y' = *(Y'_p + stride)
+ @
+ orr r3, r3, r7, lsl #5 @ r3 = b | (g << 5)
+ orr r3, r3, r11, lsl #11 @ r3 |= (r << 11)
+ @
+ movs r7, r3, lsr #8 @ store pixel
+20: @
+ ldr r11, [r0] @
+ tst r11, #LCD1_BUSY_MASK @
+ bne 20b @
+ str r7, [r0, #0x10] @
+25: @
+ ldr r11, [r0] @
+ tst r11, #LCD1_BUSY_MASK @
+ bne 25b @
+ str r3, [r0, #0x10] @
+ @
+ sub r7, r12, #16 @ r7 = Y = (Y' - 16)*74
+ add r12, r7, r7, asl #2 @
+ add r7, r12, r7, asl #5 @
+ @ compute R, G, and B
+ add r3, r8, r7, asr #8 @ r3 = b = (Y >> 9) + bu
+ add r11, r9, r7, asr #8 @ r11 = r = (Y >> 9) + rv
+ add r7, r10, r7, asr #7 @ r7 = g = (Y >> 8) + guv
+ @
+ orr r12, r3, r11 @ check if clamping is needed...
+ orr r12, r12, r7, asr #1 @ ...at all
+ cmp r12, #31 @
+ bls 15f @ no clamp @
+ cmp r3, #31 @ clamp b
+ mvnhi r3, r3, asr #31 @
+ andhi r3, r3, #31 @
+ cmp r11, #31 @ clamp r
+ mvnhi r11, r11, asr #31 @
+ andhi r11, r11, #31 @
+ cmp r7, #63 @ clamp g
+ mvnhi r7, r7, asr #31 @
+ andhi r7, r7, #63 @
+15: @ no clamp @
+ @
+ orr r3, r3, r11, lsl #11 @ r3 = b | (r << 11)
+ orr r3, r3, r7, lsl #5 @ r3 |= (g << 5)
+ @
+ movs r7, r3, lsr #8 @ store pixel
+20: @
+ ldr r11, [r0] @
+ tst r11, #LCD1_BUSY_MASK @
+ bne 20b @
+ str r7, [r0, #0x10] @
+25: @
+ ldr r11, [r0] @
+ tst r11, #LCD1_BUSY_MASK @
+ bne 25b @
+ str r3, [r0, #0x10] @
+ @
+ subs r1, r1, #2 @ subtract block from width
+ bgt 10b @ loop line @
+ @
+ ldmfd sp!, { r4-r11, pc } @ restore registers and return
+ .ltorg @ dump constant pool
+ .size lcd_write_yuv420_lines, .-lcd_write_yuv420_lines
+
+
+/****************************************************************************
+ * void lcd_write_yuv_420_lines_odither(unsigned char const * const src[3],
+ * int width,
+ * int stride,
+ * int x_screen,
+ * int y_screen);
+ *
+ * |R| |1.000000 -0.000001 1.402000| |Y'|
+ * |G| = |1.000000 -0.334136 -0.714136| |Pb|
+ * |B| |1.000000 1.772000 0.000000| |Pr|
+ * Red scaled at twice g & b but at same precision to place it in correct
+ * bit position after multiply and leave instruction count lower.
+ * |R| |258 0 408| |Y' - 16|
+ * |G| = |149 -49 -104| |Cb - 128|
+ * |B| |149 258 0| |Cr - 128|
+ *
+ * Write four RGB565 pixels in the following order on each loop:
+ * 1 3 + > down
+ * 2 4 \/ left
+ *
+ * Kernel pattern (raw|use order):
+ * 5 3 4 2 row0 row2 > down
+ * 1 7 0 6 | 5 1 3 7 4 0 2 6 col0 left
+ * 4 2 5 3 | 4 0 2 6 5 1 3 7 col2 \/
+ * 0 6 1 7
+ */
+ .section .icode, "ax", %progbits
+ .align 2
+ .global lcd_write_yuv420_lines_odither
+ .type lcd_write_yuv420_lines_odither, %function
+lcd_write_yuv420_lines_odither:
+ @ r0 = yuv_src
+ @ r1 = width
+ @ r2 = stride
+ @ r3 = x_screen
+ @ [sp] = y_screen
+ stmfd sp!, { r4-r11, lr } @ save non-scratch
+ ldmia r0, { r4, r5, r6 } @ r4 = yuv_src[0] = Y'_p
+ @ r5 = yuv_src[1] = Cb_p
+ @ r6 = yuv_src[2] = Cr_p
+ @
+ ldr r0, [sp, #40] @ Line up pattern and kernel quadrant
+ eor r14, r3, r0 @
+ and r14, r14, #0x2 @
+ mov r14, r14, lsl #6 @ 0x00 or 0x80
+ @
+ ldr r0, =LCD1_BASE @
+ @
+ sub r2, r2, #1 @ Adjust stride because of increment
+10: @ loop line @
+ @
+ ldrb r7, [r4], #1 @ r7 = *Y'_p++;
+ ldrb r8, [r5], #1 @ r8 = *Cb_p++;
+ ldrb r9, [r6], #1 @ r9 = *Cr_p++;
+ @
+ eor r14, r14, #0x80 @ flip pattern quadrant
+ @
+ sub r7, r7, #16 @ r7 = Y = (Y' - 16)*149
+ add r12, r7, r7, asl #2 @
+ add r12, r12, r12, asl #4 @
+ add r7, r12, r7, asl #6 @
+ @
+ sub r8, r8, #128 @ Cb -= 128
+ sub r9, r9, #128 @ Cr -= 128
+ @
+ add r10, r8, r8, asl #4 @ r10 = guv = Cr*104 + Cb*49
+ add r10, r10, r8, asl #5 @
+ add r10, r10, r9, asl #3 @
+ add r10, r10, r9, asl #5 @
+ add r10, r10, r9, asl #6 @
+ @
+ mov r8, r8, asl #1 @ r8 = bu = Cb*258
+ add r8, r8, r8, asl #7 @
+ @
+ add r9, r9, r9, asl #1 @ r9 = rv = Cr*408
+ add r9, r9, r9, asl #4 @
+ mov r9, r9, asl #3 @
+ @
+ @ compute R, G, and B
+ add r3, r8, r7 @ r3 = b' = Y + bu
+ add r11, r9, r7, asl #1 @ r11 = r' = Y*2 + rv
+ rsb r7, r10, r7 @ r7 = g' = Y + guv
+ @
+ @ r8 = bu, r9 = rv, r10 = guv
+ @
+ sub r12, r3, r3, lsr #5 @ r3 = 31/32*b + b/256
+ add r3, r12, r3, lsr #8 @
+ @
+ sub r12, r11, r11, lsr #5 @ r11 = 31/32*r + r/256
+ add r11, r12, r11, lsr #8 @
+ @
+ sub r12, r7, r7, lsr #6 @ r7 = 63/64*g + g/256
+ add r7, r12, r7, lsr #8 @
+ @
+ add r12, r14, #0x200 @
+ @
+ add r3, r3, r12 @ b = r3 + delta
+ add r11, r11, r12, lsl #1 @ r = r11 + delta*2
+ add r7, r7, r12, lsr #1 @ g = r7 + delta/2
+ @
+ orr r12, r3, r11, asr #1 @ check if clamping is needed...
+ orr r12, r12, r7 @ ...at all
+ movs r12, r12, asr #15 @
+ beq 15f @ no clamp @
+ movs r12, r3, asr #15 @ clamp b
+ mvnne r3, r12, lsr #15 @
+ andne r3, r3, #0x7c00 @ mask b only if clamped
+ movs r12, r11, asr #16 @ clamp r
+ mvnne r11, r12, lsr #16 @
+ movs r12, r7, asr #15 @ clamp g
+ mvnne r7, r12, lsr #15 @
+15: @ no clamp @
+ @
+ ldrb r12, [r4, r2] @ r12 = Y' = *(Y'_p + stride)
+ @
+ and r11, r11, #0xf800 @ pack pixel
+ and r7, r7, #0x7e00 @ r3 = pixel = (r & 0xf800) |
+ orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) |
+ orr r3, r11, r3, lsr #10 @ (b >> 10)
+ @
+ movs r7, r3, lsr #8 @ store pixel
+20: @
+ ldr r11, [r0] @
+ tst r11, #LCD1_BUSY_MASK @
+ bne 20b @
+ str r7, [r0, #0x10] @
+25: @
+ ldr r11, [r0] @
+ tst r11, #LCD1_BUSY_MASK @
+ bne 25b @
+ str r3, [r0, #0x10] @
+ @
+ sub r7, r12, #16 @ r7 = Y = (Y' - 16)*149
+ add r12, r7, r7, asl #2 @
+ add r12, r12, r12, asl #4 @
+ add r7, r12, r7, asl #6 @
+ @ compute R, G, and B
+ add r3, r8, r7 @ r3 = b' = Y + bu
+ add r11, r9, r7, asl #1 @ r11 = r' = Y*2 + rv
+ rsb r7, r10, r7 @ r7 = g' = Y + guv
+ @
+ sub r12, r3, r3, lsr #5 @ r3 = 31/32*b' + b'/256
+ add r3, r12, r3, lsr #8 @
+ @
+ sub r12, r11, r11, lsr #5 @ r11 = 31/32*r' + r'/256
+ add r11, r12, r11, lsr #8 @
+ @
+ sub r12, r7, r7, lsr #6 @ r7 = 63/64*g' + g'/256
+ add r7, r12, r7, lsr #8 @
+ @
+ @ This element is zero - use r14 @
+ @
+ add r3, r3, r14 @ b = r3 + delta
+ add r11, r11, r14, lsl #1 @ r = r11 + delta*2
+ add r7, r7, r14, lsr #1 @ g = r7 + delta/2
+ @
+ orr r12, r3, r11, asr #1 @ check if clamping is needed...
+ orr r12, r12, r7 @ ...at all
+ movs r12, r12, asr #15 @
+ beq 15f @ no clamp @
+ movs r12, r3, asr #15 @ clamp b
+ mvnne r3, r12, lsr #15 @
+ andne r3, r3, #0x7c00 @ mask b only if clamped
+ movs r12, r11, asr #16 @ clamp r
+ mvnne r11, r12, lsr #16 @
+ movs r12, r7, asr #15 @ clamp g
+ mvnne r7, r12, lsr #15 @
+15: @ no clamp @
+ @
+ ldrb r12, [r4], #1 @ r12 = Y' = *(Y'_p++)
+ @
+ and r11, r11, #0xf800 @ pack pixel
+ and r7, r7, #0x7e00 @ r3 = pixel = (r & 0xf800) |
+ orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) |
+ orr r3, r11, r3, lsr #10 @ (b >> 10)
+ @
+ movs r7, r3, lsr #8 @ store pixel
+20: @
+ ldr r11, [r0] @
+ tst r11, #LCD1_BUSY_MASK @
+ bne 20b @
+ str r7, [r0, #0x10] @
+25: @
+ ldr r11, [r0] @
+ tst r11, #LCD1_BUSY_MASK @
+ bne 25b @
+ str r3, [r0, #0x10] @
+ @
+ sub r7, r12, #16 @ r7 = Y = (Y' - 16)*149
+ add r12, r7, r7, asl #2 @
+ add r12, r12, r12, asl #4 @
+ add r7, r12, r7, asl #6 @
+ @ compute R, G, and B
+ add r3, r8, r7 @ r3 = b' = Y + bu
+ add r11, r9, r7, asl #1 @ r11 = r' = Y*2 + rv
+ rsb r7, r10, r7 @ r7 = g' = Y + guv
+ @
+ @ r8 = bu, r9 = rv, r10 = guv
+ @
+ sub r12, r3, r3, lsr #5 @ r3 = 31/32*b' + b'/256
+ add r3, r12, r3, lsr #8 @
+ @
+ sub r12, r11, r11, lsr #5 @ r11 = 31/32*r' + r'/256
+ add r11, r12, r11, lsr #8 @
+ @
+ sub r12, r7, r7, lsr #6 @ r7 = 63/64*g' + g'/256
+ add r7, r12, r7, lsr #8 @
+ @
+ add r12, r14, #0x100 @
+ @
+ add r3, r3, r12 @ b = r3 + delta
+ add r11, r11, r12, lsl #1 @ r = r11 + delta*2
+ add r7, r7, r12, lsr #1 @ g = r7 + delta/2
+ @
+ orr r12, r3, r11, asr #1 @ check if clamping is needed...
+ orr r12, r12, r7 @ ...at all
+ movs r12, r12, asr #15 @
+ beq 15f @ no clamp @
+ movs r12, r3, asr #15 @ clamp b
+ mvnne r3, r12, lsr #15 @
+ andne r3, r3, #0x7c00 @ mask b only if clamped
+ movs r12, r11, asr #16 @ clamp r
+ mvnne r11, r12, lsr #16 @
+ movs r12, r7, asr #15 @ clamp g
+ mvnne r7, r12, lsr #15 @
+15: @ no clamp @
+ @
+ ldrb r12, [r4, r2] @ r12 = Y' = *(Y'_p + stride)
+ @
+ and r11, r11, #0xf800 @ pack pixel
+ and r7, r7, #0x7e00 @ r3 = pixel = (r & 0xf800) |
+ orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) |
+ orr r3, r11, r3, lsr #10 @ (b >> 10)
+ @
+ movs r7, r3, lsr #8 @ store pixel
+20: @
+ ldr r11, [r0] @
+ tst r11, #LCD1_BUSY_MASK @
+ bne 20b @
+ str r7, [r0, #0x10] @
+25: @
+ ldr r11, [r0] @
+ tst r11, #LCD1_BUSY_MASK @
+ bne 25b @
+ str r3, [r0, #0x10] @
+ @
+ sub r7, r12, #16 @ r7 = Y = (Y' - 16)*149
+ add r12, r7, r7, asl #2 @
+ add r12, r12, r12, asl #4 @
+ add r7, r12, r7, asl #6 @
+ @ compute R, G, and B
+ add r3, r8, r7 @ r3 = b' = Y + bu
+ add r11, r9, r7, asl #1 @ r11 = r' = Y*2 + rv
+ rsb r7, r10, r7 @ r7 = g' = Y + guv
+ @
+ sub r12, r3, r3, lsr #5 @ r3 = 31/32*b + b/256
+ add r3, r12, r3, lsr #8 @
+ @
+ sub r12, r11, r11, lsr #5 @ r11 = 31/32*r + r/256
+ add r11, r12, r11, lsr #8 @
+ @
+ sub r12, r7, r7, lsr #6 @ r7 = 63/64*g + g/256
+ add r7, r12, r7, lsr #8 @
+ @
+ add r12, r14, #0x300 @
+ @
+ add r3, r3, r12 @ b = r3 + delta
+ add r11, r11, r12, lsl #1 @ r = r11 + delta*2
+ add r7, r7, r12, lsr #1 @ g = r7 + delta/2
+ @
+ orr r12, r3, r11, asr #1 @ check if clamping is needed...
+ orr r12, r12, r7 @ ...at all
+ movs r12, r12, asr #15 @
+ beq 15f @ no clamp @
+ movs r12, r3, asr #15 @ clamp b
+ mvnne r3, r12, lsr #15 @
+ andne r3, r3, #0x7c00 @ mask b only if clamped
+ movs r12, r11, asr #16 @ clamp r
+ mvnne r11, r12, lsr #16 @
+ movs r12, r7, asr #15 @ clamp g
+ mvnne r7, r12, lsr #15 @
+15: @ no clamp @
+ @
+ and r11, r11, #0xf800 @ pack pixel
+ and r7, r7, #0x7e00 @ r3 = pixel = (r & 0xf800) |
+ orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) |
+ orr r3, r11, r3, lsr #10 @ (b >> 10)
+ @
+ movs r7, r3, lsr #8 @ store pixel
+20: @
+ ldr r11, [r0] @
+ tst r11, #LCD1_BUSY_MASK @
+ bne 20b @
+ str r7, [r0, #0x10] @
+25: @
+ ldr r11, [r0] @
+ tst r11, #LCD1_BUSY_MASK @
+ bne 25b @
+ str r3, [r0, #0x10] @
+ @
+ subs r1, r1, #2 @ subtract block from width
+ bgt 10b @ loop line @
+ @
+ ldmfd sp!, { r4-r11, pc } @ restore registers and return
+ .ltorg @ dump constant pool
+ .size lcd_write_yuv420_lines_odither, .-lcd_write_yuv420_lines_odither
diff --git a/firmware/target/arm/pbell/vibe500/lcd-vibe500.c b/firmware/target/arm/pbell/vibe500/lcd-vibe500.c
new file mode 100644
index 0000000000..ca483f74ea
--- /dev/null
+++ b/firmware/target/arm/pbell/vibe500/lcd-vibe500.c
@@ -0,0 +1,503 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id:$
+ *
+ * Copyright (C) 2009 by Szymon Dziok
+ * Based on the Iriver H10 code by Barry Wardell
+ *
+ * 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 "cpu.h"
+#include "lcd.h"
+#include "kernel.h"
+#include "system.h"
+
+/** Initialized in lcd_init_device() **/
+/* Is the power turned on? */
+static bool power_on;
+/* Is the display turned on? */
+static bool display_on;
+/* Reverse flag. Must be remembered when display is turned off. */
+static unsigned short disp_control_rev;
+/* Contrast setting << 8 */
+static int lcd_contrast;
+
+static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0;
+
+/* Forward declarations */
+#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
+static void lcd_display_off(void);
+#endif
+
+/* register defines for the Renesas HD66773R */
+/*
+ In Packard Bell from the OF - it seems to be
+ HD66774(gate) with HD66772(source) - registers
+ are very similar but not all the same
+*/
+#define R_START_OSC 0x00
+#define R_DEVICE_CODE_READ 0x00
+#define R_DRV_OUTPUT_CONTROL 0x01
+#define R_DRV_AC_CONTROL 0x02
+#define R_POWER_CONTROL1 0x03
+#define R_POWER_CONTROL2 0x04
+#define R_ENTRY_MODE 0x05
+#define R_COMPARE_REG 0x06
+#define R_DISP_CONTROL 0x07
+#define R_FRAME_CYCLE_CONTROL 0x0b
+#define R_POWER_CONTROL3 0x0c
+#define R_POWER_CONTROL4 0x0d
+#define R_POWER_CONTROL5 0x0e
+#define R_GATE_SCAN_START_POS 0x0f
+#define R_VERT_SCROLL_CONTROL 0x11
+#define R_1ST_SCR_DRV_POS 0x14
+#define R_2ND_SCR_DRV_POS 0x15
+#define R_HORIZ_RAM_ADDR_POS 0x16
+#define R_VERT_RAM_ADDR_POS 0x17
+#define R_RAM_WRITE_DATA_MASK 0x20
+#define R_RAM_ADDR_SET 0x21
+#define R_WRITE_DATA_2_GRAM 0x22
+#define R_RAM_READ_DATA 0x22
+#define R_GAMMA_FINE_ADJ_POS1 0x30
+#define R_GAMMA_FINE_ADJ_POS2 0x31
+#define R_GAMMA_FINE_ADJ_POS3 0x32
+#define R_GAMMA_GRAD_ADJ_POS 0x33
+#define R_GAMMA_FINE_ADJ_NEG1 0x34
+#define R_GAMMA_FINE_ADJ_NEG2 0x35
+#define R_GAMMA_FINE_ADJ_NEG3 0x36
+#define R_GAMMA_GRAD_ADJ_NEG 0x37
+#define R_GAMMA_AMP_ADJ_POS 0x3a
+#define R_GAMMA_AMP_ADJ_NEG 0x3b
+
+static inline void lcd_wait_write(void)
+{
+ while (LCD1_CONTROL & LCD1_BUSY_MASK);
+}
+
+/* Send command */
+static inline void lcd_send_cmd(unsigned v)
+{
+ lcd_wait_write();
+ LCD1_CMD = (v >> 8);
+ lcd_wait_write();
+ LCD1_CMD = (v & 0xff);
+}
+
+/* Send 16-bit data */
+static inline void lcd_send_data(unsigned v)
+{
+ lcd_wait_write();
+ LCD1_DATA = (v >> 8);
+ lcd_wait_write();
+ LCD1_DATA = (v & 0xff);
+}
+
+/* Send 16-bit data byte-swapped. */
+static inline void lcd_send_data_swapped(unsigned v)
+{
+ lcd_wait_write();
+ LCD1_DATA = (v & 0xff);
+ lcd_wait_write();
+ LCD1_DATA = (v >> 8);
+}
+
+/* Write value to register */
+static void lcd_write_reg(int reg, int val)
+{
+ lcd_send_cmd(reg);
+ lcd_send_data(val);
+}
+
+/*** hardware configuration ***/
+
+int lcd_default_contrast(void)
+{
+ return DEFAULT_CONTRAST_SETTING;
+}
+
+void lcd_set_contrast(int val)
+{
+ lcd_contrast = (val&0x1f) << 8;
+ if (!power_on) return;
+
+ /* VCOMG=1, VDV4-0=xxxxx, VCM4-0=11000 */
+ lcd_write_reg(R_POWER_CONTROL5, 0x2018 | lcd_contrast);
+}
+
+void lcd_set_invert_display(bool yesno)
+{
+ if (yesno == (disp_control_rev == 0x0000))
+ return;
+
+ disp_control_rev = yesno ? 0x0000 : 0x0004;
+
+ if (!display_on)
+ return;
+
+ /* PT1-0=00, VLE2-1=00, SPT=0, GON=1, DTE=1, REV=x, D1-0=11 */
+ lcd_write_reg(R_DISP_CONTROL, 0x0033 | disp_control_rev);
+}
+
+/* turn the display upside down (call lcd_update() afterwards) */
+void lcd_set_flip(bool yesno)
+{
+ if (!power_on)
+ return;
+
+ /* SM=0, GS=x, SS=x, NL4-0=10011 (G1-G160) */
+ lcd_write_reg(R_DRV_OUTPUT_CONTROL, yesno ? 0x0313 : 0x0013);
+}
+
+/* LCD init */
+void lcd_init_device(void)
+{
+ power_on = true;
+ display_on = true;
+ disp_control_rev = 0x0004;
+ lcd_contrast = DEFAULT_CONTRAST_SETTING << 8;
+}
+
+#ifdef HAVE_LCD_SLEEP
+static void lcd_power_on(void)
+{
+ /* from the OF */
+ lcd_write_reg(R_START_OSC,0x01); /* START_OSC */
+ sleep(HZ/40); /* 25ms */
+ /* set 396x160 dots, SM=0, GS=x, SS=0, NL4-0=10011 G1-G160)*/
+ lcd_write_reg(R_DRV_OUTPUT_CONTROL,0x13);
+ /* FLD1-0=01 (1 field), B/C=1, EOR=1 (C-pat), NW5-0=000000 (1 row) */
+ lcd_write_reg(R_DRV_AC_CONTROL,7 << 8);
+ /* DIT=0, BGR=1, HWM=0, I/D1-0=0 - decrement AC, AM=1, LG2-0=000 */
+ lcd_write_reg(R_ENTRY_MODE,0x1008);
+ lcd_write_reg(0x25,0x0000); /* - ?? */
+ lcd_write_reg(0x26,0x0202); /* - ?? */
+ lcd_write_reg(0x0A,0x0000); /* - ?? */
+ lcd_write_reg(R_FRAME_CYCLE_CONTROL,0x0000);
+ lcd_write_reg(R_POWER_CONTROL4,0x0000);
+ sleep(HZ/67); /* 15ms */
+ lcd_write_reg(R_POWER_CONTROL5,0x0000);
+ sleep(HZ/67); /* 15ms */
+ lcd_write_reg(R_POWER_CONTROL3,0x0000);
+ lcd_write_reg(0x09,0x0008); /* - ?? */
+ sleep(HZ/67); /* 15ms */
+ lcd_write_reg(R_POWER_CONTROL4,0x0003);
+ sleep(HZ/67); /* 15ms */
+ lcd_write_reg(R_POWER_CONTROL5,0x1019);
+ sleep(HZ/20); /* 50ms */
+ lcd_write_reg(R_POWER_CONTROL4,0x0013);
+ sleep(HZ/67); /* 15ms */
+ lcd_write_reg(R_POWER_CONTROL1,0x0010);
+ sleep(HZ/67); /* 15ms */
+ lcd_write_reg(0x09,0x0000); /* - ?? */
+ sleep(HZ/67); /* 15ms */
+ lcd_write_reg(R_POWER_CONTROL1,0x0010);
+ sleep(HZ/67); /* 15ms */
+ lcd_write_reg(R_POWER_CONTROL5,0x3019);
+ sleep(HZ/6.6);/* 150ms */
+ lcd_write_reg(0x09,0x0002); /* - ?? */
+ sleep(HZ/67); /* 15ms */
+ lcd_write_reg(R_POWER_CONTROL4,0x0018);
+ sleep(HZ/20); /* 50ms */
+ /* RAM Address set (0x0000) */
+ lcd_write_reg(R_RAM_ADDR_SET,0x0000);
+ /* Gamma settings */
+ lcd_write_reg(R_GAMMA_FINE_ADJ_POS1,0x0004);
+ lcd_write_reg(R_GAMMA_FINE_ADJ_POS2,0x0606);
+ lcd_write_reg(R_GAMMA_FINE_ADJ_POS3,0x0505);
+ lcd_write_reg(R_GAMMA_GRAD_ADJ_POS,0x0206);
+ lcd_write_reg(R_GAMMA_FINE_ADJ_NEG1,0x0505);
+ lcd_write_reg(R_GAMMA_FINE_ADJ_NEG2,0x0707);
+ lcd_write_reg(R_GAMMA_FINE_ADJ_NEG3,0x0105);
+ lcd_write_reg(R_GAMMA_GRAD_ADJ_NEG,0x0301);
+ lcd_write_reg(R_GAMMA_AMP_ADJ_POS,0x1A00);
+ lcd_write_reg(R_GAMMA_AMP_ADJ_NEG,0x010E);
+
+ lcd_write_reg(R_GATE_SCAN_START_POS,0x0000);
+ /* Horizontal ram address start/end position (0,127); */
+ lcd_write_reg(R_HORIZ_RAM_ADDR_POS,0x7F00);
+ /* Vertical ram address start/end position (0,159); */
+ lcd_write_reg(R_VERT_RAM_ADDR_POS,0x9F00);
+
+ lcd_write_reg(R_DISP_CONTROL,0x0005);
+ sleep(HZ/25); /* 40ms */
+ lcd_write_reg(R_DISP_CONTROL,0x0025);
+ lcd_write_reg(R_DISP_CONTROL,0x0027);
+ sleep(HZ/25); /* 40ms */
+ lcd_write_reg(R_DISP_CONTROL,0x0033 | disp_control_rev);
+ sleep(HZ/100); /* 10ms */
+ lcd_write_reg(R_POWER_CONTROL1,0x0110);
+ lcd_write_reg(R_FRAME_CYCLE_CONTROL,0x0000);
+ lcd_write_reg(R_POWER_CONTROL4,0x0013);
+ lcd_write_reg(R_POWER_CONTROL5,0x2018 | lcd_contrast);
+ sleep(HZ/20); /* 50ms */
+
+ power_on = true;
+}
+
+static void lcd_power_off(void)
+{
+ /* Display must be off first */
+ if (display_on)
+ lcd_display_off();
+
+ /* power_on = false; */
+
+ /** Power OFF sequence **/
+ /* The method is unknown */
+}
+
+void lcd_sleep(void)
+{
+ if (power_on)
+ lcd_power_off();
+
+ /* Set standby mode */
+ /* Because we dont know how to power off display
+ we cannot set standby */
+ /* BT2-0=000, DC2-0=000, AP2-0=000, SLP=0, STB=1 */
+ /* lcd_write_reg(R_POWER_CONTROL1, 0x0001); */
+}
+#endif
+
+#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
+static void lcd_display_off(void)
+{
+ display_on = false;
+
+ /** Display OFF sequence **/
+ /* In the OF it is called "EnterStandby" */
+
+ /* PT1-0=00, VLE2-1=00, SPT=0, GON=1, DTE=1, REV=x, D1-0=10 */
+ lcd_write_reg(R_DISP_CONTROL, 0x0032 | disp_control_rev);
+ sleep(HZ/22); /* 45ms */
+ /* PT1-0=00, VLE2-1=00, SPT=0, GON=1, DTE=0, REV=x, D1-0=10 */
+ lcd_write_reg(R_DISP_CONTROL, 0x0022 | disp_control_rev);
+ sleep(HZ/22); /* 45ms */
+ /* PT1-0=00, VLE2-1=00, SPT=0, GON=0, DTE=0, REV=0, D1-0=00 */
+ lcd_write_reg(R_DISP_CONTROL, 0x0000);
+
+ lcd_write_reg(R_POWER_CONTROL1, 0x0000);
+ lcd_write_reg(0x09, 0x0000); /* -?? */
+ lcd_write_reg(R_POWER_CONTROL4, 0x0000);
+
+ sleep(HZ/22); /* 45ms */
+}
+#endif
+
+#if defined(HAVE_LCD_ENABLE)
+static void lcd_display_on(void)
+{
+ /* Be sure power is on first */
+ if (!power_on)
+ lcd_power_on();
+
+ /** Display ON Sequence **/
+ /* In the OF it is called "ExitStandby" */
+
+ lcd_write_reg(R_START_OSC,1);
+ sleep(HZ/40); /* 25ms */
+ lcd_write_reg(R_POWER_CONTROL4,0);
+ sleep(HZ/67); /* 15ms */
+ lcd_write_reg(R_POWER_CONTROL5,0);
+ sleep(HZ/67); /* 15ms */
+ lcd_write_reg(R_DISP_CONTROL,0);
+ sleep(HZ/67); /* 15ms */
+ lcd_write_reg(R_POWER_CONTROL3,0);
+ lcd_write_reg(0x09,8); /* -?? */
+ sleep(HZ/67); /* 15ms */
+ lcd_write_reg(R_POWER_CONTROL4,3);
+ sleep(HZ/67); /* 15ms */
+ lcd_write_reg(R_POWER_CONTROL5,0x1019);
+ sleep(HZ/20); /* 50ms */
+ lcd_write_reg(R_POWER_CONTROL4,0x13);
+ sleep(HZ/67); /* 15ms */
+ lcd_write_reg(R_POWER_CONTROL1,0x10);
+ sleep(HZ/20); /* 50ms */
+ lcd_write_reg(0x09,0); /* -?? */
+ sleep(HZ/67); /* 15ms */
+ lcd_write_reg(R_POWER_CONTROL1,0x10);
+ sleep(HZ/67); /* 15ms */
+ lcd_write_reg(R_POWER_CONTROL5,0x3019);
+ sleep(HZ/6.6);/* 150ms */
+ lcd_write_reg(0x09,2); /* -?? */
+ sleep(HZ/20); /* 50ms */
+ lcd_write_reg(R_DISP_CONTROL,5);
+ sleep(HZ/22); /* 45ms */
+ lcd_write_reg(R_DISP_CONTROL,0x25);
+ sleep(HZ/22); /* 45ms */
+ lcd_write_reg(R_DISP_CONTROL,0x27);
+ sleep(HZ/25); /* 40ms */
+ lcd_write_reg(R_DISP_CONTROL,0x33 | disp_control_rev);
+ sleep(HZ/22); /* 45ms */
+ /* fix contrast */
+ lcd_write_reg(R_POWER_CONTROL5, 0x2018 | lcd_contrast);
+
+ display_on = true;
+}
+
+void lcd_enable(bool on)
+{
+ if (on == display_on)
+ return;
+
+ if (on)
+ {
+ lcd_display_on();
+ /* Probably out of sync and we don't wanna pepper the code with
+ lcd_update() calls for this. */
+ lcd_update();
+ send_event(LCD_EVENT_ACTIVATION, NULL);
+ }
+ else
+ {
+ lcd_display_off();
+ }
+}
+#endif
+
+#if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP)
+bool lcd_active(void)
+{
+ return display_on;
+}
+#endif
+
+/*** update functions ***/
+
+void lcd_yuv_set_options(unsigned options)
+{
+ lcd_yuv_options = options;
+}
+
+/* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */
+
+extern void lcd_write_yuv420_lines(unsigned char const * const src[3],
+ int width,
+ int stride);
+extern void lcd_write_yuv420_lines_odither(unsigned char const * const src[3],
+ int width,
+ int stride,
+ int x_screen, /* To align dither pattern */
+ int y_screen);
+
+/* Performance function to blit a YUV bitmap directly to the LCD */
+void lcd_blit_yuv(unsigned char * const src[3],
+ int src_x, int src_y, int stride,
+ int x, int y, int width, int height)
+{
+ const unsigned char *yuv_src[3];
+ const unsigned char *ysrc_max;
+ int y0;
+ int options;
+
+ if (!display_on)
+ return;
+
+ width &= ~1;
+ height &= ~1;
+
+ lcd_write_reg(R_VERT_RAM_ADDR_POS, ((LCD_WIDTH - 1 - x) << 8) |
+ ((LCD_WIDTH-1) - (x + width - 1)));
+
+ y0 = LCD_HEIGHT - 1 - y;
+
+ lcd_write_reg(R_ENTRY_MODE,0x1000);
+
+ yuv_src[0] = src[0] + src_y * stride + src_x;
+ yuv_src[1] = src[1] + (src_y * stride >> 2) + (src_x >> 1);
+ yuv_src[2] = src[2] + (yuv_src[1] - src[1]);
+ ysrc_max = yuv_src[0] + height * stride;
+
+ options = lcd_yuv_options;
+
+ do
+ {
+ lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (y0 << 8) | (y0 - 1));
+ lcd_write_reg(R_RAM_ADDR_SET, ((LCD_WIDTH - 1 - x) << 8) | y0);
+
+ /* start drawing */
+ lcd_send_cmd(R_WRITE_DATA_2_GRAM);
+
+ if (options & LCD_YUV_DITHER)
+ {
+ lcd_write_yuv420_lines_odither(yuv_src, width, stride,x, y);
+ y -= 2;
+ }
+ else
+ {
+ lcd_write_yuv420_lines(yuv_src, width, stride);
+ }
+
+ y0 -= 2;
+ yuv_src[0] += stride << 1;
+ yuv_src[1] += stride >> 1;
+ yuv_src[2] += stride >> 1;
+ }
+ while (yuv_src[0] < ysrc_max);
+ lcd_write_reg(R_ENTRY_MODE,0x1008);
+}
+
+/* Update a fraction of the display. */
+void lcd_update_rect(int x0, int y0, int width, int height)
+{
+ const fb_data *addr;
+ int x1, y1;
+
+ if (!display_on)
+ return;
+
+ if ((width<=0)||(height<=0))
+ return;
+
+ if ((x0 + width)>=LCD_WIDTH)
+ width = LCD_WIDTH - x0;
+ if ((y0 + height)>=LCD_HEIGHT)
+ height = LCD_HEIGHT - y0;
+
+ y1 = (y0 + height) - 1;
+ x1 = (x0 + width) - 1;
+
+ /* In the PB Vibe LCD is flipped and the RAM addresses are decremented */
+ lcd_send_cmd(R_HORIZ_RAM_ADDR_POS);
+ lcd_send_data( (((LCD_HEIGHT-1)-y0) << 8) | ((LCD_HEIGHT-1)-y1));
+
+ lcd_send_cmd(R_VERT_RAM_ADDR_POS);
+ lcd_send_data( (((LCD_WIDTH -1)-x0) << 8) | ((LCD_WIDTH -1)-x1));
+
+ lcd_send_cmd(R_RAM_ADDR_SET);
+ lcd_send_data( (((LCD_WIDTH -1)-x0) << 8) | ((LCD_HEIGHT-1)-y0));
+
+ /* start drawing */
+ lcd_send_cmd(R_WRITE_DATA_2_GRAM);
+
+ addr = &lcd_framebuffer[y0][x0];
+
+ int c, r;
+ for (r = 0; r < height; r++)
+ {
+ for (c = 0; c < width; c++)
+ lcd_send_data_swapped(*addr++);
+ addr += LCD_WIDTH - width;
+ }
+}
+
+/* Update the display.
+ This must be called after all other LCD
+ functions that change the display. */
+void lcd_update(void)
+{
+ lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
+}
diff --git a/firmware/target/arm/pbell/vibe500/power-vibe500.c b/firmware/target/arm/pbell/vibe500/power-vibe500.c
new file mode 100644
index 0000000000..e55c69e033
--- /dev/null
+++ b/firmware/target/arm/pbell/vibe500/power-vibe500.c
@@ -0,0 +1,103 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id:$
+ *
+ * Copyright (C) 2009 by Szymon Dziok
+ *
+ * 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 "cpu.h"
+#include <stdbool.h>
+#include "kernel.h"
+#include "system.h"
+#include "power.h"
+#include "logf.h"
+#include "usb.h"
+#include "synaptics-mep.h"
+
+void power_init(void)
+{
+ GPIOD_ENABLE |= 0x80; /* enable ACK */
+ GPIOA_ENABLE |= (0x10 | 0x20); /* enable DATA, CLK */
+
+ GPIOD_OUTPUT_EN |= 0x80; /* set ACK */
+ GPIOD_OUTPUT_VAL |= 0x80; /* high */
+
+ GPIOA_OUTPUT_EN &= ~0x20; /* CLK */
+
+ GPIOA_OUTPUT_EN |= 0x10; /* set DATA */
+ GPIOA_OUTPUT_VAL |= 0x10; /* high */
+
+ if (!touchpad_init())
+ {
+ logf("touchpad not ready");
+ }
+ /* Sound unmute (on) */
+ GPIO_CLEAR_BITWISE(GPIOL_OUTPUT_VAL, 0x10);
+}
+
+unsigned int power_input_status(void)
+{
+ unsigned int status = POWER_INPUT_NONE;
+ /* GPIOL - external charger connected */
+ if (GPIOL_INPUT_VAL & 0x20)
+ status = POWER_INPUT_MAIN_CHARGER;
+ /* GPIOL - usb connected */
+ if (GPIOL_INPUT_VAL & 0x04)
+ status |= POWER_INPUT_USB_CHARGER;
+
+ return status;
+}
+
+void ide_power_enable(bool on)
+{
+ if(on){
+ GPIO_SET_BITWISE(GPIOC_OUTPUT_VAL, 0x08);
+ DEV_EN |= DEV_IDE0;
+ } else
+ {
+ DEV_EN &= ~DEV_IDE0;
+ GPIO_CLEAR_BITWISE(GPIOC_OUTPUT_VAL, 0x08);
+ }
+}
+
+bool ide_powered(void)
+{
+ return ((GPIOC_INPUT_VAL & 0x08) == 1);
+}
+
+void power_off(void)
+{
+ /* from the OF */
+/*
+ DEV_INIT2 |= DEV_I2S;
+ GPIO_SET_BITWISE(GPIOL_OUTPUT_VAL, 0x10);
+ sleep(HZ/100);
+ GPIO_SET_BITWISE(GPIOL_OUTPUT_VAL, 0x10);
+ sleep(HZ);
+ GPIO_CLEAR_BITWISE(GPIOB_OUTPUT_VAL, 0x80);
+ sleep(HZ);
+ GPIO_CLEAR_BITWISE(GPIOC_OUTPUT_VAL, 0x08);
+ GPO32_VAL |= 0x40000000;
+ GPO32_ENABLE |= 0x40000000;
+*/
+ /* Sound mute (off) */
+ DEV_INIT2 |= DEV_I2S;
+ GPIO_SET_BITWISE(GPIOL_OUTPUT_VAL, 0x10);
+ /* shutdown bit */
+ GPIO_CLEAR_BITWISE(GPIOB_OUTPUT_VAL, 0x80);
+}
diff --git a/firmware/target/arm/pbell/vibe500/powermgmt-vibe500.c b/firmware/target/arm/pbell/vibe500/powermgmt-vibe500.c
new file mode 100644
index 0000000000..d84881cea1
--- /dev/null
+++ b/firmware/target/arm/pbell/vibe500/powermgmt-vibe500.c
@@ -0,0 +1,57 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id:$
+ *
+ * Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese
+ * Revisions copyright (C) 2005 by Gerald Van Baren
+ * Copyright (C) 2009 by Szymon Dziok
+ *
+ * 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 "adc.h"
+#include "powermgmt.h"
+
+const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
+{
+ 3515
+};
+
+const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
+{
+ 3486
+};
+
+/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
+const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
+{
+ { 3474, 3515, 3556, 3597, 3638, 3679, 3720, 3761, 3802, 3843, 3884 }
+};
+
+/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
+const unsigned short percent_to_volt_charge[11] =
+{
+ 3474, 3515, 3556, 3597, 3638, 3679, 3720, 3761, 3802, 3843, 3884
+};
+
+#define BATTERY_SCALE_FACTOR 4200
+/* full-scale ADC readout (2^10) in millivolt */
+
+/* Returns battery voltage from ADC [millivolts] */
+unsigned int battery_adc_voltage(void)
+{
+ return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10;
+}
diff --git a/firmware/target/arm/pbell/vibe500/usb-target.h b/firmware/target/arm/pbell/vibe500/usb-target.h
new file mode 100644
index 0000000000..a453a7cbfa
--- /dev/null
+++ b/firmware/target/arm/pbell/vibe500/usb-target.h
@@ -0,0 +1,29 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id:$
+ *
+ * Copyright (C) 2006 by Barry Wardell
+ *
+ * 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 off x5 version */
+
+#ifndef USB_TARGET_H
+#define USB_TARGET_H
+
+bool usb_init_device(void);
+
+#endif
diff --git a/firmware/target/arm/system-pp502x.c b/firmware/target/arm/system-pp502x.c
index e2604e7633..926dcaca35 100644
--- a/firmware/target/arm/system-pp502x.c
+++ b/firmware/target/arm/system-pp502x.c
@@ -159,6 +159,16 @@ void __attribute__((interrupt("IRQ"))) irq_handler(void)
usb_insert_int();
}
/* end SAMSUNG_YHxxx */
+#elif defined(PBELL_VIBE500)
+ else if (CPU_HI_INT_STAT & GPIO0_MASK) {
+ if (GPIOA_INT_STAT & 0x20)
+ button_int();
+ }
+ else if (CPU_HI_INT_STAT & GPIO2_MASK) {
+ if (GPIOL_INT_STAT & 0x04)
+ usb_insert_int();
+ }
+/* end PBELL_VIBE500 */
#endif
#ifdef IPOD_ACCESSORY_PROTOCOL
else if (CPU_HI_INT_STAT & SER0_MASK) {
@@ -461,6 +471,8 @@ void system_init(void)
/* to be done */
#elif defined (TATUNG_TPJ1022)
/* to be done */
+#elif defined(PBELL_VIBE500)
+ /* to be done */
#endif
#if !defined(SANSA_E200) && !defined(SANSA_C200) && !defined(PHILIPS_SA9200)
diff --git a/firmware/target/arm/usb-fw-pp502x.c b/firmware/target/arm/usb-fw-pp502x.c
index bc15dc208d..0b474c96bf 100644
--- a/firmware/target/arm/usb-fw-pp502x.c
+++ b/firmware/target/arm/usb-fw-pp502x.c
@@ -88,6 +88,12 @@
#define USB_GPIO_MASK 0x10
#define USB_GPIO_VAL 0x10
+#elif defined(PBELL_VIBE500)
+ /* GPIO L bit 3 is usb detect */
+#define USB_GPIO GPIOL
+#define USB_GPIO_MASK 0x04
+#define USB_GPIO_VAL 0x04
+
#else
#error No USB GPIO config specified
#endif
diff --git a/firmware/target/arm/wmcodec-pp.c b/firmware/target/arm/wmcodec-pp.c
index bd3d4e6579..e6fbf47f0d 100644
--- a/firmware/target/arm/wmcodec-pp.c
+++ b/firmware/target/arm/wmcodec-pp.c
@@ -33,7 +33,8 @@
#include "wmcodec.h"
#if defined(IRIVER_H10) || defined(IRIVER_H10_5GB) || \
- defined(MROBE_100) || defined(PHILIPS_HDD1630)
+ defined(MROBE_100) || defined(PHILIPS_HDD1630) || \
+ defined(PBELL_VIBE500)
/* The H10's audio codec uses an I2C address of 0x1b */
#define I2C_AUDIO_ADDRESS 0x1b
#else
diff --git a/tools/configure b/tools/configure
index 33c272d1b1..dd0e189df9 100755
--- a/tools/configure
+++ b/tools/configure
@@ -906,8 +906,8 @@ cat <<EOF
==Samsung== ==Tatung== 80) DAX 1GB MP3/DAB
140) YH-820 150) Elio TPJ-1022
141) YH-920 ==Lyre project==1
- 142) YH-925 130) Lyre proto 1
- 143) YP-S3 131) Mini2440
+ 142) YH-925 ==Packard Bell== 130) Lyre proto 1
+ 143) YP-S3 160) Vibe 500 131) Mini2440
EOF
buildfor=`input`;
@@ -2456,6 +2456,29 @@ fi
t_model="yps3"
;;
+ 160|pb_vibe500)
+ target_id=67
+ modelname="pb_vibe500"
+ target="-DPBELL_VIBE500"
+ memory=32 # always
+ arm7tdmicc
+ tool="$rootdir/tools/scramble -mi4v3 -model=vibe500 -type=RBOS"
+ bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
+ bmp2rb_native="$rootdir/tools/bmp2rb -f 5"
+ output="jukebox.mi4"
+ appextra="recorder:gui"
+ plugins="no"
+ swcodec="yes"
+ boottool="$rootdir/tools/scramble -mi4v3 -model=vibe500 -type=RBBL"
+ bootoutput="rockbox.mi4"
+ # toolset is the tools within the tools directory that we build for
+ # this particular target.
+ toolset=$scramblebitmaptools
+ # architecture, manufacturer and model for the target-tree build
+ t_cpu="arm"
+ t_manufacturer="pbell"
+ t_model="vibe500"
+ ;;
*)
echo "Please select a supported target platform!"