1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
|
/*
* $Id: smartmedia.c,v 1.2 2003/04/30 07:17:01 germeier Exp $
*
* libmpio - a library for accessing Digit@lways MPIO players
* Copyright (C) 2002, 2003 Markus Germeier
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc.,g 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <stdio.h>
#include <stdlib.h>
#include "smartmedia.h"
#include "debug.h"
mpio_disk_phy_t MPIO_DISK_GEO_001={ 125, 4, 4, 2000 };
mpio_disk_phy_t MPIO_DISK_GEO_002={ 125, 4, 8, 4000 };
mpio_disk_phy_t MPIO_DISK_GEO_004={ 250, 4, 8, 8000 };
mpio_disk_phy_t MPIO_DISK_GEO_008={ 250, 4, 16, 16000 };
mpio_disk_phy_t MPIO_DISK_GEO_016={ 500, 4, 16, 32000 };
mpio_disk_phy_t MPIO_DISK_GEO_032={ 500, 8, 16, 64000 };
mpio_disk_phy_t MPIO_DISK_GEO_064={ 500, 8, 32, 128000 };
mpio_disk_phy_t MPIO_DISK_GEO_128={ 500,16, 32, 256000 };
/* This comes from the Samsung documentation files */
/* a small warning: only use this function (mpio_id2mem) in the very
* beginning of MPIO model detection. After that use the values
* of size and chips! -mager
*/
int
mpio_id2mem(BYTE id)
{
int i=0;
switch(id)
{
case 0xea:
i=2;
break;
case 0xe3: /* Samsung */
case 0xe5: /* Toshiba */
i=4;
break;
case 0xe6:
i=8;
break;
case 0x73:
i=16;
break;
case 0x75:
i=32;
break;
case 0x76:
i=64;
break;
case 0x79:
i=128;
break;
default:
debug("This should never happen (id2mem)!\n");
exit (1);
}
return i;
}
BYTE *
mpio_id2manufacturer(BYTE id)
{
BYTE *m;
switch(id)
{
case 0xec:
m="Samsung";
break;
case 0x98:
m="Toshiba";
break;
default:
m="unknown";
}
return m;
}
BYTE
mpio_id_valid(BYTE id)
{
switch(id)
{
case 0xec: /* Samsung */
case 0x98: /* Toshiba */
return 1;
default:
;
}
return 0;
}
void
mpio_id2geo(BYTE id, mpio_disk_phy_t *geo)
{
switch(id)
{
case 0xea:
*geo = MPIO_DISK_GEO_002;
break;
case 0xe3: /* Samsung */
case 0xe5: /* Toshiba */
*geo = MPIO_DISK_GEO_004;
break;
case 0xe6:
*geo = MPIO_DISK_GEO_008;
break;
case 0x73:
*geo = MPIO_DISK_GEO_016;
break;
case 0x75:
*geo = MPIO_DISK_GEO_032;
break;
case 0x76:
*geo = MPIO_DISK_GEO_064;
break;
case 0x79:
*geo = MPIO_DISK_GEO_128;
break;
default:
debug("This should never happen!\n");
exit (1);
}
return;
}
|