#include <floppy.h>
Collaboration diagram for Floppy:

Public Methods | |
| void | init () |
| void | update_timers () |
| void | deinit () |
| void | reset () |
| void | send_byte (unsigned short int byte) |
| short int | get_byte () |
| bool | wait_for_op (bool sense_interrupt_status) |
| bool | seek (unsigned char track) |
| void | recalibrate () |
| void | turn_motor_on () |
| void | turn_motor_off () |
| bool | read_block (unsigned int block, void *data) |
| bool | write_block (unsigned int block, void *data) |
| bool | read_write (unsigned int block, void *data, bool read) |
| void | implement (Block_device &disk) |
Public Attributes | |
| volatile bool | operation_done |
Protected Attributes | |
| DMA_buffer | buffer |
| volatile unsigned int | timeout_counter |
| bool | motor_on |
| int | motor_counter |
| bool | disk_change |
| unsigned char | status [7] |
| unsigned char | status_size |
| unsigned char | sr0 |
| unsigned char | current_track |
Static Protected Attributes | |
| const unsigned int | BLOCK_SIZE = 512 |
Much of it is based on code by Fabian Nunez.
|
|
Deinitialize the floppy driver.
|
|
|
Receive a byte from the floppy disk controller. Return -1 on timeout.
|
|
|
Serve as the implementation driver for the given abstract block device.
|
|
|
Initialize the floppy driver and reset the drive.
|
|
||||||||||||
|
Read a block of data from disk into the provided 512-byte buffer.
|
|
||||||||||||||||
|
Since reads and writes differ only by a few lines, this function handles both. It is called by read_block() and write_block().
|
|
|
Recalibrate the drive.
|
|
|
Reset the floppy drive to a known state.
|
|
|
Seek to the given track.
|
|
|
Send a byte to the floppy disk controller.
|
|
|
Start drive motor kill countdown.
|
|
|
Turn drive motor on.
|
|
|
Increment one tick of the timers.
|
|
|
Wait for a floppy controller operation to complete. Return false on timeout, true if operation completed.
|
|
||||||||||||
|
Write a block of data to disk from the provided 512-byte buffer.
|
|
|
|
|
|
floppy read/write data buffer.
|
|
|
current track position.
|
|
|
|
|
|
motor kill countdown.
|
|
|
whether the motor is on.
|
|
|
whether last operation is complete.
|
|
|
|
|
|
|
|
|
|
|
|
timeout countdown.
|
Torsion Operating System, Copyright (C) 2000-2002 Dan Helfman