Gpib #1

Merged
soederqvist_a merged 7 commits from gpib into main 2026-08-26 09:10:44 +02:00
6 changed files with 98 additions and 86 deletions

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
[submodule "midas_lan_gpib"]
path = midas_lan_gpib
url = git@gitea.psi.ch:lin-midas-drivers/midas_lan_gpib.git
+75 -80
View File
@@ -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,88 +33,96 @@ set(MIDAS_LIBS
midas::mscb
)
set(LIBS ${SYS_LIBS} ${MIDAS_LIBS})
################################################################################
## 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)
set_property(
TARGET
lakeshore_340
PROPERTY
CXX_STANDARD 11
)
target_include_directories(
lakeshore_340
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/device>
${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
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/device>
${CMAKE_CURRENT_SOURCE_DIR}
)
target_link_libraries(
lakeshore_340_fe
lakeshore_340
${target}
${SYS_LIBS}
${MIDAS_LIBS}
)
endif()
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()
+4 -2
View File
@@ -19,10 +19,12 @@ cmake -S "$(pwd)" -B <directory-to-build-in> -DBUILD_FRONTEND=ON
cmake --build <directory-to-build-in> --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
+1 -1
View File
@@ -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
+14 -3
View File
@@ -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;
* <p>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 */
+1
Submodule midas_lan_gpib added at 32cc20d943.