|
@@ -42,7 +42,6 @@ static struct {
|
|
|
|
|
|
static int bus_type = -1;
|
|
|
static int unit_nr = -1;
|
|
|
-
|
|
|
static struct unit {
|
|
|
int cyl;
|
|
|
bool_t initialised;
|
|
@@ -84,8 +83,6 @@ static struct index {
|
|
|
time_t trigger_time;
|
|
|
/* Timer structure for index_timer() calls. */
|
|
|
struct timer timer;
|
|
|
- volatile time_t prev;
|
|
|
- volatile unsigned int hard_count;
|
|
|
} index;
|
|
|
|
|
|
/* Timer to clean up stale index.trigger_time. */
|
|
@@ -396,6 +393,7 @@ static void step_dir_set(bool_t assert)
|
|
|
}
|
|
|
#define step_dir_out() step_dir_set(FALSE)
|
|
|
#define step_dir_in() step_dir_set(TRUE)
|
|
|
+
|
|
|
#if MCU == STM32F8
|
|
|
static void get_tg43_info(void){
|
|
|
}
|
|
@@ -450,9 +448,8 @@ static uint8_t floppy_seek_initialise(struct unit *u)
|
|
|
/* Synchronise to cylinder 0. */
|
|
|
step_dir_out();
|
|
|
for (nr = 0; nr < 256; nr++) {
|
|
|
- if (get_trk0() == LOW){
|
|
|
+ if (get_trk0() == LOW)
|
|
|
goto found_cyl0;
|
|
|
- }
|
|
|
step_once();
|
|
|
}
|
|
|
|
|
@@ -504,9 +501,9 @@ static uint8_t floppy_seek(int cyl)
|
|
|
return ACK_NO_UNIT;
|
|
|
u = &unit[unit_nr];
|
|
|
|
|
|
- op_delay_wait(DELAY_seek);
|
|
|
-
|
|
|
- if (!u->initialised) {
|
|
|
+ op_delay_wait(DELAY_seek);
|
|
|
+
|
|
|
+ if (!u->initialised) {
|
|
|
uint8_t rc = floppy_seek_initialise(u);
|
|
|
if (rc != ACK_OKAY)
|
|
|
return rc;
|
|
@@ -539,6 +536,7 @@ static uint8_t floppy_seek(int cyl)
|
|
|
op_delay_async(DELAY_read | DELAY_write | DELAY_seek,
|
|
|
delay_params.seek_settle * 1000u);
|
|
|
u->cyl = cyl;
|
|
|
+
|
|
|
#if MCU == STM32F7
|
|
|
get_tg43_info();
|
|
|
#endif
|
|
@@ -584,7 +582,6 @@ static void index_set_hard_sector_detection(uint32_t hard_sector_ticks)
|
|
|
static void floppy_flux_end(void)
|
|
|
{
|
|
|
/* Turn off write pins. */
|
|
|
-
|
|
|
if (read_pin(wgate)) {
|
|
|
write_pin(wgate, FALSE);
|
|
|
configure_pin(wdata, GPO_bus);
|
|
@@ -761,7 +758,6 @@ static struct {
|
|
|
unsigned int max_index;
|
|
|
uint32_t max_index_linger;
|
|
|
time_t deadline;
|
|
|
- unsigned int hard_nr_index;
|
|
|
} read;
|
|
|
|
|
|
static void _write_28bit(uint32_t x)
|
|
@@ -789,7 +785,6 @@ static void rdata_encode_flux(void)
|
|
|
/* We have just passed the index mark: Record information about
|
|
|
* the just-completed revolution. */
|
|
|
read.nr_index = index.count;
|
|
|
- read.hard_nr_index=0;
|
|
|
ticks = (timcnt_t)(index.rdata_cnt - prev);
|
|
|
IRQ_global_enable(); /* we're done reading ISR variables */
|
|
|
u_buf[U_MASK(u_prod++)] = 0xff;
|
|
@@ -799,16 +794,7 @@ static void rdata_encode_flux(void)
|
|
|
* pulses). */
|
|
|
watchdog_kick();
|
|
|
}
|
|
|
- //Fake index 2407
|
|
|
- /*
|
|
|
- if (read.hard_nr_index != index.hard_count) {
|
|
|
- read.hard_nr_index = index.hard_count;
|
|
|
- if (read.hard_nr_index!=0){
|
|
|
- u_buf[U_MASK(u_prod++)] = 0xff;
|
|
|
- u_buf[U_MASK(u_prod++)] = FLUXOP_HARD_INDEX;
|
|
|
- }
|
|
|
- }
|
|
|
- */
|
|
|
+
|
|
|
IRQ_global_enable();
|
|
|
|
|
|
/* Process the flux timings into the raw bitcell buffer. */
|
|
@@ -861,6 +847,7 @@ static void rdata_encode_flux(void)
|
|
|
static uint8_t floppy_read_prep(const struct gw_read_flux *rf)
|
|
|
{
|
|
|
op_delay_wait(DELAY_read);
|
|
|
+
|
|
|
/* Prepare Timer & DMA. */
|
|
|
dma_rdata.mar = (uint32_t)(unsigned long)dma.buf;
|
|
|
dma_rdata.ndtr = ARRAY_SIZE(dma.buf);
|
|
@@ -874,7 +861,6 @@ static uint8_t floppy_read_prep(const struct gw_read_flux *rf)
|
|
|
tim_rdata->cr1 = TIM_CR1_CEN;
|
|
|
|
|
|
index.count = 0;
|
|
|
- index.hard_count = 0; //Per 2407
|
|
|
usb_packet.ready = FALSE;
|
|
|
|
|
|
floppy_state = ST_read_flux;
|
|
@@ -1238,6 +1224,7 @@ static void floppy_write_wait_data(void)
|
|
|
|| ((uint32_t)(u_prod - u_cons) < u_buf_threshold))
|
|
|
&& !write_finished)
|
|
|
return;
|
|
|
+
|
|
|
op_delay_wait(DELAY_write);
|
|
|
|
|
|
floppy_state = ST_write_flux_wait_index;
|
|
@@ -1641,7 +1628,6 @@ static void process_command(void)
|
|
|
uint8_t head = u_buf[2];
|
|
|
if ((len != 3) || (head > 1))
|
|
|
goto bad_command;
|
|
|
-
|
|
|
if (read_pin(head) != head) {
|
|
|
op_delay_wait(DELAY_head);
|
|
|
write_pin(head, head);
|
|
@@ -1947,7 +1933,7 @@ static void index_timer(void *unused)
|
|
|
/* index.trigger_time mustn't get so old that the time_diff() test in
|
|
|
* IRQ_INDEX_changed() overflows. To prevent this, we ensure that,
|
|
|
* at all times,
|
|
|
- * time_diff(index.isr_time, time_now()) < 2*INDEX_TIMER_PERIOD + delta,
|
|
|
+ * time_diff(index.trigger_time, now) < 2*INDEX_TIMER_PERIOD + delta,
|
|
|
* where delta is small. */
|
|
|
if (time_diff(index.trigger_time, now) > INDEX_TIMER_PERIOD)
|
|
|
index.trigger_time = now - INDEX_TIMER_PERIOD;
|