00001 /* 00002 * EppRulbusInterface.h - class EppRulbusInterface. 00003 * 00004 * This file is part of the Rulbus Device Class Library (RDCL). 00005 * 00006 * Copyright (C) 2003-2004, Leiden University. 00007 * 00008 * This library is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * The library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with mngdriver; if not, write to the Free Software 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 * 00022 * $Id: EppRulbusInterface.h 2 2004-10-12 11:54:15Z moene $ 00023 */ 00024 00025 #ifndef __EPPRULBUSINTERFACE_H 00026 #define __EPPRULBUSINTERFACE_H 00027 00028 #ifndef __RULBUSINTERFACE_H 00029 #include "RulbusInterface.h" 00030 #endif 00031 00032 namespace Rulbus 00033 { 00034 DECLARE_CLASS( EppRulbusInterface ); 00035 00062 class EppRulbusInterface : public TheRulbusInterface 00063 { 00064 public: // P U B L I C 00066 00067 EppRulbusInterface( Quad base = DEF_EPP_BASE, bool docheck = true ); 00068 00071 00072 Quad base() const; 00073 bool invariant () const; 00074 00077 00078 bool printOn( std::ostream& stream ) const; 00079 00080 protected: // P R O T E C T E D 00083 00084 EppRulbusInterface( EppRulbusInterfaceRef ); 00085 EppRulbusInterfaceRef operator=( EppRulbusInterfaceRef ); 00086 00090 00091 int putReg( int offset, int byte ) const; 00092 int getReg( int offset ) const; 00093 00097 00098 bool interfacePresent( int *pCode ) const; 00099 00100 int readAddress () const; 00101 int readData () const; 00102 00103 bool EppTimedOut () const; 00104 00108 00109 void writeAddress ( int addr ) const; 00110 void writeData ( int byte ) const; 00111 00112 // void setForward () const; 00113 // void setReverse () const; 00114 00115 void resetInterface () const; 00116 void initializeEpp () const; 00117 bool clearEppTimeout () const; 00118 00120 00121 public: // P U B L I C 00122 static const Quad DEF_EPP_BASE = 0x0378; 00123 00124 private: // P R I V A T E 00125 Quad theBase; 00126 00129 00130 static const int OFF_SPP_DATA = 0; 00131 static const int OFF_SPP_STAT = 1; 00132 static const int OFF_SPP_CTRL = 2; 00133 static const int OFF_EPP_ADDR = 3; 00134 static const int OFF_EPP_DATA = 4; 00135 00139 00140 static const int MSK_EPP_Timeout = 0x01; 00141 static const int MSK_SPP_Reserved2 = 0x02; 00142 static const int MSK_SPP_nIRQ = 0x04; 00143 static const int MSK_SPP_nError = 0x08; 00144 static const int MSK_SPP_SelectIn = 0x10; 00145 static const int MSK_SPP_PaperOut = 0x20; 00146 static const int MSK_SPP_nAck = 0x40; 00147 static const int MSK_SPP_nBusy = 0x80; 00148 00152 00153 static const int MSK_SPP_Strobe = 0x01; 00154 static const int MSK_SPP_AutoLF = 0x02; 00155 static const int MSK_SPP_nReset = 0x04; 00156 static const int MSK_SPP_SelectPrinter= 0x08; 00157 static const int MSK_SPP_EnaIRQVAL = 0x10; 00158 static const int MSK_SPP_EnaBiDirect = 0x20; 00159 static const int MSK_SPP_Unused1 = 0x40; 00160 static const int MSK_SPP_Unused2 = 0x80; 00161 00163 00164 static CharCptr msgtitle; 00165 }; 00166 00171 inline Quad EppRulbusInterface::base() const 00172 { 00173 return theBase; 00174 } 00175 00180 inline bool EppRulbusInterface::invariant() const 00181 { 00182 return BASE_INVARIANT( TheRulbusInterface ); 00183 } 00184 00185 } // namespace Rulbus 00186 00187 #endif // __EPPRULBUSINTERFACE_H 00188 00189 /* 00190 * end of file 00191 */