Parametrize frontend #1

Merged
soederqvist_a merged 1 commits from condolidate_fe into main 2026-08-24 15:22:06 +02:00
2 changed files with 106 additions and 99 deletions

No files matched your search

+16 -19
View File
@@ -27,11 +27,6 @@ set(
"path to tcpip driver that should be used"
)
set(
DRIVERS
$ENV{MIDASSYS}/drivers/class/generic.cxx
)
set(LIBS
pthread
util
@@ -62,7 +57,6 @@ if(IS_DIRECTORY ${TCPIP_DRIVER_DIR})
else()
set(
DRIVERS
${DRIVERS}
${TCPIP_DRIVER_DIR}
)
endif()
@@ -100,35 +94,39 @@ target_link_libraries(pfeiffer_tpg252a
)
################################################################################
## Test Frontend
## Default Frontend builder
################################################################################
if(${BUILD_FRONTEND})
set(TPG252A_PRESSURE_CONTROLLER_FRONTEND_NAME "Pressure_Controller" CACHE STRING "Overridable frontend name")
set(_DEFAULT_TPGA252A_FRONTEND_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "")
function(default_tpga252a_frontend F_TARGET F_NAME F_EVENT_ID NUM_CH)
add_executable(
tpg252a_pressure_controller_scfe
frontend/pfeiffer_tpg252a_scfe.cxx
${F_TARGET}
${_DEFAULT_TPGA252A_FRONTEND_DIR}/frontend/pfeiffer_tpg252a_scfe.cxx
$ENV{MIDASSYS}/drivers/class/multi.cxx
)
add_compile_definitions(tpg252a_pressure_controller_scfe PRIVATE FRONTEND_NAME="${TPG252A_PRESSURE_CONTROLLER_FRONTEND_NAME}")
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 FRONTEND_CHANNELS=${NUM_CH})
set_property(
TARGET
tpg252a_pressure_controller_scfe
${F_TARGET}
PROPERTY
CXX_STANDARD 11
)
target_include_directories(
tpg252a_pressure_controller_scfe
${F_TARGET}
PRIVATE
$ENV{MIDASSYS}/drivers
)
find_package(Midas REQUIRED)
target_link_libraries(
tpg252a_pressure_controller_scfe
${F_TARGET}
PRIVATE
pfeiffer_tpg252a
midas::mfe
@@ -136,8 +134,7 @@ if(${BUILD_FRONTEND})
install(
TARGETS
tpg252a_pressure_controller_scfe
${F_TARGET}
RUNTIME DESTINATION bin
)
endif()
endfunction()
+90 -80
View File
@@ -1,163 +1,173 @@
/********************************************************************\
/*******************************************************************\
Name: frontend.c
Created by: RA35
Name: magnetVac_tpg252_scfe.cxx
Created by: Jonas A. Krieger
Contents: Slow control FE for Pfeiffer TPG252A
Contents: Slow control FE for Pfeiffer TPG252
\********************************************************************/
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include "midas.h"
#include "class/generic.h"
#include "pfeiffer_tpg252a.h"
#include "mfe.h"
#include "bus/tcpip.h"
#include "class/multi.h"
#include "pfeiffer_tpg252a.h"
#ifdef FORTIFY
#include "fortify.h"
#endif
//-- Globals -------------------------------------------------------
//#define TPG_FAST_READING /* do not sleep 5000 msec in frontend_loop() */
/*-- Globals -------------------------------------------------------*/
/* The frontend name (client name) as seen by other MIDAS clients */
//! The frontend name (client name) as seen by other MIDAS clients
const char *frontend_name = FRONTEND_NAME;
/* The frontend file name, don't change it */
//! The frontend file name, don't change it
const char *frontend_file_name = __FILE__;
/* frontend_loop is called periodically if this variable is TRUE */
//! frontend_loop is called periodically if this variable is TRUE
BOOL frontend_call_loop = FALSE;
/* a frontend status page is displayed with this frequency in ms */
//! a frontend status page is displayed with this frequency in ms
INT display_period = 1000;
/* maximum event size produced by this frontend */
//! maximum event size produced by this frontend
INT max_event_size = 10000;
/* maximum event size for fragmented events (EQ_FRAGMENTED) */
//! maximum event size for fragmented events (EQ_FRAGMENTED)
INT max_event_size_frag = 5*1024*1024;
/* buffer size to hold events */
//! buffer size to hold events
INT event_buffer_size = 10*10000;
extern BOOL should_exit;
/*!
//-- Equipment list ------------------------------------------------
/*!
* <p>device driver list for sample cryo and flow
*/
DEVICE_DRIVER magvac_tpg252_driver[] = {
{ "Pfeiffer_tpg252_in", pfeiffer_tpg252a, FRONTEND_CHANNELS, tcpip, DF_INPUT }, /*name, *dd, channels, *bd, flags */
{ "" }
};
/*!
* equipment_common_overwrite:
*
* - If that flag is TRUE, then the contents of the "equipment" structure is copied to
* - If that flag is TRUE, then the contents of the "equipment" structure is copied to
* the ODB on each start of the front-end.
*
* - If the flag is FALSE, then the ODB values are kept on the start of the front-end
*/
BOOL equipment_common_overwrite = FALSE;
/*-- Equipment list ------------------------------------------------*/
/* device driver list */
DEVICE_DRIVER pfeiffer_tpg252a_driver[] = {
/* initial demand value taken from instrument */
{ "PFEIFFER_TPG252A", pfeiffer_tpg252a, 2, tcpip, DF_READ_ONLY },
};
//! equipment structure for the mfe.c
EQUIPMENT equipment[] = {
{ FRONTEND_NAME, /* equipment name */
{91, 0, /* event ID, trigger mask */
"SYSTEM", /* event buffer */
EQ_SLOW, /* equipment type */
0, /* event source */
"FIXED", /* format */
TRUE, /* enabled */
{ FRONTEND_NAME, /* equipment name */
{FRONTEND_ID, 0, /* event ID, trigger mask */
"SYSTEM", /* event buffer */
EQ_SLOW, /* equipment type */
0, /* event source */
"FIXED", /* format */
TRUE, /* enabled */
RO_RUNNING |
RO_TRANSITIONS, /* read when running and on transitions */
60000, /* read every 60 sec */
0, /* stop run after this event limit */
0, /* number of sub events */
1, /* log history every event */
RO_TRANSITIONS, /* read when running and on transitions */
60000, /* read every 60 sec */
0, /* stop run after this event limit */
0, /* number of sub events */
1, /* log history every event */
"", "", ""},
cd_gen_read, /* readout routine */
cd_gen, /* class driver main routine */
pfeiffer_tpg252a_driver, /* device driver list */
NULL, /* init string */
cd_multi_read, /* readout routine */
cd_multi, /* class driver main routine */
magvac_tpg252_driver, /* device driver list */
NULL, /* init string */
},
{ "" }
{ "" }
};
/*-- Dummy routines ------------------------------------------------*/
INT poll_event(INT source, INT count, BOOL test) { return CM_SUCCESS; }
INT interrupt_configure(INT cmd, INT source, PTYPE adr) { return CM_SUCCESS; }
//-- Dummy routines ------------------------------------------------
/*-- Frontend Init -------------------------------------------------*/
INT poll_event(INT source, INT count, BOOL test) {return 1;};
INT interrupt_configure(INT cmd, INT source, POINTER_T adr) {return 1;};
//-- Frontend Init -------------------------------------------------
/*!
* <p>Called by the master frontend (mfe) at initializing stage.
* Here it is only a dummy.
*/
INT frontend_init()
{
// de-register run-transition notifications
cm_deregister_transition(TR_START);
cm_deregister_transition(TR_STOP);
cm_deregister_transition(TR_PAUSE);
cm_deregister_transition(TR_RESUME);
#ifdef FORTIFY
Fortify_CheckAllMemory();
#endif
return CM_SUCCESS;
}
/*-- Frontend Exit -------------------------------------------------*/
//-- Frontend Exit -------------------------------------------------
/*!
* <p>Called by the mfe at exiting stage.
* Here it is only a dummy.
*/
INT frontend_exit()
{
#ifdef FORTIFY
Fortify_CheckAllMemory();
Fortify_OutputStatistics();
#endif
return CM_SUCCESS;
}
/*-- Frontend Loop -------------------------------------------------*/
#ifdef FORTIFY
static DWORD last_time_fortify = 0;
#endif
//-- Frontend Loop -------------------------------------------------
/*!
* <p>Called by the mfe in the main loop.
* Here it is only a dummy.
*/
INT frontend_loop()
{
return CM_SUCCESS;
}
/*-- Begin of Run --------------------------------------------------*/
//-- Begin of Run --------------------------------------------------
/*!
* <p>Called by the mfe at the begin of the run.
* Here it is only a dummy.
*/
INT begin_of_run(INT run_number, char *error)
{
return CM_SUCCESS;
}
/*-- End of Run ----------------------------------------------------*/
//-- End of Run ----------------------------------------------------
/*!
* <p>Called by the mfe at the end of the run.
* Here it is only a dummy.
*/
INT end_of_run(INT run_number, char *error)
{
return CM_SUCCESS;
}
/*-- Pause Run -----------------------------------------------------*/
//-- Pause Run -----------------------------------------------------
/*!
* <p>Called by the mfe when the run is paused.
* Here it is only a dummy.
*/
INT pause_run(INT run_number, char *error)
{
return CM_SUCCESS;
}
/*-- Resume Run ----------------------------------------------------*/
//-- Resume Run ----------------------------------------------------
/*!
* <p>Called by the mfe when the run is resumed.
* Here it is only a dummy.
*/
INT resume_run(INT run_number, char *error)
{
return CM_SUCCESS;
}
/*------------------------------------------------------------------*/
//------------------------------------------------------------------