commit 35e7999c3f882f76f8a497f738f0b3f88a1eec94 Author: Timur A. Fatkhullin Date: Sun Dec 1 20:16:00 2024 +0300 Start developing ... diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4a0b530 --- /dev/null +++ b/.gitignore @@ -0,0 +1,74 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* +CMakeLists.txt.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..3729e87 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.16) + +project(RaptorEagleV LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}") + +find_package(spdlog REQUIRED) + +find_package(CFITSIO REQUIRED) +find_package(XCLIB REQUIRED) + +set(RAPTOR_EAGLEV_LIB raptor_eaglev) +add_library(${RAPTOR_EAGLEV_LIB} SHARED + raptor_eagle_ccd.h raptor_eagle_ccd.cpp + raptor_eagle_cameralink.h + raptor_eagle_exception.h) + +# to activate spdlog-library support in ADC-library +target_compile_definitions(${RAPTOR_EAGLEV_LIB} PRIVATE USE_SPDLOG_LIBRARY) +# !!!!! TEMPORARY !!!!! +target_include_directories(${RAPTOR_EAGLEV_LIB} PRIVATE "../ADC/") +target_include_directories(${RAPTOR_EAGLEV_LIB} PRIVATE ${XCLIB_INCLUDE_DIR}) +target_link_libraries(${RAPTOR_EAGLEV_LIB} PUPLIC spdlog::spdlog) + +add_executable(RaptorEagleV main.cpp) + +include(GNUInstallDirs) +install(TARGETS RaptorEagleV + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/FindCFITSIO.cmake b/FindCFITSIO.cmake new file mode 100644 index 0000000..107c978 --- /dev/null +++ b/FindCFITSIO.cmake @@ -0,0 +1,35 @@ +# +# Try to find CFITSIO library +# +# The module defines: +# CFITSIO_FOUND - system has CFITSIO library +# CFITSIO_LIBRARIES - libraries (cfitsio and m (if UNIX)) +# CFITSIO_INCLUDE_DIR - path to header file +# + +include(FindPackageHandleStandardArgs) + +if (UNIX) # assume on the UNIX platform the CFITSIO library was installed in standard way + find_path (CFITSIO_INCLUDE_DIR fitsio.h) + find_library (CFITSIO_LIBRARY NAMES cfitsio PATH_SUFFIXES lib lib64) + # CFITSIO needs -lm + find_library(MATH_LIBRARY m) + find_package_handle_standard_args(CFITSIO DEFAULT_MSG + CFITSIO_LIBRARY MATH_LIBRARY CFITSIO_INCLUDE_DIR) + mark_as_advanced(CFITSIO_INCLUDE_DIR CFITSIO_LIBRARY MATH_LIBRARY) + set(CFITSIO_LIBRARIES ${CFITSIO_LIBRARY} ${MATH_LIBRARY}) +elseif (WIN32) # user may set CFITSIO_INSTALL_DIR variable to detect header and library files + set(CFITSIO_INSTALL_DIR "" CACHE STRING "CFITSIO install dir") + set(CFITSIO_INSTALL_DIR_INTERNAL "" CACHE STRING "CFITSIO install dir") +# set(CFITSIO_INSTALL_DIR_INTERNAL "g:/PROGRAMS/LIBS/CFITSIO/" CACHE STRING "CFITSIO install dir") + if(NOT "${CFITSIO_INSTALL_DIR}" STREQUAL "${CFITSIO_INSTALL_DIR_INTERNAL}") # CFITSIO_INSTALL_DIR is given in command-line + unset(CFITSIO_LIBRARY CACHE) + unset(CFITSIO_INCLUDE_DIR CACHE) + endif() + find_path (CFITSIO_INCLUDE_DIR NAMES fitsio.h PATHS ${CFITSIO_INSTALL_DIR}) + find_library (CFITSIO_LIBRARY NAMES cfitsio PATHS ${CFITSIO_INSTALL_DIR}) + find_package_handle_standard_args(CFITSIO DEFAULT_MSG + CFITSIO_LIBRARY CFITSIO_INCLUDE_DIR) + mark_as_advanced(CFITSIO_INCLUDE_DIR CFITSIO_LIBRARY) + set(CFITSIO_LIBRARIES ${CFITSIO_LIBRARY}) +endif () diff --git a/FindXCLIB.cmake b/FindXCLIB.cmake new file mode 100644 index 0000000..8459c9c --- /dev/null +++ b/FindXCLIB.cmake @@ -0,0 +1,32 @@ +# +# Try to find or setup by user EPIX XClib library +# +# The module defines: +# XCLIB_FOUND - system has XCLIB library +# XCLIB_LIBRARIES - libraries +# XCLIB_INCLUDE_DIR - path to header file +# + +include(FindPackageHandleStandardArgs) + +set(XCLIB_INSTALL_DIR "" CACHE STRING "XCLIB instalation path") +set(XCLIB_INSTALL_DIR_INTERNAL "" CACHE STRING "XCLIB instalation path") + +if (NOT "${XCLIB_INSTALL_DIR}" STREQUAL "${XCLIB_INSTALL_DIR_INTERNAL}") + unset(XCLIB_INSTALL_DIR) + unset(XCLIB_INSTALL_DIR_INTERNAL) + find_path(XCLIB_INCLUDE_DIR NAMES xcliball.h PATHS ${XCLIB_INSTALL_DIR} ${XCLIB_INSTALL_DIR}/inc) +# find_library(XCLIB_LIBRARY NAMES kxclib_x86_64 xclib_x86_64 libkxclib_x86_64.so libxclib_x86_64.so +# xclibw64 PATHS ${XCLIB_INSTALL_DIR}) +# find_library(XCLIB_LIBRARY NAMES kxclib_x86_64 xclib_x86_64 xclibw64 PATHS ${XCLIB_INSTALL_DIR} ${XCLIB_INSTALL_DIR}/lib) + find_library(XCLIB_LIBRARY NAMES xclib_x86_64.so xclib_x86_64 xclibw64 PATHS ${XCLIB_INSTALL_DIR} ${XCLIB_INSTALL_DIR}/lib) +else() # try to find in system default paths + find_path (XCLIB_INCLUDE_DIR xcliball.h) + find_library (XCLIB_LIBRARY NAMES kxclib_x86_64 xclib_x86_64 xclibw64) +endif() + +find_package_handle_standard_args(XCLIB DEFAULT_MSG + XCLIB_LIBRARY XCLIB_INCLUDE_DIR) +mark_as_advanced(XCLIB_INCLUDE_DIR XCLIB_LIBRARY) +set(XCLIB_LIBRARIES ${XCLIB_LIBRARY}) + diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..3129fb9 --- /dev/null +++ b/main.cpp @@ -0,0 +1,9 @@ +#include + +using namespace std; + +int main() +{ + cout << "Hello World!" << endl; + return 0; +} diff --git a/raptor_eagle-v.fmt b/raptor_eagle-v.fmt new file mode 100644 index 0000000..7fe6463 --- /dev/null +++ b/raptor_eagle-v.fmt @@ -0,0 +1,649 @@ + +/* + * Structure: pxvidformat + * Copyright: (C) EPIX, Inc. 2000-2016 + * Created: Thu Feb 23 13:04:13 2017 + * By: EPIX(r) XCAP V3.8 + * PIXCI(R) 64 Bit Library 3.08.01 [16.03.02] + * PIXCI(R) 64 Bit Driver V3.8.013.18.25-gentoo-r1 + * OS: Linux 64 bit + */ +struct pxvidformat pxvidformat_561_id31232 = +{ + 1988, /* ddch.len */ + 561, /* ddch.mos */ + 0, /* ddch.id */ + 0, /* ddch.op */ + 0, /* ddch.un */ + 0, /* ddch.rw */ + 0, /* ddch.fu */ + 0, /* ddch.rs */ + 30819, /* fgfamily */ + 38, /* fgmodel */ + 16143, /* fgsubmodel */ + 0, /* fgcustomid */ + 2014, 2, 19, /* fgdefdate */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, /* fgcamera */ + 0, /* fgsignature */ + 0, 0, 1, 0, /* fgcamdope */ + 4, 2048, 0, 4, /* xviddim */ + 4, 2048, 0, 4, /* xdatdim */ + 1, 2048, 0, 0, /* yviddim */ + 1, 2048, 0, 0, /* ydatdim */ + 0, 2048, 0, 0, /* xvidoffset */ + 0, 2048, 0, 0, /* yvidoffset */ + 0, 0, 0, 0, /* xvidoffdim */ + 0, 0, 0, 0, /* yvidoffdim */ + 1, 1, 0, 0, /* datfields */ + 1, 1, 0, 0, /* datchannels */ + 1, 1, 0, 0, /* datphylds */ + 0, 0, 0, 0, /* rsvd2 */ + 1, 1, 1, 0, /* vidylaces */ + 1, 1, 1, 0, /* vidchannels */ + 0, 0, 0, 0, 0, 0, 0, 0, /* inputmuxs */ + 0, 0, 0, 0, 0, 0, 0, 0, /* outputmuxs */ + 0, 0, 0, 0, 0, 0, 0, 0, /* splitscreens */ + 2, 0, 0, 0, 0, 0, 0, 0, /* syncsources */ + 31232, 25088, 0, 0, 0, 0, 0, 0, /* videomodes */ + 1, 0, 0, 0, 0, 0, 0, 0, /* fieldmods */ + 1, 2147483647, 0, 0, /* buffers */ + 1, 1, 1, 0, /* vidxlaces */ + 0, 0, 0, 0, /* rsvd3 */ + 0, /* as.hoffset */ + 0, /* as.voffset */ + 0, /* as.fieldsperframe */ + 0, /* as.pixelsperclock */ + 0, /* as.pixiesperclock */ + 0, /* as.linesperframe */ + 0, /* as.pixelsperline */ + 0, 0, /* as.pixelclkfreq */ + 0, 0, /* as.vperiod */ + 0, 0, /* as.hperiod */ + 0, 0, /* as.framerate */ + 0, /* as.fieldperiodicity */ + 0, /* as.lineperiodicity */ + 0, /* as.hscanorder */ + 0, /* as.vscanorder */ + 0, /* as.framespertrigger */ + 0, /* as.scanclass */ + 0, /* as.phyldsperframe */ + 0, 0, 0, 0, 0, 0, 0, /* as.rsvd4 */ + 0, /* is.hoffset */ + 0, /* is.voffset */ + 1, /* is.fieldsperframe */ + 1, /* is.pixelsperclock */ + 0, /* is.pixiesperclock */ + 0, /* is.linesperframe */ + 0, /* is.pixelsperline */ + 40000, 1000, /* is.pixelclkfreq */ + 1000, 420, /* is.vperiod */ + 1000, 860160, /* is.hperiod */ + 420, 1000, /* is.framerate */ + 1, /* is.fieldperiodicity */ + 1, /* is.lineperiodicity */ + 108, /* is.hscanorder */ + 116, /* is.vscanorder */ + 1, /* is.framespertrigger */ + 2, /* is.scanclass */ + 1, /* is.phyldsperframe */ + 0, 0, 0, 0, 0, 0, 0, /* is.rsvd4 */ + 1, 1, /* pixelwidth */ + 1, 1, /* pixelheight */ + 0, 0, /* pixeldepth */ + 114, /* widthunits */ + 114, /* heightunits */ + 0, /* depthunits */ + 1, /* boardspercamera */ + 0, /* linesyncupdelay */ + 0, /* fieldsyncupdelay */ + 0, /* framesyncupdelay */ + 0, /* fieldflip */ + 1000, /* nosynctimeout */ + 0, /* phyldflip */ + 0, /* prefixdata */ + 0, /* postfixdata */ + 0, /* imagesperframe */ + 0x0, /* camlinkconfig */ + 0, 0, 0, /* rsvd5 */ + 1, 0, 0, 0, 0, 0, 0, 0, /* vid.pixhints */ + 16, 16, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, /* vid.pixbits */ + 2, 0, 0, 0, 0, 0, 0, 0, /* vid.pixmems */ + 215012, 215016, 215020, 215024, 215028, 215032, 215036, 214976, /* vid.pixdopes */ + 1, 0, 0, 0, 0, 0, 0, 0, /* dat.pixhints */ + 16, 16, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, /* dat.pixbits */ + 2, 0, 0, 0, 0, 0, 0, 0, /* dat.pixmems */ + 6724, 6728, 6732, 6736, 6740, 6744, 6748, 7072, /* dat.pixdopes */ + 0, 0, 0, 0, 0, 0, 0, 0, /* img.pixhints */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, /* img.pixbits */ + 0, 0, 0, 0, 0, 0, 0, 0, /* img.pixmems */ + 624884, 624888, 624892, 624864, 624868, 624872, 624876, 624848, /* img.pixdopes */ +}; + +/* + * Structure: pxvidres + * Copyright: (C) EPIX, Inc. 2000-2016 + * Created: Thu Feb 23 13:04:13 2017 + * By: EPIX(r) XCAP V3.8 + * PIXCI(R) 64 Bit Library 3.08.01 [16.03.02] + * PIXCI(R) 64 Bit Driver V3.8.013.18.25-gentoo-r1 + * OS: Linux 64 bit + */ +struct pxvidres pxvidres_125_id31232 = +{ + 492, /* ddch.len */ + 125, /* ddch.mos */ + 0, /* ddch.id */ + 0, /* ddch.op */ + 0, /* ddch.un */ + 0, /* ddch.rw */ + 0, /* ddch.fu */ + 0, /* ddch.rs */ + 2048, /* x.datsamples */ + 2048, /* x.vidsamples */ + 0, /* x.vidoffset */ + 2047, /* x.vidoffsend */ + 0, 0, 0, 0, 0, 0, 0, 0, /* x.rsvd */ + 3, /* x.setmaxdatsamples */ + 3, /* x.setmaxvidsamples */ + 1, /* x.setmidvidoffset */ + 0, /* x.vs.on */ + 0, 0, 0, 0, 0, 0, 0, 0, /* x.vs.parm */ + 0, /* x.sv.on */ + 0, /* x.sv.pos */ + 0, /* x.sv.spc */ + 2048, /* y.datsamples */ + 2048, /* y.vidsamples */ + 0, /* y.vidoffset */ + 2047, /* y.vidoffsend */ + 0, 0, 0, 0, 0, 0, 0, 0, /* y.rsvd */ + 3, /* y.setmaxdatsamples */ + 3, /* y.setmaxvidsamples */ + 1, /* y.setmidvidoffset */ + 0, /* y.vs.on */ + 0, 0, 0, 0, 0, 0, 0, 0, /* y.vs.parm */ + 0, /* y.sv.on */ + 0, /* y.sv.pos */ + 0, /* y.sv.spc */ + 1, /* datfields */ + 1, /* datchannels */ + 1, /* setmaxdatfields */ + 1, /* setmaxdatchannels */ + 1, /* datphylds */ + 1, /* setmaxdatphylds */ + 0, 0, 0, 0, 0, 0, /* rsvd1 */ + 1, /* vid.pixies */ + 16, 0, 0, 0, /* vid.pixiebits */ + 1, /* vid.pixhint */ + 2, /* vid.pixmem */ + 215012, /* vid.pixdope */ + 0, /* vid.setpixbits */ + 1, /* dat.pixies */ + 16, 0, 0, 0, /* dat.pixiebits */ + 1, /* dat.pixhint */ + 2, /* dat.pixmem */ + 6724, /* dat.pixdope */ + 0, /* dat.setpixbits */ + 1, /* img.pixies */ + 16, 0, 0, 0, /* img.pixiebits */ + 1, /* img.pixhint */ + 0, /* img.pixmem */ + 624884, /* img.pixdope */ + 0, /* img.setpixbits */ + 4096, /* line.pd */ + 4096, /* line.pdod */ + 4096, /* line.pdodal */ + 4096, /* line.pdodalsf */ + 0, /* line.rsvd2 */ + 8388608, /* field.pd */ + 8388616, /* field.pdod */ + 8388672, /* field.pdodal */ + 8388672, /* field.pdodalsf */ + 0, /* field.rsvd2 */ + 8388608, /* frame.pd */ + 8388616, /* frame.pdod */ + 8388672, /* frame.pdodal */ + 8388672, /* frame.pdodalsf */ + 0, /* frame.rsvd2 */ + 3, /* framebuffers */ + 0, /* rsvdbuffers */ + 0, 0, 0, 0, 0, 0, 0, /* rsvd3 */ +}; + +/* + * Structure: pxvidmode + * Copyright: (C) EPIX, Inc. 2000-2016 + * Created: Thu Feb 23 13:04:13 2017 + * By: EPIX(r) XCAP V3.8 + * PIXCI(R) 64 Bit Library 3.08.01 [16.03.02] + * PIXCI(R) 64 Bit Driver V3.8.013.18.25-gentoo-r1 + * OS: Linux 64 bit + */ +struct pxvidmode pxvidmode_79_id31232 = +{ + 304, /* ddch.len */ + 79, /* ddch.mos */ + 0, /* ddch.id */ + 0, /* ddch.op */ + 0, /* ddch.un */ + 0, /* ddch.rw */ + 0, /* ddch.fu */ + 0, /* ddch.rs */ + 1, /* vidchannels */ + 1, /* buffer */ + 0, /* panxy.x */ + 0, /* panxy.y */ + 0, /* useimphys */ + 0, 0, 0, 0, 0, 0, 0, 0, /* rsvd2 */ + 31232, 0, 0, 0, /* vidmode */ + 1, 0, 0, 0, /* vidylace */ + 2, 0, 0, 0, /* syncsource */ + 0, 0, 0, 0, /* vidopt */ + 0, 0, 0, 0, /* inputmux */ + 0, 0, 0, 0, /* outputmux */ + 0, 0, 0, 0, /* splitscreen */ + 1, 0, 0, 0, /* fieldmod */ + 1, 0, 0, 0, /* vidxlace */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, /* rsvd1 */ + 1, /* setmaxvidylace */ + 1, /* setmaxvidchannels */ + 1, /* setmaxvidxlace */ + 0, 0, 0, 0, 0, 0, 0, /* rsvd3 */ +}; + +/* + * Structure: pxvidphys + * Copyright: (C) EPIX, Inc. 2000-2016 + * Created: Thu Feb 23 13:04:13 2017 + * By: EPIX(r) XCAP V3.8 + * PIXCI(R) 64 Bit Library 3.08.01 [16.03.02] + * PIXCI(R) 64 Bit Driver V3.8.013.18.25-gentoo-r1 + * OS: Linux 64 bit + */ +struct pxvidphys pxvidphys_118_id31232 = +{ + 660, /* ddch.len */ + 118, /* ddch.mos */ + 0, /* ddch.id */ + 0, /* ddch.op */ + 0, /* ddch.un */ + 0, /* ddch.rw */ + 0, /* ddch.fu */ + 0, /* ddch.rs */ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, /* startadrs */ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, /* endadrs */ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, /* linelength */ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, /* linestride */ + 0x0, /* bufadrs */ + 0x0, /* bufsize */ + 0, /* bufxdim */ + 0, /* bufydim */ + 0, /* bufidim */ + 0, /* bufzdim */ + 0, /* upatita */ + 0, /* bufjdim */ + 0, 0, 0, /* rsvd */ + 0, /* buffer */ + 0, /* stateid */ + 0, /* tracker */ +}; + +/* + * Structure: pxvidimage + * Copyright: (C) EPIX, Inc. 2000-2016 + * Created: Thu Feb 23 13:04:13 2017 + * By: EPIX(r) XCAP V3.8 + * PIXCI(R) 64 Bit Library 3.08.01 [16.03.02] + * PIXCI(R) 64 Bit Driver V3.8.013.18.25-gentoo-r1 + * OS: Linux 64 bit + */ +struct pxvidimage pxvidimage_251_id31232 = +{ + 996, /* ddch.len */ + 251, /* ddch.mos */ + 0, /* ddch.id */ + 0, /* ddch.op */ + 0, /* ddch.un */ + 0, /* ddch.rw */ + 0, /* ddch.fu */ + 0, /* ddch.rs */ + 0, /* mt.order */ + 0, /* mt.mode */ + 0, 0, 0, 0, /* mt.arg */ + 0, /* bp.order */ + 0, /* bp.mode */ + 0, 0, 0, 0, /* bp.arg */ + 0, /* cs.order */ + 0, /* cs.mode */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, /* cs.intorgb */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, /* cs.fromrgb */ + 0, /* cs.scale */ + 0, /* wb.order */ + 0, /* wb.mode */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, /* wb.darkreference */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, /* wb.darktarget */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, /* wb.brightreference */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, /* wb.brighttarget */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, /* wb.gamma */ + 0, /* pc.order */ + 0, /* pc.mode */ + 0, 0, 0, 0, /* pc.arg */ + 0, /* sc.order */ + 0, /* sc.mode */ + 0, 0, 0, 0, /* sc.arg */ + 0, /* rz.order */ + 0, /* rz.mode */ + 0, /* rz.xdim */ + 0, /* rz.ydim */ + 0, 0, /* rz.arg */ + 0, /* go.order */ + 0, /* go.mode */ + 0, 0, /* go.offsbuffer */ + 0, 0, /* go.gainbuffer */ + 0, 0, 0, 1020108808, 0, 0, /* go.arg */ + 0, 0, /* go.dfctbuffer */ + 0, /* no.order */ + 0, /* no.mode */ + 0, 0, 0, 0, 0, 0, 0, 0, /* no.black */ + 0, 0, 0, 0, 0, 0, 0, 0, /* no.coef1 */ + 0, 0, 0, 0, 0, 0, 0, 0, /* no.coef2 */ + 0, /* no.scale */ + 0, 0, 0, /* no.arg */ + 0, /* sh.order */ + 0, /* sh.mode */ + 0, 0, 0, /* sh.into */ + 0, 0, 0, /* sh.from */ + 0, /* sh.scale */ + 0, 0, /* sh.arg */ + 0, 0, 0, 0, /* cs2.arg */ + 0, /* pp.order */ + 0, /* pp.mode */ + 0, 0, 0, 0, /* pp.arg */ + 0, /* rsvd1 */ +}; + +/* + * Structure: pxvidopt + * Copyright: (C) EPIX, Inc. 2000-2016 + * Created: Thu Feb 23 13:04:13 2017 + * By: EPIX(r) XCAP V3.8 + * PIXCI(R) 64 Bit Library 3.08.01 [16.03.02] + * PIXCI(R) 64 Bit Driver V3.8.013.18.25-gentoo-r1 + * OS: Linux 64 bit + */ +struct pxvidopt pxvidopt_19_id31232 = +{ + 60, /* ddch.len */ + 19, /* ddch.mos */ + 0, /* ddch.id */ + 0, /* ddch.op */ + 0, /* ddch.un */ + 0, /* ddch.rw */ + 0, /* ddch.fu */ + 0, /* ddch.rs */ + 0, /* imopstate */ + 0, /* imopmode */ + 0, /* panwraprnd */ + 0, 0, 0, 0, 0, 0, 0, 0, /* rsvd */ +}; + +/* + * Structure: pxvidmem + * Copyright: (C) EPIX, Inc. 2000-2016 + * Created: Thu Feb 23 13:04:13 2017 + * By: EPIX(r) XCAP V3.8 + * PIXCI(R) 64 Bit Library 3.08.01 [16.03.02] + * PIXCI(R) 64 Bit Driver V3.8.013.18.25-gentoo-r1 + * OS: Linux 64 bit + */ +struct pxvidmem pxvidmem_72_id31232 = +{ + 528, /* ddch.len */ + 72, /* ddch.mos */ + 0, /* ddch.id */ + 0, /* ddch.op */ + 0, /* ddch.un */ + 0, /* ddch.rw */ + 0, /* ddch.fu */ + 0, /* ddch.rs */ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, /* space */ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, /* start */ + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, /* length */ + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, /* rsvd */ +}; + +/* + * Structure: pxcamcntl + * Copyright: (C) EPIX, Inc. 2000-2016 + * Created: Thu Feb 23 13:04:13 2017 + * By: EPIX(r) XCAP V3.8 + * PIXCI(R) 64 Bit Library 3.08.01 [16.03.02] + * PIXCI(R) 64 Bit Driver V3.8.013.18.25-gentoo-r1 + * OS: Linux 64 bit + */ +struct pxcamcntl pxcamcntl_264_id31232 = +{ + 800, /* ddch.len */ + 264, /* ddch.mos */ + 0, /* ddch.id */ + 0, /* ddch.op */ + 0, /* ddch.un */ + 0, /* ddch.rw */ + 0, /* ddch.fu */ + 0, /* ddch.rs */ + 0, /* fgfamily */ + 0, /* fgmodel */ + 0, /* fgsubmodel */ + 0, /* fgcustomid */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, /* fgcamera */ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, /* rsvd1 */ + 0, /* cntlmode */ + 0, /* cntlcntinit */ + 0, /* cntlcntadj */ + 0, /* cntlcntdeinit */ + 0, 0, 0, 0, 0, 0, 0, 0, /* cntlparms */ + 0, /* cntlcntxmteot */ + 0, /* cntlcntrcveot */ + 0, /* cntloptions */ + 0, /* cntlcntreset */ + 0, /* cntlrcvtout */ + 0, /* cntlrsttout */ + 0, /* cntlretries */ + 0, /* cntlpause */ + 0, /* cntlthrottle */ + 0, /* cntladrs */ + 0, /* cntlcntrcvmask */ + 0, 0, 0, 0, 0, /* rsvd2 */ + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, /* cntldata.data32 */ +}; + +/* + * Structure: xcsv2format + * Copyright: (C) EPIX, Inc. 2000-2016 + * Created: Thu Feb 23 13:04:13 2017 + * By: EPIX(r) XCAP V3.8 + * PIXCI(R) 64 Bit Library 3.08.01 [16.03.02] + * PIXCI(R) 64 Bit Driver V3.8.013.18.25-gentoo-r1 + * OS: Linux 64 bit + */ +struct xcsv2format xcsv2format_32_id31232 = +{ + 48, /* ddch.len */ + 32, /* ddch.mos */ + 0, /* ddch.id */ + 0, /* ddch.op */ + 0, /* ddch.un */ + 0, /* ddch.rw */ + 0, /* ddch.fu */ + 0, /* ddch.rs */ + 0, /* Bt8x9format */ + 0, /* Bt8x9xtal */ + 0, /* Bt8x9control */ + 0, /* Bt819oform */ + 0, /* Bt819vscale */ + 0, /* Bt819adc */ + 0, /* Bt829oform */ + 0, /* Bt829vscale */ + 0, /* Bt829adc */ + 0, /* Bt829vtc */ + 0, /* Bt829scloop */ + 0, /* Bt848adc */ + 0, /* Bt848clrctl */ + 0, /* Bt819options */ + 0, /* Bt848faultmask */ + 0, /* Bt848haltmask */ + 0, 0, 0, 0, 0, 0, 0, 0, /* rsvd */ +}; + +/* + * Structure: xcsv2mode + * Copyright: (C) EPIX, Inc. 2000-2016 + * Created: Thu Feb 23 13:04:13 2017 + * By: EPIX(r) XCAP V3.8 + * PIXCI(R) 64 Bit Library 3.08.01 [16.03.02] + * PIXCI(R) 64 Bit Driver V3.8.013.18.25-gentoo-r1 + * OS: Linux 64 bit + */ +struct xcsv2mode xcsv2mode_21_id31232 = +{ + 40, /* ddch.len */ + 21, /* ddch.mos */ + 0, /* ddch.id */ + 0, /* ddch.op */ + 0, /* ddch.un */ + 0, /* ddch.rw */ + 0, /* ddch.fu */ + 0, /* ddch.rs */ + 0, /* brightness */ + 0, /* hue */ + 0, /* lumagain */ + 0, /* chromaUgain */ + 0, /* chromaVgain */ + 0, 0, 0, 0, 0, 0, 0, 0, /* rsvd */ +}; + +/* + * Structure: xcdxxformat + * Copyright: (C) EPIX, Inc. 2000-2016 + * Created: Thu Feb 23 13:04:13 2017 + * By: EPIX(r) XCAP V3.8 + * PIXCI(R) 64 Bit Library 3.08.01 [16.03.02] + * PIXCI(R) 64 Bit Driver V3.8.013.18.25-gentoo-r1 + * OS: Linux 64 bit + */ +struct xcdxxformat xcdxxformat_45_id31232 = +{ + 124, /* ddch.len */ + 45, /* ddch.mos */ + 0, /* ddch.id */ + 0, /* ddch.op */ + 0, /* ddch.un */ + 0, /* ddch.rw */ + 0, /* ddch.fu */ + 0, /* ddch.rs */ + 0x0, /* PRINC */ + 0x0, /* EXSYNC */ + 0x0, /* exsync */ + 0x0, /* prin */ + 0x0, /* MWETS */ + 0x0, /* LCD */ + 0x0, /* PLLMX */ + 0, /* clampreference */ + 0, /* pixelclkreference */ + 0, 0, /* sdclkfreq */ + 0, /* SDIET */ + 0x0, /* PCWD */ + 0x2, /* CLCCSE */ + 0x0, /* TEST */ + 0x0, /* CLCCSEhi */ + 0x0, /* MSSMUB */ + 0x0, /* ToucanOpt */ + 0x0, /* ToucanCoef1 */ + 0x0, /* ToucanCoef2 */ + 0x0, /* ToucanCoef3 */ + 0, 0, 0, 0, /* exsyncinfo */ + 0, 0, 0, 0, /* prininfo */ + 0x0, /* XXX */ + 0x0, /* CLCCGP */ + 0x0, /* MSSMUBhi */ + 0, 0, 0, 0, 0, /* rsvd2 */ +}; diff --git a/raptor_eagle_cameralink.h b/raptor_eagle_cameralink.h new file mode 100644 index 0000000..6450ee5 --- /dev/null +++ b/raptor_eagle_cameralink.h @@ -0,0 +1,108 @@ +#pragma once + +#include + +/* + CAMERALINK PROTOCOL DEFINITIONS + TO MANAGE RAPTOR EAGLE V 4240 CAMERA + + */ + + +/* from EAGLE V 4240 Instruction Manual Revision 1.1 */ + + +// default port settings +// the values are ones for EB1 grabber card (see XCLIB Reference manual) + +// default read/write operation timeout in milliseconds (1 second) +static constexpr std::chrono::duration CL_DEFAULT_TIMEOUT = std::chrono::milliseconds(1000); + + +static constexpr int CL_DEFAULT_BAUD_RATE = 115200; +static constexpr int CL_DEFAULT_START_BIT = 1; +static constexpr int CL_DEFAULT_DATA_BITS = 8; +static constexpr int CL_DEFAULT_STOP_BIT = 1; + +static constexpr bool CL_DEFAULT_ACK_ENABLED = true; +static constexpr bool CL_DEFAULT_CHK_SUM_ENABLED = true; + +// ETX/ERROR codes + +static constexpr char CL_ETX = 0x50; +static constexpr char CL_ETX_SER_TIMEOUT = 0x51; +static constexpr char CL_ETX_CK_SUM_ERR = 0x52; +static constexpr char CL_ETXI2C_ERR = 0x53; +static constexpr char CL_ETX_UNKNOWN_CMD = 0x54; +static constexpr char CL_ETX_DONE_LOW = 0x55; + + +/* BIT MASKS (0-7 bits) */ + +// system state + +static constexpr char CL_SYSTEM_STATE_CK_SUM = 0x40; // 6-th bit +static constexpr char CL_SYSTEM_STATE_ACK = 0x10; // 4-th bit +static constexpr char CL_SYSTEM_STATE_FPGA_BOOT_OK = 0x4; // 2-nd bit +static constexpr char CL_SYSTEM_STATE_FPGA_RST_HOLD = 0x2; // 1-st bit +static constexpr char CL_SYSTEM_STATE_FPGA_EEPROM_COMMS = 0x1; // 0-th bit + +// FPGA CTRL register + +static constexpr char CL_FPGA_CTRL_REG_HIGH_GAIN = 0x80; // 7-th bit (0 if high pre-amp gain) +static constexpr char CL_FPGA_CTRL_REG_TMP_TRIP_RST = 0x2; // 1-st bit +static constexpr char CL_FPGA_CTRL_REG_ENABLE_TEC = 0x1; // 0-th bit + +// trigger mode + +static constexpr char CL_TRIGGER_MODE_ENABLE_RISING_EDGE = 0x80; // 7-th bit +static constexpr char CL_TRIGGER_MODE_EXT_TRIGGER = 0x40; // 6-th bit +static constexpr char CL_TRIGGER_MODE_ABORT_CURRENT_EXP = 0x8; // 3-rd bit +static constexpr char CL_TRIGGER_MODE_CONTINUOUS_SEQ = 0x4; // 2-nd bit +static constexpr char CL_TRIGGER_MODE_FIXED_FRAME_RATE = 0x2; // 1-st bit +static constexpr char CL_TRIGGER_MODE_SNAPSHOT = 0x1; // 0-th bit + + +/* SETUP CONTROL VALUES */ + +// shutter + +static constexpr char CL_SHUTTER_CLOSED = 0x0; +static constexpr char CL_SHUTTER_OPEN = 0x1; +static constexpr char CL_SHUTTER_EXP = 0x2; + +// readout rate (registers values) + +static constexpr char CL_READOUT_CLOCK_RATE_A3_2MHZ = 0x02; +static constexpr char CL_READOUT_CLOCK_RATE_A4_2MHZ = 0x02; +static constexpr char CL_READOUT_CLOCK_RATE_A3_75KHZ = 0x43; +static constexpr char CL_READOUT_CLOCK_RATE_A4_75KHZ = 0x80; + +// readout mode + +static constexpr char CL_READOUT_MODE_NORMAL = 0x01; +static constexpr char CL_READOUT_MODE_TEST = 0x04; + + +static constexpr double ADC_CALIBRATION_POINT_1 = 0.0; // at 0 Celcius degree +static constexpr double ADC_CALIBRATION_POINT_2 = 40.0; // at +40 Celcius degree + +static constexpr double DAC_CALIBRATION_POINT_1 = 0.0; // at 0 Celcius degree +static constexpr double DAC_CALIBRATION_POINT_2 = 40.0; // at +40 Celcius degree + + +/* COMMANDS */ + +static unsigned char CL_COMMAND_SET_ADDRESS[] = { + 0x53, 0xE0, 0x01, 0x00}; // set address given by the last byte. the last byte should be set by user) + +static unsigned char CL_COMMAND_READ_VALUE[] = {0x53, 0xE1, 0x01}; // read a byte value + +static unsigned char CL_COMMAND_WRITE_VALUE[] = {0x53, 0xE0, 0x02, 0x00, + 0x00}; // write a byte value given by the last byte + // at address given by 3-rd byte (starting from 0) + +static constexpr unsigned char CL_COMMAND_GET_MANUFACTURER_DATA_1[] = { + 0x53, 0xAE, 0x05, 0x01, 0x00, 0x00, 0x02, 0x00}; // 1st command to get manufacturer's data + +static constexpr unsigned char CL_COMMAND_GET_MANUFACTURER_DATA_2[] = {0x53, 0xAF, 0x12}; // the second one diff --git a/raptor_eagle_ccd.cpp b/raptor_eagle_ccd.cpp new file mode 100644 index 0000000..54bf87a --- /dev/null +++ b/raptor_eagle_ccd.cpp @@ -0,0 +1,83 @@ +#include +#include + +#include "raptor_eagle_cameralink.h" +#include "raptor_eagle_ccd.h" +#include "raptor_eagle_exception.h" + + +#define DEFAULT_EPIX_VIDEO_FMT_FILE "raptor_eagle-v.fmt" + +/* CONSTRUCTORS AND DESTRUCTOR */ + +RaptorEagleCCD::RaptorEagleCCD(const adc::traits::adc_input_char_range auto& epix_video_fmt_filename, + std::shared_ptr logger) + : base_t("EagleCCD"), adc::AdcSpdlogLogger(logger) +{ + addMarkToPattern("EAGLE-CCD"); + + std::ranges::copy(epix_video_fmt_filename, std::back_inserter(_epixFmtVideoFilename)); + + logDebug("CTOR: Create RaptorEagleCCD class instance"); + if (_epixFmtVideoFilename.empty()) { + logDebug("Video format filename is not set! Use of default: {}", DEFAULT_EPIX_VIDEO_FMT_FILE); + } else { + logDebug("Set video format filename: {}", _epixFmtVideoFilename); + } +} + + +RaptorEagleCCD::RaptorEagleCCD(std::shared_ptr logger) + : RaptorEagleCCD(std::string_view(), std::move(logger)) +{ +} + + +RaptorEagleCCD::~RaptorEagleCCD() +{ + logDebug("DTOR: Delete RaptorEagleCCD class instance"); +} + + +/* PRIVATE METHODS */ + +void RaptorEagleCCD::initCamera(int unitmap) +{ + logInfo("Try to init camera with unitmap: {} ...", unitmap); + + if (unitmap < 0) { + throw std::system_error(RaptorEagleCCDError::ERROR_INVALID_UNITMAP); + } + + _cameraUnitmap = unitmap; + + logInfo("Camera with unit '{}' is initialized", _cameraUnitmap); +} + + +void RaptorEagleCCD::openPIXCI() +{ + if (_epixFmtVideoFilename.size()) { + xclibApiCall(pxd_PIXCIopen("", nullptr, _epixFmtVideoFilename.c_str()), + std::format("pxd_PIXCIopen(\"\", NULL, {})", _epixFmtVideoFilename)); + } else { + xclibApiCall(pxd_PIXCIopen("", "DEFAULT", ""), "pxd_PIXCIopen(\"\", \"DEFAULT\", \"\")"); + +#include DEFAULT_EPIX_VIDEO_FMT_FILE // exported from XCAP (Linux 64-bit!): bin 1x1, full CCD frame + pxd_videoFormatAsIncludedInit(0); + xclibApiCall(pxd_videoFormatAsIncluded(0), "pxd_videoFormatAsIncluded(0)"); + } +} + + +void RaptorEagleCCD::closePIXCI() +{ + // no exception here!!! + xclibApiCall(pxd_PIXCIclose(), "pxd_PIXCIclose()"); +} + + +void RaptorEagleCCD::initAttrComm() +{ + addAttribute(CAMERA_ATTR_EXPTIME, []() {}); +} diff --git a/raptor_eagle_ccd.h b/raptor_eagle_ccd.h new file mode 100644 index 0000000..e86ecf0 --- /dev/null +++ b/raptor_eagle_ccd.h @@ -0,0 +1,88 @@ +#pragma once + +#include + +#include +#include +#include +#include + +#include + +#include "raptor_eagle_exception.h" + + +class RaptorEagleCCD : public adc::AdcGenericDevice, adc::AdcDeviceCommand<>>, + adc::AdcSpdlogLogger +{ + typedef adc::AdcGenericDevice, adc::AdcDeviceCommand<>> base_t; + +public: + static constexpr std::string_view CAMERA_ATTR_HBIN{"HBIN"}; + static constexpr std::string_view CAMERA_ATTR_VBIN{"VBIN"}; + static constexpr std::string_view CAMERA_ATTR_ROI_LEFT{"ROI_LEFT"}; + static constexpr std::string_view CAMERA_ATTR_ROI_TOP{"ROI_TOP"}; + static constexpr std::string_view CAMERA_ATTR_ROI_WIDTH{"ROI_WIDTH"}; + static constexpr std::string_view CAMERA_ATTR_ROI_HEIGHT{"ROI_HEIGHT"}; + static constexpr std::string_view CAMERA_ATTR_GAIN{"GAIN"}; + static constexpr std::string_view CAMERA_ATTR_READ_RATE{"READ_RATE"}; + static constexpr std::string_view CAMERA_ATTR_CCD_TEMP{"CCD_TEMP"}; + static constexpr std::string_view CAMERA_ATTR_PCB_TEMP{"PCB_TEMP"}; + static constexpr std::string_view CAMERA_ATTR_EXPTIME{"EXPTIME"}; + static constexpr std::string_view CAMERA_ATTR_FRAME_RATE{"FRAME_RATE"}; + static constexpr std::string_view CAMERA_ATTR_NEXP{"NEXP"}; + static constexpr std::string_view CAMERA_ATTR_SHUTTER_STATE{"SHUTTER_STATE"}; + static constexpr std::string_view CAMERA_ATTR_CCDDIM{"CCDDIM"}; + + static constexpr std::string_view CAMERA_CMD_START_EXP{"START_EXP"}; + static constexpr std::string_view CAMERA_CMD_STOP_EXP{"STOP_EXP"}; + // static constexpr std::string_view CAMERA_CMD_OPEN_SHUTTER{"OPEN_SHUTTER"}; + // static constexpr std::string_view CAMERA_CMD_CLOSE_SHUTTER{"CLOSE_SHUTTER"}; + + + + RaptorEagleCCD(const adc::traits::adc_input_char_range auto& epix_video_fmt_filename, + std::shared_ptr logger = spdlog::null_logger_mt("EAGLE_CCD_NULLLOGGER")); + + RaptorEagleCCD(std::shared_ptr logger = spdlog::null_logger_mt("EAGLE_CCD_NULLLOGGER")); + + ~RaptorEagleCCD(); + +private: + std::string _epixFmtVideoFilename; + int _cameraUnitmap; + + void initAttrComm(); + + void initCamera(int unitmap); + + void openPIXCI(); + void closePIXCI(); + + template + void xclibApiCall(int err, const adc::traits::adc_input_char_range auto& func_name) + { + if (err) { + if (std::ranges::size(func_name)) { + logError("XCLIB API call ('{}') returns: {} ({})", func_name, err, pxd_mesgErrorCode(err)); + } else { + logError("XCLIB API call returns: {} ({})", err, pxd_mesgErrorCode(err)); + } + + if constexpr (!NOEXCEPT) { + throw std::error_code(err, XCLIBErrorCategory::get()); + } + } else { + if (std::ranges::size(func_name)) { + logDebug("XCLIB API call ('{}') finished successfully", func_name); + } + } + } + + + template + void xclibApiCall(int err) + { + xclibApiCall(err, std::string_view("")); + } +}; diff --git a/raptor_eagle_exception.h b/raptor_eagle_exception.h new file mode 100644 index 0000000..ee41de9 --- /dev/null +++ b/raptor_eagle_exception.h @@ -0,0 +1,79 @@ +#pragma once + +#include +#include + +enum class RaptorEagleCCDError : int { ERROR_OK, ERROR_INVALID_UNITMAP }; + + +namespace std +{ +template <> +class is_error_code_enum : public true_type +{ +}; + +} // namespace std + + +struct RaptorEagleCCDErrorCategory : std::error_category { + RaptorEagleCCDErrorCategory() : std::error_category() {} + + const char* name() const noexcept + { + return "EAGLE_CCD_ERROR_CATEGORY"; + } + + std::string message(int ec) const + { + RaptorEagleCCDError err = static_cast(ec); + + switch (err) { + case RaptorEagleCCDError::ERROR_OK: + return "OK"; + case RaptorEagleCCDError::ERROR_INVALID_UNITMAP: + return "invalid EPIX-library unitmap"; + default: + return "UNKNOWN ERROR"; + } + } + + static const RaptorEagleCCDErrorCategory& get() + { + static const RaptorEagleCCDErrorCategory constInst; + return constInst; + } +}; + + +/* Error category for XCLIB errors */ +struct XCLIBErrorCategory : std::error_category { + XCLIBErrorCategory() : std::error_category() {} + + const char* name() const noexcept + { + return "XCLIB_Error_Category"; + } + + std::string message(int ec) const + { + return pxd_mesgErrorCode(ec); + } + + static const XCLIBErrorCategory& get() + { + static const XCLIBErrorCategory constInst; + return constInst; + } +}; + + +namespace std +{ + +inline std::error_code make_error_code(RaptorEagleCCDError ec) +{ + return std::error_code(static_cast(ec), RaptorEagleCCDErrorCategory::get()); +} + +} // namespace std