rb8513_timebase.h

00001 /*
00002  * rb8513_timebase.h - programmable timebase (RB8513).
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: rb8513_timebase.h 2 2004-10-12 11:54:15Z moene $
00023  */
00024 
00025 #ifndef __RB8513_TIMEBASE_H
00026 #define __RB8513_TIMEBASE_H
00027 
00028 #ifndef __RULBUSDEVICE_H
00029 #include "RulbusDevice.h"       // for class RulbusDevice
00030 #endif
00031 
00032 namespace Rulbus
00033 {
00034    DECLARE_CLASS( RB8513_timebase );  //
00035 
00036    /* *
00037     * \example name.cpp
00038     * This is an example that shows ... .
00039     */
00040 
00166    class RB8513_timebase : public RulbusDevice
00167    {
00168    public:                              // public methods
00169       typedef Int Value;                
00170 
00173 
00174       RB8513_timebase( NameCref name, Addr addr = DEF_ADDR, Rack rack = DEF_RACK );
00175 
00176       ~RB8513_timebase();
00177 
00181 
00182       Time  intervalTime() const;
00183 
00184       Value clockRateMultiplier() const;
00185       Value clockRateSelector  () const;
00186 
00187 
00191 
00192       void stop();
00193 
00194       void setIntervalTime        ( Time  aTime      );
00195 
00196       void setClockRateMultiplier ( Value aValue     );
00197       void setClockRateSelector   ( Value aValue     );
00198 
00200 
00201    protected:                                   // protected methods
00204 
00205       RB8513_timebase();                                        
00206       RB8513_timebase( RB8513_timebaseCref rhs );               
00207       RB8513_timebaseRef operator= ( RB8513_timebaseCref rhs ); 
00208 
00210 
00211    public:                                      // public data
00214 
00215       static const Addr DEF_ADDR   = 0xB0;      
00216 
00217       static const int  DEF_MUL    = 1;         
00218       static const int  DEF_SEL    = 4;         
00219 
00223 
00224       static const int  LIM_MULMIN =  0;        
00225       static const int  LIM_MULMAX = 99;        
00226 
00227       static const int  LIM_SELMIN =  0;        
00228       static const int  LIM_SELMAX =  6;        
00229       static const int  LIM_SELMAXFIXED = 3;    
00230 
00232 
00233    private:                                     // private data
00236 
00237       Value theMutiplyReg;                      
00238       Value theSelectorReg;                     
00239 
00243 
00244       static const int OFF_MUL     = 0;         
00245       static const int OFF_SEL     = 1;         
00246       static const int ADR_WIDTH   = OFF_SEL + 1; 
00247 
00251 
00252       static const int MSK_SELSTP  = 0x10;      
00253 
00257 
00258       static const Time  timeList[];            
00259       static const Value selectorList[];        
00260 
00262    };
00263 
00265 
00270    inline RB8513_timebase::Value RB8513_timebase::clockRateMultiplier() const
00271    {
00272       return theMutiplyReg;
00273    }
00274 
00280    inline RB8513_timebase::Value RB8513_timebase::clockRateSelector() const
00281    {
00282       return theSelectorReg;
00283    }
00284 
00289    inline RB8513_timebaseRef to_rb8513( RulbusDevicePtr p )
00290    {
00291       return PROXY_CAST<RB8513_timebaseRef>( *p );
00292    }
00293 
00298    inline RB8513_timebasePtr to_rb8513_ptr( RulbusDevicePtr p )
00299    {
00300       return PROXY_CAST<RB8513_timebasePtr>( p );
00301    }
00302 
00303 } // namespace Rulbus
00304 
00305 #endif  // __RB8513_TIMEBASE_H
00306 
00307 /*
00308  * end of file
00309  */
00310 

Generated on Tue Oct 12 14:11:58 2004 for Rulbus Device Class Library for Microsoft Windows by doxygen 1.3.4