From: <ro...@us...> - 2008-08-20 13:48:12
|
Revision: 1954 http://nscldaq.svn.sourceforge.net/nscldaq/?rev=1954&view=rev Author: ron-fox Date: 2008-08-20 13:48:21 +0000 (Wed, 20 Aug 2008) Log Message: ----------- Get all this to the point that I can actually start a run without it dying or hanging before it does meaningfull stuff with the VM-USB Modified Paths: -------------- trunk/nextgen/usb/app/CApplication.cpp trunk/nextgen/usb/app/CApplication.h trunk/nextgen/usb/app/Makefile.am trunk/nextgen/usb/output/COutputThread.cpp trunk/nextgen/usb/output/DataBuffer.cpp trunk/nextgen/usb/vmusb/app/App.cpp trunk/nextgen/usb/vmusb/app/App.h trunk/nextgen/usb/vmusb/app/Makefile.am trunk/nextgen/usb/vmusb/daqconfig/CModuleCommand.cpp Modified: trunk/nextgen/usb/app/CApplication.cpp =================================================================== --- trunk/nextgen/usb/app/CApplication.cpp 2008-08-19 21:07:11 UTC (rev 1953) +++ trunk/nextgen/usb/app/CApplication.cpp 2008-08-20 13:48:21 UTC (rev 1954) @@ -28,6 +28,7 @@ #include <CResumeRun.h> #include <CPortManager.h> +#include <COutputThread.h> #include <stdlib.h> #include <unistd.h> @@ -78,10 +79,14 @@ // Got all we need to get the application put together: selectInterface(deviceSpecification); + selectDAQConfigFile(daqConfigFile); selectControlConfigFile(ctlConfigFile); createConfiguration(); createTclServer(port, application); + createBuffers(); + COutputThread* pRouter = new COutputThread(); + pRouter->start(); createMainInterpreter(argc, argv); // MUST BE LAST!!!!!! Modified: trunk/nextgen/usb/app/CApplication.h =================================================================== --- trunk/nextgen/usb/app/CApplication.h 2008-08-19 21:07:11 UTC (rev 1953) +++ trunk/nextgen/usb/app/CApplication.h 2008-08-20 13:48:21 UTC (rev 1954) @@ -71,6 +71,8 @@ supported device objects can be created and configured. - setupTclServer - add device types to the Tcl server so that slow control devices can be specified and configured. + - createBuffers() - Must set up the buffer pool with sufficient buffers + of the correct size for the interface. \note All member functions are virtual so that if this callback scheme is @@ -101,6 +103,7 @@ virtual void selectInterface(std::string specification) = 0; virtual void setupConfiguration(CConfiguration& configuration) = 0; virtual void setupTclServer(TclServer& server) = 0; + virtual void createBuffers() = 0; private: Modified: trunk/nextgen/usb/app/Makefile.am =================================================================== --- trunk/nextgen/usb/app/Makefile.am 2008-08-19 21:07:11 UTC (rev 1953) +++ trunk/nextgen/usb/app/Makefile.am 2008-08-20 13:48:21 UTC (rev 1954) @@ -10,6 +10,7 @@ -I@top_srcdir@/usb/tclcommon \ -I@top_srcdir@/usb/tclserver \ -I@top_srcdir@/usb/acqcommon \ + -I@top_srcdir@/usb/output \ -I@top_srcdir@/base/tclplus \ -I@top_srcdir@/servers/portmanager \ -I@top_srcdir@/base/thread \ @@ -20,6 +21,7 @@ libusbapplication_la_LDFLAGS = @top_srcdir@/usb/tclcommon/libusbtclcommon.la \ @top_srcdir@//usb/tclserver/libControlServer.la \ @top_srcdir@/usb/acqcommon/libusbacqcommon.la \ + @top_srcdir@/usb/output/libOutputStage.la @top_srcdir@/base/tclplus/libtclPlus.la \ @top_srcdir@/servers/portmanager/libPortManager.la \ @top_srcdir@/base/exception/libException.la \ Modified: trunk/nextgen/usb/output/COutputThread.cpp =================================================================== --- trunk/nextgen/usb/output/COutputThread.cpp 2008-08-19 21:07:11 UTC (rev 1953) +++ trunk/nextgen/usb/output/COutputThread.cpp 2008-08-20 13:48:21 UTC (rev 1954) @@ -74,7 +74,7 @@ COutputThread::COutputThread() : m_pRing(0) { - openRing(); // Open ring named after the user in localhost. + openRing(); // Open ring named after the user in localhost. // the ring is created if necessary. } /*! @@ -338,6 +338,12 @@ passwd* pPass = getpwuid(uid); string name(pPass->pw_name); + // If necessary create the ring:.. for now with default characteristics. + + if (!CRingBuffer::isRing(name)) { + CRingBuffer::create(name); + } + m_pRing = new CRingBuffer(name, CRingBuffer::producer); } /* Modified: trunk/nextgen/usb/output/DataBuffer.cpp =================================================================== --- trunk/nextgen/usb/output/DataBuffer.cpp 2008-08-19 21:07:11 UTC (rev 1953) +++ trunk/nextgen/usb/output/DataBuffer.cpp 2008-08-20 13:48:21 UTC (rev 1954) @@ -45,7 +45,7 @@ DataBuffer* createDataBuffer(uint32_t bodySize) { - size_t bytes = sizeof(struct DataBuffer) + (bodySize-1)*sizeof(uint16_t); + size_t bytes = sizeof(struct DataBuffer) + (bodySize)*sizeof(uint16_t); DataBuffer* p = static_cast<DataBuffer*>(malloc(bytes)); p->s_storageSize = bodySize; return p; Modified: trunk/nextgen/usb/vmusb/app/App.cpp =================================================================== --- trunk/nextgen/usb/vmusb/app/App.cpp 2008-08-19 21:07:11 UTC (rev 1953) +++ trunk/nextgen/usb/vmusb/app/App.cpp 2008-08-20 13:48:21 UTC (rev 1954) @@ -22,12 +22,16 @@ #include <CAcquisitionThread.h> #include <CVMUSBConfig.h> #include <CVMUSBControlConfig.h> +#include <DataBuffer.h> +#include <CBufferQueue.h> #include <usb.h> #include <iostream> #include <stdlib.h> +static const uint32_t BufferSize(13*1024); + /*! - Select which VM-USB to use. - Create a CVMUSB object that communicates with that interface. @@ -111,6 +115,20 @@ { CVMUSBControlConfig::configure(&pServer); } + +/*! + Create the buffer pool for the system. + This is device dependent, because the VM-USB and CC-USB e.g. use different + sized buffers +*/ +void +App::createBuffers() +{ + for (int i =0; i < 32; i++) { + DataBuffer* pBuffer = createDataBuffer(BufferSize); + gFreeBuffers.queue(pBuffer); + } +} ///////////////////////////////////////////////////////////////////////////// /*! Modified: trunk/nextgen/usb/vmusb/app/App.h =================================================================== --- trunk/nextgen/usb/vmusb/app/App.h 2008-08-19 21:07:11 UTC (rev 1953) +++ trunk/nextgen/usb/vmusb/app/App.h 2008-08-20 13:48:21 UTC (rev 1954) @@ -41,7 +41,7 @@ virtual void selectInterface(std::string specification) ; virtual void setupConfiguration(CConfiguration& configuration) ; virtual void setupTclServer(TclServer& server) ; - + virtual void createBuffers() ; }; #endif Modified: trunk/nextgen/usb/vmusb/app/Makefile.am =================================================================== --- trunk/nextgen/usb/vmusb/app/Makefile.am 2008-08-19 21:07:11 UTC (rev 1953) +++ trunk/nextgen/usb/vmusb/app/Makefile.am 2008-08-20 13:48:21 UTC (rev 1954) @@ -12,6 +12,7 @@ -I@top_srcdir@/usb/commands \ -I@top_srcdir@/usb/tclcommon \ -I@top_srcdir@/usb/tclserver \ + -I@top_srcdir@/usb/output \ -I@top_srcdir@/usb/threadcom \ -I@top_srcdir@/usb/vmusb/daqconfig \ -I@top_srcdir@/usb/vmusb/deviceDriver \ @@ -20,6 +21,7 @@ VMUSBReadout_LDADD = @top_srcdir@/usb/acqcommon/libusbacqcommon.la \ @top_srcdir@/usb/tclcommon/libusbtclcommon.la \ + @top_srcdir@/usb/output/libOutputStage.la \ @top_srcdir@/usb/threadcom/libThreadComm.la \ @top_srcdir@/usb/output/libOutputStage.la \ @top_srcdir@/usb/app/libusbapplication.la \ Modified: trunk/nextgen/usb/vmusb/daqconfig/CModuleCommand.cpp =================================================================== --- trunk/nextgen/usb/vmusb/daqconfig/CModuleCommand.cpp 2008-08-19 21:07:11 UTC (rev 1953) +++ trunk/nextgen/usb/vmusb/daqconfig/CModuleCommand.cpp 2008-08-20 13:48:21 UTC (rev 1954) @@ -19,6 +19,7 @@ #include <TCLObject.h> #include <CConfiguration.h> #include <CConfigurableObject.h> +#include <CItemConfiguration.h> using std::string; using std::vector; @@ -161,7 +162,7 @@ // Create configure and insert the module in the configuration. CConfigurableObject* pModule = createObject(); - pModule->onAttach(); + pModule->Attach(new CItemConfiguration(name), true); addObjectToConfiguration(m_config, name, getType(), pModule); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |