diff --git a/src/drv/mbuf/mbuf_probe/CMakeLists.txt b/src/drv/mbuf/mbuf_probe/CMakeLists.txt index 302c0fb74c13349db5941008865338ca9aaf3615..d4d45a902582ba41c06d97e06c57510bf6dea835 100644 --- a/src/drv/mbuf/mbuf_probe/CMakeLists.txt +++ b/src/drv/mbuf/mbuf_probe/CMakeLists.txt @@ -7,7 +7,8 @@ add_executable(mbuf_probe analyze_rmipc.cc analyze_awg_data.cc analyze_header.cc - check_size.cc) + check_size.cc + analyze_tp_cfg.cpp) target_include_directories(mbuf_probe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/../../include diff --git a/src/drv/mbuf/mbuf_probe/analyze_header.cc b/src/drv/mbuf/mbuf_probe/analyze_header.cc index 29c143292edc3ef51593663f9227bdf033195b50..d032b366e62f8dcf442cdca32335113763077a18 100644 --- a/src/drv/mbuf/mbuf_probe/analyze_header.cc +++ b/src/drv/mbuf/mbuf_probe/analyze_header.cc @@ -28,6 +28,9 @@ namespace analyze detected_type = MBUF_AWG_DATA; cout << "Detected AWG_DATA struct "; break; + case TESTPOINT_CFG_ID: + detected_type = MBUF_TP_CFG; + cout << "Detected TESTPOINT_CFG struct "; } } else diff --git a/src/drv/mbuf/mbuf_probe/analyze_tp_cfg.cpp b/src/drv/mbuf/mbuf_probe/analyze_tp_cfg.cpp new file mode 100644 index 0000000000000000000000000000000000000000..abf654891e2d19728a899ce2b853756b29f6cc61 --- /dev/null +++ b/src/drv/mbuf/mbuf_probe/analyze_tp_cfg.cpp @@ -0,0 +1,69 @@ +// +// Created by erik.vonreis on 5/20/21. +// + +#include <iostream> +#include "analyze_tp_cfg.hh" +#include "shmem_testpoint.h" +#include "analyze_header.hh" + +using namespace std; + +namespace analyze +{ + #define PRINTVAL(X) printf(#X " = %d\n", X); + + static void dump_tp_cfg(volatile TESTPOINT_CFG *tp_cfg) + { + auto detected_type = analyze_header(tp_cfg); + if(detected_type != MBUF_TP_CFG) + { + cout << "WARNING: attempting to analyze AWG_DATA structure, but structure was of type " << detected_type << endl; + } + + PRINTVAL(sizeof(TESTPOINT_CFG)); + + for(;;) + { + cout << "ex:"; + for(int i=0; i<4; ++i) + { + cout << " " << tp_cfg->excitations[i]; + } + cout << endl; + + cout << "tp:"; + for(int i=0; i<4; ++i) + { + cout << " " << tp_cfg->testpoints[i]; + } + cout << endl; + + cout << "ew:"; + for(int i=0; i<4; ++i) + { + cout << " " << tp_cfg->excitations_writeback[i]; + } + cout << endl; + + cout << "tw:"; + for(int i=0; i<4; ++i) + { + cout << " " << tp_cfg->testpoints_writeback[i]; + } + cout << endl; + + usleep(2000); + } + } + + void analyze_tp_cfg( volatile void* buffer, + std::size_t size, + const ConfigOpts& options ) + { + + dump_tp_cfg( + reinterpret_cast<volatile TESTPOINT_CFG *>(buffer) + ); + } +} \ No newline at end of file diff --git a/src/drv/mbuf/mbuf_probe/analyze_tp_cfg.hh b/src/drv/mbuf/mbuf_probe/analyze_tp_cfg.hh new file mode 100644 index 0000000000000000000000000000000000000000..f1e855de51e3b60a076072877c8245ba4308224c --- /dev/null +++ b/src/drv/mbuf/mbuf_probe/analyze_tp_cfg.hh @@ -0,0 +1,18 @@ +// +// Created by erik.vonreis on 5/20/21. +// + +#ifndef DAQD_TRUNK_ANALYZE_TP_CFG_HH +#define DAQD_TRUNK_ANALYZE_TP_CFG_HH + +#include <cstddef> +#include "mbuf_probe.hh" + +namespace analyze +{ + void analyze_tp_cfg( volatile void* buffer, + std::size_t size, + const ConfigOpts& options ); +} + +#endif // DAQD_TRUNK_ANALYZE_TP_CFG_HH diff --git a/src/drv/mbuf/mbuf_probe/mbuf_probe.cc b/src/drv/mbuf/mbuf_probe/mbuf_probe.cc index 649ca410d0df08d039377ab6ff9c1b24922a526b..8c616bacca2f7bcaef25fffebf37d666ff0e86f4 100644 --- a/src/drv/mbuf/mbuf_probe/mbuf_probe.cc +++ b/src/drv/mbuf/mbuf_probe/mbuf_probe.cc @@ -28,6 +28,7 @@ #include "analyze_daq_multi_dc.hh" #include "analyze_rmipc.hh" #include "analyze_awg_data.hh" +#include "analyze_tp_cfg.hh" #include "gap_check.hh" #include "check_size.hh" @@ -75,6 +76,7 @@ usage( const char* progname ) std::cout << "\tdaq_multi_cycle Analyze the output of a streamer/local_dc\n"; std::cout << "\tAWG_DATA Analyze the data streaming from awg.\n"; + std::cout << "\tTP_CFG Analyze the test point configuration shared memory.\n"; } ConfigOpts @@ -98,6 +100,8 @@ parse_options( int argc, char* argv[] ) std::make_pair( "daq_multi_cycle", MBUF_DAQ_MULTI_DC ) ); struct_lookup.insert( std::make_pair( "awg_data", MBUF_AWG_DATA ) ); struct_lookup.insert( std::make_pair( "AWG_DATA", MBUF_AWG_DATA ) ); + struct_lookup.insert( std::make_pair( "tp_cfg", MBUF_TP_CFG ) ); + struct_lookup.insert( std::make_pair( "TP_CFG", MBUF_TP_CFG ) ); std::deque< std::string > args; for ( int i = 1; i < argc; ++i ) @@ -362,6 +366,9 @@ handle_analyze( const ConfigOpts& opts ) case MBUF_AWG_DATA: analyze::analyze_awg_data( buffer, opts.buffer_size, opts ); break; + case MBUF_TP_CFG: + analyze::analyze_tp_cfg(buffer, opts.buffer_size, opts); + break; case MBUF_INVALID: default: std::cout << "Unknown analysis type: " << opts.analysis_type diff --git a/src/drv/mbuf/mbuf_probe/mbuf_probe.hh b/src/drv/mbuf/mbuf_probe/mbuf_probe.hh index 0c572e861b96588d559a2c79d21418e45f210d3d..b7466150adff66ecf35497eb8850aca13b41e998 100644 --- a/src/drv/mbuf/mbuf_probe/mbuf_probe.hh +++ b/src/drv/mbuf/mbuf_probe/mbuf_probe.hh @@ -36,6 +36,7 @@ enum MBufStructures MBUF_RMIPC, MBUF_DAQ_MULTI_DC, MBUF_AWG_DATA, + MBUF_TP_CFG, }; struct ConfigOpts diff --git a/src/gds/awgtpman/awgtpman.c b/src/gds/awgtpman/awgtpman.c index 7e0da193551e83f53076fa4dc5549167c9e33d87..971cd902e298aa2be4f1293e820e8d3d2db6b220 100644 --- a/src/gds/awgtpman/awgtpman.c +++ b/src/gds/awgtpman/awgtpman.c @@ -309,7 +309,7 @@ CDS_HARDWARE cdsPciModules; _exit(2); } - if(!OpenTestpointCfgSharedMemory()) + if(!OpenTestpointCfgSharedMemory(system_name)) { fprintf(stderr, "Failed to open testpoint configuration shared memory.\n"); _exit(2); diff --git a/src/gds/awgtpman/shared_memory.h b/src/gds/awgtpman/shared_memory.h index 8e3672cdec9938de5c16c24c14e43092c7d68dd8..275352a261da3284fd20a3995c9a8b93fa7f269f 100644 --- a/src/gds/awgtpman/shared_memory.h +++ b/src/gds/awgtpman/shared_memory.h @@ -63,6 +63,6 @@ extern volatile TESTPOINT_CFG * shmemTestpointCfg; * memory is mapped to global shmemTestpointCfg * @return true if successful */ -int OpenTestpointCfgSharedMemory(); +int OpenTestpointCfgSharedMemory(const char *model_name); #endif // DAQD_TRUNK_SHARED_MEMORY_H diff --git a/src/gds/awgtpman/testpoint_server.c b/src/gds/awgtpman/testpoint_server.c index 843bfa163f69c5c878f31a4cfe78128838e78658..c84e3c149c5bb2439bd843cddf5fd097ef8debe8 100644 --- a/src/gds/awgtpman/testpoint_server.c +++ b/src/gds/awgtpman/testpoint_server.c @@ -154,7 +154,7 @@ static char *versionId = "Version $Id$" ; /* list of preselected testpoints */ testpoint_t preselect[TP_MAX_PRESELECT]; /* list of TP active TPs */ - tpEntry_t indx[TP_MAX_INTERFACE][TP_MAX_INDEX]; + tpEntry_t indx[TP_MAX_INTERFACE][DAQ_GDS_MAX_TP_NUM]; /* points directly into RM IPC area rmIpcStr* ipc[TP_MAX_INTERFACE]; */ /* points directly into RM channel info area @@ -1113,14 +1113,21 @@ static char *versionId = "Version $Id$" ; int addr; /* RM address of tp index */ t = (tainsec_t) time * _ONESEC + (tainsec_t) epoch * _EPOCH; - + + if (tpNode.valid) { + MUTEX_GET (servermux); /* loop over interfaces */ for (j = 0; j < TP_MAX_INTERFACE; j++) { /* make index */ for (i = 0, size = 0; i < DAQ_GDS_MAX_TP_NUM; i++) { + if(tpNode.indx[j][i].id) + { + printf("setting interface %d node %d = %d\n", + j, i, tpNode.indx[j][i].id); + } switch(j) { case TP_LSC_EX_INTERFACE: