blob: 5cc312a3547538f5a5d6a99cc295740bc105407d [file] [log] [blame]
Robert Hakc15b4052002-08-13 08:55:58 +00001/***************************************************************************
Daniel Ankers8300d8c2006-09-03 21:00:19 +00002 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
Robert Hakc15b4052002-08-13 08:55:58 +00008 * $Id$
9 *
10 * Copyright (C) 2002 by Björn Stenberg <bjorn@haxx.se>
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
Björn Stenbergcd7691d2002-08-13 17:16:09 +000019#include <stdio.h>
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +000020#include <time.h>
Markus Braun88098be2002-10-11 08:56:23 +000021#include <stdbool.h>
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +000022
Björn Stenbergcd7691d2002-08-13 17:16:09 +000023#include "debug.h"
Robert Hakc15b4052002-08-13 08:55:58 +000024
Markus Braun88098be2002-10-11 08:56:23 +000025#include "screens.h"
Daniel Stenberg42564a12002-08-21 17:24:42 +000026#include "button.h"
27
Mats Lidelld5fd94d2002-10-11 11:12:00 +000028#include "string.h"
29#include "lcd.h"
Daniel Stenberg22b77012005-02-22 12:19:12 +000030
Jörg Hohensohnc540e822004-12-28 22:38:47 +000031#include "ata.h" /* for volume definitions */
Mats Lidelld5fd94d2002-10-11 11:12:00 +000032
Kjell Ericson32622072002-10-28 20:00:19 +000033extern char having_new_lcd;
Miika Pekkarineneab434c2005-07-22 06:32:55 +000034
Jens Arnoldd6c05452005-08-29 21:15:27 +000035#if CONFIG_CODEC != SWCODEC
Miika Pekkarinen3b6a9f32005-07-21 12:25:30 +000036void audio_set_buffer_margin(int seconds)
37{
38 (void)seconds;
39}
40#endif
41
Björn Stenbergcd7691d2002-08-13 17:16:09 +000042int fat_startsector(void)
43{
44 return 63;
45}
46
Jörg Hohensohnc540e822004-12-28 22:38:47 +000047int ata_write_sectors(IF_MV2(int drive,)
48 unsigned long start,
49 int count,
50 const void* buf)
Björn Stenbergcd7691d2002-08-13 17:16:09 +000051{
52 int i;
Daniel Ankers8300d8c2006-09-03 21:00:19 +000053
Björn Stenbergcd7691d2002-08-13 17:16:09 +000054 for (i=0; i<count; i++ ) {
55 FILE* f;
56 char name[32];
57
Björn Stenbergcd7691d2002-08-13 17:16:09 +000058 sprintf(name,"sector%lX.bin",start+i);
Steve Bavin076ab8d2006-09-28 08:45:40 +000059 f=fopen(name,"wb");
Björn Stenbergcd7691d2002-08-13 17:16:09 +000060 if (f) {
61 fwrite(buf,512,1,f);
62 fclose(f);
63 }
64 }
65 return 1;
66}
67
Jörg Hohensohnc540e822004-12-28 22:38:47 +000068int ata_read_sectors(IF_MV2(int drive,)
69 unsigned long start,
70 int count,
Björn Stenbergcd7691d2002-08-13 17:16:09 +000071 void* buf)
72{
73 int i;
Daniel Ankers8300d8c2006-09-03 21:00:19 +000074
Björn Stenbergcd7691d2002-08-13 17:16:09 +000075 for (i=0; i<count; i++ ) {
76 FILE* f;
77 char name[32];
78
Steve Bavin076ab8d2006-09-28 08:45:40 +000079 DEBUGF("Reading sector %lX\n",start+i);
Björn Stenbergcd7691d2002-08-13 17:16:09 +000080 sprintf(name,"sector%lX.bin",start+i);
Steve Bavin076ab8d2006-09-28 08:45:40 +000081 f=fopen(name,"rb");
Björn Stenbergcd7691d2002-08-13 17:16:09 +000082 if (f) {
83 fread(buf,512,1,f);
84 fclose(f);
85 }
86 }
87 return 1;
88}
Björn Stenbergc9d98ca2002-08-15 12:42:37 +000089
Jörg Hohensohnc540e822004-12-28 22:38:47 +000090void ata_delayed_write(unsigned long sector, const void* buf)
Björn Stenbergc9d98ca2002-08-15 12:42:37 +000091{
Jörg Hohensohnc540e822004-12-28 22:38:47 +000092 ata_write_sectors(IF_MV2(0,) sector, 1, buf);
Björn Stenbergc9d98ca2002-08-15 12:42:37 +000093}
Björn Stenberg6224cdb2002-08-16 14:41:47 +000094
95void ata_flush(void)
96{
97}
Daniel Stenberg42564a12002-08-21 17:24:42 +000098
Björn Stenberg457b8a02002-08-26 13:21:14 +000099void ata_spin(void)
100{
101}
102
103void ata_spindown(int s)
104{
105 (void)s;
106}
107
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +0000108int rtc_read(int address)
109{
Dave Chapman060320b2005-12-11 02:00:28 +0000110 return address ^ 0x55;
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +0000111}
112
113int rtc_write(int address, int value)
114{
Linus Nielsen Feltzing33519052004-11-17 12:45:07 +0000115 (void)address;
116 (void)value;
Dave Chapman060320b2005-12-11 02:00:28 +0000117 return 0;
118}
119
120int rtc_read_datetime(unsigned char* buf)
121{
122 time_t now = time(NULL);
123 struct tm *teem = localtime(&now);
124
125 buf[0] = (teem->tm_sec%10) | ((teem->tm_sec/10) << 4);
126 buf[1] = (teem->tm_min%10) | ((teem->tm_min/10) << 4);
127 buf[2] = (teem->tm_hour%10) | ((teem->tm_hour/10) << 4);
128 buf[3] = (teem->tm_wday);
129 buf[4] = (teem->tm_mday%10) | ((teem->tm_mday/10) << 4);
130 buf[5] = ((teem->tm_year-100)%10) | (((teem->tm_year-100)/10) << 4);
131 buf[6] = ((teem->tm_mon+1)%10) | (((teem->tm_mon+1)/10) << 4);
132
133 return 0;
134}
135
136int rtc_write_datetime(unsigned char* buf)
137{
138 (void)buf;
139 return 0;
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +0000140}
Daniel Stenbergb3438e82002-10-15 07:58:16 +0000141
Jens Arnoldd4e53972004-11-22 21:20:54 +0000142bool is_new_player(void)
Linus Nielsen Feltzing0a4b2472002-10-15 12:25:57 +0000143{
Kjell Ericson32622072002-10-28 20:00:19 +0000144 return having_new_lcd;
Linus Nielsen Feltzing0a4b2472002-10-15 12:25:57 +0000145}
Mats Lidella99c5652002-10-18 09:20:14 +0000146
147void lcd_set_contrast( int x )
148{
149 (void)x;
150}
Björn Stenberg5cb429e2002-10-18 14:03:11 +0000151
152void mpeg_set_pitch(int pitch)
153{
154 (void)pitch;
155}
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000156
Linus Nielsen Feltzing4a663272002-12-03 22:49:48 +0000157static int sleeptime;
158void set_sleep_timer(int seconds)
159{
160 sleeptime = seconds;
161}
162
163int get_sleep_timer(void)
164{
165 return sleeptime;
166}
167
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000168#ifdef HAVE_LCD_CHARCELLS
169void lcd_clearrect (int x, int y, int nx, int ny)
170{
171 /* Reprint char if you want to change anything */
Kjell Ericson08cbf692002-10-21 20:32:23 +0000172 (void)x;
173 (void)y;
174 (void)nx;
175 (void)ny;
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000176}
177
178void lcd_fillrect (int x, int y, int nx, int ny)
179{
180 /* Reprint char if you want to change display anything */
Kjell Ericson08cbf692002-10-21 20:32:23 +0000181 (void)x;
182 (void)y;
183 (void)nx;
184 (void)ny;
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000185}
186#endif
Björn Stenbergc4d8d972003-02-14 09:44:34 +0000187
188void cpu_sleep(bool enabled)
189{
190 (void)enabled;
191}
Jörg Hohensohna5e1d062003-12-20 10:00:37 +0000192
193void button_set_flip(bool yesno)
194{
195 (void)yesno;
196}
Jörg Hohensohn4f36ea82004-03-14 21:33:53 +0000197
Jens Arnoldd6c05452005-08-29 21:15:27 +0000198#if CONFIG_CODEC != SWCODEC
Jörg Hohensohn9568ca62004-04-06 07:21:55 +0000199void talk_init(void)
200{
201}
202
Jörg Hohensohn4f36ea82004-03-14 21:33:53 +0000203int talk_buffer_steal(void)
204{
205 return 0;
206}
207
Jörg Hohensohn78f06b92004-03-19 22:41:36 +0000208int talk_id(int id, bool enqueue)
Jörg Hohensohn4f36ea82004-03-14 21:33:53 +0000209{
210 (void)id;
Jörg Hohensohn78f06b92004-03-19 22:41:36 +0000211 (void)enqueue;
Jörg Hohensohn4f36ea82004-03-14 21:33:53 +0000212 return 0;
213}
214
Jörg Hohensohn78f06b92004-03-19 22:41:36 +0000215int talk_file(char* filename, bool enqueue)
Jörg Hohensohn4f36ea82004-03-14 21:33:53 +0000216{
217 (void)filename;
Jörg Hohensohn78f06b92004-03-19 22:41:36 +0000218 (void)enqueue;
219 return 0;
220}
221
222int talk_value(int n, int unit, bool enqueue)
223{
224 (void)n;
225 (void)unit;
226 (void)enqueue;
Jörg Hohensohn4f36ea82004-03-14 21:33:53 +0000227 return 0;
228}
Jörg Hohensohn5495d6e2004-03-21 00:15:16 +0000229
230int talk_number(int n, bool enqueue)
231{
232 (void)n;
233 (void)enqueue;
234 return 0;
235}
Jörg Hohensohn5e4aa642004-03-27 00:42:32 +0000236
Daniel Ankers8300d8c2006-09-03 21:00:19 +0000237int talk_spell(char* spell, bool enqueue)
Jörg Hohensohnc778aa62004-04-04 20:34:28 +0000238{
239 (void)spell;
240 (void)enqueue;
241 return 0;
242}
243
Steve Bavinc0e6e202007-06-11 09:04:50 +0000244bool talk_menus_enabled(void)
245{
246 return false;
247}
248
249void talk_enable_menus(void)
250{
251}
252
253void talk_disable_menus(void)
254{
255}
256
Linus Nielsen Feltzingcdd236c2005-01-20 22:32:09 +0000257const char* const dir_thumbnail_name = "_dirname.talk";
Jörg Hohensohn687793c2004-10-21 19:07:46 +0000258const char* const file_thumbnail_ext = ".talk";
Miika Pekkarinen159c52d2005-08-20 11:13:19 +0000259#endif
Jörg Hohensohne7b2ed92004-05-01 15:55:41 +0000260
Jörg Hohensohnb1403ee2004-07-23 23:01:20 +0000261/* assure an unused place to direct virtual pointers to */
Daniel Stenberg22b77012005-02-22 12:19:12 +0000262#define VIRT_SIZE 0xFFFF /* more than enough for our string ID range */
Jörg Hohensohnb1403ee2004-07-23 23:01:20 +0000263unsigned char vp_dummy[VIRT_SIZE];
264