mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-04-12 00:47:49 -04:00
Remove Meizu M3/M6SL/M6SP and Samsung YP-S3 ports
These targets haven't seen any changes since 2008-09 have bitrotted to the point they don't compile anymore. With only internal NAND flash for storage which doesn't seem to have ever been accessible from Rockbox, they've never been usable and there's probably not much point keeping them around any more. Change-Id: I2fc63da20682b439126672065ae013044cb2d1c4
This commit is contained in:
parent
19fe7a4915
commit
1a33d7990a
60 changed files with 38 additions and 5990 deletions
|
|
@ -215,10 +215,6 @@ keymaps/keymap-mr500.c
|
|||
keymaps/keymap-mr100.c
|
||||
#elif CONFIG_KEYPAD == COWON_D2_PAD
|
||||
keymaps/keymap-cowond2.c
|
||||
#elif CONFIG_KEYPAD == MEIZU_M6SL_PAD
|
||||
keymaps/keymap-meizu-m6sl.c
|
||||
#elif CONFIG_KEYPAD == MEIZU_M6SP_PAD
|
||||
keymaps/keymap-meizu-m6sp.c
|
||||
#elif CONFIG_KEYPAD == CREATIVEZVM_PAD
|
||||
keymaps/keymap-creativezvm.c
|
||||
#elif CONFIG_KEYPAD == CREATIVEZV_PAD
|
||||
|
|
|
|||
|
|
@ -1,299 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006 Jonathan Gordon
|
||||
*
|
||||
* 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 toshiba gigabeat 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
|
||||
*/
|
||||
|
||||
/* CONTEXT_CUSTOM's used in this file...
|
||||
|
||||
CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions)
|
||||
CONTEXT_CUSTOM|CONTEXT_SETTINGS = the direction keys for the eq/col picker screens
|
||||
i.e where up/down is inc/dec
|
||||
CONTEXT_SETTINGS = up/down is prev/next, l/r is inc/dec
|
||||
|
||||
*/
|
||||
|
||||
|
||||
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_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT,BUTTON_SELECT },
|
||||
|
||||
{ ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
|
||||
{ ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
|
||||
|
||||
{ ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
|
||||
{ ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
|
||||
|
||||
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_NONE },
|
||||
|
||||
{ ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
|
||||
{ ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
|
||||
|
||||
{ ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
|
||||
{ ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
|
||||
|
||||
{ ACTION_WPS_ABSETB_NEXTDIR, BUTTON_PLAY|BUTTON_RIGHT, BUTTON_NONE },
|
||||
{ ACTION_WPS_ABSETA_PREVDIR, BUTTON_PLAY|BUTTON_LEFT, BUTTON_NONE },
|
||||
{ ACTION_WPS_ABRESET, BUTTON_PLAY|BUTTON_SELECT, BUTTON_NONE },
|
||||
|
||||
{ ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
|
||||
{ ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
|
||||
|
||||
{ ACTION_WPS_PITCHSCREEN, BUTTON_PLAY|BUTTON_UP, BUTTON_PLAY },
|
||||
{ ACTION_WPS_VIEW_PLAYLIST, BUTTON_PLAY|BUTTON_DOWN, BUTTON_PLAY },
|
||||
|
||||
{ ACTION_WPS_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
|
||||
{ ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
|
||||
{ ACTION_WPS_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
|
||||
|
||||
{ ACTION_WPS_HOTKEY, BUTTON_PLAY|BUTTON_MENU, BUTTON_NONE },
|
||||
{ ACTION_WPS_BROWSE, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
|
||||
|
||||
LAST_ITEM_IN_LIST
|
||||
}; /* button_context_wps */
|
||||
|
||||
static const struct button_mapping button_context_list[] = {
|
||||
{ ACTION_LISTTREE_PGUP, BUTTON_PLAY|BUTTON_UP, BUTTON_NONE },
|
||||
{ ACTION_LISTTREE_PGUP, BUTTON_PLAY|BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_LISTTREE_PGDOWN, BUTTON_PLAY|BUTTON_DOWN, BUTTON_NONE },
|
||||
{ ACTION_LISTTREE_PGDOWN, BUTTON_PLAY|BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
||||
}; /* button_context_list */
|
||||
|
||||
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_NONE },
|
||||
{ ACTION_TREE_HOTKEY, BUTTON_PLAY|BUTTON_MENU, BUTTON_NONE },
|
||||
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST)
|
||||
}; /* button_context_tree */
|
||||
|
||||
static const struct button_mapping button_context_listtree_scroll_with_combo[] = {
|
||||
{ ACTION_NONE, BUTTON_PLAY, BUTTON_NONE },
|
||||
{ ACTION_TREE_PGLEFT, BUTTON_PLAY|BUTTON_LEFT, BUTTON_NONE },
|
||||
{ ACTION_TREE_ROOT_INIT, BUTTON_PLAY|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_PLAY|BUTTON_LEFT },
|
||||
{ ACTION_TREE_PGLEFT, BUTTON_PLAY|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_TREE_PGRIGHT, BUTTON_PLAY|BUTTON_RIGHT, BUTTON_NONE },
|
||||
{ ACTION_TREE_PGRIGHT, BUTTON_PLAY|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
|
||||
};
|
||||
|
||||
static const struct button_mapping button_context_listtree_scroll_without_combo[] = {
|
||||
{ ACTION_NONE, BUTTON_LEFT, BUTTON_NONE },
|
||||
{ ACTION_STD_CANCEL, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
|
||||
{ ACTION_TREE_ROOT_INIT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_LEFT },
|
||||
{ ACTION_TREE_PGLEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_NONE, BUTTON_RIGHT, BUTTON_NONE },
|
||||
{ ACTION_STD_OK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
|
||||
{ ACTION_TREE_PGRIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_TREE),
|
||||
};
|
||||
|
||||
static const struct button_mapping button_context_settings[] = {
|
||||
{ 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_settings */
|
||||
|
||||
static const struct button_mapping button_context_settings_right_is_inc[] = {
|
||||
{ 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 },
|
||||
{ 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 },
|
||||
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
||||
}; /* button_context_settingsgraphical */
|
||||
|
||||
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[] = {
|
||||
{ ACTION_STD_OK, BUTTON_PLAY|BUTTON_REL, BUTTON_NONE },
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
|
||||
}; /* button_context_colorchooser */
|
||||
|
||||
static const struct button_mapping button_context_eq[] = {
|
||||
{ ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_CUSTOM|CONTEXT_SETTINGS),
|
||||
}; /* button_context_eq */
|
||||
|
||||
/** Bookmark Screen **/
|
||||
static const struct button_mapping button_context_bmark[] = {
|
||||
{ ACTION_BMS_DELETE, BUTTON_PLAY, BUTTON_NONE },
|
||||
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
|
||||
}; /* button_context_bmark */
|
||||
|
||||
static const struct button_mapping button_context_time[] = {
|
||||
{ ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
|
||||
{ ACTION_STD_OK, BUTTON_PLAY, BUTTON_NONE },
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS),
|
||||
}; /* 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_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_TOGGLE_MODE, BUTTON_MENU, BUTTON_NONE },
|
||||
{ ACTION_PS_RESET, BUTTON_PLAY, BUTTON_NONE },
|
||||
{ ACTION_PS_EXIT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_PS_SLOWER, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_PS_FASTER, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
|
||||
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
||||
}; /* button_context_pitchcreen */
|
||||
|
||||
static const struct button_mapping button_context_keyboard[] = {
|
||||
{ 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_CURSOR_LEFT, BUTTON_PLAY|BUTTON_LEFT, BUTTON_NONE },
|
||||
{ ACTION_KBD_CURSOR_LEFT, BUTTON_PLAY|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_KBD_CURSOR_RIGHT, BUTTON_PLAY|BUTTON_RIGHT, BUTTON_NONE },
|
||||
{ ACTION_KBD_CURSOR_RIGHT, BUTTON_PLAY|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE },
|
||||
{ ACTION_KBD_PAGE_FLIP, BUTTON_PLAY|BUTTON_MENU, BUTTON_NONE },
|
||||
{ ACTION_KBD_DONE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
|
||||
{ ACTION_KBD_ABORT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_KBD_BACKSPACE, BUTTON_MENU, BUTTON_NONE },
|
||||
{ ACTION_KBD_BACKSPACE, BUTTON_MENU|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ 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_MORSE_INPUT, BUTTON_PLAY|BUTTON_POWER, BUTTON_NONE },
|
||||
{ ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
|
||||
|
||||
LAST_ITEM_IN_LIST
|
||||
}; /* button_context_keyboard */
|
||||
|
||||
|
||||
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:
|
||||
if (global_settings.hold_lr_for_scroll_in_list)
|
||||
return button_context_listtree_scroll_without_combo;
|
||||
else
|
||||
return button_context_listtree_scroll_with_combo;
|
||||
case CONTEXT_CUSTOM|CONTEXT_TREE:
|
||||
return button_context_tree;
|
||||
|
||||
case CONTEXT_SETTINGS:
|
||||
return button_context_settings;
|
||||
case CONTEXT_CUSTOM|CONTEXT_SETTINGS:
|
||||
return button_context_settings_right_is_inc;
|
||||
|
||||
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_BOOKMARKSCREEN:
|
||||
return button_context_bmark;
|
||||
case CONTEXT_QUICKSCREEN:
|
||||
return button_context_quickscreen;
|
||||
case CONTEXT_PITCHSCREEN:
|
||||
return button_context_pitchscreen;
|
||||
case CONTEXT_KEYBOARD:
|
||||
case CONTEXT_MORSE_INPUT:
|
||||
return button_context_keyboard;
|
||||
}
|
||||
return button_context_standard;
|
||||
}
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006 Jonathan Gordon
|
||||
*
|
||||
* 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 toshiba gigabeat 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
|
||||
*/
|
||||
|
||||
/* CONTEXT_CUSTOM's used in this file...
|
||||
|
||||
CONTEXT_CUSTOM|CONTEXT_TREE = the standard list/tree defines (without directions)
|
||||
CONTEXT_CUSTOM|CONTEXT_SETTINGS = the direction keys for the eq/col picker screens
|
||||
i.e where up/down is inc/dec
|
||||
CONTEXT_SETTINGS = up/down is prev/next, l/r is inc/dec
|
||||
|
||||
*/
|
||||
|
||||
/* copied from Meizu M6SP keymap */
|
||||
static const struct button_mapping button_context_standard[] = {
|
||||
#if 0 /* disabled for now, there is no BUTTON_UP/DOWN yet */
|
||||
{ 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 },
|
||||
#endif
|
||||
{ ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
|
||||
|
||||
{ ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT,BUTTON_SELECT },
|
||||
|
||||
{ ACTION_STD_QUICKSCREEN, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
|
||||
{ ACTION_STD_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
|
||||
|
||||
{ ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
|
||||
{ ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
|
||||
|
||||
LAST_ITEM_IN_LIST
|
||||
}; /* button_context_standard */
|
||||
|
||||
|
||||
const struct button_mapping* get_context_mapping(int context)
|
||||
{
|
||||
(void)context;
|
||||
|
||||
/* TODO add more button contexts */
|
||||
return button_context_standard;
|
||||
}
|
||||
|
|
@ -162,8 +162,6 @@ const struct button_mapping pf_context_buttons[] =
|
|||
{PF_QUIT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU},
|
||||
#elif CONFIG_KEYPAD == IAUDIO_M3_PAD
|
||||
{PF_QUIT, BUTTON_RC_REC, BUTTON_NONE},
|
||||
#elif CONFIG_KEYPAD == MEIZU_M6SL_PAD
|
||||
{PF_QUIT, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU},
|
||||
#elif CONFIG_KEYPAD == IRIVER_H100_PAD || CONFIG_KEYPAD == IRIVER_H300_PAD
|
||||
{PF_QUIT, BUTTON_OFF, BUTTON_NONE},
|
||||
#elif CONFIG_KEYPAD == PBELL_VIBE500_PAD
|
||||
|
|
|
|||
|
|
@ -42,14 +42,6 @@ mrobe500.c
|
|||
#elif defined(CPU_TCC780X)
|
||||
telechips.c
|
||||
show_logo.c
|
||||
#elif defined(MEIZU_M6SL)
|
||||
meizu_m6sl.c
|
||||
#elif defined(MEIZU_M6SP)
|
||||
meizu_m6sp.c
|
||||
#elif defined(MEIZU_M3)
|
||||
meizu_m3.c
|
||||
#elif defined(SAMSUNG_YPS3)
|
||||
samsung_yps3.c
|
||||
#elif defined(ONDA_VX747) || defined(ONDA_VX747P) || defined(ONDA_VX767) || defined(ONDA_VX777)
|
||||
ondavx747.c
|
||||
show_logo.c
|
||||
|
|
|
|||
|
|
@ -1,220 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006 by Greg White
|
||||
*
|
||||
* 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 <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-internal.h"
|
||||
#include "storage.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 "rbunicode.h"
|
||||
#include "usb.h"
|
||||
#include "qt1106.h"
|
||||
#include "bitmaps/rockboxlogo.h"
|
||||
|
||||
#include "i2c-s5l8700.h"
|
||||
#include "dma-target.h"
|
||||
#include "pcm.h"
|
||||
#include "audiohw.h"
|
||||
#include "rtc.h"
|
||||
#include "time.h"
|
||||
|
||||
#define LONG_DELAY 200000
|
||||
#define SHORT_DELAY 50000
|
||||
#define PAUSE_DELAY 50000
|
||||
|
||||
static inline void delay(int duration)
|
||||
{
|
||||
volatile int i;
|
||||
for(i=0;i<duration;i++);
|
||||
}
|
||||
|
||||
|
||||
void bl_debug(bool bit)
|
||||
{
|
||||
if (bit)
|
||||
{
|
||||
PDAT0 ^= (1 << 2); //Toggle backlight
|
||||
delay(LONG_DELAY);
|
||||
PDAT0 ^= (1 << 2); //Toggle backlight
|
||||
delay(LONG_DELAY);
|
||||
}
|
||||
else
|
||||
{
|
||||
PDAT0 ^= (1 << 2); //Toggle backlight
|
||||
delay(SHORT_DELAY);
|
||||
PDAT0 ^= (1 << 2); //Toggle backlight
|
||||
delay(SHORT_DELAY);
|
||||
}
|
||||
}
|
||||
|
||||
void bl_debug_count(unsigned int input)
|
||||
{
|
||||
unsigned int i;
|
||||
delay(SHORT_DELAY*3);
|
||||
for (i = 0; i < input; i++)
|
||||
{
|
||||
PDAT0 ^= (1 << 2); //Toggle backlight
|
||||
delay(SHORT_DELAY);
|
||||
PDAT0 ^= (1 << 2); //Toggle backlight
|
||||
delay(2*SHORT_DELAY);
|
||||
}
|
||||
}
|
||||
void bl_debug_int(unsigned int input,unsigned int count)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
bl_debug(input>>i & 1);
|
||||
}
|
||||
delay(SHORT_DELAY*6);
|
||||
}
|
||||
|
||||
void post_mortem_stub(void)
|
||||
{
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
char mystring[64];
|
||||
int i;
|
||||
unsigned short data = 0;
|
||||
char write_data[2], read_data[16];
|
||||
struct tm tm;
|
||||
|
||||
//Set backlight pin to output and enable
|
||||
int oldval = PCON0;
|
||||
PCON0 = ((oldval & ~(3 << 4)) | (1 << 4));
|
||||
PDAT0 |= (1 << 2);
|
||||
|
||||
// Set codec reset pin inactive
|
||||
PCON5 = (PCON5 & ~0xF) | 1;
|
||||
PDAT5 &= ~(1 << 0);
|
||||
|
||||
//power on
|
||||
// oldval = PCON1;
|
||||
// PCON1 = ((oldval & ~(0xf << 12)) | (1 << 12));
|
||||
// PDAT1|=(1<<3);
|
||||
|
||||
//Set PLAY to EINT4
|
||||
oldval = PCON1;
|
||||
PCON1 = ((oldval & ~(0xf << 16)) | (2 << 16));
|
||||
|
||||
//Set MENU to EINT0
|
||||
oldval = PCON1;
|
||||
PCON1 = (oldval & ~(0xf)) | 2;
|
||||
|
||||
// enable external interrupts
|
||||
EINTPOL = 0x11;
|
||||
INTMSK = 0x11;
|
||||
EINTMSK = 0x11;
|
||||
asm volatile("msr cpsr_c, #0x13\n\t"); // enable interrupts
|
||||
|
||||
system_init();
|
||||
kernel_init();
|
||||
|
||||
lcd_init();
|
||||
backlight_init(); /* BUGFIX backlight_init MUST BE AFTER lcd_init */
|
||||
lcd_update();
|
||||
|
||||
i2c_init();
|
||||
|
||||
init_qt1106();
|
||||
|
||||
/* Calibrate the lot */
|
||||
qt1106_io(QT1106_MODE_FREE | QT1106_MOD_INF | QT1106_DI \
|
||||
| QT1106_SLD_SLIDER | QT1106_CAL_WHEEL | QT1106_CAL_KEYS | QT1106_RES_256);
|
||||
|
||||
lcd_clear_display();
|
||||
lcd_bitmap(rockboxlogo, 0, 30, BMPWIDTH_rockboxlogo, BMPHEIGHT_rockboxlogo);
|
||||
lcd_update();
|
||||
|
||||
/* Set to maximum sensitivity */
|
||||
qt1106_io(QT1106_CT | (0x00 << 8) );
|
||||
|
||||
while(true)
|
||||
{
|
||||
#if 1 /* enable this to see info about the slider touchpad */
|
||||
qt1106_wait();
|
||||
|
||||
int slider = qt1106_io(QT1106_MODE_FREE | QT1106_MOD_INF \
|
||||
| QT1106_DI | QT1106_SLD_SLIDER | QT1106_RES_256);
|
||||
snprintf(mystring, 64, "%x %2.2x",(slider & 0x008000)>>15, slider&0xff);
|
||||
lcd_puts(0,1,mystring);
|
||||
backlight_hw_brightness((slider & 0xFF) >> 4);
|
||||
|
||||
/*
|
||||
if(slider & 0x008000)
|
||||
bl_debug_count(((slider&0xff)) + 1);
|
||||
*/
|
||||
#endif
|
||||
|
||||
#if 1 /* enable this to see info about the RTC */
|
||||
rtc_read_datetime(&tm);
|
||||
snprintf(mystring, 64, "%04d-%02d-%02d %02d:%02d:%02d",
|
||||
tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday,
|
||||
tm.tm_hour, tm.tm_min, tm.tm_sec);
|
||||
lcd_puts(0, 10, mystring);
|
||||
#endif
|
||||
|
||||
#if 1 /* enable this so see info about the UDA1380 codec */
|
||||
memset(read_data, 0, sizeof(read_data));
|
||||
for (i = 0; i < 7; i++) {
|
||||
write_data[0] = i;
|
||||
i2c_read(0x30, i, 2, read_data);
|
||||
data = read_data[0] << 8 | read_data[1];
|
||||
snprintf(mystring + 4 * i, 64, "%04X", data);
|
||||
}
|
||||
lcd_puts(0, 11, mystring);
|
||||
#endif
|
||||
|
||||
#if 1 /* enable this to see info about IODMA channel 0 (PCM) */
|
||||
snprintf(mystring, 64, "DMA: %08X %08X", (int)DMACADDR0, (int)DMACTCNT0);
|
||||
lcd_puts(0, 12, mystring);
|
||||
#endif
|
||||
#if 1 /* enable this to see info about IIS */
|
||||
snprintf(mystring, 64, "IIS: %08X", (int)I2SSTATUS);
|
||||
lcd_puts(0, 13, mystring);
|
||||
#endif
|
||||
|
||||
lcd_update();
|
||||
}
|
||||
|
||||
//power off
|
||||
PDAT1&=~(1<<3);
|
||||
}
|
||||
|
||||
|
|
@ -1,153 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006 by Greg White
|
||||
*
|
||||
* 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 <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "inttypes.h"
|
||||
#include "string.h"
|
||||
#include "cpu.h"
|
||||
#include "system.h"
|
||||
#include "lcd.h"
|
||||
#include "kernel.h"
|
||||
#include "thread.h"
|
||||
#include "storage.h"
|
||||
#include "disk.h"
|
||||
#include "font.h"
|
||||
#include "adc.h"
|
||||
#include "backlight.h"
|
||||
#include "backlight-target.h"
|
||||
#include "button.h"
|
||||
#include "panic.h"
|
||||
#include "power.h"
|
||||
#include "file.h"
|
||||
#include "common.h"
|
||||
#include "rbunicode.h"
|
||||
#include "usb.h"
|
||||
#include "qt1106.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define LONG_DELAY 200000
|
||||
#define SHORT_DELAY 50000
|
||||
#define PAUSE_DELAY 50000
|
||||
|
||||
static inline void delay(int duration)
|
||||
{
|
||||
volatile int i;
|
||||
for(i=0;i<duration;i++);
|
||||
}
|
||||
|
||||
|
||||
void bl_debug(bool bit)
|
||||
{
|
||||
if (bit)
|
||||
{
|
||||
PDAT0 ^= (1 << 2); //Toggle backlight
|
||||
delay(LONG_DELAY);
|
||||
PDAT0 ^= (1 << 2); //Toggle backlight
|
||||
delay(LONG_DELAY);
|
||||
}
|
||||
else
|
||||
{
|
||||
PDAT0 ^= (1 << 2); //Toggle backlight
|
||||
delay(SHORT_DELAY);
|
||||
PDAT0 ^= (1 << 2); //Toggle backlight
|
||||
delay(SHORT_DELAY);
|
||||
}
|
||||
}
|
||||
|
||||
void bl_debug_count(unsigned int input)
|
||||
{
|
||||
unsigned int i;
|
||||
delay(SHORT_DELAY*3);
|
||||
for (i = 0; i < input; i++)
|
||||
{
|
||||
PDAT0 ^= (1 << 2); //Toggle backlight
|
||||
delay(SHORT_DELAY);
|
||||
PDAT0 ^= (1 << 2); //Toggle backlight
|
||||
delay(2*SHORT_DELAY);
|
||||
}
|
||||
}
|
||||
void bl_debug_int(unsigned int input,unsigned int count)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
bl_debug(input>>i & 1);
|
||||
}
|
||||
delay(SHORT_DELAY*6);
|
||||
}
|
||||
|
||||
/* These functions are supposed to be static in lcd-m6sl.c, but
|
||||
we use them here for testing */
|
||||
void init_lcd_spi(void);
|
||||
unsigned int lcd_read_id(void);
|
||||
|
||||
void main(void)
|
||||
{
|
||||
//Set backlight pin to output and enable
|
||||
unsigned int model;
|
||||
int oldval = PCON0;
|
||||
PCON0 = ((oldval & ~(3 << 4)) | (1 << 4));
|
||||
PDAT0 |= (1 << 2);
|
||||
|
||||
//Set PLAY to input
|
||||
oldval = PCON1;
|
||||
PCON1 = ((oldval & ~(0xf << 16)) | (0 << 16));
|
||||
|
||||
init_qt1106();
|
||||
|
||||
// Wait for play to be pressed
|
||||
while(!(PDAT1 & (1 << 4)));
|
||||
// Wait for play to be released
|
||||
while((PDAT1 & (1 << 4)));
|
||||
PDAT0 ^= (1 << 2); //Toggle backlight
|
||||
delay(LONG_DELAY);
|
||||
|
||||
init_lcd_spi();
|
||||
model=lcd_read_id();
|
||||
bl_debug_count((model&0xf000)>>12);
|
||||
bl_debug_count((model&0xf00)>>8);
|
||||
bl_debug_count((model&0xf0)>>4);
|
||||
bl_debug_count(model&0xf);
|
||||
|
||||
/* Calibrate the lot */
|
||||
qt1106_io(QT1106_MODE_FREE | QT1106_MOD_INF | QT1106_DI \
|
||||
| QT1106_SLD_SLIDER | QT1106_CAL_WHEEL | QT1106_CAL_KEYS | QT1106_RES_4);
|
||||
|
||||
/* Set to maximum sensitivity */
|
||||
qt1106_io(QT1106_CT | (0x00 << 8) );
|
||||
|
||||
while(true)
|
||||
{
|
||||
qt1106_wait();
|
||||
|
||||
int slider = qt1106_io(QT1106_MODE_FREE | QT1106_MOD_INF \
|
||||
| QT1106_DI | QT1106_SLD_SLIDER | QT1106_RES_4);
|
||||
if(slider & 0x008000)
|
||||
bl_debug_count(((slider&0xff)) + 1);
|
||||
}
|
||||
|
||||
//power off
|
||||
PDAT1&=~(1<<3);
|
||||
}
|
||||
|
||||
|
|
@ -1,122 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006 by Greg White
|
||||
*
|
||||
* 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 <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "inttypes.h"
|
||||
#include "string.h"
|
||||
#include "cpu.h"
|
||||
#include "system.h"
|
||||
#include "lcd.h"
|
||||
#include "kernel.h"
|
||||
#include "thread.h"
|
||||
#include "storage.h"
|
||||
#include "disk.h"
|
||||
#include "font.h"
|
||||
#include "button.h"
|
||||
#include "panic.h"
|
||||
#include "power.h"
|
||||
#include "file.h"
|
||||
#include "common.h"
|
||||
#include "rbunicode.h"
|
||||
#include "usb.h"
|
||||
#include "qt1106.h"
|
||||
#include "bitmaps/rockboxlogo.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define LONG_DELAY 200000
|
||||
#define SHORT_DELAY 50000
|
||||
#define PAUSE_DELAY 50000
|
||||
|
||||
static inline void delay(int duration)
|
||||
{
|
||||
volatile int i;
|
||||
for(i=0;i<duration;i++);
|
||||
}
|
||||
|
||||
|
||||
void bl_debug(bool bit)
|
||||
{
|
||||
if (bit)
|
||||
{
|
||||
PDAT0 ^= (1 << 2); //Toggle backlight
|
||||
delay(LONG_DELAY);
|
||||
PDAT0 ^= (1 << 2); //Toggle backlight
|
||||
delay(LONG_DELAY);
|
||||
}
|
||||
else
|
||||
{
|
||||
PDAT0 ^= (1 << 2); //Toggle backlight
|
||||
delay(SHORT_DELAY);
|
||||
PDAT0 ^= (1 << 2); //Toggle backlight
|
||||
delay(SHORT_DELAY);
|
||||
}
|
||||
}
|
||||
|
||||
void bl_debug_count(unsigned int input)
|
||||
{
|
||||
unsigned int i;
|
||||
delay(SHORT_DELAY*3);
|
||||
for (i = 0; i < input; i++)
|
||||
{
|
||||
PDAT0 ^= (1 << 2); //Toggle backlight
|
||||
delay(SHORT_DELAY);
|
||||
PDAT0 ^= (1 << 2); //Toggle backlight
|
||||
delay(2*SHORT_DELAY);
|
||||
}
|
||||
}
|
||||
void bl_debug_int(unsigned int input,unsigned int count)
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
bl_debug(input>>i & 1);
|
||||
}
|
||||
delay(SHORT_DELAY*6);
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
//Set backlight pin to output and enable
|
||||
int oldval = PCON0;
|
||||
PCON0 = ((oldval & ~(3 << 4)) | (1 << 4));
|
||||
PDAT0 |= (1 << 2);
|
||||
|
||||
//Set PLAY to input
|
||||
oldval = PCON1;
|
||||
PCON1 = ((oldval & ~(0xf << 16)) | (0 << 16));
|
||||
|
||||
lcd_bitmap(rockboxlogo, 0, 0, BMPWIDTH_rockboxlogo, BMPHEIGHT_rockboxlogo);
|
||||
lcd_init_device();
|
||||
|
||||
// Wait for play to be pressed
|
||||
while(!(PDAT1 & (1 << 4)));
|
||||
// Wait for play to be released
|
||||
while((PDAT1 & (1 << 4)));
|
||||
PDAT0 ^= (1 << 2); //Toggle backlight
|
||||
delay(LONG_DELAY);
|
||||
|
||||
//power off
|
||||
PDAT1&=~(1<<3);
|
||||
}
|
||||
|
||||
|
|
@ -483,8 +483,6 @@ drivers/rtc/rtc_jz4740.c
|
|||
drivers/rtc/rtc_jz4760.c
|
||||
#elif (CONFIG_RTC == RTC_X1000)
|
||||
drivers/rtc/rtc_x1000.c
|
||||
#elif (CONFIG_RTC == RTC_S35390A)
|
||||
drivers/rtc/rtc_s35390a.c
|
||||
#elif (CONFIG_RTC == RTC_S35380A)
|
||||
drivers/rtc/rtc_s35380a.c
|
||||
#elif (CONFIG_RTC == RTC_D2)
|
||||
|
|
@ -1600,37 +1598,6 @@ target/arm/tcc780x/cowond2/audio-cowond2.c
|
|||
#endif /* BOOTLOADER */
|
||||
#endif /* COWON_D2 */
|
||||
|
||||
#ifdef MEIZU_M6SL
|
||||
target/arm/s5l8700/meizu-m6sl/lcd-m6sl.c
|
||||
drivers/qt1106.c
|
||||
#endif /* MEIZU_M6SL */
|
||||
|
||||
#ifdef MEIZU_M6SP
|
||||
target/arm/s5l8700/backlight-meizu.c
|
||||
target/arm/s5l8700/power-meizu.c
|
||||
target/arm/s5l8700/meizu-m6sp/button-m6sp.c
|
||||
target/arm/s5l8700/meizu-m6sp/lcd-m6sp.c
|
||||
#ifndef BOOTLOADER
|
||||
drivers/generic_i2c.c
|
||||
drivers/rtc/rtc_s35390a.c
|
||||
target/arm/s5l8700/audio-meizu.c
|
||||
target/arm/s5l8700/ftl-meizu.c
|
||||
target/arm/s5l8700/nand-meizu.c
|
||||
target/arm/s5l8700/fmradio-i2c-meizu.c
|
||||
target/arm/s5l8700/powermgmt-meizu.c
|
||||
target/arm/s5l8700/usb-s5l8700.c
|
||||
#endif /* BOOTLOADER */
|
||||
#endif /* MEIZU_M6SP */
|
||||
|
||||
#ifdef MEIZU_M3
|
||||
target/arm/s5l8700/backlight-meizu.c
|
||||
target/arm/s5l8700/meizu-m3/lcd-m3.c
|
||||
drivers/qt1106.c
|
||||
#ifndef BOOTLOADER
|
||||
target/arm/s5l8700/udacodec-meizu.c
|
||||
#endif /* BOOTLOADER */
|
||||
#endif /* MEIZU_M3 */
|
||||
|
||||
#ifdef IPOD_NANO2G
|
||||
target/arm/ipod/button-clickwheel.c
|
||||
target/arm/s5l8700/postmortemstub.S
|
||||
|
|
@ -1928,15 +1895,6 @@ target/arm/samsung/yh925/powermgmt-yh925.c
|
|||
target/arm/samsung/fmradio-yh92x.c
|
||||
#endif /* SAMSUNG_YH925 */
|
||||
|
||||
#ifdef SAMSUNG_YPS3
|
||||
target/arm/s5l8700/yps3/button-yps3.c
|
||||
target/arm/s5l8700/yps3/lcd-yps3.c
|
||||
target/arm/s5l8700/yps3/fmradio-i2c-yps3.c
|
||||
target/arm/s5l8700/yps3/backlight-yps3.c
|
||||
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/pbell/vibe500/lcd-vibe500.c
|
||||
|
|
|
|||
|
|
@ -1,111 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 by Bertrik Sikken
|
||||
* Copyright (C) 2008 by Robert Kukla
|
||||
*
|
||||
* 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 "rtc.h"
|
||||
#include "i2c-s5l8700.h"
|
||||
#include "timefuncs.h"
|
||||
|
||||
/* Driver for the Seiko S35390A real-time clock chip with i2c interface
|
||||
|
||||
This driver was derived from rtc_mr100.c and adapted for the S35390A
|
||||
used in the Meizu M3 (and possibly others).
|
||||
*/
|
||||
|
||||
#define RTC_ADDR 0x60
|
||||
|
||||
#define STATUS_REG1 0
|
||||
#define STATUS_REG2 1
|
||||
#define REALTIME_DATA1 2
|
||||
#define REALTIME_DATA2 3
|
||||
#define INT1_REG 4
|
||||
#define INT2_REG 5
|
||||
#define CLOCK_CORR_REG 6
|
||||
#define FREE_REG 7
|
||||
|
||||
|
||||
static void reverse_bits(unsigned char* v, int size)
|
||||
{
|
||||
static const unsigned char flipnibble[] =
|
||||
{0x00, 0x08, 0x04, 0x0C, 0x02, 0x0A, 0x06, 0x0E,
|
||||
0x01, 0x09, 0x05, 0x0D, 0x03, 0x0B, 0x07, 0x0F};
|
||||
int i;
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
v[i] = (flipnibble[v[i] & 0x0F] << 4) |
|
||||
flipnibble[(v[i] >> 4) & 0x0F];
|
||||
}
|
||||
}
|
||||
|
||||
void rtc_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
int rtc_read_datetime(struct tm *tm)
|
||||
{
|
||||
unsigned char buf[7];
|
||||
unsigned int i;
|
||||
int ret;
|
||||
|
||||
ret = i2c_read(RTC_ADDR | (REALTIME_DATA1 << 1), -1, sizeof(buf), buf);
|
||||
reverse_bits(buf, sizeof(buf));
|
||||
|
||||
buf[4] &= 0x3f; /* mask out p.m. flag */
|
||||
|
||||
for (i = 0; i < sizeof(buf); i++)
|
||||
buf[i] = BCD2DEC(buf[i]);
|
||||
|
||||
tm->tm_sec = buf[6];
|
||||
tm->tm_min = buf[5];
|
||||
tm->tm_hour = buf[4];
|
||||
tm->tm_mday = buf[2];
|
||||
tm->tm_mon = buf[1] - 1;
|
||||
tm->tm_year = buf[0] + 100;
|
||||
|
||||
set_day_of_week(tm);
|
||||
set_day_of_year(tm);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int rtc_write_datetime(const struct tm *tm)
|
||||
{
|
||||
unsigned char buf[7];
|
||||
unsigned int i;
|
||||
int ret;
|
||||
|
||||
buf[6] = tm->tm_sec;
|
||||
buf[5] = tm->tm_min;
|
||||
buf[4] = tm->tm_hour;
|
||||
buf[3] = tm->tm_wday;
|
||||
buf[2] = tm->tm_mday;
|
||||
buf[1] = tm->tm_mon + 1;
|
||||
buf[0] = tm->tm_year - 100;
|
||||
|
||||
for (i = 0; i < sizeof(buf); i++)
|
||||
buf[i] = DEC2BCD(buf[i]);
|
||||
|
||||
reverse_bits(buf, sizeof(buf));
|
||||
ret = i2c_write(RTC_ADDR | (REALTIME_DATA1 << 1), -1, sizeof(buf), buf);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -118,17 +118,13 @@
|
|||
#define CREATIVEZV_PAD 26
|
||||
#define PHILIPS_SA9200_PAD 27
|
||||
#define PHILIPS_HDD1630_PAD 29
|
||||
#define MEIZU_M6SL_PAD 30
|
||||
#define ONDAVX747_PAD 31
|
||||
#define ONDAVX767_PAD 32
|
||||
#define MEIZU_M6SP_PAD 33
|
||||
#define MEIZU_M3_PAD 34
|
||||
#define SANSA_CLIP_PAD 35
|
||||
#define SANSA_FUZE_PAD 36
|
||||
#define LYRE_PROTO1_PAD 37
|
||||
#define SAMSUNG_YH820_PAD 38
|
||||
#define ONDAVX777_PAD 39
|
||||
#define SAMSUNG_YPS3_PAD 40
|
||||
#define MINI2440_PAD 41
|
||||
#define PHILIPS_HDD6330_PAD 42
|
||||
#define PBELL_VIBE500_PAD 43
|
||||
|
|
@ -246,7 +242,6 @@
|
|||
#define LCD_SA9200 25 /* as used by the Philips SA9200 */
|
||||
#define LCD_S6B33B2 26 /* as used by the Samsumg YH820 */
|
||||
#define LCD_HDD1630 27 /* as used by the Philips HDD1630 */
|
||||
#define LCD_MEIZUM6 28 /* as used by the Meizu M6SP and M6SL (various models) */
|
||||
#define LCD_ONDAVX747 29 /* as used by the Onda VX747 */
|
||||
#define LCD_ONDAVX767 30 /* as used by the Onda VX767 */
|
||||
#define LCD_SSD1303 31 /* as used by the Sansa Clip */
|
||||
|
|
@ -354,7 +349,6 @@ Lyre prototype 1 */
|
|||
#define RTC_MR100 12
|
||||
#define RTC_MC13783 13 /* Freescale MC13783 PMIC */
|
||||
#define RTC_S5L8700 14
|
||||
#define RTC_S35390A 15
|
||||
#define RTC_JZ4740 16 /* Ingenic Jz4740 */
|
||||
#define RTC_NANO2G 17 /* This seems to be a PCF5063x */
|
||||
#define RTC_D2 18 /* Either PCF50606 or PCF50635 */
|
||||
|
|
@ -465,12 +459,6 @@ Lyre prototype 1 */
|
|||
#include "config/gogearhdd1630.h"
|
||||
#elif defined(PHILIPS_HDD6330)
|
||||
#include "config/gogearhdd6330.h"
|
||||
#elif defined(MEIZU_M6SL)
|
||||
#include "config/meizum6sl.h"
|
||||
#elif defined(MEIZU_M6SP)
|
||||
#include "config/meizum6sp.h"
|
||||
#elif defined(MEIZU_M3)
|
||||
#include "config/meizum3.h"
|
||||
#elif defined(ONDA_VX747) || defined(ONDA_VX747P)
|
||||
#include "config/ondavx747.h"
|
||||
#elif defined(ONDA_VX777)
|
||||
|
|
@ -509,8 +497,6 @@ Lyre prototype 1 */
|
|||
#include "config/samsungyh920.h"
|
||||
#elif defined(SAMSUNG_YH925)
|
||||
#include "config/samsungyh925.h"
|
||||
#elif defined(SAMSUNG_YPS3)
|
||||
#include "config/samsungyps3.h"
|
||||
#elif defined(PBELL_VIBE500)
|
||||
#include "config/vibe500.h"
|
||||
#elif defined(MPIO_HD200)
|
||||
|
|
|
|||
|
|
@ -1,176 +0,0 @@
|
|||
/*
|
||||
* This config file is for Meizu M3
|
||||
*/
|
||||
|
||||
/* For Rolo and boot loader */
|
||||
#define MODEL_NUMBER 39
|
||||
|
||||
#define MODEL_NAME "Meizu M3"
|
||||
|
||||
/* define this if you have recording possibility */
|
||||
//#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 can flip your LCD */
|
||||
//#define HAVE_LCD_FLIP
|
||||
|
||||
/* 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 can invert the colours on your LCD */
|
||||
//#define HAVE_LCD_INVERT
|
||||
|
||||
/* define this if you have access to the quickscreen */
|
||||
#define HAVE_QUICKSCREEN
|
||||
|
||||
/* define this if you would like tagcache to build on this target */
|
||||
#define HAVE_TAGCACHE
|
||||
|
||||
/* define this if you have a flash memory storage */
|
||||
#define HAVE_FLASH_STORAGE
|
||||
|
||||
#define CONFIG_STORAGE STORAGE_NAND
|
||||
|
||||
#define CONFIG_NAND NAND_SAMSUNG
|
||||
|
||||
/* The NAND flash has 2048-byte sectors, and is our only storage */
|
||||
#define SECTOR_SIZE 2048
|
||||
|
||||
/* LCD dimensions */
|
||||
#define LCD_WIDTH 176
|
||||
#define LCD_HEIGHT 132
|
||||
/* sqrt(176^2 + 132^2) / 1.5 = 146.7 */
|
||||
#define LCD_DPI 147
|
||||
#define LCD_DEPTH 16 /* pseudo 262.144 colors */
|
||||
#define LCD_PIXELFORMAT RGB565 /* rgb565 */
|
||||
|
||||
/* 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 CONFIG_KEYPAD MEIZU_M3_PAD
|
||||
|
||||
//#define AB_REPEAT_ENABLE
|
||||
//#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
|
||||
|
||||
|
||||
|
||||
|
||||
/* define this if you have a real-time clock */
|
||||
//#define CONFIG_RTC RTC_S5L8700
|
||||
#define CONFIG_RTC RTC_S35390A
|
||||
|
||||
#define CONFIG_LCD LCD_MEIZUM6
|
||||
|
||||
/* Define the type of audio codec */
|
||||
#define HAVE_UDA1380
|
||||
|
||||
/* Define this for LCD backlight available */
|
||||
#define HAVE_BACKLIGHT
|
||||
#define HAVE_BACKLIGHT_BRIGHTNESS
|
||||
|
||||
/* 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
|
||||
|
||||
/* FM Tuner */
|
||||
#define CONFIG_TUNER TEA5760
|
||||
#define CONFIG_TUNER_XTAL 32768
|
||||
|
||||
//#define HAVE_TLV320
|
||||
|
||||
/* TLV320 has no tone controls, so we use the software ones */
|
||||
#define HAVE_SW_TONE_CONTROLS
|
||||
|
||||
#define BATTERY_CAPACITY_DEFAULT 700 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 2250 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
|
||||
|
||||
#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
|
||||
|
||||
/* Hardware controlled charging, software can monitor plug and charge state */
|
||||
#define CONFIG_CHARGING CHARGING_MONITOR
|
||||
|
||||
/* Define this if your LCD can set contrast */
|
||||
//#define HAVE_LCD_CONTRAST
|
||||
|
||||
/* Define this if you have a Motorola SCF5250 */
|
||||
#define CONFIG_CPU S5L8700
|
||||
|
||||
/* Define this if you want to use coldfire's i2c interface */
|
||||
#define CONFIG_I2C I2C_S5L8700
|
||||
|
||||
/* define this if the hardware can be powered off while charging */
|
||||
#define HAVE_POWEROFF_WHILE_CHARGING
|
||||
|
||||
/* The size of the flash ROM */
|
||||
#define FLASH_SIZE 0x400000
|
||||
|
||||
/* Define this to the CPU frequency */
|
||||
#define CPU_FREQ 11289600
|
||||
|
||||
/* Define this if you have ATA power-off control */
|
||||
//#define HAVE_ATA_POWER_OFF
|
||||
|
||||
/* USB On-the-go */
|
||||
//#define CONFIG_USBOTG USBOTG_M5636
|
||||
|
||||
/* Define this if you have adjustable CPU frequency */
|
||||
#define HAVE_ADJUSTABLE_CPU_FREQ
|
||||
|
||||
#define BOOTFILE_EXT "meizu"
|
||||
#define BOOTFILE "rockbox." BOOTFILE_EXT
|
||||
#define BOOTDIR "/.rockbox"
|
||||
|
||||
#define BOOTLOADER_ENTRYPOINT 0x001F0000
|
||||
#define FLASH_ENTRYPOINT 0x00001000
|
||||
#define FLASH_MAGIC 0xfbfbfbf1
|
||||
|
||||
/* Define this for FM radio input available */
|
||||
#define HAVE_FMRADIO_IN
|
||||
|
||||
/** Port-specific settings **/
|
||||
|
||||
/* Main LCD contrast range and defaults */
|
||||
#define MIN_CONTRAST_SETTING 1
|
||||
#define MAX_CONTRAST_SETTING 30
|
||||
#define DEFAULT_CONTRAST_SETTING 19 /* Match boot contrast */
|
||||
|
||||
/* Main LCD backlight brightness range and defaults */
|
||||
#define MIN_BRIGHTNESS_SETTING 0
|
||||
#define MAX_BRIGHTNESS_SETTING 15
|
||||
#define DEFAULT_BRIGHTNESS_SETTING 10
|
||||
|
||||
/* Define this if a programmable hotkey is mapped */
|
||||
#define HAVE_HOTKEY
|
||||
|
|
@ -1,177 +0,0 @@
|
|||
/*
|
||||
* This config file is for Meizu M6SL
|
||||
*/
|
||||
|
||||
/* For Rolo and boot loader */
|
||||
#define MODEL_NUMBER 38
|
||||
|
||||
#define MODEL_NAME "Meizu M6SL"
|
||||
|
||||
/* define this if you have recording possibility */
|
||||
//#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 can flip your LCD */
|
||||
//#define HAVE_LCD_FLIP
|
||||
|
||||
/* 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 can invert the colours on your LCD */
|
||||
//#define HAVE_LCD_INVERT
|
||||
|
||||
/* define this if you have access to the quickscreen */
|
||||
#define HAVE_QUICKSCREEN
|
||||
|
||||
/* define this if you would like tagcache to build on this target */
|
||||
#define HAVE_TAGCACHE
|
||||
|
||||
/* define this if you have a flash memory storage */
|
||||
#define HAVE_FLASH_STORAGE
|
||||
|
||||
#define CONFIG_STORAGE STORAGE_NAND
|
||||
|
||||
#define CONFIG_NAND NAND_SAMSUNG
|
||||
|
||||
/* The NAND flash has 512-byte sectors, and is our only storage */
|
||||
#define SECTOR_SIZE 512
|
||||
|
||||
/* LCD dimensions */
|
||||
#define LCD_WIDTH 320
|
||||
#define LCD_HEIGHT 240
|
||||
/* sqrt(320^2 + 240^2) / 2.6 = 153.8 */
|
||||
#define LCD_DPI 154
|
||||
#define LCD_DEPTH 16 /* pseudo 262.144 colors */
|
||||
#define LCD_PIXELFORMAT RGB565 /* rgb565 */
|
||||
|
||||
/* 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 CONFIG_KEYPAD MEIZU_M6SL_PAD
|
||||
|
||||
//#define AB_REPEAT_ENABLE
|
||||
//#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
|
||||
|
||||
|
||||
|
||||
|
||||
/* define this if you have a real-time clock */
|
||||
#define CONFIG_RTC RTC_S5L8700
|
||||
//#define CONFIG_RTC RTC_S35390A
|
||||
|
||||
#define CONFIG_LCD LCD_MEIZUM6
|
||||
|
||||
/* Define this if you have the WM8975 audio codec */
|
||||
#define HAVE_WM8751 //FIXME
|
||||
|
||||
/* Define this for LCD backlight available */
|
||||
#define HAVE_BACKLIGHT
|
||||
#define HAVE_BACKLIGHT_BRIGHTNESS
|
||||
|
||||
/* 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
|
||||
|
||||
/* FM Tuner */
|
||||
#define CONFIG_TUNER TEA5760
|
||||
#define CONFIG_TUNER_XTAL 32768
|
||||
|
||||
//#define HAVE_TLV320
|
||||
|
||||
/* TLV320 has no tone controls, so we use the software ones */
|
||||
#define HAVE_SW_TONE_CONTROLS
|
||||
|
||||
#define BATTERY_CAPACITY_DEFAULT 700 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 2250 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
|
||||
|
||||
#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
|
||||
|
||||
/* Hardware controlled charging? FIXME */
|
||||
#define CONFIG_CHARGING CHARGING_SIMPLE
|
||||
|
||||
/* Define this if your LCD can set contrast */
|
||||
//#define HAVE_LCD_CONTRAST
|
||||
|
||||
/* Define this if you have a Motorola SCF5250 */
|
||||
#define CONFIG_CPU S5L8700
|
||||
|
||||
/* Define this if you want to use coldfire's i2c interface */
|
||||
#define CONFIG_I2C I2C_S5L8700
|
||||
|
||||
/* define this if the hardware can be powered off while charging */
|
||||
#define HAVE_POWEROFF_WHILE_CHARGING
|
||||
|
||||
/* The size of the flash ROM */
|
||||
#define FLASH_SIZE 0x400000
|
||||
|
||||
/* Define this to the CPU frequency */
|
||||
#define CPU_FREQ 11289600
|
||||
|
||||
/* Define this if you have ATA power-off control */
|
||||
//#define HAVE_ATA_POWER_OFF
|
||||
|
||||
/* USB On-the-go */
|
||||
//#define CONFIG_USBOTG USBOTG_M5636
|
||||
|
||||
/* Define this if you have adjustable CPU frequency */
|
||||
#define HAVE_ADJUSTABLE_CPU_FREQ
|
||||
|
||||
#define BOOTFILE_EXT "meizu"
|
||||
#define BOOTFILE "rockbox." BOOTFILE_EXT
|
||||
#define BOOTDIR "/.rockbox"
|
||||
|
||||
#define BOOTLOADER_ENTRYPOINT 0x001F0000
|
||||
#define FLASH_ENTRYPOINT 0x00001000
|
||||
#define FLASH_MAGIC 0xfbfbfbf1
|
||||
|
||||
/* Define this for FM radio input available */
|
||||
#define HAVE_FMRADIO_IN
|
||||
|
||||
/** Port-specific settings **/
|
||||
|
||||
/* Main LCD contrast range and defaults */
|
||||
#define MIN_CONTRAST_SETTING 1
|
||||
#define MAX_CONTRAST_SETTING 30
|
||||
#define DEFAULT_CONTRAST_SETTING 19 /* Match boot contrast */
|
||||
|
||||
/* Main LCD backlight brightness range and defaults */
|
||||
/* PCF50506 can output 0%-100% duty cycle but D305A expects %15-100%. */
|
||||
#define MIN_BRIGHTNESS_SETTING 1 /* 15/16 (93.75%) */
|
||||
#define MAX_BRIGHTNESS_SETTING 13 /* 3/16 (18.75%) */
|
||||
#define DEFAULT_BRIGHTNESS_SETTING 8 /* 8/16 (50.00%) = x5 boot default */
|
||||
|
||||
/* Define this if a programmable hotkey is mapped */
|
||||
#define HAVE_HOTKEY
|
||||
|
|
@ -1,183 +0,0 @@
|
|||
/*
|
||||
* This config file is for Meizu M6SP
|
||||
*/
|
||||
|
||||
/* For Rolo and boot loader */
|
||||
#define MODEL_NUMBER 37
|
||||
|
||||
#define MODEL_NAME "Meizu M6SP"
|
||||
|
||||
/* define this if you have recording possibility */
|
||||
//#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)
|
||||
|
||||
/* FIXME: define actual rates applicable for M6SP */
|
||||
#define CODEC_SRCTRL_11025HZ (0x19 << 1)
|
||||
#define CODEC_SRCTRL_22050HZ (0x1b << 1)
|
||||
#define CODEC_SRCTRL_44100HZ (0x11 << 1)
|
||||
#define CODEC_SRCTRL_88200HZ (0x1f << 1)
|
||||
|
||||
/* 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 can flip your LCD */
|
||||
//#define HAVE_LCD_FLIP
|
||||
|
||||
/* 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 can invert the colours on your LCD */
|
||||
//#define HAVE_LCD_INVERT
|
||||
|
||||
/* define this if you have access to the quickscreen */
|
||||
#define HAVE_QUICKSCREEN
|
||||
|
||||
/* define this if you would like tagcache to build on this target */
|
||||
#define HAVE_TAGCACHE
|
||||
|
||||
/* define this if you have a flash memory storage */
|
||||
#define HAVE_FLASH_STORAGE
|
||||
|
||||
#define CONFIG_STORAGE STORAGE_NAND
|
||||
|
||||
#define CONFIG_NAND NAND_SAMSUNG
|
||||
|
||||
/* The NAND flash has 2048-byte sectors, and is our only storage */
|
||||
#define SECTOR_SIZE 2048
|
||||
|
||||
/* LCD dimensions */
|
||||
#define LCD_WIDTH 240
|
||||
#define LCD_HEIGHT 320
|
||||
/* sqrt(240^2 + 320^2) / 2.4 = 166.0 */
|
||||
#define LCD_DPI 166
|
||||
#define LCD_DEPTH 16 /* pseudo 262.144 colors */
|
||||
#define LCD_PIXELFORMAT RGB565 /* rgb565 */
|
||||
|
||||
/* 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 CONFIG_KEYPAD MEIZU_M6SP_PAD
|
||||
|
||||
//#define AB_REPEAT_ENABLE
|
||||
//#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
|
||||
|
||||
|
||||
|
||||
|
||||
/* define this if you have a real-time clock */
|
||||
#define CONFIG_RTC RTC_S5L8700
|
||||
//#define CONFIG_RTC RTC_S35390A
|
||||
|
||||
#define CONFIG_LCD LCD_MEIZUM6
|
||||
|
||||
/* Define this if you have the WM8975 audio codec */
|
||||
#define HAVE_WM8751 //FIXME
|
||||
|
||||
/* Define this for LCD backlight available */
|
||||
#define HAVE_BACKLIGHT
|
||||
#define HAVE_BACKLIGHT_BRIGHTNESS
|
||||
|
||||
/* 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
|
||||
|
||||
/* FM Tuner */
|
||||
#define CONFIG_TUNER TEA5760
|
||||
#define CONFIG_TUNER_XTAL 32768
|
||||
|
||||
//#define HAVE_TLV320
|
||||
|
||||
/* TLV320 has no tone controls, so we use the software ones */
|
||||
#define HAVE_SW_TONE_CONTROLS
|
||||
|
||||
#define BATTERY_CAPACITY_DEFAULT 700 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 2250 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
|
||||
|
||||
#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
|
||||
|
||||
/* Hardware controlled charging? FIXME */
|
||||
#define CONFIG_CHARGING CHARGING_SIMPLE
|
||||
|
||||
/* Define this if your LCD can set contrast */
|
||||
//#define HAVE_LCD_CONTRAST
|
||||
|
||||
/* Define this if you have a Motorola SCF5250 */
|
||||
#define CONFIG_CPU S5L8700
|
||||
|
||||
/* Define this if you want to use coldfire's i2c interface */
|
||||
#define CONFIG_I2C I2C_S5L8700
|
||||
|
||||
/* define this if the hardware can be powered off while charging */
|
||||
#define HAVE_POWEROFF_WHILE_CHARGING
|
||||
|
||||
/* The size of the flash ROM */
|
||||
#define FLASH_SIZE 0x400000
|
||||
|
||||
/* Define this to the CPU frequency */
|
||||
#define CPU_FREQ 11289600
|
||||
|
||||
/* Define this if you have ATA power-off control */
|
||||
//#define HAVE_ATA_POWER_OFF
|
||||
|
||||
/* USB On-the-go */
|
||||
//#define CONFIG_USBOTG USBOTG_M5636
|
||||
|
||||
/* Define this if you have adjustable CPU frequency */
|
||||
#define HAVE_ADJUSTABLE_CPU_FREQ
|
||||
|
||||
#define BOOTFILE_EXT "meizu"
|
||||
#define BOOTFILE "rockbox." BOOTFILE_EXT
|
||||
#define BOOTDIR "/.rockbox"
|
||||
|
||||
#define BOOTLOADER_ENTRYPOINT 0x001F0000
|
||||
#define FLASH_ENTRYPOINT 0x00001000
|
||||
#define FLASH_MAGIC 0xfbfbfbf1
|
||||
|
||||
/* Define this for FM radio input available */
|
||||
#define HAVE_FMRADIO_IN
|
||||
|
||||
/** Port-specific settings **/
|
||||
|
||||
/* Main LCD contrast range and defaults */
|
||||
#define MIN_CONTRAST_SETTING 1
|
||||
#define MAX_CONTRAST_SETTING 30
|
||||
#define DEFAULT_CONTRAST_SETTING 19 /* Match boot contrast */
|
||||
|
||||
/* Main LCD backlight brightness range and defaults */
|
||||
/* PCF50506 can output 0%-100% duty cycle but D305A expects %15-100%. */
|
||||
#define MIN_BRIGHTNESS_SETTING 1 /* 15/16 (93.75%) */
|
||||
#define MAX_BRIGHTNESS_SETTING 13 /* 3/16 (18.75%) */
|
||||
#define DEFAULT_BRIGHTNESS_SETTING 8 /* 8/16 (50.00%) = x5 boot default */
|
||||
|
||||
/* Define this if a programmable hotkey is mapped */
|
||||
//#define HAVE_HOTKEY
|
||||
|
|
@ -1,176 +0,0 @@
|
|||
/*
|
||||
* This config file is for Samsung YP-S3
|
||||
*/
|
||||
|
||||
/* For Rolo and boot loader */
|
||||
#define MODEL_NUMBER 53
|
||||
|
||||
#define MODEL_NAME "Samsumg YP-S3"
|
||||
|
||||
/* define this if you have recording possibility */
|
||||
//#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 can flip your LCD */
|
||||
//#define HAVE_LCD_FLIP
|
||||
|
||||
/* 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 can invert the colours on your LCD */
|
||||
//#define HAVE_LCD_INVERT
|
||||
|
||||
/* define this if you have access to the quickscreen */
|
||||
#define HAVE_QUICKSCREEN
|
||||
|
||||
/* define this if you would like tagcache to build on this target */
|
||||
#define HAVE_TAGCACHE
|
||||
|
||||
/* define this if you have a flash memory storage */
|
||||
#define HAVE_FLASH_STORAGE
|
||||
|
||||
#define CONFIG_STORAGE STORAGE_NAND
|
||||
|
||||
#define CONFIG_NAND NAND_SAMSUNG
|
||||
|
||||
/* LCD dimensions */
|
||||
#define LCD_WIDTH 176
|
||||
#define LCD_HEIGHT 220
|
||||
/* sqrt(176^2 + 220^2) / 1.8 = 156.5 */
|
||||
#define LCD_DPI 157
|
||||
#define LCD_DEPTH 16 /* pseudo 262.144 colors */
|
||||
#define LCD_PIXELFORMAT RGB565 /* rgb565 */
|
||||
|
||||
/* 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
|
||||
|
||||
/* We have button lights */
|
||||
#define HAVE_BUTTON_LIGHT
|
||||
|
||||
#define CONFIG_KEYPAD MEIZU_M3_PAD
|
||||
|
||||
/* We have headphone detection */
|
||||
#define HAVE_HEADPHONE_DETECTION
|
||||
|
||||
//#define AB_REPEAT_ENABLE
|
||||
//#define ACTION_WPSAB_SINGLE ACTION_WPS_BROWSE
|
||||
|
||||
|
||||
|
||||
|
||||
/* define this if you have a real-time clock */
|
||||
#define CONFIG_RTC RTC_S35390A
|
||||
|
||||
/* Define the type of audio codec */
|
||||
//#define HAVE_WM....
|
||||
|
||||
/* Define this for LCD backlight available */
|
||||
#define HAVE_BACKLIGHT
|
||||
#define HAVE_BACKLIGHT_BRIGHTNESS
|
||||
|
||||
/* 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
|
||||
|
||||
/* FM Tuner */
|
||||
#define CONFIG_TUNER SI4700
|
||||
#define CONFIG_TUNER_XTAL 32768
|
||||
|
||||
/* assume no tone controls, so we use the software ones */
|
||||
#define HAVE_SW_TONE_CONTROLS
|
||||
|
||||
#define BATTERY_CAPACITY_DEFAULT 580 /* default battery capacity */
|
||||
#define BATTERY_CAPACITY_MIN 580 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 580 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
|
||||
|
||||
|
||||
#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
|
||||
|
||||
/* Hardware controlled charging, software can monitor plug and charge state */
|
||||
#define CONFIG_CHARGING CHARGING_MONITOR
|
||||
|
||||
/* Define this if your LCD can set contrast */
|
||||
//#define HAVE_LCD_CONTRAST
|
||||
|
||||
/* We have a Samsung S5L8700 */
|
||||
#define CONFIG_CPU S5L8700
|
||||
|
||||
/* We use the S5L8700 i2c interface */
|
||||
#define CONFIG_I2C I2C_S5L8700
|
||||
|
||||
/* define this if the hardware can be powered off while charging */
|
||||
//#define HAVE_POWEROFF_WHILE_CHARGING
|
||||
|
||||
/* The size of the flash ROM */
|
||||
#define FLASH_SIZE 0x400000
|
||||
|
||||
/* Define this to the CPU frequency */
|
||||
#define CPU_FREQ 200000000
|
||||
|
||||
/* Define this if you have ATA power-off control */
|
||||
//#define HAVE_ATA_POWER_OFF
|
||||
|
||||
/* USB */
|
||||
//#define HAVE_USBSTACK
|
||||
#define USB_VENDOR_ID 0x04E8
|
||||
#define USB_PRODUCT_ID 0x5090
|
||||
|
||||
/* Define this if you have adjustable CPU frequency */
|
||||
#define HAVE_ADJUSTABLE_CPU_FREQ
|
||||
|
||||
#define BOOTFILE_EXT "yps3"
|
||||
#define BOOTFILE "rockbox." BOOTFILE_EXT
|
||||
#define BOOTDIR "/.rockbox"
|
||||
|
||||
//#define BOOTLOADER_ENTRYPOINT 0x001F0000
|
||||
//#define FLASH_ENTRYPOINT 0x00001000
|
||||
//#define FLASH_MAGIC 0xfbfbfbf1
|
||||
|
||||
/* Define this for FM radio input available */
|
||||
#define HAVE_FMRADIO_IN
|
||||
|
||||
/** Port-specific settings **/
|
||||
|
||||
/* Main LCD contrast range and defaults */
|
||||
#define MIN_CONTRAST_SETTING 1
|
||||
#define MAX_CONTRAST_SETTING 30
|
||||
#define DEFAULT_CONTRAST_SETTING 19 /* Match boot contrast */
|
||||
|
||||
/* Main LCD backlight brightness range and defaults */
|
||||
#define MIN_BRIGHTNESS_SETTING 0
|
||||
#define MAX_BRIGHTNESS_SETTING 15
|
||||
#define DEFAULT_BRIGHTNESS_SETTING 10
|
||||
|
||||
/* Define this if a programmable hotkey is mapped */
|
||||
#define HAVE_HOTKEY
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 by Bertrik Sikken
|
||||
*
|
||||
* 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 "cpu.h"
|
||||
#include "audio.h"
|
||||
#include "audiohw.h"
|
||||
#include "sound.h"
|
||||
|
||||
int audio_channels = 2;
|
||||
int audio_output_source = AUDIO_SRC_PLAYBACK;
|
||||
|
||||
void audio_set_output_source(int source)
|
||||
{
|
||||
if ((unsigned)source >= AUDIO_NUM_SOURCES)
|
||||
source = AUDIO_SRC_PLAYBACK;
|
||||
|
||||
audio_output_source = source;
|
||||
} /* audio_set_output_source */
|
||||
|
||||
void audio_input_mux(int source, unsigned flags)
|
||||
{
|
||||
static int last_source = AUDIO_SRC_PLAYBACK;
|
||||
|
||||
(void)flags;
|
||||
|
||||
switch (source)
|
||||
{
|
||||
default: /* playback - no recording */
|
||||
source = AUDIO_SRC_PLAYBACK;
|
||||
case AUDIO_SRC_PLAYBACK:
|
||||
audio_channels = 2;
|
||||
if (source != last_source)
|
||||
{
|
||||
// audiohw_set_monitor(false);
|
||||
}
|
||||
break;
|
||||
|
||||
case AUDIO_SRC_FMRADIO: /* recording and playback */
|
||||
audio_channels = 2;
|
||||
if (source == last_source)
|
||||
break;
|
||||
|
||||
// audiohw_set_monitor(true);
|
||||
break;
|
||||
} /* end switch */
|
||||
|
||||
last_source = source;
|
||||
} /* audio_input_mux */
|
||||
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 by Bertrik Sikken
|
||||
*
|
||||
* 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 <stdbool.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "backlight.h"
|
||||
#include "backlight-target.h"
|
||||
#include "system.h"
|
||||
|
||||
/*
|
||||
Backlight driver using the PWM mode of a hardware timer.
|
||||
|
||||
The PWM duty cycle depends exponentially on the configured brightness
|
||||
level. This makes the brightness curve more linear to the human eye.
|
||||
*/
|
||||
|
||||
void backlight_hw_brightness(int brightness)
|
||||
{
|
||||
/* pwm = round(sqrt(2)**x), where brightness level x = 1..16 */
|
||||
static const unsigned int logtable[] =
|
||||
{1, 2, 3, 4, 6, 8, 11, 16, 23, 32, 45, 64, 91, 128, 181, 256};
|
||||
|
||||
/* set PWM width */
|
||||
TCDATA0 = logtable[brightness];
|
||||
}
|
||||
|
||||
void backlight_hw_on(void)
|
||||
{
|
||||
/* configure backlight pin P0.2 as timer PWM output */
|
||||
PCON0 = ((PCON0 & ~(3 << 4)) | (2 << 4));
|
||||
backlight_hw_brightness(backlight_brightness);
|
||||
}
|
||||
|
||||
void backlight_hw_off(void)
|
||||
{
|
||||
/* configure backlight pin P0.2 as GPIO and switch off */
|
||||
PCON0 = ((PCON0 & ~(3 << 4)) | (1 << 4));
|
||||
PDAT0 &= ~(1 << 2);
|
||||
}
|
||||
|
||||
bool backlight_hw_init(void)
|
||||
{
|
||||
/* enable timer clock */
|
||||
PWRCON &= ~(1 << 4);
|
||||
|
||||
/* configure timer */
|
||||
TCCMD = (1 << 1); /* TC_CLR */
|
||||
TCCON = (0 << 13) | /* TC_INT1_EN */
|
||||
(0 << 12) | /* TC_INT0_EN */
|
||||
(1 << 11) | /* TC_START */
|
||||
(3 << 8) | /* TC_CS = PCLK / 64 */
|
||||
(1 << 4); /* TC_MODE_SEL = PWM mode */
|
||||
TCDATA1 = 256; /* set PWM period */
|
||||
TCPRE = 20; /* prescaler */
|
||||
TCCMD = (1 << 0); /* TC_EN */
|
||||
|
||||
backlight_hw_on();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -24,11 +24,7 @@ STARTUP(target/arm/s5l8700/crt0.o)
|
|||
#define IRAMSIZE 256K
|
||||
#endif
|
||||
|
||||
#ifdef MEIZU_M6SL
|
||||
#define DFULOADADDR IRAMORIG
|
||||
#else
|
||||
#define DFULOADADDR (IRAMORIG+0x20000)
|
||||
#endif
|
||||
|
||||
/* This is not available in all versions of the S5L8700 */
|
||||
#define FLASHORIG 0x24000000
|
||||
|
|
@ -41,7 +37,7 @@ MEMORY
|
|||
FLASH : ORIGIN = FLASHORIG, LENGTH = FLASHSIZE
|
||||
}
|
||||
|
||||
#if defined(IPOD_NANO2G) || defined(MEIZU_M6SL)
|
||||
#if defined(IPOD_NANO2G)
|
||||
#define LOAD_AREA IRAM
|
||||
#else
|
||||
#define NEEDS_INTVECT_COPYING
|
||||
|
|
|
|||
|
|
@ -22,28 +22,6 @@
|
|||
#include "config.h"
|
||||
#include "cpu.h"
|
||||
|
||||
/* Meizu M3 SDRAM settings */
|
||||
#ifdef MEIZU_M3
|
||||
#define SDR_DSS_SEL_B 1
|
||||
#define SDR_DSS_SEL_O 1
|
||||
#define SDR_DSS_SEL_C 1
|
||||
#define SDR_TIMING 0x6A491D
|
||||
#define SDR_CONFIG 0x900
|
||||
#define SDR_MRS 0x37
|
||||
#define SDR_EMRS 0x4000
|
||||
#endif
|
||||
|
||||
/* Meizu M6SP SDRAM settings */
|
||||
#ifdef MEIZU_M6SP
|
||||
#define SDR_DSS_SEL_B 5
|
||||
#define SDR_DSS_SEL_O 2
|
||||
#define SDR_DSS_SEL_C 2
|
||||
#define SDR_TIMING 0x6A4965
|
||||
#define SDR_CONFIG 0x700
|
||||
#define SDR_MRS 0x33
|
||||
#define SDR_EMRS 0x4033
|
||||
#endif
|
||||
|
||||
.section .intvect,"ax",%progbits
|
||||
.global start
|
||||
.global _newstart
|
||||
|
|
@ -276,68 +254,6 @@ start_loc:
|
|||
mov r0, #0 // 0x0
|
||||
str r0, [r1, #44] // do not enter any power saving mode
|
||||
|
||||
#if defined(MEIZU_M6SP) || defined(MEIZU_M3)
|
||||
/* setup SDRAM for Meizu M6SP */
|
||||
ldr r1, =0x38200000
|
||||
// configure SDR drive strength and pad settings
|
||||
mov r0, #SDR_DSS_SEL_B
|
||||
str r0, [r1, #0x4C] // MIU_DSS_SEL_B
|
||||
mov r0, #SDR_DSS_SEL_O
|
||||
str r0, [r1, #0x50] // MIU_DSS_SEL_O
|
||||
mov r0, #SDR_DSS_SEL_C
|
||||
str r0, [r1, #0x54] // MIU_DSS_SEL_C
|
||||
mov r0, #2
|
||||
str r0, [r1, #0x60] // SSTL2_PAD_ON
|
||||
// select SDR mode
|
||||
ldr r0, [r1, #0x40]
|
||||
mov r2, #0xFFFDFFFF
|
||||
and r0, r0, r2
|
||||
orr r0, r0, #1
|
||||
str r0, [r1, #0x40] // MIUORG
|
||||
// set controller configuration
|
||||
mov r0, #SDR_CONFIG
|
||||
str r0, [r1] // MIUCON
|
||||
// set SDRAM timing
|
||||
ldr r0, =SDR_TIMING
|
||||
str r0, [r1, #0x10] // MIUSDPARA
|
||||
// set refresh rate
|
||||
mov r0, #0x1080
|
||||
str r0, [r1, #0x08] // MIUAREF
|
||||
// initialise SDRAM
|
||||
mov r0, #0x003
|
||||
str r0, [r1, #0x04] // MIUCOM = nop
|
||||
ldr r0, =0x203
|
||||
str r0, [r1, #0x04] // MIUCOM = precharge all banks
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
ldr r0, =0x303
|
||||
str r0, [r1, #0x04] // MIUCOM = auto-refresh
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
str r0, [r1, #0x04] // MIUCOM = auto-refresh
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
str r0, [r1, #0x04] // MIUCOM = auto-refresh
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
// set mode register
|
||||
mov r0, #SDR_MRS
|
||||
str r0, [r1, #0x0C] // MIUMRS
|
||||
ldr r0, =0x103
|
||||
str r0, [r1, #0x04] // MIUCOM = mode register set
|
||||
ldr r0, =SDR_EMRS
|
||||
str r0, [r1, #0x0C] // MIUMRS
|
||||
ldr r0, =0x103
|
||||
str r0, [r1, #0x04] // MIUCOM = mode register set
|
||||
#endif /* MEIZU_M6SP */
|
||||
|
||||
mov r1, #0x1
|
||||
mrc 15, 0, r0, c1, c0, 0
|
||||
bic r0, r0, r1
|
||||
|
|
|
|||
|
|
@ -1,146 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 by Bertrik Sikken
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
FM radio i2c interface, allows the radio driver to talk to the tuner chip.
|
||||
|
||||
It is implemented using the generic i2c driver, which does "bit-banged"
|
||||
I2C with a couple of GPIO pins.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "inttypes.h"
|
||||
#include "s5l87xx.h"
|
||||
#include "generic_i2c.h"
|
||||
#include "fmradio_i2c.h"
|
||||
|
||||
#define I2C_GPIO PDAT3
|
||||
#define I2C_GPIO_DIR PCON3
|
||||
#define I2C_SCL_PIN 4
|
||||
#define I2C_SDA_PIN 2
|
||||
|
||||
#define SCL_DIR_MASK (0xF<<(4*I2C_SCL_PIN))
|
||||
#define SCL_DIR_OUT (1<<(4*I2C_SCL_PIN))
|
||||
#define SCL_DIR_IN 0
|
||||
#define SDA_DIR_MASK (0xF<<(4*I2C_SDA_PIN))
|
||||
#define SDA_DIR_OUT (1<<(4*I2C_SDA_PIN))
|
||||
#define SDA_DIR_IN 0
|
||||
|
||||
static int fm_i2c_bus;
|
||||
|
||||
static void fm_scl_hi(void)
|
||||
{
|
||||
I2C_GPIO |= 1 << I2C_SCL_PIN;
|
||||
}
|
||||
|
||||
static void fm_scl_lo(void)
|
||||
{
|
||||
I2C_GPIO &= ~(1 << I2C_SCL_PIN);
|
||||
}
|
||||
|
||||
static void fm_sda_hi(void)
|
||||
{
|
||||
I2C_GPIO |= 1 << I2C_SDA_PIN;
|
||||
}
|
||||
|
||||
static void fm_sda_lo(void)
|
||||
{
|
||||
I2C_GPIO &= ~(1 << I2C_SDA_PIN);
|
||||
}
|
||||
|
||||
static void fm_sda_input(void)
|
||||
{
|
||||
I2C_GPIO_DIR = (I2C_GPIO_DIR & ~SDA_DIR_MASK) | SDA_DIR_IN;
|
||||
}
|
||||
|
||||
static void fm_sda_output(void)
|
||||
{
|
||||
I2C_GPIO_DIR = (I2C_GPIO_DIR & ~SDA_DIR_MASK) | SDA_DIR_OUT;
|
||||
}
|
||||
|
||||
static void fm_scl_input(void)
|
||||
{
|
||||
I2C_GPIO_DIR = (I2C_GPIO_DIR & ~SCL_DIR_MASK) | SCL_DIR_IN;
|
||||
}
|
||||
|
||||
static void fm_scl_output(void)
|
||||
{
|
||||
I2C_GPIO_DIR = (I2C_GPIO_DIR & ~SCL_DIR_MASK) | SCL_DIR_OUT;
|
||||
}
|
||||
|
||||
static int fm_sda(void)
|
||||
{
|
||||
return (I2C_GPIO & (1 << I2C_SDA_PIN));
|
||||
}
|
||||
|
||||
static int fm_scl(void)
|
||||
{
|
||||
return (I2C_GPIO & (1 << I2C_SCL_PIN));
|
||||
}
|
||||
|
||||
/* simple and crude delay, used for all delays in the generic i2c driver */
|
||||
static void fm_delay(void)
|
||||
{
|
||||
volatile int i;
|
||||
|
||||
/* this loop is uncalibrated and could use more sophistication */
|
||||
for (i = 0; i < 20; i++) {
|
||||
}
|
||||
}
|
||||
|
||||
/* interface towards the generic i2c driver */
|
||||
static const struct i2c_interface fm_i2c_interface = {
|
||||
.scl_hi = fm_scl_hi,
|
||||
.scl_lo = fm_scl_lo,
|
||||
.sda_hi = fm_sda_hi,
|
||||
.sda_lo = fm_sda_lo,
|
||||
.sda_input = fm_sda_input,
|
||||
.sda_output = fm_sda_output,
|
||||
.scl_input = fm_scl_input,
|
||||
.scl_output = fm_scl_output,
|
||||
.scl = fm_scl,
|
||||
.sda = fm_sda,
|
||||
|
||||
.delay_hd_sta = fm_delay,
|
||||
.delay_hd_dat = fm_delay,
|
||||
.delay_su_dat = fm_delay,
|
||||
.delay_su_sto = fm_delay,
|
||||
.delay_su_sta = fm_delay,
|
||||
.delay_thigh = fm_delay
|
||||
};
|
||||
|
||||
/* initialise i2c for fmradio */
|
||||
void fmradio_i2c_init(void)
|
||||
{
|
||||
fm_i2c_bus = i2c_add_node(&fm_i2c_interface);
|
||||
}
|
||||
|
||||
int fmradio_i2c_write(unsigned char address, const unsigned char* buf, int count)
|
||||
{
|
||||
return i2c_write_data(fm_i2c_bus, address, -1, buf, count);
|
||||
}
|
||||
|
||||
int fmradio_i2c_read(unsigned char address, unsigned char* buf, int count)
|
||||
{
|
||||
return i2c_read_data(fm_i2c_bus, address, -1, buf, count);
|
||||
}
|
||||
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2010 by Bertrik Sikken
|
||||
*
|
||||
* 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 "ftl-target.h"
|
||||
|
||||
uint32_t ftl_init(void)
|
||||
{
|
||||
/* TODO implement */
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t ftl_read(uint32_t sector, uint32_t count, void* buffer)
|
||||
{
|
||||
/* TODO implement */
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t ftl_write(uint32_t sector, uint32_t count, const void* buffer)
|
||||
{
|
||||
/* TODO implement */
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t ftl_sync(void)
|
||||
{
|
||||
/* TODO implement */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 Bertrik Sikken
|
||||
*
|
||||
* 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 <stdbool.h>
|
||||
#include "config.h"
|
||||
|
||||
#include "inttypes.h"
|
||||
#include "s5l87xx.h"
|
||||
#include "button-target.h"
|
||||
|
||||
/* Button driver for the meizu M3
|
||||
|
||||
TODO: implement buttons based on on touch strip events, for example
|
||||
short touch (select), slide up and down, touching the <> button, etc.
|
||||
*/
|
||||
|
||||
|
||||
void button_init_device(void)
|
||||
{
|
||||
PCON0 &= ~(3 << 10); /* P0.5 hold switch */
|
||||
PCON1 &= ~(0xF << 0); /* P1.0 menu button */
|
||||
PCON1 &= ~(0xF << 16); /* P1.4 play button */
|
||||
PCON3 &= ~(0xF << 12); /* P3.3 <> button */
|
||||
}
|
||||
|
||||
int button_read_device(void)
|
||||
{
|
||||
int buttons = 0;
|
||||
|
||||
if (button_hold()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((PDAT1 & (1 << 0)) == 0) {
|
||||
buttons |= BUTTON_MENU;
|
||||
}
|
||||
if ((PDAT1 & (1 << 4)) == 0) {
|
||||
buttons |= BUTTON_PLAY;
|
||||
}
|
||||
if ((PDAT3 & (1 << 3)) == 0) {
|
||||
buttons |= BUTTON_PREVNEXT;
|
||||
}
|
||||
|
||||
return buttons;
|
||||
}
|
||||
|
||||
bool button_hold(void)
|
||||
{
|
||||
return ((PDAT0 & (1 << 5)) != 0);
|
||||
}
|
||||
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006 by Linus Nielsen Feltzing
|
||||
*
|
||||
* 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_
|
||||
|
||||
#define HAS_BUTTON_HOLD
|
||||
|
||||
/* Meizu M3 specific button codes */
|
||||
#define BUTTON_PREVNEXT 0x00000001
|
||||
#define BUTTON_MENU 0x00000002
|
||||
#define BUTTON_PLAY 0x00000004
|
||||
|
||||
#define BUTTON_MAIN (BUTTON_PREVNEXT|BUTTON_MENU|BUTTON_PLAY)
|
||||
|
||||
#define POWEROFF_BUTTON BUTTON_PLAY
|
||||
#define POWEROFF_COUNT 10
|
||||
|
||||
#endif /* _BUTTON_TARGET_H_ */
|
||||
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 by Michael Sparmann
|
||||
*
|
||||
* 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 __FTL_TARGET_H__
|
||||
#define __FTL_TARGET_H__
|
||||
|
||||
#include "config.h"
|
||||
#include "inttypes.h"
|
||||
|
||||
#ifdef BOOTLOADER
|
||||
/* Bootloaders don't need write access */
|
||||
#define FTL_READONLY
|
||||
#endif
|
||||
|
||||
/* Pointer to an info structure regarding the flash type used */
|
||||
const struct nand_device_info_type* ftl_nand_type;
|
||||
|
||||
/* Number of banks we detected a chip on */
|
||||
uint32_t ftl_banks;
|
||||
|
||||
uint32_t ftl_init(void);
|
||||
uint32_t ftl_read(uint32_t sector, uint32_t count, void* buffer);
|
||||
uint32_t ftl_write(uint32_t sector, uint32_t count, const void* buffer);
|
||||
uint32_t ftl_sync(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,321 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2008 by Denes Balatoni
|
||||
*
|
||||
* 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 "hwcompat.h"
|
||||
#include "kernel.h"
|
||||
#include "lcd.h"
|
||||
#include "system.h"
|
||||
#include "cpu.h"
|
||||
#include "inttypes.h"
|
||||
#include "s5l87xx.h"
|
||||
|
||||
/*** definitions ***/
|
||||
#define STAT_BUS_IDLE (1<<8) /* Data bus idle */
|
||||
#define STAT_FULL (1<<4) /* FIFO full */
|
||||
#define STAT_READON (1<<0) /* Read operation done */
|
||||
|
||||
/** globals **/
|
||||
static uint8_t lcd_type;
|
||||
static int xoffset; /* needed for flip */
|
||||
|
||||
/*** hardware configuration ***/
|
||||
|
||||
int lcd_default_contrast(void)
|
||||
{
|
||||
return 0x1f;
|
||||
}
|
||||
|
||||
void lcd_set_contrast(int val)
|
||||
{
|
||||
}
|
||||
|
||||
void lcd_set_invert_display(bool yesno)
|
||||
{
|
||||
}
|
||||
|
||||
/* turn the display upside down (call lcd_update() afterwards) */
|
||||
void lcd_set_flip(bool yesno)
|
||||
{
|
||||
/* TODO: flip mode isn't working. The commands in the else part of
|
||||
this function are how the original firmware inits the LCD */
|
||||
|
||||
if (yesno)
|
||||
{
|
||||
xoffset = 132 - LCD_WIDTH; /* 132 colums minus the 128 we have */
|
||||
}
|
||||
else
|
||||
{
|
||||
xoffset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void lcd_sleep(uint32_t t)
|
||||
{
|
||||
volatile uint32_t i;
|
||||
for(i=0;i<t;++i);
|
||||
}
|
||||
|
||||
static uint8_t lcd_readdata(void)
|
||||
{
|
||||
LCD_RDATA = 0;
|
||||
lcd_sleep(64);
|
||||
return (LCD_DBUFF/* & 0xff*/);
|
||||
}
|
||||
|
||||
static void lcd_writereg(uint32_t reg, uint32_t data)
|
||||
{
|
||||
while (LCD_STATUS & STAT_FULL);
|
||||
LCD_WCMD = reg >> 8;
|
||||
while (LCD_STATUS & STAT_FULL);
|
||||
LCD_WCMD = reg & 0xff;
|
||||
while (LCD_STATUS & STAT_FULL);
|
||||
LCD_WDATA = data >> 8;
|
||||
while (LCD_STATUS & STAT_FULL);
|
||||
LCD_WDATA = data & 0xff;
|
||||
}
|
||||
|
||||
void lcd_on(void) {
|
||||
if (lcd_type == 1) {
|
||||
LCD_WCMD = 0x29;
|
||||
} else {
|
||||
lcd_writereg(0x7, 0x21);
|
||||
lcd_writereg(0x12, 0x137);
|
||||
lcd_sleep(70000);
|
||||
lcd_writereg(0x7, 0x21);
|
||||
lcd_writereg(0x12, 0x1137);
|
||||
lcd_sleep(700000);
|
||||
lcd_writereg(0x7, 0x233);
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_off(void) {
|
||||
/* FIXME wait for DMA to finnish */
|
||||
if (lcd_type == 1) {
|
||||
LCD_WCMD = 0x28;
|
||||
LCD_WDATA = 0;
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* LCD init */
|
||||
void lcd_init_device(void)
|
||||
{
|
||||
uint8_t data[5];
|
||||
int i;
|
||||
|
||||
/* init basic things */
|
||||
PWRCON &= ~0x800;
|
||||
PCON_ASRAM = 0x2;
|
||||
PCON7 = 0x12222233;
|
||||
|
||||
LCD_CON = 0xca0;
|
||||
LCD_PHTIME = 0;
|
||||
LCD_INTCON = 0;
|
||||
LCD_RST_TIME = 0x7ff;
|
||||
|
||||
/* detect lcd type, it's not detected the first time for some reason */
|
||||
for(i=0;i<3;++i) {
|
||||
LCD_WCMD = 0x1;
|
||||
lcd_sleep(166670);
|
||||
LCD_WCMD = 0x11;
|
||||
lcd_sleep(2000040);
|
||||
lcd_readdata();
|
||||
LCD_WCMD = 0x4;
|
||||
lcd_sleep(100);
|
||||
data[0]=lcd_readdata();
|
||||
data[1]=lcd_readdata();
|
||||
data[2]=lcd_readdata();
|
||||
data[3]=lcd_readdata();
|
||||
data[4]=lcd_readdata();
|
||||
|
||||
lcd_type=0;
|
||||
if (((data[1]==0x38) && ((data[2] & 0xf0) == 0x80)) ||
|
||||
((data[2]==0x38) && ((data[3] & 0xf0) == 0x80)))
|
||||
lcd_type=1;
|
||||
}
|
||||
/* init lcd */
|
||||
if (lcd_type == 1) {
|
||||
LCD_WCMD = 0x3a;
|
||||
LCD_WDATA = 0x6;
|
||||
LCD_WCMD = 0xab;
|
||||
LCD_WCMD = 0x35;
|
||||
LCD_WDATA = 0;
|
||||
LCD_WCMD=0x13;
|
||||
LCD_WCMD = 0x2a;
|
||||
LCD_WDATA = 0;
|
||||
LCD_WDATA = 0;
|
||||
LCD_WCMD = 0x2b;
|
||||
LCD_WDATA = 0;
|
||||
LCD_WDATA = 0;
|
||||
LCD_WCMD = 0x29;
|
||||
} else {
|
||||
LCD_WCMD = 0x0;
|
||||
LCD_WCMD = 0x0;
|
||||
LCD_WCMD = 0x0;
|
||||
LCD_WCMD = 0x0;
|
||||
lcd_sleep(700000);
|
||||
lcd_writereg(0xa4, 0x1);
|
||||
lcd_sleep(1100000);
|
||||
lcd_writereg(0x1, 0x100);
|
||||
lcd_writereg(0x2, 0x300);
|
||||
lcd_writereg(0x3, 0x9230);
|
||||
lcd_writereg(0x8, 0x404);
|
||||
lcd_writereg(0xe, 0x10);
|
||||
lcd_writereg(0x70, 0x1000);
|
||||
lcd_writereg(0x71, 0x1);
|
||||
lcd_writereg(0x30, 0x2);
|
||||
lcd_writereg(0x31, 0x400);
|
||||
lcd_writereg(0x32, 0x7);
|
||||
lcd_writereg(0x33, 0x500);
|
||||
lcd_writereg(0x34, 0x7);
|
||||
lcd_writereg(0x35, 0x703);
|
||||
lcd_writereg(0x36, 0x507);
|
||||
lcd_writereg(0x37, 0x5);
|
||||
lcd_writereg(0x38, 0x1404);
|
||||
lcd_writereg(0x39, 0xe);
|
||||
lcd_writereg(0x40, 0x202);
|
||||
lcd_writereg(0x41, 0x3);
|
||||
lcd_writereg(0x42, 0x0);
|
||||
lcd_writereg(0x43, 0x200);
|
||||
lcd_writereg(0x44, 0x707);
|
||||
lcd_writereg(0x45, 0x407);
|
||||
lcd_writereg(0x46, 0x505);
|
||||
lcd_writereg(0x47, 0x2);
|
||||
lcd_writereg(0x48, 0x4);
|
||||
lcd_writereg(0x49, 0x4);
|
||||
lcd_writereg(0x60, 0x202);
|
||||
lcd_writereg(0x61, 0x3);
|
||||
lcd_writereg(0x62, 0x0);
|
||||
lcd_writereg(0x63, 0x200);
|
||||
lcd_writereg(0x64, 0x707);
|
||||
lcd_writereg(0x65, 0x407);
|
||||
lcd_writereg(0x66, 0x505);
|
||||
lcd_writereg(0x67, 0x2);
|
||||
lcd_writereg(0x68, 0x4);
|
||||
lcd_writereg(0x69, 0x4);
|
||||
lcd_writereg(0x7, 0x1);
|
||||
lcd_writereg(0x18, 0x1);
|
||||
lcd_writereg(0x10, 0x1690);
|
||||
lcd_writereg(0x11, 0x100);
|
||||
lcd_writereg(0x12, 0x117);
|
||||
lcd_writereg(0x13, 0xf80);
|
||||
lcd_writereg(0x12, 0x137);
|
||||
lcd_writereg(0x20, 0x0);
|
||||
lcd_writereg(0x21, 0x0);
|
||||
lcd_writereg(0x50, 0x0);
|
||||
lcd_writereg(0x51, 0xaf);
|
||||
lcd_writereg(0x52, 0x0);
|
||||
lcd_writereg(0x53, 0x83);
|
||||
lcd_writereg(0x90, 0x0);
|
||||
lcd_writereg(0x91, 0x0);
|
||||
lcd_writereg(0x92, 0x0);
|
||||
lcd_writereg(0x98, 0x0);
|
||||
lcd_writereg(0x99, 0x903);
|
||||
lcd_writereg(0x9a, 0x502);
|
||||
lcd_writereg(0x9b, 0x300);
|
||||
LCD_WCMD = 0x0;
|
||||
LCD_WCMD = 0x22;
|
||||
lcd_sleep(700000);
|
||||
lcd_on();
|
||||
}
|
||||
}
|
||||
|
||||
/*** Update functions ***/
|
||||
|
||||
/* Performance function that works with an external buffer
|
||||
note that by and bheight are in 8-pixel units! */
|
||||
void lcd_blit_mono(const unsigned char *data, int x, int by, int width,
|
||||
int bheight, int stride)
|
||||
{
|
||||
/* Copy display bitmap to hardware */
|
||||
while (bheight--)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Performance function that works with an external buffer
|
||||
note that by and bheight are in 8-pixel units! */
|
||||
void lcd_blit_grey_phase_blit(unsigned char *values, unsigned char *phases,
|
||||
int x, int by, int width, int bheight, int stride)
|
||||
{
|
||||
(void)values;
|
||||
(void)phases;
|
||||
(void)x;
|
||||
(void)by;
|
||||
(void)width;
|
||||
(void)bheight;
|
||||
(void)stride;
|
||||
}
|
||||
|
||||
/* Update the display.
|
||||
This must be called after all other LCD functions that change the display. */
|
||||
void lcd_update(void) ICODE_ATTR;
|
||||
void lcd_update(void)
|
||||
{
|
||||
int i;
|
||||
fb_data *p;
|
||||
|
||||
/* Copy display bitmap to hardware */
|
||||
if (lcd_type == 1) {
|
||||
LCD_WCMD = 0x2a;
|
||||
LCD_WDATA = 0;
|
||||
LCD_WDATA = 0;
|
||||
LCD_WDATA = 0;
|
||||
LCD_WDATA = 0xaf;
|
||||
LCD_WCMD = 0x2b;
|
||||
LCD_WDATA = 0;
|
||||
LCD_WDATA = 0;
|
||||
LCD_WDATA = 0;
|
||||
LCD_WDATA = 0x83;
|
||||
LCD_WCMD = 0x2c;
|
||||
} else {
|
||||
lcd_writereg(0x20, 0x0);
|
||||
lcd_writereg(0x21, 0x0);
|
||||
LCD_WCMD = 0;
|
||||
LCD_WCMD = 0x22;
|
||||
}
|
||||
for(p=FBADDR(0,0), i=0;i<LCD_WIDTH*LCD_FBHEIGHT;++i, ++p) {
|
||||
while (LCD_STATUS & STAT_FULL);
|
||||
LCD_WDATA = RGB_UNPACK_RED(*p);
|
||||
while (LCD_STATUS & STAT_FULL);
|
||||
LCD_WDATA = RGB_UNPACK_GREEN(*p);
|
||||
while (LCD_STATUS & STAT_FULL);
|
||||
LCD_WDATA = RGB_UNPACK_BLUE(*p);
|
||||
}
|
||||
}
|
||||
|
||||
/* Update a fraction of the display. */
|
||||
void lcd_update_rect(int, int, int, int) ICODE_ATTR;
|
||||
void lcd_update_rect(int x, int y, int width, int height)
|
||||
{
|
||||
lcd_update();
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
/* stub */
|
||||
}
|
||||
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 by Michael Sparmann
|
||||
*
|
||||
* 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 __NAND_TARGET_H__
|
||||
#define __NAND_TARGET_H__
|
||||
|
||||
#include "config.h"
|
||||
#include "inttypes.h"
|
||||
|
||||
|
||||
struct nand_device_info_type
|
||||
{
|
||||
uint32_t id;
|
||||
uint16_t blocks;
|
||||
uint16_t userblocks;
|
||||
uint16_t pagesperblock;
|
||||
uint8_t blocksizeexponent;
|
||||
uint8_t tunk1;
|
||||
uint8_t twp;
|
||||
uint8_t tunk2;
|
||||
uint8_t tunk3;
|
||||
} __attribute__((packed));
|
||||
|
||||
uint32_t nand_read_page(uint32_t bank, uint32_t page, void* databuffer,
|
||||
void* sparebuffer, uint32_t doecc,
|
||||
uint32_t checkempty);
|
||||
uint32_t nand_write_page(uint32_t bank, uint32_t page, void* databuffer,
|
||||
void* sparebuffer, uint32_t doecc);
|
||||
uint32_t nand_block_erase(uint32_t bank, uint32_t page);
|
||||
|
||||
const struct nand_device_info_type* nand_get_device_type(uint32_t bank);
|
||||
uint32_t nand_reset(uint32_t bank);
|
||||
uint32_t nand_device_init(void);
|
||||
void nand_set_active(void);
|
||||
long nand_last_activity(void);
|
||||
void nand_power_up(void);
|
||||
void nand_power_down(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2009 Bertrik Sikken
|
||||
*
|
||||
* 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 "adc-target.h"
|
||||
#include "powermgmt.h"
|
||||
|
||||
/* Battery voltage calculation and discharge/charge curves for the Meizu M3.
|
||||
|
||||
Battery voltage is calculated under the assumption that the adc full-scale
|
||||
readout represents 3.00V and that the battery ADC channel is fed with
|
||||
exactly half of the battery voltage (through a resistive divider).
|
||||
Discharge and charge curves have not been calibrated yet.
|
||||
*/
|
||||
|
||||
unsigned short battery_level_disksafe = 3400; /* TODO: this is just an initial guess */
|
||||
|
||||
unsigned short battery_level_shutoff = 3300; /* TODO: this is just an initial guess */
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
|
||||
unsigned short percent_to_volt_discharge[11] =
|
||||
{
|
||||
/* TODO: simple uncalibrated curve, linear except for first 10% */
|
||||
3300, 3600, 3665, 3730, 3795, 3860, 3925, 3990, 4055, 4120, 4185
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
|
||||
unsigned short percent_to_volt_charge[11] =
|
||||
/* TODO: simple uncalibrated curve, linear except for first 10% */
|
||||
{ 3300, 3600, 3665, 3730, 3795, 3860, 3925, 3990, 4055, 4120, 4185 };
|
||||
|
||||
/* full-scale ADC readout (2^10) in millivolt */
|
||||
#define BATTERY_SCALE_FACTOR 6000
|
||||
|
||||
/* Returns battery voltage from ADC [millivolts] */
|
||||
int _battery_voltage(void)
|
||||
{
|
||||
return (adc_read(ADC_BATTERY) * BATTERY_SCALE_FACTOR) >> 10;
|
||||
}
|
||||
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006 by Linus Nielsen Feltzing
|
||||
*
|
||||
* 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_
|
||||
|
||||
#define HAS_BUTTON_HOLD
|
||||
|
||||
/* Toshiba Gigabeat specific button codes */
|
||||
|
||||
#define BUTTON_LEFT 0x00000001
|
||||
#define BUTTON_RIGHT 0x00000002
|
||||
#define BUTTON_UP 0x00000004
|
||||
#define BUTTON_DOWN 0x00000008
|
||||
|
||||
#define BUTTON_SELECT 0x00000010
|
||||
|
||||
#define BUTTON_MENU 0x00000020
|
||||
#define BUTTON_PLAY 0x00000040
|
||||
|
||||
|
||||
#define BUTTON_MAIN (BUTTON_MENU|BUTTON_LEFT|BUTTON_RIGHT\
|
||||
|BUTTON_UP|BUTTON_DOWN|BUTTON_SELECT|BUTTON_PLAY)
|
||||
|
||||
#define POWEROFF_BUTTON BUTTON_PLAY
|
||||
#define POWEROFF_COUNT 10
|
||||
|
||||
#endif /* _BUTTON_TARGET_H_ */
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 by Michael Sparmann
|
||||
*
|
||||
* 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 __FTL_TARGET_H__
|
||||
#define __FTL_TARGET_H__
|
||||
|
||||
#include "config.h"
|
||||
#include "inttypes.h"
|
||||
|
||||
#ifdef BOOTLOADER
|
||||
/* Bootloaders don't need write access */
|
||||
#define FTL_READONLY
|
||||
#endif
|
||||
|
||||
/* Pointer to an info structure regarding the flash type used */
|
||||
const struct nand_device_info_type* ftl_nand_type;
|
||||
|
||||
/* Number of banks we detected a chip on */
|
||||
uint32_t ftl_banks;
|
||||
|
||||
uint32_t ftl_init(void);
|
||||
uint32_t ftl_read(uint32_t sector, uint32_t count, void* buffer);
|
||||
uint32_t ftl_write(uint32_t sector, uint32_t count, const void* buffer);
|
||||
uint32_t ftl_sync(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,321 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2002 by Alan Korr
|
||||
*
|
||||
* 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 "hwcompat.h"
|
||||
#include "kernel.h"
|
||||
#include "lcd.h"
|
||||
#include "system.h"
|
||||
#include "cpu.h"
|
||||
#include "s6d0154.h"
|
||||
|
||||
/*** definitions ***/
|
||||
|
||||
|
||||
#define SPIDELAY(_x) void(_x);
|
||||
|
||||
#define SETMOSI() (PDAT4 |= (1 << 3))
|
||||
#define CLRMOSI() (PDAT4 &= ~(1 << 3))
|
||||
|
||||
#define MISO ((PDAT1 >> 1) & 1)
|
||||
|
||||
#define SETCLK() (PDAT4 |= (1 << 2))
|
||||
#define CLRCLK() (PDAT4 &= ~(1 << 2))
|
||||
|
||||
#define SETSS() (PDAT7 |= (1 << 1))
|
||||
#define CLRSS() (PDAT7 &= ~(1 << 1))
|
||||
|
||||
static unsigned short controller_type = 0;
|
||||
|
||||
void init_lcd_spi(void)
|
||||
{
|
||||
int oldval;
|
||||
|
||||
oldval = PCON1;
|
||||
//Set P1.1 to input
|
||||
PCON1 = ((oldval & ~(0xf << 4)));
|
||||
|
||||
oldval = PCON4;
|
||||
//Set P4.2 and 4.3 to output
|
||||
PCON4 = ((oldval & ~(0xf << 8 | 0xf << 12)) | (1 << 8 | 1 << 12));
|
||||
|
||||
oldval = PCON4;
|
||||
//Set P4.2 and 4.3 to output
|
||||
PCON4 = ((oldval & ~(0xf << 8 | 0xf << 12)) | (1 << 8 | 1 << 12));
|
||||
|
||||
oldval = PCON7;
|
||||
//Set P7.0 and 7.1 to output
|
||||
PCON7 = ((oldval & ~(0xf << 0 | 0xf << 4)) | (1 << 0 | 1 << 4));
|
||||
|
||||
SETSS();
|
||||
SETCLK();
|
||||
}
|
||||
|
||||
static inline void delay(int duration)
|
||||
{
|
||||
volatile int i;
|
||||
for(i=0;i<duration;i++);
|
||||
}
|
||||
|
||||
unsigned int lcd_spi_io(unsigned int output,unsigned int bits,unsigned int inskip)
|
||||
{
|
||||
unsigned int input = 0;
|
||||
unsigned int i;
|
||||
|
||||
//delay(10); // < 470 us
|
||||
|
||||
CLRSS();
|
||||
//delay(13); // > 22 us
|
||||
|
||||
for (i = 0; i < bits+inskip; i++) {
|
||||
|
||||
CLRCLK();
|
||||
|
||||
if(i<bits)
|
||||
{
|
||||
if (output & (1 << (bits-1)))
|
||||
SETMOSI();
|
||||
else
|
||||
CLRMOSI();
|
||||
output <<= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
CLRMOSI();
|
||||
}
|
||||
|
||||
//delay(20); // >> 6.7 us
|
||||
|
||||
SETCLK();
|
||||
|
||||
if(i>=inskip)
|
||||
{
|
||||
input <<= 1;
|
||||
input |= MISO;
|
||||
}
|
||||
|
||||
//delay(20); // >> 6.7 us
|
||||
}
|
||||
|
||||
SETSS();
|
||||
|
||||
return (input);
|
||||
}
|
||||
|
||||
void spi_set_reg(unsigned char reg,unsigned short value)
|
||||
{
|
||||
lcd_spi_io(0x700000|reg,24,0); // possibly 0x74
|
||||
lcd_spi_io(0x720000|value,24,0); // possibly 0x77
|
||||
}
|
||||
|
||||
unsigned int lcd_read_id(void)
|
||||
{
|
||||
unsigned int device_code;
|
||||
lcd_spi_io(0x700000,24,0); // possibly 0x74
|
||||
|
||||
device_code=lcd_spi_io(0x7300,16,24); // possibly 0x77
|
||||
return device_code;
|
||||
}
|
||||
|
||||
/** globals **/
|
||||
|
||||
static int xoffset; /* needed for flip */
|
||||
|
||||
/*** hardware configuration ***/
|
||||
|
||||
int lcd_default_contrast(void)
|
||||
{
|
||||
return 0x1f;
|
||||
}
|
||||
|
||||
void lcd_set_contrast(int val)
|
||||
{
|
||||
}
|
||||
|
||||
void lcd_set_invert_display(bool yesno)
|
||||
{
|
||||
}
|
||||
|
||||
/* turn the display upside down (call lcd_update() afterwards) */
|
||||
void lcd_set_flip(bool yesno)
|
||||
{
|
||||
/* TODO: flip mode isn't working. The commands in the else part of
|
||||
this function are how the original firmware inits the LCD */
|
||||
|
||||
if (yesno)
|
||||
{
|
||||
xoffset = 132 - LCD_WIDTH; /* 132 colums minus the 128 we have */
|
||||
}
|
||||
else
|
||||
{
|
||||
xoffset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void lcd_off(void)
|
||||
{
|
||||
switch(controller_type)
|
||||
{
|
||||
case 0x0154:
|
||||
spi_set_reg(S6D0154_REG_DISPLAY_CONTROL, 0x12);
|
||||
delay(20);
|
||||
spi_set_reg(S6D0154_REG_DISPLAY_CONTROL, 0x00);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_on(void)
|
||||
{
|
||||
switch(controller_type)
|
||||
{
|
||||
case 0x0154:
|
||||
spi_set_reg(S6D0154_REG_DISPLAY_CONTROL, 0x12);
|
||||
delay(20);
|
||||
spi_set_reg(S6D0154_REG_DISPLAY_CONTROL, 0x13);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* LCD init */
|
||||
void lcd_init_device(void)
|
||||
{
|
||||
init_lcd_spi();
|
||||
controller_type = lcd_read_id();
|
||||
switch(controller_type)
|
||||
{
|
||||
case 0x0154:
|
||||
spi_set_reg(S6D0154_REG_EXTERNAL_INTERFACE_CONTROL, 0x130); // RGB interface, RGB interface for PNP mode
|
||||
spi_set_reg(S6D0154_REG_MTP_TEST_KEY, 0x8d); // ??
|
||||
spi_set_reg(0x92, 0x10);
|
||||
/* See also datasheet 11.3 Set up Flow of Generated Power Supply */
|
||||
spi_set_reg(S6D0154_REG_POWER_CONTROL_2, 0x1b); // VC1IEN, 2.76V
|
||||
spi_set_reg(S6D0154_REG_POWER_CONTROL_3, 0x3101);// VGH=6*VCI1, VGL=-4*VCI1, f(DCCLK):f(DCCLK1)=1:0.5, f(DCCLK) : f(DCCLK3)= 1:0.5
|
||||
spi_set_reg(S6D0154_REG_POWER_CONTROL_4, 0x105f);//DCR_EX=1(Use dotclock)
|
||||
spi_set_reg(S6D0154_REG_POWER_CONTROL_5, 0x667f);
|
||||
spi_set_reg(S6D0154_REG_POWER_CONTROL_1, 0x800);
|
||||
delay(20); // >10ms
|
||||
spi_set_reg(S6D0154_REG_POWER_CONTROL_2, 0x11b);
|
||||
delay(20); // >10ms
|
||||
spi_set_reg(S6D0154_REG_POWER_CONTROL_2, 0x31b);
|
||||
delay(20); // >10ms
|
||||
spi_set_reg(S6D0154_REG_POWER_CONTROL_2, 0x71b);
|
||||
delay(20); // >10ms
|
||||
spi_set_reg(S6D0154_REG_POWER_CONTROL_2, 0xf1b);
|
||||
delay(20); // >10ms
|
||||
spi_set_reg(S6D0154_REG_POWER_CONTROL_2, 0xf3b);
|
||||
delay(30); // >30ms
|
||||
spi_set_reg(S6D0154_REG_DRIVER_OUTPUT_CONTROL, 0x2128);
|
||||
spi_set_reg(S6D0154_REG_LCD_DRIVING_WAVEFORM_CONTROL, 0x100);
|
||||
spi_set_reg(S6D0154_REG_ENTRY_MODE, 0x1030);//{DB [17:12], DB [11:6], DB [5:0]} is assigned to {B, G, R}. Horizontal first, auto increment address, write from 0x0000 to 0xdbaf
|
||||
spi_set_reg(S6D0154_REG_DISPLAY_CONTROL, 0); // all off
|
||||
spi_set_reg(S6D0154_REG_BLANK_PERIOD_CONTROL, 0x808);
|
||||
spi_set_reg(S6D0154_REG_FRAME_CYCLE_CONTROL, 0x1100);
|
||||
spi_set_reg(S6D0154_REG_START_OSCILLATION, 0xf01);// Start oscillator, X 1.25
|
||||
spi_set_reg(S6D0154_REG_VCI_RECYCLING, 0);
|
||||
spi_set_reg(S6D0154_REG_GATE_SCAN_POSITION, 0);
|
||||
/* Set things up to write to the entire screen */
|
||||
spi_set_reg(S6D0154_REG_PARTIAL_SCREEN_DRIVING_POSITION_1, 319); // end of partial screen
|
||||
spi_set_reg(S6D0154_REG_PARTIAL_SCREEN_DRIVING_POSITION_2, 0); // start of partial screen
|
||||
spi_set_reg(S6D0154_REG_HORIZONTAL_WINDOW_ADDRESS_1, 239); // end of window
|
||||
spi_set_reg(S6D0154_REG_HORIZONTAL_WINDOW_ADDRESS_2, 0); // start of window
|
||||
spi_set_reg(S6D0154_REG_VERTICAL_WINDOW_ADDRESS_1, 319); // end of window
|
||||
spi_set_reg(S6D0154_REG_VERTICAL_WINDOW_ADDRESS_2, 0); // start of window
|
||||
spi_set_reg(S6D0154_REG_GAMMA_CONTROL_1, 0);
|
||||
spi_set_reg(S6D0154_REG_GAMMA_CONTROL_2, 0xf00);
|
||||
spi_set_reg(S6D0154_REG_GAMMA_CONTROL_3, 0xa03);
|
||||
spi_set_reg(S6D0154_REG_GAMMA_CONTROL_4, 0x300);
|
||||
spi_set_reg(S6D0154_REG_GAMMA_CONTROL_5, 0xc05);
|
||||
spi_set_reg(S6D0154_REG_GAMMA_CONTROL_6, 0xf00);
|
||||
spi_set_reg(S6D0154_REG_GAMMA_CONTROL_7, 0xf00);
|
||||
spi_set_reg(S6D0154_REG_GAMMA_CONTROL_8, 3);
|
||||
spi_set_reg(S6D0154_REG_GAMMA_CONTROL_9, 0x1f07);
|
||||
spi_set_reg(S6D0154_REG_GAMMA_CONTROL_10, 0x71f);
|
||||
delay(20);
|
||||
lcd_on();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*** Update functions ***/
|
||||
|
||||
/* Performance function that works with an external buffer
|
||||
note that by and bheight are in 8-pixel units! */
|
||||
void lcd_blit_mono(const unsigned char *data, int x, int by, int width,
|
||||
int bheight, int stride)
|
||||
{
|
||||
/* Copy display bitmap to hardware */
|
||||
while (bheight--)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Performance function that works with an external buffer
|
||||
note that by and bheight are in 8-pixel units! */
|
||||
void lcd_blit_grey_phase_blit(unsigned char *values, unsigned char *phases,
|
||||
int x, int by, int width, int bheight, int stride)
|
||||
{
|
||||
(void)values;
|
||||
(void)phases;
|
||||
(void)x;
|
||||
(void)by;
|
||||
(void)width;
|
||||
(void)bheight;
|
||||
(void)stride;
|
||||
}
|
||||
|
||||
/* Update the display.
|
||||
This must be called after all other LCD functions that change the display. */
|
||||
void lcd_update(void) ICODE_ATTR;
|
||||
void lcd_update(void)
|
||||
{
|
||||
int y;
|
||||
|
||||
/* Copy display bitmap to hardware */
|
||||
for (y = 0; y < LCD_FBHEIGHT; y++)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/* Update a fraction of the display. */
|
||||
void lcd_update_rect(int, int, int, int) ICODE_ATTR;
|
||||
void lcd_update_rect(int x, int y, int width, int height)
|
||||
{
|
||||
int ymax;
|
||||
|
||||
/* The Y coordinates have to work on even 8 pixel rows */
|
||||
ymax = (y + height-1) >> 3;
|
||||
y >>= 3;
|
||||
|
||||
if(x + width > LCD_WIDTH)
|
||||
width = LCD_WIDTH - x;
|
||||
if (width <= 0)
|
||||
return; /* nothing left to do, 0 is harmful to lcd_write_data() */
|
||||
if(ymax >= LCD_FBHEIGHT)
|
||||
ymax = LCD_FBHEIGHT-1;
|
||||
|
||||
/* Copy specified rectange bitmap to hardware */
|
||||
for (; y <= ymax; y++)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 by Michael Sparmann
|
||||
*
|
||||
* 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 __NAND_TARGET_H__
|
||||
#define __NAND_TARGET_H__
|
||||
|
||||
#include "config.h"
|
||||
#include "inttypes.h"
|
||||
|
||||
|
||||
struct nand_device_info_type
|
||||
{
|
||||
uint32_t id;
|
||||
uint16_t blocks;
|
||||
uint16_t userblocks;
|
||||
uint16_t pagesperblock;
|
||||
uint8_t blocksizeexponent;
|
||||
uint8_t tunk1;
|
||||
uint8_t twp;
|
||||
uint8_t tunk2;
|
||||
uint8_t tunk3;
|
||||
} __attribute__((packed));
|
||||
|
||||
uint32_t nand_read_page(uint32_t bank, uint32_t page, void* databuffer,
|
||||
void* sparebuffer, uint32_t doecc,
|
||||
uint32_t checkempty);
|
||||
uint32_t nand_write_page(uint32_t bank, uint32_t page, void* databuffer,
|
||||
void* sparebuffer, uint32_t doecc);
|
||||
uint32_t nand_block_erase(uint32_t bank, uint32_t page);
|
||||
|
||||
const struct nand_device_info_type* nand_get_device_type(uint32_t bank);
|
||||
uint32_t nand_reset(uint32_t bank);
|
||||
uint32_t nand_device_init(void);
|
||||
void nand_set_active(void);
|
||||
long nand_last_activity(void);
|
||||
void nand_power_up(void);
|
||||
void nand_power_down(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2008 by Frank Gevaerts
|
||||
*
|
||||
* 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 _S6D0154_H_
|
||||
#define _S6D0154_H_
|
||||
|
||||
#define S6D0154_REG_VERSION 0x00
|
||||
#define S6D0154_REG_DRIVER_OUTPUT_CONTROL 0x01
|
||||
#define S6D0154_REG_LCD_DRIVING_WAVEFORM_CONTROL 0x02
|
||||
#define S6D0154_REG_ENTRY_MODE 0x03
|
||||
#define S6D0154_REG_DISPLAY_CONTROL 0x07
|
||||
#define S6D0154_REG_BLANK_PERIOD_CONTROL 0x08
|
||||
#define S6D0154_REG_FRAME_CYCLE_CONTROL 0x0B
|
||||
#define S6D0154_REG_EXTERNAL_INTERFACE_CONTROL 0x0C
|
||||
#define S6D0154_REG_START_OSCILLATION 0x0F
|
||||
#define S6D0154_REG_POWER_CONTROL_1 0x10
|
||||
#define S6D0154_REG_POWER_CONTROL_2 0x11
|
||||
#define S6D0154_REG_POWER_CONTROL_3 0x12
|
||||
#define S6D0154_REG_POWER_CONTROL_4 0x13
|
||||
#define S6D0154_REG_POWER_CONTROL_5 0x14
|
||||
#define S6D0154_REG_VCI_RECYCLING 0x15
|
||||
#define S6D0154_REG_RAM_ADDRESS_REGISTER_1 0x20
|
||||
#define S6D0154_REG_RAM_ADDRESS_REGISTER_2 0x21
|
||||
#define S6D0154_REG_GRAM_READ_WRITE 0x22
|
||||
#define S6D0154_REG_RESET 0x28
|
||||
#define S6D0154_REG_FLM_FUNCTION 0x29
|
||||
#define S6D0154_REG_GATE_SCAN_POSITION 0x30
|
||||
#define S6D0154_REG_VERTICAL_SCROLL_CONTROL_1A 0x31
|
||||
#define S6D0154_REG_VERTICAL_SCROLL_CONTROL_1B 0x32
|
||||
#define S6D0154_REG_VERTICAL_SCROLL_CONTROL_2 0x33
|
||||
#define S6D0154_REG_PARTIAL_SCREEN_DRIVING_POSITION_1 0x34
|
||||
#define S6D0154_REG_PARTIAL_SCREEN_DRIVING_POSITION_2 0x35
|
||||
#define S6D0154_REG_HORIZONTAL_WINDOW_ADDRESS_1 0x36
|
||||
#define S6D0154_REG_HORIZONTAL_WINDOW_ADDRESS_2 0x37
|
||||
#define S6D0154_REG_VERTICAL_WINDOW_ADDRESS_1 0x38
|
||||
#define S6D0154_REG_VERTICAL_WINDOW_ADDRESS_2 0x39
|
||||
#define S6D0154_REG_SUB_PANEL_CONTROL 0x40
|
||||
#define S6D0154_REG_MDDI_LINK_WAKEUP_START_POSITION 0x41
|
||||
#define S6D0154_REG_SUB_PANEL_SELECTION_INDEX 0x42
|
||||
#define S6D0154_REG_SUB_PANEL_DATA_WRITE_INDEX 0x43
|
||||
#define S6D0154_REG_GPIO_VALUE 0x44
|
||||
#define S6D0154_REG_GPIO_IO_CONTROL 0x45
|
||||
#define S6D0154_REG_GPIO_CLEAR 0x46
|
||||
#define S6D0154_REG_GPIO_INTERRUPT_ENABLE 0x47
|
||||
#define S6D0154_REG_GPIO_POLARITY_SELECTION 0x48
|
||||
|
||||
#define S6D0154_REG_GAMMA_CONTROL_1 0x50
|
||||
#define S6D0154_REG_GAMMA_CONTROL_2 0x51
|
||||
#define S6D0154_REG_GAMMA_CONTROL_3 0x52
|
||||
#define S6D0154_REG_GAMMA_CONTROL_4 0x53
|
||||
#define S6D0154_REG_GAMMA_CONTROL_5 0x54
|
||||
#define S6D0154_REG_GAMMA_CONTROL_6 0x55
|
||||
#define S6D0154_REG_GAMMA_CONTROL_7 0x56
|
||||
#define S6D0154_REG_GAMMA_CONTROL_8 0x57
|
||||
#define S6D0154_REG_GAMMA_CONTROL_9 0x58
|
||||
#define S6D0154_REG_GAMMA_CONTROL_10 0x59
|
||||
|
||||
#define S6D0154_REG_MTP_TEST_KEY 0x80
|
||||
#define S6D0154_REG_MTP_CONTROL_REGISTERS 0x81
|
||||
#define S6D0154_REG_MTP_DATA_READ_WRITE 0x82
|
||||
#define S6D0154_REG_PRODUCT_NAME_VERSION_WRITE 0x83
|
||||
|
||||
#endif
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 Bertrik Sikken
|
||||
*
|
||||
* 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 <stdbool.h>
|
||||
#include "config.h"
|
||||
|
||||
#include "inttypes.h"
|
||||
#include "s5l87xx.h"
|
||||
#include "button-target.h"
|
||||
|
||||
/* Button driver for the meizu M6SP
|
||||
|
||||
Future improvements:
|
||||
* touch strip support
|
||||
* left/right buttons (probably read out with ADC0)
|
||||
* unify with m3/m6sl button driver if possible
|
||||
|
||||
*/
|
||||
|
||||
|
||||
void button_init_device(void)
|
||||
{
|
||||
PCON0 &= ~(0x3 << 10); /* P0.5 hold switch */
|
||||
PCON0 &= ~(0x3 << 14); /* P0.7 enter button */
|
||||
PCON1 &= ~(0xF << 16); /* P1.4 play/power button */
|
||||
}
|
||||
|
||||
int button_read_device(void)
|
||||
{
|
||||
int buttons = 0;
|
||||
|
||||
if (button_hold()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((PDAT1 & (1 << 4)) == 0) {
|
||||
buttons |= BUTTON_PLAY;
|
||||
}
|
||||
if ((PDAT0 & (1 << 7)) == 0) {
|
||||
buttons |= BUTTON_ENTER;
|
||||
}
|
||||
|
||||
return buttons;
|
||||
}
|
||||
|
||||
bool button_hold(void)
|
||||
{
|
||||
return ((PDAT0 & (1 << 5)) != 0);
|
||||
}
|
||||
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006 by Linus Nielsen Feltzing
|
||||
*
|
||||
* 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_
|
||||
|
||||
#define HAS_BUTTON_HOLD
|
||||
|
||||
/* Meizu M6 specific button codes */
|
||||
|
||||
#define BUTTON_LEFT 0x00000001
|
||||
#define BUTTON_RIGHT 0x00000002
|
||||
#define BUTTON_PLAY 0x00000004
|
||||
#define BUTTON_MENU 0x00000008
|
||||
#define BUTTON_SELECT 0x00000010 /* TODO: tap on the touch strip */
|
||||
#define BUTTON_ENTER 0x00000020
|
||||
|
||||
|
||||
#define BUTTON_MAIN (BUTTON_LEFT|BUTTON_RIGHT|BUTTON_PLAY|BUTTON_MENU\
|
||||
|BUTTON_SELECT|BUTTON_ENTER)
|
||||
|
||||
#define POWEROFF_BUTTON BUTTON_PLAY
|
||||
#define POWEROFF_COUNT 10
|
||||
|
||||
#endif /* _BUTTON_TARGET_H_ */
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 by Michael Sparmann
|
||||
*
|
||||
* 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 __FTL_TARGET_H__
|
||||
#define __FTL_TARGET_H__
|
||||
|
||||
#include "config.h"
|
||||
#include "inttypes.h"
|
||||
|
||||
#ifdef BOOTLOADER
|
||||
/* Bootloaders don't need write access */
|
||||
#define FTL_READONLY
|
||||
#endif
|
||||
|
||||
/* Pointer to an info structure regarding the flash type used */
|
||||
const struct nand_device_info_type* ftl_nand_type;
|
||||
|
||||
/* Number of banks we detected a chip on */
|
||||
uint32_t ftl_banks;
|
||||
|
||||
uint32_t ftl_init(void);
|
||||
uint32_t ftl_read(uint32_t sector, uint32_t count, void* buffer);
|
||||
uint32_t ftl_write(uint32_t sector, uint32_t count, const void* buffer);
|
||||
uint32_t ftl_sync(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,494 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 Bertrik Sikken
|
||||
*
|
||||
* 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 <inttypes.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "s5l87xx.h"
|
||||
#include "lcd.h"
|
||||
|
||||
/* LCD driver for the Meizu M6 SP using the CLCD controller in the S5L8700
|
||||
|
||||
The Meizu M6 SP can have two different LCDs, the S6D0139 and another
|
||||
(yet unknown) type, the exact type is detected at run-time.
|
||||
|
||||
Open issues:
|
||||
* LCD is currently in portrait mode instead of landscape mode
|
||||
* This LCD driver accesses the Rockbox framebuffer directly, so any changes
|
||||
to the framebuffer as shown directly even before lcd_update is called.
|
||||
* Sometimes part of the top of the screen appears at the bottom
|
||||
* The Meizu seems to hang after LCD initialisation
|
||||
* The driver for the S6D0139 LCD has not been tested yet
|
||||
|
||||
*/
|
||||
|
||||
/* LCD SPI connections */
|
||||
#define LCD_SPI_SSn (1<<1) /* on PDAT7 */
|
||||
#define LCD_SPI_MISO (1<<2) /* on PDAT3 */
|
||||
#define LCD_SPI_MOSI (1<<6) /* on PDAT3 */
|
||||
#define LCD_SPI_SCLK (1<<7) /* on PDAT3 */
|
||||
|
||||
/* LCD SPI communication definitions */
|
||||
#define LCD_SPI_DEVICE_ID (0x1D<<2)
|
||||
#define LCD_SPI_INDEX_WRITE (LCD_SPI_DEVICE_ID|0)
|
||||
#define LCD_SPI_STATUS_READ (LCD_SPI_DEVICE_ID|1)
|
||||
#define LCD_SPI_DATA_WRITE (LCD_SPI_DEVICE_ID|2)
|
||||
#define LCD_SPI_DATA_READ (LCD_SPI_DEVICE_ID|3)
|
||||
|
||||
#define LCD_TYPE1_ID 0x139 /* id for LCD type S6D0139 */
|
||||
|
||||
static int lcd_type = 0;
|
||||
static bool lcd_is_active = false;
|
||||
|
||||
/* simple and crude delay */
|
||||
static void lcd_delay(int count)
|
||||
{
|
||||
volatile int i;
|
||||
for (i = 0; i < count; i++);
|
||||
}
|
||||
|
||||
/* write 'data_out' of length 'bits' over SPI and return received data */
|
||||
static unsigned int lcd_spi_transfer(int bits, unsigned int data_out)
|
||||
{
|
||||
unsigned int data_in = 0;
|
||||
|
||||
/* SSn active */
|
||||
PDAT7 &= ~LCD_SPI_SSn;
|
||||
lcd_delay(10);
|
||||
|
||||
/* send and receive data */
|
||||
while (bits--) {
|
||||
/* CLK low */
|
||||
PDAT3 &= ~LCD_SPI_SCLK;
|
||||
|
||||
/* set MOSI */
|
||||
if (data_out & (1 << bits)) {
|
||||
PDAT3 |= LCD_SPI_MOSI;
|
||||
}
|
||||
else {
|
||||
PDAT3 &= ~LCD_SPI_MOSI;
|
||||
}
|
||||
|
||||
/* delay */
|
||||
lcd_delay(10);
|
||||
|
||||
/* sample MISO */
|
||||
data_in <<= 1;
|
||||
if (PDAT3 & LCD_SPI_MISO) {
|
||||
data_in |= 1;
|
||||
}
|
||||
|
||||
/* CLK high */
|
||||
PDAT3 |= LCD_SPI_SCLK;
|
||||
|
||||
/* delay */
|
||||
lcd_delay(10);
|
||||
}
|
||||
|
||||
/* SSn inactive */
|
||||
PDAT7 |= LCD_SPI_SSn;
|
||||
lcd_delay(10);
|
||||
|
||||
return data_in;
|
||||
}
|
||||
|
||||
/* initialize the lcd SPI port interface */
|
||||
static void lcd_spi_init(void)
|
||||
{
|
||||
/* configure SSn (P7.1) as output */
|
||||
PCON7 = (PCON7 & ~0x000000F0) | 0x00000010;
|
||||
|
||||
/* configure MISO (P3.2) input, MOSI (P3.6) output, SCLK (P3.7) output */
|
||||
PCON3 = (PCON3 & ~0xFF000F00) | 0x11000000;
|
||||
|
||||
/* set all outputs high */
|
||||
PDAT7 |= LCD_SPI_SSn;
|
||||
PDAT3 |= (LCD_SPI_MOSI | LCD_SPI_SCLK);
|
||||
}
|
||||
|
||||
/* read LCD identification word over SPI */
|
||||
static unsigned int lcd_read_reg(unsigned reg)
|
||||
{
|
||||
unsigned int data;
|
||||
|
||||
lcd_spi_transfer(24, (LCD_SPI_INDEX_WRITE << 16) | reg);
|
||||
data = lcd_spi_transfer(24, (LCD_SPI_DATA_READ << 16));
|
||||
return data & 0xFFFF;
|
||||
}
|
||||
|
||||
/* write LCD register over SPI */
|
||||
static void lcd_write_reg(unsigned char reg, unsigned int data)
|
||||
{
|
||||
lcd_spi_transfer(24, (LCD_SPI_INDEX_WRITE << 16) | reg);
|
||||
lcd_spi_transfer(24, (LCD_SPI_DATA_WRITE << 16) | data);
|
||||
}
|
||||
|
||||
/* enable/disable clock signals towards the lcd */
|
||||
static void lcd_controller_power(bool on)
|
||||
{
|
||||
if (on) {
|
||||
LCDCON1 |= 0x80003;
|
||||
}
|
||||
else {
|
||||
LCDCON1 &= ~0x80003;
|
||||
}
|
||||
}
|
||||
|
||||
/* lcd init configuration for lcd type 1 */
|
||||
static void lcd_init1(void)
|
||||
{
|
||||
lcd_write_reg(0x07, 0x0000); /* display control */
|
||||
lcd_write_reg(0x13, 0x0000); /* power control 3 */
|
||||
lcd_delay(166670);
|
||||
|
||||
lcd_write_reg(0x11, 0x3304); /* power control 2 */
|
||||
lcd_write_reg(0x14, 0x1300); /* power control 4 */
|
||||
lcd_write_reg(0x10, 0x1A20); /* power control 1 */
|
||||
lcd_write_reg(0x13, 0x0040); /* power control 3 */
|
||||
lcd_delay(833350);
|
||||
|
||||
lcd_write_reg(0x13, 0x0060); /* power control 3 */
|
||||
lcd_write_reg(0x13, 0x0070); /* power control 3 */
|
||||
lcd_delay(3333400);
|
||||
|
||||
lcd_write_reg(0x01, 0x0127); /* driver output control */
|
||||
lcd_write_reg(0x02, 0x0700); /* lcd driving waveform control */
|
||||
lcd_write_reg(0x03, 0x1030); /* entry mode */
|
||||
lcd_write_reg(0x08, 0x0208); /* blank period control 1 */
|
||||
lcd_write_reg(0x0B, 0x0620); /* frame cycle control */
|
||||
lcd_write_reg(0x0C, 0x0110); /* external interface control */
|
||||
lcd_write_reg(0x30, 0x0120); /* gamma control 1 */
|
||||
lcd_write_reg(0x31, 0x0117); /* gamma control 2 */
|
||||
lcd_write_reg(0x32, 0x0000); /* gamma control 3 */
|
||||
lcd_write_reg(0x33, 0x0305); /* gamma control 4 */
|
||||
lcd_write_reg(0x34, 0x0717); /* gamma control 5 */
|
||||
lcd_write_reg(0x35, 0x0124); /* gamma control 6 */
|
||||
lcd_write_reg(0x36, 0x0706); /* gamma control 7 */
|
||||
lcd_write_reg(0x37, 0x0503); /* gamma control 8 */
|
||||
lcd_write_reg(0x38, 0x1F03); /* gamma control 9 */
|
||||
lcd_write_reg(0x39, 0x0009); /* gamma control 10 */
|
||||
lcd_write_reg(0x40, 0x0000); /* gate scan position */
|
||||
lcd_write_reg(0x41, 0x0000); /* vertical scroll control */
|
||||
lcd_write_reg(0x42, 0x013F); /* 1st screen driving position (end) */
|
||||
lcd_write_reg(0x43, 0x0000); /* 1st screen driving position (start) */
|
||||
lcd_write_reg(0x44, 0x013F); /* 2nd screen driving position (end) */
|
||||
lcd_write_reg(0x45, 0x0000); /* 2nd screen driving position (start) */
|
||||
lcd_write_reg(0x46, 0xEF00); /* horizontal window address */
|
||||
lcd_write_reg(0x47, 0x013F); /* vertical window address (end) */
|
||||
lcd_write_reg(0x48, 0x0000); /* vertical window address (start) */
|
||||
|
||||
lcd_write_reg(0x07, 0x0015); /* display control */
|
||||
lcd_delay(500000);
|
||||
lcd_write_reg(0x07, 0x0017); /* display control */
|
||||
|
||||
lcd_write_reg(0x20, 0x0000); /* RAM address set (low part) */
|
||||
lcd_write_reg(0x21, 0x0000); /* RAM address set (high part) */
|
||||
lcd_write_reg(0x22, 0x0000); /* write data to GRAM */
|
||||
}
|
||||
|
||||
/* lcd init configuration for lcd type 2 */
|
||||
static void lcd_init2(void)
|
||||
{
|
||||
lcd_write_reg(0x07, 0x0000);
|
||||
lcd_write_reg(0x12, 0x0000);
|
||||
lcd_delay(166670);
|
||||
|
||||
lcd_write_reg(0x11, 0x000C);
|
||||
lcd_write_reg(0x12, 0x0A1C);
|
||||
lcd_write_reg(0x13, 0x0022);
|
||||
lcd_write_reg(0x14, 0x0000);
|
||||
|
||||
lcd_write_reg(0x10, 0x7404);
|
||||
lcd_write_reg(0x11, 0x0738);
|
||||
lcd_write_reg(0x10, 0x7404);
|
||||
lcd_delay(833350);
|
||||
|
||||
lcd_write_reg(0x07, 0x0009);
|
||||
lcd_write_reg(0x12, 0x065C);
|
||||
lcd_delay(3333400);
|
||||
|
||||
lcd_write_reg(0x01, 0xE127);
|
||||
lcd_write_reg(0x02, 0x0300);
|
||||
lcd_write_reg(0x03, 0x1100);
|
||||
lcd_write_reg(0x08, 0x0008);
|
||||
lcd_write_reg(0x0B, 0x0000);
|
||||
lcd_write_reg(0x0C, 0x0000);
|
||||
lcd_write_reg(0x0D, 0x0007);
|
||||
lcd_write_reg(0x15, 0x0003);
|
||||
lcd_write_reg(0x16, 0x0014);
|
||||
lcd_write_reg(0x17, 0x0000);
|
||||
|
||||
lcd_write_reg(0x30, 0x0503); /* gamma? */
|
||||
lcd_write_reg(0x31, 0x0303);
|
||||
lcd_write_reg(0x32, 0x0305);
|
||||
lcd_write_reg(0x33, 0x0202);
|
||||
lcd_write_reg(0x34, 0x0204);
|
||||
lcd_write_reg(0x35, 0x0404);
|
||||
lcd_write_reg(0x36, 0x0402);
|
||||
lcd_write_reg(0x37, 0x0202);
|
||||
lcd_write_reg(0x38, 0x1000);
|
||||
lcd_write_reg(0x39, 0x1000);
|
||||
|
||||
lcd_write_reg(0x07, 0x0009);
|
||||
lcd_delay(666680);
|
||||
|
||||
lcd_write_reg(0x07, 0x0109);
|
||||
lcd_delay(666680);
|
||||
|
||||
lcd_write_reg(0x07, 0x010B);
|
||||
}
|
||||
|
||||
/* lcd enable for lcd type 1 */
|
||||
static void lcd_enable1(bool on)
|
||||
{
|
||||
if (on) {
|
||||
lcd_write_reg(0x00, 0x0001); /* start oscillation */
|
||||
lcd_delay(166670);
|
||||
lcd_write_reg(0x10, 0x0000); /* power control 1 */
|
||||
lcd_delay(166670);
|
||||
|
||||
lcd_write_reg(0x11, 0x3304); /* power control 2 */
|
||||
lcd_write_reg(0x14, 0x1300); /* power control 4 */
|
||||
lcd_write_reg(0x10, 0x1A20); /* power control 1 */
|
||||
lcd_write_reg(0x07, 0x0015); /* display control */
|
||||
lcd_delay(500000);
|
||||
|
||||
lcd_write_reg(0x20, 0x0000); /* RAM address set (low part) */
|
||||
lcd_write_reg(0x21, 0x0000); /* RAM address set (high part) */
|
||||
lcd_write_reg(0x22, 0x0000); /* write data to GRAM */
|
||||
}
|
||||
else {
|
||||
lcd_write_reg(0x07, 0x0016); /* display control */
|
||||
lcd_delay(166670 * 4);
|
||||
lcd_write_reg(0x07, 0x0004); /* display control */
|
||||
lcd_delay(166670 * 4);
|
||||
|
||||
lcd_write_reg(0x10, 0x1E21); /* power control 1 */
|
||||
lcd_delay(166670);
|
||||
}
|
||||
}
|
||||
|
||||
/* lcd enable for lcd type 2 */
|
||||
static void lcd_enable2(bool on)
|
||||
{
|
||||
if (on) {
|
||||
lcd_write_reg(0x10, 0x0400);
|
||||
lcd_delay(666680);
|
||||
|
||||
lcd_write_reg(0x07, 0x0000);
|
||||
lcd_write_reg(0x12, 0x0000);
|
||||
lcd_delay(166670);
|
||||
|
||||
lcd_write_reg(0x11, 0x000C);
|
||||
lcd_write_reg(0x12, 0x0A1C);
|
||||
lcd_write_reg(0x13, 0x0022);
|
||||
lcd_write_reg(0x14, 0x0000);
|
||||
lcd_write_reg(0x10, 0x7404);
|
||||
lcd_write_reg(0x11, 0x0738);
|
||||
lcd_write_reg(0x10, 0x7404);
|
||||
lcd_delay(833350);
|
||||
|
||||
lcd_write_reg(0x07, 0x0009);
|
||||
lcd_write_reg(0x12, 0x065C);
|
||||
lcd_delay(3333400);
|
||||
|
||||
lcd_write_reg(0x0B, 0x0000);
|
||||
lcd_write_reg(0x07, 0x0009);
|
||||
lcd_delay(666680);
|
||||
|
||||
lcd_write_reg(0x07, 0x0109);
|
||||
lcd_delay(666680);
|
||||
|
||||
lcd_write_reg(0x07, 0x010B);
|
||||
}
|
||||
else {
|
||||
lcd_write_reg(0x0B, 0x0109);
|
||||
lcd_write_reg(0x07, 0x0009);
|
||||
lcd_delay(666680);
|
||||
|
||||
lcd_write_reg(0x07, 0x0008);
|
||||
lcd_delay(666680);
|
||||
|
||||
lcd_write_reg(0x10, 0x0400);
|
||||
lcd_write_reg(0x10, 0x0401);
|
||||
lcd_delay(166670);
|
||||
}
|
||||
}
|
||||
|
||||
/* turn both the lcd controller and the lcd itself on or off */
|
||||
void lcd_enable(bool on)
|
||||
{
|
||||
if (on) {
|
||||
/* enable controller clock */
|
||||
PWRCON &= ~(1 << 18);
|
||||
|
||||
lcd_controller_power(true);
|
||||
lcd_delay(166670);
|
||||
}
|
||||
|
||||
/* call type specific power function */
|
||||
if (lcd_type == 1) {
|
||||
lcd_enable1(on);
|
||||
}
|
||||
else {
|
||||
lcd_enable2(on);
|
||||
}
|
||||
|
||||
if (!on) {
|
||||
lcd_controller_power(false);
|
||||
|
||||
/* disable controller clock */
|
||||
PWRCON |= (1 << 18);
|
||||
}
|
||||
|
||||
lcd_is_active = on;
|
||||
}
|
||||
|
||||
bool lcd_active(void)
|
||||
{
|
||||
return lcd_is_active;
|
||||
}
|
||||
|
||||
/* initialise the lcd controller inside the s5l8700 */
|
||||
static void lcd_controller_init(void)
|
||||
{
|
||||
PWRCON &= ~(1 << 18);
|
||||
|
||||
LCDCON1 = (0 << 28) | /* BURSTLEN */
|
||||
(0 << 19) | /* DIVEN */
|
||||
(12 << 13) | /* CLKVAL */
|
||||
(1 << 12) | /* CLKDIR, 1=divided clock */
|
||||
(0 << 11) | /* CLKSEL, 0=HCLK, 1=PLL */
|
||||
(5 << 6) | /* BPPMODEF, 5=rgb565, 7=raw24 */
|
||||
(5 << 2) | /* BPPMODEB, 5=rgb565, 7=raw24 */
|
||||
(0 << 0); /* ENVID */
|
||||
LCDCON2 = (2 << 9) | /* PALFRM, 2=rgb565 palette */
|
||||
(1 << 7) | /* IVCLK */
|
||||
(1 << 6) | /* IHSYNC */
|
||||
(1 << 5) | /* IVSYNC */
|
||||
(1 << 3); /* IVDEN */
|
||||
LCDTCON1 = (lcd_type == 1) ? 0x070103 : 0x030303;
|
||||
LCDTCON2 = (lcd_type == 1) ? 0x070103 : 0x030703;
|
||||
LCDTCON3 = ((LCD_HEIGHT - 1) << 11) | (LCD_WIDTH - 1);
|
||||
LCDOSD1 = 0;
|
||||
LCDOSD2 = 0;
|
||||
LCDOSD3 = 0;
|
||||
|
||||
LCDB1SADDR1 = 0;
|
||||
LCDB2SADDR1 = 0;
|
||||
LCDF1SADDR1 = 0;
|
||||
LCDF2SADDR1 = 0;
|
||||
LCDB1SADDR2 = 0;
|
||||
LCDB2SADDR2 = 0;
|
||||
LCDF1SADDR2 = 0;
|
||||
LCDF2SADDR2 = 0;
|
||||
LCDB1SADDR3 = 0;
|
||||
LCDB2SADDR3 = 0;
|
||||
LCDF1SADDR3 = 0;
|
||||
LCDF2SADDR3 = 0;
|
||||
|
||||
LCDKEYCON = 0;
|
||||
LCDCOLVAL = 0;
|
||||
LCDBGCON = 0;
|
||||
LCDFGCON = 0;
|
||||
LCDDITHMODE = 0;
|
||||
|
||||
LCDINTCON = 0;
|
||||
}
|
||||
|
||||
void lcd_init_device(void)
|
||||
{
|
||||
unsigned int lcd_id;
|
||||
uint32_t fb, fb_end, window;
|
||||
|
||||
/* configure LCD SPI pins */
|
||||
lcd_spi_init();
|
||||
|
||||
/* identify display through SPI */
|
||||
lcd_id = lcd_read_reg(0);
|
||||
lcd_type = (lcd_id == LCD_TYPE1_ID) ? 1 : 2;
|
||||
|
||||
/* display specific init sequence */
|
||||
if (lcd_type == 1) {
|
||||
lcd_init1();
|
||||
}
|
||||
else {
|
||||
lcd_init2();
|
||||
}
|
||||
|
||||
/* init LCD controller */
|
||||
lcd_controller_init();
|
||||
|
||||
/* set framebuffer addresses */
|
||||
fb = (uint32_t) FBADDR(0,0);
|
||||
fb_end = (uint32_t) FBADDR(0,LCD_HEIGHT);
|
||||
window = 2 * LCD_WIDTH;
|
||||
|
||||
LCDB1SADDR1 = fb;
|
||||
LCDB2SADDR1 = fb;
|
||||
LCDF1SADDR1 = fb;
|
||||
LCDF2SADDR1 = fb;
|
||||
|
||||
LCDB1SADDR2 = fb_end;
|
||||
LCDB2SADDR2 = fb_end;
|
||||
LCDF1SADDR2 = fb_end;
|
||||
LCDF2SADDR2 = fb_end;
|
||||
|
||||
LCDB1SADDR3 = window;
|
||||
LCDB2SADDR3 = window;
|
||||
LCDF1SADDR3 = window;
|
||||
LCDF2SADDR3 = window;
|
||||
|
||||
lcd_enable(true);
|
||||
|
||||
/* configure LCD pins */
|
||||
PCON_ASRAM = 1;
|
||||
}
|
||||
|
||||
void lcd_update_rect(int x, int y, int width, int height)
|
||||
{
|
||||
/* not implemented yet, LCD controller accesses framebuffer directly */
|
||||
(void) x;
|
||||
(void) y;
|
||||
(void) width;
|
||||
(void) height;
|
||||
}
|
||||
|
||||
void lcd_update(void)
|
||||
{
|
||||
lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
(void)src;
|
||||
(void)src_x;
|
||||
(void)src_y;
|
||||
(void)stride;
|
||||
(void)x;
|
||||
(void)y;
|
||||
(void)width;
|
||||
(void)height;
|
||||
/* TODO: not implemented yet */
|
||||
}
|
||||
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 by Michael Sparmann
|
||||
*
|
||||
* 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 __NAND_TARGET_H__
|
||||
#define __NAND_TARGET_H__
|
||||
|
||||
#include "config.h"
|
||||
#include "inttypes.h"
|
||||
|
||||
|
||||
struct nand_device_info_type
|
||||
{
|
||||
uint32_t id;
|
||||
uint16_t blocks;
|
||||
uint16_t userblocks;
|
||||
uint16_t pagesperblock;
|
||||
uint8_t blocksizeexponent;
|
||||
uint8_t tunk1;
|
||||
uint8_t twp;
|
||||
uint8_t tunk2;
|
||||
uint8_t tunk3;
|
||||
} __attribute__((packed));
|
||||
|
||||
uint32_t nand_read_page(uint32_t bank, uint32_t page, void* databuffer,
|
||||
void* sparebuffer, uint32_t doecc,
|
||||
uint32_t checkempty);
|
||||
uint32_t nand_write_page(uint32_t bank, uint32_t page, void* databuffer,
|
||||
void* sparebuffer, uint32_t doecc);
|
||||
uint32_t nand_block_erase(uint32_t bank, uint32_t page);
|
||||
|
||||
const struct nand_device_info_type* nand_get_device_type(uint32_t bank);
|
||||
uint32_t nand_reset(uint32_t bank);
|
||||
uint32_t nand_device_init(void);
|
||||
void nand_set_active(void);
|
||||
long nand_last_activity(void);
|
||||
void nand_power_up(void);
|
||||
void nand_power_down(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2008 Rafaël Carré
|
||||
*
|
||||
* 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 "powermgmt.h"
|
||||
#include "adc.h"
|
||||
#include "adc-target.h"
|
||||
|
||||
unsigned short battery_level_disksafe = 3400;/* TODO: this is just an initial guess */
|
||||
|
||||
unsigned short battery_level_shutoff = 3300; /* TODO: this is just an initial guess */
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
|
||||
unsigned short percent_to_volt_discharge[11] =
|
||||
{
|
||||
/* TODO: simple uncalibrated curve, linear except for first 10% */
|
||||
3300, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200
|
||||
};
|
||||
|
||||
#if CONFIG_CHARGING
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
|
||||
unsigned short percent_to_volt_charge[11] =
|
||||
{
|
||||
/* TODO: simple uncalibrated curve, linear except for first 10% */
|
||||
3300, 3390, 3480, 3570, 3660, 3750, 3840, 3930, 4020, 4110, 4200
|
||||
};
|
||||
#endif /* CONFIG_CHARGING */
|
||||
|
||||
/* ADC should read 0x3ff=6.00V */
|
||||
#define BATTERY_SCALE_FACTOR 6000
|
||||
/* full-scale ADC readout (2^10) in millivolt */
|
||||
|
||||
|
||||
/* Returns battery voltage from ADC [millivolts] */
|
||||
int _battery_voltage(void)
|
||||
{
|
||||
return (adc_read(ADC_BATTERY) * BATTERY_SCALE_FACTOR) >> 10;
|
||||
}
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2010 by Bertrik Sikken
|
||||
*
|
||||
* 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 "nand-target.h"
|
||||
|
||||
const struct nand_device_info_type* nand_get_device_type(uint32_t bank);
|
||||
|
||||
|
||||
uint32_t nand_read_page(uint32_t bank, uint32_t page, void* databuffer,
|
||||
void* sparebuffer, uint32_t doecc,
|
||||
uint32_t checkempty)
|
||||
{
|
||||
/* TODO implement */
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t nand_write_page(uint32_t bank, uint32_t page, void* databuffer,
|
||||
void* sparebuffer, uint32_t doecc)
|
||||
{
|
||||
/* TODO implement */
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t nand_block_erase(uint32_t bank, uint32_t page)
|
||||
{
|
||||
/* TODO implement */
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t nand_reset(uint32_t bank)
|
||||
{
|
||||
/* TODO implement */
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t nand_device_init(void)
|
||||
{
|
||||
/* TODO implement */
|
||||
return 0;
|
||||
}
|
||||
|
||||
void nand_power_up(void)
|
||||
{
|
||||
/* TODO implement */
|
||||
}
|
||||
|
||||
void nand_power_down(void)
|
||||
{
|
||||
/* TODO implement */
|
||||
}
|
||||
|
||||
void nand_set_active(void)
|
||||
{
|
||||
/* TODO implement */
|
||||
}
|
||||
|
||||
long nand_last_activity(void)
|
||||
{
|
||||
/* TODO implement */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2009 Bertrik Sikken
|
||||
*
|
||||
* 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 <stdbool.h>
|
||||
#include "config.h"
|
||||
#include "inttypes.h"
|
||||
#include "s5l87xx.h"
|
||||
#include "power.h"
|
||||
|
||||
/* Power handling for S5L8700 based Meizu players
|
||||
|
||||
The M3 and M6 players appear to use the same pins for power, USB detection
|
||||
and charging status.
|
||||
*/
|
||||
|
||||
void power_off(void)
|
||||
{
|
||||
/* take down PWRON_M (P1.3) */
|
||||
PDAT1 &= ~(1 << 3);
|
||||
}
|
||||
|
||||
void power_init(void)
|
||||
{
|
||||
/* configure PWRON_M (P1.3) as output and set it to keep power turned on */
|
||||
PCON1 = (PCON1 & ~(0xF << 12)) | (0x1 << 12);
|
||||
PDAT1 |= (1 << 3);
|
||||
|
||||
/* configure PBSTAT (P1.4) as input */
|
||||
PCON1 &= ~(0xF << 16);
|
||||
|
||||
/* configure CHRG (P5.7) as input to monitor charging state */
|
||||
PCON5 &= ~(0xF << 28);
|
||||
|
||||
/* enable USB2.0 function controller to allow VBUS monitoring */
|
||||
PWRCON &= ~(1 << 15);
|
||||
}
|
||||
|
||||
#if CONFIG_CHARGING
|
||||
unsigned int power_input_status(void)
|
||||
{
|
||||
/* check VBUS in the USB2.0 function controller */
|
||||
if (USB_TR & (1 << 15)) {
|
||||
return POWER_INPUT_USB;
|
||||
}
|
||||
|
||||
return POWER_INPUT_NONE;
|
||||
}
|
||||
|
||||
bool charging_state(void)
|
||||
{
|
||||
/* CHRG pin goes low when charging */
|
||||
return ((PDAT5 & (1 << 7)) == 0);
|
||||
}
|
||||
#endif /* CONFIG_CHARGING */
|
||||
|
||||
#if CONFIG_TUNER
|
||||
static bool tuner_on = false;
|
||||
|
||||
bool tuner_power(bool status)
|
||||
{
|
||||
if (status != tuner_on)
|
||||
{
|
||||
tuner_on = status;
|
||||
status = !status;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
bool tuner_powered(void)
|
||||
{
|
||||
return tuner_on; /* No debug info */
|
||||
}
|
||||
#endif /* CONFIG_TUNER */
|
||||
|
||||
|
|
@ -35,12 +35,6 @@
|
|||
#if defined(IPOD_NANO2G)
|
||||
#define MIUSDPARA_BOOST 0x006A49A5
|
||||
#define MIUSDPARA_UNBOOST 0x006124D1
|
||||
#elif defined(MEIZU_M3)
|
||||
#define MIUSDPARA_BOOST 0x006A491D
|
||||
#define MIUSDPARA_UNBOOST 0x0061248D
|
||||
#elif defined(MEIZU_M6SP)
|
||||
#define MIUSDPARA_BOOST 0x006A4965
|
||||
#define MIUSDPARA_UNBOOST 0x00612491
|
||||
#endif
|
||||
|
||||
#define default_interrupt(name) \
|
||||
|
|
|
|||
|
|
@ -1,62 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 by Bertrik Sikken
|
||||
*
|
||||
* 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 "kernel.h"
|
||||
#include "s5l87xx.h"
|
||||
#include "i2c-s5l8700.h"
|
||||
#include "uda1380.h"
|
||||
#include "udacodec.h"
|
||||
|
||||
void udacodec_reset(void)
|
||||
{
|
||||
/* Reset codec using GPIO P5.0 */
|
||||
PCON5 = (PCON5 & ~0xF) | 1;
|
||||
PDAT5 |= (1 << 0);
|
||||
sleep(HZ/100);
|
||||
|
||||
/* Set codec reset pin inactive */
|
||||
PDAT5 &= ~(1 << 0);
|
||||
}
|
||||
|
||||
int udacodec_write(unsigned char reg, unsigned short value)
|
||||
{
|
||||
unsigned char data[2];
|
||||
|
||||
data[0] = value >> 8;
|
||||
data[1] = value & 0xFF;
|
||||
|
||||
return i2c_write(UDA1380_ADDR, reg, 2, data);
|
||||
}
|
||||
|
||||
int udacodec_write2(unsigned char reg,
|
||||
unsigned short value1, unsigned short value2)
|
||||
{
|
||||
unsigned char data[4];
|
||||
|
||||
data[0] = value1 >> 8;
|
||||
data[1] = value1 & 0xFF;
|
||||
data[2] = value2 >> 8;
|
||||
data[3] = value2 & 0xFF;
|
||||
|
||||
return i2c_write(UDA1380_ADDR, reg, 4, data);
|
||||
}
|
||||
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 by Bertrik Sikken
|
||||
*
|
||||
* 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_hw_init(void);
|
||||
void backlight_hw_on(void);
|
||||
void backlight_hw_off(void);
|
||||
void backlight_hw_brightness(int brightness);
|
||||
|
||||
void buttonlight_hw_on(void);
|
||||
void buttonlight_hw_off(void);
|
||||
|
||||
#endif /* BACKLIGHT_TARGET_H */
|
||||
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 by Bertrik Sikken
|
||||
*
|
||||
* 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 <stdbool.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "backlight.h"
|
||||
#include "backlight-target.h"
|
||||
#include "system.h"
|
||||
|
||||
/*
|
||||
Backlight driver using the PWM mode of a hardware timer.
|
||||
|
||||
The PWM duty cycle depends exponentially on the configured brightness
|
||||
level. This makes the brightness curve more linear to the human eye.
|
||||
|
||||
The button LEDs are all activated at the same time (even though there
|
||||
are three individually controllable groups: menu/back, cursor, middle).
|
||||
*/
|
||||
|
||||
void backlight_hw_brightness(int brightness)
|
||||
{
|
||||
/* pwm = round(16 * 16**(x/16)), where brightness level x = 1..16 */
|
||||
static const unsigned int logtable[] =
|
||||
{19, 23, 27, 32, 38, 45, 54, 64, 76, 91, 108, 128, 152, 181, 215, 256};
|
||||
|
||||
/* set PWM width */
|
||||
TADATA0 = logtable[brightness];
|
||||
}
|
||||
|
||||
void backlight_hw_on(void)
|
||||
{
|
||||
/* configure backlight pin P0.0 as timer PWM output */
|
||||
PCON0 = ((PCON0 & ~(3 << 0)) | (2 << 0));
|
||||
|
||||
backlight_hw_brightness(backlight_brightness);
|
||||
}
|
||||
|
||||
void backlight_hw_off(void)
|
||||
{
|
||||
/* configure backlight pin P0.0 as GPIO and switch off */
|
||||
PCON0 = ((PCON0 & ~(3 << 0)) | (1 << 0));
|
||||
PDAT0 &= ~(1 << 0);
|
||||
}
|
||||
|
||||
void buttonlight_hw_on(void)
|
||||
{
|
||||
PDAT3 |= (3 << 2);
|
||||
PDAT4 |= (1 << 2);
|
||||
}
|
||||
|
||||
void buttonlight_hw_off(void)
|
||||
{
|
||||
PDAT3 &= ~(3 << 2);
|
||||
PDAT4 &= ~(1 << 2);
|
||||
}
|
||||
|
||||
bool backlight_hw_init(void)
|
||||
{
|
||||
/* Enable button LEDs: P3.2 (menu/back), P3.3 (cursor), P4.2 (middle) */
|
||||
PCON3 = (PCON3 & ~0x0000FF00) | 0x00001100;
|
||||
PCON4 = (PCON4 & ~0x00000F00) | 0x00000100;
|
||||
buttonlight_hw_off();
|
||||
|
||||
/* enable timer clock */
|
||||
PWRCON &= ~(1 << 4);
|
||||
|
||||
/* configure timer */
|
||||
TACMD = (1 << 1); /* TA_CLR */
|
||||
TACON = (0 << 13) | /* TA_INT1_EN */
|
||||
(0 << 12) | /* TA_INT0_EN */
|
||||
(1 << 11) | /* TA_START */
|
||||
(3 << 8) | /* TA_CS = PCLK / 64 */
|
||||
(1 << 4); /* TA_MODE_SEL = PWM mode */
|
||||
TADATA1 = 256; /* set PWM period */
|
||||
TAPRE = 20; /* prescaler */
|
||||
TACMD = (1 << 0); /* TA_EN */
|
||||
|
||||
backlight_hw_on();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 by Bertrik Sikken
|
||||
*
|
||||
* 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_
|
||||
|
||||
#define HAS_BUTTON_HOLD
|
||||
|
||||
#define BUTTON_BACK 0x00000001
|
||||
#define BUTTON_MENU 0x00000002
|
||||
#define BUTTON_UP 0x00000004
|
||||
#define BUTTON_DOWN 0x00000008
|
||||
#define BUTTON_LEFT 0x00000010
|
||||
#define BUTTON_RIGHT 0x00000020
|
||||
#define BUTTON_SELECT 0x00000040
|
||||
#define BUTTON_POWER 0x00000080
|
||||
|
||||
#define BUTTON_MAIN (BUTTON_BACK|BUTTON_MENU|BUTTON_UP|BUTTON_DOWN|BUTTON_LEFT|\
|
||||
BUTTON_RIGHT|BUTTON_SELECT)
|
||||
|
||||
#define POWEROFF_BUTTON BUTTON_POWER
|
||||
#define POWEROFF_COUNT 10
|
||||
|
||||
#endif /* _BUTTON_TARGET_H_ */
|
||||
|
|
@ -1,156 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 Bertrik Sikken
|
||||
*
|
||||
* 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 <stdbool.h>
|
||||
#include "config.h"
|
||||
|
||||
#include "inttypes.h"
|
||||
#include "s5l87xx.h"
|
||||
#include "button.h"
|
||||
#include "button-target.h"
|
||||
|
||||
/* Button driver for the touch keys on the Samsung YP-S3
|
||||
|
||||
The exact controller is not known, but it is likely from Melfas.
|
||||
|
||||
The protocol is as follows:
|
||||
* the communication is done using three signals: DRDY, DCLK and DOUT
|
||||
* in the idle state these signals are all high.
|
||||
* when a key is touched or released, the key controller pulls down DRDY
|
||||
and outputs the first bit of a 20-bit word on its DOUT signal.
|
||||
* the CPU stores the bit, then acknowledges it by toggling the DCLK signal.
|
||||
* the key controller prepares the next bit, then toggles its DRDY output,
|
||||
unless all 20 bits have been transferred (in that case it stays high).
|
||||
* the 20-bit word contains separate bits for each button, some fixed bits
|
||||
and a bit indicating the number of keys pressed (modulo 2).
|
||||
*/
|
||||
|
||||
|
||||
void button_init_device(void)
|
||||
{
|
||||
/* P0.5/P1.0 power switch input */
|
||||
PCON0 &= ~(3 << 10);
|
||||
PCON1 &= ~0x0000000F;
|
||||
|
||||
/* P1.3 headphones detect input */
|
||||
PCON1 &= ~0x0000F000;
|
||||
|
||||
/* P1.5 DATA, P1.6 DRDY inputs (touch key controller) */
|
||||
PCON1 &= ~0x0FF00000;
|
||||
|
||||
/* P3.4 DCLK output (touch key controller) */
|
||||
PCON3 = (PCON3 & ~0x000F0000) | 0x00010000;
|
||||
PDAT3 |= (1 << 4);
|
||||
|
||||
/* P4.3 hold switch input */
|
||||
PCON4 &= ~0x0000F000;
|
||||
}
|
||||
|
||||
/* returns the raw 20-bit word from the touch key controller */
|
||||
static int tkey_read(void)
|
||||
{
|
||||
static int value = 0;
|
||||
int i;
|
||||
|
||||
/* check activity */
|
||||
if (PDAT1 & (1 << 6)) {
|
||||
return value;
|
||||
}
|
||||
|
||||
/* get key bits */
|
||||
value = 0;
|
||||
for (i = 0; i < 10; i++) {
|
||||
/* sample bit from falling edge of DRDY */
|
||||
while ((PDAT1 & (1 << 6)) != 0);
|
||||
value <<= 1;
|
||||
if (PDAT1 & (1 << 5)) {
|
||||
value |= 1;
|
||||
}
|
||||
|
||||
/* acknowledge on DCLK */
|
||||
PDAT3 &= ~(1 << 4);
|
||||
|
||||
/* sample bit from rising edge of DRDY */
|
||||
while ((PDAT1 & (1 << 6)) == 0);
|
||||
value <<= 1;
|
||||
if (PDAT1 & (1 << 5)) {
|
||||
value |= 1;
|
||||
}
|
||||
|
||||
/* acknowledge on DCLK */
|
||||
PDAT3 |= (1 << 4);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
int button_read_device(void)
|
||||
{
|
||||
int buttons = 0;
|
||||
int tkey_data;
|
||||
|
||||
/* hold switch */
|
||||
if (button_hold()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* power button */
|
||||
if (PDAT1 & (1 << 0)) {
|
||||
buttons |= BUTTON_POWER;
|
||||
}
|
||||
|
||||
/* touch keys */
|
||||
tkey_data = tkey_read();
|
||||
if (tkey_data & (1 << 9)) {
|
||||
buttons |= BUTTON_BACK;
|
||||
}
|
||||
if (tkey_data & (1 << 8)) {
|
||||
buttons |= BUTTON_UP;
|
||||
}
|
||||
if (tkey_data & (1 << 7)) {
|
||||
buttons |= BUTTON_MENU;
|
||||
}
|
||||
if (tkey_data & (1 << 6)) {
|
||||
buttons |= BUTTON_LEFT;
|
||||
}
|
||||
if (tkey_data & (1 << 5)) {
|
||||
buttons |= BUTTON_SELECT;
|
||||
}
|
||||
if (tkey_data & (1 << 4)) {
|
||||
buttons |= BUTTON_RIGHT;
|
||||
}
|
||||
if (tkey_data & (1 << 3)) {
|
||||
buttons |= BUTTON_DOWN;
|
||||
}
|
||||
|
||||
return buttons;
|
||||
}
|
||||
|
||||
bool button_hold(void)
|
||||
{
|
||||
return (PDAT4 & (1 << 3));
|
||||
}
|
||||
|
||||
bool headphones_inserted(void)
|
||||
{
|
||||
return ((PDAT1 & (1 << 3)) == 0);
|
||||
}
|
||||
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 by Bertrik Sikken
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
FM radio i2c interface, allows the radio driver to talk to the tuner chip.
|
||||
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "i2c-s5l8700.h"
|
||||
#include "fmradio_i2c.h"
|
||||
|
||||
void fmradio_i2c_init(void)
|
||||
{
|
||||
/* nothing to do */
|
||||
}
|
||||
|
||||
int fmradio_i2c_write(unsigned char address, const unsigned char* buf, int count)
|
||||
{
|
||||
return i2c_write(address, -1, count, buf);
|
||||
}
|
||||
|
||||
int fmradio_i2c_read(unsigned char address, unsigned char* buf, int count)
|
||||
{
|
||||
return i2c_read(address, -1, count, buf);
|
||||
}
|
||||
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 by Michael Sparmann
|
||||
*
|
||||
* 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 __FTL_TARGET_H__
|
||||
#define __FTL_TARGET_H__
|
||||
|
||||
#include "config.h"
|
||||
#include "inttypes.h"
|
||||
|
||||
#ifdef BOOTLOADER
|
||||
/* Bootloaders don't need write access */
|
||||
#define FTL_READONLY
|
||||
#endif
|
||||
|
||||
uint32_t ftl_init(void);
|
||||
uint32_t ftl_read(uint32_t sector, uint32_t count, void* buffer);
|
||||
uint32_t ftl_write(uint32_t sector, uint32_t count, const void* buffer);
|
||||
uint32_t ftl_sync(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -1,337 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 by Bertrik Sikken
|
||||
*
|
||||
* 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 "s5l87xx.h"
|
||||
#include "lcd.h"
|
||||
|
||||
/* LCD driver for the Samsung YP-S3
|
||||
|
||||
It appears that this player can contain two display types.
|
||||
Detection of the display type is done by looking at the level of pin P0.4.
|
||||
Currently only display "type 2" has been implemented and tested.
|
||||
|
||||
This driver could use DMA to do the screen updates, but currently writes
|
||||
the data to the LCD using the processor instead.
|
||||
*/
|
||||
|
||||
|
||||
static int lcd_type = 0;
|
||||
|
||||
|
||||
static void lcd_delay(int delay)
|
||||
{
|
||||
volatile int i;
|
||||
for (i = 0; i < delay; i++);
|
||||
}
|
||||
|
||||
static void lcd_reset_delay(void)
|
||||
{
|
||||
lcd_delay(10000);
|
||||
}
|
||||
|
||||
static void lcd_reset(void)
|
||||
{
|
||||
LCD_CON = 0xDB8;
|
||||
LCD_PHTIME = 0x22;
|
||||
LCD_RST_TIME = 0x7FFF;
|
||||
|
||||
lcd_reset_delay();
|
||||
LCD_DRV_RST = 0;
|
||||
lcd_reset_delay();
|
||||
LCD_DRV_RST = 1;
|
||||
lcd_reset_delay();
|
||||
LCD_DRV_RST = 0;
|
||||
lcd_reset_delay();
|
||||
LCD_DRV_RST = 1;
|
||||
|
||||
LCD_INTCON = 0;
|
||||
}
|
||||
|
||||
static void lcd_wcmd(unsigned int cmd)
|
||||
{
|
||||
while ((LCD_STATUS & 0x10) != 0);
|
||||
LCD_WCMD = cmd;
|
||||
}
|
||||
|
||||
static void lcd_wdata(unsigned int data)
|
||||
{
|
||||
while ((LCD_STATUS & 0x10) != 0);
|
||||
LCD_WDATA = data;
|
||||
}
|
||||
|
||||
static void lcd_wcmd_data(unsigned int cmd, unsigned int data)
|
||||
{
|
||||
lcd_wcmd(cmd);
|
||||
lcd_wdata(data);
|
||||
}
|
||||
|
||||
static void lcd_init1(void)
|
||||
{
|
||||
lcd_wcmd(0x11);
|
||||
lcd_delay(10000);
|
||||
|
||||
lcd_wcmd(0xF0);
|
||||
lcd_wdata(0x5A);
|
||||
|
||||
lcd_wcmd(0xC0);
|
||||
lcd_wdata(0x05);
|
||||
lcd_wdata(0x01);
|
||||
|
||||
lcd_wcmd(0xC1);
|
||||
lcd_wdata(0x04);
|
||||
|
||||
lcd_wcmd(0xC5);
|
||||
lcd_wdata(0xB0);
|
||||
|
||||
lcd_wcmd(0xC6);
|
||||
lcd_wdata(0x0);
|
||||
|
||||
lcd_wcmd(0xB1);
|
||||
lcd_wdata(0x02);
|
||||
lcd_wdata(0x0E);
|
||||
lcd_wdata(0x00);
|
||||
|
||||
lcd_wcmd(0xF2);
|
||||
lcd_wdata(0x01);
|
||||
|
||||
lcd_wcmd(0xE0);
|
||||
lcd_wdata(0x09);
|
||||
lcd_wdata(0x00);
|
||||
lcd_wdata(0x06);
|
||||
lcd_wdata(0x2E);
|
||||
lcd_wdata(0x2B);
|
||||
lcd_wdata(0x0B);
|
||||
lcd_wdata(0x1A);
|
||||
lcd_wdata(0x02);
|
||||
lcd_wdata(0x06);
|
||||
lcd_wdata(0x0C);
|
||||
lcd_wdata(0x0D);
|
||||
lcd_wdata(0x00);
|
||||
lcd_wdata(0x05);
|
||||
lcd_wdata(0x02);
|
||||
lcd_wdata(0x05);
|
||||
|
||||
lcd_wcmd(0xE1);
|
||||
lcd_wdata(0x06);
|
||||
lcd_wdata(0x23);
|
||||
lcd_wdata(0x25);
|
||||
lcd_wdata(0x0F);
|
||||
lcd_wdata(0x0A);
|
||||
lcd_wdata(0x04);
|
||||
lcd_wdata(0x02);
|
||||
lcd_wdata(0x1A);
|
||||
lcd_wdata(0x05);
|
||||
lcd_wdata(0x03);
|
||||
lcd_wdata(0x06);
|
||||
lcd_wdata(0x01);
|
||||
lcd_wdata(0x0C);
|
||||
lcd_wdata(0x0B);
|
||||
lcd_wdata(0x05);
|
||||
lcd_wdata(0x05);
|
||||
|
||||
lcd_wcmd(0x3A);
|
||||
lcd_wdata(0x05);
|
||||
|
||||
lcd_wcmd(0x29);
|
||||
|
||||
lcd_wcmd(0x2C);
|
||||
}
|
||||
|
||||
static void lcd_init2(void)
|
||||
{
|
||||
lcd_wcmd_data(0x00, 0x0001);
|
||||
lcd_delay(50000);
|
||||
|
||||
lcd_wcmd_data(0x07, 0x0000);
|
||||
lcd_wcmd_data(0x12, 0x0000);
|
||||
lcd_delay(10000);
|
||||
|
||||
lcd_wcmd(0);
|
||||
lcd_wcmd(0);
|
||||
lcd_wcmd(0);
|
||||
lcd_wcmd(0);
|
||||
|
||||
lcd_wcmd_data(0xA4, 0x0001);
|
||||
lcd_delay(10000);
|
||||
|
||||
lcd_wcmd_data(0x70, 0x1B00);
|
||||
lcd_wcmd_data(0x08, 0x030A);
|
||||
lcd_wcmd_data(0x30, 0x0000);
|
||||
lcd_wcmd_data(0x31, 0x0305);
|
||||
lcd_wcmd_data(0x32, 0x0304);
|
||||
lcd_wcmd_data(0x33, 0x0107);
|
||||
lcd_wcmd_data(0x34, 0x0304);
|
||||
|
||||
lcd_wcmd_data(0x35, 0x0204);
|
||||
lcd_wcmd_data(0x36, 0x0707);
|
||||
lcd_wcmd_data(0x37, 0x0701);
|
||||
lcd_wcmd_data(0x38, 0x1B08);
|
||||
lcd_wcmd_data(0x39, 0x030F);
|
||||
lcd_wcmd_data(0x3A, 0x0E0E);
|
||||
|
||||
lcd_wcmd_data(0x07, 0x0001);
|
||||
lcd_delay(50000);
|
||||
|
||||
lcd_wcmd_data(0x18, 0x0001);
|
||||
lcd_wcmd_data(0x10, 0x12B0);
|
||||
lcd_wcmd_data(0x11, 0x0001);
|
||||
|
||||
lcd_wcmd_data(0x12, 0x0114);
|
||||
lcd_wcmd_data(0x13, 0x8D0F);
|
||||
lcd_wcmd_data(0x12, 0x0134);
|
||||
lcd_delay(1000);
|
||||
lcd_wcmd_data(0x01, 0x0100);
|
||||
lcd_wcmd_data(0x02, 0x0700);
|
||||
lcd_wcmd_data(0x03, 0x5030);
|
||||
|
||||
lcd_wcmd_data(0x04, 0x0000);
|
||||
lcd_wcmd_data(0x09, 0x0000);
|
||||
lcd_wcmd_data(0x0C, 0x0000);
|
||||
lcd_wcmd_data(0x0F, 0x0000);
|
||||
|
||||
lcd_wcmd_data(0x14, 0x8000);
|
||||
lcd_wcmd_data(0x20, 0x0000);
|
||||
lcd_wcmd_data(0x21, 0x0000);
|
||||
lcd_wcmd_data(0x71, 0x0001);
|
||||
lcd_wcmd_data(0x7A, 0x0000);
|
||||
lcd_wcmd_data(0x90, 0x0000);
|
||||
lcd_wcmd_data(0x91, 0x0100);
|
||||
lcd_wcmd_data(0x92, 0x0000);
|
||||
lcd_wcmd_data(0x98, 0x0001);
|
||||
lcd_wcmd_data(0x99, 0x030C);
|
||||
lcd_wcmd_data(0x9A, 0x030C);
|
||||
|
||||
lcd_delay(50000);
|
||||
lcd_wcmd_data(0x07, 0x0001);
|
||||
lcd_delay(30000);
|
||||
lcd_wcmd_data(0x07, 0x0021);
|
||||
|
||||
lcd_wcmd_data(0x12, 0x1134);
|
||||
lcd_delay(10000);
|
||||
|
||||
lcd_wcmd_data(0x07, 0x0233);
|
||||
lcd_delay(30000);
|
||||
}
|
||||
|
||||
|
||||
static void lcd_set_window1(int x, int y, int width, int height)
|
||||
{
|
||||
(void)x;
|
||||
(void)width;
|
||||
|
||||
lcd_wcmd(0x2A);
|
||||
lcd_wdata(0);
|
||||
lcd_wdata(y);
|
||||
lcd_wdata(0);
|
||||
|
||||
lcd_wcmd(0x2B);
|
||||
lcd_wdata(0);
|
||||
lcd_wdata(y + height - 1);
|
||||
lcd_wdata(0);
|
||||
}
|
||||
|
||||
static void lcd_set_window2(int x, int y, int width, int height)
|
||||
{
|
||||
lcd_wcmd_data(0x50, x);
|
||||
lcd_wcmd_data(0x51, x + width - 1);
|
||||
lcd_wcmd_data(0x52, y);
|
||||
lcd_wcmd_data(0x53, y + height - 1);
|
||||
}
|
||||
|
||||
|
||||
static void lcd_set_position1(int x, int y)
|
||||
{
|
||||
(void)x;
|
||||
(void)y;
|
||||
}
|
||||
|
||||
static void lcd_set_position2(int x, int y)
|
||||
{
|
||||
lcd_wcmd_data(0x20, x);
|
||||
lcd_wcmd_data(0x21, y);
|
||||
lcd_wcmd(0x22);
|
||||
}
|
||||
|
||||
void lcd_init_device(void)
|
||||
{
|
||||
/* enable LCD clock */
|
||||
PWRCON &= ~(1 << 18);
|
||||
|
||||
/* configure LCD pins */
|
||||
PCON0 &= ~(3 << 8);
|
||||
PCON7 = (PCON7 & ~(0x000000FF)) | 0x00000033;
|
||||
PCON_ASRAM = 2;
|
||||
|
||||
lcd_reset();
|
||||
|
||||
/* detect LCD type on P0.4 */
|
||||
lcd_type = (PDAT0 & (1 << 4)) ? 1 : 2;
|
||||
|
||||
/* initialise display */
|
||||
if (lcd_type == 1) {
|
||||
lcd_init1();
|
||||
} else {
|
||||
lcd_init2();
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_update_rect(int x, int y, int width, int height)
|
||||
{
|
||||
fb_data* p;
|
||||
int h, w;
|
||||
|
||||
void* (*fbaddr)(int x, int y) = FB_CURRENTVP_BUFFER->get_address_fn;
|
||||
if (lcd_type == 1) {
|
||||
/* TODO implement and test */
|
||||
lcd_set_window1(x, y, width, height);
|
||||
lcd_set_position1(x, y);
|
||||
|
||||
for (h = 0; h < height; h++) {
|
||||
p = fbaddr(0,y);
|
||||
for (w = 0; w < LCD_WIDTH; w++) {
|
||||
while (LCD_STATUS & 0x10);
|
||||
LCD_WDATA = *p++;
|
||||
}
|
||||
y++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
lcd_set_window2(x, y, width, height);
|
||||
lcd_set_position2(x, y);
|
||||
|
||||
for (h = 0; h < height; h++) {
|
||||
p = fbaddr(x,y);
|
||||
for (w = 0; w < width; w++) {
|
||||
while (LCD_STATUS & 0x10);
|
||||
LCD_WDATA = *p++;
|
||||
}
|
||||
y++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_update(void)
|
||||
{
|
||||
lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
|
||||
}
|
||||
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 Bertrik Sikken
|
||||
*
|
||||
* 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 _NAND_TARGET_H_
|
||||
#define _NAND_TARGET_H_
|
||||
|
||||
#include "config.h"
|
||||
|
||||
void nand_ll_init(void);
|
||||
unsigned int nand_ll_read_id(int bank);
|
||||
|
||||
/* TODO later: create nand_ll_read/write/erase prototypes */
|
||||
|
||||
#endif /* _NAND_TARGET_H_ */
|
||||
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2009 Bertrik Sikken
|
||||
*
|
||||
* 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 <string.h>
|
||||
|
||||
#include "config.h"
|
||||
#include "s5l87xx.h"
|
||||
#include "nand-target.h"
|
||||
|
||||
/* Driver for the S5L8700 flash memory controller for low-level access to the
|
||||
NAND flash of the Samsung YP-S3.
|
||||
|
||||
The YP-S3 seems to use the pins P6.5 and P6.6 as chip selects in GPIO mode
|
||||
instead of using the regular pins P6.3 and P6.4.
|
||||
*/
|
||||
|
||||
#define FMSTAT_RBB (1<<0)
|
||||
#define FMSTAT_RBBDone (1<<1)
|
||||
#define FMSTAT_CMDDone (1<<2)
|
||||
#define FMSTAT_AddrDone (1<<3)
|
||||
#define FMSTAT_TransDone (1<<4)
|
||||
#define FMSTAT_WFIFO_HEMPTY (1<<5)
|
||||
#define FMSTAT_RFIFO_HFULL (1<<6)
|
||||
#define FMSTAT_WFIFO_EMPTY (1<<8)
|
||||
#define FMSTAT_RFIFO_FULL (1<<9)
|
||||
#define FMSTAT_EndECC (1<<10)
|
||||
|
||||
#define FMCTRL1_DoTransAddr (1<<0)
|
||||
#define FMCTRL1_DoReadData (1<<1)
|
||||
#define FMCTRL1_DoWriteData (1<<2)
|
||||
#define FMCTRL1_WriteREQSEL (1<<4)
|
||||
#define FMCTRL1_ClearSyndPtr (1<<5)
|
||||
#define FMCTRL1_ClearWFIFO (1<<6)
|
||||
#define FMCTRL1_ClearRFIFO (1<<7)
|
||||
#define FMCTRL1_ParityPtr (1<<8)
|
||||
#define FMCTRL1_SyndPtr (1<<9)
|
||||
|
||||
static void nand_chip_select(int bank)
|
||||
{
|
||||
unsigned int select;
|
||||
|
||||
select = (1 << bank);
|
||||
FMCTRL0 = 0x1821 | ((select & 3) << 1);
|
||||
PDAT6 = (PDAT6 & ~0x60) | ((~select & 0xC) << 3);
|
||||
}
|
||||
|
||||
void nand_ll_init(void)
|
||||
{
|
||||
/* enable flash memory controller */
|
||||
PWRCON &= ~(1 << 1);
|
||||
|
||||
/* P2.X is SMC I/O */
|
||||
PCON2 = 0x55555555;
|
||||
/* P4.1 = CLE, P4.4 = nWR, P4.5 = nRD */
|
||||
PCON4 = (PCON4 & ~0x00FF00F0) | 0x00550050;
|
||||
/* P6.0 = nf_rbn, P6.1 = smc_ce0, P6.2 = smc_ce1,
|
||||
P6.5 = smc_ce2 (as GPIO), P6.6 = smc_ce3 (as GPIO), P6.7 = ALE */
|
||||
PCON6 = (PCON6 & ~0xFFF00FFF) | 0x51100555;
|
||||
PDAT6 |= 0x60;
|
||||
}
|
||||
|
||||
unsigned int nand_ll_read_id(int bank)
|
||||
{
|
||||
unsigned int nand_id;
|
||||
|
||||
nand_chip_select(bank);
|
||||
|
||||
/* send "read id" command */
|
||||
FMCMD = 0x90;
|
||||
while ((FMCSTAT & FMSTAT_CMDDone) == 0);
|
||||
FMCSTAT = FMSTAT_CMDDone;
|
||||
|
||||
/* transfer address */
|
||||
FMANUM = 0;
|
||||
FMADDR0 = 0;
|
||||
FMCTRL1 = FMCTRL1_DoTransAddr;
|
||||
while ((FMCSTAT & FMSTAT_AddrDone) == 0);
|
||||
FMCSTAT = FMSTAT_AddrDone;
|
||||
|
||||
/* read back data */
|
||||
FMDNUM = 3;
|
||||
FMCTRL1 = FMCTRL1_DoReadData;
|
||||
while ((FMCSTAT & FMSTAT_TransDone) == 0);
|
||||
FMCSTAT = FMSTAT_TransDone;
|
||||
nand_id = FMFIFO;
|
||||
|
||||
/* clear read FIFO */
|
||||
FMCTRL1 = FMCTRL1_ClearRFIFO;
|
||||
|
||||
return nand_id;
|
||||
}
|
||||
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright © 2009 Bertrik Sikken
|
||||
*
|
||||
* 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 <stdbool.h>
|
||||
#include "config.h"
|
||||
#include "s5l87xx.h"
|
||||
#include "power.h"
|
||||
|
||||
/* Power handling for the S5L8700 based Samsung YP-S3
|
||||
|
||||
Pins involved in power management:
|
||||
* P0.1: stay powered up (even with the USB cable unplugged)
|
||||
* P1.1: USB power detect
|
||||
* P4.7: tuner power/enable
|
||||
* P5.2: unknown output
|
||||
* P5.3: unknown output, related to charging (perhaps charge current?)
|
||||
* P5.4: charge status input (only valid if charger enabled)
|
||||
* P5.6: charger enable
|
||||
*/
|
||||
|
||||
void power_off(void)
|
||||
{
|
||||
/* take down P0.1 to power off (plugged USB cable overrides this though) */
|
||||
PDAT0 &= ~(1 << 1);
|
||||
|
||||
while(1); /* wait for system to shut down */
|
||||
}
|
||||
|
||||
void power_init(void)
|
||||
{
|
||||
/* configure P0.1 as output for power-up and stay powered up */
|
||||
PCON0 = (PCON0 & ~(3 << 2)) | (1 << 2);
|
||||
PDAT0 |= (1 << 1);
|
||||
|
||||
/* configure P1.1 as input for USB power detect */
|
||||
PCON1 = (PCON1 & ~0x000000F0) | 0x00000000;
|
||||
|
||||
/* configure P4.7 as output for tuner power and turn power off */
|
||||
PCON4 = (PCON4 & ~0xF0000000) | 0x10000000;
|
||||
PDAT4 &= ~(1 << 7);
|
||||
|
||||
/* configure P5.2 / P5.3 / P5.6 as output, P5.4 as input */
|
||||
PCON5 = (PCON5 & ~0x0F0FFF00) | 0x01001100;
|
||||
PDAT5 &= ~((1 << 2) | (1 << 3) | (1 << 6));
|
||||
}
|
||||
|
||||
#if CONFIG_CHARGING
|
||||
unsigned int power_input_status(void)
|
||||
{
|
||||
/* check USB power on P1.1 */
|
||||
if (PDAT1 & (1 << 1)) {
|
||||
return POWER_INPUT_USB;
|
||||
}
|
||||
|
||||
return POWER_INPUT_NONE;
|
||||
}
|
||||
|
||||
bool charging_state(void)
|
||||
{
|
||||
/* check if charger is enabled */
|
||||
if (PDAT5 & (1 << 6)) {
|
||||
/* check if charging is busy */
|
||||
return (PDAT5 & (1 << 4));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif /* CONFIG_CHARGING */
|
||||
|
||||
#if CONFIG_TUNER
|
||||
bool tuner_power(bool status)
|
||||
{
|
||||
if (status) {
|
||||
PDAT4 |= (1 << 7);
|
||||
}
|
||||
else {
|
||||
PDAT4 &= ~(1 << 7);
|
||||
}
|
||||
/* TODO what should we return here? */
|
||||
return status;
|
||||
}
|
||||
|
||||
bool tuner_powered(void)
|
||||
{
|
||||
return (PDAT4 & (1 << 7));
|
||||
}
|
||||
#endif /* CONFIG_TUNER */
|
||||
|
||||
|
|
@ -237,13 +237,6 @@
|
|||
#define UI_LCD_POSX 129 /* x position of lcd */
|
||||
#define UI_LCD_POSY 85 /* y position of lcd */
|
||||
|
||||
#elif defined(MEIZU_M6SL)
|
||||
#define UI_TITLE "Meizu M6"
|
||||
#define UI_WIDTH 512 /* width of GUI window */
|
||||
#define UI_HEIGHT 322 /* height of GUI window */
|
||||
#define UI_LCD_POSX 39 /* x position of lcd */
|
||||
#define UI_LCD_POSY 38 /* y position of lcd */
|
||||
|
||||
#elif defined(SANSA_FUZEPLUS)
|
||||
#define UI_TITLE "Sansa Fuze+"
|
||||
#define UI_WIDTH 322 /* width of GUI window */
|
||||
|
|
|
|||
|
|
@ -207,18 +207,6 @@ $releasenotes="/wiki/ReleaseNotes400";
|
|||
name => 'Mini 2440',
|
||||
status => 1,
|
||||
},
|
||||
'meizum3' => {
|
||||
name => 'Meizu M3',
|
||||
status => 1,
|
||||
},
|
||||
'meizum6sl' => {
|
||||
name => 'Meizu M6SL',
|
||||
status => 1,
|
||||
},
|
||||
'meizum6sp' => {
|
||||
name => 'Meizu M6SP',
|
||||
status => 1,
|
||||
},
|
||||
'mrobe100' => {
|
||||
name => 'Olympus M-Robe 100',
|
||||
status => 3,
|
||||
|
|
@ -276,10 +264,6 @@ $releasenotes="/wiki/ReleaseNotes400";
|
|||
sim => 0,
|
||||
status => 2,
|
||||
},
|
||||
'samsungyps3' => {
|
||||
name => 'Samsung YP-S3',
|
||||
status => 1,
|
||||
},
|
||||
'sansac200' => {
|
||||
name => 'SanDisk Sansa c200',
|
||||
status => 3,
|
||||
|
|
|
|||
172
tools/configure
vendored
172
tools/configure
vendored
|
|
@ -566,13 +566,6 @@ arm9tdmicc () {
|
|||
endian="little"
|
||||
}
|
||||
|
||||
arm940tbecc () {
|
||||
findarmgcc
|
||||
GCCOPTS="$CCOPTS -mbig-endian -mcpu=arm940t"
|
||||
GCCOPTIMIZE="-fomit-frame-pointer"
|
||||
endian="big"
|
||||
}
|
||||
|
||||
arm940tcc () {
|
||||
findarmgcc
|
||||
GCCOPTS="$CCOPTS -mcpu=arm940t"
|
||||
|
|
@ -1703,48 +1696,43 @@ cat <<EOF
|
|||
HDD1830 92) Zen Vision 63) Sansa Fuze v2
|
||||
102) GoGear HDD6330 93) Zen X-Fi2 64) Sansa Fuze+
|
||||
94) Zen X-Fi3 65) Sansa Clip Zip
|
||||
==Meizu== 95) Zen V 66) Sansa Connect
|
||||
110) M6SL 96) Zen X-Fi
|
||||
111) M6SP 97) Zen Mozaic ==Lyre project==
|
||||
112) M3 98) Zen 130) Lyre proto 1
|
||||
131) Mini2440
|
||||
==Samsung== ==Onda==
|
||||
140) YH-820 120) VX747 ==Packard Bell==
|
||||
141) YH-920 122) VX747+ 160) Vibe 500
|
||||
142) YH-925 121) VX767
|
||||
143) YP-S3 123) VX777 ==ROCKCHIP==
|
||||
144) YP-R0 180) rk27xx generic
|
||||
145) YP-R1 (WIP) ==MPIO==
|
||||
170) HD200 ==HiFi E.T.==
|
||||
==HiFiMAN== 171) HD300 210) MA9
|
||||
190) HM-60x 211) MA9C
|
||||
191) HM-801 ==Application== 212) MA8
|
||||
200) SDL (Generic) 213) MA8C
|
||||
==Sony== 201) Android (ARM)
|
||||
219) NWZ-E350 series 202) Android (MIPS) ==IHIFI==
|
||||
220) NWZ-E370/E380 series 203) Android (x86) 230) 760
|
||||
221) NWZ-E360 series 209) Anbernic RG Nano 231) 770
|
||||
222) NWZ-E450 series 232) 770C
|
||||
223) NWZ-E460 series 233) 800
|
||||
224) NWZ-E470 series 234) 960
|
||||
225) NWZ-E580 series
|
||||
226) NWZ-A10 series ==AgpTek== ==AIGO==
|
||||
227) NW-A20 series 240) Rocker 245) Eros Q / K (hosted)
|
||||
228) NWZ-A860 series 247) Eros Q / K native
|
||||
229) NWZ-S750 series ==iBasso== (hw1/hw2 bl, all hw rb)
|
||||
250) DX50 248) Eros Q / K native
|
||||
==FiiO== 251) DX90 (hw3 bl only)
|
||||
244) M3K Linux 249) Eros Q / K native
|
||||
246) M3K baremetal ==xDuoo== (hw4 bl only)
|
||||
241) X3
|
||||
==Shanling== 242) X3II ==HiBy==
|
||||
260) Q1 243) X20 300) R3 Pro II
|
||||
301) R1
|
||||
==Echo project== ==Surfans==
|
||||
270) Echo R1 (WIP) 280) F28 (WIP)
|
||||
==Samsung== 95) Zen V 66) Sansa Connect
|
||||
140) YH-820 96) Zen X-Fi
|
||||
141) YH-920 97) Zen Mozaic ==Lyre project==
|
||||
142) YH-925 98) Zen 130) Lyre proto 1
|
||||
144) YP-R0 131) Mini2440
|
||||
145) YP-R1 (WIP) ==Onda==
|
||||
120) VX747 ==Packard Bell==
|
||||
==HiFiMAN== 122) VX747+ 160) Vibe 500
|
||||
190) HM-60x 121) VX767
|
||||
191) HM-801 123) VX777 ==ROCKCHIP==
|
||||
180) rk27xx generic
|
||||
==Sony== ==MPIO==
|
||||
219) NWZ-E350 series 170) HD200 ==HiFi E.T.==
|
||||
220) NWZ-E370/E380 series 171) HD300 210) MA9
|
||||
221) NWZ-E360 series 211) MA9C
|
||||
222) NWZ-E450 series ==Application== 212) MA8
|
||||
223) NWZ-E460 series 200) SDL (Generic) 213) MA8C
|
||||
224) NWZ-E470 series 201) Android (ARM)
|
||||
225) NWZ-E580 series 202) Android (MIPS) ==IHIFI==
|
||||
226) NWZ-A10 series 203) Android (x86) 230) 760
|
||||
227) NW-A20 series 209) Anbernic RG Nano 231) 770
|
||||
228) NWZ-A860 series 232) 770C
|
||||
229) NWZ-S750 series ==AgpTek== 233) 800
|
||||
240) Rocker 234) 960
|
||||
==FiiO==
|
||||
244) M3K Linux ==iBasso== ==AIGO==
|
||||
246) M3K baremetal 250) DX50 245) Eros Q / K (hosted)
|
||||
251) DX90 247) Eros Q / K native
|
||||
==Shanling== (hw1/hw2 bl, all hw rb)
|
||||
260) Q1 ==xDuoo== 248) Eros Q / K native
|
||||
241) X3 (hw3 bl only)
|
||||
==Echo project== 242) X3II 249) Eros Q / K native
|
||||
270) Echo R1 (WIP) 243) X20 (hw4 bl only)
|
||||
|
||||
==Nintendo==
|
||||
290) Nintendo 3DS (WIP)
|
||||
==Nintendo== ==Surfans== ==HiBy==
|
||||
290) Nintendo 3DS (WIP) 280) F28 (WIP) 300) R3 Pro II
|
||||
301) R1
|
||||
|
||||
EOF
|
||||
|
||||
|
|
@ -1760,7 +1748,7 @@ fi
|
|||
ipodbitmaptools="$toolset scramble bmp2rb"
|
||||
gigabeatbitmaptools="$toolset scramble descramble bmp2rb"
|
||||
tccbitmaptools="$toolset scramble bmp2rb"
|
||||
# generic is used by IFP, Meizu and Onda
|
||||
# generic is used by IFP and Onda
|
||||
genericbitmaptools="$toolset bmp2rb"
|
||||
# scramble is used by all other targets
|
||||
scramblebitmaptools="$genericbitmaptools scramble"
|
||||
|
|
@ -2974,71 +2962,6 @@ fi
|
|||
t_model="hdd6330"
|
||||
;;
|
||||
|
||||
110|meizum6sl)
|
||||
target_id=49
|
||||
modelname="meizum6sl"
|
||||
blonly="yes"
|
||||
target="MEIZU_M6SL"
|
||||
memory=16 # always
|
||||
arm940tbecc
|
||||
tool="cp"
|
||||
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
|
||||
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
|
||||
output="rockbox.meizu"
|
||||
appextra="recorder:gui:radio"
|
||||
plugins="no" #FIXME
|
||||
toolset=$genericbitmaptools
|
||||
boottool="cp"
|
||||
bootoutput="rockboot.ebn"
|
||||
# architecture, manufacturer and model for the target-tree build
|
||||
t_cpu="arm"
|
||||
t_manufacturer="s5l8700"
|
||||
t_model="meizu-m6sl"
|
||||
;;
|
||||
|
||||
111|meizum6sp)
|
||||
target_id=46
|
||||
modelname="meizum6sp"
|
||||
blonly="yes"
|
||||
target="MEIZU_M6SP"
|
||||
memory=16 # always
|
||||
arm940tbecc
|
||||
tool="cp"
|
||||
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
|
||||
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
|
||||
output="rockbox.meizu"
|
||||
appextra="recorder:gui:radio"
|
||||
plugins="no" #FIXME
|
||||
toolset=$genericbitmaptools
|
||||
boottool="cp"
|
||||
bootoutput="rockboot.ebn"
|
||||
# architecture, manufacturer and model for the target-tree build
|
||||
t_cpu="arm"
|
||||
t_manufacturer="s5l8700"
|
||||
t_model="meizu-m6sp"
|
||||
;;
|
||||
|
||||
112|meizum3)
|
||||
target_id=47
|
||||
modelname="meizum3"
|
||||
target="MEIZU_M3"
|
||||
memory=16 # always
|
||||
arm940tbecc
|
||||
tool="cp"
|
||||
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
|
||||
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
|
||||
output="rockbox.meizu"
|
||||
appextra="recorder:gui:radio"
|
||||
plugins="no" #FIXME
|
||||
toolset=$genericbitmaptools
|
||||
boottool="cp"
|
||||
bootoutput="rockboot.ebn"
|
||||
# architecture, manufacturer and model for the target-tree build
|
||||
t_cpu="arm"
|
||||
t_manufacturer="s5l8700"
|
||||
t_model="meizu-m3"
|
||||
;;
|
||||
|
||||
120|ondavx747)
|
||||
target_id=45
|
||||
modelname="ondavx747"
|
||||
|
|
@ -3237,27 +3160,6 @@ fi
|
|||
t_model="yh925"
|
||||
;;
|
||||
|
||||
143|samsungyps3)
|
||||
target_id=72
|
||||
modelname="samsungyps3"
|
||||
target="SAMSUNG_YPS3"
|
||||
memory=16 # always
|
||||
arm940tbecc
|
||||
tool="cp"
|
||||
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
|
||||
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
|
||||
output="rockbox.yps3"
|
||||
appextra="recorder:gui:radio"
|
||||
plugins="no" #FIXME
|
||||
toolset=$genericbitmaptools
|
||||
boottool="cp"
|
||||
bootoutput="rockboot.ebn"
|
||||
# architecture, manufacturer and model for the target-tree build
|
||||
t_cpu="arm"
|
||||
t_manufacturer="s5l8700"
|
||||
t_model="yps3"
|
||||
;;
|
||||
|
||||
160|vibe500)
|
||||
target_id=67
|
||||
modelname="vibe500"
|
||||
|
|
|
|||
|
|
@ -35,8 +35,6 @@ cowon-d2.c
|
|||
creative-zvm.c
|
||||
#elif CONFIG_KEYPAD == CREATIVEZV_PAD
|
||||
creative-zv.c
|
||||
#elif CONFIG_KEYPAD == MEIZU_M6SL_PAD
|
||||
meizu-m6sl.c
|
||||
#elif CONFIG_KEYPAD == PHILIPS_SA9200_PAD
|
||||
gogear-sa9200.c
|
||||
#elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
CFLAGS = -W -Wall
|
||||
LDFLAGS = -lusb
|
||||
|
||||
all: meizu_dfu
|
||||
|
||||
meizu_dfu: meizu_dfu.c
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
rm -f meizu_dfu
|
||||
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
Meizu DFU tool for Linux
|
||||
|
||||
This tool can restore the firmware on M3, M6 SP, M6 TP and M6 SL.
|
||||
It can also run a single provided file from RAM.
|
||||
|
||||
Notes:
|
||||
1. SST39VF800.dfu is taken from the official dfu tool provided by Meizu.
|
||||
2. updateNAND_BE_070831.dfu is taken from the unofficial dfu tool for M6 SL.
|
||||
3. To compile, just run `make'.
|
||||
|
|
@ -1,441 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2008 by William Poetra Yoga Hadisoeseno and Frank Gevaerts
|
||||
*
|
||||
* 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 <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <libgen.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#include <usb.h>
|
||||
|
||||
#define bswap_16(value) \
|
||||
((((value) & 0xff) << 8) | ((value) >> 8))
|
||||
|
||||
#define bswap_32(value) \
|
||||
(((uint32_t)bswap_16((uint16_t)((value) & 0xffff)) << 16) | \
|
||||
(uint32_t)bswap_16((uint16_t)((value) >> 16)))
|
||||
|
||||
#define host_to_le32(_x) bswap_32(htonl(_x))
|
||||
#define host_to_le16(_x) bswap_16(htons(_x))
|
||||
|
||||
void usage()
|
||||
{
|
||||
fprintf(stderr, "usage: meizu_dfu m3 [SST39VF800.dfu] <M3.EBN>\n");
|
||||
fprintf(stderr, " meizu_dfu m6 [SST39VF800.dfu] <M6.EBN>\n");
|
||||
fprintf(stderr, " meizu_dfu m6sl [updateNAND_BE_070831.dfu] <M6SL.EBN>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
uint32_t crc32(char *data, int len, uint32_t poly, uint32_t init)
|
||||
{
|
||||
uint32_t crc_table[256];
|
||||
uint32_t crc, t;
|
||||
int i, j;
|
||||
|
||||
// generate the table
|
||||
for (i = 0; i < 256; ++i) {
|
||||
t = i;
|
||||
for (j = 0; j < 8; ++j)
|
||||
if (t & 1)
|
||||
t = (t >> 1) ^ poly;
|
||||
else
|
||||
t >>= 1;
|
||||
crc_table[i] = t;
|
||||
}
|
||||
|
||||
// calculate the crc
|
||||
crc = init;
|
||||
for (i = 0; i < len; ++i)
|
||||
crc = (crc >> 8) ^ crc_table[(crc^data[i]) & 0xff];
|
||||
|
||||
return crc;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
char *data;
|
||||
int len;
|
||||
} image_data_t;
|
||||
|
||||
typedef struct {
|
||||
int delay;
|
||||
int pre_off;
|
||||
uint32_t pre_sig;
|
||||
uint16_t suf_dev;
|
||||
uint16_t suf_prod;
|
||||
uint16_t suf_ven;
|
||||
uint16_t suf_dfu;
|
||||
char suf_sig[3];
|
||||
uint8_t suf_len;
|
||||
} image_attr_t;
|
||||
|
||||
#define BLOCK_SIZE 2048
|
||||
#define DFU_TIMEOUT 0xa000
|
||||
#define DFU_CRC_POLY 0xedb88320
|
||||
#define DFU_INIT_CRC 0xffffffff
|
||||
|
||||
#define USB_VID_SAMSUNG 0x0419
|
||||
#define USB_PID_M6SL 0x0145
|
||||
#define USB_PID_M3_M6 0x0141
|
||||
|
||||
void init_img(image_data_t *img, const char *filename, image_attr_t *attr)
|
||||
{
|
||||
int fd, len, i, readlen;
|
||||
struct stat statbuf;
|
||||
char buf[BLOCK_SIZE];
|
||||
uint32_t dfu_crc;
|
||||
uint32_t le_len;
|
||||
|
||||
printf("Reading %s...", filename);
|
||||
|
||||
if (stat(filename, &statbuf) < 0) {
|
||||
printf("\nCould not stat file, exiting.\n");
|
||||
exit(1);
|
||||
}
|
||||
len = statbuf.st_size;
|
||||
|
||||
img->name = basename(strdup(filename));
|
||||
img->data = malloc(len + 16);
|
||||
img->len = len + 16;
|
||||
|
||||
fd = open(filename, O_RDONLY);
|
||||
for (i = 0; i < len; i += BLOCK_SIZE) {
|
||||
readlen = ((len - i) < BLOCK_SIZE) ? (len - i) : BLOCK_SIZE;
|
||||
read(fd, buf, readlen);
|
||||
memcpy(img->data + i, buf, readlen);
|
||||
}
|
||||
close(fd);
|
||||
|
||||
le_len = host_to_le32(img->len);
|
||||
// patch the data size in after the signature
|
||||
memcpy(img->data + attr->pre_off + 4, &le_len, 4);
|
||||
|
||||
/* convert to little endian */
|
||||
attr->suf_dev = host_to_le16(attr->suf_dev);
|
||||
attr->suf_prod = host_to_le16(attr->suf_prod);
|
||||
attr->suf_ven = host_to_le16(attr->suf_ven);
|
||||
attr->suf_dfu = host_to_le16(attr->suf_dfu);
|
||||
|
||||
// append the suffix (excluding the checksum)
|
||||
memcpy(img->data + len, &attr->suf_dev, 2);
|
||||
memcpy(img->data + len + 2, &attr->suf_prod, 2);
|
||||
memcpy(img->data + len + 4, &attr->suf_ven, 2);
|
||||
memcpy(img->data + len + 6, &attr->suf_dfu, 2);
|
||||
memcpy(img->data + len + 8, &attr->suf_sig, 3);
|
||||
memcpy(img->data + len + 11, &attr->suf_len, 1);
|
||||
|
||||
dfu_crc = host_to_le32(crc32(img->data, len + 12, DFU_CRC_POLY, DFU_INIT_CRC));
|
||||
memcpy(img->data + len + 12, &dfu_crc, 4);
|
||||
|
||||
#if 0
|
||||
FILE *f = fopen(img->name, "w");
|
||||
fwrite(img->data, len + 16, 1, f);
|
||||
fclose(f);
|
||||
#endif
|
||||
|
||||
printf("OK\n");
|
||||
}
|
||||
|
||||
usb_dev_handle *usb_dev_open(uint16_t dfu_vid, uint16_t dfu_pid)
|
||||
{
|
||||
struct usb_bus *bus;
|
||||
struct usb_device *dev;
|
||||
usb_dev_handle *device;
|
||||
|
||||
printf("USB initialization...");
|
||||
|
||||
usb_init();
|
||||
usb_find_busses();
|
||||
usb_find_devices();
|
||||
|
||||
for (bus = usb_get_busses(); bus != NULL; bus = bus->next)
|
||||
for (dev = bus->devices; dev != NULL; dev = dev->next)
|
||||
if (dev->descriptor.idVendor == dfu_vid
|
||||
&& dev->descriptor.idProduct == dfu_pid)
|
||||
goto found;
|
||||
|
||||
printf("\nNo device found, exiting.\n");
|
||||
exit(1);
|
||||
|
||||
found:
|
||||
printf(" Device found.\n");
|
||||
device = usb_open(dev);
|
||||
usb_claim_interface(device, 0);
|
||||
return device;
|
||||
}
|
||||
|
||||
void usb_mimic_windows(usb_dev_handle *device)
|
||||
{
|
||||
char data[1024];
|
||||
|
||||
usb_control_msg(device, 0x80, 0x06, 0x0100, 0x0000, data, 0x0012, DFU_TIMEOUT);
|
||||
usb_control_msg(device, 0x80, 0x06, 0x0200, 0x0000, data, 0x0009, DFU_TIMEOUT);
|
||||
usb_control_msg(device, 0x80, 0x06, 0x0200, 0x0000, data, 0x001b, DFU_TIMEOUT);
|
||||
usb_control_msg(device, 0x80, 0x06, 0x0100, 0x0000, data, 0x0040, DFU_TIMEOUT);
|
||||
usb_control_msg(device, 0x80, 0x06, 0x0100, 0x0000, data, 0x0012, DFU_TIMEOUT);
|
||||
usb_control_msg(device, 0x80, 0x06, 0x0200, 0x0000, data, 0x0009, DFU_TIMEOUT);
|
||||
usb_control_msg(device, 0x80, 0x06, 0x0300, 0x0000, data, 0x00ff, DFU_TIMEOUT);
|
||||
usb_control_msg(device, 0x80, 0x06, 0x0303, 0x0409, data, 0x00ff, DFU_TIMEOUT);
|
||||
usb_control_msg(device, 0x80, 0x06, 0x0200, 0x0000, data, 0x00ff, DFU_TIMEOUT);
|
||||
usb_control_msg(device, 0x80, 0x06, 0x0300, 0x0000, data, 0x00ff, DFU_TIMEOUT);
|
||||
usb_control_msg(device, 0x80, 0x06, 0x0302, 0x0409, data, 0x00ff, DFU_TIMEOUT);
|
||||
usb_control_msg(device, 0x80, 0x06, 0x0300, 0x0000, data, 0x00ff, DFU_TIMEOUT);
|
||||
usb_control_msg(device, 0x80, 0x06, 0x0302, 0x0409, data, 0x00ff, DFU_TIMEOUT);
|
||||
usb_control_msg(device, 0x80, 0x06, 0x0100, 0x0000, data, 0x0012, DFU_TIMEOUT);
|
||||
usb_control_msg(device, 0x80, 0x06, 0x0200, 0x0000, data, 0x0209, DFU_TIMEOUT);
|
||||
}
|
||||
|
||||
void usb_dev_close(usb_dev_handle *device)
|
||||
{
|
||||
printf("Releasing interface...");
|
||||
|
||||
usb_release_interface(device, 0);
|
||||
|
||||
printf(" OK\n");
|
||||
}
|
||||
|
||||
enum DFU_REQUEST {
|
||||
DFU_DETACH = 0,
|
||||
DFU_DOWNLOAD,
|
||||
DFU_UPLOAD,
|
||||
DFU_GETSTATUS,
|
||||
DFU_CLRSTATUS,
|
||||
DFU_GETSTATE,
|
||||
DFU_ABORT
|
||||
};
|
||||
|
||||
void get_cpu(usb_dev_handle *device)
|
||||
{
|
||||
char data[64];
|
||||
int req_out_if = USB_ENDPOINT_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE;
|
||||
int len;
|
||||
|
||||
printf("GET CPU");
|
||||
|
||||
// check for "S5L8700 Rev.1"
|
||||
len = usb_control_msg(device, req_out_if, 0xff, 0x0002, 0, data, 0x003f, DFU_TIMEOUT);
|
||||
if (len < 0) {
|
||||
printf("\nError trying to get CPU model, exiting.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
memset(data + len, 0, 64 - len);
|
||||
printf(", got: %s\n", data);
|
||||
}
|
||||
|
||||
void send_file(usb_dev_handle *device, image_data_t *img)
|
||||
{
|
||||
char dfu_ret[6];
|
||||
char *data;
|
||||
int req_out_if = USB_ENDPOINT_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE;
|
||||
int req_in_if = USB_ENDPOINT_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE;
|
||||
int len, idx, writelen, i;
|
||||
|
||||
printf("Sending %s... ", img->name);
|
||||
|
||||
len = img->len;
|
||||
data = img->data;
|
||||
|
||||
// loop for the file
|
||||
for (i = 0, idx = 0; i < len; i += BLOCK_SIZE, ++idx) {
|
||||
writelen = ((len - i) < BLOCK_SIZE) ? (len - i) : BLOCK_SIZE;
|
||||
usb_control_msg(device, req_out_if, DFU_DOWNLOAD, idx, 0, data + i, writelen, DFU_TIMEOUT);
|
||||
dfu_ret[4] = 0x00;
|
||||
while (dfu_ret[4] != 0x05)
|
||||
usb_control_msg(device, req_in_if, DFU_GETSTATUS, 0, 0, dfu_ret, 6, DFU_TIMEOUT);
|
||||
printf("#");
|
||||
}
|
||||
|
||||
usb_control_msg(device, req_out_if, DFU_DOWNLOAD, idx, 0, NULL, 0, DFU_TIMEOUT);
|
||||
dfu_ret[4] = 0x00;
|
||||
while (dfu_ret[4] != 0x07)
|
||||
usb_control_msg(device, req_in_if, DFU_GETSTATUS, 0, 0, dfu_ret, 6, DFU_TIMEOUT);
|
||||
|
||||
printf(" OK\n");
|
||||
}
|
||||
|
||||
void clear_status(usb_dev_handle *device)
|
||||
{
|
||||
char dfu_ret[6];
|
||||
int usb_in_if = USB_ENDPOINT_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE;
|
||||
int usb_out_if = USB_ENDPOINT_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE;
|
||||
|
||||
printf("Clearing status...");
|
||||
|
||||
dfu_ret[4] = 0x00;
|
||||
while (dfu_ret[4] != 0x08)
|
||||
usb_control_msg(device, usb_in_if, DFU_GETSTATUS, 0, 0, dfu_ret, 6, DFU_TIMEOUT);
|
||||
usb_control_msg(device, usb_out_if, DFU_CLRSTATUS, 0, 0, NULL, 0, DFU_TIMEOUT);
|
||||
|
||||
printf(" OK\n");
|
||||
}
|
||||
|
||||
void dfu_detach(usb_dev_handle *device)
|
||||
{
|
||||
char usb_ret[4];
|
||||
int usb_in_oth = USB_ENDPOINT_IN | USB_TYPE_CLASS | USB_RECIP_OTHER;
|
||||
int usb_out_oth = USB_ENDPOINT_OUT | USB_TYPE_CLASS | USB_RECIP_OTHER;
|
||||
|
||||
printf("Detaching...");
|
||||
|
||||
usb_control_msg(device, usb_in_oth, DFU_DETACH, 0x0000, 3, usb_ret, 4, DFU_TIMEOUT);
|
||||
usb_control_msg(device, usb_out_oth, DFU_DOWNLOAD, 0x0010, 3, NULL, 0, DFU_TIMEOUT);
|
||||
usb_control_msg(device, usb_in_oth, DFU_DETACH, 0x0000, 3, usb_ret, 4, DFU_TIMEOUT);
|
||||
usb_control_msg(device, usb_in_oth, DFU_DETACH, 0x0000, 3, usb_ret, 4, DFU_TIMEOUT);
|
||||
usb_control_msg(device, usb_in_oth, DFU_DETACH, 0x0000, 3, usb_ret, 4, DFU_TIMEOUT);
|
||||
usb_control_msg(device, usb_in_oth, DFU_DETACH, 0x0000, 3, usb_ret, 4, DFU_TIMEOUT);
|
||||
usb_control_msg(device, usb_in_oth, DFU_DETACH, 0x0000, 3, usb_ret, 4, DFU_TIMEOUT);
|
||||
|
||||
printf(" OK\n");
|
||||
}
|
||||
|
||||
void dfu_m3_m6(char *file1, char *file2)
|
||||
{
|
||||
image_data_t img1, img2;
|
||||
image_attr_t attr1, attr2;
|
||||
usb_dev_handle *device;
|
||||
|
||||
attr1.delay = 1000;
|
||||
attr1.pre_off = 0x20;
|
||||
attr1.pre_sig = 0x44465543;
|
||||
attr1.suf_dev = 0x0100;
|
||||
attr1.suf_prod = 0x0140;
|
||||
attr1.suf_ven = 0x0419;
|
||||
attr1.suf_dfu = 0x0100;
|
||||
memcpy(attr1.suf_sig, "RON", 3);
|
||||
attr1.suf_len = 0x10;
|
||||
|
||||
init_img(&img1, file1, &attr1);
|
||||
|
||||
if (file2) {
|
||||
attr2.delay = 1000;
|
||||
attr2.pre_off = 0x20;
|
||||
attr2.pre_sig = 0x44465543;
|
||||
attr2.suf_dev = 0x0100;
|
||||
attr2.suf_prod = 0x0140;
|
||||
attr2.suf_ven = 0x0419;
|
||||
attr2.suf_dfu = 0x0100;
|
||||
memcpy(attr2.suf_sig, "UFD", 3);
|
||||
attr2.suf_len = 0x10;
|
||||
|
||||
init_img(&img2, file2, &attr2);
|
||||
}
|
||||
|
||||
device = usb_dev_open(USB_VID_SAMSUNG, USB_PID_M3_M6);
|
||||
// usb_mimic_windows();
|
||||
get_cpu(device);
|
||||
get_cpu(device);
|
||||
send_file(device, &img1);
|
||||
|
||||
if (file2) {
|
||||
printf("Wait a sec (literally)...");
|
||||
sleep(1);
|
||||
printf(" OK\n");
|
||||
|
||||
clear_status(device);
|
||||
get_cpu(device);
|
||||
send_file(device, &img2);
|
||||
dfu_detach(device);
|
||||
}
|
||||
|
||||
usb_dev_close(device);
|
||||
}
|
||||
|
||||
void dfu_m6sl(char *file1, char *file2)
|
||||
{
|
||||
image_data_t img1, img2;
|
||||
image_attr_t attr1, attr2;
|
||||
usb_dev_handle *device;
|
||||
|
||||
attr1.delay = 1000;
|
||||
attr1.pre_off = 0x20;
|
||||
attr1.pre_sig = 0x44465543;
|
||||
attr1.suf_dev = 0x0100;
|
||||
attr1.suf_prod = 0x0140;
|
||||
attr1.suf_ven = 0x0419;
|
||||
attr1.suf_dfu = 0x0100;
|
||||
memcpy(attr1.suf_sig, "UFD", 3);
|
||||
attr1.suf_len = 0x10;
|
||||
|
||||
init_img(&img1, file1, &attr1);
|
||||
|
||||
if (file2) {
|
||||
attr2.delay = 1000;
|
||||
attr2.pre_off = 0x20;
|
||||
attr2.pre_sig = 0x44465543;
|
||||
attr2.suf_dev = 0x0100;
|
||||
attr2.suf_prod = 0x0140;
|
||||
attr2.suf_ven = 0x0419;
|
||||
attr2.suf_dfu = 0x0100;
|
||||
memcpy(attr2.suf_sig, "UFD", 3);
|
||||
attr2.suf_len = 0x10;
|
||||
|
||||
init_img(&img2, file2, &attr2);
|
||||
}
|
||||
|
||||
device = usb_dev_open(USB_VID_SAMSUNG, USB_PID_M6SL);
|
||||
get_cpu(device);
|
||||
get_cpu(device);
|
||||
send_file(device, &img1);
|
||||
|
||||
if (file2) {
|
||||
printf("Wait a sec (literally)...");
|
||||
sleep(1);
|
||||
printf(" OK\n");
|
||||
usb_dev_close(device);
|
||||
|
||||
device = usb_dev_open(USB_VID_SAMSUNG, USB_PID_M6SL);
|
||||
get_cpu(device);
|
||||
get_cpu(device);
|
||||
send_file(device, &img2);
|
||||
dfu_detach(device);
|
||||
}
|
||||
|
||||
usb_dev_close(device);
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (argc < 3 || argc > 4)
|
||||
usage();
|
||||
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
|
||||
char *second_file = (argc == 4) ? argv[3] : NULL;
|
||||
|
||||
if (!strcmp(argv[1], "m3"))
|
||||
dfu_m3_m6(argv[2], second_file);
|
||||
else if (!strcmp(argv[1], "m6"))
|
||||
dfu_m3_m6(argv[2], second_file);
|
||||
else if (!strcmp(argv[1], "m6sl"))
|
||||
dfu_m6sl(argv[2], second_file);
|
||||
else
|
||||
usage();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -589,33 +589,6 @@ lyreproto1
|
|||
record : no
|
||||
}
|
||||
|
||||
meizum3
|
||||
{
|
||||
name : Meizu M3
|
||||
screen : 176 x 132 @ rgb
|
||||
remote : no
|
||||
fm : yes
|
||||
record : no
|
||||
}
|
||||
|
||||
meizum6sl
|
||||
{
|
||||
name : Meizu M6SL
|
||||
screen : 320 x 240 @ rgb
|
||||
remote : no
|
||||
fm : yes
|
||||
record : no
|
||||
}
|
||||
|
||||
meizum6sp
|
||||
{
|
||||
name : Meizu M6SP
|
||||
screen : 240 x 320 @ rgb
|
||||
remote : no
|
||||
fm : yes
|
||||
record : no
|
||||
}
|
||||
|
||||
mini2440
|
||||
{
|
||||
name : Mini 2440
|
||||
|
|
@ -688,15 +661,6 @@ samsungypr0
|
|||
record : no
|
||||
}
|
||||
|
||||
samsungyps3
|
||||
{
|
||||
name : Samsung YP-S3
|
||||
screen : 176 x 220 @ rgb
|
||||
remote : no
|
||||
fm : yes
|
||||
record : no
|
||||
}
|
||||
|
||||
sansac100
|
||||
{
|
||||
name : SanDisk Sansa c100
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue