Robert Hak | c15b405 | 2002-08-13 08:55:58 +0000 | [diff] [blame] | 1 | /*************************************************************************** |
| 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 Stenberg | cd7691d | 2002-08-13 17:16:09 +0000 | [diff] [blame] | 19 | #include <stdio.h> |
Daniel Stenberg | d4d3a5d | 2002-10-11 18:48:22 +0000 | [diff] [blame] | 20 | #include <time.h> |
Markus Braun | 88098be | 2002-10-11 08:56:23 +0000 | [diff] [blame] | 21 | #include <stdbool.h> |
Daniel Stenberg | d4d3a5d | 2002-10-11 18:48:22 +0000 | [diff] [blame] | 22 | |
Björn Stenberg | cd7691d | 2002-08-13 17:16:09 +0000 | [diff] [blame] | 23 | #include "debug.h" |
Robert Hak | c15b405 | 2002-08-13 08:55:58 +0000 | [diff] [blame] | 24 | |
Markus Braun | 88098be | 2002-10-11 08:56:23 +0000 | [diff] [blame] | 25 | #include "screens.h" |
Daniel Stenberg | 42564a1 | 2002-08-21 17:24:42 +0000 | [diff] [blame] | 26 | #include "button.h" |
Daniel Stenberg | 7c3dd40 | 2002-08-23 13:01:36 +0000 | [diff] [blame] | 27 | #include "menu.h" |
Daniel Stenberg | 42564a1 | 2002-08-21 17:24:42 +0000 | [diff] [blame] | 28 | |
Mats Lidell | d5fd94d | 2002-10-11 11:12:00 +0000 | [diff] [blame] | 29 | #include "string.h" |
| 30 | #include "lcd.h" |
| 31 | |
Kjell Ericson | 3262207 | 2002-10-28 20:00:19 +0000 | [diff] [blame] | 32 | extern char having_new_lcd; |
| 33 | |
| 34 | |
Robert Hak | c15b405 | 2002-08-13 08:55:58 +0000 | [diff] [blame] | 35 | void backlight_on(void) |
| 36 | { |
| 37 | /* we could do something better here! */ |
| 38 | } |
| 39 | |
| 40 | void backlight_time(int dummy) |
| 41 | { |
| 42 | (void)dummy; |
| 43 | } |
Björn Stenberg | cd7691d | 2002-08-13 17:16:09 +0000 | [diff] [blame] | 44 | |
| 45 | int fat_startsector(void) |
| 46 | { |
| 47 | return 63; |
| 48 | } |
| 49 | |
| 50 | int 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 | |
| 71 | int 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 Stenberg | c9d98ca | 2002-08-15 12:42:37 +0000 | [diff] [blame] | 91 | |
| 92 | void ata_delayed_write(unsigned long sector, void* buf) |
| 93 | { |
| 94 | ata_write_sectors(sector,1,buf); |
| 95 | } |
Björn Stenberg | 6224cdb | 2002-08-16 14:41:47 +0000 | [diff] [blame] | 96 | |
| 97 | void ata_flush(void) |
| 98 | { |
| 99 | } |
Daniel Stenberg | 42564a1 | 2002-08-21 17:24:42 +0000 | [diff] [blame] | 100 | |
Björn Stenberg | 457b8a0 | 2002-08-26 13:21:14 +0000 | [diff] [blame] | 101 | void ata_spin(void) |
| 102 | { |
| 103 | } |
| 104 | |
| 105 | void ata_spindown(int s) |
| 106 | { |
| 107 | (void)s; |
| 108 | } |
| 109 | |
Björn Stenberg | a4c3b03 | 2002-09-24 18:04:15 +0000 | [diff] [blame] | 110 | bool simulate_usb(void) |
Daniel Stenberg | 42564a1 | 2002-08-21 17:24:42 +0000 | [diff] [blame] | 111 | { |
| 112 | usb_display_info(); |
Björn Stenberg | b1d5124 | 2002-08-21 18:11:06 +0000 | [diff] [blame] | 113 | while (button_get(true) & BUTTON_REL); |
Björn Stenberg | a4c3b03 | 2002-09-24 18:04:15 +0000 | [diff] [blame] | 114 | return false; |
Daniel Stenberg | 42564a1 | 2002-08-21 17:24:42 +0000 | [diff] [blame] | 115 | } |
Linus Nielsen Feltzing | 644e4ce | 2002-09-03 08:29:03 +0000 | [diff] [blame] | 116 | |
Daniel Stenberg | b95fe1a | 2002-10-01 10:59:36 +0000 | [diff] [blame] | 117 | void backlight_set_timeout(int seconds) |
| 118 | { |
| 119 | (void)seconds; |
| 120 | } |
Daniel Stenberg | c43b36c | 2002-10-01 11:12:57 +0000 | [diff] [blame] | 121 | |
| 122 | void backlight_set_on_when_charging(bool beep) |
| 123 | { |
| 124 | (void)beep; |
| 125 | } |
Daniel Stenberg | d4d3a5d | 2002-10-11 18:48:22 +0000 | [diff] [blame] | 126 | |
Daniel Stenberg | a9b04be | 2003-01-27 14:40:02 +0000 | [diff] [blame] | 127 | /* original is in firmware/common/timefuncs.c */ |
| 128 | struct tm *get_time(void) |
| 129 | { |
| 130 | time_t now = time(NULL); |
| 131 | return localtime(&now); |
| 132 | } |
| 133 | |
Daniel Stenberg | d4d3a5d | 2002-10-11 18:48:22 +0000 | [diff] [blame] | 134 | int 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 Stenberg | 6e0a75c | 2002-10-15 12:24:09 +0000 | [diff] [blame] | 145 | |
| 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 Stenberg | d4d3a5d | 2002-10-11 18:48:22 +0000 | [diff] [blame] | 157 | } |
| 158 | |
| 159 | return address ^ 0x55; |
| 160 | } |
| 161 | |
| 162 | int rtc_write(int address, int value) |
| 163 | { |
| 164 | DEBUGF("write %x to address %x\n", value, address); |
| 165 | return 0; |
| 166 | } |
Daniel Stenberg | b3438e8 | 2002-10-15 07:58:16 +0000 | [diff] [blame] | 167 | |
| 168 | bool oscillograph(void) |
| 169 | { |
| 170 | /* does nothing */ |
| 171 | return false; |
| 172 | } |
Linus Nielsen Feltzing | 0a4b247 | 2002-10-15 12:25:57 +0000 | [diff] [blame] | 173 | |
Linus Nielsen Feltzing | 0a4b247 | 2002-10-15 12:25:57 +0000 | [diff] [blame] | 174 | bool has_new_lcd(void) |
| 175 | { |
Kjell Ericson | 3262207 | 2002-10-28 20:00:19 +0000 | [diff] [blame] | 176 | return having_new_lcd; |
Linus Nielsen Feltzing | 0a4b247 | 2002-10-15 12:25:57 +0000 | [diff] [blame] | 177 | } |
Mats Lidell | a99c565 | 2002-10-18 09:20:14 +0000 | [diff] [blame] | 178 | |
| 179 | void lcd_set_contrast( int x ) |
| 180 | { |
| 181 | (void)x; |
| 182 | } |
Björn Stenberg | 5cb429e | 2002-10-18 14:03:11 +0000 | [diff] [blame] | 183 | |
| 184 | void mpeg_set_pitch(int pitch) |
| 185 | { |
| 186 | (void)pitch; |
| 187 | } |
Kjell Ericson | d19b9ed | 2002-10-21 20:16:14 +0000 | [diff] [blame] | 188 | |
Linus Nielsen Feltzing | f1f7b61 | 2002-12-05 13:16:23 +0000 | [diff] [blame] | 189 | void mpeg_set_buffer_margin(int seconds) |
| 190 | { |
| 191 | (void)seconds; |
| 192 | } |
| 193 | |
Linus Nielsen Feltzing | 4a66327 | 2002-12-03 22:49:48 +0000 | [diff] [blame] | 194 | static int sleeptime; |
| 195 | void set_sleep_timer(int seconds) |
| 196 | { |
| 197 | sleeptime = seconds; |
| 198 | } |
| 199 | |
| 200 | int get_sleep_timer(void) |
| 201 | { |
| 202 | return sleeptime; |
| 203 | } |
| 204 | |
Kjell Ericson | d19b9ed | 2002-10-21 20:16:14 +0000 | [diff] [blame] | 205 | #ifdef HAVE_LCD_CHARCELLS |
| 206 | void lcd_clearrect (int x, int y, int nx, int ny) |
| 207 | { |
| 208 | /* Reprint char if you want to change anything */ |
Kjell Ericson | 08cbf69 | 2002-10-21 20:32:23 +0000 | [diff] [blame] | 209 | (void)x; |
| 210 | (void)y; |
| 211 | (void)nx; |
| 212 | (void)ny; |
Kjell Ericson | d19b9ed | 2002-10-21 20:16:14 +0000 | [diff] [blame] | 213 | } |
| 214 | |
| 215 | void lcd_fillrect (int x, int y, int nx, int ny) |
| 216 | { |
| 217 | /* Reprint char if you want to change display anything */ |
Kjell Ericson | 08cbf69 | 2002-10-21 20:32:23 +0000 | [diff] [blame] | 218 | (void)x; |
| 219 | (void)y; |
| 220 | (void)nx; |
| 221 | (void)ny; |
Kjell Ericson | d19b9ed | 2002-10-21 20:16:14 +0000 | [diff] [blame] | 222 | } |
| 223 | #endif |
Björn Stenberg | c4d8d97 | 2003-02-14 09:44:34 +0000 | [diff] [blame] | 224 | |
| 225 | void cpu_sleep(bool enabled) |
| 226 | { |
| 227 | (void)enabled; |
| 228 | } |