blob: cfef2b5bff310d25a750c5991c2e4e00faad0efc [file] [log] [blame]
Robert Hakc15b4052002-08-13 08:55:58 +00001/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $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"
Daniel Stenberg7c3dd402002-08-23 13:01:36 +000027#include "menu.h"
Daniel Stenberg42564a12002-08-21 17:24:42 +000028
Mats Lidelld5fd94d2002-10-11 11:12:00 +000029#include "string.h"
30#include "lcd.h"
31
Kjell Ericson32622072002-10-28 20:00:19 +000032extern char having_new_lcd;
33
34
Robert Hakc15b4052002-08-13 08:55:58 +000035void backlight_on(void)
36{
37 /* we could do something better here! */
38}
39
40void backlight_time(int dummy)
41{
42 (void)dummy;
43}
Björn Stenbergcd7691d2002-08-13 17:16:09 +000044
45int fat_startsector(void)
46{
47 return 63;
48}
49
50int ata_write_sectors(unsigned long start,
51 unsigned char count,
52 void* buf)
53{
54 int i;
55
56 for (i=0; i<count; i++ ) {
57 FILE* f;
58 char name[32];
59
60 DEBUGF("Writing sector %X\n",start+i);
61 sprintf(name,"sector%lX.bin",start+i);
62 f=fopen(name,"w");
63 if (f) {
64 fwrite(buf,512,1,f);
65 fclose(f);
66 }
67 }
68 return 1;
69}
70
71int ata_read_sectors(unsigned long start,
72 unsigned char count,
73 void* buf)
74{
75 int i;
76
77 for (i=0; i<count; i++ ) {
78 FILE* f;
79 char name[32];
80
81 DEBUGF("Reading sector %X\n",start+i);
82 sprintf(name,"sector%lX.bin",start+i);
83 f=fopen(name,"r");
84 if (f) {
85 fread(buf,512,1,f);
86 fclose(f);
87 }
88 }
89 return 1;
90}
Björn Stenbergc9d98ca2002-08-15 12:42:37 +000091
92void ata_delayed_write(unsigned long sector, void* buf)
93{
94 ata_write_sectors(sector,1,buf);
95}
Björn Stenberg6224cdb2002-08-16 14:41:47 +000096
97void ata_flush(void)
98{
99}
Daniel Stenberg42564a12002-08-21 17:24:42 +0000100
Björn Stenberg457b8a02002-08-26 13:21:14 +0000101void ata_spin(void)
102{
103}
104
105void ata_spindown(int s)
106{
107 (void)s;
108}
109
Björn Stenberga4c3b032002-09-24 18:04:15 +0000110bool simulate_usb(void)
Daniel Stenberg42564a12002-08-21 17:24:42 +0000111{
112 usb_display_info();
Björn Stenbergb1d51242002-08-21 18:11:06 +0000113 while (button_get(true) & BUTTON_REL);
Björn Stenberga4c3b032002-09-24 18:04:15 +0000114 return false;
Daniel Stenberg42564a12002-08-21 17:24:42 +0000115}
Linus Nielsen Feltzing644e4ce2002-09-03 08:29:03 +0000116
Daniel Stenbergb95fe1a2002-10-01 10:59:36 +0000117void backlight_set_timeout(int seconds)
118{
119 (void)seconds;
120}
Daniel Stenbergc43b36c2002-10-01 11:12:57 +0000121
122void backlight_set_on_when_charging(bool beep)
123{
124 (void)beep;
125}
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +0000126
Daniel Stenberga9b04be2003-01-27 14:40:02 +0000127/* original is in firmware/common/timefuncs.c */
128struct tm *get_time(void)
129{
130 time_t now = time(NULL);
131 return localtime(&now);
132}
133
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +0000134int rtc_read(int address)
135{
136 time_t now = time(NULL);
137 struct tm *teem = localtime(&now);
138
139 switch(address) {
140 case 3: /* hour */
141 return (teem->tm_hour%10) | ((teem->tm_hour/10) << 4);
142
143 case 2: /* minute */
144 return (teem->tm_min%10) | ((teem->tm_min/10) << 4);
Daniel Stenberg6e0a75c2002-10-15 12:24:09 +0000145
146 case 1: /* seconds */
147 return (teem->tm_sec%10) | ((teem->tm_sec/10) << 4);
148
149 case 7: /* year */
150 return ((teem->tm_year-100)%10) | (((teem->tm_year-100)/10) << 4);
151
152 case 6: /* month */
153 return ((teem->tm_mon+1)%10) | (((teem->tm_mon+1)/10) << 4);
154
155 case 5: /* day */
156 return (teem->tm_mday%10) | ((teem->tm_mday/10) << 4);
Daniel Stenbergd4d3a5d2002-10-11 18:48:22 +0000157 }
158
159 return address ^ 0x55;
160}
161
162int rtc_write(int address, int value)
163{
164 DEBUGF("write %x to address %x\n", value, address);
165 return 0;
166}
Daniel Stenbergb3438e82002-10-15 07:58:16 +0000167
168bool oscillograph(void)
169{
170 /* does nothing */
171 return false;
172}
Linus Nielsen Feltzing0a4b2472002-10-15 12:25:57 +0000173
Linus Nielsen Feltzing0a4b2472002-10-15 12:25:57 +0000174bool has_new_lcd(void)
175{
Kjell Ericson32622072002-10-28 20:00:19 +0000176 return having_new_lcd;
Linus Nielsen Feltzing0a4b2472002-10-15 12:25:57 +0000177}
Mats Lidella99c5652002-10-18 09:20:14 +0000178
179void lcd_set_contrast( int x )
180{
181 (void)x;
182}
Björn Stenberg5cb429e2002-10-18 14:03:11 +0000183
184void mpeg_set_pitch(int pitch)
185{
186 (void)pitch;
187}
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000188
Linus Nielsen Feltzingf1f7b612002-12-05 13:16:23 +0000189void mpeg_set_buffer_margin(int seconds)
190{
191 (void)seconds;
192}
193
Linus Nielsen Feltzing4a663272002-12-03 22:49:48 +0000194static int sleeptime;
195void set_sleep_timer(int seconds)
196{
197 sleeptime = seconds;
198}
199
200int get_sleep_timer(void)
201{
202 return sleeptime;
203}
204
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000205#ifdef HAVE_LCD_CHARCELLS
206void lcd_clearrect (int x, int y, int nx, int ny)
207{
208 /* Reprint char if you want to change anything */
Kjell Ericson08cbf692002-10-21 20:32:23 +0000209 (void)x;
210 (void)y;
211 (void)nx;
212 (void)ny;
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000213}
214
215void lcd_fillrect (int x, int y, int nx, int ny)
216{
217 /* Reprint char if you want to change display anything */
Kjell Ericson08cbf692002-10-21 20:32:23 +0000218 (void)x;
219 (void)y;
220 (void)nx;
221 (void)ny;
Kjell Ericsond19b9ed2002-10-21 20:16:14 +0000222}
223#endif
Björn Stenbergc4d8d972003-02-14 09:44:34 +0000224
225void cpu_sleep(bool enabled)
226{
227 (void)enabled;
228}