class rcGTM : public genNamedObj<rcGTM*>, public Pu

Proxy class for a GTM board in the run control server

Inheritance:


Public Methods

static rcGTM* createGTM( const char *name, const char *pud_name, long vme_address, const char* pcServerName = NULL)
Static member function that is used to create GTMs
virtual ~rcGTM()
Dtor: removes the proxy from the run control server but does not talk to VxWorks

Public

BUSY functions to control the granule BUSY over VME
int setVmeBusy()
Sets the VME busy of the GTM via a RMI
int clearVmeBusy()
Clears the VME busy of the GTM via a RMI
Configuration Commands and retrieval of configuration parameters
int configure( const char* cmd, const char *value, const char *aux_param )
Generic configuration command inherited from PU - see PU for details
int addFem( FEM* pFem )
Adds an FEM to the list of FEMs that the GTM controls
int addDcm( DCM* pDcm )
Adds a DCM to the list of DCMs that the GTM controls
int addPar( Par* pPar )
Add a partition module to the list of partition modules that the GTM controls
static rcGTM* getGtmForDcm( const char *pcDcmName )
For a given Dcm name, return the GTM that has it in its internal list of associated Dcms or NULL
static rcGTM* getGtmForPar( const char *pcParName )
For a given Par name, return the GTM that has it in its internal list of associated Par or NULL
inline void setGranule( Granule *pGranule )
Set the granule that the GTM represents
inline Granule* getGranule()
Return a pointer to the granule that the GTM represents
rcGTM* castToGTM()
Inherited member from PU to mimic RTTI
Function that coordinate the GTM-FEM-DCM interdependence
int adjustGtmFemState()
Adjusts the relative state between FEM and GTM
int initFemAfterGtmOk()
Initialises the FEMs once the GTM is in the "right" state
int initDcmAfterGtmOk()
Starts the initialisation sequence of the DCM system via the partition module once the GTMs are in the proper state
int finishDownloadingAfterFEM()
Checks that the FEMs are really all in the locked state
Functions inherited from PU that make up the global state transitions
int connect()
Initial startup function
int initialise()
Initialises the board
virtual int download()
Downloads the board
int start_run()
Starts the run
int end_run()
Stops the run
virtual bool updatePu( int iStatus, int eState_on_success )
Standard updatePu as inherited from PU
print, dump, list functions and accessors
void print( ostream &os = cout )
Prints a one line summary of the instance to os
void dump( ostream &os = cout )
Prints detailed information about the GTM instance to os
const char* getDefaultModeBitFile()
Returns the default mode bit file
const char* getModeBitFile()
Returns the current mode bit file
void setDefaultModeBitFile( const char* newFileName )
Sets the default mode bit file
void setModeBitFile( const char* newFileName )
Sets the mode bit file
void resetModeBitFile()
Resets the mode bit file
inline long getAddress()
Returns the (hex) address in the VME crate
inline const char* getServerName()
Returns the server name that manages this object
Resetting the glink on the GTM
int resetGlink()
Resets the Glink of the GTM for the GTM with the name pcName
static int resetAllGlinks()
Resets the Glink of all GTM
static member function that affect all instances of the GTMs
static void dump_all( ostream &os = cout )
Calls dump on all instances
static void listAll( ostream &os = cout )
Calls list on all objects
static int createAllGtms()
Creates all GTMs in Vxworks

Protected Fields

int iLastCmdSent
Remembers the last command that we sent to Vxworks
list <DCM*> listDcm
Internal list of the DCMs that are controlled by the GTM
list <FEM*> listFem
Internal list of the FEMs that are controlled by the GTM
list <Par*> listPar
Internal list of the PARs that are controlled by the GTM
Granule* myGranule
Pointer to the granule

Protected Methods

rcGTM(const char *name, const char *pud_name, long vme_address, const char* pcServerName )
Constructor
void reportErrorFromGtmUpdate( int iStatus, int eState_on_success )
Reports an error from the updatePu member function
int sendGtmEvent( int iEventId )
Fills the corba event data into the generic ONCS event and sends the event to the event notifier
virtual bool updateDownload()
Handles the updatePu case for download state transition
virtual bool updateInitialise()
Handles the updatePu case for initialise state transition
bool updateStartRun()
Handles the updatePu case for start run state transition

Private Fields

bool bCreatedInVxWorks
True if we created the object in VxWorks
int iStopEOxx
Determines the stop sequence of the board
long lGranuleType
ONCS global granule type
long lVMEaddress
VME address of the board
char* pcDefaultModeBitFile
Take this mode bit file if we didn't redefine it
char* pcModeBitFile
Take this mode bit file if we configured the board differently
char* pcServerName
Name of the VxWorks object manager/corba server
GTM_ptr ptrGTM
Pointer to the corba object in VxWorks

Private Methods

int createInVxWorks()
Creates the GTM in VxWorks using RMI on the object manager

Inherited from genNamedObj:

Public Methods

static void add( const char *name, X x )
inline static X begin()
inline static X end()
static bool exists( const char *name )
static X get( const char *name )
int getLocation()
inline static int getNbElements()
static X getObject( const char *name )
static int getObjects( const char *name, list<X> &theList )
inline const char* getObjName()
inline static X next()
static void remove( const char *name )

Private Fields

static map < const char*, X, cstring_ordering_t > ::iterator m_It
static map < const char*, X, cstring_ordering_t > m_Map
char* m_Name

Inherited from Pu:

Public

Accessors common to all PU

const char* getPudName()
Returns the name of the Process Unit Design
const char* getPrstName()
Return the name of the process stage, which controls this PU
Prst* getPrst()
Return a pointer to the process stage, which controls this PU
inline void enable()
To set the enable flag of the PU to true
inline void disable()
To set the disable flag of the PU to false
virtual bool isEnabled( const char* pccTransition = NULL )
To find out whether a process unit is enabled
void setSimulate( bool bValue )
To set the simulate mode
void setDebug( bool aBool )
To set the debug mode
bool getDebug()
Returns true if we are in debug mode

Architectural common member functions for all PU

Pu(const char *name, const char *pud_name )
constructor with the name and design as input
virtual ~Pu()
virtual destructor for handling dtor of subtypes
static mapPu_t mapPu
The PUs are organized in a global STL map
static bool exists( const char *name )
Returns true if a PU of this name exists
static mapPu_t::iterator locate( const char *name )
given the name of the PU return an STL map iterator to it
static Pu* get( char *name )
given the name return a pointer to the object itself
static int getPuByTag( const char* pcTag, list<Pu*> &theList )
To get a whole bunch of Pu that start with a given name
virtual void identify( ostream &os = cout )
To print out a one-line identifing message to the ostream os
virtual void dump( ostream &os = cout )
To print out a detailed summary of the Pu to ostream os
static void dump_all( ostream &os = cout )
To print out a detailed summary for all PU to ostream os
static void listAll( ostream &os = cout )
To print out a one-line summary for all PU to ostream os

Simple implementation of RTTI (see note above)

virtual Rdev* castToRdev()
virtual casts to Rdev
virtual Rout* castToRout()
virtual casts to Rout
virtual EvPool* castToEvPool()
virtual casts to EvPool
virtual Swpu* castToSwpu()
virtual casts to Swpu
virtual rcGTM* castToGTM()
virtual casts to GTM
virtual FEM* castToFEM()
virtual casts to FEM
virtual DCM* castToDCM()
virtual casts to DCM
virtual DDsocket* castToDDsocket()
virtual casts to DDsocket
virtual ROobject* castToROobject()
virtual casts to ROobject
virtual ddEventServer* castToddEventServer()
virtual casts to ddEventServer
virtual DataLogger* castToDataLogger()
virtual casts to DataLogger
virtual rcDataLogger* castToRcDataLogger()
virtual casts to rcDataLogger
virtual DummyDevice* castToDummyDevice()
virtual casts to Dummy device
virtual Par* castToPar()
virtual casts to Par
virtual EvbComponent* castToEvbComponent()
virtual casts to EvbComponent

State transitions

enum states
enum with the different possible states - these are common to all PU!!!
static const char* pcStates[]
the names of the state transitions as static const char*
int setState(int state )
Sets the state to the new state given by the enum int
int setState( const char *pcState )
Sets the state to the new state given by the name of the state
int getState()
Returns the state to the new state as enum int
const char* getcState()
Returns the state to the new state as a string
static int setStateAndUpdateStage( const char *pcPuGroup, const char *pcNewState )
Function that searches for a named PU (or group of PUs), sets its STT to the pcNewState and updates the ProcessStage at the same time

virtual functions for generic configuring, starting/updating/continuing a state transition

virtual int configure( const char* config_req, const char* value, const char *param = NULL )
To configure a PU
virtual int connect()
Connect is called once at initialisation time
virtual int initialise()
To initialise the PU
virtual int download()
To download the PU
virtual int start_run()
To start a new run
virtual int end_run()
To stop a run in progress
virtual bool updatePu( int iStatus, int eState_on_success )
Whenever a PU reports to the prst that is has done a state transition, the prst calls this virtual function
virtual bool checkReady( int iLevel )
Returns true if the process unit is in a ready state

Protected Fields

bool bDebug
bool bEnabled
bool bIgnoreErrorOnTransition[ eNStates ]
bool bSimulate
int eState
char* pcName
char* pcPud_name
const char* pcState

Protected Methods

int sendEventPuDone( int eState_on_success )
int updateStateAfterConfigReq( int eNewState = eInitialised )

Private Methods

int setIgnoreErrorOnTransition( const char* pcTransition, bool bValue )

Documentation

Proxy class for a GTM board in the run control server. The rcGTM class corresponds to the granule timing board (GTM). There is one instance of a GTM per granule and it in a way defines the granule. There are 1:M relationship to FEMs, 1:M to DCMs and partition modules. These relationsships are currently instantiated out of the configuration files, eventually they will be read out of the global database.
The GTM inherits from the process unit object (PU).

A special feature of the GTM operation is that fact that there are slight differences between the operational sequence from board to board. The "offenders" are BB, ZDC and TEC. Their behavior is accomodated by inheritance. This results in most member functions being protected.

The static member function createGTM creates the "right" object based on the global ONCS naming convention and returns a pointer to the rcGTM object.

The following things happen during the state transition functions:

static rcGTM* createGTM( const char *name, const char *pud_name, long vme_address, const char* pcServerName = NULL)
Static member function that is used to create GTMs. This member function must be used to instantiate rcGTM objects (constructor is private) in order to allow the creation of the right version of the GTM board.

virtual ~rcGTM()
Dtor: removes the proxy from the run control server but does not talk to VxWorks

static member function that affect all instances of the GTMs

static void dump_all( ostream &os = cout )
Calls dump on all instances

static void listAll( ostream &os = cout )
Calls list on all objects

static int createAllGtms()
Creates all GTMs in Vxworks

print, dump, list functions and accessors

void print( ostream &os = cout )
Prints a one line summary of the instance to os

void dump( ostream &os = cout )
Prints detailed information about the GTM instance to os

const char* getDefaultModeBitFile()
Returns the default mode bit file

const char* getModeBitFile()
Returns the current mode bit file

void setDefaultModeBitFile( const char* newFileName )
Sets the default mode bit file

void setModeBitFile( const char* newFileName )
Sets the mode bit file

void resetModeBitFile()
Resets the mode bit file

inline long getAddress()
Returns the (hex) address in the VME crate

inline const char* getServerName()
Returns the server name that manages this object

Configuration Commands and retrieval of configuration parameters

int configure( const char* cmd, const char *value, const char *aux_param )
Generic configuration command inherited from PU - see PU for details
Parameters:
command - command
value - value of the command
aux_param - auxilliary parameter

int addFem( FEM* pFem )
Adds an FEM to the list of FEMs that the GTM controls

int addDcm( DCM* pDcm )
Adds a DCM to the list of DCMs that the GTM controls

int addPar( Par* pPar )
Add a partition module to the list of partition modules that the GTM controls

static rcGTM* getGtmForDcm( const char *pcDcmName )
For a given Dcm name, return the GTM that has it in its internal list of associated Dcms or NULL

static rcGTM* getGtmForPar( const char *pcParName )
For a given Par name, return the GTM that has it in its internal list of associated Par or NULL

inline void setGranule( Granule *pGranule )
Set the granule that the GTM represents

inline Granule* getGranule()
Return a pointer to the granule that the GTM represents

rcGTM* castToGTM()
Inherited member from PU to mimic RTTI

BUSY functions to control the granule BUSY over VME

int setVmeBusy()
Sets the VME busy of the GTM via a RMI
Returns:
rcSuccess or rcFailure

int clearVmeBusy()
Clears the VME busy of the GTM via a RMI
Returns:
rcSuccess or rcFailure

Resetting the glink on the GTM

int resetGlink()
Resets the Glink of the GTM for the GTM with the name pcName.
Returns:
rcSuccess if the GTM exists

static int resetAllGlinks()
Resets the Glink of all GTM

Functions inherited from PU that make up the global state transitions

int connect()
Initial startup function. Creates the object in Vxworks

int initialise()
Initialises the board. This is a global operation for all the different flavors of GTM boards
Returns:
rcSuccess or rcFailure

virtual int download()
Downloads the board. Note that this function is virtual as the download procedure varies between some of the boards. The "generic" boards is the default, the BB, ZDC and TEC GTM need some "special" treatment. That is done by the corresponding subtype.
Returns:
rcSuccess or rcFailure

int start_run()
Starts the run. Currently there is no operation associated with the start run procedure as we start the GTM at the end of the download sequence.
Returns:
rcSuccess or rcFailure

int end_run()
Stops the run. Note that there is no action associated with this state at the moment.
Returns:
rcSuccess or rcFailure

virtual bool updatePu( int iStatus, int eState_on_success )
Standard updatePu as inherited from PU. Note that this is a virtual function as we need a special version for the BB and the ZDC due to the non-standard implementation of the GTM board.
Returns:
true [if we are all done and arrived in the final state successfully], false [if there is more work to do or an error occurred].
Parameters:
iStatus - status as reported by the remote CORBA GTM object
eState_on_success - final state upon successful operation

Function that coordinate the GTM-FEM-DCM interdependence

int adjustGtmFemState()
Adjusts the relative state between FEM and GTM

int initFemAfterGtmOk()
Initialises the FEMs once the GTM is in the "right" state
Returns:
rcSuccess Note that this function needs some work and currently always returns success (see expl in .cc file)

int initDcmAfterGtmOk()
Starts the initialisation sequence of the DCM system via the partition module once the GTMs are in the proper state
Returns:
rcSuccess if the DCM events were sent successfully, error otherwise

int finishDownloadingAfterFEM()
Checks that the FEMs are really all in the locked state. If that is the case it performs the last step of the download sequence, namely starting the local scheduler.
Returns:
rcSuccess All FEMs are locked and the scheduler is being started. rcFailure Otherwise

rcGTM(const char *name, const char *pud_name, long vme_address, const char* pcServerName )
Constructor. Creates the proxy but does not talk to VxWorks yet.
Parameters:
name - : name of the board according to the ONCS naming convention, eg GTM.DC.E
pud_name - : name of the corresponding design
vme_address - : address in the VME crate
pcServerName - : name of the server that manages this object

int sendGtmEvent( int iEventId )
Fills the corba event data into the generic ONCS event and sends the event to the event notifier
Returns:
rcSuccess, rcFaliure if we found bad configuration information in the modebit file.

void reportErrorFromGtmUpdate( int iStatus, int eState_on_success )
Reports an error from the updatePu member function

virtual bool updateInitialise()
Handles the updatePu case for initialise state transition

virtual bool updateDownload()
Handles the updatePu case for download state transition

bool updateStartRun()
Handles the updatePu case for start run state transition

int iLastCmdSent
Remembers the last command that we sent to Vxworks

Granule* myGranule
Pointer to the granule

list <FEM*> listFem
Internal list of the FEMs that are controlled by the GTM

list <DCM*> listDcm
Internal list of the DCMs that are controlled by the GTM

list <Par*> listPar
Internal list of the PARs that are controlled by the GTM

int createInVxWorks()
Creates the GTM in VxWorks using RMI on the object manager. It also raises the busy to make sure we have a disabled granule from the beginning.
Returns:
rcSuccess or rcFailure

GTM_ptr ptrGTM
Pointer to the corba object in VxWorks

bool bCreatedInVxWorks
True if we created the object in VxWorks

long lGranuleType
ONCS global granule type

long lVMEaddress
VME address of the board. Needed for initialisation

char* pcServerName
Name of the VxWorks object manager/corba server

char* pcDefaultModeBitFile
Take this mode bit file if we didn't redefine it

char* pcModeBitFile
Take this mode bit file if we configured the board differently

int iStopEOxx
Determines the stop sequence of the board. Currently always end of fiducial


Direct child classes:
rcGTMTec
rcGTMNevis
Author:
C.Witzig
Date: First (empty) implementation Aug 28, 98
Version:
Last update: Feb 1, 2000

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de