summaryrefslogtreecommitdiff
path: root/firmware
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 /firmware
parentba19af2b129305d39d17b6794342461034c45eb5 (diff)
functions for high level disk operations
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@338 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-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 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2002 by wavey@wavey.org
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include <stdio.h>
+#include <malloc.h>
+#include "disk.h"
+#include "debug.h"
+#include "panic.h"
+
+void read_file_into_buffer( char **buf, const char *filename )
+{
+ /*char debug_message[128]; */
+ int i;
+ FILE *fp;
+ int count = 0;
+
+ /*sprintf( debug_message, "read_file_into_buffer( %s, %s )\n", *buf, filename );
+ debug( debug_message );*/
+
+ fp = fopen( filename, "r" );
+
+ if( fp == NULL )
+ {
+ panicf( "failed to open file: %s\n", filename );
+ }
+
+ while( ( i = getc( fp ) ) != EOF )
+ {
+ /*printf( "%d-'%c'\n", count, i ); */
+ count++;
+ *buf = (char *)realloc( *buf, count * sizeof( char ) );
+ /*printf( "%d='%s'\n", *buf, *buf ); */
+ (*(buf))[count - 1] = (char)i;
+ /*printf( "%d='%s'\n", *buf, *buf );*/
+ }
+
+ /* add null terminator */
+
+ *buf = (char *)realloc( *buf, count * sizeof( char ) );
+ (*(buf))[ count ] = '\0';
+
+ /* count -2 because of 0 start and \0 terminator
+ printf( "read %d bytes: '%s'\n", count - 2, *buf ); */
+}
+
+/*
+ * stub versions of pre-fat sector storage functions
+ */
+
+int persist_volume_setting( void )
+{
+ return 1;
+}
+
+int persist_balance_setting( void )
+{
+ return 1;
+}
+
+int persist_bass_setting( void )
+{
+ return 1;
+}
+
+int persist_treble_setting( void )
+{
+ return 1;
+}
+
+int persist_loudness_setting( void )
+{
+ return 1;
+}
+
+int persist_bass_boost_setting( void )
+{
+ return 1;
+}
+
+int persist_contrast_setting( void )
+{
+ return 1;
+}
+
+int persist_poweroff_setting( void )
+{
+ return 1;
+}
+
+int persist_backlight_setting( void )
+{
+ return 1;
+}
+
+int persist_resume_setting( void )
+{
+ return 1;
+}
+
+int persist_playlist_filename( void )
+{
+ return 1;
+}
+
+int persist_playlist_indices( void )
+{
+ return 1;
+}
+
+int persist_playlist_index( void )
+{
+ return 1;
+}
+
+int persist_resume_track_time( void )
+{
+ return 1;
+}