aboutsummaryrefslogtreecommitdiff
path: root/libmpio
diff options
context:
space:
mode:
Diffstat (limited to 'libmpio')
-rw-r--r--libmpio/defs.h5
-rw-r--r--libmpio/src/mpio.c12
-rw-r--r--libmpio/src/smartmedia.c17
-rw-r--r--libmpio/src/smartmedia.h3
4 files changed, 33 insertions, 4 deletions
diff --git a/libmpio/defs.h b/libmpio/defs.h
index 413ab6a..10033b3 100644
--- a/libmpio/defs.h
+++ b/libmpio/defs.h
@@ -1,5 +1,5 @@
/*
- * $Id: defs.h,v 1.28 2003/07/15 07:34:53 germeier Exp $
+ * $Id: defs.h,v 1.29 2003/07/24 16:17:30 germeier Exp $
*
* libmpio - a library for accessing Digit@lways MPIO players
* Copyright (C) 2002, 2003 Markus Germeier
@@ -240,6 +240,9 @@ typedef struct {
/* lookup table for phys.<->log. block mapping */
mpio_zonetable_t zonetable;
+ /* version of chips used */
+ BYTE version;
+
} mpio_smartmedia_t;
/* health status of a memory "card" */
diff --git a/libmpio/src/mpio.c b/libmpio/src/mpio.c
index 146b12e..99d747a 100644
--- a/libmpio/src/mpio.c
+++ b/libmpio/src/mpio.c
@@ -1,5 +1,5 @@
/*
- * $Id: mpio.c,v 1.6 2003/06/27 12:21:21 crunchy Exp $
+ * $Id: mpio.c,v 1.7 2003/07/24 16:17:30 germeier Exp $
*
* libmpio - a library for accessing Digit@lways MPIO players
* Copyright (C) 2002, 2003 Markus Germeier
@@ -155,6 +155,7 @@ mpio_init_internal(mpio_t *m)
return;
}
+ sm->version = mpio_id2version(sm->id);
/* look for further installed memory chips
* models with 1, 2 and 4 chips are known
@@ -191,6 +192,9 @@ mpio_init_internal(mpio_t *m)
debugn(2, "max_cluster: %d\n", sm->max_cluster);
/* 16 bytes per cluster */
sm->fat_size = (sm->max_cluster * 16) / SECTOR_SIZE;
+ /* the new chips seem to use some kind of mega-block (== 128KB) instead of 16KB */
+ if (sm->version)
+ sm->fat_size /= 8;
debugn(2, "fat_size: %04x\n", sm->fat_size * SECTOR_SIZE);
sm->fat = malloc(sm->fat_size * SECTOR_SIZE);
/* fat will be read in mpio_init, so we can more easily handle
@@ -211,6 +215,11 @@ mpio_init_internal(mpio_t *m)
sm->root->prev = NULL;
mpio_rootdir_read(m, MPIO_INTERNAL_MEM);
sm->cdir = sm->root;
+
+ if (sm->version)
+ debug("Warning, your player has a new SmartMedia chip which is not yet supported\n"
+ "Support for this chip is scheduled for the 0.7.1 release\n"
+ "Watch http://mpio.sf.net for further announcements\n");
}
void
@@ -229,6 +238,7 @@ mpio_init_external(mpio_t *m)
{
sm->manufacturer = m->version[e_offset];
sm->id = m->version[e_offset + 1];
+ sm->version = mpio_id2version(sm->id);
} else {
sm->manufacturer = 0;
sm->id = 0;
diff --git a/libmpio/src/smartmedia.c b/libmpio/src/smartmedia.c
index dfdaac4..bf700e9 100644
--- a/libmpio/src/smartmedia.c
+++ b/libmpio/src/smartmedia.c
@@ -1,5 +1,5 @@
/*
- * $Id: smartmedia.c,v 1.4 2003/07/17 18:29:11 germeier Exp $
+ * $Id: smartmedia.c,v 1.5 2003/07/24 16:17:30 germeier Exp $
*
* libmpio - a library for accessing Digit@lways MPIO players
* Copyright (C) 2002, 2003 Markus Germeier
@@ -150,3 +150,18 @@ mpio_id2geo(BYTE id, mpio_disk_phy_t *geo)
return;
}
+
+BYTE
+mpio_id2version(BYTE id)
+{
+ switch(id)
+ {
+ case 0xf1: /* 128MB new Samsung */
+ return 1;
+ default:
+ ;
+ }
+
+ return 0;
+}
+
diff --git a/libmpio/src/smartmedia.h b/libmpio/src/smartmedia.h
index ce030a6..2f48aaf 100644
--- a/libmpio/src/smartmedia.h
+++ b/libmpio/src/smartmedia.h
@@ -1,5 +1,5 @@
/*
- * $Id: smartmedia.h,v 1.2 2003/04/30 07:17:02 germeier Exp $
+ * $Id: smartmedia.h,v 1.3 2003/07/24 16:17:30 germeier Exp $
*
* libmpio - a library for accessing Digit@lways MPIO players
* Copyright (C) 2002, 2003 Markus Germeier
@@ -34,6 +34,7 @@ int mpio_id2mem (BYTE);
BYTE * mpio_id2manufacturer(BYTE);
void mpio_id2geo(BYTE, mpio_disk_phy_t *);
BYTE mpio_id_valid(BYTE);
+BYTE mpio_id2version(BYTE);
#ifdef __cplusplus
}