aboutsummaryrefslogtreecommitdiff
path: root/libmpio/src
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 /libmpio/src
parent8472132d251b16a4287d2fa4a91e9b13dd5914cf (diff)
downloadmpiosh-fc7ef140a8106398fff38c2d93b2f07d72f3dfe9.tar.gz
mpiosh-fc7ef140a8106398fff38c2d93b2f07d72f3dfe9.tar.bz2
mpiosh-fc7ef140a8106398fff38c2d93b2f07d72f3dfe9.zip
initial handling of the new SmartMedia chip
Diffstat (limited to 'libmpio/src')
-rw-r--r--libmpio/src/mpio.c12
-rw-r--r--libmpio/src/smartmedia.c17
-rw-r--r--libmpio/src/smartmedia.h3
3 files changed, 29 insertions, 3 deletions
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
}