summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStuart Martin <mister_wavey@rockbox.org>2002-04-30 19:22:25 +0000
committerStuart Martin <mister_wavey@rockbox.org>2002-04-30 19:22:25 +0000
commitb09b1a091b21db5dd0bbf0882daf20ce776b5316 (patch)
tree42643974a9659e38a08c083ced09e56a2b75bb31
parentba19af2b129305d39d17b6794342461034c45eb5 (diff)
downloadrockbox-b09b1a091b21db5dd0bbf0882daf20ce776b5316.tar.gz
rockbox-b09b1a091b21db5dd0bbf0882daf20ce776b5316.zip
functions for high level disk operations
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@338 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/disk.c134
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
26void 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
66int persist_volume_setting( void )
67{
68 return 1;
69}
70
71int persist_balance_setting( void )
72{
73 return 1;
74}
75
76int persist_bass_setting( void )
77{
78 return 1;
79}
80
81int persist_treble_setting( void )
82{
83 return 1;
84}
85
86int persist_loudness_setting( void )
87{
88 return 1;
89}
90
91int persist_bass_boost_setting( void )
92{
93 return 1;
94}
95
96int persist_contrast_setting( void )
97{
98 return 1;
99}
100
101int persist_poweroff_setting( void )
102{
103 return 1;
104}
105
106int persist_backlight_setting( void )
107{
108 return 1;
109}
110
111int persist_resume_setting( void )
112{
113 return 1;
114}
115
116int persist_playlist_filename( void )
117{
118 return 1;
119}
120
121int persist_playlist_indices( void )
122{
123 return 1;
124}
125
126int persist_playlist_index( void )
127{
128 return 1;
129}
130
131int persist_resume_track_time( void )
132{
133 return 1;
134}