]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Development test HD IDE controller.
authorToni Wilen <twilen@winuae.net>
Sat, 20 Feb 2021 16:19:12 +0000 (18:19 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 20 Feb 2021 16:19:12 +0000 (18:19 +0200)
expansion.cpp
ide.cpp
idecontrollers.cpp
include/idecontrollers.h
include/rommgr.h

index 52b6629f515aeb7d01e006a99971ba185b1ddd3d..f534a8bf3b2fa9816612c340498593ae2a1ae2bb 100644 (file)
@@ -5788,6 +5788,14 @@ const struct expansionromtype expansionroms[] = {
                false, 0, x86_rt1000_settings
 
        },
+#ifndef NDEBUG
+       {
+               _T("dev_ide"), _T("DEV IDE"), NULL,
+               NULL, dev_hd_init, NULL, dev_hd_add_ide_unit, ROMTYPE_DEVHD | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true,
+               NULL, 0,
+               false, EXPANSIONTYPE_CUSTOM | EXPANSIONTYPE_IDE | EXPANSIONTYPE_SCSI
+       },
+#endif
 
        /* PC Bridgeboards */
 
diff --git a/ide.cpp b/ide.cpp
index 4736efa892705ca7f7f0276c97f49fb10cbc26ba..d95db8facbf32ebe5659cc5760812b11472acaf9 100644 (file)
--- a/ide.cpp
+++ b/ide.cpp
@@ -842,7 +842,7 @@ static void process_rw_command (struct ide_hdf *ide)
 static void process_packet_command (struct ide_hdf *ide)
 {
        setbsy (ide);
-       write_comm_pipe_u32 (&ide->its->requests, ide->num | 0x100, 1);
+       write_comm_pipe_u32 (&ide->its->requests, ide->num | 0x8000, 1);
 }
 
 static void atapi_data_done (struct ide_hdf *ide)
@@ -1566,8 +1566,8 @@ static void ide_thread (void *idedata)
                struct ide_hdf *ide;
                if (its->state == 0 || unit == 0xfffffff)
                        break;
-               ide = its->idetable[unit & 0xff];
-               if (unit & 0x100)
+               ide = its->idetable[unit & 0x7fff];
+               if (unit & 0x8000)
                        do_process_packet_command (ide);
                else
                        do_process_rw_command (ide);
index 2058137fc4d8c6552e41acd3b91040f75b7ea5dc..381a2cb5636df828c90a9a1348f366057425ee03 100644 (file)
@@ -56,7 +56,8 @@
 #define TRIFECTA_IDE (IVST500AT_IDE + MAX_DUPLICATE_EXPANSION_BOARDS)
 #define TANDEM_IDE (TRIFECTA_IDE + MAX_DUPLICATE_EXPANSION_BOARDS)
 #define DOTTO_IDE (TANDEM_IDE + MAX_DUPLICATE_EXPANSION_BOARDS)
-#define TOTAL_IDE (DOTTO_IDE + MAX_DUPLICATE_EXPANSION_BOARDS)
+#define DEV_IDE (DOTTO_IDE + MAX_DUPLICATE_EXPANSION_BOARDS)
+#define TOTAL_IDE (DEV_IDE + MAX_DUPLICATE_EXPANSION_BOARDS)
 
 #define ALF_ROM_OFFSET 0x0100
 #define GVP_IDE_ROM_OFFSET 0x8000
@@ -120,13 +121,19 @@ static struct ide_board *accessx_board[MAX_DUPLICATE_EXPANSION_BOARDS];
 static struct ide_board *ivst500at_board[MAX_DUPLICATE_EXPANSION_BOARDS];
 static struct ide_board *trifecta_board[MAX_DUPLICATE_EXPANSION_BOARDS];
 static struct ide_board *tandem_board[MAX_DUPLICATE_EXPANSION_BOARDS];
-static struct ide_board *dotto_board[MAX_DUPLICATE_EXPANSION_BOARDS];
+static struct ide_board* dotto_board[MAX_DUPLICATE_EXPANSION_BOARDS];
+static struct ide_board* dev_board[MAX_DUPLICATE_EXPANSION_BOARDS];
 
 static struct ide_hdf *idecontroller_drive[TOTAL_IDE * 2];
 static struct ide_thread_state idecontroller_its;
 
 static struct ide_board *ide_boards[MAX_IDE_UNITS + 1];
 
+static int dev_hd_io_base, dev_hd_io_total;
+static int dev_hd_io_size;
+static int dev_hd_data_base;
+static int dev_hd_io_secondary;
+
 static void freencrunit(struct ide_board *ide)
 {
        if (!ide)
@@ -593,6 +600,21 @@ static int get_ivst500at_reg(uaecptr addr, struct ide_board *board, int *portnum
        return reg;
 }
 
+static int get_dev_hd_reg(uaecptr addr, struct ide_board* board)
+{
+       int reg = -1;
+       if (addr >= dev_hd_io_base && addr < dev_hd_io_base + dev_hd_io_total) {
+               reg = (addr - dev_hd_io_base) / dev_hd_io_size;
+               reg &= 7;
+               if (addr & dev_hd_io_secondary) {
+                       reg |= IDE_SECONDARY;
+               }
+       } else if (addr >= dev_hd_data_base && addr < dev_hd_data_base + 4) {
+               reg = 0;
+       }
+       return reg;
+}
+
 static int getidenum(struct ide_board *board, struct ide_board **arr)
 {
        for (int i = 0; i < MAX_DUPLICATE_EXPANSION_BOARDS; i++) {
@@ -967,6 +989,12 @@ static uae_u32 ide_read_byte(struct ide_board *board, uaecptr addr)
                        }
                }
 
+       } else if (board->type == DEV_IDE) {
+
+               int reg = get_dev_hd_reg(addr, board);
+               if (reg >= 0) {
+                       v = get_ide_reg(board, reg);
+               }
        }
 
        return v;
@@ -1269,6 +1297,13 @@ static uae_u32 ide_read_word(struct ide_board *board, uaecptr addr)
                                }
                        }
 
+               } else if (board->type == DEV_IDE) {
+
+                       int reg = get_dev_hd_reg(addr, board);
+                       if (reg == IDE_DATA) {
+                               v = get_ide_reg(board, reg);
+                       }
+
                }
 
        }
@@ -1567,8 +1602,14 @@ static void ide_write_byte(struct ide_board *board, uaecptr addr, uae_u8 v)
                                put_ide_reg(board, regnum, v);
                        }
 
-               }
+               } else if (board->type == DEV_IDE) {
 
+                       int reg = get_dev_hd_reg(addr, board);
+                       if (reg >= 0) {
+                               put_ide_reg(board, reg, v);
+                       }
+
+               }
        }
 }
 
@@ -1770,6 +1811,13 @@ static void ide_write_word(struct ide_board *board, uaecptr addr, uae_u16 v)
                                v = adide_encode_word(v);
                                put_ide_reg(board, regnum, v >> 8);
                        }
+               } else if (board->type == DEV_IDE) {
+
+                       int reg = get_dev_hd_reg(addr, board);
+                       if (reg == IDE_DATA) {
+                               put_ide_reg(board, reg, v);
+                       }
+
                }
        }
 }
@@ -1954,7 +2002,6 @@ bool gvp_ide_rom_autoconfig_init(struct autoconfig_info *aci)
                ide->bank = &gvp_ide_rom_bank;
                ide->rom_size = 16384;
        }
-       ide->configured = 0;
        ide->mask = 65536 - 1;
        ide->type = GVP_IDE;
        ide->configured = 0;
@@ -2898,6 +2945,39 @@ void dotto_add_ide_unit(int ch, struct uaedev_config_info *ci, struct romconfig
        add_ide_standard_unit(ch, ci, rc, dotto_board, DOTTO_IDE, false, true, 2);
 }
 
+bool dev_hd_init(struct autoconfig_info* aci)
+{
+       const struct expansionromtype* ert = get_device_expansion_rom(ROMTYPE_DEVHD);
+       ide_add_reset();
+
+       // fake
+       aci->start = 0xe90000;
+       aci->size = 0x10000;
+       dev_hd_io_base = 0x4000;
+       dev_hd_io_size = 4;
+       dev_hd_data_base = 0x4800;
+       dev_hd_io_secondary = 0x1000;
+       dev_hd_io_total = 0x2000;
+       if (!aci->doinit) {
+               return true;
+       }
+       struct ide_board *ide = getide(aci);
+
+       ide->bank = &ide_bank_generic;
+       ide->mask = 65536 - 1;
+       ide->configured = 1;
+       ide->baseaddress = aci->start;
+       map_banks(ide->bank, aci->start >> 16, aci->size >> 16, 0);
+
+       aci->addrbank = ide->bank;
+       return true;
+}
+
+void dev_hd_add_ide_unit(int ch, struct uaedev_config_info* ci, struct romconfig* rc)
+{
+       add_ide_standard_unit(ch, ci, rc, dev_board, DEV_IDE, false, true, 2);
+}
+
 
 extern void x86_xt_ide_bios(struct zfile*, struct romconfig*);
 static bool x86_at_hd_init(struct autoconfig_info *aci, int type)
index d0c414b763b1708fb888fd30bea73e58900d6c2d..afabe2aa04ccf55fe85ff45e0035b6fd7b4b4dbc 100644 (file)
@@ -64,6 +64,9 @@ void tandem_add_ide_unit(int ch, struct uaedev_config_info *ci, struct romconfig
 void dotto_add_ide_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc);
 bool dotto_init(struct autoconfig_info *aci);
 
+void dev_hd_add_ide_unit(int ch, struct uaedev_config_info* ci, struct romconfig* rc);
+bool dev_hd_init(struct autoconfig_info* aci);
+
 uae_u32 REGPARAM3 apollo_ide_lget (uaecptr addr) REGPARAM;
 uae_u32 REGPARAM3 apollo_ide_wget (uaecptr addr) REGPARAM;
 uae_u32 REGPARAM3 apollo_ide_bget (uaecptr addr) REGPARAM;
index a5e9c897ac4600b671ad31ae9b3c7210c9eb744c..a31829431a2f3e171b6c8504e791865831308379 100644 (file)
@@ -201,6 +201,7 @@ extern int decode_cloanto_rom_do (uae_u8 *mem, int size, int real_size);
 #define ROMTYPE_S3VIRGE                0x00100089
 #define ROMTYPE_VOODOO5                0x0010008a
 #define ROMTYPE_HD20A          0x0010008b
+#define ROMTYPE_DEVHD          0x0010008c
 
 #define ROMTYPE_NOT                    0x00800000
 #define ROMTYPE_QUAD           0x01000000