Commit 62ce8d9a authored by Graziano Scalamera's avatar Graziano Scalamera
Browse files

First import from CVS release_09

parent 5ed2212c
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
bin/
.nse_depinfo
# Eclipse
.cproject
.project
.settings
NAME_SRV = mercury-srv
CXXFLAGS =
LDFLAGS = -lbufferrt
include ../makefiles/Make-9.3.4.in
DP90
DI166
DD394
DL2000
SM2000
WW3
WT1
MN
BF
DP90
DI166
DD394
DL2000
SM2000
WW3
WT1
MN
BF
DP220
DI45
DD200
DL2000
SM2000
WW3
WT1
MN
BF
DP120
DI180
DD120
DL2000
SM1999
WW3
WT1
MN
BF
SPA 1 0x1 220
SPA 1 0x2 45
SPA 1 0x3 200
SPA 1 0x4 2000
SPA 1 0x8 0.5
SPA 1 0x9 32767
SPA 1 0xA 50
SPA 1 0xB 100
SPA 1 0xC 100
SPA 1 0xE 4000
SPA 1 0xF 1
SPA 1 0x13 0
SPA 1 0x14 1
SPA 1 0x15 200
SPA 1 0x16 100
SPA 1 0x17 100
SPA 1 0x18 0
SPA 1 0x1A 0
SPA 1 0x2F 100
SPA 1 0x30 0
SPA 1 0x31 0
SPA 1 0x32 0
SPA 1 0x33 0
SPA 1 0x34 0
SPA 1 0x3C M-404.8PD
SPA 1 0x3F 0
SPA 1 0x47 0
SPA 1 0x48 0
SPA 1 0x49 25
SPA 1 0x4A 100
SPA 1 0x4B 100
SPA 1 0x4D 0
SPA 1 0x50 10
SPA 1 0x59 32767
SPA 1 0x5A 10000
SPA 1 0x5B 1
SPA 1 0x5C 0
SPA 1 0x5D 0
SPA 1 0x5E 0
SPA 1 0x5F 0
SPA 1 0x60 0
SPA 1 0x61 0
SPA 1 0x62 0
SPA 1 0x63 0.2
SPA 1 0x70 0
SPA 1 0x71 8
SPA 1 0x72 0
SPA 1 0x94 10000
SPA 1 0x95 1
SPA 1 0x400 1
SPA 1 0x401 220
SPA 1 0x402 45
SPA 1 0x403 200
SPA 1 0x404 2000
SPA 1 0x405 0
SPA 1 0x406 0
SPA 1 0x407 0
SPA 1 0x411 220
SPA 1 0x412 45
SPA 1 0x413 200
SPA 1 0x414 2000
SPA 1 0x415 0
SPA 1 0x416 100
SPA 1 0x417 100
SPA 1 0x421 220
SPA 1 0x422 45
SPA 1 0x423 200
SPA 1 0x424 2000
SPA 1 0x425 0
SPA 1 0x426 1000000
SPA 1 0x427 1000000
SPA 1 0x431 220
SPA 1 0x432 45
SPA 1 0x433 200
SPA 1 0x434 2000
SPA 1 0x435 0
SPA 1 0x436 1000000
SPA 1 0x437 1000000
SPA 1 0x441 220
SPA 1 0x442 45
SPA 1 0x443 200
SPA 1 0x444 2000
SPA 1 0x445 0
SPA 1 0x446 1000000
SPA 1 0x447 1000000
SPA 1 0x7000601 MM
SPA 1 0x7000000 -536870.9118
SPA 1 0x7000001 536870.9118
SPA 1 0x1 120
SPA 1 0x2 180
SPA 1 0x3 120
SPA 1 0x4 2000
SPA 1 0x8 0.065891
SPA 1 0x9 32767
SPA 1 0xA 5.999991
SPA 1 0xB 80.000013
SPA 1 0xC 80.000013
SPA 1 0xE 2458624
SPA 1 0xF 81
SPA 1 0x13 0
SPA 1 0x14 1
SPA 1 0x15 204.000001
SPA 1 0x16 104.999994
SPA 1 0x17 104.999994
SPA 1 0x18 0
SPA 1 0x1A 0
SPA 1 0x2F 99.000007
SPA 1 0x30 0
SPA 1 0x31 0
SPA 1 0x32 0
SPA 1 0x33 0
SPA 1 0x34 0
SPA 1 0x3C M-521.DG
SPA 1 0x3F 0
SPA 1 0x47 0
SPA 1 0x48 0
SPA 1 0x49 2.999997
SPA 1 0x4A 80.000013
SPA 1 0x4B 80.000013
SPA 1 0x4D 0
SPA 1 0x50 2.999997
SPA 1 0x59 32767
SPA 1 0x5A 10000
SPA 1 0x5B 1
SPA 1 0x5C 0
SPA 1 0x5D 0
SPA 1 0x5E 0
SPA 1 0x5F 0
SPA 1 0x60 0
SPA 1 0x61 0
SPA 1 0x62 0
SPA 1 0x63 0.200011
SPA 1 0x70 0
SPA 1 0x71 8
SPA 1 0x72 0
SPA 1 0x94 10000
SPA 1 0x95 1
SPA 1 0x400 1
SPA 1 0x401 120
SPA 1 0x402 180
SPA 1 0x403 120
SPA 1 0x404 2000
SPA 1 0x405 0
SPA 1 0x406 0
SPA 1 0x407 0
SPA 1 0x411 120
SPA 1 0x412 180
SPA 1 0x413 120
SPA 1 0x414 2000
SPA 1 0x415 0
SPA 1 0x416 100
SPA 1 0x417 100
SPA 1 0x421 120
SPA 1 0x422 180
SPA 1 0x423 120
SPA 1 0x424 2000
SPA 1 0x425 0
SPA 1 0x426 1000000
SPA 1 0x427 1000000
SPA 1 0x431 120
SPA 1 0x432 180
SPA 1 0x433 120
SPA 1 0x434 2000
SPA 1 0x435 0
SPA 1 0x436 1000000
SPA 1 0x437 1000000
SPA 1 0x441 120
SPA 1 0x442 180
SPA 1 0x443 120
SPA 1 0x444 2000
SPA 1 0x445 0
SPA 1 0x446 1000000
SPA 1 0x447 1000000
SPA 1 0x7000601 MM
SPA 1 0x7000000 -70749.401052
SPA 1 0x7000001 70749.401052
#
# Resource backup , created Tue Jun 23 09:53:26 CEST 2009
#
#---------------------------------------------------------
# SERVER mercury-srv/eclaser, PiMercury device declaration
#---------------------------------------------------------
mercury-srv/eclaser/DEVICE/PiMercury: "pil/motor/pits1_1",\
"seed/motor/pits1_1"
# --- pil/motor/pits1_1 properties
pil/motor/pits1_1->AxisBackwardLimit: -600
pil/motor/pits1_1->AxisForwardLimit: 600
pil/motor/pits1_1->AxisNumber: 1
pil/motor/pits1_1->ChannelTrigger: 1
pil/motor/pits1_1->current_position: 0
pil/motor/pits1_1->DefaultAcceleration: 130
pil/motor/pits1_1->DefaultMaxSpeed: 67
pil/motor/pits1_1->DefaultMinSpeed: 67
pil/motor/pits1_1->HomeEdgeOffset: 0
pil/motor/pits1_1->MaxAllowedSpeed: 100
pil/motor/pits1_1->PositionRatio: 599.4
pil/motor/pits1_1->RtArraySize: 20000
pil/motor/pits1_1->Rt_Sleep: 1
pil/motor/pits1_1->Serialdevice: "eclaser/ttyS/0"
pil/motor/pits1_1->Serial_timeout: 1000
pil/motor/pits1_1->Th_sleep: 500
pil/motor/pits1_1->Wr_sleep: 100
# --- pil/motor/pits1_1 attribute properties
pil/motor/pits1_1/Position->display_unit: 1.0
pil/motor/pits1_1/Position->event_period: 1000
pil/motor/pits1_1/Position->format: %7.4f
pil/motor/pits1_1/Position->standard_unit: 1.0
pil/motor/pits1_1/Position->unit: ps
pil/motor/pits1_1/Acceleration->display_unit: 1.0
pil/motor/pits1_1/Acceleration->event_period: 1000
pil/motor/pits1_1/Acceleration->format: %7.4f
pil/motor/pits1_1/Acceleration->standard_unit: 1.0
pil/motor/pits1_1/Acceleration->unit: "ps/s^2"
pil/motor/pits1_1/Speed->display_unit: 1.0
pil/motor/pits1_1/Speed->event_period: 1000
pil/motor/pits1_1/Speed->format: %7.4f
pil/motor/pits1_1/Speed->min_value: 0.0
pil/motor/pits1_1/Speed->standard_unit: 1.0
pil/motor/pits1_1/Speed->unit: "mm/s"
pil/motor/pits1_1/TargetPosition->display_unit: 1.0
pil/motor/pits1_1/TargetPosition->event_period: 1000
pil/motor/pits1_1/TargetPosition->format: %10.6f
pil/motor/pits1_1/TargetPosition->standard_unit: 1.0
pil/motor/pits1_1/TargetPosition->unit: ps
# --- seed/motor/pits1_1 properties
seed/motor/pits1_1->AxisBackwardLimit: -650
seed/motor/pits1_1->AxisForwardLimit: 650
seed/motor/pits1_1->AxisNumber: 1
seed/motor/pits1_1->ChannelTrigger: 1
seed/motor/pits1_1->current_position: 0
seed/motor/pits1_1->DefaultAcceleration: 130
seed/motor/pits1_1->DefaultMaxSpeed: 67
seed/motor/pits1_1->DefaultMinSpeed: 67
seed/motor/pits1_1->HomeEdgeOffset: 0
seed/motor/pits1_1->MaxAllowedSpeed: 100
seed/motor/pits1_1->PositionRatio: 599.4
seed/motor/pits1_1->RtArraySize: 20000
seed/motor/pits1_1->Rt_Sleep: 1
seed/motor/pits1_1->Serialdevice: "eclaser/ttyS/6"
seed/motor/pits1_1->Serial_timeout: 1000
seed/motor/pits1_1->Th_sleep: 500
seed/motor/pits1_1->Wr_sleep: 100
#---------------------------------------------------------
# CLASS PiMercury properties
#---------------------------------------------------------
CLASS/PiMercury->cvs_location: "/home/cvsadm/cvsroot/fermi/servers/mercury/src/"
CLASS/PiMercury->Description: "Tango Device for Pi Mercury Motion Controller (models C-663, C-862, C-863)"
CLASS/PiMercury->doc_url: "http://www.esrf.fr/computing/cs/tango/tango_doc/ds_doc/"
CLASS/PiMercury->InheritedFrom: Device_3Impl
CLASS/PiMercury->ProjectTitle: "Pi Mercury"
#
# Resource backup , created Tue Jun 23 09:55:51 CEST 2009
#
#---------------------------------------------------------
# SERVER serial-srv/eclaser, Serial device declaration
#---------------------------------------------------------
serial-srv/eclaser/DEVICE/Serial: "eclaser/ttyS/0",\
"eclaser/ttyS/6"
# --- eclaser/ttyS/0 properties
eclaser/ttyS/0->baudrate: 9600
eclaser/ttyS/0->charlength: 8
eclaser/ttyS/0->newline: 03
eclaser/ttyS/0->parity: none
eclaser/ttyS/0->serialline: "/dev/ttyTIP0"
eclaser/ttyS/0->stopbits: 1
eclaser/ttyS/0->timeout: 500
# --- eclaser/ttyS/6 properties
eclaser/ttyS/6->baudrate: 9600
eclaser/ttyS/6->charlength: 8
eclaser/ttyS/6->newline: 03
eclaser/ttyS/6->parity: none
eclaser/ttyS/6->serialline: "/dev/ttyTIP6"
eclaser/ttyS/6->stopbits: 1
eclaser/ttyS/6->timeout: 500
#---------------------------------------------------------
# CLASS Serial properties
#---------------------------------------------------------
CLASS/Serial->Description: "C++ source for the SerialClass"
CLASS/Serial->ProjectTitle: "TANGO Device Server"
static const char *RcsId = "$Header: /home/cvsadm/cvsroot/fermi/servers/mercury/src/ClassFactory.cpp,v 1.1 2008/11/19 10:28:46 graziano Exp $";
//+=============================================================================
//
// file : ClassFactory.cpp
//
// description : C++ source for the class_factory method of the DServer
// device class. This method is responsible to create
// all class singletin for a device server. It is called
// at device server startup
//
// project : TANGO Device Server
//
// $Author: graziano $
//
// $Revision: 1.1 $
//
// $Log: ClassFactory.cpp,v $
// Revision 1.1 2008/11/19 10:28:46 graziano
// first version
//
//
// copyleft : European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
//-=============================================================================
//
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//
// (c) - Software Engineering Group - ESRF
//=============================================================================
#include <tango.h>
#include <PiMercuryClass.h>
/**
* Create PiMercuryClass singleton and store it in DServer object.
*/
void Tango::DServer::class_factory()
{
add_class(PiMercury_ns::PiMercuryClass::init("PiMercury"));
}
static const char *RcsId = "";
//+=============================================================================
//
// file : PiMercury.cpp
//
// description : C++ source for the PiMercury and its commands.
// The class is derived from Device. It represents the
// CORBA servant object which will be accessed from the
// network. All commands which can be executed on the
// PiMercury are implemented in this file.
//
// project : TANGO Device Server
//
// $Author: graziano $
//
// $Revision: 1.20 $
//
// $Log: PiMercury.cpp,v $
// Revision 1.20 2017-05-16 13:54:34 graziano
// tango 9
//
// Revision 1.18 2016-08-23 12:06:21 graziano
// changed ChannelXOut to Out0X and added In01 ... In04
//
// Revision 1.17 2015-08-24 09:38:45 graziano
// added Out01 - Out04 attributes
//
// Revision 1.16 2014-06-12 11:50:40 graziano
// fixed memory leak
//
// Revision 1.15 2013-10-16 13:45:29 graziano
// Device_4Impl and support for new C863_10
//
// Revision 1.14 2013-07-09 08:08:33 graziano
// added command LoadConfig
//
// Revision 1.12 2012-01-12 08:45:48 graziano
// added support for multiple devices
//
// Revision 1.11 2011/04/20 12:34:43 graziano
// supported new buffer modes
//
// Revision 1.10 2010/08/26 08:09:14 graziano
// added logs
//
// Revision 1.9 2009/08/21 13:40:51 graziano
// New libbufferrt
//
// Revision 1.8 2009/08/20 06:24:59 graziano
// New libbufferrt
//
// Revision 1.7 2009/05/27 13:35:44 graziano
// fixed bug in delete
//
// Revision 1.6 2009/05/27 09:35:04 graziano
// check in rt_mode if the buffer is updating, otherwise set an error message in the status string
//
// Revision 1.5 2009/04/24 13:42:54 graziano
// bug fixing
//
// Revision 1.4 2009/04/24 07:52:03 graziano
// bug fixing
//
// Revision 1.3 2009/04/23 09:07:02 graziano
// development of rt_mode using kernel module
//
// Revision 1.2 2009/04/14 12:40:26 graziano
// added rt_mode, scan mode, ...
//
// Revision 1.1 2008/11/19 10:28:46 graziano
// first version
//
//
// copyleft : European Synchrotron Radiation Facility
// BP 220, Grenoble 38043
// FRANCE
//
//-=============================================================================
//
// This file is generated by POGO
// (Program Obviously used to Generate tango Object)
//
// (c) - Software Engineering Group - ESRF
//=============================================================================
//===================================================================
//
// The following table gives the correspondence
// between commands and method name.
//
// Command name | Method name
// ----------------------------------------
// State | dev_state()
// Status | dev_status()
// Forward | forward()
// Backward | backward()
// Stop | stop()
// Abort | abort()
// Brake | brake()
// GoHome | go_home()
// GetVersion | get_version()
// MotorON | motor_on()
// MotorOFF | motor_off()
// SetHome | set_home()
// LimitSwitchEnable | limit_switch_enable()
// FindEdge | find_edge()
// LimitSwitchLevel | limit_switch_level()
// GetPosition | get_position()
// CheckTrigger | check_trigger()
// StartScan | start_scan()
//
//===================================================================
#include <sys/time.h>
#include <tango.h>
#include <PiMercury.h>
#include <PiMercuryClass.h>
#include "mercurythread.h"
#ifndef _SERVER_RT
#include <fcntl.h>
#include <sys/ioctl.h>
#include "mercury_rt.h"
#include <sys/mman.h>
#endif
#include <check_get_rt_buffer.h>
namespace PiMercury_ns
{
//+----------------------------------------------------------------------------
//
// method : PiMercury::PiMercury(string &s)
//
// description : constructor for simulated PiMercury
//
// in : - cl : Pointer to the DeviceClass object
// - s : Device name
//
//-----------------------------------------------------------------------------
PiMercury::PiMercury(Tango::DeviceClass *cl,string &s)
:TANGO_BASE_CLASS(cl,s.c_str())
{
init_device();
}
PiMercury::PiMercury(Tango::DeviceClass *cl,const char *s)
:TANGO_BASE_CLASS(cl,s)
{
init_device();
}
PiMercury::PiMercury(Tango::DeviceClass *cl,const char *s,const char *d)
:TANGO_BASE_CLASS(cl,s,d)
{
init_device();
}
//+----------------------------------------------------------------------------
//
// method : PiMercury::delete_device()
//
// description : will be called at device destruction or at init command.
//
//-----------------------------------------------------------------------------
void PiMercury::delete_device()
{
// Delete device's allocated object
abortflag = 1;
int ret;
sleep(1);
ret = munmap(buf, vsize);
if(ret == -1)
{
WARN_STREAM << "PiMercury::delete_device(): error unmapping rt_buffer" << endl;
}
else if(ret == 0)
{
DEBUG_STREAM << "PiMercury::delete_device(): successfully unmapped rt_buffer" << endl;
}
if(fd_buffer >= 0)
close(fd_buffer);
if(fd_mercury >= 0)
close(fd_mercury);
delete attr_Position_read;
delete attr_Acceleration_read;
delete attr_Speed_read;
delete attr_TargetPosition_read;
delete [] attr_Limits_read;
delete attr_ScanSpeed_read;
delete [] attr_AxisConfig_read;
delete attr_In01_read;
delete attr_In02_read;
delete attr_In03_read;
delete attr_In04_read;
delete [] rt_pos_array.pos;
delete [] rt_pos_array.ts;
delete [] rt_pos_array.bunch;
delete mutex;
delete devserial;
}
//+----------------------------------------------------------------------------
//
// method : PiMercury::init_device()
//