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$
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2002 by Bj<EFBFBD>rn Stenberg <bjorn@haxx.se>
|
|
|
|
|
*
|
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
|
*
|
|
|
|
|
* 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-10-11 18:48:22 +00:00
|
|
|
|
|
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
|
|
|
|
|
2004-12-28 22:38:47 +00:00
|
|
|
|
#include "ata.h" /* for volume definitions */
|
2002-10-11 11:12:00 +00:00
|
|
|
|
|
2002-10-28 20:00:19 +00:00
|
|
|
|
extern char having_new_lcd;
|
2005-07-22 06:32:55 +00:00
|
|
|
|
|
2005-08-29 21:15:27 +00:00
|
|
|
|
#if CONFIG_CODEC != SWCODEC
|
2005-07-21 12:25:30 +00:00
|
|
|
|
void audio_set_buffer_margin(int seconds)
|
|
|
|
|
{
|
|
|
|
|
(void)seconds;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2004-12-28 22:38:47 +00:00
|
|
|
|
int ata_write_sectors(IF_MV2(int drive,)
|
|
|
|
|
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) {
|
|
|
|
|
fwrite(buf,512,1,f);
|
|
|
|
|
fclose(f);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2004-12-28 22:38:47 +00:00
|
|
|
|
int ata_read_sectors(IF_MV2(int drive,)
|
|
|
|
|
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;
|
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) {
|
|
|
|
|
fread(buf,512,1,f);
|
|
|
|
|
fclose(f);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2002-08-15 12:42:37 +00:00
|
|
|
|
|
2004-12-28 22:38:47 +00:00
|
|
|
|
void ata_delayed_write(unsigned long sector, const void* buf)
|
2002-08-15 12:42:37 +00:00
|
|
|
|
{
|
2004-12-28 22:38:47 +00:00
|
|
|
|
ata_write_sectors(IF_MV2(0,) sector, 1, buf);
|
2002-08-15 12:42:37 +00:00
|
|
|
|
}
|
2002-08-16 14:41:47 +00:00
|
|
|
|
|
|
|
|
|
void ata_flush(void)
|
|
|
|
|
{
|
|
|
|
|
}
|
2002-08-21 17:24:42 +00:00
|
|
|
|
|
2002-08-26 13:21:14 +00:00
|
|
|
|
void ata_spin(void)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ata_spindown(int s)
|
|
|
|
|
{
|
|
|
|
|
(void)s;
|
|
|
|
|
}
|
|
|
|
|
|
2007-08-12 19:49:03 +00:00
|
|
|
|
void rtc_init(void)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
|
2005-12-11 02:00:28 +00:00
|
|
|
|
int rtc_read_datetime(unsigned char* buf)
|
|
|
|
|
{
|
|
|
|
|
time_t now = time(NULL);
|
|
|
|
|
struct tm *teem = localtime(&now);
|
2002-10-15 12:24:09 +00:00
|
|
|
|
|
2005-12-11 02:00:28 +00:00
|
|
|
|
buf[0] = (teem->tm_sec%10) | ((teem->tm_sec/10) << 4);
|
|
|
|
|
buf[1] = (teem->tm_min%10) | ((teem->tm_min/10) << 4);
|
|
|
|
|
buf[2] = (teem->tm_hour%10) | ((teem->tm_hour/10) << 4);
|
|
|
|
|
buf[3] = (teem->tm_wday);
|
|
|
|
|
buf[4] = (teem->tm_mday%10) | ((teem->tm_mday/10) << 4);
|
|
|
|
|
buf[5] = ((teem->tm_year-100)%10) | (((teem->tm_year-100)/10) << 4);
|
|
|
|
|
buf[6] = ((teem->tm_mon+1)%10) | (((teem->tm_mon+1)/10) << 4);
|
2002-10-11 18:48:22 +00:00
|
|
|
|
|
2005-12-11 02:00:28 +00:00
|
|
|
|
return 0;
|
2002-10-11 18:48:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-12-11 02:00:28 +00:00
|
|
|
|
int rtc_write_datetime(unsigned char* buf)
|
2002-10-11 18:48:22 +00:00
|
|
|
|
{
|
2005-12-11 02:00:28 +00:00
|
|
|
|
(void)buf;
|
|
|
|
|
return 0;
|
2002-10-11 18:48:22 +00:00
|
|
|
|
}
|
2002-10-15 07:58:16 +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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool rtc_enable_alarm(bool enable)
|
|
|
|
|
{
|
|
|
|
|
return enable;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool rtc_check_alarm_started(bool release_alarm)
|
|
|
|
|
{
|
|
|
|
|
return release_alarm;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool rtc_check_alarm_flag(void)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_HEADPHONE_DETECTION
|
|
|
|
|
bool headphones_inserted(void)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_LCD_ENABLE
|
|
|
|
|
bool lcd_enabled(void)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
bool charging_state(void)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool charger_inserted(void)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_SPDIF_POWER
|
|
|
|
|
void spdif_power_enable(bool on)
|
|
|
|
|
{
|
|
|
|
|
(void)on;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool spdif_powered(void)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2004-11-22 21:20:54 +00:00
|
|
|
|
bool is_new_player(void)
|
2002-10-15 12:25:57 +00:00
|
|
|
|
{
|
2002-10-28 20:00:19 +00:00
|
|
|
|
return having_new_lcd;
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if CONFIG_CHARGING
|
|
|
|
|
bool usb_charging_enable(bool on)
|
|
|
|
|
{
|
|
|
|
|
(void)on;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
bool usb_inserted(void)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#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
|
|
|
|
|
2002-12-03 22:49:48 +00:00
|
|
|
|
static int sleeptime;
|
|
|
|
|
void set_sleep_timer(int seconds)
|
|
|
|
|
{
|
|
|
|
|
sleeptime = seconds;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int get_sleep_timer(void)
|
|
|
|
|
{
|
|
|
|
|
return sleeptime;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
void button_set_flip(bool yesno)
|
|
|
|
|
{
|
|
|
|
|
(void)yesno;
|
|
|
|
|
}
|
2004-03-14 21:33:53 +00:00
|
|
|
|
|
2005-08-29 21:15:27 +00:00
|
|
|
|
#if CONFIG_CODEC != SWCODEC
|
2004-04-06 07:21:55 +00:00
|
|
|
|
void talk_init(void)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2004-03-14 21:33:53 +00:00
|
|
|
|
int talk_buffer_steal(void)
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2004-03-19 22:41:36 +00:00
|
|
|
|
int talk_id(int id, bool enqueue)
|
2004-03-14 21:33:53 +00:00
|
|
|
|
{
|
|
|
|
|
(void)id;
|
2004-03-19 22:41:36 +00:00
|
|
|
|
(void)enqueue;
|
2004-03-14 21:33:53 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2004-03-19 22:41:36 +00:00
|
|
|
|
int talk_file(char* filename, bool enqueue)
|
2004-03-14 21:33:53 +00:00
|
|
|
|
{
|
|
|
|
|
(void)filename;
|
2004-03-19 22:41:36 +00:00
|
|
|
|
(void)enqueue;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int talk_value(int n, int unit, bool enqueue)
|
|
|
|
|
{
|
|
|
|
|
(void)n;
|
|
|
|
|
(void)unit;
|
|
|
|
|
(void)enqueue;
|
2004-03-14 21:33:53 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2004-03-21 00:15:16 +00:00
|
|
|
|
|
|
|
|
|
int talk_number(int n, bool enqueue)
|
|
|
|
|
{
|
|
|
|
|
(void)n;
|
|
|
|
|
(void)enqueue;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2004-03-27 00:42:32 +00:00
|
|
|
|
|
2006-09-03 21:00:19 +00:00
|
|
|
|
int talk_spell(char* spell, bool enqueue)
|
2004-04-04 20:34:28 +00:00
|
|
|
|
{
|
|
|
|
|
(void)spell;
|
|
|
|
|
(void)enqueue;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2007-06-11 09:04:50 +00:00
|
|
|
|
bool talk_menus_enabled(void)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void talk_enable_menus(void)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void talk_disable_menus(void)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2005-01-20 22:32:09 +00:00
|
|
|
|
const char* const dir_thumbnail_name = "_dirname.talk";
|
2004-10-21 19:07:46 +00:00
|
|
|
|
const char* const file_thumbnail_ext = ".talk";
|
2005-08-20 11:13:19 +00:00
|
|
|
|
#endif
|
2004-05-01 15:55:41 +00:00
|
|
|
|
|
2004-07-23 23:01:20 +00:00
|
|
|
|
/* assure an unused place to direct virtual pointers to */
|
2005-02-22 12:19:12 +00:00
|
|
|
|
#define VIRT_SIZE 0xFFFF /* more than enough for our string ID range */
|
2004-07-23 23:01:20 +00:00
|
|
|
|
unsigned char vp_dummy[VIRT_SIZE];
|
|
|
|
|
|