Commit e9963c41 authored by ahoms's avatar ahoms
Browse files

* changed Espia enums to signed integer values;

  using unsigned SCDXIPCI constants in espia_lib calls
* removed warning in EspiaSerialLine constructor
* unified all directory Makefiles to use global.inc
  with common sub-dirs all/clean targets
* implemented detection of Espia driver directories 
  depending on the platform by including espia.inc;
  limit compilation to suse82 and redhate5/x86_64
* started Frelon code development


git-svn-id: https://scm.blissgarden.org/svn/lima/trunk@69 45c4679d-1946-429d-baad-37912b19538b
parent b97a1fc9
.PHONY: common hardware camera sub-dirs = common hardware camera
all: common hardware control camera include global.inc
common:
make -C common
hardware:
make -C hardware
control:
camera:
make -C camera
.PHONY: simulator common sub-dirs = common simulator frelon
all: simulator common include ../global.inc
simulator:
make -C simulator
common:
make -C common
.PHONY: espia sub-dirs = espia
all: espia include ../../global.inc
espia:
make -C espia
all: sub-dirs = src
make -C src
include ../../../global.inc
...@@ -13,9 +13,9 @@ class Espia ...@@ -13,9 +13,9 @@ class Espia
{ {
public: public:
enum { enum {
Invalid = SCDXIPCI_INVALID, Invalid = -1,
NoBlock = SCDXIPCI_NO_BLOCK, NoBlock = 0,
BlockForever = SCDXIPCI_BLOCK_FOREVER, BlockForever = -1,
MetaDev = SCDXIPCI_META_DEV, MetaDev = SCDXIPCI_META_DEV,
}; };
......
CS_SCRIPTS = /csadmin/common/scripts
OS = $(shell $(CS_SCRIPTS)/get_os.share)
ESRF_VER = $(shell $(CS_SCRIPTS)/get_esrflinux)
ESRF_MAJ_VER = $(shell echo $(ESRF_VER) | cut -c1-4)
ARCH = $(shell $(CS_SCRIPTS)/get_esrflinux --architecture)
BLISS_DRV_BASE = /segfs/bliss/source/driver
ESRF_COMP_BASE = $(BLISS_DRV_BASE)/linux-2.6/compile/$(ESRF_MAJ_VER)
ifndef ESPIA_DRV_BASE
ifeq ($(OS), suse82)
ESPIA_DRV_BASE = $(BLISS_DRV_BASE)/linux/espia/rel
else # OS != suse82
ifneq ($(OS), redhate5)
ESPIA_DRV_BASE = $(error Invalid ESRF/Linux version: $(ESRF_VER))
else # OS == redhate5
ifneq ($(ARCH), x86_64)
ESPIA_DRV_BASE = $(error Invalid ESRF/Linux architecture: $(ARCH))
else # ARCH == x86_64
ESPIA_DRV_BASE = $(ESRF_COMP_BASE)/espia/release
endif # ARCH == x86_64
endif # ESRF_VER == redhate5
endif # OS != suse82
ifndef ESPIA_DRV_INCL
ESPIA_DRV_INCL = $(ESPIA_DRV_BASE)/src
endif
ifndef ESPIA_DRV_LIB
ESPIA_DRV_LIB = $(ESPIA_DRV_BASE)/src
endif
endif # ESPIA_DRV_BASE
...@@ -59,7 +59,7 @@ void EspiaAcq::registerLastFrameCb() ...@@ -59,7 +59,7 @@ void EspiaAcq::registerLastFrameCb()
cb_data.type = ESPIA_CB_ACQ; cb_data.type = ESPIA_CB_ACQ;
cb_data.cb = dispatchFrameCb; cb_data.cb = dispatchFrameCb;
cb_data.data = this; cb_data.data = this;
cb_data.timeout = BlockForever; cb_data.timeout = SCDXIPCI_BLOCK_FOREVER;
struct img_frame_info& req_finfo = cb_data.info.acq.req_finfo; struct img_frame_info& req_finfo = cb_data.info.acq.req_finfo;
req_finfo.buffer_nr = ESPIA_ACQ_ANY; req_finfo.buffer_nr = ESPIA_ACQ_ANY;
...@@ -186,7 +186,7 @@ void EspiaAcq::getFrameInfo(int acq_frame_nb, HwFrameInfoType& info) ...@@ -186,7 +186,7 @@ void EspiaAcq::getFrameInfo(int acq_frame_nb, HwFrameInfoType& info)
finfo.frame_nr = ESPIA_ACQ_ANY; finfo.frame_nr = ESPIA_ACQ_ANY;
finfo.round_count = ESPIA_ACQ_ANY; finfo.round_count = ESPIA_ACQ_ANY;
finfo.acq_frame_nr = acq_frame_nb; finfo.acq_frame_nr = acq_frame_nb;
CHECK_CALL(espia_get_frame(m_dev, &finfo, NoBlock)); CHECK_CALL(espia_get_frame(m_dev, &finfo, SCDXIPCI_NO_BLOCK));
real2virtFrameInfo(finfo, info); real2virtFrameInfo(finfo, info);
} }
...@@ -207,10 +207,10 @@ void EspiaAcq::real2virtFrameInfo(const struct img_frame_info& real_info, ...@@ -207,10 +207,10 @@ void EspiaAcq::real2virtFrameInfo(const struct img_frame_info& real_info,
void EspiaAcq::resetFrameInfo(struct img_frame_info& frame_info) void EspiaAcq::resetFrameInfo(struct img_frame_info& frame_info)
{ {
frame_info.buffer_ptr = NULL; frame_info.buffer_ptr = NULL;
frame_info.buffer_nr = Invalid; frame_info.buffer_nr = SCDXIPCI_INVALID;
frame_info.frame_nr = Invalid; frame_info.frame_nr = SCDXIPCI_INVALID;
frame_info.round_count = Invalid; frame_info.round_count = SCDXIPCI_INVALID;
frame_info.acq_frame_nr = Invalid; frame_info.acq_frame_nr = SCDXIPCI_INVALID;
frame_info.time_us = 0; frame_info.time_us = 0;
frame_info.pixels = 0; frame_info.pixels = 0;
} }
...@@ -237,7 +237,7 @@ void EspiaAcq::startAcq() ...@@ -237,7 +237,7 @@ void EspiaAcq::startAcq()
resetFrameInfo(m_last_frame_info); resetFrameInfo(m_last_frame_info);
CHECK_CALL(espia_start_acq(m_dev, 0, m_nb_frames, NoBlock)); CHECK_CALL(espia_start_acq(m_dev, 0, m_nb_frames, SCDXIPCI_NO_BLOCK));
m_start_ts = Timestamp::now(); m_start_ts = Timestamp::now();
m_started = true; m_started = true;
......
...@@ -31,7 +31,7 @@ void EspiaDev::open(int dev_nb) ...@@ -31,7 +31,7 @@ void EspiaDev::open(int dev_nb)
void EspiaDev::close() void EspiaDev::close()
{ {
if (m_dev_nb == Invalid) if (m_dev_nb == int(Invalid))
return; return;
CHECK_CALL(espia_close(m_dev)); CHECK_CALL(espia_close(m_dev));
......
...@@ -10,8 +10,8 @@ using namespace std; ...@@ -10,8 +10,8 @@ using namespace std;
EspiaSerialLine::EspiaSerialLine( EspiaDev& edev, const string& line_term, EspiaSerialLine::EspiaSerialLine( EspiaDev& edev, const string& line_term,
double timeout, int block_size, double timeout, int block_size,
double block_delay ) : double block_delay ) :
m_dev(edev), HwSerialLine(line_term, timeout, block_size, block_delay),
HwSerialLine(line_term, timeout, block_size, block_delay) m_dev(edev)
{ {
if( edev.isMeta() ) if( edev.isMeta() )
throw LIMA_HW_EXC(NotSupported, "Can't create an " throw LIMA_HW_EXC(NotSupported, "Can't create an "
......
espia-objs = EspiaBase.o EspiaDev.o EspiaAcq.o EspiaSerialLine.o espia-objs = EspiaBase.o EspiaDev.o EspiaAcq.o EspiaSerialLine.o
#ESPIA_DRV_BASE = ../../../../../../bliss/source/driver/linux-2.6/espia include ../include/espia.inc
ESPIA_DRV_BASE = /segfs/bliss/source/driver/linux-2.6/espia
ESPIA_DRV_INC = $(ESPIA_DRV_BASE)/src
CXXFLAGS = -I../include -I../../../../hardware/include \ CXXFLAGS = -I../include \
-I../../../../common/include -I$(ESPIA_DRV_INC) -I../../../../hardware/include -I../../../../common/include \
-I$(ESPIA_DRV_INCL) -Wall
all: clean Espia.o all: clean Espia.o
......
sub-dirs = src test
include ../../global.inc
#ifndef FRELON_H
#define FRELON_H
#include "EspiaSerialLine.h"
#include <string>
#include <map>
namespace lima
{
class Frelon
{
public:
enum Reg {
NrFrames, ExpTime, ShutCloseTime, LatencyTime,
RoiLineBegin, RoiLineWidth, RoiPixelBegin, RoiPixelWidth,
ChanMode, TimeUnit, RoiEnable, RoiFast,
AntiBloom, BinVert, BinHorz, ConfigHD,
RoiKinetic, ShutEnable, HardTrigDisable,
PixelFreq, LineFreq, Flip, IntCalib,
DisplayImage, AdcFloatDiode, AdcSignal,
DarkPixelCalib, DarkPixelMode, ChanControl, Mire,
AoiLineBegin, AoiLineWidth, AoiPixelBegin, AoiPixelWidth,
AoiImageHeight, AoiImageWidth, ChanOnImage, ChanOnCcd,
Version, SerNr, Warn,
};
enum Cmd {
Reset, Start, Stop, Save,
};
enum MultiLineCmd {
Help, Config, Dac, Volt,
Aoi,
};
class SerialLine : public HwSerialLine
{
public:
enum MsgPart {
MsgSync, MsgCmd, MsgVal, MsgReq, MsgTerm,
};
SerialLine(EspiaSerialLine& espia_ser_line);
virtual void write(const std::string& buffer,
bool no_wait = false);
virtual void read(std::string& buffer, int len,
double timeout);
virtual void readStr(std::string& buffer, int len,
double timeout);
virtual void getNumAvailBytes(int &avail);
void splitMsg(const std::string& msg,
std::map<MsgPart, std::string>& msg_parts);
private:
EspiaSerialLine& m_espia_ser_line;
bool m_multi_line_cmd;
};
Frelon(EspiaSerialLine& espia_ser_line);
private:
SerialLine m_ser_line;
};
} // namespace lima
#endif // FRELON_H
#include "Frelon.h"
#include "RegEx.h"
using namespace lima;
using namespace std;
#define FRELON_SINGLE_SER_TIMEOUT 0.5
#define FRELON_NORM_SER_TIMEOUT 1.5
#define FRELON_MAX_SER_TIMEOUT 2.0
#define FRELON_RESET_SER_TIMEOUT 5.0
Frelon::SerialLine::SerialLine(EspiaSerialLine& espia_ser_line)
: m_espia_ser_line(espia_ser_line)
{
m_espia_ser_line.setLineTerm("\r\n");
m_espia_ser_line.setTimeout(FRELON_NORM_SER_TIMEOUT);
m_multi_line_cmd = true;
}
void Frelon::SerialLine::splitMsg(const string& msg,
map<MsgPart, string>& msg_parts)
{
msg_parts.clear();
RegEx re("^(?P<pre>>)?"
"(?P<cmd>[A-Z]+)"
"((?P<req>\\?)|(?P<val>[0-9]+))?"
"(?P<term>[\r\n]+)?$");
RegEx::FullNameMatchType match;
if (!re.matchName(msg, match))
throw LIMA_HW_EXC(InvalidValue, "Invalid Frelon message");
}
Frelon::Frelon(EspiaSerialLine& espia_ser_line)
: m_ser_line(espia_ser_line)
{
}
include ../../common/espia/include/espia.inc
CXXFLAGS = -I../include -I../../common/espia/include \
-I../../../hardware/include -I../../../common/include \
-I$(ESPIA_DRV_INCL) -Wall -pthread
all: clean Frelon.o
clean:
rm -f *.o
frelon-obs = ../src/Frelon.o ../../common/espia/src/Espia.o \
../../../hardware/src/Hw.o ../../../common/src/Common.o
include ../../common/espia/include/espia.inc
LDFLAGS = -pthread -L$(ESPIA_DRV_LIB)
LDLIBS = -lespia
CXXFLAGS = -I../include -I../../common/espia/include \
-I../../../hardware/include -I../../../common/include \
-I$(ESPIA_DRV_INCL) -Wall -pthread
all: clean testfrelon
testfrelon: testfrelon.o $(frelon-objs)
$(CXX) $(LDFLAGS) -o $@ $+ $(LDLIBS)
clean:
rm -f *.o testfrelon
#include "Frelon.h"
#include <iostream>
using namespace lima;
using namespace std;
void test_frelon()
{
}
int main(int argc, char *argv[])
{
try {
test_frelon();
} catch (Exception e) {
cerr << "LIMA Exception: " << e << endl;
}
return 0;
}
MAKE_CMD = $(MAKE) sub-dirs = src test
all: include ../../global.inc
$(MAKE_CMD) -C src all
$(MAKE_CMD) -C test all
clean:
$(MAKE_CMD) -C src clean
$(MAKE_CMD) -C test clean
sub-dirs = src test
all: include ../global.inc
$(MAKE) -C src all
$(MAKE) -C test all
clean:
$(MAKE) -C src clean
$(MAKE) -C test clean
sub-dirs-clean = $(sub-dirs:%=%.clean)
.PHONY: $(sub-dirs)
all: $(sub-dirs)
clean: $(sub-dirs-clean)
$(sub-dirs):
make -C $(@)
$(sub-dirs-clean):
make -C $(@:%.clean=%) clean
MAKE_CMD = $(MAKE) -C src sub-dirs = src
all: include ../global.inc
$(MAKE_CMD) all
clean:
$(MAKE_CMD) clean
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment