From: <ro...@us...> - 2009-04-13 14:00:25
|
Revision: 2127 http://nscldaq.svn.sourceforge.net/nscldaq/?rev=2127&view=rev Author: ron-fox Date: 2009-04-13 14:00:15 +0000 (Mon, 13 Apr 2009) Log Message: ----------- Good compiles on the new busy and remove clears from the trigger so they can cooperate. Modified Paths: -------------- trunk/nextgen/sbs/readout/CV977Trigger.cpp trunk/nextgen/sbs/readout/Makefile.am Added Paths: ----------- trunk/nextgen/sbs/readout/CV977Busy.cpp trunk/nextgen/sbs/readout/CV977Busy.h Added: trunk/nextgen/sbs/readout/CV977Busy.cpp =================================================================== --- trunk/nextgen/sbs/readout/CV977Busy.cpp (rev 0) +++ trunk/nextgen/sbs/readout/CV977Busy.cpp 2009-04-13 14:00:15 UTC (rev 2127) @@ -0,0 +1,84 @@ +/* + This software is Copyright by the Board of Trustees of Michigan + State University (c) Copyright 2005. + + You may use this software under the terms of the GNU public license + (GPL). The terms of this license are described at: + + http://www.gnu.org/licenses/gpl.txt + + Author: + Ron Fox + NSCL + Michigan State University + East Lansing, MI 48824-1321 +*/ +#include <config.h> +#include "CV977Busy.h" +#include <CCAENV977.h> + + +/*! + Construction from scratch: + @param base - Base address of the V977 module + @param crate - Optional AVME crate moduel is in. Defaults to 0. + +*/ +CV977Busy::CV977Busy(uint32_t base, unsigned crate) : + m_busy(*(new CCAENV977(base, crate))) +{ + initialize(); +} +/*! + Construction from an existing CCAENV977 module. Still initialize: + @param module - Existing module. +*/ +CV977Busy::CV977Busy(CCAENV977& module) : + m_busy(module) +{ + initialize(); +} + +/*! + Copy construction. In this case no initialization is done as the underlying + module is already initialized + @param rhs - Object we are cloning. +*/ +CV977Busy::CV977Busy(const CV977Busy& rhs) : + m_busy(rhs.m_busy) +{} + + +/*! + Go busy by setting bit 1: +*/ +void +CV977Busy::GoBusy() +{ + m_busy.outputSet(1); +} +/*! + Go clear by clearing the output register: +*/ + +void +CV977Busy::GoClear() +{ + m_busy.outputSet(2); + m_busy.outputSet(0); + m_busy.outputClear(); + +} + +/* +** Initialize a module for use. +*/ +void +CV977Busy::initialize() +{ + m_busy.Reset(); + m_busy.controlRegister(0); + m_busy.inputMask(0); + m_busy.outputMask(0xfffe); // Compatible with trigger class. + m_busy.outputClear(); +} Added: trunk/nextgen/sbs/readout/CV977Busy.h =================================================================== --- trunk/nextgen/sbs/readout/CV977Busy.h (rev 0) +++ trunk/nextgen/sbs/readout/CV977Busy.h 2009-04-13 14:00:15 UTC (rev 2127) @@ -0,0 +1,72 @@ +/* + This software is Copyright by the Board of Trustees of Michigan + State University (c) Copyright 2005. + + You may use this software under the terms of the GNU public license + (GPL). The terms of this license are described at: + + http://www.gnu.org/licenses/gpl.txt + + Author: + Ron Fox + NSCL + Michigan State University + East Lansing, MI 48824-1321 +*/ + +#ifndef __CV977BUSY_H +#define __CV977BUSY_H + +#ifndef __CBUSY_H +#include "CBusy.h" +#endif + +#ifndef __CRT_STDINT_H +#include <stdint.h> +#ifndef __CRT_STDINT_H +#define __CRT_STDINT_H +#endif +#endif + +class CCAENV977; + + +/*! + Concrete busy class that mangest he CAEN V977 as a busy module. + The assumption is that the busy is the OR of all output bits...set by any input bit. + (this dovetails nicely with CV977Trigger). Our go clear will clear all bits in + in the output register. At construction time we'll set the module up the + same way CV977Trigger is setup. +*/ +class CV977Busy : public CBusy +{ +private: + CCAENV977& m_busy; + +public: + // We can construct from base/crate a module object and do copy construction. + + CV977Busy(uint32_t base, unsigned crate=0); + CV977Busy(CCAENV977& module); + CV977Busy(const CV977Busy& rhs); + + + // The following are not implemented: +private: + CV977Busy& operator=(const CV977Busy& rhs); // can't dup stuff with references. + int operator==(const CV977Busy& rhs) const; // comparison is senseless. + int operator!=(const CV977Busy& rhs) const; + +public: + // THe busy interface: + + virtual void GoBusy(); + virtual void GoClear(); + +private: + void initialize(); + +}; + + +#endif Modified: trunk/nextgen/sbs/readout/CV977Trigger.cpp =================================================================== --- trunk/nextgen/sbs/readout/CV977Trigger.cpp 2009-04-12 14:12:51 UTC (rev 2126) +++ trunk/nextgen/sbs/readout/CV977Trigger.cpp 2009-04-13 14:00:15 UTC (rev 2127) @@ -92,23 +92,15 @@ } /*! Check for the trigger.. If the trigger fires; - clear the bottom bit of the output register and return true, + return true, else return false. - \note - there is a race condition possible if other software uses - the output register of this module in a manner that is not - synchronized to the trigger; Specifically clearing a bit in the - output register is a read followed by a write.. if the output register - is modified between those operations, the modifications will be lsot. + */ bool CV977Trigger::operator()() { bool triggered = (m_pModule->singleHitRead() & 1) != 0; - if (triggered) { - UShort_t outputs = m_pModule->outputSet(); /// Race... - outputs &= 0xfffe; /// Condition - m_pModule->outputSet(outputs); /// Potential. - } + return triggered; } Modified: trunk/nextgen/sbs/readout/Makefile.am =================================================================== --- trunk/nextgen/sbs/readout/Makefile.am 2009-04-12 14:12:51 UTC (rev 2126) +++ trunk/nextgen/sbs/readout/Makefile.am 2009-04-13 14:00:15 UTC (rev 2127) @@ -35,7 +35,8 @@ CDocumentedVars.cpp \ CVariableBuffers.cpp \ CBusy.cpp \ - CCAENV262Busy.cpp + CCAENV262Busy.cpp \ + CV977Busy.cpp noinst_HEADERS = CReadoutMain.h Skeleton.h CTCLAuthorizer.h \ @@ -49,7 +50,7 @@ CEndCommand.h CDocumentedPacket.h CDocumentedPacketManager.h \ CReadoutException.h CInvalidPacketStateException.h \ CEventPacket.h CVarList.h CDocumentedVars.h CVariableBuffers.h \ - CBusy.h CCAENV262Busy.cpp + CBusy.h CCAENV262Busy.h CV977Busy.h This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |