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"
|
|
|
|
|
|
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! */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void backlight_time(int dummy)
|
|
|
|
|
{
|
|
|
|
|
(void)dummy;
|
|
|
|
|
}
|
2002-08-13 17:16:09 +00:00
|
|
|
|
|
|
|
|
|
int fat_startsector(void)
|
|
|
|
|
{
|
|
|
|
|
return 63;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int ata_write_sectors(unsigned long start,
|
|
|
|
|
unsigned char count,
|
|
|
|
|
void* buf)
|
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int ata_read_sectors(unsigned long start,
|
|
|
|
|
unsigned char count,
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
void ata_delayed_write(unsigned long sector, void* buf)
|
|
|
|
|
{
|
|
|
|
|
ata_write_sectors(sector,1,buf);
|
|
|
|
|
}
|
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
|
|
|
|
|
2003-01-27 14:40:02 +00:00
|
|
|
|
/* original is in firmware/common/timefuncs.c */
|
|
|
|
|
struct tm *get_time(void)
|
|
|
|
|
{
|
|
|
|
|
time_t now = time(NULL);
|
|
|
|
|
return localtime(&now);
|
|
|
|
|
}
|
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
DEBUGF("write %x to address %x\n", value, address);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2002-10-15 07:58:16 +00:00
|
|
|
|
|
2002-10-18 09:20:14 +00:00
|
|
|
|
bool has_new_lcd(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
|
|
|
|
|
2002-12-05 13:16:23 +00:00
|
|
|
|
void mpeg_set_buffer_margin(int seconds)
|
|
|
|
|
{
|
|
|
|
|
(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
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
const char* dir_thumbnail_name = ".dirname.mp3";
|