aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--libmpio/defs.h4
-rw-r--r--libmpio/mpio.h9
-rw-r--r--libmpio/src/directory.c8
-rw-r--r--libmpio/src/mpio.c14
-rw-r--r--mpiosh/callback.c59
-rw-r--r--mpiosh/callback.h3
-rw-r--r--mpiosh/global.c5
8 files changed, 93 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 1e1de09..c9377f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2003-06-26 Markus Germeier <mager@tzi.de>
+ * libmpio/src/mpio.c (mpio_file_exists):
+ added helper function
+ * mpiosh/callback.c (mpiosh_cmd_font_upload):
+ * libmpio/defs.h (MPIO_FONT_FON): added support for
+ font file
+ * mpiosh/callback.c (mpiosh_cmd_format):
+ restore font file if it existed before a format
+
2003-06-18 Markus Germeier <mager@tzi.de>
* libmpio/Makefile.am (AM_LDFLAGS):
added variable to support API versioninging of libmpio
diff --git a/libmpio/defs.h b/libmpio/defs.h
index cd0def3..dd3cd09 100644
--- a/libmpio/defs.h
+++ b/libmpio/defs.h
@@ -1,5 +1,5 @@
/*
- * $Id: defs.h,v 1.26 2003/04/27 12:08:20 germeier Exp $
+ * $Id: defs.h,v 1.27 2003/06/26 19:53:58 germeier Exp $
*
* libmpio - a library for accessing Digit@lways MPIO players
* Copyright (C) 2002, 2003 Markus Germeier
@@ -63,7 +63,6 @@ typedef enum { GET_VERSION = 0x01,
MODIFY_FIRMWARE = 0xa0 } mpio_cmd_t;
/* file types on internal memory */
-/* found in the code of salmoon, are these needed? -mager */
typedef enum { FTYPE_CHAN = 0x00,
FTYPE_MUSIC = 0x01,
FTYPE_CONF = 'C',
@@ -79,6 +78,7 @@ typedef enum { FTYPE_CHAN = 0x00,
#define MPIO_CONFIG_FILE "CONFIG.DAT"
#define MPIO_CHANNEL_FILE "FMCONFIG.DAT"
#define MPIO_MPIO_RECORD "MPIO RECORD"
+#define MPIO_FONT_FON "FONT.FON"
/* type of callback functions */
typedef BYTE (*mpio_callback_t)(int, int) ;
diff --git a/libmpio/mpio.h b/libmpio/mpio.h
index 999b0db..6a1e18c 100644
--- a/libmpio/mpio.h
+++ b/libmpio/mpio.h
@@ -1,5 +1,5 @@
/*
- * $Id: mpio.h,v 1.21 2003/04/27 12:08:20 germeier Exp $
+ * $Id: mpio.h,v 1.22 2003/06/26 19:53:58 germeier Exp $
*
* libmpio - a library for accessing Digit@lways MPIO players
* Copyright (C) 2002, 2003 Markus Germeier
@@ -122,7 +122,12 @@ int mpio_file_get_to_memory(mpio_t *, mpio_mem_t, mpio_filename_t,
/* ... memory pointer, size of file */
int mpio_file_put_from_memory(mpio_t *, mpio_mem_t, mpio_filename_t,
mpio_filetype_t, mpio_callback_t,
- BYTE *, int);
+ BYTE *, int);
+
+/* check if file exists on selected memory */
+/* return pointer to file dentry if file exists */
+BYTE *mpio_file_exists(mpio_t *, mpio_mem_t, mpio_filename_t);
+
/*
* rename a file on the MPIO
diff --git a/libmpio/src/directory.c b/libmpio/src/directory.c
index 200d1e9..394e193 100644
--- a/libmpio/src/directory.c
+++ b/libmpio/src/directory.c
@@ -1,5 +1,5 @@
/*
- * $Id: directory.c,v 1.5 2003/06/16 10:25:03 germeier Exp $
+ * $Id: directory.c,v 1.6 2003/06/26 19:53:58 germeier Exp $
*
* libmpio - a library for accessing Digit@lways MPIO players
* Copyright (C) 2002, 2003 Markus Germeier
@@ -519,8 +519,10 @@ mpio_dentry_filename_write(mpio_t *m, mpio_mem_t mem, BYTE *p,
j++;
}
- f_8_3[6]='~';
- f_8_3[7]='0';
+ while(mpio_dentry_find_name_8_3(m, mem, f_8_3)) {
+ f_8_3[6]='~';
+ f_8_3[7]='0';
+ }
while(mpio_dentry_find_name_8_3(m, mem, f_8_3))
f_8_3[7]++;
diff --git a/libmpio/src/mpio.c b/libmpio/src/mpio.c
index 133ac9c..1dfa192 100644
--- a/libmpio/src/mpio.c
+++ b/libmpio/src/mpio.c
@@ -1,5 +1,5 @@
/*
- * $Id: mpio.c,v 1.4 2003/05/19 17:30:58 germeier Exp $
+ * $Id: mpio.c,v 1.5 2003/06/26 19:53:58 germeier Exp $
*
* libmpio - a library for accessing Digit@lways MPIO players
* Copyright (C) 2002, 2003 Markus Germeier
@@ -1160,6 +1160,18 @@ mpio_file_del(mpio_t *m, mpio_mem_t mem, mpio_filename_t filename,
return MPIO_OK;
}
+BYTE *
+mpio_file_exists(mpio_t *m, mpio_mem_t mem, mpio_filename_t filename) {
+ BYTE *p;
+ /* find file */
+ p = mpio_dentry_find_name(m, mem, filename);
+ if (!p)
+ p = mpio_dentry_find_name_8_3(m, mem, filename);
+
+ return p;
+}
+
+
int
mpio_sync(mpio_t *m, mpio_mem_t mem)
{
diff --git a/mpiosh/callback.c b/mpiosh/callback.c
index 768222a..70c2e5a 100644
--- a/mpiosh/callback.c
+++ b/mpiosh/callback.c
@@ -2,7 +2,7 @@
*
* Author: Andreas Büsching <crunchy@tzi.de>
*
- * $Id: callback.c,v 1.41 2003/04/19 23:58:02 germeier Exp $
+ * $Id: callback.c,v 1.42 2003/06/26 19:53:58 germeier Exp $
*
* Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de>
*
@@ -651,8 +651,8 @@ void
mpiosh_cmd_format(char *args[])
{
char answer[512];
- BYTE *config, *fmconfig, *rconfig;
- int csize, fmsize, rsize;
+ BYTE *config, *fmconfig, *rconfig, *fontconfig;
+ int csize, fmsize, rsize, fontsize;
MPIOSH_CHECK_CONNECTION_CLOSED;
@@ -665,10 +665,13 @@ mpiosh_cmd_format(char *args[])
if (answer[0] == 'y' || answer[0] == 'Y') {
if (mpiosh.card == MPIO_INTERNAL_MEM) {
- /* save config files and write them back after formatting */
- config = NULL;
- fmconfig = NULL;
- rconfig = NULL;
+ printf("read config files from player\n");
+
+ /* save config files and write them back after formatting */
+ config = NULL;
+ fmconfig = NULL;
+ rconfig = NULL;
+ fontconfig = NULL;
csize = mpio_file_get_to_memory(mpiosh.dev, MPIO_INTERNAL_MEM,
MPIO_CONFIG_FILE, NULL, &config);
@@ -676,8 +679,12 @@ mpiosh_cmd_format(char *args[])
MPIO_CHANNEL_FILE, NULL, &fmconfig);
rsize = mpio_file_get_to_memory(mpiosh.dev, MPIO_INTERNAL_MEM,
MPIO_MPIO_RECORD, NULL, &rconfig);
+ fontsize = mpio_file_get_to_memory(mpiosh.dev, MPIO_INTERNAL_MEM,
+ MPIO_FONT_FON, NULL, &fontconfig);
}
+ printf("formatting memory...\n");
+
if (mpio_memory_format(mpiosh.dev, mpiosh.card,
mpiosh_callback_format) == -1)
printf("\nfailed\n");
@@ -685,6 +692,7 @@ mpiosh_cmd_format(char *args[])
printf("\n");
if (mpiosh.card == MPIO_INTERNAL_MEM) {
+ printf("restoring saved config files\n");
/* restore everything we saved */
if (config)
if (mpio_file_put_from_memory(mpiosh.dev, MPIO_INTERNAL_MEM,
@@ -700,8 +708,13 @@ mpiosh_cmd_format(char *args[])
if (mpio_directory_make(mpiosh.dev, MPIO_INTERNAL_MEM,
MPIO_MPIO_RECORD)!=MPIO_OK)
mpio_perror("error");
+ if (fontconfig)
+ if (mpio_file_put_from_memory(mpiosh.dev, MPIO_INTERNAL_MEM,
+ MPIO_FONT_FON, FTYPE_FONT,
+ NULL, fontconfig, fontsize)==-1)
+ mpio_perror("error");
- if (config || fmconfig || rconfig)
+ if (config || fmconfig || rconfig || fontconfig)
mpio_sync(mpiosh.dev, MPIO_INTERNAL_MEM);
if (config)
free(config);
@@ -709,6 +722,8 @@ mpiosh_cmd_format(char *args[])
free(fmconfig);
if (rconfig)
free(rconfig);
+ if (fontconfig)
+ free(fontconfig);
}
}
@@ -1099,5 +1114,33 @@ mpiosh_cmd_id3_format(char *args[])
}
}
+void
+mpiosh_cmd_font_upload(char *args[])
+{
+ BYTE * p;
+ int size;
+
+ MPIOSH_CHECK_CONNECTION_CLOSED;
+ MPIOSH_CHECK_ARG;
+
+ /* check if fonts file already exists */
+ p = mpio_file_exists(mpiosh.dev, MPIO_INTERNAL_MEM,
+ MPIO_FONT_FON);
+ if (p) {
+ printf("Fontsfile already exists. Please delete it first!\n");
+ return;
+ }
+
+ printf("writing new font file ...\n");
+ if (mpio_file_put_as(mpiosh.dev, MPIO_INTERNAL_MEM,
+ args[0], MPIO_FONT_FON,
+ FTYPE_FONT, mpiosh_callback_put)==-1)
+ mpio_perror("error");
+
+ printf("\n");
+ mpio_sync(mpiosh.dev, MPIO_INTERNAL_MEM);
+
+}
+
/* end of callback.c */
diff --git a/mpiosh/callback.h b/mpiosh/callback.h
index 3d1c8f8..f0e2b61 100644
--- a/mpiosh/callback.h
+++ b/mpiosh/callback.h
@@ -2,7 +2,7 @@
*
* Author: Andreas Büsching <crunchy@tzi.de>
*
- * $Id: callback.h,v 1.11 2003/04/19 23:58:02 germeier Exp $
+ * $Id: callback.h,v 1.12 2003/06/26 19:53:59 germeier Exp $
*
* Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de>
*
@@ -56,6 +56,7 @@ void mpiosh_cmd_config(char *args[]);
void mpiosh_cmd_channel(char *args[]);
void mpiosh_cmd_id3(char *args[]);
void mpiosh_cmd_id3_format(char *args[]);
+void mpiosh_cmd_font_upload(char *args[]);
/* local command callbacks */
void mpiosh_cmd_ldir(char *args[]);
diff --git a/mpiosh/global.c b/mpiosh/global.c
index e1215f1..dc4ad45 100644
--- a/mpiosh/global.c
+++ b/mpiosh/global.c
@@ -2,7 +2,7 @@
*
* Author: Andreas Buesching <crunchy@tzi.de>
*
- * $Id: global.c,v 1.12 2003/04/23 08:34:15 crunchy Exp $
+ * $Id: global.c,v 1.13 2003/06/26 19:53:59 germeier Exp $
*
* Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de>
*
@@ -129,6 +129,9 @@ struct mpiosh_cmd_t commands[] = {
{ "id3_format", NULL, "[<format>]",
" define/show the format line for ID3 rewriting",
mpiosh_cmd_id3_format, NULL },
+ { "font_upload", NULL, "[<fontfile>]",
+ " upload the give fontfile to the internal memory",
+ mpiosh_cmd_font_upload, NULL },
{ "dump_memory", NULL, NULL,
" dump FAT, directory, spare area and the first 0x100 of the\n"
" selected memory card",