2002-08-13 08:55:58 +00:00
|
|
|
|
/***************************************************************************
|
|
|
|
|
* __________ __ ___.
|
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
|
* $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-08-23 13:01:36 +00:00
|
|
|
|
#include "menu.h"
|
2002-08-21 17:24:42 +00:00
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
|
2002-08-13 08:55:58 +00:00
|
|
|
|
void backlight_on(void)
|
|
|
|
|
{
|
|
|
|
|
/* we could do something better here! */
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-18 10:05:46 +00:00
|
|
|
|
void backlight_off(void)
|
|
|
|
|
{
|
|
|
|
|
/* we could do something better here! */
|
|
|
|
|
}
|
|
|
|
|
|
2002-08-13 08:55:58 +00:00
|
|
|
|
void backlight_time(int dummy)
|
|
|
|
|
{
|
|
|
|
|
(void)dummy;
|
|
|
|
|
}
|
2002-08-13 17:16:09 +00:00
|
|
|
|
|
|
|
|
|
int fat_startsector(void)
|
|
|
|
|
{
|
|
|
|
|
return 63;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i=0; i<count; i++ ) {
|
|
|
|
|
FILE* f;
|
|
|
|
|
char name[32];
|
|
|
|
|
|
|
|
|
|
DEBUGF("Writing sector %X\n",start+i);
|
|
|
|
|
sprintf(name,"sector%lX.bin",start+i);
|
|
|
|
|
f=fopen(name,"w");
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i=0; i<count; i++ ) {
|
|
|
|
|
FILE* f;
|
|
|
|
|
char name[32];
|
|
|
|
|
|
|
|
|
|
DEBUGF("Reading sector %X\n",start+i);
|
|
|
|
|
sprintf(name,"sector%lX.bin",start+i);
|
|
|
|
|
f=fopen(name,"r");
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2002-09-24 18:04:15 +00:00
|
|
|
|
bool simulate_usb(void)
|
2002-08-21 17:24:42 +00:00
|
|
|
|
{
|
|
|
|
|
usb_display_info();
|
2002-08-21 18:11:06 +00:00
|
|
|
|
while (button_get(true) & BUTTON_REL);
|
2002-09-24 18:04:15 +00:00
|
|
|
|
return false;
|
2002-08-21 17:24:42 +00:00
|
|
|
|
}
|
2002-09-03 08:29:03 +00:00
|
|
|
|
|
2004-01-30 23:27:44 +00:00
|
|
|
|
void backlight_set_timeout(int index)
|
2002-10-01 10:59:36 +00:00
|
|
|
|
{
|
2004-01-30 23:27:44 +00:00
|
|
|
|
(void)index;
|
2002-10-01 10:59:36 +00:00
|
|
|
|
}
|
2002-10-01 11:12:57 +00:00
|
|
|
|
|
|
|
|
|
void backlight_set_on_when_charging(bool beep)
|
|
|
|
|
{
|
|
|
|
|
(void)beep;
|
|
|
|
|
}
|
2002-10-11 18:48:22 +00:00
|
|
|
|
|
2005-05-30 06:42:14 +00:00
|
|
|
|
void remote_backlight_set_timeout(int index)
|
|
|
|
|
{
|
|
|
|
|
(void)index;
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-11 18:48:22 +00:00
|
|
|
|
int rtc_read(int address)
|
|
|
|
|
{
|
|
|
|
|
time_t now = time(NULL);
|
|
|
|
|
struct tm *teem = localtime(&now);
|
|
|
|
|
|
|
|
|
|
switch(address) {
|
|
|
|
|
case 3: /* hour */
|
|
|
|
|
return (teem->tm_hour%10) | ((teem->tm_hour/10) << 4);
|
|
|
|
|
|
|
|
|
|
case 2: /* minute */
|
|
|
|
|
return (teem->tm_min%10) | ((teem->tm_min/10) << 4);
|
2002-10-15 12:24:09 +00:00
|
|
|
|
|
|
|
|
|
case 1: /* seconds */
|
|
|
|
|
return (teem->tm_sec%10) | ((teem->tm_sec/10) << 4);
|
|
|
|
|
|
|
|
|
|
case 7: /* year */
|
|
|
|
|
return ((teem->tm_year-100)%10) | (((teem->tm_year-100)/10) << 4);
|
|
|
|
|
|
|
|
|
|
case 6: /* month */
|
|
|
|
|
return ((teem->tm_mon+1)%10) | (((teem->tm_mon+1)/10) << 4);
|
|
|
|
|
|
|
|
|
|
case 5: /* day */
|
|
|
|
|
return (teem->tm_mday%10) | ((teem->tm_mday/10) << 4);
|
2002-10-11 18:48:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return address ^ 0x55;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int rtc_write(int address, int value)
|
|
|
|
|
{
|
2004-11-17 12:45:07 +00:00
|
|
|
|
(void)address;
|
|
|
|
|
(void)value;
|
|
|
|
|
return 0;
|
2002-10-11 18:48:22 +00:00
|
|
|
|
}
|
2002-10-15 07:58:16 +00:00
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
|
2005-04-04 12:06:29 +00:00
|
|
|
|
void audio_set_buffer_margin(int seconds)
|
2002-12-05 13:16:23 +00:00
|
|
|
|
{
|
|
|
|
|
(void)seconds;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
2004-04-04 20:34:28 +00:00
|
|
|
|
int talk_spell(char* spell, bool enqueue)
|
|
|
|
|
{
|
|
|
|
|
(void)spell;
|
|
|
|
|
(void)enqueue;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
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";
|
2004-05-01 15:55:41 +00:00
|
|
|
|
|
|
|
|
|
/* FIXME: this shoudn't be a stub, rather the real thing.
|
|
|
|
|
I'm afraid on Win32/X11 it'll be hard to kill a thread from outside. */
|
|
|
|
|
void remove_thread(int threadnum)
|
|
|
|
|
{
|
|
|
|
|
(void)threadnum;
|
|
|
|
|
}
|
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];
|
|
|
|
|
|