From c000c6d3c878f8f9423ff44d53e975c3e4697c1f Mon Sep 17 00:00:00 2001 From: Erik von Reis <evonreis@caltech.edu> Date: Thu, 20 May 2021 13:29:28 -0700 Subject: [PATCH] awgtpman, mbuf_probe: added testpoint config table to mbuf_probe. --- src/drv/mbuf/mbuf_probe/CMakeLists.txt | 3 +- src/drv/mbuf/mbuf_probe/analyze_header.cc | 3 + src/drv/mbuf/mbuf_probe/analyze_tp_cfg.cpp | 69 ++++++++++++++++++++++ src/drv/mbuf/mbuf_probe/analyze_tp_cfg.hh | 18 ++++++ src/drv/mbuf/mbuf_probe/mbuf_probe.cc | 7 +++ src/drv/mbuf/mbuf_probe/mbuf_probe.hh | 1 + src/gds/awgtpman/awgtpman.c | 2 +- src/gds/awgtpman/shared_memory.h | 2 +- src/gds/awgtpman/testpoint_server.c | 11 +++- 9 files changed, 111 insertions(+), 5 deletions(-) create mode 100644 src/drv/mbuf/mbuf_probe/analyze_tp_cfg.cpp create mode 100644 src/drv/mbuf/mbuf_probe/analyze_tp_cfg.hh diff --git a/src/drv/mbuf/mbuf_probe/CMakeLists.txt b/src/drv/mbuf/mbuf_probe/CMakeLists.txt index 302c0fb74..d4d45a902 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 29c143292..d032b366e 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 000000000..abf654891 --- /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 000000000..f1e855de5 --- /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 649ca410d..8c616bacc 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 0c572e861..b7466150a 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 7e0da1935..971cd902e 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 8e3672cde..275352a26 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 843bfa163..c84e3c149 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: -- GitLab