forked from len0rd/rockbox
MPIO HD300 - initial commit
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28680 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
608bc4ed4b
commit
9a24892e2e
21 changed files with 1344 additions and 12 deletions
|
@ -303,6 +303,8 @@ keymaps/keymap-mini2440.c
|
|||
keymaps/keymap-vibe500.c
|
||||
#elif CONFIG_KEYPAD == MPIO_HD200_PAD
|
||||
keymaps/keymap-mpio-hd200.c
|
||||
#elif CONFIG_KEYPAD == MPIO_HD300_PAD
|
||||
keymaps/keymap-mpio-hd300.c
|
||||
#elif CONFIG_KEYPAD == ANDROID_PAD
|
||||
keymaps/keymap-android.c
|
||||
#elif CONFIG_KEYPAD == SDL_PAD
|
||||
|
|
|
@ -1893,7 +1893,7 @@ static bool dbg_save_roms(void)
|
|||
fd = creat("/internal_rom_000000-3FFFFF.bin", 0666);
|
||||
#elif defined(IAUDIO_X5) || defined(IAUDIO_M5) || defined(IAUDIO_M3)
|
||||
fd = creat("/internal_rom_000000-3FFFFF.bin", 0666);
|
||||
#elif defined(MPIO_HD200)
|
||||
#elif defined(MPIO_HD200) || defined(MPIO_HD300)
|
||||
fd = creat("/internal_rom_000000-1FFFFF.bin", 0666);
|
||||
#endif
|
||||
if(fd >= 0)
|
||||
|
|
252
apps/keymaps/keymap-mpio-hd300.c
Normal file
252
apps/keymaps/keymap-mpio-hd300.c
Normal file
|
@ -0,0 +1,252 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id:$
|
||||
*
|
||||
* Copyright (C) 2010 Marcin Bukat
|
||||
*
|
||||
* 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 "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
|
||||
*/
|
||||
|
||||
/*****************************************************************************
|
||||
* Main control mappings
|
||||
*****************************************************************************/
|
||||
|
||||
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_OK, BUTTON_ENTER|BUTTON_REL, BUTTON_ENTER },
|
||||
{ ACTION_STD_CANCEL, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
|
||||
{ ACTION_STD_CONTEXT, BUTTON_ENTER|BUTTON_REPEAT, BUTTON_ENTER },
|
||||
{ ACTION_STD_MENU, BUTTON_MENU|BUTTON_REPEAT, BUTTON_MENU },
|
||||
/* { ACTION_STD_QUICKSCREEN, BUTTON_, BUTTON_ }, */
|
||||
/* { ACTION_STD_KEYLOCK, BUTTON_, BUTTON_ }, */
|
||||
/* { ACTION_STD_REC, BUTTON_, BUTTON_ }, */
|
||||
/* { ACTION_STD_HOTKEY, BUTTON_, BUTTON_ }, */
|
||||
/* { ACTION_F3, BUTTON_, BUTTON_ }, */
|
||||
|
||||
LAST_ITEM_IN_LIST
|
||||
}; /* button_context_standard */
|
||||
|
||||
static const struct button_mapping button_context_tree[] = {
|
||||
/* { ACTION_TREE_ROOT_INIT, BUTTON_, BUTTON_ }, */
|
||||
/* { ACTION_TREE_PGLEFT, BUTTON_, BUTTON_ }, */
|
||||
/* { ACTION_TREE_PGRIGHT, BUTTON_, BUTTON_ }, */
|
||||
{ ACTION_TREE_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
|
||||
{ ACTION_TREE_WPS, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
|
||||
/* { ACTION_TREE_HOTKEY, BUTTON_, BUTTON_ }, */
|
||||
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
||||
}; /* button_context_tree */
|
||||
|
||||
static const struct button_mapping button_context_wps[] = {
|
||||
{ ACTION_WPS_BROWSE, BUTTON_ENTER|BUTTON_REL, BUTTON_ENTER },
|
||||
{ ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
|
||||
{ ACTION_WPS_SEEKBACK, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_WPS_SEEKFWD, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_WPS_STOPSEEK, BUTTON_REW|BUTTON_REL, BUTTON_REW|BUTTON_REPEAT },
|
||||
{ ACTION_WPS_STOPSEEK, BUTTON_FF|BUTTON_REL, BUTTON_FF|BUTTON_REPEAT },
|
||||
{ ACTION_WPS_SKIPNEXT, BUTTON_FF|BUTTON_REL, BUTTON_FF },
|
||||
{ ACTION_WPS_SKIPPREV, BUTTON_REW|BUTTON_REL, BUTTON_REW },
|
||||
{ ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
|
||||
{ ACTION_WPS_VOLDOWN, BUTTON_DOWN, BUTTON_NONE },
|
||||
{ ACTION_WPS_VOLDOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_WPS_VOLUP, BUTTON_UP, BUTTON_NONE },
|
||||
{ ACTION_WPS_VOLUP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
|
||||
/* { ACTION_WPS_PITCHSCREEN, BUTTON_, BUTTON_ }, */
|
||||
/* { ACTION_WPS_ID3SCREEN, BUTTON_, BUTTON_ }, */
|
||||
{ ACTION_WPS_CONTEXT, BUTTON_ENTER|BUTTON_REPEAT, BUTTON_ENTER },
|
||||
{ ACTION_WPS_QUICKSCREEN, BUTTON_REC|BUTTON_REPEAT, BUTTON_REC },
|
||||
{ ACTION_WPS_MENU, BUTTON_MENU|BUTTON_REL, BUTTON_MENU },
|
||||
/* { ACTION_WPS_VIEW_PLAYLIST, BUTTON_, BUTTON_ }, */
|
||||
/* { ACTION_WPS_REC, BUTTON_, BUTTON_ }, */
|
||||
/* { ACTION_WPS_ABSETA_PREVDIR, BUTTON_, BUTTON_ }, */
|
||||
/* { ACTION_WPS_ABSETB_NEXTDIR, BUTTON_, BUTTON_ }, */
|
||||
/* { ACTION_WPS_ABRESET, BUTTON_, BUTTON_ }, */
|
||||
/* { ACTION_WPS_HOTKEY, BUTTON_, BUTTON_ }, */
|
||||
|
||||
LAST_ITEM_IN_LIST,
|
||||
}; /* button_context_wps */
|
||||
|
||||
static const struct button_mapping button_context_settings[] = {
|
||||
{ ACTION_SETTINGS_INC, BUTTON_FF, BUTTON_NONE },
|
||||
{ ACTION_SETTINGS_INCREPEAT, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
|
||||
/* { ACTION_SETTINGS_INCBIGSTEP,BUTTON_, BUTTON_ }, */
|
||||
{ ACTION_SETTINGS_DEC, BUTTON_REW, BUTTON_NONE },
|
||||
{ ACTION_SETTINGS_DECREPEAT, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
|
||||
/* { ACTION_SETTINGS_DECBIGSTEP,BUTTON_, BUTTON_ }, */
|
||||
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
||||
}; /* button_context_settings */
|
||||
|
||||
static const struct button_mapping button_context_yesno[] = {
|
||||
{ ACTION_YESNO_ACCEPT, BUTTON_ENTER, BUTTON_NONE },
|
||||
{ ACTION_YESNO_ACCEPT, BUTTON_PLAY, BUTTON_NONE },
|
||||
|
||||
LAST_ITEM_IN_LIST
|
||||
}; /* button_context_yesno */
|
||||
|
||||
static const struct button_mapping button_context_bmark[] = {
|
||||
{ ACTION_BMS_DELETE, BUTTON_REC|BUTTON_REPEAT, BUTTON_REC },
|
||||
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
|
||||
}; /* button_context_bmark */
|
||||
|
||||
/*
|
||||
static const struct button_mapping button_context_quickscreen[] = {
|
||||
{ ACTION_QS_LEFT, BUTTON_VOL_DOWN, BUTTON_NONE },
|
||||
{ ACTION_QS_LEFT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_QS_RIGHT, BUTTON_VOL_UP, BUTTON_NONE },
|
||||
{ ACTION_QS_RIGHT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_QS_DOWN, BUTTON_FF, BUTTON_NONE },
|
||||
{ ACTION_QS_DOWN, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_QS_TOP, BUTTON_REW, BUTTON_NONE },
|
||||
{ ACTION_QS_TOP, BUTTON_REW|BUTTON_REPEAT, 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_VOL_UP, BUTTON_NONE },
|
||||
// { ACTION_PS_INC_BIG, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
|
||||
// { ACTION_PS_DEC_SMALL, BUTTON_VOL_DOWN, BUTTON_NONE },
|
||||
// { ACTION_PS_DEC_BIG, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_PS_NUDGE_LEFT, BUTTON_REW, BUTTON_NONE },
|
||||
{ ACTION_PS_NUDGE_RIGHT, BUTTON_FF, BUTTON_NONE },
|
||||
{ ACTION_PS_NUDGE_LEFTOFF, BUTTON_REW|BUTTON_REL, BUTTON_NONE },
|
||||
{ ACTION_PS_NUDGE_RIGHTOFF, BUTTON_FF|BUTTON_REL, BUTTON_NONE },
|
||||
{ ACTION_PS_TOGGLE_MODE, BUTTON_PLAY, BUTTON_NONE },
|
||||
{ ACTION_PS_RESET, BUTTON_ENTER, BUTTON_NONE },
|
||||
{ ACTION_PS_EXIT, BUTTON_MENU, BUTTON_NONE },
|
||||
{ ACTION_PS_SLOWER, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_PS_FASTER, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
|
||||
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
||||
}; /* button_context_pitchscreen */
|
||||
|
||||
static const struct button_mapping button_context_radio[] = {
|
||||
{ ACTION_FM_MENU, BUTTON_ENTER|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_FM_PRESET, BUTTON_ENTER|BUTTON_REL, BUTTON_ENTER },
|
||||
/* { ACTION_FM_RECORD, BUTTON_, BUTTON_ }, */
|
||||
/* { ACTION_FM_FREEZE, BUTTON_, BUTTON_ }, */
|
||||
{ ACTION_FM_STOP, BUTTON_REC|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_FM_MODE, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
|
||||
{ ACTION_FM_EXIT, BUTTON_REC|BUTTON_REL, BUTTON_REC },
|
||||
{ ACTION_FM_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
|
||||
/* { ACTION_FM_RECORD_DBLPRE, BUTTON_, BUTTON_ }, */
|
||||
/* { ACTION_FM_NEXT_PRESET, BUTTON_, BUTTON_ }, */
|
||||
/* { ACTION_FM_PREV_PRESET, BUTTON_, BUTTON_ }, */
|
||||
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
|
||||
}; /* button_context_radio */
|
||||
|
||||
static const struct button_mapping button_context_recscreen[] = {
|
||||
/* { ACTION_REC_LCD, BUTTON_, BUTTON_ }, */
|
||||
{ ACTION_REC_PAUSE, BUTTON_PLAY, BUTTON_NONE },
|
||||
{ ACTION_REC_NEWFILE, BUTTON_ENTER|BUTTON_REPEAT, BUTTON_ENTER },
|
||||
/* { ACTION_REC_F2, BUTTON_, BUTTON_ }, */
|
||||
/* { ACTION_REC_F3, BUTTON_, BUTTON_ }, */
|
||||
|
||||
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
|
||||
}; /* button_context_recscreen */
|
||||
|
||||
#if 0
|
||||
static const struct button_mapping button_context_keyboard[] = {
|
||||
{ ACTION_KBD_LEFT, BUTTON_VOL_DOWN, BUTTON_NONE },
|
||||
{ ACTION_KBD_LEFT, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_KBD_RIGHT, BUTTON_VOL_UP, BUTTON_NONE },
|
||||
{ ACTION_KBD_RIGHT, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
|
||||
/* { ACTION_KBD_CURSOR_LEFT, BUTTON_, BUTTON_ }, */
|
||||
/* { ACTION_KBD_CURSOR_RIGHT, BUTTON_, BUTTON_ }, */
|
||||
{ ACTION_KBD_SELECT, BUTTON_FUNC, BUTTON_NONE },
|
||||
{ ACTION_KBD_PAGE_FLIP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
|
||||
{ ACTION_KBD_DONE, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
|
||||
{ ACTION_KBD_ABORT, BUTTON_REC|BUTTON_REL, BUTTON_REC },
|
||||
/* { ACTION_KBD_BACKSPACE, BUTTON_, BUTTON_ }, */
|
||||
{ ACTION_KBD_UP, BUTTON_REW, BUTTON_NONE },
|
||||
{ ACTION_KBD_UP, BUTTON_REW|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_KBD_DOWN, BUTTON_FF, BUTTON_NONE },
|
||||
{ ACTION_KBD_DOWN, BUTTON_FF|BUTTON_REPEAT, BUTTON_NONE },
|
||||
{ ACTION_KBD_MORSE_INPUT, BUTTON_REC|BUTTON_REPEAT, BUTTON_REC },
|
||||
{ ACTION_KBD_MORSE_SELECT, BUTTON_FUNC|BUTTON_REL, BUTTON_NONE },
|
||||
|
||||
LAST_ITEM_IN_LIST
|
||||
}; /* button_context_keyboard */
|
||||
#endif
|
||||
|
||||
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;
|
||||
|
||||
#if CONFIG_TUNER
|
||||
case CONTEXT_FM:
|
||||
return button_context_radio;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_RECORDING
|
||||
case CONTEXT_RECSCREEN:
|
||||
return button_context_recscreen;
|
||||
#endif
|
||||
|
||||
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;
|
||||
|
||||
case CONTEXT_SETTINGS:
|
||||
case CONTEXT_SETTINGS_EQ:
|
||||
return button_context_settings;
|
||||
|
||||
case CONTEXT_TREE:
|
||||
case CONTEXT_MAINMENU:
|
||||
case CONTEXT_CUSTOM|CONTEXT_TREE:
|
||||
return button_context_tree;
|
||||
|
||||
case CONTEXT_LIST:
|
||||
default:
|
||||
return button_context_standard;
|
||||
}
|
||||
return button_context_standard;
|
||||
}
|
||||
|
|
@ -63,6 +63,6 @@ show_logo.c
|
|||
#elif defined(PBELL_VIBE500)
|
||||
main-pp.c
|
||||
show_logo.c
|
||||
#elif defined(MPIO_HD200)
|
||||
#elif defined(MPIO_HD200) || defined(MPIO_HD300)
|
||||
mpio_hd200.c
|
||||
#endif
|
||||
|
|
|
@ -263,7 +263,9 @@ static void bootmenu(void)
|
|||
switch (button)
|
||||
{
|
||||
case BUTTON_REW:
|
||||
#ifdef MPIO_HD200
|
||||
case BUTTON_RC_REW:
|
||||
#endif
|
||||
if (option > rockbox)
|
||||
option--;
|
||||
else
|
||||
|
@ -271,7 +273,9 @@ static void bootmenu(void)
|
|||
break;
|
||||
|
||||
case BUTTON_FF:
|
||||
#ifdef MPIO_HD200
|
||||
case BUTTON_RC_FF:
|
||||
#endif
|
||||
if (option < shutdown)
|
||||
option++;
|
||||
else
|
||||
|
@ -279,8 +283,10 @@ static void bootmenu(void)
|
|||
break;
|
||||
|
||||
case BUTTON_PLAY:
|
||||
#ifdef MPIO_HD200
|
||||
case BUTTON_RC_PLAY:
|
||||
case (BUTTON_PLAY|BUTTON_REC):
|
||||
#endif
|
||||
reset_screen();
|
||||
|
||||
switch (option)
|
||||
|
@ -360,7 +366,11 @@ void main(void)
|
|||
event = EVENT_NONE;
|
||||
button = button_get_w_tmo(HZ);
|
||||
|
||||
if ( (button & BUTTON_PLAY) || (button & BUTTON_RC_PLAY) )
|
||||
if ( (button & BUTTON_PLAY)
|
||||
#ifdef MPIO_HD200
|
||||
|| (button & BUTTON_RC_PLAY)
|
||||
#endif
|
||||
)
|
||||
event |= EVENT_ON;
|
||||
|
||||
if ( usb_detect() == USB_INSERTED )
|
||||
|
|
|
@ -1701,6 +1701,27 @@ target/coldfire/mpio/fmradio_i2c-mpio.c
|
|||
#endif /* SIMULATOR */
|
||||
#endif
|
||||
|
||||
#ifdef MPIO_HD300
|
||||
#ifndef SIMULATOR
|
||||
/* TODO: currently including all files */
|
||||
target/coldfire/ata-as-coldfire.S
|
||||
target/coldfire/mpio/system-mpio.c
|
||||
target/coldfire/mpio/power-mpio.c
|
||||
target/coldfire/mpio/backlight-mpio.c
|
||||
target/coldfire/mpio/usb-mpio.c
|
||||
target/coldfire/mpio/ata-mpio.c
|
||||
target/coldfire/mpio/adc-mpio.c
|
||||
target/coldfire/mpio/hd300/button-hd300.c
|
||||
target/coldfire/mpio/hd300/lcd-hd300.c
|
||||
target/coldfire/mpio/hd300/lcd-as-hd300.S
|
||||
target/coldfire/mpio/hd300/powermgmt-hd300.c
|
||||
#ifndef BOOTLOADER
|
||||
target/coldfire/mpio/audio-mpio.c
|
||||
target/coldfire/wmcodec-coldfire.c
|
||||
target/coldfire/mpio/fmradio_i2c-mpio.c
|
||||
#endif /* BOOTLOADER */
|
||||
#endif /* SIMULATOR */
|
||||
#endif
|
||||
|
||||
#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
|
||||
target/hosted/android/fs-android.c
|
||||
|
|
|
@ -565,6 +565,7 @@ void audiohw_set_recsrc(int source, bool recording)
|
|||
}
|
||||
break;
|
||||
|
||||
#if (INPUT_SRC_CAPS & SRC_CAP_LINEIN)
|
||||
case AUDIO_SRC_LINEIN:
|
||||
#ifdef AUDIOHW_HAVE_DEPTH_3D
|
||||
wmcodec_write(PWRMGMT1, PWRMGMT1_VREF | PWRMGMT1_VMIDSEL_50K);
|
||||
|
@ -599,7 +600,8 @@ void audiohw_set_recsrc(int source, bool recording)
|
|||
wmcodec_write(LEFTMIX1, LEFTMIX1_LD2LO);
|
||||
wmcodec_write(RIGHTMIX2, RIGHTMIX2_RD2RO);
|
||||
break;
|
||||
|
||||
#endif
|
||||
#if (INPUT_SRC_CAPS & SRC_CAP_MIC)
|
||||
case AUDIO_SRC_MIC:
|
||||
#ifdef AUDIOHW_HAVE_DEPTH_3D
|
||||
wmcodec_write(PWRMGMT1, PWRMGMT1_VREF | PWRMGMT1_VMIDSEL_50K);
|
||||
|
@ -634,7 +636,8 @@ void audiohw_set_recsrc(int source, bool recording)
|
|||
/* route DAC signal to output mixer */
|
||||
wmcodec_write(LEFTMIX1, LEFTMIX1_LD2LO);
|
||||
wmcodec_write(RIGHTMIX2, RIGHTMIX2_RD2RO);
|
||||
|
||||
break;
|
||||
#endif
|
||||
} /* switch(source) */
|
||||
}
|
||||
|
||||
|
|
|
@ -130,6 +130,7 @@
|
|||
#define MPIO_HD200_PAD 44
|
||||
#define ANDROID_PAD 45
|
||||
#define SDL_PAD 46
|
||||
#define MPIO_HD300_PAD 47
|
||||
|
||||
/* CONFIG_REMOTE_KEYPAD */
|
||||
#define H100_REMOTE 1
|
||||
|
@ -428,6 +429,8 @@ Lyre prototype 1 */
|
|||
#include "config/vibe500.h"
|
||||
#elif defined(MPIO_HD200)
|
||||
#include "config/mpiohd200.h"
|
||||
#elif defined(MPIO_HD300)
|
||||
#include "config/mpiohd300.h"
|
||||
|
||||
#elif defined(APPLICATION)
|
||||
#include "config/application.h"
|
||||
|
|
186
firmware/export/config/mpiohd300.h
Normal file
186
firmware/export/config/mpiohd300.h
Normal file
|
@ -0,0 +1,186 @@
|
|||
/*
|
||||
* This config file is for MPIO HD200
|
||||
*/
|
||||
#define TARGET_TREE /* this target is using the target tree system */
|
||||
|
||||
/* For Rolo and boot loader */
|
||||
#define MODEL_NUMBER 70
|
||||
|
||||
#define MODEL_NAME "MPIO HD300"
|
||||
|
||||
/* define this if you use an ATA controller */
|
||||
#define CONFIG_STORAGE STORAGE_ATA
|
||||
#define HAVE_LBA48
|
||||
#define ATA_SWAP_WORDS
|
||||
|
||||
/* 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_FMRADIO)
|
||||
|
||||
/* define the bitmask of hardware sample rates */
|
||||
#define HW_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | SAMPR_CAP_11)
|
||||
|
||||
/* define the bitmask of recording sample rates */
|
||||
#define REC_SAMPR_CAPS (SAMPR_CAP_88 | SAMPR_CAP_44 | SAMPR_CAP_22 | SAMPR_CAP_11)
|
||||
|
||||
/* define this if you have a bitmap LCD display */
|
||||
#define HAVE_LCD_BITMAP
|
||||
|
||||
/* define this if you 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 flip your LCD */
|
||||
#define HAVE_LCD_FLIP
|
||||
|
||||
/* 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 have access to the pitchscreen */
|
||||
#define HAVE_PITCHSCREEN
|
||||
|
||||
/* define this if you would like tagcache to build on this target */
|
||||
#define HAVE_TAGCACHE
|
||||
|
||||
/* LCD dimensions */
|
||||
#define LCD_WIDTH 160
|
||||
#define LCD_HEIGHT 128
|
||||
#define LCD_DEPTH 2
|
||||
|
||||
#define LCD_PIXELFORMAT VERTICAL_PACKING
|
||||
|
||||
/* Display colours, for screenshots and sim (0xRRGGBB) */
|
||||
#define LCD_DARKCOLOR 0x000000
|
||||
#define LCD_BRIGHTCOLOR 0x5a915a
|
||||
#define LCD_BL_DARKCOLOR 0x000000
|
||||
#define LCD_BL_BRIGHTCOLOR 0x82b4fa
|
||||
|
||||
#define CONFIG_KEYPAD MPIO_HD300_PAD
|
||||
|
||||
/* Define this if you do software codec */
|
||||
#define CONFIG_CODEC SWCODEC
|
||||
|
||||
/* Define this if you have RTC */
|
||||
#define CONFIG_RTC RTC_S35390A
|
||||
|
||||
#define CONFIG_LCD LCD_S1D15E06
|
||||
|
||||
/* Define this for LCD backlight available */
|
||||
#define HAVE_BACKLIGHT
|
||||
#define HAVE_BACKLIGHT_BRIGHTNESS
|
||||
#define MIN_BRIGHTNESS_SETTING 0
|
||||
#define MAX_BRIGHTNESS_SETTING 31
|
||||
#define DEFAULT_BRIGHTNESS_SETTING 20
|
||||
|
||||
|
||||
/* define this if you have a disk storage, i.e. something
|
||||
that needs spinups and can cause skips when shaked */
|
||||
#define HAVE_DISK_STORAGE
|
||||
|
||||
/* Define this if you have a software controlled poweroff */
|
||||
#define HAVE_SW_POWEROFF
|
||||
|
||||
/* The number of bytes reserved for loadable codecs */
|
||||
#define CODEC_SIZE 0x100000
|
||||
|
||||
/* The number of bytes reserved for loadable plugins */
|
||||
#define PLUGIN_BUFFER_SIZE 0x80000
|
||||
|
||||
/* FM Tuner
|
||||
* turn off for now
|
||||
*/
|
||||
#define CONFIG_TUNER TEA5767
|
||||
#define CONFIG_TUNER_XTAL 32768
|
||||
|
||||
|
||||
/* we have WM8750 codec in I2S master mode */
|
||||
#define HAVE_WM8750
|
||||
|
||||
/* clocking setup based on 11.2896 MHz master clock
|
||||
* provided to the codec by MCU
|
||||
* WM8750L Datasheet Table 40, page 46
|
||||
*/
|
||||
#define CODEC_SRCTRL_11025HZ (0x18 << 1)
|
||||
#define CODEC_SRCTRL_22050HZ (0x1A << 1)
|
||||
#define CODEC_SRCTRL_44100HZ (0x10 << 1)
|
||||
#define CODEC_SRCTRL_88200HZ (0x1E << 1)
|
||||
|
||||
/* copied from HD200 for now needs calibration */
|
||||
#define BATTERY_TYPES_COUNT 1
|
||||
#define BATTERY_CAPACITY_DEFAULT 850 /* this is wild guess */
|
||||
#define BATTERY_CAPACITY_MIN 800 /* min. capacity selectable */
|
||||
#define BATTERY_CAPACITY_MAX 2500 /* max. capacity selectable */
|
||||
#define BATTERY_CAPACITY_INC 50 /* capacity increment */
|
||||
|
||||
#define CURRENT_NORMAL 68 /* measured during playback unboosted */
|
||||
#define CURRENT_BACKLIGHT 24 /* measured */
|
||||
#define CURRENT_RECORD 40 /* additional current while recording */
|
||||
#define CURRENT_ATA 100 /* additional current when ata system is ON */
|
||||
/* #define CURRENT_REMOTE 0 additional current when remote connected */
|
||||
|
||||
#define CONFIG_CHARGING CHARGING_MONITOR
|
||||
|
||||
#ifndef SIMULATOR
|
||||
|
||||
/* Define this if your LCD can set contrast */
|
||||
#define HAVE_LCD_CONTRAST
|
||||
|
||||
/* Define this if you have a Motorola SCF5249 */
|
||||
#define CONFIG_CPU MCF5249
|
||||
|
||||
/* Define this if you want to use coldfire's i2c interface */
|
||||
#define CONFIG_I2C I2C_COLDFIRE
|
||||
|
||||
/* 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 0x200000
|
||||
|
||||
/* Define this to the CPU frequency */
|
||||
#define CPU_FREQ 11289600
|
||||
|
||||
/* Define this if you have ATA power-off control */
|
||||
#define HAVE_ATA_POWER_OFF
|
||||
|
||||
/* Offset ( in the firmware file's header ) to the file length */
|
||||
#define FIRMWARE_OFFSET_FILE_LENGTH 0
|
||||
|
||||
/* Offset ( in the firmware file's header ) to the file CRC */
|
||||
#define FIRMWARE_OFFSET_FILE_CRC 0
|
||||
|
||||
/* Offset ( in the firmware file's header ) to the real data */
|
||||
#define FIRMWARE_OFFSET_FILE_DATA 8
|
||||
|
||||
/* Define this if you have adjustable CPU frequency */
|
||||
#define HAVE_ADJUSTABLE_CPU_FREQ
|
||||
|
||||
#define BOOTFILE_EXT "mpio"
|
||||
#define BOOTFILE "rockbox." BOOTFILE_EXT
|
||||
#define BOOTDIR "/.rockbox"
|
||||
|
||||
#define BOOTLOADER_ENTRYPOINT 0x001F0000
|
||||
#define FLASH_ENTRYPOINT 0x00001000
|
||||
#define FLASH_MAGIC 0xfbfbfbf1
|
||||
|
||||
#endif /* SIMULATOR */
|
||||
|
||||
/** Port-specific settings **/
|
||||
|
||||
#define MIN_CONTRAST_SETTING 20
|
||||
#define MAX_CONTRAST_SETTING 32
|
||||
#define DEFAULT_CONTRAST_SETTING 24
|
||||
|
||||
#define IRAM_LCDFRAMEBUFFER IBSS_ATTR /* put the lcd frame buffer in IRAM */
|
|
@ -63,14 +63,14 @@ start:
|
|||
move.l #0x00000180,%d0 /* CSCR0 - no wait states, 16 bits, no bursts */
|
||||
move.l %d0,(0x088,%a0)
|
||||
|
||||
#ifdef MPIO_HD200
|
||||
#if (defined MPIO_HD200) || (defined MPIO_HD300)
|
||||
/* Chip select 3 - LCD controller */
|
||||
/* values taken from original firmware except base address*/
|
||||
/* FIXME Check if we really need this 2 wait states! */
|
||||
move.l #0xf0000000,%d0 /* CSAR3 - Base = 0xf0000000 */
|
||||
move.l %d0,(0x0a4,%a0)
|
||||
moveq.l #0x1,%d0 /* CSMR3 - 64K */
|
||||
move.l %d0,(0x0a8,%a0)
|
||||
move.l #0x00000980,%d0 /* CSCR3 - 1 wait state, 16 bits no bursts */
|
||||
move.l #0x00000980,%d0 /* CSCR3 - 2 wait states, 16 bits no bursts */
|
||||
move.l %d0,(0x0ac,%a0)
|
||||
#elif !(defined IAUDIO_M3)
|
||||
/* Chip select 1 - LCD controller */
|
||||
|
@ -276,7 +276,7 @@ start:
|
|||
or.l %d0,(0xbc,%a1)
|
||||
#endif
|
||||
|
||||
#ifdef MPIO_HD200
|
||||
#if (defined MPIO_HD200) || (defined MPIO_HD300)
|
||||
/* Set KEEP_ACT
|
||||
* Set GPIO57 high to remove hissing nois on startup
|
||||
*/
|
||||
|
|
|
@ -28,7 +28,8 @@
|
|||
#elif (CONFIG_KEYPAD == IAUDIO_M3_PAD)
|
||||
# define DEBUG_CANCEL BUTTON_RC_REC
|
||||
|
||||
#elif (CONFIG_KEYPAD == MPIO_HD200_PAD)
|
||||
#elif (CONFIG_KEYPAD == MPIO_HD200_PAD) || \
|
||||
(CONFIG_KEYPAD == MPIO_HD300_PAD)
|
||||
# define DEBUG_CANCEL BUTTON_REC
|
||||
#endif
|
||||
bool dbg_ports(void);
|
||||
|
|
|
@ -36,9 +36,15 @@ void audio_set_output_source(int source)
|
|||
static const unsigned char txsrc_select[AUDIO_NUM_SOURCES+1] =
|
||||
{
|
||||
[AUDIO_SRC_PLAYBACK+1] = 3, /* PDOR3 */
|
||||
#if (INPUT_SRC_CAPS & SRC_CAP_MIC)
|
||||
[AUDIO_SRC_MIC+1] = 4, /* IIS1 RcvData */
|
||||
#endif
|
||||
#if (INPUT_SRC_CAPS & SRC_CAP_LINEIN)
|
||||
[AUDIO_SRC_LINEIN+1] = 4, /* IIS1 RcvData */
|
||||
#endif
|
||||
#if (INPUT_SRC_CAPS & SRC_CAP_FMRADIO)
|
||||
[AUDIO_SRC_FMRADIO+1] = 4, /* IIS1 RcvData */
|
||||
#endif
|
||||
};
|
||||
|
||||
int level = set_irq_level(DMA_IRQ_LEVEL);
|
||||
|
@ -74,7 +80,9 @@ void audio_input_mux(int source, unsigned flags)
|
|||
break;
|
||||
|
||||
case AUDIO_SRC_MIC:
|
||||
#if (INPUT_SRC_CAPS & SRC_CAP_LINEIN)
|
||||
case AUDIO_SRC_LINEIN:
|
||||
#endif
|
||||
/* recording only */
|
||||
if (source != last_source)
|
||||
{
|
||||
|
|
234
firmware/target/coldfire/mpio/hd300/button-hd300.c
Normal file
234
firmware/target/coldfire/mpio/hd300/button-hd300.c
Normal file
|
@ -0,0 +1,234 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2010 Marcin Bukat
|
||||
* scrollstrip logic inspired by button-mini1g.c
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "cpu.h"
|
||||
#include "system.h"
|
||||
#include "button.h"
|
||||
#include "backlight.h"
|
||||
#include "adc.h"
|
||||
#include "powermgmt.h"
|
||||
|
||||
#define SLIDER_BASE_SENSITIVITY 6
|
||||
|
||||
/* GPI7 H-L, GPI6 H-L, GPI7 L-H, GPI6 L-H */
|
||||
#define SLIDER_GPIO_MASK ((1<<15)|(1<<14)|(1<<7)|(1<<6))
|
||||
|
||||
static inline void disable_scrollstrip_interrupts(void)
|
||||
{
|
||||
and_l(~SLIDER_GPIO_MASK,&GPIO_INT_EN);
|
||||
}
|
||||
|
||||
static inline void enable_scrollstrip_interrupts(void)
|
||||
{
|
||||
|
||||
or_l(SLIDER_GPIO_MASK,&GPIO_INT_EN);
|
||||
}
|
||||
|
||||
static inline void ack_scrollstrip_interrupt(void)
|
||||
{
|
||||
or_l(SLIDER_GPIO_MASK,&GPIO_INT_CLEAR);
|
||||
}
|
||||
|
||||
void scrollstrip_isr(void) __attribute__ ((interrupt_handler,section(".icode")));
|
||||
void scrollstrip_isr(void)
|
||||
{
|
||||
/* reading line 6 and 7 forms four possible states:
|
||||
* 0, 1 , 2, 3
|
||||
* tracking the order of line changes we can judge
|
||||
* if the slide is up or down in the following way:
|
||||
* sliding up order: 0 2 3 1 0 2 3 1
|
||||
* sliding down order: 0 1 3 2 0 1 3 2
|
||||
*/
|
||||
static const signed char scroll_state[4][4] ICONST_ATTR = {
|
||||
{ BUTTON_NONE, BUTTON_DOWN, BUTTON_UP, BUTTON_NONE},
|
||||
{ BUTTON_UP, BUTTON_NONE, BUTTON_NONE, BUTTON_DOWN},
|
||||
{ BUTTON_DOWN, BUTTON_NONE, BUTTON_NONE, BUTTON_UP},
|
||||
{ BUTTON_NONE, BUTTON_UP, BUTTON_DOWN, BUTTON_NONE}
|
||||
};
|
||||
|
||||
static signed char prev_scroll_lines = -1;
|
||||
static signed char direction = 0;
|
||||
static unsigned char count = 0;
|
||||
static long next_backlight_on = 0;
|
||||
|
||||
signed int new_scroll_lines;
|
||||
signed int scroll_dir;
|
||||
|
||||
disable_scrollstrip_interrupts();
|
||||
|
||||
/* read GPIO6 and GPIO7 state*/
|
||||
new_scroll_lines = (GPIO_READ >> 6) & 0x03;
|
||||
|
||||
if ( prev_scroll_lines == -1 )
|
||||
{
|
||||
prev_scroll_lines = new_scroll_lines;
|
||||
ack_scrollstrip_interrupt();
|
||||
enable_scrollstrip_interrupts();
|
||||
return;
|
||||
}
|
||||
|
||||
scroll_dir = scroll_state[prev_scroll_lines][new_scroll_lines];
|
||||
prev_scroll_lines = new_scroll_lines;
|
||||
|
||||
if (direction != scroll_dir)
|
||||
{
|
||||
/* direction reversal */
|
||||
direction = scroll_dir;
|
||||
count = 0;
|
||||
ack_scrollstrip_interrupt();
|
||||
enable_scrollstrip_interrupts();
|
||||
return;
|
||||
}
|
||||
|
||||
/* poke backlight */
|
||||
if (TIME_AFTER(current_tick, next_backlight_on))
|
||||
{
|
||||
backlight_on();
|
||||
reset_poweroff_timer();
|
||||
next_backlight_on = current_tick + HZ/4;
|
||||
}
|
||||
|
||||
if (++count < SLIDER_BASE_SENSITIVITY)
|
||||
{
|
||||
ack_scrollstrip_interrupt();
|
||||
enable_scrollstrip_interrupts();
|
||||
return;
|
||||
}
|
||||
|
||||
count = 0;
|
||||
|
||||
/* post scrollstrip event to the button queue */
|
||||
if (queue_empty(&button_queue))
|
||||
queue_post(&button_queue, scroll_dir, 0);
|
||||
|
||||
ack_scrollstrip_interrupt();
|
||||
enable_scrollstrip_interrupts();
|
||||
}
|
||||
|
||||
/* register interrupt service routine for scrollstrip lines */
|
||||
void GPI6(void) __attribute__ ((alias("scrollstrip_isr")));
|
||||
void GPI7(void) __attribute__ ((alias("scrollstrip_isr")));
|
||||
|
||||
void button_init_device(void)
|
||||
{
|
||||
/* GPIO56 (PLAY) general input
|
||||
* GPIO45 (ENTER) general input
|
||||
* GPIO41 (MENU) dual function pin shared with audio serial data
|
||||
*
|
||||
* GPIO6, GPIO7 scrollstrip lines
|
||||
* GPIO31 scrollstrip enable
|
||||
*/
|
||||
|
||||
or_l((1<<24)|(1<<13),&GPIO1_FUNCTION);
|
||||
and_l(~((1<<24)|(1<<13)),&GPIO1_ENABLE);
|
||||
|
||||
or_l((1<<31)|(1<<7)|(1<<6),&GPIO_FUNCTION);
|
||||
and_l(~((1<<7)|(1<<6)),&GPIO_ENABLE);
|
||||
|
||||
/* scrollstrip enable active low */
|
||||
and_l(~(1<<31),&GPIO_OUT);
|
||||
or_l((1<<31),&GPIO_ENABLE);
|
||||
|
||||
/* GPI6, GPI7 interrupt level 4.0 */
|
||||
or_l((4<<28)|(4<<24), &INTPRI5);
|
||||
|
||||
enable_scrollstrip_interrupts();
|
||||
}
|
||||
|
||||
bool button_hold(void)
|
||||
{
|
||||
/* GPIO51 active low */
|
||||
return (GPIO1_READ & (1<<19))?false:true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get button pressed from hardware
|
||||
*/
|
||||
int button_read_device(void)
|
||||
{
|
||||
int btn = BUTTON_NONE;
|
||||
int data = 0;
|
||||
static bool hold_button = false;
|
||||
|
||||
bool hold_button_old;
|
||||
|
||||
|
||||
/* read hold buttons status */
|
||||
hold_button_old = hold_button;
|
||||
hold_button = button_hold();
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
/* Only main hold affects backlight */
|
||||
if (hold_button != hold_button_old)
|
||||
backlight_hold_changed(hold_button);
|
||||
#endif
|
||||
|
||||
/* Skip if main hold is active */
|
||||
if (!hold_button)
|
||||
{
|
||||
data = adc_scan(ADC_BUTTONS);
|
||||
|
||||
if (data < 800) /* middle */
|
||||
{
|
||||
if (data < 450)
|
||||
{
|
||||
if (data > 250)
|
||||
btn |= BUTTON_FF;
|
||||
}
|
||||
else /* 800 - 450 */
|
||||
{
|
||||
if (data > 600)
|
||||
btn |= BUTTON_REW;
|
||||
}
|
||||
}
|
||||
else /* data > 800 */
|
||||
{
|
||||
if (data < 1150)
|
||||
if (data > 950)
|
||||
btn |= BUTTON_REC;
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle GPIOs buttons
|
||||
*
|
||||
* GPIO56 active high PLAY/PAUSE/ON
|
||||
* GPIO45 active low ENTER
|
||||
* GPIO41 active low MENU
|
||||
*/
|
||||
|
||||
data = GPIO1_READ;
|
||||
|
||||
if (!hold_button)
|
||||
{
|
||||
if (data & (1<<24))
|
||||
btn |= BUTTON_PLAY;
|
||||
|
||||
if (!(data & (1<<13)))
|
||||
btn |= BUTTON_ENTER;
|
||||
|
||||
if (!(data & (1<<9)))
|
||||
btn |= BUTTON_MENU;
|
||||
}
|
||||
|
||||
return btn;
|
||||
}
|
55
firmware/target/coldfire/mpio/hd300/button-target.h
Normal file
55
firmware/target/coldfire/mpio/hd300/button-target.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2010 Marcin Bukat
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifndef _BUTTON_TARGET_H_
|
||||
#define _BUTTON_TARGET_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "config.h"
|
||||
|
||||
#define HAS_BUTTON_HOLD
|
||||
#define BUTTON_REMOTE 0
|
||||
|
||||
bool button_hold(void);
|
||||
void button_init_device(void);
|
||||
int button_read_device(void);
|
||||
|
||||
/* HD300 specific button codes */
|
||||
#define BUTTON_PLAY 0x00000001
|
||||
#define BUTTON_REW 0x00000004
|
||||
#define BUTTON_FF 0x00000002
|
||||
#define BUTTON_UP 0x00000008
|
||||
#define BUTTON_DOWN 0x00000010
|
||||
#define BUTTON_REC 0x00000020
|
||||
#define BUTTON_MENU 0x00000040
|
||||
#define BUTTON_ENTER 0x00000080
|
||||
|
||||
#define BUTTON_LEFT BUTTON_REW
|
||||
#define BUTTON_RIGHT BUTTON_FF
|
||||
#define BUTTON_ON BUTTON_PLAY
|
||||
|
||||
#define BUTTON_MAIN (BUTTON_PLAY|BUTTON_REW|BUTTON_FF|\
|
||||
BUTTON_UP|BUTTON_DOWN|BUTTON_REC|BUTTON_MENU|\
|
||||
BUTTON_ENTER)
|
||||
|
||||
#define POWEROFF_BUTTON BUTTON_PLAY
|
||||
#define POWEROFF_COUNT 30
|
||||
|
||||
#endif /* _BUTTON_TARGET_H_ */
|
227
firmware/target/coldfire/mpio/hd300/lcd-as-hd300.S
Normal file
227
firmware/target/coldfire/mpio/hd300/lcd-as-hd300.S
Normal file
|
@ -0,0 +1,227 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Adopted for MPIO HD300 by Marcin Bukat
|
||||
* Copyright (C) 2007 by Jens Arnold
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "cpu.h"
|
||||
|
||||
.section .icode,"ax",@progbits
|
||||
|
||||
.align 2
|
||||
.global lcd_write_command
|
||||
.type lcd_write_command,@function
|
||||
|
||||
lcd_write_command:
|
||||
move.l (4, %sp), %d0
|
||||
move.w %d0, 0xf0000000
|
||||
rts
|
||||
.wc_end:
|
||||
.size lcd_write_command,.wc_end-lcd_write_command
|
||||
|
||||
|
||||
.align 2
|
||||
.global lcd_write_command_ex
|
||||
.type lcd_write_command_ex,@function
|
||||
|
||||
lcd_write_command_ex:
|
||||
lea.l 0xf0000000, %a0
|
||||
|
||||
move.l (4, %sp), %d0 /* Command */
|
||||
move.w %d0, (%a0)+ /* Write to LCD, set A0 = 1 */
|
||||
|
||||
move.l (8, %sp), %d0 /* Data */
|
||||
cmp.l #-1, %d0 /* -1? */
|
||||
beq.b .last
|
||||
move.w %d0, (%a0) /* Write to LCD */
|
||||
|
||||
move.l (12, %sp), %d0 /* Data */
|
||||
cmp.l #-1, %d0 /* -1? */
|
||||
beq.b .last
|
||||
move.w %d0, (%a0) /* Write to LCD */
|
||||
|
||||
.last:
|
||||
rts
|
||||
.wcex_end:
|
||||
.size lcd_write_command_ex,.wcex_end-lcd_write_command_ex
|
||||
|
||||
|
||||
.align 2
|
||||
.global lcd_write_data
|
||||
.type lcd_write_data,@function
|
||||
|
||||
lcd_write_data:
|
||||
movem.l (4, %sp), %a0-%a1 /* Data pointer */
|
||||
move.l %a1, %d0 /* Length */
|
||||
lea 0xf0000002, %a1
|
||||
|
||||
.loop:
|
||||
/* When running in IRAM, this loop takes 10 cycles plus the LCD write.
|
||||
The 10 cycles are necessary to follow the LCD timing specs
|
||||
at 140MHz */
|
||||
nop /* 3(0/0) */
|
||||
move.b (%a0)+, %d1 /* 3(1/0) */
|
||||
move.w %d1, (%a1) /* 1(0/1) */
|
||||
subq.l #1, %d0 /* 1(0/0) */
|
||||
bne .loop /* 2(0/0) */
|
||||
rts
|
||||
.wd_end:
|
||||
.size lcd_write_data,.wd_end-lcd_write_data
|
||||
|
||||
|
||||
.align 2
|
||||
.global lcd_grey_data
|
||||
.type lcd_grey_data,@function
|
||||
|
||||
/* The main loop assumes the buffers are in SDRAM. Otherwise the LCD
|
||||
* controller timing won't be met at 124 MHz and graphical glitches
|
||||
* will occur. */
|
||||
|
||||
lcd_grey_data:
|
||||
lea.l (-11*4, %sp), %sp
|
||||
movem.l %d2-%d7/%a2-%a6, (%sp) /* free some registers */
|
||||
movem.l (11*4+4, %sp), %a0-%a2 /* values, phases, length */
|
||||
lea.l (%a1, %a2.l*4), %a2 /* end address */
|
||||
lea 0xf0000002, %a3 /* LCD data port */
|
||||
moveq.l #24, %d6 /* shift count */
|
||||
move.l #0xc30c3, %d7 /* bit shuffle factor */
|
||||
|
||||
moveq.l #12, %d2
|
||||
add.l %a1, %d2
|
||||
and.l #0xfffffff0, %d2 /* first line bound */
|
||||
cmp.l %d2, %a2 /* end address lower than first line bound? */
|
||||
bhs.s 1f
|
||||
move.l %a2, %d2 /* -> adjust end address of head loop */
|
||||
1:
|
||||
cmp.l %a1, %d2
|
||||
bls.s .g_hend
|
||||
|
||||
.g_hloop:
|
||||
move.l (%a1), %d0 /* fetch 4 pixel phases */
|
||||
|
||||
move.l %d0, %d1
|
||||
and.l #0x80808080, %d1 /* separate MSBs of the 4 phases */
|
||||
eor.l %d1, %d0 /* clear them in %d0 */
|
||||
add.l (%a0)+, %d0 /* add 4 pixel values to the phases */
|
||||
move.l %d0, (%a1)+ /* store new phases, advance pointer */
|
||||
|
||||
lsr.l #1, %d1 /* %d1 = .0.......1.......2.......3...... */
|
||||
mulu.l %d7, %d1 /* %d1 = 00112233112233..2233....33...... */
|
||||
not.l %d1 /* negate bits */
|
||||
lsr.l %d6, %d1 /* %d1 = ........................00112233 */
|
||||
move.w %d1, (%a3) /* write pixel block */
|
||||
|
||||
cmp.l %a1, %d2 /* go up to first line bound */
|
||||
bhi.s .g_hloop
|
||||
|
||||
.g_hend:
|
||||
cmp.l %a1, %a2
|
||||
bls.w .g_tend
|
||||
lea.l (-12, %a2), %a2
|
||||
cmp.l %a1, %a2
|
||||
bls.s .g_lend
|
||||
|
||||
.g_lloop:
|
||||
movem.l (%a1), %d0-%d3 /* fetch 4 blocks of 4 pixel phases each */
|
||||
|
||||
move.l %d0, %d4 /* calculate first pixel block */
|
||||
and.l #0x80808080, %d4
|
||||
eor.l %d4, %d0
|
||||
lsr.l #1, %d4
|
||||
mulu.l %d7, %d4
|
||||
not.l %d4
|
||||
lsr.l %d6, %d4
|
||||
|
||||
move.w %d4, (%a3) /* write first pixel block to LCD */
|
||||
|
||||
move.l %d1, %d5 /* calculate second pixel block */
|
||||
and.l #0x80808080, %d5
|
||||
eor.l %d5, %d1
|
||||
lsr.l #1, %d5
|
||||
mulu.l %d7, %d5
|
||||
not.l %d5
|
||||
lsr.l %d6, %d5
|
||||
|
||||
move.l %d2, %d4 /* calculate third pixel block */
|
||||
and.l #0x80808080, %d4
|
||||
eor.l %d4, %d2
|
||||
lsr.l #1, %d4
|
||||
mulu.l %d7, %d4
|
||||
not.l %d4
|
||||
lsr.l %d6, %d4
|
||||
|
||||
move.w %d5, (%a3) /* write second pixel block to LCD */
|
||||
|
||||
movem.l (%a0), %d5/%a4-%a6 /* fetch 4 blocks of 4 pixel values each */
|
||||
lea.l (16, %a0), %a0
|
||||
|
||||
move.w %d4, (%a3) /* write third pixel block to LCD */
|
||||
|
||||
move.l %d3, %d4 /* calculate fourth pixel block */
|
||||
and.l #0x80808080, %d4
|
||||
eor.l %d4, %d3
|
||||
lsr.l #1, %d4
|
||||
mulu.l %d7, %d4
|
||||
not.l %d4
|
||||
lsr.l %d6, %d4
|
||||
|
||||
add.l %d5, %d0 /* calculate 4*4 new pixel phases */
|
||||
add.l %a4, %d1 /* (packed addition) */
|
||||
add.l %a5, %d2
|
||||
add.l %a6, %d3
|
||||
|
||||
movem.l %d0-%d3, (%a1) /* store 4*4 new pixel phases */
|
||||
lea.l (16, %a1), %a1
|
||||
|
||||
move.w %d4, (%a3) /* write fourth pixel block to LCD */
|
||||
|
||||
cmp.l %a1, %a2 /* go up to last line bound */
|
||||
bhi.s .g_lloop
|
||||
|
||||
.g_lend:
|
||||
lea.l (12, %a2), %a2
|
||||
cmp.l %a1, %a2
|
||||
bls.s .g_tend
|
||||
|
||||
.g_tloop:
|
||||
move.l (%a1), %d0 /* fetch 4 pixel phases */
|
||||
|
||||
move.l %d0, %d1
|
||||
and.l #0x80808080, %d1
|
||||
eor.l %d1, %d0
|
||||
add.l (%a0)+, %d0 /* add 4 pixel values to the phases */
|
||||
move.l %d0, (%a1)+ /* store new phases, advance pointer */
|
||||
|
||||
lsr.l #1, %d1
|
||||
mulu.l %d7, %d1
|
||||
not.l %d1
|
||||
lsr.l %d6, %d1
|
||||
move.w %d1, (%a3) /* write pixel block */
|
||||
|
||||
cmp.l %a1, %a2 /* go up to end address */
|
||||
bhi.s .g_tloop
|
||||
|
||||
.g_tend:
|
||||
movem.l (%sp), %d2-%d7/%a2-%a6 /* restore registers */
|
||||
lea.l (11*4, %sp), %sp
|
||||
rts
|
||||
|
||||
.gd_end:
|
||||
.size lcd_grey_data,.gd_end-lcd_grey_data
|
244
firmware/target/coldfire/mpio/hd300/lcd-hd300.c
Normal file
244
firmware/target/coldfire/mpio/hd300/lcd-hd300.c
Normal file
|
@ -0,0 +1,244 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Adopted for MPIO HD300 by Marcin Bukat
|
||||
* Copyright (C) 2007 by Jens Arnold
|
||||
*
|
||||
* 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 "kernel.h"
|
||||
#include "lcd.h"
|
||||
|
||||
/*** definitions ***/
|
||||
|
||||
/* LCD command codes */
|
||||
#define LCD_CNTL_POWER_CONTROL 0x25
|
||||
#define LCD_CNTL_VOLTAGE_SELECT 0x2b
|
||||
#define LCD_CNTL_LINE_INVERT_DRIVE 0x36
|
||||
#define LCD_CNTL_GRAY_SCALE_PATTERN 0x39
|
||||
#define LCD_CNTL_TEMP_GRADIENT_SELECT 0x4e
|
||||
#define LCD_CNTL_OSC_FREQUENCY 0x5f
|
||||
#define LCD_CNTL_ON_OFF 0xae
|
||||
#define LCD_CNTL_OSC_ON_OFF 0xaa
|
||||
#define LCD_CNTL_OFF_MODE 0xbe
|
||||
#define LCD_CNTL_POWER_SAVE 0xa8
|
||||
#define LCD_CNTL_REVERSE 0xa6
|
||||
#define LCD_CNTL_ALL_LIGHTING 0xa4
|
||||
#define LCD_CNTL_COMMON_OUTPUT_STATUS 0xc4
|
||||
#define LCD_CNTL_COLUMN_ADDRESS_DIR 0xa0
|
||||
#define LCD_CNTL_NLINE_ON_OFF 0xe4
|
||||
#define LCD_CNTL_DISPLAY_MODE 0x66
|
||||
#define LCD_CNTL_DUTY_SET 0x6d
|
||||
#define LCD_CNTL_ELECTRONIC_VOLUME 0x81
|
||||
#define LCD_CNTL_DATA_INPUT_DIR 0x84
|
||||
#define LCD_CNTL_DISPLAY_START_LINE 0x8a
|
||||
#define LCD_CNTL_AREA_SCROLL 0x10
|
||||
|
||||
#define LCD_CNTL_PAGE 0xb1
|
||||
#define LCD_CNTL_COLUMN 0x13
|
||||
#define LCD_CNTL_DATA_WRITE 0x1d
|
||||
|
||||
/*** shared semi-private declarations ***/
|
||||
extern const unsigned char lcd_dibits[16] ICONST_ATTR;
|
||||
|
||||
/*** hardware configuration ***/
|
||||
int lcd_default_contrast(void)
|
||||
{
|
||||
return DEFAULT_CONTRAST_SETTING;
|
||||
}
|
||||
|
||||
void lcd_set_contrast(int val)
|
||||
{
|
||||
/* Keep val in acceptable hw range */
|
||||
if (val < 0)
|
||||
val = 0;
|
||||
else if (val > 127)
|
||||
val = 127;
|
||||
|
||||
lcd_write_command_ex(LCD_CNTL_ELECTRONIC_VOLUME, val, -1);
|
||||
}
|
||||
|
||||
void lcd_set_invert_display(bool yesno)
|
||||
{
|
||||
lcd_write_command(LCD_CNTL_REVERSE | (yesno?1:0));
|
||||
}
|
||||
|
||||
/* turn the display upside down (call lcd_update() afterwards) */
|
||||
void lcd_set_flip(bool yesno)
|
||||
{
|
||||
if (yesno)
|
||||
{
|
||||
lcd_write_command(LCD_CNTL_COLUMN_ADDRESS_DIR | 1);
|
||||
lcd_write_command(LCD_CNTL_COMMON_OUTPUT_STATUS | 0);
|
||||
lcd_write_command_ex(LCD_CNTL_DUTY_SET, 0x20, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
lcd_write_command(LCD_CNTL_COLUMN_ADDRESS_DIR | 0);
|
||||
lcd_write_command(LCD_CNTL_COMMON_OUTPUT_STATUS | 1);
|
||||
lcd_write_command_ex(LCD_CNTL_DUTY_SET, 0x20, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_init_device(void)
|
||||
{
|
||||
and_l(~0x00000800, &GPIO_FUNCTION); /* CS3 line */
|
||||
|
||||
/* LCD Reset GPO34 */
|
||||
or_l(0x00000004, &GPIO1_ENABLE); /* set as output */
|
||||
or_l(0x00000004, &GPIO1_FUNCTION); /* switch to secondary function - GPIO */
|
||||
|
||||
and_l(~0x00000004, &GPIO1_OUT); /* RESET low */
|
||||
sleep(1); /* delay at least 1000 ns */
|
||||
or_l(0x00000004, &GPIO1_OUT); /* RESET high */
|
||||
sleep(1);
|
||||
|
||||
lcd_write_command(LCD_CNTL_ON_OFF | 1); /* LCD ON */
|
||||
lcd_write_command(LCD_CNTL_OFF_MODE | 1); /* OFF -> VCC on drivers */
|
||||
lcd_write_command(LCD_CNTL_REVERSE | 0); /* Reverse OFF */
|
||||
lcd_write_command(LCD_CNTL_ALL_LIGHTING | 0); /* Normal */
|
||||
lcd_write_command(LCD_CNTL_COMMON_OUTPUT_STATUS | 1); /* Reverse dir */
|
||||
lcd_write_command_ex(LCD_CNTL_DISPLAY_START_LINE, 0, -1);
|
||||
lcd_write_command(LCD_CNTL_COLUMN_ADDRESS_DIR | 0); /* Normal */
|
||||
lcd_write_command_ex(LCD_CNTL_DISPLAY_MODE, 0, -1); /* Greyscale mode */
|
||||
lcd_write_command_ex(LCD_CNTL_GRAY_SCALE_PATTERN, 0x53, -1);
|
||||
lcd_write_command_ex(LCD_CNTL_DUTY_SET, 0x20, 1);
|
||||
lcd_write_command_ex(LCD_CNTL_ELECTRONIC_VOLUME, 24, -1); /* 0x18 */
|
||||
|
||||
lcd_write_command(LCD_CNTL_OSC_ON_OFF | 1); /* Oscillator ON */
|
||||
lcd_write_command(LCD_CNTL_POWER_SAVE | 0);
|
||||
lcd_write_command_ex(LCD_CNTL_VOLTAGE_SELECT, 3, -1);
|
||||
lcd_write_command_ex(LCD_CNTL_POWER_CONTROL, 0x17, -1);
|
||||
lcd_write_command_ex(LCD_CNTL_OSC_FREQUENCY, 3, -1);
|
||||
lcd_write_command(LCD_CNTL_NLINE_ON_OFF | 1); /* N-line ON */
|
||||
lcd_write_command_ex(LCD_CNTL_LINE_INVERT_DRIVE, 0x10, -1);
|
||||
lcd_write_command_ex(LCD_CNTL_TEMP_GRADIENT_SELECT, 0, -1);
|
||||
|
||||
lcd_update();
|
||||
}
|
||||
|
||||
/*** 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)
|
||||
{
|
||||
const unsigned char *src, *src_end;
|
||||
unsigned char *dst_u, *dst_l;
|
||||
static unsigned char upper[LCD_WIDTH] IBSS_ATTR;
|
||||
static unsigned char lower[LCD_WIDTH] IBSS_ATTR;
|
||||
unsigned int byte;
|
||||
|
||||
by *= 2;
|
||||
|
||||
while (bheight--)
|
||||
{
|
||||
src = data;
|
||||
src_end = data + width;
|
||||
dst_u = upper;
|
||||
dst_l = lower;
|
||||
do
|
||||
{
|
||||
byte = *src++;
|
||||
*dst_u++ = lcd_dibits[byte & 0x0F];
|
||||
byte >>= 4;
|
||||
*dst_l++ = lcd_dibits[byte & 0x0F];
|
||||
}
|
||||
while (src < src_end);
|
||||
|
||||
lcd_write_command_ex(LCD_CNTL_PAGE, by++, -1);
|
||||
lcd_write_command_ex(LCD_CNTL_COLUMN, x, -1);
|
||||
lcd_write_command(LCD_CNTL_DATA_WRITE);
|
||||
lcd_write_data(upper, width);
|
||||
|
||||
lcd_write_command_ex(LCD_CNTL_PAGE, by++, -1);
|
||||
lcd_write_command_ex(LCD_CNTL_COLUMN, x, -1);
|
||||
lcd_write_command(LCD_CNTL_DATA_WRITE);
|
||||
lcd_write_data(lower, width);
|
||||
|
||||
data += stride;
|
||||
}
|
||||
}
|
||||
|
||||
/* Helper function for lcd_grey_phase_blit(). */
|
||||
void lcd_grey_data(unsigned char *values, unsigned char *phases, int count);
|
||||
|
||||
/* Performance function that works with an external buffer
|
||||
note that by and bheight are in 4-pixel units! */
|
||||
void lcd_blit_grey_phase(unsigned char *values, unsigned char *phases,
|
||||
int x, int by, int width, int bheight, int stride)
|
||||
{
|
||||
stride <<= 2; /* 4 pixels per block */
|
||||
while (bheight--)
|
||||
{
|
||||
lcd_write_command_ex(LCD_CNTL_PAGE, by++, -1);
|
||||
lcd_write_command_ex(LCD_CNTL_COLUMN, x, -1);
|
||||
lcd_write_command(LCD_CNTL_DATA_WRITE);
|
||||
lcd_grey_data(values, phases, width);
|
||||
values += stride;
|
||||
phases += 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++)
|
||||
{
|
||||
lcd_write_command_ex(LCD_CNTL_PAGE, y, -1);
|
||||
lcd_write_command_ex(LCD_CNTL_COLUMN, 0, -1);
|
||||
|
||||
lcd_write_command(LCD_CNTL_DATA_WRITE);
|
||||
lcd_write_data (lcd_framebuffer[y], LCD_WIDTH);
|
||||
}
|
||||
}
|
||||
|
||||
/* 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) >> 2;
|
||||
y >>= 2;
|
||||
|
||||
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++)
|
||||
{
|
||||
lcd_write_command_ex(LCD_CNTL_PAGE, y, -1);
|
||||
lcd_write_command_ex(LCD_CNTL_COLUMN, x, -1);
|
||||
|
||||
lcd_write_command(LCD_CNTL_DATA_WRITE);
|
||||
lcd_write_data (&lcd_framebuffer[y][x], width);
|
||||
}
|
||||
}
|
58
firmware/target/coldfire/mpio/hd300/powermgmt-hd300.c
Normal file
58
firmware/target/coldfire/mpio/hd300/powermgmt-hd300.c
Normal file
|
@ -0,0 +1,58 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2010 Marcin Bukat
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "adc.h"
|
||||
#include "powermgmt.h"
|
||||
|
||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
3600
|
||||
};
|
||||
|
||||
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
3500
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
|
||||
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
|
||||
{
|
||||
{ 3500, 3566, 3597, 3619, 3644, 3676, 3732, 3806, 3868, 3937, 4004 }
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
|
||||
const unsigned short percent_to_volt_charge[11] =
|
||||
{
|
||||
/* values measured over one full charging cycle */
|
||||
3386, 3872, 3904, 3942, 3996, 4029, 4033, 4036, 4038, 4039, 4041
|
||||
};
|
||||
|
||||
/* 3.33V as reference */
|
||||
#define BATTERY_SCALE_FACTOR 3330
|
||||
|
||||
|
||||
/* Returns battery voltage from ADC [millivolts] */
|
||||
unsigned int battery_adc_voltage(void)
|
||||
{
|
||||
return (adc_read(ADC_BATTERY) * BATTERY_SCALE_FACTOR) >> 11;
|
||||
}
|
||||
|
|
@ -122,7 +122,9 @@ bool ide_powered(void)
|
|||
|
||||
void power_off(void)
|
||||
{
|
||||
#ifdef HAVE_LCD_SHUTDOWN
|
||||
lcd_shutdown();
|
||||
#endif
|
||||
set_irq_level(DISABLE_INTERRUPTS);
|
||||
and_l(~(1<<21), &GPIO1_OUT); /* pull KEEPACT low */
|
||||
asm("halt");
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "i2s.h"
|
||||
#include "wmcodec.h"
|
||||
|
||||
#if defined(MPIO_HD200)
|
||||
#if defined(MPIO_HD200) || defined(MPIO_HD300)
|
||||
#define I2C_CODEC_ADDRESS 0x34
|
||||
#define I2C_IFACE I2C_IFACE_1
|
||||
#endif
|
||||
|
|
24
tools/configure
vendored
24
tools/configure
vendored
|
@ -1088,6 +1088,7 @@ cat <<EOF
|
|||
|
||||
==MPIO== == Application ==
|
||||
170) HD200 200) Application
|
||||
171) HD300
|
||||
|
||||
EOF
|
||||
|
||||
|
@ -2717,6 +2718,29 @@ fi
|
|||
t_model="hd200"
|
||||
;;
|
||||
|
||||
171|mpiohd300)
|
||||
target_id=70
|
||||
modelname="mpiohd300"
|
||||
target="-DMPIO_HD300"
|
||||
memory=16 # always
|
||||
coldfirecc
|
||||
tool="$rootdir/tools/scramble -add=hd30"
|
||||
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
|
||||
bmp2rb_native="$rootdir/tools/bmp2rb -f 2"
|
||||
output="rockbox.mpio"
|
||||
bootoutput="bootloader.mpio"
|
||||
appextra="recorder:gui:radio"
|
||||
plugins=""
|
||||
swcodec="yes"
|
||||
# toolset is the tools within the tools directory that we build for
|
||||
# this particular target.
|
||||
toolset="$genericbitmaptools"
|
||||
# architecture, manufacturer and model for the target-tree build
|
||||
t_cpu="coldfire"
|
||||
t_manufacturer="mpio"
|
||||
t_model="hd300"
|
||||
;;
|
||||
|
||||
200|app*)
|
||||
target_id=100
|
||||
modelname="application"
|
||||
|
|
|
@ -125,7 +125,7 @@ void usage(void)
|
|||
"\t tpj2, c200, e200, giga, gigs, m100, m500, d2,\n");
|
||||
printf("\t 9200, 1630, 6330, ldax, m200, c100, clip, e2v2,\n"
|
||||
"\t m2v4, fuze, c2v2, clv2, y820, y920, y925, x747,\n"
|
||||
"\t 747p, x777, nn2g, m244, cli+, fuz2, hd20)\n");
|
||||
"\t 747p, x777, nn2g, m244, cli+, fuz2, hd20, hd30)\n");
|
||||
printf("\nNo option results in Archos standard player/recorder format.\n");
|
||||
|
||||
exit(1);
|
||||
|
@ -330,6 +330,8 @@ int main (int argc, char** argv)
|
|||
modelnum = 131;
|
||||
else if (!strcmp(&argv[1][5], "hd20")) /* MPIO HD200 */
|
||||
modelnum = 69;
|
||||
else if (!strcmp(&argv[1][5], "hd30")) /* MPIO HD300 */
|
||||
modelnum = 70;
|
||||
else {
|
||||
fprintf(stderr, "unsupported model: %s\n", &argv[1][5]);
|
||||
return 2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue