aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgermeier <germeier>2003-07-24 16:17:30 +0000
committergermeier <germeier>2003-07-24 16:17:30 +0000
commitfc7ef140a8106398fff38c2d93b2f07d72f3dfe9 (patch)
tree27bfc40d63688f1f8b41f085ec962b236d9be4cd
parent8472132d251b16a4287d2fa4a91e9b13dd5914cf (diff)
downloadmpiosh-fc7ef140a8106398fff38c2d93b2f07d72f3dfe9.tar.gz
mpiosh-fc7ef140a8106398fff38c2d93b2f07d72f3dfe9.tar.bz2
mpiosh-fc7ef140a8106398fff38c2d93b2f07d72f3dfe9.zip
initial handling of the new SmartMedia chip
-rw-r--r--ChangeLog7
-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
5 files changed, 40 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 6555fa9..ffb9f27 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2003-07-24 Markus Germeier <mager@tzi.de>
+ * detect new SmartMedia chips and report them
+ * added version to mpio_smartmedia_t
+ * libmpio/src/smartmedia.c (mpio_id2version):
+ added function
+ * spare area read of new chips should work now
+
2003-07-17 Markus Germeier <mager@tzi.de>
* libmpio/src/smartmedia.c (mpio_id2mem):
added non-standard SmartMedia chip ID, as reported by Andreas
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
}