]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Emplant SCSI controller
authorToni Wilen <twilen@winuae.net>
Thu, 3 Aug 2017 17:17:01 +0000 (20:17 +0300)
committerToni Wilen <twilen@winuae.net>
Thu, 3 Aug 2017 17:17:01 +0000 (20:17 +0300)
expansion.cpp
include/rommgr.h
include/scsi.h
scsi.cpp

index 4f4cbed2b2ec36e54386225667c601a0165b03a0..c7ae0d3aff93cb87352122bc8c30b27fd7f65fee 100644 (file)
@@ -4841,6 +4841,15 @@ const struct expansionromtype expansionroms[] = {
                supra_sub, 0,
                true, EXPANSIONTYPE_SCSI
        },
+       {
+               _T("emplant"), _T("Emplant (SCSI only)"), _T("Utilities Unlimited"),
+               NULL, emplant_init, NULL, emplant_add_scsi_unit, ROMTYPE_EMPLANT | ROMTYPE_NONE, 0, 0, BOARD_AUTOCONFIG_Z2, false,
+               NULL, 0,
+               false, EXPANSIONTYPE_SCSI,
+               0, 0, 0, false, NULL,
+               false, 0, NULL,
+               { 0xd1, 0x15, 0x40, 0x00, 0x08, 0x7b, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00 },
+       },
 #if 0 /* driver is MIA, 3rd party ScottDevice driver is not enough for full implementation. */
        {
                NULL, _T("microforge"), _T("Hard Disk"), _T("Micro Forge"),
index c7e852c079f2e5fda49e1ce73e0b7077d74de1fc..69f03a88ebdabe1f30a9159343c349841d2e19ea 100644 (file)
@@ -157,6 +157,7 @@ extern int decode_cloanto_rom_do (uae_u8 *mem, int size, int real_size);
 #define ROMTYPE_A2090B         0x00100067
 #define ROMTYPE_FASTATA4K      0x00100068
 #define ROMTYPE_INMATE         0x00100069
+#define ROMTYPE_EMPLANT                0x0010006a
 
 #define ROMTYPE_NOT                    0x00800000
 #define ROMTYPE_QUAD           0x01000000
index 49634c3286a957224f9f590fec787c41ec9f980b..f05d8c06b1689e60de7e27dfcb245879fed3406d 100644 (file)
@@ -271,6 +271,9 @@ void addhard_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconf
 bool inmate_init(struct autoconfig_info*);
 void inmate_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc);
 
+bool emplant_init(struct autoconfig_info*);
+void emplant_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc);
+
 uae_u8 idescsi_scsi_get(uaecptr addr);
 void idescsi_scsi_put(uaecptr addr, uae_u8 v);
 
index d8d29d96247dda93395558ae32deb387f8c244ba..b1bd7937870969b4c365af59b7bb70c9397ecaf9 100644 (file)
--- a/scsi.cpp
+++ b/scsi.cpp
@@ -63,7 +63,8 @@
 #define NCR5380_MALIBU 32
 #define NCR5380_ADDHARD 33
 #define NONCR_INMATE 34
-#define NCR_LAST 35
+#define NCR5380_EMPLANT 35
+#define NCR_LAST 36
 
 extern int log_scsiemu;
 
@@ -762,6 +763,7 @@ struct soft_scsi
        int subtype;
        int dma_direction;
        bool dma_active;
+       bool dma_started;
        bool dma_controller;
        struct romconfig *rc;
        struct soft_scsi **self_ptr;
@@ -1902,6 +1904,7 @@ void ncr5380_bput(struct soft_scsi *scsi, int reg, uae_u8 v)
                if (scsi->regs[2] & 2) {
                        scsi->dma_direction = 1;
                        scsi->dma_active = true;
+                       scsi->dma_started = true;
                }
 #if NCR5380_DEBUG
                write_log(_T("DMA target recv PC=%08x\n"), M68K_GETPC);
@@ -1911,6 +1914,7 @@ void ncr5380_bput(struct soft_scsi *scsi, int reg, uae_u8 v)
                if (scsi->regs[2] & 2) {
                        scsi->dma_direction = -1;
                        scsi->dma_active = true;
+                       scsi->dma_started = true;
                        dma_check(scsi);
                }
 #if NCR5380_DEBUG
@@ -2478,6 +2482,19 @@ static int addhardreg(uaecptr addr)
        return addr;
 }
 
+static int emplantreg(uaecptr addr)
+{
+       if (addr & 1)
+               return -1;
+       if ((addr & 0xf000) == 0x6000)
+               return 8;
+       if ((addr & 0xf000) != 0x5000)
+               return -1;
+       addr >>= 4;
+       addr &= 7;
+       return addr;
+}
+
 static int malibureg(uaecptr addr)
 {
        if ((addr & 0xc000) == 0x8000)
@@ -2662,6 +2679,19 @@ static uae_u32 ncr80_bget2(struct soft_scsi *ncr, uaecptr addr, int size)
                        }
                }
 
+       } else if (ncr->type == NCR5380_EMPLANT) {
+
+               if ((addr & 0xf000) >= 0xc000) {
+                       v = ncr->rom[addr & 0x3fff];
+               } else {
+                       reg = emplantreg(addr);
+                       if (reg == 8 && !ncr->dma_active)
+                               reg = -1;
+                       if (reg >= 0) {
+                               v = ncr5380_bget(ncr, reg);
+                       }
+               }
+
        } else if (ncr->type == NONCR_HARDFRAME) {
 
                if (addr == 0xc0) {
@@ -3166,6 +3196,21 @@ static void ncr80_bput2(struct soft_scsi *ncr, uaecptr addr, uae_u32 val, int si
                        }
                }
 
+       } else if (ncr->type == NCR5380_EMPLANT) {
+
+               reg = emplantreg(addr);
+               if (reg == 8 && !ncr->dma_active)
+                       reg = -1;
+               if (reg >= 0) {
+                       ncr5380_bput(ncr, reg, val);
+               } else if ((addr & 0xff00) == 0x3800) {
+                       if ((val & 0x88) == 0x88) {
+                               ncr->intena = true;
+                       } else if ((val & 0x88) == 0x08) {
+                               ncr->intena = false;
+                       }
+               }
+
        } else if (ncr->type == NONCR_HARDFRAME) {
                
                if (addr == 0xc0) {
@@ -4680,3 +4725,29 @@ void addhard_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconf
 {
        generic_soft_scsi_add(ch, ci, rc, NCR5380_ADDHARD, 65536, 32768, ROMTYPE_ADDHARD);
 }
+
+bool emplant_init(struct autoconfig_info *aci)
+{
+       const struct expansionromtype *ert = get_device_expansion_rom(ROMTYPE_EMPLANT);
+       if (!aci->doinit) {
+               aci->autoconfigp = ert->autoconfig;
+               return true;
+       }
+
+       struct soft_scsi *scsi = getscsi(aci->rc);
+       if (!scsi)
+               return false;
+
+       load_rom_rc(aci->rc, ROMTYPE_EMPLANT, 8192, 0, scsi->rom, 16384, LOADROM_EVENONLY_ODDONE);
+       for (int i = 0; i < 16; i++) {
+               uae_u8 b = ert->autoconfig[i];
+               ew(scsi, i * 4, b);
+       }
+       aci->addrbank = scsi->bank;
+       return true;
+}
+
+void emplant_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc)
+{
+       generic_soft_scsi_add(ch, ci, rc, NCR5380_EMPLANT, 65536, 16384, ROMTYPE_EMPLANT);
+}