Compare commits

...

1 commit

Author SHA1 Message Date
Keir Fraser
5ccbe4ae46 FF.CFG: New option ungated= to ignore the drive-select line
Instead the drive is permanently enabled.
2022-08-02 18:43:32 +01:00
8 changed files with 32 additions and 10 deletions

View file

@ -102,6 +102,11 @@ motor-delay = ignore
# delay-N: Automatically after N*0.5sec (0 <= N <= 15)
chgrst = step
# Ungated mode: If yes, this drive is permanently enabled, its outputs are
# constantly active, and jumper locations S0/S1/MO have no effect.
# Values: yes | no
ungated = no
##
## STARTUP / INITIALISATION

View file

@ -164,6 +164,7 @@ struct packed ff_cfg {
#define WDRAIN_eot 2
uint8_t write_drain;
uint8_t max_cyl;
bool_t ungated;
};
extern struct ff_cfg ff_cfg;

View file

@ -285,8 +285,17 @@ static void drive_configure_output_pin(unsigned int pin)
void floppy_init(void)
{
const struct exti_irq *irqs;
struct drive *drv = &drive;
irqs = exti_irqs;
if (ff_cfg.ungated) {
/* Skip initialisation of SELA IRQ. We ignore SELA and permanently
* enable drive select. */
irqs += 1;
drv->sel = 1;
}
floppy_set_fintf_mode();
board_floppy_init();
@ -305,7 +314,7 @@ void floppy_init(void)
drive_change_output(drv, outp_wrprot, TRUE);
drive_change_output(drv, outp_trk0, TRUE);
floppy_init_irqs();
floppy_init_irqs(irqs);
IRQx_set_prio(FLOPPY_SOFTIRQ, FLOPPY_SOFTIRQ_PRI);
IRQx_enable(FLOPPY_SOFTIRQ);

View file

@ -97,14 +97,13 @@ struct exti_irq {
#include "gotek/floppy.c"
#endif
/* Initialise IRQs according to statically-defined exti_irqs[]. */
static void floppy_init_irqs(void)
/* Initialise the specified list of IRQs. */
static void floppy_init_irqs(const struct exti_irq *irqs)
{
const struct exti_irq *e;
unsigned int i;
/* Configure physical interface interrupts. */
for (i = 0, e = exti_irqs; i < ARRAY_SIZE(exti_irqs); i++, e++) {
for (e = irqs; e->irq != 0; e++) {
IRQx_set_prio(e->irq, e->pri);
if (e->pr_mask != 0) {
/* Do not trigger an initial interrupt on this line. Clear EXTI_PR
@ -120,7 +119,7 @@ static void floppy_init_irqs(void)
}
/* Enable physical interface interrupts. */
for (i = 0, e = exti_irqs; i < ARRAY_SIZE(exti_irqs); i++, e++) {
for (e = irqs; e->irq != 0; e++) {
IRQx_enable(e->irq);
}
}

View file

@ -60,7 +60,8 @@ static const struct exti_irq exti_irqs[] = {
/* WGATE */ { 7, FLOPPY_IRQ_WGATE_PRI, 0 },
/* SIDE */ { 10, TIMER_IRQ_PRI, 0 },
/* WGATE */ { 23, FLOPPY_IRQ_WGATE_PRI, 0 },
/* MTR/CHGRST */ { 40, TIMER_IRQ_PRI, 0 }
/* MTR/CHGRST */ { 40, TIMER_IRQ_PRI, 0 },
{ 0, 0, 0 }
};
/* Subset of output pins which are active (O_TRUE). */

View file

@ -57,7 +57,8 @@ static const struct exti_irq exti_irqs[] = {
/* WGATE */ { 7, FLOPPY_IRQ_WGATE_PRI, 0 },
/* WGATE */ { 23, FLOPPY_IRQ_WGATE_PRI, 0 },
/* RESET */ { 28, TIMER_IRQ_PRI, 0 },
/* Rotary */ { 40, TIMER_IRQ_PRI, 0 }
/* Rotary */ { 40, TIMER_IRQ_PRI, 0 },
{ 0, 0, 0 }
};
bool_t floppy_ribbon_is_reversed(void)

View file

@ -1038,6 +1038,10 @@ static void read_ff_cfg(void)
: CHGRST_step;
break;
case FFCFG_ungated:
ff_cfg.ungated = !strcmp(opts.arg, "yes");
break;
/* STARTUP / INITIALISATION */
case FFCFG_ejected_on_startup:
@ -1304,9 +1308,11 @@ static void process_ff_cfg_opts(const struct ff_cfg *old)
cfg.ejected = TRUE;
/* oled-font, display-type: Reinitialise the display subsystem. */
/* ungated: Reinitialise the floppy subsystem. */
if ((ff_cfg.oled_font != old->oled_font)
|| (ff_cfg.oled_contrast != old->oled_contrast)
|| (ff_cfg.display_type != old->display_type))
|| (ff_cfg.display_type != old->display_type)
|| (ff_cfg.ungated != old->ungated))
system_reset(); /* hit it with a hammer */
}

View file

@ -138,7 +138,7 @@ void floppy_init(void)
write_pin(wrprot, HIGH);
write_pin(ready, HIGH);
floppy_init_irqs();
floppy_init_irqs(exti_irqs);
timer_init(&index.timer, index_assert, NULL);
}