OSDN Git Service

COPYRIGHT 変更
[unagi/old-svn-converted.git] / client / trunk / flashmemory.h
1 /*
2 famicom ROM cartridge utility - unagi
3 flash memory driver
4
5 Copyright (C) 2008 ±·³«È¯¶¨Æ±Áȹç
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
21 flashmemory.c ¤À¤±¤Î·Ù¹ð
22 ¤³¤Î¥½¡¼¥¹¥³¡¼¥É¤ò»²¹Í¡¢Å¾ÍѤ·¤Æ¥·¥§¥¢¥¦¥§¥¢¤Ê¤É¤ÇÍø±×¤òÆÀ¤Ê¤¤¤³¤È¡£
23 ȽÌÀ¤·¤¿¾ì¹ç¤Ï LGPL ¤¬Å¬ÍѤµ¤ì¡¢³ºÅö²Õ½ê¤Î¥½¡¼¥¹¤ò¸ø³«¤¹¤ëɬÍפ¬¤¢¤ë¡£
24 */
25 #ifndef _FLASHMEMORY_H_
26 #define _FLASHMEMORY_H_
27
28 struct flash_order{
29         //JEDEC command ¤ò½¼¤Æ¤ë CPU/PPU ÏÀÍý¥¢¥É¥ì¥¹
30         long command_0000, command_2aaa, command_5555;
31         long pagesize;
32         //struct reader_driver ¤Î´Ø¿ô¥Ý¥¤¥ó¥¿¤òÅϤ¹¾ì½ê
33         void (*flash_write)(long address, long data);
34         void (*read)(long address, long length, u8 *data);
35 };
36
37 struct memory;
38 struct flash_driver{
39         const char *name;
40         long capacity, pagesize;
41         u8 id_manufacurer, id_device;
42         int (*productid_check)(const struct flash_order *d, const struct flash_driver *f);
43 #if DEBUG==1
44         void (*erase)(const struct flash_order *d);
45 #endif
46         void (*init)(const struct flash_order *d);
47         void (*write)(const struct flash_order *d, long address, long length, const struct memory *m);
48 };
49
50 const struct flash_driver *flash_driver_get(const char *name);
51 #endif