...
 
Commits (64)
......@@ -6,4 +6,5 @@
\#*\#
.\#*
*.pyc
build/
tango/build/
stages:
- build
- build-noarch
- deploy
.build-conda: &build-conda
stage: build
artifacts:
paths:
- dist/
tags:
- conda
build-linux:
<<: *build-conda
script:
- conda build ./conda/camera --prefix-length=80 --output-folder=dist/ --channel=http://bcu-ci.esrf.fr/stable
tags:
- linux
build-noarch:
<<: *build-conda
stage: build-noarch
script:
- conda build ./conda/tango --prefix-length=80 --output-folder=dist/ -c tango-controls --channel=http://bcu-ci.esrf.fr/stable
dependencies:
- build-linux
deploy-devel:
stage: deploy
environment:
name: devel/$CI_COMMIT_REF_NAME
url: http://bcu-ci.esrf.fr/devel
dependencies:
- build-linux
- build-noarch
script:
- cp -Rf dist/* /conda-devel/
- conda index /conda-devel/
tags:
- conda
- linux
only:
- branches
except:
- master
when: manual
deploy-stable:
stage: deploy
environment:
name: production
url: http://bcu-ci.esrf.fr/stable
dependencies:
- build-linux
- build-noarch
script:
- cp -Rf dist/* /conda/
- conda index /conda/
tags:
- conda
- linux
only:
- tags
###########################################################################
# This file is part of LImA, a Library for Image Acquisition
#
# Copyright (C) : 2009-2019
# European Synchrotron Radiation Facility
# CS40220 38043 Grenoble Cedex 9
# FRANCE
#
# Contact: lima@esrf.fr
#
# This is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
############################################################################
cmake_minimum_required(VERSION 3.1)
project(frelon)
set(NAME "frelon")
# Include additional modules that are used inconditionnaly
include(GNUInstallDirs)
include(GenerateExportHeader)
# If conda build, always set lib dir to 'lib'
if($ENV{CONDA_BUILD})
set(CMAKE_INSTALL_LIBDIR "lib")
endif()
# Set lower / upper case project names
string(TOUPPER "${PROJECT_NAME}" PROJECT_NAME_UPPER)
string(TOLOWER "${PROJECT_NAME}" PROJECT_NAME_LOWER)
# Set targets export name (used by lima and dependencies)
set(TARGETS_EXPORT_NAME "${PROJECT_NAME_LOWER}-targets")
#set(namespace "${PROJECT_NAME}::")
# Check if project is being used directly or via add_subdirectory
set(CAMERA_MASTER_PROJECT OFF)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(CAMERA_MASTER_PROJECT ON)
endif()
if (CAMERA_MASTER_PROJECT)
find_package(Lima REQUIRED COMPONENTS devel tools)
endif()
# CMake additional macros
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${LIMA_CMAKE_INCLUDE_DIRS} ${CMAKE_MODULE_PATH})
include(LimaTools)
# Set version
include(project_version)
# Enable python binding code compilation using sip generator
if (CAMERA_MASTER_PROJECT)
option(LIMA_ENABLE_PYTHON "compile python binding code?" OFF)
option(LIMA_ENABLE_PYTANGO_SERVER "install python tango server?" OFF)
if (LIMA_ENABLE_PYTHON)
limatools_find_python_and_sip()
endif()
endif()
if (CAMERA_MASTER_PROJECT)
find_package(Espia REQUIRED)
endif()
file(GLOB_RECURSE FRELON_INCS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
add_library(frelon SHARED
src/Frelon.cpp
src/FrelonSerialLine.cpp
src/FrelonModel.cpp
src/FrelonGeometry.cpp
src/FrelonCamera.cpp
src/FrelonTimingCtrl.cpp
src/FrelonInterface.cpp
src/FrelonCorrection.cpp
${FRELON_INCS}
)
# Generate export macros
generate_export_header(frelon)
# Set version and output name
set_target_properties(frelon PROPERTIES
OUTPUT_NAME "lima${PROJECT_NAME_LOWER}"
VERSION "${PROJECT_VERSION}"
SOVERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}")
# Add dependencies
target_include_directories(frelon
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/tools/src>"
PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>" # For export header
PUBLIC "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
target_link_libraries(frelon PUBLIC espia limacore)
if(WIN32)
target_compile_definitions(frelon
PRIVATE frelon_EXPORTS
PUBLIC NOMINMAX)
set_target_properties(frelon PROPERTIES PREFIX "lib" IMPORT_PREFIX "lib")
endif()
# Binding code for python
if(LIMA_ENABLE_PYTHON)
set(IMPORTS "limaespia.sip")
if(NOT CAMERA_MASTER_PROJECT)
set(SIP_INCLUDE_DIRS
"${CMAKE_CURRENT_BINARY_DIR}/../common/espia/sip"
"${CMAKE_CURRENT_SOURCE_DIR}/../common/espia/sip"
)
endif()
limatools_run_sip_for_camera(frelon)
endif()
# Generate and install package config file and version
if(CAMERA_MASTER_PROJECT)
set(PROJECT_LIBRARIES frelon)
set(SIP_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/sip/lima)
set(CMAKE_INSTALL_DIR ${CMAKE_INSTALL_DATADIR}/cmake/lima)
include(package_config)
endif()
## Installation
install(
TARGETS frelon
EXPORT "${TARGETS_EXPORT_NAME}"
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # import library
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # .so files are libraries
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} # .dll files are binaries
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} # this does not actually install anything (but used by downstream projects)
)
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
COMPONENT devel
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
FILES_MATCHING PATTERN "*.h"
)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/project_version.h
${PROJECT_BINARY_DIR}/frelon_export.h
COMPONENT devel
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
if(LIMA_ENABLE_PYTHON)
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/python/
DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/Frelon"
)
if (LIMA_ENABLE_PYTANGO_SERVER)
add_subdirectory(tango)
endif()
endif()
## Tests
if(CAMERA_ENABLE_TESTS)
enable_testing()
#add_subdirectory(test)
endif()
This diff is collapsed.
[![License](https://img.shields.io/github/license/esrf-bliss/lima.svg?style=flat)](https://opensource.org/licenses/GPL-3.0)
[![Gitter](https://img.shields.io/gitter/room/esrf-bliss/lima.svg?style=flat)](https://gitter.im/esrf-bliss/LImA)
[![Conda](https://img.shields.io/conda/dn/esrf-bcu/lima-camera-frelon.svg?style=flat)](https://anaconda.org/esrf-bcu)
[![Version](https://img.shields.io/conda/vn/esrf-bcu/lima-camera-frelon.svg?style=flat)](https://anaconda.org/esrf-bcu)
[![Platform](https://img.shields.io/conda/pn/esrf-bcu/lima-camera-frelon.svg?style=flat)](https://anaconda.org/esrf-bcu)
# LImA Frelon Camera Plugin
This is the LImA plugin for the Frelon cameras.
## Install
### Camera python
conda install -c esrf-bcu lima-camera-frelon
### Camera tango device server
conda install -c tango-controls -c esrf-bcu lima-camera-frelon-tango
# LImA
Lima ( **L** ibrary for **Im** age **A** cquisition) is a project for the unified control of 2D detectors. The aim is to clearly separate hardware specific code from common software configuration and features, like setting standard acquisition parameters (exposure time, external trigger), file saving and image processing.
Lima is a C++ library which can be used with many different cameras. The library also comes with a [Python](http://python.org) binding and provides a [PyTango](http://pytango.readthedocs.io/en/stable/) device server for remote control.
## Documentation
The documentation is available [here](https://lima.blissgarden.org)
# Config file for @PROJECT_NAME_LOWER@
#
# It defines the following variables:
#
# @PROJECT_NAME_UPPER@_INCLUDE_DIRS - include directory
# @PROJECT_NAME_UPPER@_LIBRARIES - all dynamic libraries
# @PROJECT_NAME_UPPER@_STATIC_LIBRARIES - all static libraries
@PACKAGE_INIT@
# Add dependencies here
include(CMakeFindDependencyMacro)
find_dependency(Lima)
find_dependency(Espia)
include("${CMAKE_CURRENT_LIST_DIR}/@TARGETS_EXPORT_NAME@.cmake")
check_required_components("@PROJECT_NAME@")
check_required_components(@PROJECT_NAME_LOWER@)
#!/bin/bash
cmake -Bbuild -H. -DLIMA_ENABLE_PYTHON=1 -DCAMERA_ENABLE_TESTS=1 -DCMAKE_INSTALL_PREFIX=$PREFIX -DPYTHON_SITE_PACKAGES_DIR=$SP_DIR -DCMAKE_FIND_ROOT_PATH=$PREFIX
cmake --build build --target install
blas_impl:
- mkl # [x86_64]
c_compiler:
- vs2017 # [win]
cxx_compiler:
- vs2017 # [win]
python:
- 2.7 # [linux]
- 3.6
- 3.7
# This differs from target_platform in that it determines what subdir the compiler
# will target, not what subdir the compiler package will be itself.
# For example, we need a win-64 vs2008_win-32 package, so that we compile win-32
# code on win-64 miniconda.
cross_compiler_target_platform:
- win-64 # [win]
target_platform:
- win-64 # [win]
vc:
- 14
zip_keys:
- # [win]
- vc # [win]
- c_compiler # [win]
- cxx_compiler # [win]
# Strip the 'v' from the version tag
{% if GIT_DESCRIBE_TAG is defined %}
{% set version = GIT_DESCRIBE_TAG[1:] %}
{% else %}
{% set version = "0.0.0" %}
{% endif %}
package:
name: lima-camera-frelon
version: {{ version }}
source:
path: ../..
build:
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
requirements:
host:
- python {{ python }}
- numpy
- sip 4.19.8 # For compatibility with pyqt 5.9.2
- lima-core
- lima-common-espia
build:
- git
- cmake
- {{ compiler('cxx') }}
run:
- python {{ python }}
- sip >=4.19.4, <=4.19.8 # For compatibility with pyqt 5.9.2
- {{ pin_compatible('lima-core', max_pin='x.x') }}
- lima-common-espia
test:
requires:
- cmake
imports:
- Lima.Frelon
commands:
- cmake --version
- ctest --version
- cpack --version
about:
home: https://github.com/esrf-bliss/Lima
license: GPL
license_file: COPYING
summary: a library for the unified control of 2D detectors
cd tango
cmake -Bbuild -H. -DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% -DPYTHON_SITE_PACKAGES_DIR=%SP_DIR% -DCMAKE_FIND_ROOT_PATH=%LIBRARY_PREFIX%
IF %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%
cmake --build build --config Release --target install
IF %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%
#!/bin/bash
cd tango/
cmake -Bbuild -H. -DCMAKE_INSTALL_PREFIX=$PREFIX -DPYTHON_SITE_PACKAGES_DIR=$SP_DIR -DCMAKE_FIND_ROOT_PATH=$PREFIX
cmake --build build --target install
# Strip the 'v' from the version tag
{% if GIT_DESCRIBE_TAG is defined %}
{% set version = GIT_DESCRIBE_TAG[1:] %}
{% else %}
{% set version = "0.0.0" %}
{% endif %}
package:
name: lima-camera-frelon-tango
version: {{ version }}
source:
path: ../..
build:
number: {{ environ.get('GIT_DESCRIBE_NUMBER', 0) }}
noarch: python
requirements:
build:
- cmake
- git
- lima-core
run:
- lima-tango-server
- lima-camera-frelon
about:
home: https://github.com/esrf-bliss/Lima
license: GPL
license_file: COPYING
summary: a library for the unified control of 2D detectors
.. _camera-frelon:
Frelon camera plugin
---------------------
Frelon camera
--------------
.. image:: FReLoN-2k.jpg
Introduction
````````````
TODO
The FReLoN camera is a 14 bit dynamic CCD camera, with a 2048*2048 pixel chip. This camera has been developped by the awesome people with the 'Analog and Transient Electronic' ESRF group.
Prerequisite
````````````
Installation & Module configuration
````````````````````````````````````
- follow first the steps for the linux installation :ref:`linux_installation`
```````````````````````````````````
The minimum configuration file is *config.inc* :
Follow the generic instructions in :ref:`build_installation`. If using CMake directly, add the following flag:
.. code-block:: sh
COMPILE_CORE=1
COMPILE_SIMULATOR=0
COMPILE_SPS_IMAGE=1
COMPILE_ESPIA=0
COMPILE_FRELON=1
COMPILE_MAXIPIX=0
COMPILE_PILATUS=0
COMPILE_BASLER=0
COMPILE_PROSILICA=0
COMPILE_ROPERSCIENTIFIC=0
COMPILE_MYTHEN=0
COMPILE_ADSC=0
COMPILE_UEYE=0
COMPILE_XH=0
COMPILE_XSPRESS3=0
COMPILE_XPAD=0
COMPILE_PERKINELMER=0
COMPILE_ANDOR=0
COMPILE_PHOTONICSCIENCE=0
COMPILE_PCO=0
COMPILE_MARCCD=0
COMPILE_POINTGREY=0
COMPILE_IMXPAD=0
COMPILE_DEXELA=0
COMPILE_RAYONIXHS=0
COMPILE_CBF_SAVING=0
COMPILE_NXS_SAVING=0
COMPILE_FITS_SAVING=0
COMPILE_EDFGZ_SAVING=0
COMPILE_TIFF_SAVING=0
COMPILE_CONFIG=1
LINK_STRICT_VERSION=0
export COMPILE_CORE COMPILE_SPS_IMAGE COMPILE_SIMULATOR \
COMPILE_ESPIA COMPILE_FRELON COMPILE_MAXIPIX COMPILE_PILATUS \
COMPILE_BASLER COMPILE_PROSILICA COMPILE_ROPERSCIENTIFIC COMPILE_ADSC \
COMPILE_MYTHEN COMPILE_UEYE COMPILE_XH COMPILE_XSPRESS3 COMPILE_XPAD COMPILE_PERKINELMER \
COMPILE_ANDOR COMPILE_PHOTONICSCIENCE COMPILE_PCO COMPILE_MARCCD COMPILE_DEXELA\
COMPILE_POINTGREY COMPILE_IMXPAD COMPILE_RAYONIXHS COMPILE_CBF_SAVING COMPILE_NXS_SAVING \
COMPILE_FITS_SAVING COMPILE_EDFGZ_SAVING COMPILE_TIFF_SAVING COMPILE_CONFIG\
LINK_STRICT_VERSION
- start the linux compilation :ref:`linux_compilation`
- finally with the Tango server installation :ref:`tango_installation`
-DLIMACAMERA_FRELON=true
For the Tango server installation, refers to :ref:`tango_installation`.
Initialisation and Capabilities
````````````````````````````````
In order to help people to understand how the camera plugin has been implemented in LImA this section
provide some important information about the developer's choices.
```````````````````````````````
Implementing a new plugin for new detector is driven by the LIMA framework but the developer has some freedoms to choose which standard and specific features will be made available. This section is supposed to give you the correct information regarding how the camera is exported within the LIMA framework.
Camera initialisation
......................
The Frelon plugin is providing a helper class **FrelonAcq** which manages the initialisation sequence with
the camera and interface object. One should only provide an Espia board channel number as the initialisation
.....................
The Frelon plugin provides a helper class :cpp:class:`FrelonAcq` which manages the initialisation sequence with
the camera and interface object. An Espia board channel number should be set as the initialisation
parameter (default is 0).
.. code-block:: c++
frelon = Frelon.FrelonAcq(int(espia_dev_nb))
return frelon.getGlobalControl()
Std capabilites
................
...............
This plugin has been implemented in respect of the mandatory capabilites but with limitations according
This plugin has been implemented in respect of the mandatory capabilites but with limitations according
due to the detector specific features and with some programmer's choices. We do not explain here the standard Lima capabilites
but you can find in this section the useful information on the Dexela specfic features.
* HwDetInfo
TODO
TODO
* HwSync
TODO
TODO
Optional capabilites
........................
In addition to the standard capabilities, we make the choice to implement some optional capabilities in order to
....................
In addition to the standard capabilities, we make the choice to implement some optional capabilities in order to
have an improved simulation.
* HwShutter
TODO
TODO
* HwRoi
TODO
* HwBin
TODO
TODO
* HwBin
TODO
Configuration
`````````````
The main configuration will consist in providing the correct "DexelaConfig.cfg" file to the detector API.
The file has to be provided by the manufacturer with a second file like "sensor2923.fmt". The .fmt file contains
some calibration data.
The main configuration will consist in providing the correct ``DexelaConfig.cfg`` file to the detector API.
The file has to be provided by the manufacturer with a second file like ``sensor2923.fmt``. The ``.fmt`` file contains some calibration data.
How to use
````````````
The LimaCCDs tango server provides a complete interface to the dexela plugin so feel free to test.
For a quick test one can use python, is this a short code example:
For a quick test one can use python, this is a short example code:
.. code-block:: python
from Lima import Frelon
from lima impor Core
from lima import Core
import time
FrelonAcq = Frelon.FrelonAcq(int(espia_dev_nb))
control = FrelonAcq.getGlobalControl()
control = FrelonAcq.getGlobalControl()
acq = control.acquisition()
......@@ -148,8 +112,8 @@ For a quick test one can use python, is this a short code example:
# now ask for 2 sec. exposure and 10 frames
acq.setAcqExpoTime(2)
acq.setNbImages(10)
acq.setNbImages(10)
acq.prepareAcq()
acq.startAcq()
......@@ -158,9 +122,6 @@ For a quick test one can use python, is this a short code example:
while lastimg !=9:
time.sleep(1)
lastimg = control.getStatus().ImageCounters.LastImageReady
# read a image
im0 = control.ReadImage(0)
# read the first image
im0 = control.ReadImage(0)
Frelon Tango device
=======================
This is the reference documentation of the Frelon Tango device.
you can also find some useful information about the camera models/prerequisite/installation/configuration/compilation in the :ref:`Frelon camera plugin <camera-frelon>` section.
Properties
----------
=============== =============== =============== ==============================================================
Property name Mandatory Default value Description
=============== =============== =============== ==============================================================
espia_dev_nb No 0 The acquisition Espia board number
=============== =============== =============== ==============================================================
Attributes
----------
======================= ======= ======================= ===========================================================
Attribute name RW Type Description
======================= ======= ======================= ===========================================================
espia_dev_nb ro DevString The Espia board number.
image_mode rw DevString The acquisition image mode:
- **Frame transfert**
- **Full frame**
input_channel rw DevString The Inputs ADC channels:
- **1**
- **2**
- **3**
- **4**
- **1-2**
- **3-4**
- **1-3**
- **2-4**
- **1-2-3-4**
e2v_correction rw DevString Active/Desactive the corrstion for e2v cameras:
- **On**
- **Off**
roi_mode rw DevString The roi mode:
- **None**
- **Slow**
- **Fast**
- **Kinetic**
roi_bin_offset rw DevLong The roi offset in line
spb2_config rw DevString The internal config for pixel rate, **precision** or **speed**.
Depending on your camera model, the pixel rates are factory defined
seq_status ro DevLong
======================= ======= ======================= ===========================================================
Please refer to the *Frelon User's Guide* for more information about the above specfic configuration parameters.
Commands
--------
======================= =============== ======================= ===========================================
Command name Arg. in Arg. out Description
======================= =============== ======================= ===========================================
Init DevVoid DevVoid Do not use
State DevVoid DevLong Return the device state
Status DevVoid DevString Return the device state as a string
getAttrStringValueList DevString: DevVarStringArray: Return the authorized string value list for
Attribute name String value list a given attribute name
execSerialCommand DevString DevString Send a command through the serial line
command command result
resetLink DevVoid DevVoid reset the espia link
======================= =============== ======================= ===========================================
......@@ -49,7 +49,9 @@ enum Reg {
SingleVertXfer, SingleHorzXfer, AllVertXfer, AllHorzXfer,
ReadoutTime, TransferTime, CcdModesAvail, StatusSeqA,
StatusAMTA, StatusAMTB, StatusAMTC, StatusAMTD,
LookUpTable, ImagesPerEOF,
StatusAMTE,
LookUpTable, ImagesPerEOF, WeightValDFl, WeightValSig,
SeqClockFreq, CamChar,
};
typedef std::map<Reg, std::string> RegStrMapType;
......@@ -57,6 +59,8 @@ extern RegStrMapType RegStrMap;
typedef std::vector<Reg> RegListType;
extern RegListType CacheableRegList;
extern RegListType FloatRegList;
extern RegListType SignedRegList;
typedef std::map<Reg, double> RegDoubleMapType;
extern RegDoubleMapType RegSleepMap;
......@@ -73,8 +77,12 @@ extern CmdStrMapType CmdStrMap;
enum MultiLineCmd {
Help, Config, Dac, Volt,
Help, Config, Dac, MonitorVolt,
Aoi, PLL, Timing, StatusCam,
SampWeight, ConfigSeq, ConfigSPB, ConfigDLine,
ConfigDAC, ConfigADC, ConfigPLL, ConfigSWeight,
ConfigVCXO, ConfigAlarm, ConfigAoi, UserInfo,
MonitorADC,
};
typedef std::map<MultiLineCmd, std::string> MultiLineCmdStrMapType;
......@@ -113,12 +121,12 @@ extern InputChanList DefInputChanList;
enum SerNbParam {
SerNb = 0x00ff,
SPB1Kodak = 0x2000,
SPB1Adc16 = 0x4000,
SPB2Sign = 0x0100,
SPB2Type = 0x7000,
Taper = 0x8000,
SerNb = 0x00ff,
SPB1Kodak = 0x2000,
SPB1Adc16 = 0x4000,
SPBTypeMask = 0x0300,
ChipTypeMask = 0x7800,
TaperFlag = 0x8000,
};
enum RoiMode {
......@@ -133,6 +141,10 @@ typedef std::map<TimeUnitFactor, double> TimeUnitFactorMapType;
extern TimeUnitFactorMapType TimeUnitFactorMap;
enum SPBType {
SPBType1, SPBType2, SPBType8,
};
enum ChipType {
Atmel,
Kodak,
......@@ -141,6 +153,19 @@ enum ChipType {
E2V_4k,
E2V_4kNotMPP,
Hama,
Andanta_CcdFT2k = 8,
};
enum SPBConType {
SPBConNone, SPBConX, SPBConY, SPBConXY,
};
enum GeomType {
SPB12_4_Quad,
Hamamatsu,
SPB2_F16,
SPB8_F16_Single,
SPB8_F16_Dual,
};
typedef std::map<ChipType, FrameDim> ChipMaxFrameDimMapType;
......@@ -180,26 +205,61 @@ enum Status {
StatusMask = 0x3ff,
};
enum StatusSPB2 {
SPB2_GBitFifoPixEmpty = 0x8000,
SPB2_FifoOutEmpty = 0x4000,
SPB2_FifoInEmpty = 0x2000,
SPB2_FifoLUTEmpty = 0x1000,
SPB2_FifoChan4Empty = 0x0800,
SPB2_FifoChan3Empty = 0x0400,
SPB2_FifoChan2Empty = 0x0200,
SPB2_FifoChan1Empty = 0x0100,
SPB2_FifoEmptyMask = 0xff00,
SPB2_TstEnvFrmOut = 0x0040,
SPB2_TstEnvFrmIn = 0x0020,
SPB2_TstEnvMask = 0x0060,
SPB2_TstFlashUsrReady = 0x0010,
SPB2_EndInitRam = 0x0008,
SPB2_EndFlashRead = 0x0004,
SPB2_AuroraChanUp = 0x0002,
SPB2_DcmLocked = 0x0001,
SPB2_TstInitMask = 0x001f,
SPB2_TstInitGood = 0x001f,
enum StatusSPB2_SAA {
SPB2_SAA_GBitFifoPixEmpty = 0x8000,
SPB2_SAA_FifoOutEmpty = 0x4000,
SPB2_SAA_FifoInEmpty = 0x2000,
SPB2_SAA_FifoLUTEmpty = 0x1000,
SPB2_SAA_FifoChan4Empty = 0x0800,
SPB2_SAA_FifoChan3Empty = 0x0400,
SPB2_SAA_FifoChan2Empty = 0x0200,
SPB2_SAA_FifoChan1Empty = 0x0100,
SPB2_SAA_FifoEmptyMask = 0xff00,
SPB2_SAA_TstEnvFrmOut = 0x0040,
SPB2_SAA_TstEnvFrmIn = 0x0020,
SPB2_SAA_TstEnvMask = 0x0060,
SPB2_SAA_TstFlashUsrReady = 0x0010,
SPB2_SAA_EndInitRam = 0x0008,
SPB2_SAA_EndFlashRead = 0x0004,
SPB2_SAA_AuroraChanUp = 0x0002,
SPB2_SAA_DcmLocked = 0x0001,
SPB2_SAA_TstInitMask = 0x001f,
SPB2_SAA_TstInitGood = 0x001f,
};
enum StatusSPB8_SAA {
SPB8_SAA_PLL8Locked = 0x8000,
SPB8_SAA_PLL7Locked = 0x4000,
SPB8_SAA_PLL6Locked = 0x2000,
SPB8_SAA_PLL5Locked = 0x1000,
SPB8_SAA_PLL4Locked = 0x0800,
SPB8_SAA_PLL3Locked = 0x0400,
SPB8_SAA_PLL2Locked = 0x0200,
SPB8_SAA_PLL1Locked = 0x0100,
SPB8_SAA_DCMLocked = 0x0020,
SPB8_SAA_AuroraChanUp = 0x0010,
SPB8_SAA_DDR1CalDone = 0x0002,
SPB8_SAA_DDR0CalDone = 0x0001,
SPB8_SAA_TstInitMask = 0xff33,
SPB8_SAA_TstInitGood = 0xff33,
};
enum StatusSPB8_SAE {
SPB8_SAE_TstEnvFrmOut = 0x8000,
SPB8_SAE_TstEnvFrmIn = 0x4000,
SPB8_SAE_TstEnvMask = 0xc000,
SPB8_SAE_FifoTXAEmpty = 0x0800,
SPB8_SAE_FifoOutEmpty = 0x0400,
SPB8_SAE_FifoInEmpty = 0x0200,
SPB8_SAE_FifoMuxEmpty = 0x0100,
SPB8_SAE_FifoChan8Empty = 0x0080,
SPB8_SAE_FifoChan7Empty = 0x0040,
SPB8_SAE_FifoChan6Empty = 0x0020,
SPB8_SAE_FifoChan5Empty = 0x0010,
SPB8_SAE_FifoChan4Empty = 0x0008,
SPB8_SAE_FifoChan3Empty = 0x0004,
SPB8_SAE_FifoChan2Empty = 0x0002,
SPB8_SAE_FifoChan1Empty = 0x0001,
};
enum ShutMode {
......
......@@ -24,8 +24,9 @@
#include "FrelonSerialLine.h"
#include "FrelonModel.h"
#include "FrelonGeometry.h"
#include "FrelonTimingCtrl.h"
#include "HwMaxImageSizeCallback.h"
#include "lima/HwMaxImageSizeCallback.h"
namespace lima
{
......@@ -33,7 +34,7 @@ namespace lima
namespace Frelon
{
class Camera : public HwMaxImageSizeCallbackGen
class Camera
{
DEB_CLASS_NAMESPC(DebModCamera, "Camera", "Frelon");
......@@ -45,6 +46,7 @@ class Camera : public HwMaxImageSizeCallbackGen
void writeRegister(Reg reg, int val);
void readRegister (Reg reg, int& val);
void readFloatRegister(Reg reg, double& val);
void hardReset();
void getVersionStr(std::string& ver);
......@@ -60,8 +62,8 @@ class Camera : public HwMaxImageSizeCallbackGen
void setFrameTransferMode(FrameTransferMode ftm);
void getFrameTransferMode(FrameTransferMode& ftm);
static std::string getInputChanModeName(FrameTransferMode ftm,
InputChan input_chan);
std::string getInputChanModeName(FrameTransferMode ftm,
InputChan input_chan);
void getMaxFrameDim(FrameDim& max_frame_dim);
void getFrameDim(FrameDim& frame_dim);
......@@ -98,8 +100,13 @@ class Camera : public HwMaxImageSizeCallbackGen
void setShutCloseTime(double shut_time);
void getShutCloseTime(double& shut_time);
void setLatTime(double lat_time);
void getLatTime(double& lat_time);
void setUserLatTime(double lat_time);
void getUserLatTime(double& lat_time);
void getReadoutTime(double& readout_time);
void getTransferTime(double& xfer_time);
void getDeadTime(double& dead_time);
void setTotalLatTime(double lat_time);
void getTotalLatTime(double& lat_time);
void setNbFrames(int nb_frames);
void getNbFrames(int& nb_frames);
......@@ -107,15 +114,15 @@ class Camera : public HwMaxImageSizeCallbackGen
void setSPB2Config(SPB2Config spb2_config);
void getSPB2Config(SPB2Config& spb2_config);
static std::string getSPB2ConfigName(SPB2Config spb2_config);
std::string getSPB2ConfigName(SPB2Config spb2_config);
void setExtSyncEnable(ExtSync ext_sync_ena);
void getExtSyncEnable(ExtSync& ext_sync_ena);
void getStatus(Status& status, bool use_ser_line=false,
bool read_spb2=false);
bool read_spb=false);
bool waitStatus(Status& status, Status mask, double timeout,
bool use_ser_line=false, bool read_spb2=false);
bool use_ser_line=false, bool read_spb=false);
void getImageCount(unsigned int& img_count, bool only_lsw=false);
......@@ -123,8 +130,11 @@ class Camera : public HwMaxImageSizeCallbackGen
void stop();
bool isRunning();
protected:
virtual void setMaxImageSizeCallbackActive(bool cb_active);
void registerDeadTimeChangedCallback(DeadTimeChangedCallback& cb);
void unregisterDeadTimeChangedCallback(DeadTimeChangedCallback& cb);
void registerMaxImageSizeCallback(HwMaxImageSizeCallback& cb);
void unregisterMaxImageSizeCallback(HwMaxImageSizeCallback& cb);
private:
static const double ResetLinkWaitTime;
......@@ -141,82 +151,39 @@ class Camera : public HwMaxImageSizeCallbackGen
void sendCmd(Cmd cmd);
int getModesAvail();
void setChanMode(int chan_mode);
void getChanMode(int& chan_mode);
void calcBaseChanMode(FrameTransferMode ftm, int& base_chan_mode);
void calcChanMode(FrameTransferMode ftm, InputChan input_chan,
int& chan_mode);
void calcFTMInputChan(int chan_mode, FrameTransferMode& ftm,
InputChan& input_chan);
void setFlipMode(int flip_mode);
void getFlipMode(int& flip_mode);
Flip getMirror();
Point getNbChan();
Size getCcdSize();
Size getChanSize();
Flip getRoiInsideMirror();
void writeChanRoi(const Roi& chan_roi);
void readChanRoi(Roi& chan_roi);
void xformChanCoords(const Point& point, Point& chan_point,
Corner& ref_corner);
void calcImageRoi(const Roi& chan_roi, const Flip& roi_inside_mirror,
Roi& image_roi, Point& roi_bin_offset);
void calcFinalRoi(const Roi& image_roi, const Point& roi_offset,
Roi& final_roi);
void calcChanRoi(const Roi& image_roi, Roi& chan_roi,
Flip& roi_inside_mirror);
void calcChanRoiOffset(const Roi& req_roi, const Roi& image_roi,
Point& roi_offset);
void checkRoiMode(const Roi& roi);
void processSetRoi(const Roi& req_roi, Roi& hw_roi, Roi& chan_roi,
Point& roi_offset);
void resetRoiBinOffset();
void setTimeUnitFactor(TimeUnitFactor time_unit_factor);
void getTimeUnitFactor(TimeUnitFactor& time_unit_factor);
int calcTimeUnits(double time_sec, TimeUnitFactor time_unit_factor);
double getMaxIdleWaitTime();
bool waitIdleStatus(Status& status, bool use_ser_line=false,
bool read_spb2=false);
bool read_spb=false);
Status getSPBStatus();
AutoMutex lock();
SerialLine m_ser_line;
Model m_model;
TimingCtrl m_timing_ctrl;
Point m_chan_roi_offset;
Point m_roi_bin_offset;
AutoPtr<Geometry> m_geom;
TrigMode m_trig_mode;
int m_nb_frames;
bool m_mis_cb_act;
Mutex m_lock;
bool m_started;
};
inline bool Camera::isChanActive(InputChan curr, InputChan chan)
{
return (curr & chan) == chan;
};
inline AutoMutex Camera::lock()
{
return AutoMutex(m_lock);
}
inline bool Camera::waitIdleStatus(Status& status, bool use_ser_line,
bool read_spb2)
bool read_spb)
{
status = Wait;
return waitStatus(status, StatusMask, getMaxIdleWaitTime(),
use_ser_line, read_spb2);
use_ser_line, read_spb);
}
......
......@@ -22,8 +22,8 @@
#ifndef FRELONCORRECTION_H
#define FRELONCORRECTION_H
#include "LinkTask.h"
#include "SizeUtils.h"
#include "processlib/LinkTask.h"
#include "lima/SizeUtils.h"
namespace lima
{
......
//###########################################################################
// This file is part of LImA, a Library for Image Acquisition
//
// Copyright (C) : 2009-2011
// European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
// This is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3 of the License, or
// (at your option) any later version.
//
// This software is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, see <http://www.gnu.org/licenses/>.
//###########################################################################
#ifndef FRELONGEOMETRY_H
#define FRELONGEOMETRY_H
#include "FrelonModel.h"
#include "lima/HwMaxImageSizeCallback.h"
namespace lima
{
namespace Frelon
{
class Geometry;
class Camera;
class DeadTimeChangedCallback
{
DEB_CLASS_NAMESPC(DebModCamera, "DeadTimeChangedCallback", "Frelon");
public:
DeadTimeChangedCallback();
virtual ~DeadTimeChangedCallback();
protected:
virtual void deadTimeChanged(double dead_time) = 0;
private:
friend class Geometry;
Geometry *m_geom;
};
class Geometry : public HwMaxImageSizeCallbackGen
{
DEB_CLASS_NAMESPC(DebModCamera, "Geometry", "Frelon");
public:
Geometry(Camera& cam);
~Geometry();
void sync();
bool getDefInputChan(FrameTransferMode ftm,
InputChan& input_chan);
void setInputChan(InputChan input_chan);
void getInputChan(InputChan& input_chan);
void setFrameTransferMode(FrameTransferMode ftm);
void getFrameTransferMode(FrameTransferMode& ftm);
std::string getInputChanModeName(FrameTransferMode ftm,
InputChan input_chan);
void getMaxFrameDim(FrameDim& max_frame_dim);
void getFrameDim(FrameDim& frame_dim);
bool isChanActive(InputChan curr, InputChan chan);
void checkFlip(Flip& flip);
void setFlip(const Flip& flip);
void getFlip(Flip& flip);
void checkBin(Bin& bin);
void setBin(const Bin& bin);
void getBin(Bin& bin);
void setRoiMode(RoiMode roi_mode);
void getRoiMode(RoiMode& roi_mode);
void checkRoi(const Roi& set_roi, Roi& hw_roi);
void setRoi(const Roi& set_roi);
void getRoi(Roi& hw_roi);
void setRoiBinOffset(const Point& roi_bin_offset);
void getRoiBinOffset(Point& roi_bin_offset);
void setSPB2Config(SPB2Config spb2_config);
void getSPB2Config(SPB2Config& spb2_config);
std::string getSPB2ConfigName(SPB2Config spb2_config);
void getReadoutTime(double& readout_time);
void getTransferTime(double& xfer_time);
void getDeadTime(double& dead_time);
void deadTimeChanged();
void registerDeadTimeChangedCallback(DeadTimeChangedCallback& cb);
void unregisterDeadTimeChangedCallback(DeadTimeChangedCallback& cb);
protected:
virtual void setMaxImageSizeCallbackActive(bool cb_active);
bool isFrelon16();
void writeRegister(Reg reg, int val);
void readRegister (Reg reg, int& val);
void readFloatRegister(Reg reg, double& val);
int getModesAvail();
void setChanMode(int chan_mode);
void getChanMode(int& chan_mode);
void calcBaseChanMode(FrameTransferMode ftm, int& base_chan_mode);
void calcChanMode(FrameTransferMode ftm, InputChan input_chan,
int& chan_mode);
void calcFTMInputChan(int chan_mode, FrameTransferMode& ftm,
InputChan& input_chan);
void setFlipMode(int flip_mode);
void getFlipMode(int& flip_mode);
Flip getMirror();
Point getNbChan();
Size getCcdSize();
Size getChanSize();
Flip getRoiInsideMirror();
void writeChanRoi(const Roi& chan_roi);
void readChanRoi(Roi& chan_roi);
void xformChanCoords(const Point& point, Point& chan_point,
Corner& ref_corner);
void calcImageRoi(const Roi& chan_roi, const Flip& roi_inside_mirror,
Roi& image_roi, Point& roi_bin_offset);
void calcFinalRoi(const Roi& image_roi, const Point& roi_offset,
Roi& final_roi);
void calcChanRoi(const Roi& image_roi, Roi& chan_roi,
Flip& roi_inside_mirror);
void calcChanRoiOffset(const Roi& req_roi, const Roi& image_roi,
Point& roi_offset);
void checkRoiMode(const Roi& roi);
void processSetRoi(const Roi& req_roi, Roi& hw_roi, Roi& chan_roi,
Point& roi_offset);
void resetRoiBinOffset();
Camera& m_cam;
Model& m_model;
Point m_chan_roi_offset;
Point m_roi_bin_offset;
bool m_mis_cb_act;
double m_dead_time;
DeadTimeChangedCallback *m_dead_time_cb;
};
inline bool Geometry::isChanActive(InputChan curr, InputChan chan)
{
return (curr & chan) == chan;
};
inline bool Geometry::isFrelon16()
{
return (m_model.getChipType() == Andanta_CcdFT2k);
}
} // namespace Frelon
} // namespace lima
#endif // FRELONGEOMETRY_H
......@@ -22,7 +22,7 @@
#ifndef FRELONINTERFACE_H
#define FRELONINTERFACE_H
#include "HwInterface.h"
#include "lima/HwInterface.h"
#include "EspiaBufferMgr.h"
#include "FrelonCamera.h"
......@@ -177,8 +177,22 @@ class SyncCtrlObj : public HwSyncCtrlObj
virtual void getValidRanges(ValidRangesType& valid_ranges);
private:
class DeadTimeChangedCallback : public Frelon::DeadTimeChangedCallback
{
DEB_CLASS_NAMESPC(DebModCamera, "DeadTimeChangedCallback",
"Frelon::SynCtrlObj");
public:
DeadTimeChangedCallback(SyncCtrlObj *sync);
protected:
virtual void deadTimeChanged(double dead_time);
private:
friend class SyncCtrlObj;
SyncCtrlObj *m_sync;
};
Espia::Acq& m_acq;
Camera& m_cam;
DeadTimeChangedCallback m_dead_time_cb;
};
......
......@@ -53,6 +53,7 @@ class Firmware
static const Firmware v2_1b;
static const Firmware v3_0i;
static const Firmware v3_1c;
static const Firmware v4_1;
private:
void checkValid();
......@@ -108,6 +109,12 @@ class Model
DEB_CLASS_NAMESPC(DebModCamera, "Model", "Frelon");
public:
enum Feature {
Taper, HamaChip,
ModesAvail, TimeCalc, HTDCmd, GoodHTD, ImagesPerEOF, CamChar,
SPB1, SPB2, SPB8,
};
Model();
~Model();
......@@ -117,42 +124,43 @@ class Model
void setComplexSerialNb(int complex_ser_nb);
void getComplexSerialNb(int& complex_ser_nb);
void setCamChar(int cam_char);
void getCamChar(int& cam_char);
void setF16ForceSingle(bool f16_force_single);
void getF16ForceSingle(bool& f16_force_single);
void reset();
bool isValid();
int getSerialNb();
bool isSPB1();
bool isSPB2();
SPBType getSPBType();
int getAdcBits();
ChipType getChipType();
bool isHama();
bool hasTaper();
bool hasModesAvail();
bool hasTimeCalc();
bool hasHTDCmd();
bool hasGoodHTD();
bool hasImagesPerEOF();
SPBConType getSPBConType();
GeomType getGeomType();
bool has(Feature feature);
double getPixelSize();
std::string getName();
private:
typedef std::map<Feature, bool> FeatureMap;
void update();
void checkValid();
int getSerialNbParam(SerNbParam param);
Firmware m_firmware;
int m_complex_ser_nb;
bool m_valid;
ChipType m_chip_type;
bool m_is_hama;
bool m_modes_avail;
bool m_time_calc;
bool m_htd_cmd;
bool m_good_htd;
bool m_images_per_eof;
int m_cam_char;
bool m_f16_force_single;
bool m_valid;
SPBType m_spb_type;
ChipType m_chip_type;
SPBConType m_spb_con_type;
FeatureMap m_feature;
};
......
......@@ -23,7 +23,7 @@
#define FRELONSERIALLINE_H
#include "Frelon.h"
#include "ThreadUtils.h"
#include "lima/ThreadUtils.h"
namespace lima
{
......@@ -37,7 +37,7 @@ class SerialLine : public HwSerialLine
public:
enum MsgPart {
MsgSync, MsgCmd, MsgVal, MsgReq, MsgTerm,
MsgSync, MsgCmd, MsgVal, MsgDec, MsgReq, MsgTerm, MsgSign,
};
enum AnsPart {
......@@ -90,6 +90,7 @@ class SerialLine : public HwSerialLine
void writeRegister(Reg reg, int val);
void readRegister (Reg reg, int& val);
void readFloatRegister(Reg reg, double& val);
int getLastWarning();
......@@ -129,12 +130,21 @@ class SerialLine : public HwSerialLine
void readRespCleanup();
bool isFloatReg(Reg reg);
template <class T>
void checkRegType(Reg reg);
bool isRegCacheable(Reg reg);
bool getRegCacheVal(Reg reg, int& val);
bool getRegCacheValSafe(Reg reg, int& val);
template <class T>
bool getRegCacheVal(Reg reg, T& val);
template <class T>
bool getRegCacheValSafe(Reg reg, T& val);
double getRegSleepTime(Reg reg);
template <class T>
void readCameraRegister(Reg reg, T& val);
Espia::SerialLine& m_espia_ser_line;
Cond m_cond;
int m_last_warn;
......@@ -148,6 +158,16 @@ class SerialLine : public HwSerialLine
std::string m_curr_fmt_resp;
};
inline void SerialLine::readRegister(Reg reg, int& val)
{
readCameraRegister(reg, val);
}
inline void SerialLine::readFloatRegister(Reg reg, double& val)
{
readCameraRegister(reg, val);
}
std::ostream& operator <<(std::ostream& os, SerialLine::RegOp op);
......
This diff is collapsed.