diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/disk.c | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/firmware/disk.c b/firmware/disk.c new file mode 100644 index 0000000000..9d131f0421 --- /dev/null +++ b/firmware/disk.c | |||
@@ -0,0 +1,134 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by wavey@wavey.org | ||
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 | ****************************************************************************/ | ||
19 | |||
20 | #include <stdio.h> | ||
21 | #include <malloc.h> | ||
22 | #include "disk.h" | ||
23 | #include "debug.h" | ||
24 | #include "panic.h" | ||
25 | |||
26 | void read_file_into_buffer( char **buf, const char *filename ) | ||
27 | { | ||
28 | /*char debug_message[128]; */ | ||
29 | int i; | ||
30 | FILE *fp; | ||
31 | int count = 0; | ||
32 | |||
33 | /*sprintf( debug_message, "read_file_into_buffer( %s, %s )\n", *buf, filename ); | ||
34 | debug( debug_message );*/ | ||
35 | |||
36 | fp = fopen( filename, "r" ); | ||
37 | |||
38 | if( fp == NULL ) | ||
39 | { | ||
40 | panicf( "failed to open file: %s\n", filename ); | ||
41 | } | ||
42 | |||
43 | while( ( i = getc( fp ) ) != EOF ) | ||
44 | { | ||
45 | /*printf( "%d-'%c'\n", count, i ); */ | ||
46 | count++; | ||
47 | *buf = (char *)realloc( *buf, count * sizeof( char ) ); | ||
48 | /*printf( "%d='%s'\n", *buf, *buf ); */ | ||
49 | (*(buf))[count - 1] = (char)i; | ||
50 | /*printf( "%d='%s'\n", *buf, *buf );*/ | ||
51 | } | ||
52 | |||
53 | /* add null terminator */ | ||
54 | |||
55 | *buf = (char *)realloc( *buf, count * sizeof( char ) ); | ||
56 | (*(buf))[ count ] = '\0'; | ||
57 | |||
58 | /* count -2 because of 0 start and \0 terminator | ||
59 | printf( "read %d bytes: '%s'\n", count - 2, *buf ); */ | ||
60 | } | ||
61 | |||
62 | /* | ||
63 | * stub versions of pre-fat sector storage functions | ||
64 | */ | ||
65 | |||
66 | int persist_volume_setting( void ) | ||
67 | { | ||
68 | return 1; | ||
69 | } | ||
70 | |||
71 | int persist_balance_setting( void ) | ||
72 | { | ||
73 | return 1; | ||
74 | } | ||
75 | |||
76 | int persist_bass_setting( void ) | ||
77 | { | ||
78 | return 1; | ||
79 | } | ||
80 | |||
81 | int persist_treble_setting( void ) | ||
82 | { | ||
83 | return 1; | ||
84 | } | ||
85 | |||
86 | int persist_loudness_setting( void ) | ||
87 | { | ||
88 | return 1; | ||
89 | } | ||
90 | |||
91 | int persist_bass_boost_setting( void ) | ||
92 | { | ||
93 | return 1; | ||
94 | } | ||
95 | |||
96 | int persist_contrast_setting( void ) | ||
97 | { | ||
98 | return 1; | ||
99 | } | ||
100 | |||
101 | int persist_poweroff_setting( void ) | ||
102 | { | ||
103 | return 1; | ||
104 | } | ||
105 | |||
106 | int persist_backlight_setting( void ) | ||
107 | { | ||
108 | return 1; | ||
109 | } | ||
110 | |||
111 | int persist_resume_setting( void ) | ||
112 | { | ||
113 | return 1; | ||
114 | } | ||
115 | |||
116 | int persist_playlist_filename( void ) | ||
117 | { | ||
118 | return 1; | ||
119 | } | ||
120 | |||
121 | int persist_playlist_indices( void ) | ||
122 | { | ||
123 | return 1; | ||
124 | } | ||
125 | |||
126 | int persist_playlist_index( void ) | ||
127 | { | ||
128 | return 1; | ||
129 | } | ||
130 | |||
131 | int persist_resume_track_time( void ) | ||
132 | { | ||
133 | return 1; | ||
134 | } | ||