Commit 6075973c authored by Claudio Scafuri's avatar Claudio Scafuri 💬
Browse files

first import from CVS repo

parent bf6f66d3
.pydevproject
.project
.cproject
.settings
obj
bin
core*
*~
*.pyc
*.so
*.so*
.pylintrc
.metadata
.idea
.cvsignore
.nse_depinfo
software
oldsrc
CVS
#=============================================================================
#
# file : Makefile
#
# description : Include for the BPMID class.
#
# project : Makefile to generate a Tango server
#
# $Author: claudio $
#
# $Revision: 1.13 $
#
# $Log: Makefile,v $
# Revision 1.13 2020-07-27 13:19:26 claudio
# c+11, removed unneeded explic libraries dependencies
#
# Revision 1.12 2020-07-27 12:56:45 claudio
# tango 9.3.3
#
# Revision 1.11 2016-12-02 13:48:00 claudio
# tango-9
# use static libhsl
#
# Revision 1.10 2014-01-02 13:55:39 claudio
# tango-8 compliant
#
# Revision 1.9 2014-01-02 13:09:54 claudio
# tango8.1.2.c
#
# Revision 1.8 2013-03-04 10:10:51 claudio
# tango-8
#
# Revision 1.7 2012-05-08 12:08:00 claudio
# ticket 668: fix di alcuni bug nel flusso di istruzioni
# - da provare quando si cambia energia.
# - passato a tango-4
#
# Revision 1.6 2009/02/12 09:14:09 claudio
# new algorithms from E. Karantzoulis
#
# Revision 1.5 2009/01/23 10:09:52 claudio
# use tango 6
#
# Revision 1.4 2008/12/02 10:43:57 claudio
# general tango&omni
#
# Revision 1.3 2008/08/14 12:31:06 claudio
# *** empty log message ***
#
# Revision 1.2 2008/08/13 12:40:30 claudio
# first version with detached thread
#
# Revision 1.1 2008/07/31 07:36:12 claudio
# Initial import
#
#
# 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
#=============================================================================
#
CLASS = BPMID
MAJOR_VERS = 2
MINOR_VERS = 1
RELEASE = Release_$(MAJOR_VERS)_$(MINOR_VERS)
OS =
SERVER = bpmid-srv
#-----------------------------------------
# Set default home directories
#-----------------------------------------
#no_debug = 1
TANGO_HOME = /usr/local/tango-9.3.4
OMNI_HOME= /usr/local/omniorb-4.2.3
ZMQ_HOME = /usr/local/zeromq-4.0.8
CPP_SERVERS = $(TANGO_HOME)/cppserver
ifdef no_debug
DEBUG = -O2
else
DEBUG = -g -Wall
endif
CXX_SHLIB = $(CC) -fPIC
INCLUDE_DIRS = -I$(TANGO_HOME)/include/tango -I$(OMNI_HOME)/include -I$(ZMQ_HOME)/include -Isrc
OBJS_DIR = obj
BIN_DIR = bin
LIB_DIRS = -L $(TANGO_HOME)/lib -L $(OMNI_HOME)/lib -L $(ZMQ_HOME)/lib -L/runtime/lib
#-----------------------------------------
# Set CXXFLAGS and LFLAGS
#-----------------------------------------
CXXFLAGS = -std=c++11 -D_REENTRANT -D__linux__ -D__OSVERSION__=2 -pedantic -Wall -Wextra \
-Wno-non-virtual-dtor -Wno-long-long -DOMNI_UNLOADABLE_STUBS $(INCLUDE_DIRS)
LFLAGS = $(DEBUG) $(LIB_DIRS) \
-ltango \
-lomniORB4 \
-lomniDynamic4 \
-lomnithread \
-lCOS4 \
-lhls -llpc -lbeam_info -lbpm -lnc \
-ldl -lpthread -lzmq
CFLAGS += $(DEBUG) -D_REENTRANT -I /runtime/include
#-----------------------------------------
# Set dependences
#-----------------------------------------
SVC_OBJS = $(OBJS_DIR)/main.o \
$(OBJS_DIR)/ClassFactory.o \
$(OBJS_DIR)/$(CLASS)Class.o \
$(OBJS_DIR)/$(CLASS)StateMachine.o \
$(OBJS_DIR)/$(CLASS).o \
$(OBJS_DIR)/bpmidThread.o
BPMID_OBJ= $(OBJS_DIR)/bpmid.o
PLOT_TWISS_OBJ= $(OBJS_DIR)/plot_twiss_all.o
BPMID_INC= src/bpmid.h
SVC_INC = src/$(CLASS)Class.h \
src/$(CLASS).h
$(OBJS_DIR)/%.o: src/%.cpp $(SVC_INC)
@mkdir -p $(OBJS_DIR)
$(CXX) $(CXXFLAGS) -c $< -o $(OBJS_DIR)/$*.o
#-----------------------------------------
# Make Entry
#-----------------------------------------
default: release
release debug: $(BIN_DIR)/$(SERVER)
release: CXXFLAGS += -O2 -DNDEBUG
release: LFLAGS += -s
debug: CXXFLAGS += -ggdb3
$(BIN_DIR)/$(SERVER): $(SVC_OBJS) $(BPMID_OBJ) $(PLOT_TWISS_OBJ)
@mkdir -p $(BIN_DIR)
$(CXX) $(SVC_OBJS) $(BPMID_OBJ) $(PLOT_TWISS_OBJ) -o $(BIN_DIR)/$(SERVER) $(LFLAGS)
$(BPMID_OBJ): src/bpmid.c $(BPMID_INC)
$(CC) $(CFLAGS) -c $< -o $(BPMID_OBJ)
$(PLOT_TWISS_OBJ): src/plot_twiss_all.c
$(CC) $(CFLAGS) -c $< -o $(PLOT_TWISS_OBJ)
clean:
rm -rf $(OBJS_DIR)
rm -rf $(BIN_DIR)
rm -f core* bpmid.grind
make_obj_dir:
@mkdir -p $(OBJS_DIR)
make_bin_dir:
@mkdir -p $(BIN_DIR)
This diff is collapsed.
#!/bin/bash
################################################################################
# RP - 17 febbraio 2006
# CS - 23 gennaio 2009
# Codici di errore dello script
# - in avvio:
# 2: non c'e` l'eseguibile oppure i permessi non sono impostati correttamente
# 3: il programma e` gia` in esecuzione
# 4: non c'e` il file di configurazione /etc/default/elettra_daemons
# 5: nel file di configurazione /etc/default/elettra_daemons non viene
# richiesto di avviare il programma
# 6: errore nell'avvio del programma come root.
# 7: errore nell'avvio del programma come servuser.
# 8: e` stato utilizzato un utente sbagliato per eseguire lo script
# - in arresto:
# 50: il programma non e` in esecuzione
# 51: si e` verificato un errore arrestando il programma. Viene fornito il
# codice di uscita del kill
################################################################################
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/runtime/servers/bin
LD_LIBRARY_PATH=/usr/local/tango-6.1.1.b/lib:/usr/local/omniorb-4.1.2/lib:/runtime/elettra/lib:/usr/local/lib
export PATH LD_LIBRARY_PATH
export TANGO_HOST=tom.ecs:20000
export HLSETC=/runtime/hls/etc/
SERVER="BPMID-srv"
INSTANCE="SR"
LOGFILE="/tmp/logs/$SERVER.log"
startserver()
{
if [ `id -u` -eq "0" ]
then
su - servuser -c "cd /home/servuser && ulimit -c unlimited && /runtime/servers/bin/$SERVER $INSTANCE 2>&1 > $LOGFILE &"
sleep 1
if [ `ps -ef | grep "$SERVER $INSTANCE" | grep -v grep | wc -l` -eq "0" ]
then
echo " FAILED: an error occurred starting the program. Exit code: $?"
exit 6
else
echo " OK."
fi
else
if [ `id -u` -eq "10005" ]
then
cd /home/servuser && ulimit -c unlimited && $SERVER $INSTANCE 2>&1 > $LOGFILE &
sleep 1
if [ `ps -ef | grep "$SERVER $INSTANCE" | grep -v grep | wc -l` -eq "0" ]
then
echo " FAILED: an error occurred starting the program. Exit code: $?"
exit 6
else
echo " OK."
fi
else
echo " FAILED: You must be root or servuser to run this script."
exit 8
fi
fi
}
case "$1" in
start)
echo -n "Starting the $SERVER server for TANGO..."
if [ ! -x /runtime/servers/bin/$SERVER ]; then
echo " FAILED: executable not found."
exit 2
fi
if [ `ps -ef | grep "$SERVER $INSTANCE" | grep -v grep | wc -l` -eq "1" ]
then
echo " FAILED: program already running."
exit 3
fi
# source the system configuration variables
if [ -f /etc/default/elettra_daemons ]
then
. /etc/default/elettra_daemons
else
echo " ERROR: /etc/default/elettra_daemons file MISSING."
exit 4
fi
if [ "$BPMID_SRV" != 1 ]
then
echo " FAILED: program not required to run."
exit 5
fi
startserver
;;
stop)
echo -n "Stopping the $SERVER server for TANGO..."
if [ `ps -ef | grep "$SERVER $INSTANCE" | grep -v grep | wc -l` -eq "0" ]
then
echo " FAILED: not running."
exit 50
else
kill `ps -ef | grep "$SERVER $INSTANCE" | grep -v grep | awk '{print $2}'`
if [ $? != "0" ]
then
echo " FAILED: an error occurred stopping the program. Exit code: $?"
exit 51
else
echo " OK."
fi
fi
;;
status)
echo -n "Checking the $SERVER server for TANGO..."
if [ `ps -ef | grep "$SERVER $INSTANCE" | grep -v grep | wc -l` -eq "0" ]
then
echo " NOT running."
fi
if [ `ps -ef | grep "$SERVER $INSTANCE" | grep -v grep | wc -l` -gt "0" ]
then
echo " running."
fi
;;
restart)
$0 stop
sleep 2
$0 start
;;
*)
echo "Usage: /etc/init.d/$0 {start|stop|status|restart}"
;;
esac
exit 0
# EOF
valgrind --num-callers=20 --leak-check=yes --leak-resolution=high --leak-check=full --show-reachable=yes --log-file-exactly=bpmid.grind bin/BPMID-srv SR
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*----- PROTECTED REGION ID(BPMID::ClassFactory.cpp) ENABLED START -----*/
static const char *RcsId = "$Header: /home/cvsadm/cvsroot/elettra/server/bpmid/src/ClassFactory.cpp,v 1.1 2008-07-31 07:36:12 claudio 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: claudio $
//
// $Revision: 1.1 $
//
// $Log: ClassFactory.cpp,v $
// Revision 1.1 2008-07-31 07:36:12 claudio
// Initial import
//
//
// 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 <BPMIDClass.h>
/**
* Create BPMIDClass singleton and store it in DServer object.
*/
void Tango::DServer::class_factory()
{
add_class(BPMID_ns::BPMIDClass::init("BPMID"));
}
/*----- PROTECTED REGION END -----*/ // BPMID::ClassFactory.cpp
#=============================================================================
#
# file : Makefile
#
# description : Makefile to generate a TANGO device server.
#
# project : BPMID
#
#=============================================================================
# This file is generated by POGO
# (Program Obviously used to Generate tango Object)
#=============================================================================
#
#
# MAKE_ENV is the path to find common environment to buil project
#
MAKE_ENV = /usr/local/tango-9.3.3/share/pogo/preferences
#=============================================================================
# PACKAGE_NAME is the name of the library/device/exe you want to build
#
PACKAGE_NAME = BPMID
MAJOR_VERS = 1
MINOR_VERS = 0
RELEASE = Release_$(MAJOR_VERS)_$(MINOR_VERS)
# #=============================================================================
# # RELEASE_TYPE
# # - DEBUG : debug symbols - no optimization
# # - OPTIMIZED : no debug symbols - optimization level set to O2
# #-----------------------------------------------------------------------------
RELEASE_TYPE = DEBUG
#=============================================================================
# OUTPUT_TYPE can be one of the following :
# - 'STATIC_LIB' for a static library (.a)
# - 'SHARED_LIB' for a dynamic library (.so)
# - 'DEVICE' for a device server (will automatically include and link
# with Tango dependencies)
# - 'SIMPLE_EXE' for an executable with no dependency (for exemple the test tool
# of a library with no Tango dependencies)
#
OUTPUT_TYPE = DEVICE
#=============================================================================
# OUTPUT_DIR is the directory which contains the build result.
# if not set, the standard location is :
# - ./shlib if OUTPUT_TYPE is SHARED_LIB
# - ./lib if OUTPUT_TYPE is STATIC_LIB
# - ./bin for others
#
#OUTPUT_DIR =
#=============================================================================
# INC_DIR_USER is the list of all include path needed by your sources
# - for a device server, tango dependencies are automatically appended
# - '-I ../include' and '-I .' are automatically appended in all cases
#
INC_DIR_USER= -I .
#=============================================================================
# LIB_DIR_USER is the list of user library directories
# - for a device server, tango libraries directories are automatically appended
# - '-L ../lib' is automatically appended in all cases
#
LIB_DIR_USER=
#=============================================================================
# LFLAGS_USR is the list of user link flags
# - for a device server, tango libraries directories are automatically appended
# - '-ldl -lpthread' is automatically appended in all cases
#
# !!! ATTENTION !!!
# Be aware that the order matters.
# For example if you must link with libA, and if libA depends itself on libB
# you must use '-lA -lB' in this order as link flags, otherwise you will get
# 'undefined reference' errors
#
#LFLAGS_USR+=
#=============================================================================
# CXXFLAGS_USR lists the compilation flags specific for your library/device/exe
# This is the place where to put your compile-time macros using '-Dmy_macro'
#
# -DACE_HAS_EXCEPTIONS -D__ACE_INLINE__ for ACE
#
#CXXFLAGS_USR+= -Wall
#=============================================================================
# TANGO_REQUIRED
# - TRUE : your project depends on TANGO
# - FALSE : your project does not depend on TANGO
#-----------------------------------------------------------------------------
# - NOTE : if PROJECT_TYPE is set to DEVICE, TANGO will be auto. added
#-----------------------------------------------------------------------------
TANGO_REQUIRED = TRUE
#=============================================================================
# include Standard TANGO compilation options
#
include $(MAKE_ENV)/tango.opt
#=============================================================================
# POST_PROCESSING: action to be done after normal make.
# e.g.: change executable file name, .....
#POST_PROCESSING = \
# mv bin/$(BIN_DIR)/$(PACKAGE_NAME) bin/$(BIN_DIR)/$(PACKAGE_NAME)_DS
#=============================================================================
# SVC_OBJS is the list of all objects needed to make the output
#
SVC_INCL = $(PACKAGE_NAME).h $(PACKAGE_NAME)Class.h
SVC_OBJS = \
$(LIB_OBJS) \
$(OBJDIR)/ClassFactory.o \
$(OBJDIR)/main.o
LIB_OBJS = \
$(OBJDIR)/$(PACKAGE_NAME).o \
$(OBJDIR)/$(PACKAGE_NAME)Class.o \
$(OBJDIR)/$(PACKAGE_NAME)StateMachine.o \
$(ADDITIONAL_OBJS)
SVC_INHERITANCE_OBJ = \
#=============================================================================
# include common targets
#
include $(MAKE_ENV)/common_target.opt
/**
* Device Class Identification:
*
* Class Name : BPMID
* Contact : claudio.scafuri@elettra.eu
* Class Family : BeamDiag
* Platform : All Platforms
* Bus : Not Applicable
* Manufacturer : none
* Reference :
*/
This diff is collapsed.
//interface for bpmid functions new EK version
#ifndef _BPMID_H_INCLUDED_
#define _BPMID_H_INCLUDED_
#ifdef __cplusplus
extern "C" {
#endif
extern double THRESHOLD; /* threshold of BPM difference in um */
extern double BEAM_THRESHOLD; /* threshold of DCCT in mA */
extern double beam_current; /* beam current */
extern double En; /* beam energy */
extern double **XY_LSTR; /* position in short straigth sections */
extern double **XYP_LSTR; /* angle in short straigth sections */
extern double **XY_BEND1; /* position at bending sources */
extern double **XYP_BEND1; /* angle at bending sources */
extern double **PID; /* position at centre of ID */
extern double **AID; /* angle at centre of ID */
int bpmid_init();
int bpmid_read_and_update();
void bpmid_print_orbit(int plane);
void Init_field();
void bpmid_close();
/* TODO for finer control of errors:
int bpmid_read_energy();
int bpmid_read_current();
int update_middle_points();
*/
/*int bak;*/
#ifdef __cplusplus
}
#endif
#endif /* _BPMID_H_INCLUDED_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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