diff -urNb tridas.orig/daq/evbdm/include/BM.h tridas/daq/evbdm/include/BM.h --- tridas.orig/daq/evbdm/include/BM.h Mon Oct 28 09:04:51 2002 +++ tridas/daq/evbdm/include/BM.h Mon Nov 11 16:17:15 2002 @@ -110,7 +110,7 @@ BSem * mutex_; BSem * alloc_; - unsigned long triggerDisable_; + unsigned long rmDisable_; unsigned long noEIDs_; EventIdentifier * eida_; diff -urNb tridas.orig/daq/evbdm/include/BU.h tridas/daq/evbdm/include/BU.h --- tridas.orig/daq/evbdm/include/BU.h Mon Oct 28 09:04:51 2002 +++ tridas/daq/evbdm/include/BU.h Mon Nov 11 16:17:15 2002 @@ -144,7 +144,9 @@ I2O_TRANSACTION_CONTEXT context; U32 instance = bum_->retrieve(i2odecodel(rumh->rid), (I2O_V2_SGE_FRAGMENT_ELEMENT_U32*)sglRef->buf_, &wc, &context); - XDAQ_DEBUG(("- Event building completed on BU: %d total wc: %d",instance_,wc)) + if (eventsCounter_ % samples_ == 0) { + XDAQ_NOTE(("- Event building completed on BU: %d evt: %d wc: %d", instance_, eventsCounter_, wc)) + } eventsCounter_++; diff -urNb tridas.orig/daq/evbdm/include/RM.h tridas/daq/evbdm/include/RM.h --- tridas.orig/daq/evbdm/include/RM.h Mon Oct 28 09:04:51 2002 +++ tridas/daq/evbdm/include/RM.h Mon Nov 11 16:17:15 2002 @@ -4,17 +4,12 @@ #include "xdaq.h" #include "vxSys.h" #include "i2oRMAdapter.h" -#include "i2oEVMParam.h" #include "FLT.h" #include "BSem.h" #include "TriggerListener.h" - -#include "soapUserTriggerListener.h" - class RM: public xdaqApplication, public i2oRMAdapter, - public soapUserTriggerListener, public TriggerListener { @@ -58,7 +53,6 @@ void SystemConfigure(); - //Invoked by BM void readyToRead(EventIdentifier* eid); @@ -66,6 +60,7 @@ void trigger(TriggerInfo info); void spillOn(TriggerInfo info) {} void spillOff(TriggerInfo info) {} + private: // ID Queue inline int idnotempty() @@ -93,11 +88,13 @@ unsigned long counterLost_; rlist identifiersq_; FLTInterface * flt_; - unsigned long builderDisable_; unsigned long enable_; BSem * mutex_; BOOL pending_; unsigned long noEIDs_; + unsigned long gtpDisable_; + unsigned long rcnDisable_; + unsigned long useFRBRCN_; }; #endif diff -urNb tridas.orig/daq/evbdm/include/RUI.h tridas/daq/evbdm/include/RUI.h --- tridas.orig/daq/evbdm/include/RUI.h Mon Oct 28 09:04:52 2002 +++ tridas/daq/evbdm/include/RUI.h Mon Nov 11 16:17:15 2002 @@ -13,10 +13,8 @@ class RUI: public xdaqApplication, public i2oRUIAdapter, public soapUserReadoutListener - { - - public: - +{ +public: RUI(RUM * rum); void Enable() throw (xdaqException); @@ -33,9 +31,9 @@ void dummy_readout_and_remove(EventIdentifier* eid) ; - void readout_and_remove (EventIdentifier* eid) ; + void readout_and_remove(EventIdentifier *eid, TriggerIdentifier *trig); - protected: +protected: unsigned long counter_; RUM *rum_; @@ -43,8 +41,6 @@ unsigned long dataSize_; unsigned long blockSize_; unsigned long noEIDs_; - - }; #endif diff -urNb tridas.orig/daq/evbdm/include/i2oEVMParam.h tridas/daq/evbdm/include/i2oEVMParam.h --- tridas.orig/daq/evbdm/include/i2oEVMParam.h Mon Oct 28 09:04:53 2002 +++ tridas/daq/evbdm/include/i2oEVMParam.h Wed Dec 31 18:00:00 1969 @@ -1,76 +0,0 @@ -#ifndef _i2oEVMParam_h_ -#define _i2oEVMParam_h_ - -//---------------------------------------------------------------------------- -// RM Parameter Groups -//---------------------------------------------------------------------------- - -// RM Configuration and Operating Structures and Defines - -// RM Groups - -#define I2O_RM_GROUP_NO_RM_INFO 0x8a00 -#define I2O_RM_GROUP_NO_STATISTICS 0x8a01 - - -// - 8a00h - RM Information Parameters defines - -typedef enum { - FieldIdx_DI_RM_NoEIDs = 0, - FieldIdx_DI_RM_builderDisable = 1 -} I2O_RM_DEVICE_INFO_FIELDIDX; - - -typedef struct _I2O_RM_DEVICE_INFO_SCALAR { - U32 NoEIDs; - U32 builderDisable; -} I2O_RM_DEVICE_INFO_SCALAR, *PI2O_RM_DEVICE_INFO_SCALAR; - - -// - 8a01h - RM Statistics Parameters defines - -typedef enum { - FieldIdx_ST_TBD = 0 -} I2O_RM_DEVICE_STATISTICS_FIELDIDX; - -typedef struct _I2O_RM_DEVICE_STATISTICS_SCALAR { - U32 tbd; -} I2O_RM_DEVICE_STATISTICS_SCALAR, *PI2O_RM_DEVICE_STATISTICS_SCALAR; - - -//---------------------------------------------------------------------------- -// BM Parameter Groups -//---------------------------------------------------------------------------- - -// BM Configuration and Operating Structures and Defines - -// BM Groups - -#define I2O_BM_GROUP_NO_BM_INFO 0x8b00 -#define I2O_BM_GROUP_NO_STATISTICS 0x8b01 - -// - 8b00h - RM Information Parameters defines - -typedef enum { - FieldIdx_DI_BM_NoEIDs = 0, - FieldIdx_DI_BM_triggerDisable = 1 -} I2O_BM_DEVICE_INFO_FIELDIDX; - -typedef struct _I2O_BM_DEVICE_INFO_SCALAR { - U32 NoEIDs; - U32 triggerDisable; -} I2O_BM_DEVICE_INFO_SCALAR, *PI2O_BM_DEVICE_INFO_SCALAR; - - -// - 8b01h - RM Statistics Parameters defines - -typedef enum { - FieldIdx_ST_BM_TBD = 0 -} I2O_BM_DEVICE_STATISTICS_FIELDIDX; - -typedef struct _I2O_BM_DEVICE_STATISTICS_SCALAR { - U32 tbd; -} I2O_BM_DEVICE_STATISTICS_SCALAR, *PI2O_BM_DEVICE_STATISTICS_SCALAR; - - -#endif diff -urNb tridas.orig/daq/evbdm/include/i2oRUIAdapter.h tridas/daq/evbdm/include/i2oRUIAdapter.h --- tridas.orig/daq/evbdm/include/i2oRUIAdapter.h Mon Oct 28 09:04:54 2002 +++ tridas/daq/evbdm/include/i2oRUIAdapter.h Mon Nov 11 16:17:15 2002 @@ -26,19 +26,16 @@ } void rqstReadout(BufRef * ref) { - PI2O_RUI_READOUT_MESSAGE_FRAME frame = (PI2O_RUI_READOUT_MESSAGE_FRAME )ref->data(); - this->readout_and_remove(((EventIdentifier)(frame->info[0].eventId)), - ((TriggerIdentifier)(frame->info[0].triggerId)) ); - + PI2O_RUI_READOUT_MESSAGE_FRAME frame = + (PI2O_RUI_READOUT_MESSAGE_FRAME)ref->data(); + this->readout_and_remove( + (EventIdentifier *)&(frame->info[0].eventId), + (TriggerIdentifier *)&(frame->info[0].triggerId)); xdaq::frameFree(ref); } - virtual void readout_and_remove (EventIdentifier eid, TriggerIdentifier trigger) - { - XDAQ_ERROR (("not implemented: readout_and_remove")) - } - + virtual void readout_and_remove(EventIdentifier *eid, TriggerIdentifier *trigger) = 0; virtual DOM_Node DdmAdapterAttach (DOM_Node soapMsg) {DOM_Node reply; return reply;} virtual DOM_Node DdmAdapterReconfig (DOM_Node soapMsg){DOM_Node reply; return reply;} diff -urNb tridas.orig/daq/evbdm/include/i2oRUIInterface.h tridas/daq/evbdm/include/i2oRUIInterface.h --- tridas.orig/daq/evbdm/include/i2oRUIInterface.h Mon Oct 28 09:04:54 2002 +++ tridas/daq/evbdm/include/i2oRUIInterface.h Mon Nov 11 16:17:15 2002 @@ -9,15 +9,13 @@ class i2oRUIInterface : public virtual i2oInterface { - public: - - +public: // // Called by EVM to request a readout for an event. // If the event exists the command override the existing // event with the new one requested // - virtual void readout_and_remove (EventIdentifier eid, TriggerIdentifier trigger) = 0; + virtual void readout_and_remove(EventIdentifier *eid, TriggerIdentifier *trigger) = 0; }; diff -urNb tridas.orig/daq/evbdm/include/i2oRUIProxy.h tridas/daq/evbdm/include/i2oRUIProxy.h --- tridas.orig/daq/evbdm/include/i2oRUIProxy.h Mon Oct 28 09:04:54 2002 +++ tridas/daq/evbdm/include/i2oRUIProxy.h Mon Nov 11 16:17:15 2002 @@ -8,8 +8,7 @@ class i2oRUIProxy : public i2oProxy, public i2oRUIInterface { - public: - +public: i2oRUIProxy (I2O_TID source, I2O_TID destination ) { destination_ = destination; @@ -21,8 +20,8 @@ { } - public: - void readout_and_remove (EventIdentifier eid, TriggerIdentifier trigger) { + void readout_and_remove(EventIdentifier *eid, TriggerIdentifier *trigger) + { BufRef *ref = xdaq::frameAlloc(sizeof(I2O_RUI_READOUT_MESSAGE_FRAME)); PI2O_RUI_READOUT_MESSAGE_FRAME frame = (PI2O_RUI_READOUT_MESSAGE_FRAME )ref->data(); @@ -39,14 +38,40 @@ frame->nbEventIds = 1; frame->mode = 0; - frame->info[0].eventId = (U32) eid; - frame->info[0].triggerId = (U32) trigger; + frame->info[0].eventId = (U32)*eid; + frame->info[0].triggerId = (U32)*trigger; frame->PvtMessageFrame.StdMessageFrame.MessageSize = sizeof(I2O_RUI_READOUT_MESSAGE_FRAME) >> 2; xdaq::frameSend(ref); + } + void readout_and_remove_multicast( + EventIdentifier *eid, TriggerIdentifier *trigger) + { + BufRef *ref = xdaq::frameAlloc(sizeof(I2O_RUI_READOUT_MESSAGE_FRAME)); + PI2O_RUI_READOUT_MESSAGE_FRAME frame = (PI2O_RUI_READOUT_MESSAGE_FRAME )ref->data(); + // + // Standard contents + // + frame->PvtMessageFrame.StdMessageFrame.Function = I2O_PRIVATE_MESSAGE; + frame->PvtMessageFrame.XFunctionCode = I2O_RUI_READOUT; + frame->PvtMessageFrame.OrganizationID = XDAQ_ORGANIZATION_ID; // function group offset + frame->PvtMessageFrame.StdMessageFrame.VersionOffset = 0; + frame->PvtMessageFrame.StdMessageFrame.MsgFlags = XDAQ_MULTICAST; + frame->PvtMessageFrame.StdMessageFrame.TargetAddress = + executive->getClassIdByName("RUI"); + frame->PvtMessageFrame.StdMessageFrame.InitiatorAddress = source_; + + frame->nbEventIds = 1; + frame->mode = 0; + frame->info[0].eventId = (U32)*eid; + frame->info[0].triggerId = (U32)*trigger; + + frame->PvtMessageFrame.StdMessageFrame.MessageSize = sizeof(I2O_RUI_READOUT_MESSAGE_FRAME) >> 2; + xdaq::frameSend(ref); } + }; diff -urNb tridas.orig/daq/evbdm/src/common/BM.cc tridas/daq/evbdm/src/common/BM.cc --- tridas.orig/daq/evbdm/src/common/BM.cc Mon Oct 28 09:05:00 2002 +++ tridas/daq/evbdm/src/common/BM.cc Mon Nov 11 16:17:15 2002 @@ -3,26 +3,25 @@ BM::BM() { state(Halted); - triggerDisable_ = 0; + rmDisable_ = 0; noEIDs_ = 0; eida_ = 0; mutex_ = new BSem(BSem::FULL); alloc_ = new BSem(BSem::FULL); - exportParam("triggerDisable",triggerDisable_); - exportParam("noEIDs",noEIDs_); + exportParam("rmDisable", rmDisable_); + exportParam("noEIDs", noEIDs_); } void BM::Configure() throw (xdaqException) { - XDAQ_NOTE(("BM instance %d parameter list",instance_)); - XDAQ_NOTE(("triggerDisable: %d",triggerDisable_)); - XDAQ_NOTE(("noEIDs: %d",noEIDs_)); + XDAQ_NOTE(("BM instance %d parameter list", instance_)); + XDAQ_NOTE(("rmDisable: %d", rmDisable_)); + XDAQ_NOTE(("noEIDs: %d", noEIDs_)); this->SystemConfigure(); - } void BM::Enable() throw (xdaqException) @@ -68,7 +67,7 @@ XDAQ_DEBUG(("EVM Clearing %d events", neids)); // DISABLE TRIGGER idput(*eid); - if ( triggerDisable_ ) { + if (rmDisable_) { for (int i =0; i < neids; i++) { triggerput(eid[i]); //recycle ID //cout << "cleared: " << eid[i] << endl; @@ -100,12 +99,10 @@ // previous runs. // Empty trigger queue - if (triggerDisable_ ) { + if (rmDisable_) { while (triggernotempty()) { triggerget(); } - } else { - // nothing, RM takes care of resetting triggers } // Clear urgent queue @@ -113,8 +110,8 @@ urgentpop(); } - if ( triggerDisable_ ) { - for ( int i =0; i< noEIDs_; i++ ) + if (rmDisable_) { + for (int i =0; i< noEIDs_; i++) triggerput(i); //No trigger } @@ -127,28 +124,27 @@ inline void BM::commit() { // Commit must be serialized (thread safe) alloc_->take(); - XDAQ_DEBUG(("")); - //cout << "commit: " << endl; - if ( urgentnotempty() ) { // requests pending + XDAQ_DEBUG(("alloc_->take")); + + if (urgentnotempty()) { // requests pending UrgentRequest r = urgentfront(); - if ( triggernum() >= r.neids ) { + if (triggernum() >= r.neids) { - XDAQ_DEBUG(("")); + XDAQ_DEBUG(("%d triggers ready", triggernum())); for ( int i = 0 ; i < r.neids; i ++ ) { eida_[i] = triggerget(); - //cout << "confirm: " << eida_[i] << endl; } - XDAQ_DEBUG(("")); + XDAQ_DEBUG(("bu->confirm")); bu_[r.dest]->confirm(eida_,r.neids); urgentpop(); - } } alloc_->give(); - } + +// End of file diff -urNb tridas.orig/daq/evbdm/src/common/FLT.cc tridas/daq/evbdm/src/common/FLT.cc --- tridas.orig/daq/evbdm/src/common/FLT.cc Mon Oct 28 09:05:00 2002 +++ tridas/daq/evbdm/src/common/FLT.cc Mon Nov 11 16:17:15 2002 @@ -8,7 +8,7 @@ FLT::FLT() { - timer_.setDelay(5); + timer_.setDelay(100); timer_.addListener(this); } diff -urNb tridas.orig/daq/evbdm/src/common/RM.cc tridas/daq/evbdm/src/common/RM.cc --- tridas.orig/daq/evbdm/src/common/RM.cc Mon Oct 28 09:05:00 2002 +++ tridas/daq/evbdm/src/common/RM.cc Mon Nov 11 16:17:15 2002 @@ -1,11 +1,7 @@ - #include "RM.h" - - -RM::RM( FLTInterface *flt ) +RM::RM(FLTInterface *flt) { - builderDisable_ = 0; flt_ = flt; //interface to Trigger generator pending_ = FALSE; @@ -13,26 +9,40 @@ counterTrigger_ = 0; counterLost_ = 0; noEIDs_ = 1024; + gtpDisable_ = 0; + rcnDisable_ = 0; + useFRBRCN_ = 0; mutex_ = new BSem(BSem::FULL); - exportParam("builderDisable",builderDisable_); - exportParam("noEIDs",noEIDs_); - - flt_->addListener(this); - + exportParam("noEIDs", noEIDs_); + exportParam("gtpDisable", gtpDisable_); + exportParam("rcnDisable", rcnDisable_); + exportParam("useFRBRCN", useFRBRCN_); } - void RM::Configure() throw (xdaqException) { - XDAQ_NOTE(("builderDisable: %d",builderDisable_)); - XDAQ_NOTE(("noEIDs: %d",noEIDs_)); + XDAQ_NOTE(("RM instance %d parameter list", instance_)); + XDAQ_NOTE(("noEIDs: %d", noEIDs_)); + XDAQ_NOTE(("gtpDisable: %d", gtpDisable_)); + XDAQ_NOTE(("rcnDisable: %d", rcnDisable_)); + XDAQ_NOTE(("useFRBRCN: %d", useFRBRCN_)); this->SystemConfigure(); + + return; } void RM::Enable() throw (xdaqException) { + enable_ = TRUE; + + if (gtpDisable_) { + flt_->addListener(this); + flt_->BusyOff(); + } + + return; } void RM::SystemConfigure() @@ -40,24 +50,20 @@ identifiersq_.resize(noEIDs_+1); identifiersq_.setName("i2oRM/identifiersq_"); - for ( int i =0; i< noEIDs_; i++ ) - idput(i); - enable_ = TRUE; - flt_->BusyOff(); -} - -void RM::Suspend () throw (xdaqException) {} -void RM::Resume () throw (xdaqException){} - + for (int i = 0; i < noEIDs_; i++) idput(i); + return; +} +void RM::Suspend() throw (xdaqException) {} +void RM::Resume() throw (xdaqException) {} //Invoked by BM -void RM::readyToRead(EventIdentifier* eid) +void RM::readyToRead(EventIdentifier *eid) { mutex_->take(); idput(*eid); - if ( pending_ ) { // re-enable trigger + if (gtpDisable_ && pending_) { // re-enable trigger pending_ = FALSE; flt_->BusyOff(); XDAQ_DEBUG(("Re-enable trigger again")); @@ -67,44 +73,35 @@ //Invoked by TriggerGenerator void RM::trigger(TriggerInfo info) { - if ( ! enable_ ) { + if (gtpDisable_ && !enable_) { XDAQ_DEBUG(("Trigger is not enable")); - //getchar(); flt_->BusyOff(); + return; } XDAQ_DEBUG(("Triggering...")); - if ( idnotempty() ) { + if (idnotempty()) { // IDs availables EventIdentifier eid = idget(); - //testbeam specific - //cout << "Trigger a read: " << eid << endl; - - //for (int i=0; i< rui_.size(); i++ ) - // rui_[i]->readout_and_remove(&eid); // // Test for direct interface + if (!rcnDisable_) { + if (!useFRBRCN_) { for (int i=0; i< rui_.size(); i++ ) { XDAQ_DEBUG(("ask for readout")) - rui_[i]->readout_and_remove(eid,info ); - - - // NEW (example of local interface use) - //i2oInterface * intf = e_->getIntf(I2O_RUI_CLASSID,0); - //((i2oRUIInterface*)intf)->readout_and_remove(&eid); - - + rui_[i]->readout_and_remove(&eid, &info); + } + } else { + XDAQ_DEBUG(("ask for readout, multicast")) + rui_[0]->readout_and_remove_multicast(&eid, &info); + } } - if ( builderDisable_) - idput(eid); - else { XDAQ_DEBUG(("give eid to BM for reading (readyToSend)")); bm_->readyToSend(&eid); - } } else { // TRIGGER LOST @@ -115,6 +112,7 @@ #endif } + if (gtpDisable_) { mutex_->take(); if ( idnotempty() ) { //space available in RDPM @@ -126,6 +124,9 @@ pending_ = TRUE; } mutex_->give(); + } return; } + +// End of file diff -urNb tridas.orig/daq/evbdm/src/common/RUI.cc tridas/daq/evbdm/src/common/RUI.cc --- tridas.orig/daq/evbdm/src/common/RUI.cc Mon Oct 28 09:05:00 2002 +++ tridas/daq/evbdm/src/common/RUI.cc Mon Nov 11 16:17:15 2002 @@ -3,7 +3,6 @@ RUI::RUI(RUM * rum) { - state(Halted); // set default values for fields @@ -12,14 +11,12 @@ rum_ = rum; counter_ = 0; - exportParam("noEIDs",noEIDs_); - exportParam("testSize",testSize_); + exportParam("noEIDs", noEIDs_); + exportParam("testSize", testSize_); exportParam("blockSize", blockSize_); - exportParam("counter",counter_); - + exportParam("counter", counter_); } - void RUI::Enable () throw (xdaqException) { } @@ -46,7 +43,6 @@ { } - void RUI::Halt () throw (xdaqException) { // Clear the RUM @@ -78,8 +74,7 @@ XDAQ_DEBUG(("eid is %d",counter_ )); - this->readout_and_remove(&eid); - + this->dummy_readout_and_remove(&eid); SOAPMessage reply; SOAPEnvelope envelope = reply.getSOAPPart().getEnvelope(); @@ -107,7 +102,7 @@ BufRef* ref = rum_->fetch(*eid); if (ref != 0) { - BufRefPool * pool = ref->pool_; + BufRefPool *pool = ref->pool_; pool->free(ref); rum_->reset(*eid); } @@ -118,19 +113,16 @@ int nBlocks; if ( (testSize_ % dataSize_ ) != 0 ) { nBlocks = (int)((testSize_ + dataSize_)/dataSize_); - } - else { + } else { nBlocks = (int)((testSize_)/dataSize_); - } - //int nBlocks = (int)((testSize_ + dataSize_)/dataSize_); XDAQ_DEBUG(("Number of blocks per fragment is %d", nBlocks )) int remainingSize = testSize_; int transferSize; - for (int i = 0; i < nBlocks; i++ ) { + for (int i = 0; i < nBlocks; i++) { transferSize = (remainingSize < dataSize_ ? remainingSize:dataSize_ ); //MIN remainingSize = remainingSize - transferSize; @@ -142,14 +134,12 @@ rum_->append(*eid,ref,transferSize); } - rum_->unlock(*eid); - } -void RUI::readout_and_remove (EventIdentifier* eid) +void RUI::readout_and_remove(EventIdentifier *eid, TriggerIdentifier *trig) { - if ( state() == Halted ) { + if (state() == Halted) { XDAQ_WARN(("RUI system is already halted (ignore request)")); return ; } @@ -158,3 +148,4 @@ this->dummy_readout_and_remove(eid); } +// End of file diff -urNb tridas.orig/daq/evbdm/xml/1ru1burcn.xml tridas/daq/evbdm/xml/1ru1burcn.xml --- tridas.orig/daq/evbdm/xml/1ru1burcn.xml Wed Dec 31 18:00:00 1969 +++ tridas/daq/evbdm/xml/1ru1burcn.xml Mon Nov 11 16:17:15 2002 @@ -0,0 +1,114 @@ + + + + + + + + ptTCP + ptFRB + + RUI + RUO + BM + RM + BU + FU + + + + + + + + + +
+
+ + + + 100 + 0 + + + + + + + + 100 + 1 + 0 + 1 + + + + /home/ichiro/work/tridas/lib/linux/x86/libevbdm.so + + + /home/ichiro/work/tridas/lib/linux/x86/libptTCP.so + + /home/ichiro/work/tridas/lib/linux/x86/libptFRB.so + + + +
+
+ + + + 56000 + 50000 + 100 + + + + + + + /home/ichiro/work/tridas/lib/linux/x86/libevbdm.so + + + /home/ichiro/work/tridas/lib/linux/x86/libptTCP.so + + /home/ichiro/work/tridas/lib/linux/x86/libptFRB.so + + + +
+
+ + + + 0 + 1 + 1 + 100 + 0 + file:/home/ichiro/work/tridas/daq/evbdm/xml/fsets-1.xml + + + + /home/ichiro/work/tridas/lib/linux/x86/libevbdm.so + + + /home/ichiro/work/tridas/lib/linux/x86/libptTCP.so + + /home/ichiro/work/tridas/lib/linux/x86/libptFRB.so + + +