Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

Floppy Class Reference

This is the floppy disk driver. More...

#include <floppy.h>

Inherits Block_device.

Inheritance diagram for Floppy:

Inheritance graph
[legend]
Collaboration diagram for Floppy:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual void init ()
virtual 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 ()
virtual bool read_block (unsigned block, void *data)
virtual bool write_block (unsigned block, void *data)
bool read_write (unsigned block, void *data, bool read)
void print ()

Public Attributes

Semaphore operation_lock
Timer_callback motor_kill_callback
bool motor_on

Protected Attributes

DMA_buffer buffer
bool disk_change
unsigned char status [7]
unsigned char status_size
unsigned char sr0
unsigned char current_track
Int_handler handler

Static Protected Attributes

const Size BLOCK_SIZE = 512

Detailed Description

This is the floppy disk driver.

Much of it is based on code by Fabian Nunez.


Member Function Documentation

void Floppy::deinit  )  [virtual]
 

Deinitialize the floppy driver.

Implements Block_device.

short int Floppy::get_byte  ) 
 

Receive a byte from the floppy disk controller. Return -1 on timeout.

void Floppy::init  )  [virtual]
 

Initialize the floppy driver and reset the drive.

Implements Block_device.

void Floppy::print  ) 
 

Print basic information on the floppy driver.

bool Floppy::read_block unsigned  block,
void *  data
[virtual]
 

Read a block of data from disk into the provided 512-byte buffer.

Implements Block_device.

bool Floppy::read_write unsigned  block,
void *  data,
bool  read
 

Since reads and writes differ only by a few lines, this function handles both.

It is called by read_block() and write_block().

void Floppy::recalibrate  ) 
 

Recalibrate the drive.

void Floppy::reset  ) 
 

Reset the floppy drive to a known state.

bool Floppy::seek unsigned char  track  ) 
 

Seek to the given track.

void Floppy::send_byte unsigned short int  byte  ) 
 

Send a byte to the floppy disk controller.

void Floppy::turn_motor_off  ) 
 

Start drive motor kill countdown.

void Floppy::turn_motor_on  ) 
 

Turn drive motor on.

bool Floppy::wait_for_op bool  sense_interrupt_status  ) 
 

Wait for a floppy controller operation to complete.

Return false on timeout, true if operation completed.

bool Floppy::write_block unsigned  block,
void *  data
[virtual]
 

Write a block of data to disk from the provided 512-byte buffer.

Implements Block_device.


Member Data Documentation

const Size Floppy::BLOCK_SIZE = 512 [static, protected]
 

DMA_buffer Floppy::buffer [protected]
 

floppy read/write data buffer

unsigned char Floppy::current_track [protected]
 

current track position

bool Floppy::disk_change [protected]
 

Int_handler Floppy::handler [protected]
 

floppy interrupt handler

Timer_callback Floppy::motor_kill_callback
 

timer callback for stopping motor

bool Floppy::motor_on
 

whether the motor is on

Semaphore Floppy::operation_lock
 

locked while operation happening

unsigned char Floppy::sr0 [protected]
 

unsigned char Floppy::status[7] [protected]
 

unsigned char Floppy::status_size [protected]
 


The documentation for this class was generated from the following files:

Torsion Operating System, Copyright (C) 2000-2004 Dan Helfman