Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ccbe4ae46 |
8 changed files with 32 additions and 10 deletions
|
|
@ -102,6 +102,11 @@ motor-delay = ignore
|
||||||
# delay-N: Automatically after N*0.5sec (0 <= N <= 15)
|
# delay-N: Automatically after N*0.5sec (0 <= N <= 15)
|
||||||
chgrst = step
|
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
|
## STARTUP / INITIALISATION
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,7 @@ struct packed ff_cfg {
|
||||||
#define WDRAIN_eot 2
|
#define WDRAIN_eot 2
|
||||||
uint8_t write_drain;
|
uint8_t write_drain;
|
||||||
uint8_t max_cyl;
|
uint8_t max_cyl;
|
||||||
|
bool_t ungated;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct ff_cfg ff_cfg;
|
extern struct ff_cfg ff_cfg;
|
||||||
|
|
|
||||||
11
src/floppy.c
11
src/floppy.c
|
|
@ -285,8 +285,17 @@ static void drive_configure_output_pin(unsigned int pin)
|
||||||
|
|
||||||
void floppy_init(void)
|
void floppy_init(void)
|
||||||
{
|
{
|
||||||
|
const struct exti_irq *irqs;
|
||||||
struct drive *drv = &drive;
|
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();
|
floppy_set_fintf_mode();
|
||||||
|
|
||||||
board_floppy_init();
|
board_floppy_init();
|
||||||
|
|
@ -305,7 +314,7 @@ void floppy_init(void)
|
||||||
drive_change_output(drv, outp_wrprot, TRUE);
|
drive_change_output(drv, outp_wrprot, TRUE);
|
||||||
drive_change_output(drv, outp_trk0, TRUE);
|
drive_change_output(drv, outp_trk0, TRUE);
|
||||||
|
|
||||||
floppy_init_irqs();
|
floppy_init_irqs(irqs);
|
||||||
|
|
||||||
IRQx_set_prio(FLOPPY_SOFTIRQ, FLOPPY_SOFTIRQ_PRI);
|
IRQx_set_prio(FLOPPY_SOFTIRQ, FLOPPY_SOFTIRQ_PRI);
|
||||||
IRQx_enable(FLOPPY_SOFTIRQ);
|
IRQx_enable(FLOPPY_SOFTIRQ);
|
||||||
|
|
|
||||||
|
|
@ -97,14 +97,13 @@ struct exti_irq {
|
||||||
#include "gotek/floppy.c"
|
#include "gotek/floppy.c"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Initialise IRQs according to statically-defined exti_irqs[]. */
|
/* Initialise the specified list of IRQs. */
|
||||||
static void floppy_init_irqs(void)
|
static void floppy_init_irqs(const struct exti_irq *irqs)
|
||||||
{
|
{
|
||||||
const struct exti_irq *e;
|
const struct exti_irq *e;
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
/* Configure physical interface interrupts. */
|
/* 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);
|
IRQx_set_prio(e->irq, e->pri);
|
||||||
if (e->pr_mask != 0) {
|
if (e->pr_mask != 0) {
|
||||||
/* Do not trigger an initial interrupt on this line. Clear EXTI_PR
|
/* 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. */
|
/* 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);
|
IRQx_enable(e->irq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,8 @@ static const struct exti_irq exti_irqs[] = {
|
||||||
/* WGATE */ { 7, FLOPPY_IRQ_WGATE_PRI, 0 },
|
/* WGATE */ { 7, FLOPPY_IRQ_WGATE_PRI, 0 },
|
||||||
/* SIDE */ { 10, TIMER_IRQ_PRI, 0 },
|
/* SIDE */ { 10, TIMER_IRQ_PRI, 0 },
|
||||||
/* WGATE */ { 23, FLOPPY_IRQ_WGATE_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). */
|
/* Subset of output pins which are active (O_TRUE). */
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,8 @@ static const struct exti_irq exti_irqs[] = {
|
||||||
/* WGATE */ { 7, FLOPPY_IRQ_WGATE_PRI, 0 },
|
/* WGATE */ { 7, FLOPPY_IRQ_WGATE_PRI, 0 },
|
||||||
/* WGATE */ { 23, FLOPPY_IRQ_WGATE_PRI, 0 },
|
/* WGATE */ { 23, FLOPPY_IRQ_WGATE_PRI, 0 },
|
||||||
/* RESET */ { 28, TIMER_IRQ_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)
|
bool_t floppy_ribbon_is_reversed(void)
|
||||||
|
|
|
||||||
|
|
@ -1038,6 +1038,10 @@ static void read_ff_cfg(void)
|
||||||
: CHGRST_step;
|
: CHGRST_step;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case FFCFG_ungated:
|
||||||
|
ff_cfg.ungated = !strcmp(opts.arg, "yes");
|
||||||
|
break;
|
||||||
|
|
||||||
/* STARTUP / INITIALISATION */
|
/* STARTUP / INITIALISATION */
|
||||||
|
|
||||||
case FFCFG_ejected_on_startup:
|
case FFCFG_ejected_on_startup:
|
||||||
|
|
@ -1304,9 +1308,11 @@ static void process_ff_cfg_opts(const struct ff_cfg *old)
|
||||||
cfg.ejected = TRUE;
|
cfg.ejected = TRUE;
|
||||||
|
|
||||||
/* oled-font, display-type: Reinitialise the display subsystem. */
|
/* oled-font, display-type: Reinitialise the display subsystem. */
|
||||||
|
/* ungated: Reinitialise the floppy subsystem. */
|
||||||
if ((ff_cfg.oled_font != old->oled_font)
|
if ((ff_cfg.oled_font != old->oled_font)
|
||||||
|| (ff_cfg.oled_contrast != old->oled_contrast)
|
|| (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 */
|
system_reset(); /* hit it with a hammer */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ void floppy_init(void)
|
||||||
write_pin(wrprot, HIGH);
|
write_pin(wrprot, HIGH);
|
||||||
write_pin(ready, HIGH);
|
write_pin(ready, HIGH);
|
||||||
|
|
||||||
floppy_init_irqs();
|
floppy_init_irqs(exti_irqs);
|
||||||
|
|
||||||
timer_init(&index.timer, index_assert, NULL);
|
timer_init(&index.timer, index_assert, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue