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
|
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;
|
|
|
|
}
|
|
|
|
#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;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
int storage_write_sectors(IF_MV2(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) {
|
|
|
|
fwrite(buf,512,1,f);
|
|
|
|
fclose(f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2008-11-02 02:19:39 +00:00
|
|
|
int storage_read_sectors(IF_MV2(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;
|
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
|
|
|
|
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
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2009-09-26 14:58:32 +00:00
|
|
|
int rtc_read_datetime(struct tm *tm)
|
2005-12-11 02:00:28 +00:00
|
|
|
{
|
|
|
|
time_t now = time(NULL);
|
2009-09-26 14:58:32 +00:00
|
|
|
*tm = *localtime(&now);
|
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
|
|
|
}
|
|
|
|
|
2009-09-26 14:58:32 +00:00
|
|
|
int rtc_write_datetime(const struct tm *tm)
|
2002-10-11 18:48:22 +00:00
|
|
|
{
|
2009-09-26 14:58:32 +00:00
|
|
|
(void)tm;
|
2005-12-11 02:00:28 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
2007-08-12 19:49:03 +00:00
|
|
|
#if CONFIG_CHARGING
|
2008-12-03 19:54:25 +00:00
|
|
|
bool charger_inserted(void)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2008-12-03 20:43:10 +00:00
|
|
|
bool power_input_present(void)
|
2007-08-12 19:49:03 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2008-12-03 20:43:10 +00:00
|
|
|
|
|
|
|
unsigned int power_input_status(void)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_BATTERY_SWITCH
|
|
|
|
return POWER_INPUT_BATTERY;
|
|
|
|
#else
|
|
|
|
return POWER_INPUT_NONE;
|
2007-08-12 19:49:03 +00:00
|
|
|
#endif
|
2008-12-03 20:43:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool charging_state(void)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_CHARGING */
|
2007-08-12 19:49:03 +00:00
|
|
|
|
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
|
|
|
|
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
|
|
|
|
2008-05-29 21:53:49 +00:00
|
|
|
#ifdef HAVE_TOUCHPAD_SENSITIVITY_SETTING
|
|
|
|
void touchpad_set_sensitivity(int level)
|
|
|
|
{
|
|
|
|
(void)level;
|
|
|
|
}
|
|
|
|
#endif
|