From 28ca5c615c7260f539146c3cf5d36896c2f4066b Mon Sep 17 00:00:00 2001 From: "Jonas A. Krieger" Date: Tue, 31 Mar 2026 10:24:24 +0200 Subject: [PATCH 1/7] frontend currently used with GPIB on GPS and HAL --- .gitmodules | 3 +++ midas_lan_gpib | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 midas_lan_gpib diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e156538 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "midas_lan_gpib"] + path = midas_lan_gpib + url = git@gitea.psi.ch:lin-midas-drivers/midas_lan_gpib.git diff --git a/midas_lan_gpib b/midas_lan_gpib new file mode 160000 index 0000000..6a3ed29 --- /dev/null +++ b/midas_lan_gpib @@ -0,0 +1 @@ +Subproject commit 6a3ed297b9043262911d07300ef393015e55c51f -- 2.54.0 From 7a17b78eb443a78b343099dcfffacd1bb94be1cc Mon Sep 17 00:00:00 2001 From: "Jonas A. Krieger" Date: Tue, 31 Mar 2026 10:28:11 +0200 Subject: [PATCH 2/7] adds gpib support --- CMakeLists.txt | 33 ++++++++++++++------------------- device/lakeshore_340.cxx | 2 +- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b14aca..20e7471 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,29 +49,21 @@ set(MIDAS_LIBS set(LIBS ${SYS_LIBS} ${MIDAS_LIBS}) ################################################################################ -## make tcpip library configurable +## add gpib library ################################################################################ -if(IS_DIRECTORY ${TCPIP_DRIVER_DIR}) - add_subdirectory( - # TODO not sure, should it be a submodule? does it really make sense to - # separate everything? - ${TCPIP_DRIVER_DIR} ./bus/tcpip - ) - - set( - LIBS - ${LIBS} - tcpip - ) -else() - set( - DRIVERS - ${DRIVERS} - ${TCPIP_DRIVER_DIR} - ) +#build midas_lan_gib if not already there +if(NOT TARGET midas_lan_gpib) + add_subdirectory(midas_lan_gpib) endif() +set( + LIBS + ${LIBS} + midas_lan_gpib +) + + ################################################################################ ## Device Library ################################################################################ @@ -82,6 +74,9 @@ add_library( ${DRIVERS} ) +# Compile the device driver for use with GPIB +target_compile_definitions(lakeshore_340 PRIVATE LANGPIB_SUPPORT) + set_property( TARGET lakeshore_340 diff --git a/device/lakeshore_340.cxx b/device/lakeshore_340.cxx index c7297c0..a6cc0b8 100644 --- a/device/lakeshore_340.cxx +++ b/device/lakeshore_340.cxx @@ -77,7 +77,7 @@ #endif #ifdef LANGPIB_SUPPORT -#include "bus/langpib.h" +#include "midas_lan_gpib.h" #endif #define WATCHDOG // disable checking of this front end by watchdog during -- 2.54.0 From b16a88cb8917860cc253f1e4044864654423abdc Mon Sep 17 00:00:00 2001 From: "Jonas A. Krieger" Date: Tue, 31 Mar 2026 10:39:41 +0200 Subject: [PATCH 3/7] somehow it still wants to include the tcp header? added it back to cmake --- CMakeLists.txt | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 20e7471..5e2aed7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,6 +63,29 @@ set( midas_lan_gpib ) +################################################################################ +## make tcpip library configurable +################################################################################ + +if(IS_DIRECTORY ${TCPIP_DRIVER_DIR}) + add_subdirectory( + # TODO not sure, should it be a submodule? does it really make sense to + # separate everything? + ${TCPIP_DRIVER_DIR} ./bus/tcpip + ) + + set( + LIBS + ${LIBS} + tcpip + ) +else() + set( + DRIVERS + ${DRIVERS} + ${TCPIP_DRIVER_DIR} + ) +endif() ################################################################################ ## Device Library -- 2.54.0 From d62b2d450b756722d501079367ea575fc72e7c2f Mon Sep 17 00:00:00 2001 From: "Jonas A. Krieger" Date: Tue, 31 Mar 2026 10:53:02 +0200 Subject: [PATCH 4/7] updates frontend --- CMakeLists.txt | 1 + frontend/lakeshore_340_scfe.cxx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e2aed7..c37cd8d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -146,6 +146,7 @@ if(${}) target_link_libraries( lakeshore_340_fe lakeshore_340 + midas_lan_gpib ) endif() \ No newline at end of file diff --git a/frontend/lakeshore_340_scfe.cxx b/frontend/lakeshore_340_scfe.cxx index a4df756..65a1f24 100644 --- a/frontend/lakeshore_340_scfe.cxx +++ b/frontend/lakeshore_340_scfe.cxx @@ -6,7 +6,7 @@ #include "midas.h" #include "mfe.h" -#include "bus/tcpip.h" +#include "midas_lan_gpib.h" #include "class/multi.h" #include "lakeshore_340.h" -- 2.54.0 From d59d6b0f8d14cd0576877aa148570d580a1ad747 Mon Sep 17 00:00:00 2001 From: "Jonas A. Krieger" Date: Tue, 31 Mar 2026 13:33:00 +0200 Subject: [PATCH 5/7] fixes bug in submodule --- frontend/lakeshore_340_scfe.cxx | 4 ++-- midas_lan_gpib | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/lakeshore_340_scfe.cxx b/frontend/lakeshore_340_scfe.cxx index 65a1f24..51a5f05 100644 --- a/frontend/lakeshore_340_scfe.cxx +++ b/frontend/lakeshore_340_scfe.cxx @@ -42,8 +42,8 @@ BOOL should_exit=FALSE; *

device driver list for sample cryo and flow */ DEVICE_DRIVER ls340_driver[] = { - { "LS340in", ls340_in, 48, tcpip, DF_INPUT}, - { "LS340out", ls340_out, 24, tcpip, DF_OUTPUT}, + { "LS340in", ls340_in, 48, langpib, DF_INPUT}, + { "LS340out", ls340_out, 24, langpib, DF_OUTPUT}, { "" } }; diff --git a/midas_lan_gpib b/midas_lan_gpib index 6a3ed29..32cc20d 160000 --- a/midas_lan_gpib +++ b/midas_lan_gpib @@ -1 +1 @@ -Subproject commit 6a3ed297b9043262911d07300ef393015e55c51f +Subproject commit 32cc20d943cb3ecf4c7a6b7565960591b5442b6e -- 2.54.0 From d42fdf401c71f3bd0bfc8eaf6b3b529253695571 Mon Sep 17 00:00:00 2001 From: "Jonas A. Krieger" Date: Tue, 31 Mar 2026 14:15:19 +0200 Subject: [PATCH 6/7] updated readme --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9da287d..a6dd087 100644 --- a/README.md +++ b/README.md @@ -19,10 +19,12 @@ cmake -S "$(pwd)" -B -DBUILD_FRONTEND=ON cmake --build --clean-first -- -j8 ``` -## Run +## Configuration files: +This frontend has file-system interactions. It should be started in a dedicated configuration file folder. As a start command in the odb, simply prepend a ```cd``` command. +## Run ```bash -/build/driver/lakeshore_340_fe -e flame +cd /home/repos/programs/frontends/ccr_oven_ls340_scfe/config; /build/driver/lakeshore_340_fe -e gps ``` ## Including in Custom Frontend -- 2.54.0 From 177aadb7b96c763c6ef4b5bc2a4223b09af3bbb0 Mon Sep 17 00:00:00 2001 From: Alexander Soederqvist Date: Wed, 26 Aug 2026 09:01:43 +0200 Subject: [PATCH 7/7] Parametrize tcpip or langpib --- CMakeLists.txt | 174 ++++++++++++++------------------ frontend/lakeshore_340_scfe.cxx | 17 +++- 2 files changed, 89 insertions(+), 102 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c37cd8d..ff3da57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 3.03) +# This cmake file build 2 targets, one for tcpip and one for langpib + project(lakeshore_340 VERSION 0.1) add_compile_options( @@ -11,26 +13,11 @@ add_compile_options( -Wno-unused-function ) -option( - BUILD_FRONTEND - "If ON, build the default frontend executable" - OFF -) - set(CMAKE_PREFIX_PATH "$ENV{MIDASSYS}") find_package(Midas REQUIRED) -set( - TCPIP_DRIVER_DIR - $ENV{MIDASSYS}/drivers/bus/tcpip.cxx - CACHE STRING - "path to tcpip driver that should be used" -) - -set( - DRIVERS - $ENV{MIDASSYS}/drivers/class/multi.cxx -) +#build midas_lan_gib if not already there +add_subdirectory(midas_lan_gpib) set(SYS_LIBS pthread @@ -46,107 +33,96 @@ set(MIDAS_LIBS midas::mscb ) -set(LIBS ${SYS_LIBS} ${MIDAS_LIBS}) - -################################################################################ -## add gpib library -################################################################################ - -#build midas_lan_gib if not already there -if(NOT TARGET midas_lan_gpib) - add_subdirectory(midas_lan_gpib) -endif() - -set( - LIBS - ${LIBS} - midas_lan_gpib -) - ################################################################################ ## make tcpip library configurable ################################################################################ -if(IS_DIRECTORY ${TCPIP_DRIVER_DIR}) - add_subdirectory( - # TODO not sure, should it be a submodule? does it really make sense to - # separate everything? - ${TCPIP_DRIVER_DIR} ./bus/tcpip - ) - - set( - LIBS - ${LIBS} - tcpip - ) -else() - set( - DRIVERS - ${DRIVERS} - ${TCPIP_DRIVER_DIR} - ) -endif() - ################################################################################ -## Device Library +## Device Libraries ################################################################################ -add_library( - lakeshore_340 - device/lakeshore_340.cxx - ${DRIVERS} -) +foreach(target IN ITEMS lakeshore_340 lakeshore_340langpib) -# Compile the device driver for use with GPIB -target_compile_definitions(lakeshore_340 PRIVATE LANGPIB_SUPPORT) - -set_property( - TARGET - lakeshore_340 - PROPERTY - CXX_STANDARD 11 -) - -target_include_directories( - lakeshore_340 - PUBLIC - $ - ${CMAKE_CURRENT_SOURCE_DIR} -) - -target_link_libraries( - lakeshore_340 - ${LIBS} -) - -################################################################################ -## Test Frontend -################################################################################ - -if(${}) - - add_executable( - lakeshore_340_fe - frontend/lakeshore_340_scfe.cxx + add_library( + ${target} + device/lakeshore_340.cxx ) + set_property( TARGET - lakeshore_340_fe + ${target} PROPERTY CXX_STANDARD 11 ) target_include_directories( - lakeshore_340_fe - PRIVATE - $ENV{MIDASSYS}/drivers + ${target} + PUBLIC + $ + ${CMAKE_CURRENT_SOURCE_DIR} ) target_link_libraries( - lakeshore_340_fe - lakeshore_340 - midas_lan_gpib + ${target} + ${SYS_LIBS} + ${MIDAS_LIBS} ) -endif() \ No newline at end of file +endforeach() + +target_sources( + lakeshore_340 PRIVATE + $ENV{MIDASSYS}/drivers/bus/tcpip.cxx +) + +target_link_libraries( + lakeshore_340langpib + midas_lan_gpib +) + +# Compile the device driver for use with GPIB +target_compile_definitions(lakeshore_340langpib PRIVATE LANGPIB_SUPPORT) + +################################################################################ +## Test Frontend +################################################################################ +set(_DEFAULT_LAKESHORE_340_FRONTEND_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "") + +function(default_lakeshore_340_frontend F_TARGET F_NAME F_EVENT_ID LIB_TARGET) + + if(NOT ("${LIB_TARGET}" STREQUAL "lakeshore_340" OR "${LIB_TARGET}" STREQUAL "lakeshore_340langpib")) + message(FATAL_ERROR "Invalid lakeshore 340 target") + endif() + + message("LAKESHORE_340: ${F_NAME} ${F_EVENT_ID} ${LIB_TARGET}") + + add_executable( + ${F_TARGET} + ${_DEFAULT_LAKESHORE_340_FRONTEND_DIR}/frontend/lakeshore_340_scfe.cxx + $ENV{MIDASSYS}/drivers/class/multi.cxx + ) + + target_compile_definitions(${F_TARGET} PRIVATE FRONTEND_NAME="${F_NAME}") + target_compile_definitions(${F_TARGET} PRIVATE FRONTEND_ID=${F_EVENT_ID}) + target_compile_definitions(${F_TARGET} PRIVATE TARGET_LIB=${LIB_TARGET}) + + set_property( + TARGET + ${F_TARGET} + PROPERTY + CXX_STANDARD 11 + ) + + target_include_directories( + ${F_TARGET} + PRIVATE + $ENV{MIDASSYS}/drivers + ) + + target_link_libraries( + ${F_TARGET} + ${LIB_TARGET} + ) + +endfunction() diff --git a/frontend/lakeshore_340_scfe.cxx b/frontend/lakeshore_340_scfe.cxx index 51a5f05..7bff96b 100644 --- a/frontend/lakeshore_340_scfe.cxx +++ b/frontend/lakeshore_340_scfe.cxx @@ -6,14 +6,20 @@ #include "midas.h" #include "mfe.h" +// Depending on preprocess var +#if TARGET_LIB == lakeshore_340langpib #include "midas_lan_gpib.h" +#else +#include "bus/tcpip.h" +#endif + #include "class/multi.h" #include "lakeshore_340.h" //-- Globals ------------------------------------------------------- //! The frontend name (client name) as seen by other MIDAS clients -const char *frontend_name = "Lakeshore340"; +const char *frontend_name = FRONTEND_NAME; //! The frontend file name, don't change it const char *frontend_file_name = __FILE__; @@ -42,8 +48,13 @@ BOOL should_exit=FALSE; *

device driver list for sample cryo and flow */ DEVICE_DRIVER ls340_driver[] = { +#if TARGET_LIB == lakeshore_340langpib { "LS340in", ls340_in, 48, langpib, DF_INPUT}, { "LS340out", ls340_out, 24, langpib, DF_OUTPUT}, +#else + { "LS340in", ls340_in, 48, tcpip, DF_INPUT}, + { "LS340out", ls340_out, 24, tcpip, DF_OUTPUT}, +#endif { "" } }; @@ -60,8 +71,8 @@ BOOL equipment_common_overwrite = FALSE; //! equipment structure for the mfe.c EQUIPMENT equipment[] = { - { "Lakeshore340", /* equipment name */ - {95, 0, /* event ID, trigger mask */ + { FRONTEND_NAME, /* equipment name */ + {FRONTEND_ID, 0, /* event ID, trigger mask */ "SYSTEM", /* event buffer */ EQ_SLOW, /* equipment type */ 0, /* event source */ -- 2.54.0