Author: wmb
Date: 2008-09-30 23:18:35 +0200 (Tue, 30 Sep 2008)
New Revision: 955
Added:
dev/isafdc/
dev/isafdc/build/
dev/isafdc/chrpejct.fth
dev/isafdc/fdc-test.fth
dev/isafdc/fdccntrl.fth
dev/isafdc/fdcconf.fth
dev/isafdc/fdcdata.fth
dev/isafdc/fdcdma.fth
dev/isafdc/fdcpio.fth
dev/isafdc/fdcpkg.fth
dev/isafdc/isafdc.fth
dev/isafdc/loadfdc.fth
Log:
Added old floppy driver to tree for use with VMWare and VirtualBox.
Added: dev/isafdc/chrpejct.fth
===================================================================
--- dev/isafdc/chrpejct.fth (rev 0)
+++ dev/isafdc/chrpejct.fth 2008-09-30 21:18:35 UTC (rev 955)
@@ -0,0 +1,60 @@
+purpose: Amend floppy nodes to implement and report the CHRP eject function
+\ See license at end of file
+
+dev /fdc
+
+0 0 encode-bytes
+h# 3f0 1 encode-phys encode+ 7 encode-int encode+
+h# 3f7 1 encode-phys encode+ 1 encode-int encode+
+eject-port 1 encode-phys encode+ 1 encode-int encode+
+" reg" property
+
+" chrp,fdc" +compatible
+
+0 0 encode-bytes " auto-eject" property
+
+: eject ( -- )
+ floppy-xselect \ Select drive, enable motor
+ eject-port pc@ dup ( orig orig ) \ Old port value
+ dup 1 and if ( orig orig ) \ Is eject bit currently 1?
+ h# fe and ( orig eject ) \ Set low (active low eject)
+ else
+ 1 or ( orig eject ) \ Set high (active high eject)
+ then
+ eject-port pc! ( orig ) \ Set the eject bit
+ 1 ms ( orig ) \ Wait
+ eject-port pc! ( ) \ Put back original value
+ floppy-xdeselect \ Unselect drive, disable motor
+;
+
+dev /fdc/disk
+: eject ( -- )
+ my-unit " set-address" $call-parent
+ " eject" $call-parent
+;
+device-end
+
+
+\ LICENSE_BEGIN
+\ Copyright (c) 1997 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
Added: dev/isafdc/fdc-test.fth
===================================================================
--- dev/isafdc/fdc-test.fth (rev 0)
+++ dev/isafdc/fdc-test.fth 2008-09-30 21:18:35 UTC (rev 955)
@@ -0,0 +1,143 @@
+\ ========== Copyright Header Begin ==========================================
+\
+\ Hypervisor Software File: fdc-test.fth
+\
+\ Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
+\
+\ - Do no alter or remove copyright notices
+\
+\ - Redistribution and use of this software in source and binary forms, with
+\ or without modification, are permitted provided that the following
+\ conditions are met:
+\
+\ - Redistribution of source code must retain the above copyright notice,
+\ this list of conditions and the following disclaimer.
+\
+\ - Redistribution in binary form must reproduce the above copyright notice,
+\ this list of conditions and the following disclaimer in the
+\ documentation and/or other materials provided with the distribution.
+\
+\ Neither the name of Sun Microsystems, Inc. or the names of contributors
+\ may be used to endorse or promote products derived from this software
+\ without specific prior written permission.
+\
+\ This software is provided "AS IS," without a warranty of any kind.
+\ ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+\ INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+\ PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+\ MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+\ ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+\ DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
+\ OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
+\ FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+\ DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+\ ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+\ SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+\
+\ You acknowledge that this software is not designed, licensed or
+\ intended for use in the design, construction, operation or maintenance of
+\ any nuclear facility.
+\
+\ ========== Copyright Header End ============================================
+purpose: Selftest routines for floppy disk controller.
+copyright: Copyright 1990 Sun Microsystems, Inc. All Rights Reserved
+
+headerless
+: sense-drive-status ( head -- status )
+ floppy-select
+ 4 fdc-cmd ( head ) h&d >fdc
+ result
+ floppy-deselect
+ statbuf c@
+;
+
+: dumpreg ( -- ) h# 0e fdc-cmd result ;
+
+: chk ( flag value index -- flag' ) statbuf + c@ <> or ;
+: check-registers ( -- error? )
+\ 0 c, 0 c, 0 c, 0 c, \ Cylinder numbers
+ false
+ srt 4 << hut or 4 chk ( error? )
+ hlt 1 << nd or 5 chk ( error? )
+
+\ This doesn't work on some chips, such as the SMC 37C935 Super-I/O
+\ moff 4 << hsda or mon or flock or 7 chk ( error? )
+
+ eis efifo or poll or fifothr or 8 chk ( error? )
+ \ We can't check the EOT/SC field because its value depends on a
+ \ prior execution of a read, write, or format command.
+;
+
+\ If flag is true, displays the message "adr len", ?error places false on
+\ the stack and returns to the caller's caller. Otherwise discards adr,len
+
+: ?error ( flag adr len -- [ false ] )
+ rot if type cr false r> drop else 2drop then
+;
+
+: 1cyl ( -- #bytes ) sec/trk 2* h# 200 * ;
+
+headers
+: chip-okay? ( -- okay? )
+ false
+\ statbuf c@ h# 80 <> " Floppy chip initialization failed." ?error
+
+\ dumpreg check-registers
+\ " Floppy chip registers read back incorrectly." ?error
+ 0=
+;
+: drive-okay? ( -- okay? )
+ floppy-recalibrate statbuf c@ h# 10 and if
+ ." Recalibrate failed. The floppy drive is either missing," cr
+ ." improperly connected, or defective." cr
+ false exit
+ then
+
+ false
+ 0 floppy-seek statbuf c@
+ h# 20 drive + <> " Seek to track 0 failed." ?error
+
+ 0 sense-drive-status
+ h# 10 and 0= " Track 0 not reported." ?error
+
+ 2 floppy-seek statbuf c@
+ h# 20 drive + <> " Seek to track 2 failed." ?error
+
+ 0 sense-drive-status
+ h# 10 and " Track 0 reported when on track 2." ?error
+
+ 0 floppy-seek statbuf c@
+ h# 20 drive + <> " Seek to track 0 failed." ?error
+
+ 0 sense-drive-status
+ h# 10 and 0= " Track 0 not reported." ?error
+
+ 0 sense-drive-status
+ 4 and " Head select is 1; should be 0." ?error
+
+ 1 sense-drive-status
+ 4 and 0= " Head select is 0; should be 1." ?error
+
+ 0=
+;
+
+: test-disk ( drive# -- error? )
+ ." Testing floppy disk system. A formatted disk should be in the drive." cr
+ to drive
+ chip-okay? 0= if true exit then
+ drive-okay? 0= if true exit then
+
+ \ diskette-present? is sometimes redefined so we use $call-self to
+ \ make sure we get the latest version...
+ " diskette-present?" $call-self 0= if
+ ." Diskette not present" cr true exit
+ then
+
+ 1cyl dma-alloc >r
+ r@ 0 1cyl true r/w-data dup if ( fatal? true )
+ nip ( true )
+ ." Can't read the first cylinder." cr ( true )
+ then ( error? )
+ r> 1cyl dma-free
+;
+
Added: dev/isafdc/fdccntrl.fth
===================================================================
--- dev/isafdc/fdccntrl.fth (rev 0)
+++ dev/isafdc/fdccntrl.fth 2008-09-30 21:18:35 UTC (rev 955)
@@ -0,0 +1,159 @@
+\ ========== Copyright Header Begin ==========================================
+\
+\ Hypervisor Software File: fdccntrl.fth
+\
+\ Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
+\
+\ - Do no alter or remove copyright notices
+\
+\ - Redistribution and use of this software in source and binary forms, with
+\ or without modification, are permitted provided that the following
+\ conditions are met:
+\
+\ - Redistribution of source code must retain the above copyright notice,
+\ this list of conditions and the following disclaimer.
+\
+\ - Redistribution in binary form must reproduce the above copyright notice,
+\ this list of conditions and the following disclaimer in the
+\ documentation and/or other materials provided with the distribution.
+\
+\ Neither the name of Sun Microsystems, Inc. or the names of contributors
+\ may be used to endorse or promote products derived from this software
+\ without specific prior written permission.
+\
+\ This software is provided "AS IS," without a warranty of any kind.
+\ ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+\ INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+\ PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+\ MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+\ ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+\ DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
+\ OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
+\ FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+\ DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+\ ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+\ SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+\
+\ You acknowledge that this software is not designed, licensed or
+\ intended for use in the design, construction, operation or maintenance of
+\ any nuclear facility.
+\
+\ ========== Copyright Header End ============================================
+purpose: Floppy Disk Controller driver, control words
+copyright: Copyright 1990 Sun Microsystems, Inc. All Rights Reserved
+
+\ P. Thomas 12/21/87
+
+headerless
+hex
+
+0 instance value floppy-#selects
+: floppy-select ( -- )
+ floppy-#selects dup 0= if floppy-xselect then
+ 1+ is floppy-#selects
+;
+: floppy-deselect ( -- )
+ floppy-#selects 1- dup 0<= if floppy-xdeselect then
+ 0 max is floppy-#selects
+;
+
+
+: h&d ( head -- n ) 1 and 2 << drive 3 and or ;
+
+\ true if problem in execution
+: floppy-error? ( -- flag ) statbuf c@ h# c0 and ;
+
+: ck-density ( mfm -- ok? )
+ floppy-select
+ h# 0a or mt or fdc-cmd 0 h&d >fdc
+ result floppy-error?
+ floppy-deselect
+;
+
+\ Adds funky bits to the command code
+\ : +xfer-bits ( cmd -- cmd' )
+\ mfm ck-density if 0 else mfm then
+\ or mt or
+\ ;
+
+: +xfer-bits ( cmd -- cmd' ) mfm or mt or ;
+
+: sense-interrupt-status ( -- status ) 08 fdc-cmd result statbuf c@ ;
+
+\ Read and discard all the interrupt events that the chip has queued up.
+\ Stop when there are no more events to read.
+: flush-int ( -- )
+ d# 50 0 do
+ sense-interrupt-status ( status )
+ \ wait for intr status
+ h# c0 and h# c0 = ?leave
+ 1 ms
+ loop
+ \ Flush the queue
+ d# 10 0 do
+ sense-interrupt-status h# c0 and h# 80 = ?leave
+ loop
+;
+
+\ Read and discard interrupt events until an event for this drive is seen.
+: wait-done ( -- )
+ wait-command
+ begin
+ \ Discard status for other drives
+ begin sense-interrupt-status 3 and drive = until
+ \ Wait until either Seek End or Equipment Check
+ statbuf c@ h# 30 and
+ until
+;
+
+: fdc-specify ( -- ) \ sets drive characteristics
+ 3 fdc-cmd
+ srt 4 << hut or >fdc
+ hlt 1 << nd or >fdc
+;
+
+: fdc-lock ( -- ) \ Protect the config parameters
+ 94 fdc-cmd
+ fdc-fifo-wait fifo@ 2drop
+;
+
+: fdc-configure ( -- ) \ Sets the floppy controller chip parameters
+ 13 fdc-cmd
+ moff 4 << hsda or mon or >fdc
+ eis efifo or poll or fifothr or >fdc
+ pretrk >fdc
+;
+
+: floppy-recalibrate ( -- ) \ Seeks to track 0
+ floppy-select
+ 7 fdc-cmd drive >fdc wait-done
+ floppy-deselect
+;
+: floppy-seek ( cylinder -- ) \ Seeks to the indicated cylinder
+ floppy-select
+ 0f fdc-cmd 0 h&d >fdc ( cylinder ) >fdc wait-done
+ d# 15 ms \ Head settling time
+ floppy-deselect
+;
+: diskette-present? ( -- flag ) \ true if a floppy disk is in the drive
+ floppy-select
+ dir@ drop \ Read once to clear out the old status
+ 1 floppy-seek floppy-recalibrate
+ dskchg-bitset? 0= ( flag )
+ floppy-deselect ( flag )
+;
+
+headers
+: fdc-init ( -- )
+ map-floppy
+ 0 is floppy-#selects
+ fdc-reset
+ flush-int
+ fdc-specify
+ fdc-configure
+ fdc-lock
+;
+
+: drive-present? ( -- flag )
+ fdc-init floppy-recalibrate statbuf c@ h# 10 and 0=
+;
Added: dev/isafdc/fdcconf.fth
===================================================================
--- dev/isafdc/fdcconf.fth (rev 0)
+++ dev/isafdc/fdcconf.fth 2008-09-30 21:18:35 UTC (rev 955)
@@ -0,0 +1,179 @@
+\ ========== Copyright Header Begin ==========================================
+\
+\ Hypervisor Software File: fdcconf.fth
+\
+\ Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
+\
+\ - Do no alter or remove copyright notices
+\
+\ - Redistribution and use of this software in source and binary forms, with
+\ or without modification, are permitted provided that the following
+\ conditions are met:
+\
+\ - Redistribution of source code must retain the above copyright notice,
+\ this list of conditions and the following disclaimer.
+\
+\ - Redistribution in binary form must reproduce the above copyright notice,
+\ this list of conditions and the following disclaimer in the
+\ documentation and/or other materials provided with the distribution.
+\
+\ Neither the name of Sun Microsystems, Inc. or the names of contributors
+\ may be used to endorse or promote products derived from this software
+\ without specific prior written permission.
+\
+\ This software is provided "AS IS," without a warranty of any kind.
+\ ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+\ INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+\ PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+\ MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+\ ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+\ DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
+\ OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
+\ FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+\ DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+\ ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+\ SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+\
+\ You acknowledge that this software is not designed, licensed or
+\ intended for use in the design, construction, operation or maintenance of
+\ any nuclear facility.
+\
+\ ========== Copyright Header End ============================================
+purpose: Floppy controller driver variables and constants
+copyright: Copyright 1990 Sun Microsystems, Inc. All Rights Reserved
+
+hex
+
+headerless
+d# 10 instance buffer: statbuf
+
+ 40 constant dio \ Direction In, i.e. read FIFO
+ 10 constant busy \ Not ready for new command
+
+ 2 instance value #heads \ number of heads
+d# 18 instance value sec/trk \ sectors per track (9 for 720K, d# 18 for 1.44M )
+ 200 instance value bytes/sec \ bytes per sector. goes with size
+ 0 instance value drive \ drive number
+
+d# 18 instance value end-of-trk \ final sector number of current track
+ 2 instance value size \ bytes per sector (2 for 512)
+ 01b instance value gpl \ read, write gap
+ 0ff instance value dtl \ special sector size (0 for 128 byte sector)
+
+ 1b instance value gpl3 \ gap 3 size
+
+\ 0c instance value srt \ 13 for 4 ms at 500Kbps
+\ 2 instance value hut \ 2 for 16 ms at 500Kbps
+\ 19 instance value hlt \ 25 for 50 ms at 500Kbps
+
+\ 1.44 in 1.44 drive
+ 0a instance value srt \ 0 for 16 ms at 500Kbps
+ 0f instance value hut \ 0 for 256 ms at 500Kbps
+ 1 instance value hlt \ 0 for 256 ms at 500Kbps
+
+ 0 instance value mot \ 0 for wait for motor
+ 0 instance value moff \ 6 for 5.2secs delay default, 300 rpm
+ \ The 82077 does not support the MON field; the second "configure"
+ \ byte must be 0
+ 0 instance value mon \ 4 for 800msec motor on delay, 300 rpm
+ 0 instance value efifo \ 20 for no fifo, default
+ 9 instance value fifothr \ FIFO threshold; report ready as soon as possible
+ 0 instance value precomp \ 0 for default, 125 ns at 500 Kbps
+ 0 instance value dratesel \ data rate select, 0 for 500 Kbps
+
+ 40 constant mfm \ 40 for mfm
+ 80 constant mt \ multi-track - read until the end of a cylinder
+ 0 constant nd \ non-DMA mode
+ 0 constant hsda \ no high speed disks
+ 80 constant flock \ floppy parameters locked
+ 40 constant eis \ implied seek
+ 10 constant poll \ 10 to disable polling
+ 0 constant pretrk \ 0 for pre-comp on track 0
+
+ 3 constant dor-drvsel \ drive select bit mask
+ 4 constant dor-reset \ hard reset
+ 8 constant dor-dmagate \ enable INT, DRQ, TC, and DACK to the system
+\ 10 constant dor-motoren0 \ motor enable for drive 0
+\ 20 constant dor-motoren1 \ motor enable for drive 1
+\ 40 constant dor-motoren2 \ motor enable for drive 2
+\ 80 constant dor-motoren3 \ motor enable for drive 3
+[ifdef] sun
+ 80 constant dor-eject \ floppy eject (Sun-specific)
+[then]
+
+ 80 constant dsr-swreset \ soft reset
+ 80 constant dir-dskchg \ disk change
+
+: wait-command ( -- ) begin busy fstat@ and 0= until ;
+
+\ Reads result bytes as long as the chip has some to give us
+: result ( -- )
+ statbuf begin ( adr )
+ \ If fdc-fifo-wait times out, the 80 bit will not be set
+ fdc-fifo-wait dio 80 or tuck and = ( adr flag )
+ while
+ fifo@ over c! 1+ ( adr' )
+ repeat ( adr )
+ drop
+;
+
+\ Sends a command byte to the floppy command registers
+: >fdc ( byte -- )
+ fdc-fifo-wait dio and abort" Floppy chip not ready for command"
+ fifo!
+;
+
+\ Sends the first command byte to the floppy command register
+: fdc-cmd ( command-byte -- ) wait-command >fdc ;
+
+: dor-motoren ( -- mask ) h# 10 drive lshift ;
+
+: floppy-xdeselect ( -- )
+ fstat@ busy and 0= ( flag1 )
+ dor@ dor-motoren and ( flag1 flag2 )
+ and if
+ dor@ dor-motoren invert and dor!
+ then
+;
+
+: fdc-reset ( -- )
+ dor@ dor-reset invert and dor!
+ 1 ms
+ dor@ dor-reset or dor!
+ 1 ms
+\ dor-reset dor!
+ clear-terminal-count
+ dsr-swreset fstat!
+ precomp 2 << dratesel + fstat!
+
+ \ Theoretically, 2 milliseconds delay is needed before the oscillators
+ \ stabilize, but this is overlapped with the head load delay, so we
+ \ don't actually have to time it.
+
+2 ms
+
+ floppy-xdeselect
+ dor@ dor-reset or dor-dmagate or dor!
+\ dor-dmagate dor!
+;
+
+
+: floppy-xselect ( -- )
+ dor@
+ dor-drvsel invert and drive or
+ dor-motoren or
+ dor!
+\ d# 500 ms
+;
+
+: dskchg-bitset? ( -- flag ) dir@ dir-dskchg and ;
+headers
+[ifdef] sun
+: floppy-eject ( -- )
+ map-floppy
+ floppy-xselect
+ dor@ dor-eject or dor! noop noop dor@ dor-eject invert and dor!
+ floppy-xdeselect
+ unmap-floppy
+;
+[then]
Added: dev/isafdc/fdcdata.fth
===================================================================
--- dev/isafdc/fdcdata.fth (rev 0)
+++ dev/isafdc/fdcdata.fth 2008-09-30 21:18:35 UTC (rev 955)
@@ -0,0 +1,85 @@
+\ ========== Copyright Header Begin ==========================================
+\
+\ Hypervisor Software File: fdcdata.fth
+\
+\ Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
+\
+\ - Do no alter or remove copyright notices
+\
+\ - Redistribution and use of this software in source and binary forms, with
+\ or without modification, are permitted provided that the following
+\ conditions are met:
+\
+\ - Redistribution of source code must retain the above copyright notice,
+\ this list of conditions and the following disclaimer.
+\
+\ - Redistribution in binary form must reproduce the above copyright notice,
+\ this list of conditions and the following disclaimer in the
+\ documentation and/or other materials provided with the distribution.
+\
+\ Neither the name of Sun Microsystems, Inc. or the names of contributors
+\ may be used to endorse or promote products derived from this software
+\ without specific prior written permission.
+\
+\ This software is provided "AS IS," without a warranty of any kind.
+\ ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+\ INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+\ PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+\ MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+\ ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+\ DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
+\ OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
+\ FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+\ DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+\ ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+\ SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+\
+\ You acknowledge that this software is not designed, licensed or
+\ intended for use in the design, construction, operation or maintenance of
+\ any nuclear facility.
+\
+\ ========== Copyright Header End ============================================
+purpose: Floppy data transfer
+copyright: Copyright 1990 Sun Microsystems, Inc. All Rights Reserved
+
+headerless
+10 instance buffer: fcmdbuf
+instance variable fcmdp
+: putb ( byte -- ) fcmdp @ c! 1 fcmdp +! ;
+: setcmd ( -- ) fcmdbuf fcmdp ! putb ;
+: sendcmd ( -- ) fcmdp @ fcmdbuf ?do i c@ >fdc loop ;
+
+\ fills command block for transfer commands
+: transfer-command ( block# cmd -- )
+ +xfer-bits setcmd ( block# )
+ sec/trk /mod ( sector# track# )
+ #heads /mod ( sector# cylinder# head# )
+ over h&d putb ( sector# cylinder# head# )
+
+ putb putb 1+ putb ( )
+ size putb end-of-trk putb gpl3 putb dtl putb
+ sendcmd
+;
+
+headers
+
+: r/w-data ( adr block# #bytes read? -- false | fatal? true )
+ dup if 6 else 5 then ( adr block# #bytes read? command )
+ floppy-select ( adr block# #bytes read? command )
+ ff statbuf c! ( adr block# #bytes read? command )
+ >r rot >r ( adr #bytes read? ) ( r: cmd block# )
+ dma-setup ( adr devaddr #bytes ) ( r: cmd block# )
+ r> r> ( adr devaddr #bytes block# cmd )
+ transfer-command ( adr devaddr #bytes )
+ dma-wait drop result ( )
+ floppy-error? ( error? )
+ floppy-deselect ( error? )
+
+ dup if ( true )
+ statbuf 1+ c@ 30 and 0= ( true fatal? )
+ dup 0= if floppy-recalibrate then ( true fatal? )
+ swap
+ then ( false | fatal? true )
+;
+
+headers
Added: dev/isafdc/fdcdma.fth
===================================================================
--- dev/isafdc/fdcdma.fth (rev 0)
+++ dev/isafdc/fdcdma.fth 2008-09-30 21:18:35 UTC (rev 955)
@@ -0,0 +1,105 @@
+purpose: Program channel 2 of an ISA DMA controller for use with an ISA floppy
+\ See license at end of file
+
+hex
+headerless
+
+: dma-setup ( vadr len write-memory? -- vadr devaddr len )
+ 14 8 pc! \ disable the chip while programming it
+
+ if 46 else 4a then b pc! \ single transfer, increment addr,
+ \ no autoinit, ch 2
+
+ 2dup true " dma-map-in" $call-parent swap ( vadr devadr len )
+
+ \ Load count ( vadr devadr len )
+ 0 c pc! \ Reset address byte pointer
+ dup 1- wbsplit swap 5 pc! 5 pc! ( vadr devadr len )
+
+ \ Load address
+ 0 c pc! \ Reset address byte pointer
+ over lbsplit 2swap swap 4 pc! 4 pc! ( vadr devadr len page-byte hi-byte )
+
+ swap 81 pc! ( vadr devadr len hi-byte )
+
+ \ Setting this high byte register last causes the DMA controller
+ \ in the 82378 to increment all 32 bits of the address.
+ 481 pc! ( vadr devadr len )
+
+ c0 d6 pc! \ Set cascade mode for channel 4
+ 0 d4 pc! \ Release channel 4 (master for chs. 0-3)
+ 2 a pc! \ Release channel 2
+
+ 10 8 pc! \ re-enable the chip
+
+;
+: dma-wait ( vaddr devaddr len -- timeout? )
+ true
+ d# 400 0 do
+ 8 pc@ 4 and if 0= leave then
+ d# 10 ms
+ loop
+ >r
+ " dma-map-out" $call-parent
+ r>
+;
+
+headers
+external
+
+\ The deblocker needs these
+: dma-alloc ( len -- adr )
+ \ We must ensure that the buffer is in the lower 16 MBytes,
+ \ and doesn't cross a 64K boundary.
+
+ \ Allocate twice as much as is wanted to guarantee that there will
+ \ be a piece of the desired size on one side of a 64K boundary.
+
+ dup 2* " dma-alloc" $call-parent swap ( adr len )
+
+ \ The boundary crossing must be evaluated in physical space
+ 2dup true " dma-map-in" $call-parent ( adr len phys )
+ 3dup swap " dma-map-out" $call-parent ( adr len phys )
+
+ h# ffff and ( adr len offset )
+
+ tuck + na1+ h# 10000 > if ( adr offset )
+ \ The start is too close to the boundary,
+ \ so we use the piece above the boundary
+
+ over swap - h# 10000 + ( adr adr' )
+ else ( adr offset )
+ drop dup na1+ ( adr adr' )
+ then
+
+ \ Store the address of the allocated piece just before the returned
+ \ address, so that dma-free can find that address
+ tuck -1 na+ ! ( adr' )
+;
+: dma-free ( adr len -- ) swap -1 na+ @ swap " dma-free" $call-parent ;
+
+headers
+
+\ LICENSE_BEGIN
+\ Copyright (c) 1994 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
Added: dev/isafdc/fdcpio.fth
===================================================================
--- dev/isafdc/fdcpio.fth (rev 0)
+++ dev/isafdc/fdcpio.fth 2008-09-30 21:18:35 UTC (rev 955)
@@ -0,0 +1,162 @@
+purpose: Patch floppy driver to use programmed-I/O
+\ See license at end of file
+
+dev /fdc
+
+headerless
+\ patch 54 14 dma-setup \ DREQ active high \ use no dma before it's time
+\ patch 50 10 dma-setup \ DREQ active high
+
+1 to nd \ Set non-DMA mode
+
+[ifdef] notdef
+code pio-sector ( adr len in? reg-adr -- error? )
+ lwz t2,0(sp) \ direction in t2
+ lwz t0,1cell(sp) \ len to t0
+ lwz t1,2cells(sp) \ adr to t1
+ addi sp,sp,3cells \ clear stack
+
+ mtspr ctr,t0 \ Setup loop counter
+
+ addi t1,t1,-1 \ Account for pre-increment
+
+ \ We can't allow interrupts because the time
+ \ spent handling them could cause overruns
+ mfmsr t3
+ rlwinm t0,t3,0,17,15 \ Mask off interrupt enable bit
+ mtmsr t0
+
+ \ Now that interupts are disabled, we can use the DEC register
+ \ to keep track of a timeout. But we must save the value that
+ \ is there and restore it when we are done. We will use the T5
+ \ register to do that hold hold the orignal value.
+
+ mfspr t5,dec
+
+ \ Now to calculate a timeout value and stuff it into DEC
+
+ 'user counts/ms lwz t6,* \ Get counts per milisecond, store in t6
+
+ mulli t7,t6,d#10000 \ h# 2710 is 10000 (mS) ==> 10 Seconds
+ mtspr dec,t7 \ Set the DEC register
+ mulli t7,t6,d#1000 \ Set 1 second in t7, 3e8 is 1000.
+
+ cmpi 0,0,t2,0 \ Incoming if nonzero
+ <> if
+ set t9,h#40 \ Use t9 to hold mask value which determines
+ else \ how to test status register. 40 for reads
+ set t9,h#0 \ 00 for writes.
+ then
+
+ begin
+ begin
+ lbz t4,0(tos)
+ andi. t8,t4,h#80
+ 0= while \ Wait until device has data for us
+ mfspr t6,dec
+ cmp 0,0,t6,t7
+ < if \ Less than 1 second left...timeout
+ 1 L:
+ set tos,-1 \ Set error flag
+ mtspr ctr,up \ Restore "next" pointer
+ mtmsr t3 \ Restore previous state of interrupt enable
+ mtspr dec,t5 \ Restore the DEC to it's original value.
+ next
+ then
+ repeat
+
+ andi. t8,t4,h#20 \ If the Non-DMA bit is off, the data phase
+ 1 B: 0= brif \ is over prematurely, so go to error bailout
+
+ andi. t8,t4,h#40 \ If the direction is wrong, bail out
+ cmp 0,0,t8,t9
+ 1 B: <> brif
+
+ cmpi 0,0,t2,0
+ <> if \ Read case
+ lbz t0,1(tos) \ Data byte
+ stbu t0,1(t1) \ Store to memory
+ else \ Write case
+ lbzu t0,1(t1) \ Load from memory
+ stb t0,1(tos) \ Data byte
+ then
+ countdown
+
+ mtspr ctr,up \ Restore "next" pointer
+ mtspr dec,t5 \ Restore the DEC to it's original value.
+ mtmsr t3 \ Restore previous state of interrupt enable
+ set tos,0
+c;
+: pio-data-transfer ( adr len in? -- error? ) floppy-chip pio-sector ;
+
+
+[else]
+: (pio-data-transfer) ( adr len in? -- error? )
+ if ( adr len )
+ bounds ?do
+ begin fstat@ h# 80 and until
+ fstat@ h# 60 and h# 60 <> if
+ true unloop exit
+ then
+ fifo@ i c!
+ loop
+ else
+ bounds ?do
+ begin fstat@ h# 80 and until
+ fstat@ h# 60 and h# 20 <> if
+ true unloop exit
+ then
+ i c@ fifo!
+ loop
+ then
+ false
+;
+: pio-data-transfer ( adr len in? -- error? )
+ lock[ \ Interrupts off to avoid overruns
+ (pio-data-transfer)
+ ]unlock
+;
+
+[then]
+: unload ( -- )
+ begin fdc-fifo-wait dio 80 or tuck and = while fifo@ drop repeat
+;
+
+: pio-error? ( -- error? )
+ statbuf c@ h# c0 and h# 40 = if
+ statbuf 1+ c@ 80 <>
+ else
+ floppy-error?
+ then
+;
+
+patch pio-data-transfer dma-wait r/w-data
+patch noop dma-setup r/w-data
+patch pio-error? floppy-error? r/w-data
+
+device-end
+headers
+
+\ LICENSE_BEGIN
+\ Copyright (c) 1996 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
Added: dev/isafdc/fdcpkg.fth
===================================================================
--- dev/isafdc/fdcpkg.fth (rev 0)
+++ dev/isafdc/fdcpkg.fth 2008-09-30 21:18:35 UTC (rev 955)
@@ -0,0 +1,177 @@
+\ ========== Copyright Header Begin ==========================================
+\
+\ Hypervisor Software File: fdcpkg.fth
+\
+\ Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
+\
+\ - Do no alter or remove copyright notices
+\
+\ - Redistribution and use of this software in source and binary forms, with
+\ or without modification, are permitted provided that the following
+\ conditions are met:
+\
+\ - Redistribution of source code must retain the above copyright notice,
+\ this list of conditions and the following disclaimer.
+\
+\ - Redistribution in binary form must reproduce the above copyright notice,
+\ this list of conditions and the following disclaimer in the
+\ documentation and/or other materials provided with the distribution.
+\
+\ Neither the name of Sun Microsystems, Inc. or the names of contributors
+\ may be used to endorse or promote products derived from this software
+\ without specific prior written permission.
+\
+\ This software is provided "AS IS," without a warranty of any kind.
+\ ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
+\ INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
+\ PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
+\ MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
+\ ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+\ DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
+\ OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
+\ FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
+\ DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
+\ ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
+\ SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+\
+\ You acknowledge that this software is not designed, licensed or
+\ intended for use in the design, construction, operation or maintenance of
+\ any nuclear facility.
+\
+\ ========== Copyright Header End ============================================
+purpose: Floppy disk package.
+copyright: Copyright 1990 Sun Microsystems, Inc. All Rights Reserved
+
+headers
+1 encode-int " #address-cells" property
+0 encode-int " #size-cells" property
+: decode-unit ( adr len -- n ) push-hex $number if 0 then pop-base ;
+: encode-unit ( n -- adr len ) push-hex (u.) pop-base ;
+: open ( -- flag ) fdc-init true ;
+: reset ( -- ) fdc-init unmap-floppy ;
+: close ( -- ) unmap-floppy ;
+: set-address ( dev# -- ) to drive ;
+: probe ( -- )
+ 2 0 do
+ i set-address drive-present? if
+ " /fdc/disk" find-package if
+ push-package
+ \ "i" must be executed outside of package( ... )package,
+ \ which uses the return stack
+ i 0 package( encode-int " reg" property )package
+ pop-package
+ then
+ then
+ 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 * ;
+\ : block-size ( -- n ) max-transfer ;
+\ : #blocks ( -- n ) d# 80 ; \ For 1.44 MByte floppies
+: block-size ( -- n ) h# 200 ;
+: #blocks ( -- n ) d# 80 sec/cyl * ; \ For 1.44 MByte floppies
+
+new-device
+" disk" device-name
+" block" device-type
+
+headerless
+0 instance value deblocker
+: init-deblocker ( -- okay? )
+ " " " deblocker" $open-package is deblocker
+ deblocker if
+ true
+ else
+ ." Can't open deblocker package" cr false
+ then
+;
+
+0 instance value offset-low \ Offset to start of partition
+0 instance value offset-high
+
+0 instance value label-package
+
+\ Sets offset-low and offset-high, reflecting the starting location of the
+\ partition specified by the "my-args" string.
+
+: init-label-package ( -- okay? )
+ 0 is offset-high 0 is offset-low
+ my-args " disk-label" $open-package is label-package
+ label-package if
+ 0 0 " offset" label-package $call-method is offset-high is offset-low
+ true
+ else
+ ." Can't open disk label package" cr false
+ then
+;
+
+headers
+
+: dma-alloc ( size -- virt ) " dma-alloc" $call-parent ;
+: dma-free ( virt size -- ) " dma-free" $call-parent ;
+: max-transfer ( -- n ) " max-transfer" $call-parent ;
+: block-size ( -- n ) " block-size" $call-parent ;
+: #blocks ( -- n ) " #blocks" $call-parent ;
+\ : sec/cyl ( -- n ) " sec/cyl" $call-parent ;
+
+headerless
+instance variable floppy-#retries
+[ifdef] notdef
+: r/w-blocks ( adr cyl# #cyls read? -- #read )
+ >r -rot 2 pick ( #cyls adr cyl# #rem )
+ begin dup while ( #cyls adr cyl# #rem )
+ floppy-#retries off ( #cyls adr cyl# #rem )
+ begin ( #cyls adr cyl# #rem )
+ 2 pick 2 pick ( sec/cyl * ) ( #cyls adr cyl# #rem adr #blks )
+ block-size r@ " r/w-data" $call-parent ( #cyls adr cyl# #rem error? )
+ while ( #cyls adr cyl# #rem fatal? )
+ if r> drop nip nip - exit then ( #cyls adr cyl# #rem )
+
+ 1 floppy-#retries +!
+ floppy-#retries @ 8 >= if r> drop nip nip - exit then
+
+ repeat ( #cyls adr cyl# #rem )
+ rot block-size + rot 1+ rot 1- ( #cyls adr' cyl#' #rem' )
+ repeat ( #cyls adr' cyl#' 0 )
+ r> drop 3drop ( #cyls )
+;
+[else]
+: r/w-blocks ( adr blk# #blks read? -- actual# )
+ over >r >r ( adr blk# #blks r: #blks read? )
+ block-size * r> " r/w-data" $call-parent if ( r: #blks )
+ r> drop 0 ( 0 )
+ else ( r: #blks )
+ r> ( #blks )
+ then ( actual# )
+;
+[then]
+
+headers
+: read-blocks ( adr cyl# #cyls -- #read ) true r/w-blocks ;
+: write-blocks ( adr cyl# #cyls -- #written ) false r/w-blocks ;
+
+: load ( adr -- size ) " load" label-package $call-method ;
+: seek ( offset.low offset.high -- okay? )
+ offset-low offset-high d+ " seek" deblocker $call-method
+;
+: write ( adr len -- actual-len ) " write" deblocker $call-method ;
+: read ( adr len -- actual-len ) " read" deblocker $call-method ;
+
+: close ( -- ) label-package close-package deblocker close-package ;
+: open ( -- flag )
+ my-unit " set-address" $call-parent
+ " chip-okay?" $call-parent 0= if false exit then
+ " drive-okay?" $call-parent 0= if false exit then
+ " diskette-present?" $call-parent 0= if false exit then
+ init-deblocker 0= if false exit then
+ init-label-package 0= if deblocker close-package false exit then
+ true
+;
+: selftest ( -- bad? ) my-unit " test-disk" $call-parent ;
+
+finish-device
Added: dev/isafdc/isafdc.fth
===================================================================
--- dev/isafdc/isafdc.fth (rev 0)
+++ dev/isafdc/isafdc.fth 2008-09-30 21:18:35 UTC (rev 955)
@@ -0,0 +1,52 @@
+purpose: Setup for i82077 floppy chip driver
+\ See license at end of file
+
+hex
+\ Map a virtual address to the floppy device.
+
+\ " i82077" device-name \ Name of device node
+my-address my-space 8 reg
+
+headerless
+2 constant terminal-count
+0 instance value floppy-chip
+: map-floppy ( -- )
+ my-address my-space 8 " map-in" $call-parent 4 + is floppy-chip
+;
+
+: fifo@ ( -- char ) floppy-chip 1+ rb@ ;
+: fifo! ( char -- ) floppy-chip 1+ rb! ;
+: fstat@ ( -- char ) floppy-chip rb@ ;
+: fstat! ( char -- ) floppy-chip rb! ;
+: dor@ ( -- char ) floppy-chip 2- rb@ ;
+: dor! ( -- char ) floppy-chip 2- rb! ;
+: dir@ ( -- char ) floppy-chip 3 + rb@ ;
+: dir! ( -- char ) floppy-chip 3 + rb! ;
+
+headers
+: unmap-floppy ( -- ) floppy-chip 4 - 8 " map-out" $call-parent ;
+
+
+\ LICENSE_BEGIN
+\ Copyright (c) 1994 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END
Added: dev/isafdc/loadfdc.fth
===================================================================
--- dev/isafdc/loadfdc.fth (rev 0)
+++ dev/isafdc/loadfdc.fth 2008-09-30 21:18:35 UTC (rev 955)
@@ -0,0 +1,68 @@
+purpose: Load file for ISA floppy chip
+\ See license at end of file
+
+" fdc" device-name
+" fdc" device-type
+
+[ifdef] PREP
+ 6 encode-int " interrupts" property
+ 2 encode-int h# 68 encode-int encode+ " dma" property
+[else]
+ 6 encode-int 3 encode-int encode+ " interrupts" property
+ 2 encode-int \ Channel
+ 1 encode-int encode+ \ Type (1=A)
+ 8 encode-int encode+ \ Data bits
+d# 16 encode-int encode+ \ Count bits
+ 0 encode-int encode+ \ Not bus mastering
+ " dma" property
+[then]
+
+" pnpPNP,700" " compatible" string-property
+
+headerless
+defer getsec defer putsec
+
+headers
+fload ${BP}/dev/isafdc/isafdc.fth
+
+headerless
+: clear-terminal-count ( -- ) ;
+: fdc-fifo-wait ( -- stat )
+ 0 d# 300 0 do \ wait up to 3 second
+ drop fstat@ dup h# 80 and h# 80 = ?leave
+ d# 10 ms
+ loop
+;
+headers
+
+fload ${BP}/dev/isafdc/fdcdma.fth
+fload ${BP}/dev/isafdc/fdcconf.fth
+fload ${BP}/dev/isafdc/fdccntrl.fth
+fload ${BP}/dev/isafdc/fdcdata.fth
+fload ${BP}/dev/isafdc/fdc-test.fth
+fload ${BP}/dev/isafdc/fdcpkg.fth
+
+
+\ LICENSE_BEGIN
+\ Copyright (c) 1994 FirmWorks
+\
+\ Permission is hereby granted, free of charge, to any person obtaining
+\ a copy of this software and associated documentation files (the
+\ "Software"), to deal in the Software without restriction, including
+\ without limitation the rights to use, copy, modify, merge, publish,
+\ distribute, sublicense, and/or sell copies of the Software, and to
+\ permit persons to whom the Software is furnished to do so, subject to
+\ the following conditions:
+\
+\ The above copyright notice and this permission notice shall be
+\ included in all copies or substantial portions of the Software.
+\
+\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+\
+\ LICENSE_END