diff --git a/CMakeLists.txt b/CMakeLists.txt index 00cca72..bef8197 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,7 +53,7 @@ set(CMAKE_PREFIX_PATH "$ENV{MIDASSYS}") set(SIS1100_DIR "struck_sis1100-310x") -# Always build the library (even for test mode, we can define HAVE_TEST_RUN) +# Always build the library add_library(sis3100scal STATIC ${SIS1100_DIR}/sis3100_calls/sis3100_vme_calls.c ${SIS1100_DIR}/sis3100_calls/sharc_utils.c @@ -64,12 +64,6 @@ target_include_directories(sis3100scal ${SIS1100_DIR} ) -# --- TEST FRONTEND MODE --- -if (FRONTEND) - target_compile_definitions(sis3100scal PUBLIC HAVE_TEST_RUN) - message(STATUS "Building in TEST FRONTEND mode (no hardware required).") -endif () - # ============================================================================= # 5. Scaler Frontend Executable # ============================================================================= @@ -77,44 +71,41 @@ endif () set(_default_scaler_frontend_dir "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "") function(default_scaler_frontend F_TARGET F_NAME F_EVENT_ID NUM_CHANNELS) -add_executable(${F_TARGET} - ${_default_scaler_frontend_dir}/frontend/struck_sis3820_fcfe.cxx - ${_default_scaler_frontend_dir}/device/struck_sis3820.c - ${DRIVERS} -) + add_executable(${F_TARGET} + ${_default_scaler_frontend_dir}/frontend/struck_sis3820_fcfe.cxx + ${_default_scaler_frontend_dir}/device/struck_sis3820.c + ) -target_compile_definitions(${F_TARGET} PUBLIC FRONTEND_NAME="${F_NAME}") -target_compile_definitions(${F_TARGET} PUBLIC N_SCALER=${NUM_CHANNELS}) -target_compile_definitions(${F_TARGET} PUBLIC F_EVENT_ID=${F_EVENT_ID}) + target_compile_definitions(${F_TARGET} PUBLIC FRONTEND_NAME="${F_NAME}") + target_compile_definitions(${F_TARGET} PUBLIC N_SCALER=${NUM_CHANNELS}) + target_compile_definitions(${F_TARGET} PUBLIC F_EVENT_ID=${F_EVENT_ID}) -target_include_directories(${F_TARGET} - PRIVATE - $ENV{MIDASSYS}/include - $ENV{MIDASSYS}/drivers/kernel - $ENV{MIDASSYS}/drivers/divers - ${_DEFAULT_SCALER_FRONTEND_DIR} - ${_DEFAULT_SCALER_FRONTEND_DIR}/mxml - ${_DEFAULT_SCALER_FRONTEND_DIR}/device - ${SIS1100_DIR} - ${SIS1100_DIR}/sis3100_calls -) + target_include_directories(${F_TARGET} + PRIVATE + $ENV{MIDASSYS}/include + $ENV{MIDASSYS}/drivers/kernel + $ENV{MIDASSYS}/drivers/divers + ${_default_scaler_frontend_dir}/ + ${SIS1100_DIR} + ${SIS1100_DIR}/sis3100_calls + ) -find_package(Midas REQUIRED) -target_link_libraries(${F_TARGET} - PRIVATE - sis3100scal - midas::mfe - midas::midas - midas::mscb - z pthread util rt dl m -) + find_package(Midas REQUIRED) + target_link_libraries(${F_TARGET} + PRIVATE + sis3100scal + midas::mfe + midas::midas + midas::mscb + z pthread util rt dl m + ) -# ============================================================================= -# 6. Installation -# ============================================================================= + # ============================================================================= + # 6. Installation + # ============================================================================= -install( - TARGETS ${F_TARGET} - RUNTIME DESTINATION bin -) + install( + TARGETS ${F_TARGET} + RUNTIME DESTINATION bin + ) endfunction() diff --git a/device/struck_sis3820.c b/device/struck_sis3820.c index d625525..9788e6b 100644 --- a/device/struck_sis3820.c +++ b/device/struck_sis3820.c @@ -38,14 +38,7 @@ */ int sis3820_key_reset(int device, u_int32_t sis3820_base) { - int status; - -#ifdef HAVE_TEST_RUN - status = 0; -#else - status = vme_A32D32_write(device, sis3820_base+SIS3820_KEY_RESET, SIS3820_KEY_RESET); -#endif - return status; + return vme_A32D32_write(device, sis3820_base+SIS3820_KEY_RESET, SIS3820_KEY_RESET); } /*------ sis3820_key_enable -----------------------------------------------------*/ @@ -61,14 +54,7 @@ int sis3820_key_reset(int device, u_int32_t sis3820_base) */ int sis3820_key_enable(int device, u_int32_t sis3820_base) { - int status; - -#ifdef HAVE_TEST_RUN - status = 0; -#else - status = vme_A32D32_write(device, sis3820_base+SIS3820_KEY_OPERATION_ENABLE, SIS3820_KEY_OPERATION_ENABLE); -#endif - return status; + return vme_A32D32_write(device, sis3820_base+SIS3820_KEY_OPERATION_ENABLE, SIS3820_KEY_OPERATION_ENABLE); } /*------- sis3820_key_disable ----------------------------------------------------*/ @@ -83,27 +69,13 @@ int sis3820_key_enable(int device, u_int32_t sis3820_base) */ int sis3820_key_disable(int device, u_int32_t sis3820_base) { - int status; - -#ifdef HAVE_TEST_RUN - status = 0; -#else - status = vme_A32D32_write(device, sis3820_base+SIS3820_KEY_OPERATION_DISABLE, SIS3820_KEY_OPERATION_DISABLE); -#endif - return status; + return vme_A32D32_write(device, sis3820_base+SIS3820_KEY_OPERATION_DISABLE, SIS3820_KEY_OPERATION_DISABLE); } /*------------------------------------------------------------------------------*/ int sis3820_operation_mode_read(int device, u_int32_t sis3820_base, u_int32_t* mode) { - int status; - -#ifdef HAVE_TEST_RUN - status = 0; -#else - status = vme_A32D32_read(device, sis3820_base+SIS3820_OPERATION_MODE, mode); -#endif - return status; + return vme_A32D32_read(device, sis3820_base+SIS3820_OPERATION_MODE, mode); } /*------- sis3820_operation_mode_write -----------------------------------------*/ @@ -164,40 +136,19 @@ int sis3820_operation_mode_read(int device, u_int32_t sis3820_base, u_int32_t* m /*------------------------------------------------------------------------------*/ int sis3820_operation_mode_write(int device, u_int32_t sis3820_base, u_int32_t mode) { - int status; - -#ifdef HAVE_TEST_RUN - status = 0; -#else - status = vme_A32D32_write(device, sis3820_base+SIS3820_OPERATION_MODE, mode); -#endif - return status; + return vme_A32D32_write(device, sis3820_base+SIS3820_OPERATION_MODE, mode); } /*------------------------------------------------------------------------------*/ int sis3820_modid_read(int device, u_int32_t sis3820_base, u_int32_t* modid) { - int status; - -#ifdef HAVE_TEST_RUN - status = 0; -#else - status = vme_A32D32_read(device, sis3820_base+SIS3820_MODID, modid); -#endif - return status; + return vme_A32D32_read(device, sis3820_base+SIS3820_MODID, modid); } /*------------------------------------------------------------------------------*/ int sis3820_control_read(int device, u_int32_t sis3820_base, u_int32_t* control_status) { - int status; - -#ifdef HAVE_TEST_RUN - status = 0; -#else - status = vme_A32D32_read(device, sis3820_base+SIS3820_CONTROL_STATUS, control_status); -#endif - return status; + return vme_A32D32_read(device, sis3820_base+SIS3820_CONTROL_STATUS, control_status); } /*------- sis3820_control_write -----------------------------------------*/ @@ -228,14 +179,7 @@ int sis3820_control_read(int device, u_int32_t sis3820_base, u_int32_t* control_ *------------------------------------------------------------------------------*/ int sis3820_control_write(int device, u_int32_t sis3820_base, u_int32_t control_status) { - int status; - -#ifdef HAVE_TEST_RUN - status = 0; -#else - status = vme_A32D32_write(device, sis3820_base+SIS3820_CONTROL_STATUS, control_status); -#endif - return status; + return vme_A32D32_write(device, sis3820_base+SIS3820_CONTROL_STATUS, control_status); } /*------- sis3820_copy_disable_channel -------------------------------------------*/ @@ -252,14 +196,7 @@ int sis3820_control_write(int device, u_int32_t sis3820_base, u_int32_t control_ */ int sis3820_copy_disable_channel(int device, u_int32_t sis3820_base, u_int32_t channel_disable) { - int status; - -#ifdef HAVE_TEST_RUN - status = 0; -#else - status = vme_A32D32_write(device, sis3820_base+SIS3820_COPY_DISABLE, channel_disable); -#endif - return status; + return vme_A32D32_write(device, sis3820_base+SIS3820_COPY_DISABLE, channel_disable); } /*-------- sis3820_scaler_read ----------------------------------------------------*/ @@ -283,9 +220,6 @@ int sis3820_scaler_read(int device, u_int32_t sis3820_base, int mode, int nwords int status ; int gotwords; -#ifdef HAVE_TEST_RUN - status = 0; -#else status = -2; switch (mode) @@ -320,7 +254,6 @@ int sis3820_scaler_read(int device, u_int32_t sis3820_base, int mode, int nwords default: break; } -#endif return status; } diff --git a/frontend/struck_sis3820_fcfe.cxx b/frontend/struck_sis3820_fcfe.cxx index 88daab0..60d932d 100644 --- a/frontend/struck_sis3820_fcfe.cxx +++ b/frontend/struck_sis3820_fcfe.cxx @@ -200,9 +200,6 @@ INT frontend_init() flag_scaler_address_1 = FALSE;} /*--- VME initialization ---*/ -#ifdef HAVE_TEST_RUN - hdev = 0; -#else cm_msg(MINFO, "frontend_init","LINUX_VERSION = 0x%x",LINUX_VERSION_CODE); cm_yield(0); if (LINUX_VERSION_CODE < 0x20600) // for sis1100 drivers < V2, Linux kernel 2.4 @@ -216,7 +213,6 @@ INT frontend_init() cm_yield(0); return FE_ERR_HW; } -#endif //SIS3820 scaler initialization if (init_sis3820(SIS3820_ADDRESS_0) == FE_ERR_HW) @@ -427,11 +423,6 @@ INT interrupt_configure(INT cmd, INT source, PTYPE adr) *
Read out of scaler modules. *
* - *If HAVE_TEST_RUN is defined scaler entries - * of about 100 are thrown. If not defined - * use the function sis3820_read_scaler - * to read out the VME scaler module. - * *
Return:
* - bank size of scaler event
*
@@ -450,23 +441,6 @@ INT read_scaler_event(char *pevent, INT off)
bk_create(pevent, "SCL0", TID_DWORD, (void**)&pdata);
// read out scaler module /
-#ifdef HAVE_TEST_RUN
- int channel = 0;
- for (i=0; i