fdc.h

00001 /***************************************************************************
00002  *   Copyright (C) 2005 by Fred Klaus                                      *
00003  *   frednet@web.de                                                        *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef FDC_H
00021 #define FDC_H
00022 
00023 #include "fdcconst.h"
00024 #include "types.h"
00025 #include "drive.h"
00026 #include "cmdtable.h"
00027 
00028 #include <cstdio>
00029 
00030 
00032 class Fdc
00033 {
00034 
00035 public:
00036         Fdc();
00037         ~Fdc() {}
00038 
00039         typedef void (Fdc::*CmdHandler)(void);
00040 
00041         void  write_data(UBYTE val);
00042         UBYTE read_status();
00043         UBYTE read_data();
00044         void  specify();
00045         void  drvstat();
00046         void  recalib();
00047         void  intstat();
00048         void  seek();
00049         void  readtrk();
00050         void  write();
00051         void  read();
00052         void  readID();
00053         void  writeID();
00054         void  scan();
00055 
00056         void check_unit();
00057         int  init_status_regs();
00058         Sector* find_sector(UBYTE *requested_CHRN);
00059         inline void cmd_write();
00060         inline void cmd_read();
00061         inline void cmd_readtrk();
00062         inline void cmd_scan();
00063 
00064         int  dsk_load(const char *pchFileName, int drv, char chID='A');
00065         void dsk_eject(int drv);
00066 
00067         //void scanlo();
00068         //void scanhi();
00069 
00070         int motor()              {return mMotor;}
00071         void setMotor(int s)     {mMotor=s;}
00072         int flags()              {return mFlags;}
00073         void addFlags(int flags) {mFlags |= flags;}
00074         int phase()              {return mPhase;}
00075         int  timeout()           {return mTimeout;}
00076         void setTimeout(int val) {mTimeout=val;}
00077 
00078         int cmdDirection() {return mCmdDirection;}
00079 
00080         bool led()               {return mLed;}
00081 
00082 private:
00083         int  mTimeout;
00084         int  mMotor;
00085         bool mLed;
00086         int  mFlags;
00087         int  mPhase;
00088         int  mByteCount;
00089         int  mBufferCount;
00090         int  mCmdLength;
00091         int  mResLength;
00092         int  mCmdDirection;
00093         CmdHandler mCmdHandler;
00094         //void (Fdc::*mCmdHandler)(void);
00095 
00096         UBYTE* pbGPBuffer;
00097 
00098         UBYTE* mBufferPtr;
00099         UBYTE* mBufferEndPtr;
00100         UBYTE  mCommand[12];
00101         UBYTE  mResult[8];
00102 
00103         Drive mDriveA;
00104         Drive mDriveB;
00105 
00106         Drive *mActiveDrive; // reference to the currently selected drive
00107         Track *mActiveTrack; // reference to the currently selected track, of the active_drive
00108         UWORD mReadStatusDelay;
00109         UWORD mBytesTransferred;
00110 
00111         CmdTable mCmdTable;
00112 
00113         FILE *pfileObject;
00114 
00115 };
00116 
00117 #endif
00118 
00119 

Generated on Fri Mar 16 21:30:28 2007 for roland.kdevelop by  doxygen 1.5.0