From 9635a5282be064a72d42a95c6e95bd23b590a4e6 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Wed, 21 Jun 2017 20:40:16 +0300 Subject: [PATCH] Add manufacturer id. Fix parallel programming. --- flashrom.cpp | 13 +++++++------ include/flashrom.h | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/flashrom.cpp b/flashrom.cpp index 86d71419..614838a0 100644 --- a/flashrom.cpp +++ b/flashrom.cpp @@ -516,12 +516,12 @@ struct flashrom_data int state; int modified; int sectorsize; - uae_u8 devicecode; + uae_u8 devicecode, mfgcode; int flags; struct zfile *zf; }; -void *flash_new(uae_u8 *rom, int flashsize, int allocsize, uae_u8 devicecode, struct zfile *zf, int flags) +void *flash_new(uae_u8 *rom, int flashsize, int allocsize, uae_u8 mfgcode, uae_u8 devcode, struct zfile *zf, int flags) { struct flashrom_data *fd = xcalloc(struct flashrom_data, 1); fd->flashsize = flashsize; @@ -530,8 +530,9 @@ void *flash_new(uae_u8 *rom, int flashsize, int allocsize, uae_u8 devicecode, st fd->zf = zf; fd->rom = rom; fd->flags = flags; - fd->devicecode = devicecode; - fd->sectorsize = devicecode == 0x20 ? 16384 : 65536; + fd->devicecode = devcode; + fd->mfgcode = mfgcode; + fd->sectorsize = devcode == 0x20 ? 16384 : 65536; return fd; } @@ -595,7 +596,7 @@ bool flash_write(void *fdv, uaecptr addr, uae_u8 v) addr &= fd->mask; addr2 = addr & 0xffff; - if (fd->state == 7) { + if (fd->state >= 7 && fd->state < 7 + 64) { if (!(fd->flags & FLASHROM_PARALLEL_EEPROM)) { fd->state = 100; } else { @@ -691,7 +692,7 @@ uae_u32 flash_read(void *fdv, uaecptr addr) if (fd->state == 3) { uae_u8 a = addr & 0xff; if (a == 0) - v = 0x01; + v = fd->mfgcode; if (a == 1) v = fd->devicecode; if (a == 2) diff --git a/include/flashrom.h b/include/flashrom.h index 3b4c89c8..8b447c47 100644 --- a/include/flashrom.h +++ b/include/flashrom.h @@ -5,7 +5,7 @@ /* FLASH */ -void *flash_new(uae_u8 *rom, int flashsize, int allocsize, uae_u8 devicecode, struct zfile *zf, int flags); +void *flash_new(uae_u8 *rom, int flashsize, int allocsize, uae_u8 mfgcode, uae_u8 devcode, struct zfile *zf, int flags); void flash_free(void *fdv); bool flash_write(void *fdv, uaecptr addr, uae_u8 v); -- 2.47.3