2 famicom ROM cartridge utility - unagi
5 Copyright (C) 2008-2009 ±·³«È¯¶¨Æ±Áȹç
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.
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.
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
21 flashmemory.c ¤À¤±¤Î·Ù¹ð
22 ¤³¤Î¥½¡¼¥¹¥³¡¼¥É¤ò»²¹Í¡¢Å¾ÍѤ·¤Æ¥·¥§¥¢¥¦¥§¥¢¤Ê¤É¤ÇÍø±×¤òÆÀ¤Ê¤¤¤³¤È¡£
23 ȽÌÀ¤·¤¿¾ì¹ç¤Ï LGPL ¤¬Å¬ÍѤµ¤ì¡¢³ºÅö²Õ½ê¤Î¥½¡¼¥¹¤ò¸ø³«¤¹¤ëɬÍפ¬¤¢¤ë¡£
25 #ifndef _FLASHMEMORY_H_
26 #define _FLASHMEMORY_H_
29 //JEDEC command ¤ò½¼¤Æ¤ë CPU/PPU ÏÀÍý¥¢¥É¥ì¥¹
30 long command_0000, command_2aaa, command_5555;
33 //struct reader_driver ¤Î´Ø¿ô¥Ý¥¤¥ó¥¿¤òÅϤ¹¾ì½ê
34 void (*config)(long c000, long c2aaa, long c5555, long unit, bool retry);
35 void (*erase)(long address, bool dowait);
36 void (*write)(long address, long length, uint8_t *data);
37 long (*program)(long address, long length, const uint8_t *data, bool dowait, bool skip);
43 long capacity, pagesize;
45 long erase_wait; //unit is msec
46 u8 id_manufacurer, id_device;
47 int (*productid_check)(const struct flash_order *d, const struct flash_driver *f);
48 void (*init)(const struct flash_order *d, long wait);
49 void (*program)(const struct flash_order *d, long address, long length, const struct memory *m);
51 const struct flash_driver FLASH_DRIVER_UNDEF;
52 const struct flash_driver *flash_driver_get(const char *name);
54 //0x80 °Ê¹ß¤ÏËÜÅö¤Î¥Ç¥Ð¥¤¥¹½ÅÊ£¤·¤Ê¤¤¤È»×¤¦. 狼 JEDEC ¤Î¤È¤³¤ò¤·¤é¤Ù¤Æ.
56 FLASH_ID_DEVICE_SRAM = 0xf0,