Author: wmb Date: 2009-01-04 03:33:00 +0100 (Sun, 04 Jan 2009) New Revision: 1062
Modified: dev/isafdc/fdcdma.fth dev/isafdc/fdcpkg.fth Log: Added workarounds to the floppy driver to make it work under emulation. QEMU and VirtualBox don't emulate the "terminal count" bits in the ISA DMA controller status register, so that can't be used to poll for DMA completion.
Modified: dev/isafdc/fdcdma.fth =================================================================== --- dev/isafdc/fdcdma.fth 2009-01-03 23:37:10 UTC (rev 1061) +++ dev/isafdc/fdcdma.fth 2009-01-04 02:33:00 UTC (rev 1062) @@ -5,7 +5,7 @@ headerless
: dma-setup ( vadr len write-memory? -- vadr devaddr len ) - 14 8 pc! \ disable the chip while programming it + 4 8 pc! \ disable the chip while programming it
if 46 else 4a then b pc! \ single transfer, increment addr, \ no autoinit, ch 2 @@ -30,9 +30,10 @@ 0 d4 pc! \ Release channel 4 (master for chs. 0-3) 2 a pc! \ Release channel 2
- 10 8 pc! \ re-enable the chip + 0 8 pc! \ re-enable the chip
; +[ifdef] notdef : dma-wait ( vaddr devaddr len -- timeout? ) true d# 400 0 do @@ -43,6 +44,18 @@ " dma-map-out" $call-parent r> ; +[else] +: dma-wait ( vaddr devaddr len -- timeout? ) + true + d# 400 0 do + 0 c pc! 5 pc@ 5 pc@ bwjoin h# ffff = if 0= leave then + d# 10 ms + loop + >r + " dma-map-out" $call-parent + r> +; +[then]
headers external
Modified: dev/isafdc/fdcpkg.fth =================================================================== --- dev/isafdc/fdcpkg.fth 2009-01-03 23:37:10 UTC (rev 1061) +++ dev/isafdc/fdcpkg.fth 2009-01-04 02:33:00 UTC (rev 1062) @@ -65,14 +65,15 @@ loop ;
-\ We set both the block size and the maximum transfer size to one cylinder. -\ Reading a cylinder at a time improves the performance dramatically -\ compared to reading a block at at a time. -\ XXX: Override these values if the installed drive isn't 3.5-inch 1.44MB. : sec/cyl ( -- n ) sec/trk 2* ; -: max-transfer ( -- n ) h# 200 sec/cyl * ; + +\ It is tempting to set the block size and the maximum transfer size to +\ one cylinder to get better performance, but that doesn't work well +\ with filesystems that expect the block size to be 512. +\ : max-transfer ( -- n ) h# 200 sec/cyl * ; \ : block-size ( -- n ) max-transfer ; \ : #blocks ( -- n ) d# 80 ; \ For 1.44 MByte floppies +: max-transfer ( -- n ) h# 200 ; : block-size ( -- n ) h# 200 ; : #blocks ( -- n ) d# 80 sec/cyl * ; \ For 1.44 MByte floppies