@@ -34,6 +34,8 @@ static time_t prefetch_start_time;
34
34
static uint32_t max_prefetch_us ;
35
35
36
36
struct drive ;
37
+ static always_inline void drive_change_pin (
38
+ struct drive * drv , uint8_t pin , bool_t assert );
37
39
static always_inline void drive_change_output (
38
40
struct drive * drv , uint8_t outp , bool_t assert );
39
41
@@ -130,13 +132,20 @@ static void drive_change_output(
130
132
131
133
static void update_amiga_id (struct drive * drv , bool_t amiga_hd_id )
132
134
{
133
- /* Only for the Amiga interface, with hacked RDY (pin 34) signal. */
134
- if (fintf_mode != FINTF_AMIGA )
135
+ /* JC and pin 34 are overridden only for the Amiga interface. */
136
+ if (fintf_mode != FINTF_AMIGA ) {
137
+ drv -> amiga_pin34 = FALSE;
138
+ board_jc_set_mode (GPI_pull_up );
135
139
return ;
140
+ }
136
141
142
+ /* JC and HDEN are set according to Amiga density. */
143
+ board_jc_set_mode (GPO_opendrain (_2MHz , amiga_hd_id ));
137
144
drive_change_output (drv , outp_hden , amiga_hd_id );
138
145
139
- if (pin34 != outp_unused )
146
+ /* If pin 34 is explicitly configured, we do not mess with it. */
147
+ drv -> amiga_pin34 = (pin34 == outp_unused );
148
+ if (!drv -> amiga_pin34 )
140
149
return ;
141
150
142
151
IRQ_global_disable ();
@@ -151,7 +160,8 @@ static void update_amiga_id(struct drive *drv, bool_t amiga_hd_id)
151
160
* the HD-ID sequence 101010... with the host poll loop. It turns out that
152
161
* starting with pin 34 asserted when the HD image is mounted seems to
153
162
* generally work! */
154
- drive_change_pin (& drive , pin_34 , TRUE);
163
+ if (ff_cfg .motor_delay == MOTOR_ignore )
164
+ drive_change_pin (& drive , pin_34 , TRUE);
155
165
}
156
166
157
167
void floppy_cancel (void )
@@ -613,6 +623,10 @@ static void motor_spinup_timer(void *_drv)
613
623
struct drive * drv = _drv ;
614
624
615
625
drv -> motor .on = TRUE;
626
+ if (drv -> amiga_pin34 ) {
627
+ IRQ_global_disable ();
628
+ drive_change_pin (drv , pin_34 , TRUE);
629
+ }
616
630
drive_change_output (drv , outp_rdy , TRUE);
617
631
}
618
632
0 commit comments