fixed hang if no IDE-device was connected

This commit is contained in:
MHeinrichs
2022-03-08 13:51:53 +01:00
parent 65af379ced
commit 876b2adb5b
17 changed files with 11767 additions and 22370 deletions
+37 -39
View File
@@ -60,7 +60,7 @@ entity LAN_IDE_CP is
RESET : in STD_LOGIC;
INT2_OUT : out STD_LOGIC;
INT6_OUT : out STD_LOGIC;
AUTOBOOT_OFF : in STD_LOGIC;
IDE_OFF : in STD_LOGIC;
ROM_B : out STD_LOGIC_VECTOR (1 downto 0);
ROM_OE : out STD_LOGIC;
IDE_WAIT : in STD_LOGIC;
@@ -132,6 +132,7 @@ architecture Behavioral of LAN_IDE_CP is
signal CP_WE_S: std_logic;
signal CP_WE_QUIRK: std_logic;
signal SET_FREQUENCY: std_logic :='1';
signal CLEAR_REGISTER: std_logic :='1';
signal LAN_CS_RST: std_logic;
signal LAN_WR_RST: std_logic;
@@ -173,7 +174,6 @@ begin
LAN_CS_RST<='1';
LAN_WR_RST<='1';
elsif(rising_edge(CLK_EXT))then
--init the clock afer reset finished!
case LAN_RST_SM is
when nop=>
@@ -188,11 +188,12 @@ begin
LAN_CS_RST<='0';
LAN_WR_RST<='0';
LAN_RST_SM<=clr_commit;
when clr_commit=>
when clr_commit=>
CLEAR_REGISTER <='0';
LAN_CS_RST<='0';
LAN_WR_RST<='1';
LAN_RST_SM<=wait1;
when wait1=>
when wait1=>
LAN_CS_RST<='0';
LAN_WR_RST<='1';
LAN_RST_SM<=set;
@@ -337,7 +338,7 @@ begin
IDE_TERM <= '1';
elsif falling_edge(AMIGA_CLK) then
if(ide='0' and AS ='0')then
if(ide='0' and DS ='0')then
if(RW='0')then
--the write goes to the hdd!
IDE_W_S <= '0';
@@ -453,7 +454,7 @@ begin
elsif(AUTO_CONFIG_DONE = 2)then
CP_BASEADR(7 downto 0) <= D(15 downto 8); --Base adress
SHUT_UP(1) <= '0'; --enable board
AUTO_CONFIG_DONE_CYCLE <= ('0' & AUTOBOOT_OFF); --done here, if Autoboot_off = 0 skip ide part!
AUTO_CONFIG_DONE_CYCLE <= ('0' & IDE_OFF); --done here, if Autoboot_off = 0 skip ide part!
elsif(AUTO_CONFIG_DONE = 1)then
IDE_BASEADR(7 downto 0) <= D(15 downto 8); --Base adress
SHUT_UP(2) <= '0'; --enable board
@@ -473,13 +474,14 @@ begin
ADDRESS_SAMPLE: process(CLK_EXT)
begin
if(rising_edge(CLK_EXT))then
if(falling_edge(CLK_EXT))then
--clear and set-register adresses during initialization phase
if(LAN_RST_SM = wait0 or LAN_RST_SM = clr or LAN_RST_SM = clr_commit)then
A_LAN_OUT <= LAN_A_CLRREG(13 downto 0);
end if;
if(LAN_RST_SM = wait1 or LAN_RST_SM = set or LAN_RST_SM = set_commit)then
A_LAN_OUT <= LAN_A_SETREG(13 downto 0);
if(SET_FREQUENCY = '1')then
if(CLEAR_REGISTER ='1')then
A_LAN_OUT <= LAN_A_CLRREG(13 downto 0);
else
A_LAN_OUT <= LAN_A_SETREG(13 downto 0);
end if;
end if;
if(lan_adr ='0')then --the lanport is shifted by one adress line but I forgot to adopt the clockport address!
@@ -494,28 +496,25 @@ begin
DATA_SAMPLE: process(CLK_EXT)
begin
if(rising_edge(CLK_EXT))then
if(falling_edge(CLK_EXT))then
if(SET_FREQUENCY = '1' and CLEAR_REGISTER ='1')then
D_IN <= LAN_D_CLR;
elsif(SET_FREQUENCY = '1' and CLEAR_REGISTER ='0') then
D_IN <= LAN_D_SET;
elsif(lan_adr ='0' and lan_adr_sw ='0') then
D_IN <= D( 7 downto 0) & D(15 downto 8);
elsif(cp ='0') then
D_IN <= D(15 downto 8) & D(15 downto 8);
elsif((lan_adr ='0' and lan_adr_sw ='1') or ide ='0') then
D_IN <= D( 15 downto 0);
else
D_IN <= x"FFFF";
end if;
if(DS='0')then
if(LAN_RST_SM = wait0 or LAN_RST_SM = clr or LAN_RST_SM = clr_commit) then
D_IN <= LAN_D_CLR;
end if;
if(LAN_RST_SM = wait1 or LAN_RST_SM = set or LAN_RST_SM = set_commit) then
D_IN <= LAN_D_SET;
end if;
if(lan_adr ='0' and lan_adr_sw ='0') then
D_IN <= D( 7 downto 0) & D(15 downto 8);
end if;
if(cp ='0') then
D_IN <= D(15 downto 8) & D(15 downto 8);
end if;
if((lan_adr ='0' and lan_adr_sw ='1') or ide ='0') then
D_IN <= D( 15 downto 0);
end if;
--out sample
if((lan_adr ='0' and lan_adr_sw ='1') or ide = '0') then
D_OUT <= DQ( 15 downto 0);
@@ -534,10 +533,10 @@ begin
end process;
LAN_CS <= not(lan_adr) when LAN_RST_SM =done else not(LAN_CS_RST);
LAN_WRL <= not(LAN_WRL_S) when AS ='0' and LAN_RST_SM =done else not(LAN_WR_RST);
LAN_WRH <= not(LAN_WRH_S) when AS ='0' and LAN_RST_SM =done else not(LAN_WR_RST);
LAN_RD <= not(LAN_RD_S ) when (AS_D ='0' or AS ='0') and LAN_RST_SM =done else '0';
LAN_CS <= not(lan_adr) when SET_FREQUENCY ='0' else not(LAN_CS_RST);
LAN_WRL <= not(LAN_WRL_S) when AS ='0' and SET_FREQUENCY ='0' else not(LAN_WR_RST);
LAN_WRH <= not(LAN_WRH_S) when AS ='0' and SET_FREQUENCY ='0' else not(LAN_WR_RST);
LAN_RD <= not(LAN_RD_S ) when (AS_D ='0' or AS ='0') and SET_FREQUENCY ='0' else '0';
CP_WE <= CP_WE_S when AS ='0' and CP_WE_QUIRK ='1' else '1';
CP_RD <= CP_RD_S when (AS_D ='0' or AS ='0') else '1';
@@ -551,6 +550,7 @@ begin
DQ <= D_IN when (RW='0' and AS='0' and (lan_adr ='0' or cp ='0' or ide ='0')) or SET_FREQUENCY ='1'
else (others => '1') when (RW='1' and AS='1' and ide ='0') -- The bus must be cleared to avoid a hang, if no IDE drive is attached
else (others => 'Z');
IDE_W <= IDE_W_S when AS = '0' else '1';
@@ -578,8 +578,6 @@ begin
--DTACK <= IDE_TERM when ide='0' and (AS_D ='0' or AS ='0') else 'Z';
DTACK <= 'Z';
A <= (others => 'Z');
MTACK <= 'Z';
MTACK <= 'Z';
end Behavioral;