From e30735f60be461ce62a64f8434f23a28c9d90ed2 Mon Sep 17 00:00:00 2001 From: Ruud Overeem <overeem@astron.nl> Date: Sun, 19 Apr 2009 12:28:34 +0000 Subject: [PATCH] Bug 1000: Added new protocol so that the StationController and the ClockController can chat which each other. --- .gitattributes | 1 + .../src/ClockProtocol/Clock_Protocol.prot | 166 ++++++++++++++++++ .../StationCU/src/ClockProtocol/Makefile.am | 24 +++ 3 files changed, 191 insertions(+) create mode 100644 MAC/APL/StationCU/src/ClockProtocol/Clock_Protocol.prot create mode 100644 MAC/APL/StationCU/src/ClockProtocol/Makefile.am diff --git a/.gitattributes b/.gitattributes index 16e4e398335..5bcdb0b0c95 100644 --- a/.gitattributes +++ b/.gitattributes @@ -355,6 +355,7 @@ MAC/APL/RTDBCommon/src/RTDButilities.cc -text MAC/APL/RTDBCommon/test/Makefile.am -text MAC/APL/RTDBCommon/test/tRTDButilities.cc -text MAC/APL/RTDBCommon/test/tRTDButilities.h -text +MAC/APL/StationCU/src/ClockProtocol/Clock_Protocol.prot -text MAC/APL/StationCU/src/HardwareMonitor/EC_Protocol.prot -text MAC/APL/StationCU/src/HardwareMonitor/HardwareMonitor.conf -text MAC/APL/StationCU/src/HardwareMonitor/RSPMonitor.cc -text diff --git a/MAC/APL/StationCU/src/ClockProtocol/Clock_Protocol.prot b/MAC/APL/StationCU/src/ClockProtocol/Clock_Protocol.prot new file mode 100644 index 00000000000..050a2ad4902 --- /dev/null +++ b/MAC/APL/StationCU/src/ClockProtocol/Clock_Protocol.prot @@ -0,0 +1,166 @@ +//# ClockControl_Protocol.prot: Protocol definition for the ClockController +//# +//# Copyright (C) 2009 +//# ASTRON (Netherlands Foundation for Research in Astronomy) +//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl +//# +//# This program 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 2 of the License, or +//# (at your option) any later version. +//# +//# This program 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, write to the Free Software +//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//# +//# $Id: Controller_Protocol.prot 11042 2008-03-21 08:35:15Z overeem $ + + +autogen definitions protocol; + +description = "Protocol for the ClockController of the station"; +prefix = "CLKCTRL"; // for the signal names +id = "(LOFAR::MACIO::F_APL_PROTOCOL+1)"; + +// specify extra include files +// e.g. +// include = '<sys/time.h>'; +include = '<Common/lofar_bitset.h>'; +include = '<Common/LofarConstants.h>'; +include = '<APL/APLCommon/ControllerDefines.h>'; + +prelude = << PRELUDE_END + +// The following messages are defined in the Controller protocol: +// +// GET_CLOCK () +// GET_CLOCK_ACK (int clock) +// SET_CLOCK (int clock) +// SET_CLOCK_ACK (int status) +// +// GET_SPLITTERS () +// GET_SPLITTERS_ACK (bitset splitters) +// SET_SPLITTERS (bool splittersOn) +// SET_SPLITTERS_ACK (int status, bitset splitters) +// + +PRELUDE_END; + +error = { + id = NO; + msg = "No errors"; +}; +error = { + id = CLOCKFREQ; + msg = "Invalid clock frequency specified, only 160 and 200 MHz are allowed"; +}; +error = { + id = SPLITTERS; + msg = "Trouble setting the splitters"; +}; + +// +// An "event" has a "signal" and a "dir" (direction) +// and zero or more "param"s. +// "dir" can be one of "IN" or "OUT". +// A "param" has a "name" and a "type". +// + +// +// GET_CLOCK +// +event = { + signal = GET_CLOCK; + dir = IN; // from client to server +}; + +// +// GET_CLOCK_ACK +// +event = { + signal = GET_CLOCK_ACK; + dir = OUT; + param = { + name = "clock"; + type = "uint32"; + }; +}; + +// +// SET_CLOCK +// +event = { + signal = SET_CLOCK; + dir = IN; + param = { + name = "clock"; + type = "uint32"; + }; +}; + +// +// SET_CLOCK_ACK +// +event = { + signal = SET_CLOCK_ACK; + dir = OUT; + param = { + name = "status"; + type = "uint32"; + }; +}; + +// +// GET_SPLITTERS +// +event = { + signal = GET_SPLITTERS; + dir = IN; // from client to server +}; + +// +// GET_SPLITTERS_ACK +// +event = { + signal = GET_SPLITTERS_ACK; + dir = OUT; + param = { + name = "splitters"; + type = "bitset<MAX_RSPBOARDS>"; + }; +}; + +// +// SET_SPLITTERS +// +event = { + signal = SET_SPLITTERS; + dir = IN; + param = { + name = "splittersOn"; + type = "bool"; + }; +}; + +// +// SET_SPLITTERS_ACK +// +event = { + signal = SET_SPLITTERS_ACK; + dir = OUT; + param = { + name = "status"; + type = "uint32"; + }; + param = { + name = "splitters"; + type = "bitset<MAX_RSPBOARDS>"; + }; +}; + + diff --git a/MAC/APL/StationCU/src/ClockProtocol/Makefile.am b/MAC/APL/StationCU/src/ClockProtocol/Makefile.am new file mode 100644 index 00000000000..f5ef97a2ad7 --- /dev/null +++ b/MAC/APL/StationCU/src/ClockProtocol/Makefile.am @@ -0,0 +1,24 @@ +AUTOGEN = autogen +SUFFIXES = .ph +%.ph: %.prot + $(AUTOGEN) --writable -L $(datadir)/MACIO $< + cp $*.ph $(top_builddir)/include/APL/ClockProtocol + +%.cc: %.prot + $(AUTOGEN) --writable -L $(datadir)/MACIO $< + +EXTRA_DIST = Clock_Protocol.prot + +BUILT_SOURCES = Clock_Protocol.ph Clock_Protocol.cc + +pkgincludedir = $(includedir)/APL/ClockProtocol +pkginclude_HEADERS = $(BUILT_SOURCES) + +lib_LTLIBRARIES = libclock_protocol.la + +libclock_protocol_la_SOURCES = $(BUILT_SOURCES) + +clean-local: + rm -f *.ph + +include $(top_srcdir)/Makefile.common -- GitLab