2002-08-13 08:55:58 +00:00
|
|
|
/***************************************************************************
|
2006-09-03 21:00:19 +00:00
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
2002-08-13 08:55:58 +00:00
|
|
|
* $Id$
|
|
|
|
*
|
2008-05-05 10:32:46 +00:00
|
|
|
* Copyright (C) 2002 by Björn Stenberg <bjorn@haxx.se>
|
2002-08-13 08:55:58 +00:00
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* 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.
|
2002-08-13 08:55:58 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
2002-08-13 17:16:09 +00:00
|
|
|
#include <stdio.h>
|
2002-10-11 18:48:22 +00:00
|
|
|
#include <time.h>
|
2002-10-11 08:56:23 +00:00
|
|
|
#include <stdbool.h>
|
2002-08-13 17:16:09 +00:00
|
|
|
#include "debug.h"
|
2002-08-13 08:55:58 +00:00
|
|
|
|
2002-10-11 08:56:23 +00:00
|
|
|
#include "screens.h"
|
2002-08-21 17:24:42 +00:00
|
|
|
#include "button.h"
|
|
|
|
|
2002-10-11 11:12:00 +00:00
|
|
|
#include "string.h"
|
|
|
|
#include "lcd.h"
|
2005-02-22 12:19:12 +00:00
|
|
|
|
2008-12-03 19:54:25 +00:00
|
|
|
#include "power.h"
|
|
|
|
|
2004-12-28 22:38:47 +00:00
|
|
|
#include "ata.h" /* for volume definitions */
|
2002-10-11 11:12:00 +00:00
|
|
|
|
2008-11-02 02:19:39 +00:00
|
|
|
static bool storage_spinning = false;
|
2005-07-22 06:32:55 +00:00
|
|
|
|
2005-08-29 21:15:27 +00:00
|
|
|
#if CONFIG_CODEC != SWCODEC
|
2012-03-04 19:44:43 +00:00
|
|
|
#include "mp3_playback.h"
|
|
|
|
|
2008-03-28 12:51:33 +00:00
|
|
|
void audio_set_buffer_margin(int seconds)
|
2005-07-21 12:25:30 +00:00
|
|
|
{
|
|
|
|
(void)seconds;
|
|
|
|
}
|
2010-10-31 21:09:34 +00:00
|
|
|
|
|
|
|
/* firmware/target/sh/archos/audio-archos.c */
|
|
|
|
|
|
|
|
/* list of tracks in memory */
|
|
|
|
#define MAX_ID3_TAGS (1<<4) /* Must be power of 2 */
|
|
|
|
#define MAX_ID3_TAGS_MASK (MAX_ID3_TAGS - 1)
|
|
|
|
|
|
|
|
static bool paused; /* playback is paused */
|
|
|
|
static bool playing; /* We are playing an MP3 stream */
|
|
|
|
|
|
|
|
bool audio_is_initialized = false;
|
|
|
|
|
|
|
|
void mp3_init(int volume, int bass, int treble, int balance, int loudness,
|
|
|
|
int avc, int channel_config, int stereo_width,
|
|
|
|
int mdb_strength, int mdb_harmonics,
|
|
|
|
int mdb_center, int mdb_shape, bool mdb_enable,
|
|
|
|
bool superbass)
|
|
|
|
{
|
|
|
|
(void)volume;
|
|
|
|
(void)bass;
|
|
|
|
(void)treble;
|
|
|
|
(void)balance;
|
|
|
|
(void)loudness;
|
|
|
|
(void)avc;
|
|
|
|
(void)channel_config;
|
|
|
|
(void)stereo_width;
|
|
|
|
(void)mdb_strength;
|
|
|
|
(void)mdb_harmonics;
|
|
|
|
(void)mdb_center;
|
|
|
|
(void)mdb_shape;
|
|
|
|
(void)mdb_enable;
|
|
|
|
(void)superbass;
|
|
|
|
audio_is_initialized = true;
|
|
|
|
|
|
|
|
playing = false;
|
|
|
|
paused = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void mp3_play_pause(bool play)
|
|
|
|
{
|
|
|
|
(void)play;
|
|
|
|
}
|
|
|
|
|
|
|
|
void mp3_play_stop(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned char* mp3_get_pos(void)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-03-04 19:44:43 +00:00
|
|
|
void mp3_play_data(const void* start, size_t size,
|
|
|
|
mp3_play_callback_t get_more)
|
2010-10-31 21:09:34 +00:00
|
|
|
{
|
|
|
|
(void)start; (void)size; (void)get_more;
|
|
|
|
}
|
|
|
|
|
2012-01-04 00:07:27 +00:00
|
|
|
void mp3_shutdown(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-10-31 21:09:34 +00:00
|
|
|
/* firmware/drivers/audio/mas35xx.c */
|
|
|
|
#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
|
|
|
|
void audiohw_set_loudness(int value)
|
|
|
|
{
|
|
|
|
(void)value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void audiohw_set_avc(int value)
|
|
|
|
{
|
|
|
|
(void)value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void audiohw_set_mdb_strength(int value)
|
|
|
|
{
|
|
|
|
(void)value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void audiohw_set_mdb_harmonics(int value)
|
|
|
|
{
|
|
|
|
(void)value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void audiohw_set_mdb_center(int value)
|
|
|
|
{
|
|
|
|
(void)value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void audiohw_set_mdb_shape(int value)
|
|
|
|
{
|
|
|
|
(void)value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void audiohw_set_mdb_enable(int value)
|
|
|
|
{
|
|
|
|
(void)value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void audiohw_set_superbass(int value)
|
|
|
|
{
|
|
|
|
(void)value;
|
|
|
|
}
|
|
|
|
#endif /* (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) */
|
|
|
|
#endif /* CODEC != SWCODEC */
|
2005-07-21 12:25:30 +00:00
|
|
|
|
2002-08-13 17:16:09 +00:00
|
|
|
int fat_startsector(void)
|
|
|
|
{
|
|
|
|
return 63;
|
|
|
|
}
|
|
|
|
|
2007-08-12 19:49:03 +00:00
|
|
|
bool fat_ismounted(int volume)
|
|
|
|
{
|
|
|
|
(void)volume;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-07-04 13:37:52 +00:00
|
|
|
int storage_spinup_time(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-11-02 02:19:39 +00:00
|
|
|
int storage_init(void)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2013-08-17 16:18:22 +00:00
|
|
|
int storage_write_sectors(IF_MV(int drive,)
|
2004-12-28 22:38:47 +00:00
|
|
|
unsigned long start,
|
|
|
|
int count,
|
|
|
|
const void* buf)
|
2002-08-13 17:16:09 +00:00
|
|
|
{
|
2007-08-12 19:49:03 +00:00
|
|
|
IF_MV((void)drive;)
|
2002-08-13 17:16:09 +00:00
|
|
|
int i;
|
2006-09-03 21:00:19 +00:00
|
|
|
|
2002-08-13 17:16:09 +00:00
|
|
|
for (i=0; i<count; i++ ) {
|
|
|
|
FILE* f;
|
|
|
|
char name[32];
|
|
|
|
|
|
|
|
sprintf(name,"sector%lX.bin",start+i);
|
2006-09-28 08:45:40 +00:00
|
|
|
f=fopen(name,"wb");
|
2002-08-13 17:16:09 +00:00
|
|
|
if (f) {
|
2012-02-19 13:42:11 +00:00
|
|
|
if(fwrite(buf,512,1,f) != 1) {
|
|
|
|
fclose(f);
|
|
|
|
return -1;
|
|
|
|
}
|
2002-08-13 17:16:09 +00:00
|
|
|
fclose(f);
|
|
|
|
}
|
2012-02-19 13:42:11 +00:00
|
|
|
else {
|
|
|
|
return -1;
|
|
|
|
}
|
2002-08-13 17:16:09 +00:00
|
|
|
}
|
2012-01-22 20:22:53 +00:00
|
|
|
return 0;
|
2002-08-13 17:16:09 +00:00
|
|
|
}
|
|
|
|
|
2013-08-17 16:18:22 +00:00
|
|
|
int storage_read_sectors(IF_MV(int drive,)
|
2004-12-28 22:38:47 +00:00
|
|
|
unsigned long start,
|
|
|
|
int count,
|
2002-08-13 17:16:09 +00:00
|
|
|
void* buf)
|
|
|
|
{
|
2007-08-12 19:49:03 +00:00
|
|
|
IF_MV((void)drive;)
|
2002-08-13 17:16:09 +00:00
|
|
|
int i;
|
2012-01-22 20:22:53 +00:00
|
|
|
size_t ret;
|
2006-09-03 21:00:19 +00:00
|
|
|
|
2002-08-13 17:16:09 +00:00
|
|
|
for (i=0; i<count; i++ ) {
|
|
|
|
FILE* f;
|
|
|
|
char name[32];
|
|
|
|
|
2006-09-28 08:45:40 +00:00
|
|
|
DEBUGF("Reading sector %lX\n",start+i);
|
2002-08-13 17:16:09 +00:00
|
|
|
sprintf(name,"sector%lX.bin",start+i);
|
2006-09-28 08:45:40 +00:00
|
|
|
f=fopen(name,"rb");
|
2002-08-13 17:16:09 +00:00
|
|
|
if (f) {
|
2012-01-22 20:22:53 +00:00
|
|
|
ret = fread(buf,512,1,f);
|
2002-08-13 17:16:09 +00:00
|
|
|
fclose(f);
|
2012-02-19 13:42:11 +00:00
|
|
|
if (ret != 1)
|
2012-01-22 20:22:53 +00:00
|
|
|
return -1;
|
2002-08-13 17:16:09 +00:00
|
|
|
}
|
|
|
|
}
|
2012-01-22 20:22:53 +00:00
|
|
|
return 0;
|
2002-08-13 17:16:09 +00:00
|
|
|
}
|
2002-08-15 12:42:37 +00:00
|
|
|
|
2008-11-02 02:19:39 +00:00
|
|
|
void storage_spin(void)
|
2002-08-26 13:21:14 +00:00
|
|
|
{
|
2008-11-02 02:19:39 +00:00
|
|
|
storage_spinning = true;
|
2002-08-26 13:21:14 +00:00
|
|
|
}
|
|
|
|
|
2008-11-02 02:19:39 +00:00
|
|
|
void storage_sleep(void)
|
2008-04-13 12:24:47 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-11-02 02:19:39 +00:00
|
|
|
bool storage_disk_is_active(void)
|
2008-07-03 13:37:57 +00:00
|
|
|
{
|
2008-11-02 02:19:39 +00:00
|
|
|
return storage_spinning;
|
2008-07-03 13:37:57 +00:00
|
|
|
}
|
|
|
|
|
2008-11-02 02:19:39 +00:00
|
|
|
void storage_spindown(int s)
|
2002-08-26 13:21:14 +00:00
|
|
|
{
|
|
|
|
(void)s;
|
2008-11-02 02:19:39 +00:00
|
|
|
storage_spinning = false;
|
2002-08-26 13:21:14 +00:00
|
|
|
}
|
|
|
|
|
2002-10-11 18:48:22 +00:00
|
|
|
int rtc_read(int address)
|
|
|
|
{
|
2005-12-11 02:00:28 +00:00
|
|
|
return address ^ 0x55;
|
|
|
|
}
|
2002-10-15 12:24:09 +00:00
|
|
|
|
2005-12-11 02:00:28 +00:00
|
|
|
int rtc_write(int address, int value)
|
|
|
|
{
|
|
|
|
(void)address;
|
|
|
|
(void)value;
|
|
|
|
return 0;
|
|
|
|
}
|
2002-10-15 12:24:09 +00:00
|
|
|
|
2007-08-12 19:49:03 +00:00
|
|
|
#ifdef HAVE_RTC_ALARM
|
|
|
|
void rtc_get_alarm(int *h, int *m)
|
|
|
|
{
|
|
|
|
*h = 11;
|
|
|
|
*m = 55;
|
|
|
|
}
|
|
|
|
|
|
|
|
void rtc_set_alarm(int h, int m)
|
|
|
|
{
|
|
|
|
(void)h;
|
|
|
|
(void)m;
|
|
|
|
}
|
|
|
|
|
2010-05-22 00:28:26 +00:00
|
|
|
void rtc_enable_alarm(bool enable)
|
2007-08-12 19:49:03 +00:00
|
|
|
{
|
2010-05-22 00:28:26 +00:00
|
|
|
(void)enable;
|
2007-08-12 19:49:03 +00:00
|
|
|
}
|
|
|
|
|
2007-10-13 12:07:59 +00:00
|
|
|
extern bool sim_alarm_wakeup;
|
2007-08-12 19:49:03 +00:00
|
|
|
bool rtc_check_alarm_started(bool release_alarm)
|
|
|
|
{
|
2007-10-13 12:07:59 +00:00
|
|
|
(void)release_alarm;
|
|
|
|
return sim_alarm_wakeup;
|
2007-08-12 19:49:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool rtc_check_alarm_flag(void)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_HEADPHONE_DETECTION
|
|
|
|
bool headphones_inserted(void)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_SPDIF_POWER
|
|
|
|
void spdif_power_enable(bool on)
|
|
|
|
{
|
|
|
|
(void)on;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool spdif_powered(void)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2010-08-02 20:34:47 +00:00
|
|
|
#ifdef ARCHOS_PLAYER
|
2004-11-22 21:20:54 +00:00
|
|
|
bool is_new_player(void)
|
2002-10-15 12:25:57 +00:00
|
|
|
{
|
2010-08-02 20:34:47 +00:00
|
|
|
extern char having_new_lcd;
|
2002-10-28 20:00:19 +00:00
|
|
|
return having_new_lcd;
|
2002-10-15 12:25:57 +00:00
|
|
|
}
|
2010-08-02 20:34:47 +00:00
|
|
|
#endif
|
2002-10-15 12:25:57 +00:00
|
|
|
|
2007-08-12 19:49:03 +00:00
|
|
|
#ifdef HAVE_USB_POWER
|
|
|
|
bool usb_powered(void)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2008-12-03 20:43:10 +00:00
|
|
|
bool usb_charging_enable(bool on)
|
|
|
|
{
|
|
|
|
(void)on;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-11-23 17:43:42 +00:00
|
|
|
#ifndef USB_NONE
|
2007-08-12 19:49:03 +00:00
|
|
|
bool usb_inserted(void)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2009-11-23 17:43:42 +00:00
|
|
|
#endif
|
2007-08-12 19:49:03 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_REMOTE_LCD_TICKING
|
|
|
|
void lcd_remote_emireduce(bool state)
|
|
|
|
{
|
|
|
|
(void)state;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2002-10-18 09:20:14 +00:00
|
|
|
void lcd_set_contrast( int x )
|
2002-10-15 12:25:57 +00:00
|
|
|
{
|
2002-10-18 09:20:14 +00:00
|
|
|
(void)x;
|
2002-10-15 12:25:57 +00:00
|
|
|
}
|
2002-10-18 14:03:11 +00:00
|
|
|
|
|
|
|
void mpeg_set_pitch(int pitch)
|
|
|
|
{
|
|
|
|
(void)pitch;
|
|
|
|
}
|
2002-10-21 20:16:14 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LCD_CHARCELLS
|
|
|
|
void lcd_clearrect (int x, int y, int nx, int ny)
|
|
|
|
{
|
|
|
|
/* Reprint char if you want to change anything */
|
2002-10-21 20:32:23 +00:00
|
|
|
(void)x;
|
|
|
|
(void)y;
|
|
|
|
(void)nx;
|
|
|
|
(void)ny;
|
2002-10-21 20:16:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void lcd_fillrect (int x, int y, int nx, int ny)
|
|
|
|
{
|
|
|
|
/* Reprint char if you want to change display anything */
|
2002-10-21 20:32:23 +00:00
|
|
|
(void)x;
|
|
|
|
(void)y;
|
|
|
|
(void)nx;
|
|
|
|
(void)ny;
|
2002-10-21 20:16:14 +00:00
|
|
|
}
|
|
|
|
#endif
|
2003-02-14 09:44:34 +00:00
|
|
|
|
|
|
|
void cpu_sleep(bool enabled)
|
|
|
|
{
|
|
|
|
(void)enabled;
|
|
|
|
}
|
2003-12-20 10:00:37 +00:00
|
|
|
|
2008-05-29 21:53:49 +00:00
|
|
|
#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
|
|
|
|
void touchpad_set_sensitivity(int level)
|
|
|
|
{
|
|
|
|
(void)level;
|
|
|
|
}
|
|
|
|
#endif
|
2013-09-02 09:03:56 +00:00
|
|
|
|
2013-09-05 18:35:51 +00:00
|
|
|
#if defined(HAVE_TOUCHSCREEN) && !defined(HAS_BUTTON_HOLD)
|
2013-09-02 09:03:56 +00:00
|
|
|
void touchscreen_enable_device(bool en)
|
|
|
|
{
|
|
|
|
(void)en;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-09-05 18:35:51 +00:00
|
|
|
#if defined(HAVE_TOUCHPAD) && !defined(HAS_BUTTON_HOLD)
|
2013-09-02 09:03:56 +00:00
|
|
|
void touchpad_enable_device(bool en)
|
|
|
|
{
|
|
|
|
(void)en;
|
|
|
|
}
|
|
|
|
#endif
|