You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
imagedev/floppy: replace write_flux with streaming write interface
Replace the batched write_flux(start, end, count, transitions) interface with
an event-driven streaming interface: write_start, write_flux_change, write_end
and write_flush. This makes the floppy device own the write-gate lifecycle
and the transition buffer rather than requiring every controller to maintain
its own.
write_start activates the write gate and snapshots the current track identity.
write_flux_change appends a single transition timestamp to an internal buffer.
write_end deactivates the write gate and flushes buffered transitions to the
track. write_flush commits transitions earlier than a given time without
ending the write, retaining later transitions for a subsequent flush or end.
All controllers now call write_flux_change directly as transitions are
generated rather than maintaining local buffers. Controllers that use
speculative execution with checkpoint/rollback (wd_fdc, 64h156, c2040fdc,
paulafdc) previously needed local 32-entry write buffers to avoid duplicating
transitions after rollback. The floppy device now handles this transparently:
write_flux_change detects out-of-sequence timestamps and discards stale
entries, so replayed transitions replace their predecessors cleanly.
The hp9895 controller supports simultaneous read and write for write-with-
verify loopback. It previously read back transitions from the fdc_pll write
buffer. Since that buffer no longer exists, hp9895 now maintains its own
loopback buffer that captures transition times as they are generated and
serves them back through get_next_transition when the write gate is active.
Add a floppy parameter to fdc_pll_t::start_writing so that write_start is
called on the floppy device at the correct point in the PLL lifecycle. All
controllers that use fdc_pll_t (wd_fdc, swim3, mc6843, upd765, i8271,
hdc92x4, hp9885, isbc202, c8050fdc, victor9k_fdc, hp9895) now pass their
floppy pointer through start_writing. The same change applies to the wd_fdc
digital PLL and the paulafdc PLL.
The old fdc_pll_t::write_next_bit had a lazy-init path that implicitly
started writing on the first bit if start_writing had not been called. Three
controllers (upd765, i8271, hdc92x4) relied on this for sector writes -- only
their format-track paths called start_writing explicitly. That lazy init is
removed; the sector-write paths now call start_writing at the point where they
transition from reading gap data to writing sector data.
The batching performance benefit from the earlier write_flux optimization is
preserved: transitions accumulate in the floppy device and are written to the
track representation only at flush points, avoiding repeated track vector
edits during sequential writes such as formatting.
Copy file name to clipboardExpand all lines: docs/source/techspecs/floppy.rst
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -409,6 +409,29 @@ A number of methods are provided to simplify writing the converter classes.
409
409
410
410
The read/write interface is designed to work asynchronously, e.g. somewhat independently of the current time.
411
411
412
+
**get_next_transition(from_when)**
413
+
414
+
Returns the attotime of the next flux transition after *from_when*. Returns ``attotime::never`` when there is no upcoming transition.
415
+
416
+
**write_start(when)**
417
+
418
+
Activates the write gate at time *when*. No effect when no disk is loaded, the motor is off or the media is write-protected.
419
+
420
+
**write_flux_change(when)**
421
+
422
+
Records a single flux transition at time *when*. Buffered until a flush or end. If *when* is not after the most recently buffered transition, later entries are discarded first; this handles speculative re-execution transparently.
423
+
424
+
**write_end(when)**
425
+
426
+
Deactivates the write gate. Buffered transitions earlier than *when* are flushed to the track with the write span ending at *when*.
427
+
428
+
**write_flush(when)**
429
+
430
+
Commits buffered transitions earlier than *when* without deactivating the write gate. Transitions at or after *when* are retained for a subsequent flush or end.
431
+
432
+
**set_write_splice(when)**
433
+
434
+
Sets the track write-splice position to the angular position corresponding to *when*.
412
435
413
436
414
437
.. [1] Cylinder is a hard-drive term somewhat improperly used for floppies. It comes from the fact that hard-drives are similar to floppies but include a series of stacked disks with a read/write head on each. The heads are physically linked and all point to the same circle on every disk at a given time, making the accessed area look like a cylinder. Hence the name.
0 commit comments