소스 검색

floppy: On read flux, after reading all requested index pulses, add a 500us tail to the read operation.
This small overlap into the next revolution is useful when extracting a perfect revolution.

Keir Fraser 4 년 전
부모
커밋
dd4864c216
1개의 변경된 파일11개의 추가작업 그리고 4개의 파일을 삭제
  1. 11 4
      src/floppy.c

+ 11 - 4
src/floppy.c

@@ -344,8 +344,6 @@ static void rdata_encode_flux(void)
     timcnt_t prev = dma.prev_sample, curr, next;
     uint32_t ticks;
 
-    ASSERT(read.nr_index < read.max_index);
-
     /* We don't want to race the Index IRQ handler. */
     IRQ_global_disable();
 
@@ -477,8 +475,17 @@ static void floppy_read(void)
             floppy_state = ST_read_flux_drain;
             u_cons = u_prod = avail = 0;
 
-        } else if ((read.nr_index >= read.max_index)
-                   || (time_since(read.deadline) >= 0)) {
+        } else if (read.nr_index >= read.max_index) {
+
+            /* Read all requested indexes. Allow for a short tail of data. */
+            time_t deadline = time_now() + time_us(500);
+            if (time_diff(deadline, read.deadline) > 0)
+                read.deadline = deadline;
+            read.max_index = INT_MAX;
+
+        }
+
+        else if (time_since(read.deadline) >= 0) {
 
             /* Read all requested data. */
             floppy_flux_end();