Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0351c481c0 |
4 changed files with 12 additions and 114 deletions
1
Rules.mk
1
Rules.mk
|
|
@ -15,7 +15,6 @@ FLAGS += -Wstrict-prototypes -Wredundant-decls -Wnested-externs
|
|||
FLAGS += -fno-common -fno-exceptions -fno-strict-aliasing
|
||||
FLAGS += -mlittle-endian -mthumb -mfloat-abi=soft
|
||||
FLAGS += -Wno-unused-value -ffunction-sections
|
||||
FLAGS += -DAPPLE2=1
|
||||
|
||||
## STM32F105
|
||||
ifeq ($(mcu),stm32f105)
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@
|
|||
# jc: Specified by jumper JC (open: shugart, closed: ibmpc)
|
||||
# shugart: P2=DSKCHG, P34=RDY (Amiga, Atari ST, many others)
|
||||
# ibmpc: P2=unused, P34=DSKCHG (IBM PC interface)
|
||||
# ibmpc-hdout: P2=HD_OUT, P34=DSKCHG (not generally needed: prefer 'ibmpc')
|
||||
# ibmpc-hdout: P2=HD_OUT, P34=DSKCHG (not generally needed: prefer ibmpc)
|
||||
# jppc: P2=unused, P34=RDY (Japanese PC standard)
|
||||
# jppc-hdout: P2=HD_OUT, P34=RDY (Japanese PC alternate: prefer 'jppc')
|
||||
# akai-s950: Legacy alias of 'jppc-hdout', previously used for Akai S950
|
||||
# amiga: P2=DSKCHG, P34=DRIVE_ID (not generally needed: prefer 'shugart')
|
||||
# jppc-hdout: P2=HD_OUT, P34=RDY (Japanese PC alternate: prefer jppc)
|
||||
# akai-s950: Legacy alias of jppc-hdout, previously used for Akai S950
|
||||
# amiga: P2=DSKCHG, P34=DRIVE_ID (not generally needed: prefer shugart)
|
||||
interface = jc
|
||||
|
||||
# Host platform: Improves image-format detection for generic types such as IMG
|
||||
|
|
@ -172,9 +172,9 @@ twobutton-action = zero
|
|||
# Input sensor type at the rotary-encoder inputs (pins PC10 and PC11):
|
||||
# [full | half | quarter]:
|
||||
# Rotary encoder, identified by fraction of a Gray-code cycle performed
|
||||
# per detent/click. If default value ('full') requires multiple
|
||||
# clicks/detents to move position then change to 'half' (if 2 clicks
|
||||
# per move) or 'quarter' (if 4 clicks).
|
||||
# per detent/click. If default value (full) requires multiple
|
||||
# clicks/detents to move position then change to half (if 2 clicks
|
||||
# per move) or quarter (if 4 clicks).
|
||||
# [trackball]:
|
||||
# Blackberry-style trackball (eg. using Hall-effect sensors).
|
||||
# [buttons]:
|
||||
|
|
@ -220,15 +220,15 @@ oled-font = 6x13
|
|||
oled-contrast = 143
|
||||
|
||||
# Text height and arrangement on LCD/OLED and on OSD, respectively.
|
||||
# 'default', or a comma-separated list (one entry per LCD/OLED row, top down).
|
||||
# Each list item is a digit plus optional height specifier: <content-row>[d]
|
||||
# content-row: '0-3' = specified content row, '7' = blank
|
||||
# Comma-separated list, one entry per display row, top down.
|
||||
# Each list item is a digit plus optional height specifier: [0-7][d]
|
||||
# content-row: 0-3 = specified content, 7 = blank
|
||||
# 0: Current image name
|
||||
# 1: Status
|
||||
# 2: Image/Volume info
|
||||
# 3: Current subfolder name
|
||||
# height specifier: 'd' = double height (32px, OLED only; ignored for LCD)
|
||||
# 'default' depends on display, eg.: oled-128x32='0,1' ; oled-128x64='3,0d,1'
|
||||
# height-specifier: d = double height (32px, OLED only; ignored for LCD)
|
||||
# Default depends on display, eg.: oled-128x32 -> 0,1 ; oled-128x64 -> 3,0d,1
|
||||
# Values: [0-7][d] | default
|
||||
display-order = default
|
||||
osd-display-order = default
|
||||
|
|
|
|||
|
|
@ -219,12 +219,10 @@ void board_init(void)
|
|||
|
||||
if (mcu_package == MCU_QFN32) {
|
||||
|
||||
#if !defined(APPLE2)
|
||||
/* The sole QFN32 board is a KC30 Rev 1 design. */
|
||||
has_kc30_header = 1;
|
||||
|
||||
pa_skip &= ~(1<<10); /* PA10 is not used as serial rx */
|
||||
#endif
|
||||
pb_skip |= 1<<1; /* PB1 is a floppy input (WGATE) */
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -14,15 +14,8 @@
|
|||
|
||||
/* Input pins: DIR=PB0, STEP=PA1, SELA=PA0, SELB=PA3, WGATE=PB9, SIDE=PB4,
|
||||
* MOTOR=PA15/PB15 */
|
||||
#if defined(APPLE2)
|
||||
#define pin_pha0 6 /* PA6 */
|
||||
#define pin_pha1 15 /* PA15 */
|
||||
#define pin_pha2 0 /* PB0 */
|
||||
#define pin_pha3 1 /* PA1 */
|
||||
#else
|
||||
#define pin_dir 0 /* PB0 */
|
||||
#define pin_step 1 /* PA1 */
|
||||
#endif
|
||||
#define pin_sel0 0 /* PA0 */
|
||||
#define pin_sel1 3 /* PA3 */
|
||||
static uint8_t pin_wgate = 9; /* PB9 */
|
||||
|
|
@ -58,12 +51,7 @@ void IRQ_6(void) __attribute__((alias("IRQ_SELA_changed"))); /* EXTI0 */
|
|||
void IRQ_7(void) __attribute__((alias("IRQ_WGATE_rotary"))); /* EXTI1 */
|
||||
void IRQ_10(void) __attribute__((alias("IRQ_SIDE_changed"))); /* EXTI4 */
|
||||
void IRQ_23(void) __attribute__((alias("IRQ_WGATE_rotary"))); /* EXTI9_5 */
|
||||
#if defined(APPLE2)
|
||||
static struct timer step_timer;
|
||||
static void POLL_step(void *unused);
|
||||
#else
|
||||
void IRQ_28(void) __attribute__((alias("IRQ_STEP_changed"))); /* TMR2 */
|
||||
#endif
|
||||
void IRQ_40(void) __attribute__((alias("IRQ_MOTOR_CHGRST_rotary"))); /* EXTI15_10 */
|
||||
#define MOTOR_CHGRST_IRQ 40
|
||||
static const struct exti_irq exti_irqs[] = {
|
||||
|
|
@ -92,7 +80,6 @@ static volatile uint32_t *p_dma_rd_active;
|
|||
|
||||
bool_t floppy_ribbon_is_reversed(void)
|
||||
{
|
||||
#if !defined(APPLE2)
|
||||
time_t t_start = time_now();
|
||||
|
||||
/* If ribbon is reversed then most/all inputs are grounded.
|
||||
|
|
@ -104,7 +91,6 @@ bool_t floppy_ribbon_is_reversed(void)
|
|||
if (time_since(t_start) > time_ms(1000))
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -125,9 +111,7 @@ static void board_floppy_init(void)
|
|||
gpio->crl = (gpio->crl & ~(0xfu<<((pin)<<2))) \
|
||||
| (((mode)&0xfu)<<((pin)<<2))
|
||||
|
||||
#if !defined(APPLE2)
|
||||
gpio_configure_pin(gpioa, pin_step, GPI_bus);
|
||||
#endif
|
||||
gpio_configure_pin(gpio_data, pin_wdata, GPI_bus);
|
||||
gpio_configure_pin(gpio_data, pin_rdata, GPO_bus);
|
||||
|
||||
|
|
@ -138,10 +122,8 @@ static void board_floppy_init(void)
|
|||
| (((mode)&0x3u)<<((pin)<<1));
|
||||
#define afio syscfg
|
||||
|
||||
#if !defined(APPLE2)
|
||||
gpio_set_af(gpioa, pin_step, 1);
|
||||
gpio_configure_pin(gpioa, pin_step, AFI(PUPD_none));
|
||||
#endif
|
||||
|
||||
gpio_set_af(gpio_data, pin_wdata, 1);
|
||||
gpio_configure_pin(gpio_data, pin_wdata, AFI(PUPD_none));
|
||||
|
|
@ -167,16 +149,7 @@ static void board_floppy_init(void)
|
|||
pin_wgate = 1; /* PB1 */
|
||||
}
|
||||
|
||||
#if defined(APPLE2)
|
||||
gpio_configure_pin(gpioa, pin_pha0, GPI_bus);
|
||||
gpio_configure_pin(gpioa, pin_pha1, GPI_bus);
|
||||
gpio_configure_pin(gpiob, pin_pha2, GPI_bus);
|
||||
gpio_configure_pin(gpioa, pin_pha3, GPI_bus);
|
||||
timer_init(&step_timer, POLL_step, NULL);
|
||||
timer_set(&step_timer, time_now());
|
||||
#else
|
||||
gpio_configure_pin(gpiob, pin_dir, GPI_bus);
|
||||
#endif
|
||||
gpio_configure_pin(gpioa, pin_sel0, GPI_bus);
|
||||
gpio_configure_pin(gpiob, pin_wgate, GPI_bus);
|
||||
gpio_configure_pin(gpiob, pin_side, GPI_bus);
|
||||
|
|
@ -302,76 +275,6 @@ static void update_SELA_irq(bool_t amiga_hd_id)
|
|||
#undef OFF
|
||||
}
|
||||
|
||||
#if defined(APPLE2)
|
||||
|
||||
static void POLL_step(void *unused)
|
||||
{
|
||||
static unsigned int _pha;
|
||||
|
||||
struct drive *drv = &drive;
|
||||
uint16_t idr_a, idr_b;
|
||||
unsigned int pha;
|
||||
|
||||
/* Latch inputs. */
|
||||
idr_a = gpioa->idr;
|
||||
idr_b = gpiob->idr;
|
||||
|
||||
/* Bail if drive not selected. */
|
||||
if (idr_a & m(pin_sel0)) {
|
||||
_pha = 0;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Debounce the phase signals. */
|
||||
pha = _pha;
|
||||
_pha = ((idr_a >> pin_pha0) & 1)
|
||||
| ((idr_a >> (pin_pha1-1)) & 2)
|
||||
| ((idr_b << (2-pin_pha2)) & 4)
|
||||
| ((idr_a << (3-pin_pha3)) & 8);
|
||||
pha &= _pha;
|
||||
|
||||
/* Do nothing while we're mid-step. */
|
||||
if (drv->step.state & STEP_active)
|
||||
goto out;
|
||||
|
||||
/* Rotate the phase bitmap so that the current phase is at bit 0. Note
|
||||
* that the current phase is directly related to the current cylinder. */
|
||||
pha = ((pha | (pha << 4)) >> (drv->cyl & 3)) & 0xf;
|
||||
|
||||
/* Conditions to action a head step:
|
||||
* (1) Only one phase is asserted;
|
||||
* (2) That phase is adjacent to the current phase;
|
||||
* (3) We haven't hit a cylinder hard limit. */
|
||||
switch (pha) {
|
||||
case m(1): /* Phase +1 only */
|
||||
if (drv->cyl == ff_cfg.max_cyl)
|
||||
goto out;
|
||||
drv->step.inward = TRUE;
|
||||
break;
|
||||
case m(3): /* Phase -1 only */
|
||||
if (drv->cyl == 0)
|
||||
goto out;
|
||||
drv->step.inward = FALSE;
|
||||
break;
|
||||
default:
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Action a head step. */
|
||||
if (dma_rd != NULL)
|
||||
rdata_stop();
|
||||
if (dma_wr != NULL)
|
||||
wdata_stop();
|
||||
drv->step.start = time_now();
|
||||
drv->step.state = STEP_started;
|
||||
IRQx_set_pending(FLOPPY_SOFTIRQ);
|
||||
|
||||
out:
|
||||
timer_set(&step_timer, step_timer.deadline + time_ms(1));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static bool_t drive_is_writing(void)
|
||||
{
|
||||
if (!dma_wr)
|
||||
|
|
@ -432,8 +335,6 @@ static void IRQ_STEP_changed(void)
|
|||
IRQx_set_pending(FLOPPY_SOFTIRQ);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void IRQ_SIDE_changed(void)
|
||||
{
|
||||
stk_time_t t = stk_now();
|
||||
|
|
|
|||
Loading…
Reference in a new issue