aboutsummaryrefslogtreecommitdiff
path: root/libmpio/cis.c
blob: c30085b2e833ae50a7980b255d7526cd6b748299 (plain)
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
/* 
 *
 * $Id: cis.c,v 1.1 2002/10/06 21:19:50 germeier Exp $
 *
 * Library for USB MPIO-*
 *
 * Markus Germeier (mager@tzi.de)
 *
 * 
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation; either version 2 of the
 * License, or (at your option) any later version.
 *
 * This program 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
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * */

#include "cis.h"

/* This data is CIS block (Card Information System) of the SmartMedia
 * cards, it can be found here:
 * http://www.samsungelectronics.com/semiconductors/flash/technical_data/application_notes/SM_format.pdf  (page 8 + 9)
 * or on any Smartmedia card
 *
 * It is not believed to be some kind of trade secret or such, so ...
 * ... if we are mistaken, please tell us so.
 */

char cis_templ[0x80] = {
  0x01, 0x03, 0xd9, 0x01, 0xff, 0x18, 0x02, 0xdf, /* 0x00 */
  0x01, 0x20, 0x04, 0x00, 0x00, 0x00, 0x00, 0x21,

  0x02, 0x04, 0x01, 0x22, 0x02, 0x01, 0x01, 0x22, /* 0x10  */
  0x03, 0x02, 0x04, 0x07, 0x1a, 0x05, 0x01, 0x03,

  0x00, 0x02, 0x0f, 0x1b, 0x08, 0xc0, 0xc0, 0xa1, /* 0x20 */
  0x01, 0x55, 0x08, 0x00, 0x20, 0x1b, 0x0a, 0xc1, 

  0x41, 0x99, 0x01, 0x55, 0x64, 0xf0, 0xff, 0xff, /* 0x30 */
  0x20, 0x1b, 0x0c, 0x82, 0x41, 0x18, 0xea, 0x61,

  0xf0, 0x01, 0x07, 0xf6, 0x03, 0x01, 0xee, 0x1b, /* 0x40 */
  0x0c, 0x83, 0x41, 0x18, 0xea, 0x61, 0x70, 0x01,

  0x07, 0x76, 0x03, 0x01, 0xee, 0x15, 0x14, 0x05, /* 0x50 */
  0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,

  0x00, 0x20, 0x20, 0x20, 0x20, 0x00, 0x30, 0x2e, /* 0x60 */
  0x30, 0x00, 0xff, 0x14, 0x00, 0xff, 0x00, 0x00,

  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70 */
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00

};

BYTE *
mpio_cis_gen()
{
  BYTE *p;
  
  p = (BYTE *)malloc(SECTOR_SIZE);
  
  memset(p, 0, SECTOR_SIZE);  
  memcpy(p,       cis_templ, 0x80);
  memcpy(p+0x100, cis_templ, 0x80);
  
  return p;
  
}