Cat
Public Types | Public Member Functions | Private Attributes | List of all members
Phaser Class Reference

#include <Phaser.h>

Inheritance diagram for Phaser:
Element Hierarchy Object Attrib

Public Types

typedef unsigned long U32
 
typedef unsigned short U16
 
typedef unsigned char U8
 
- Public Types inherited from Attrib
enum  Attribut {
  UNDEFINED, PASSIVE, ACTIVE, INTERFACE,
  IO, IODATA, ELEMENT, HARDWARE,
  PROCESSUS, SOFTWARE
}
 

Public Member Functions

 Phaser ()
 
 ~Phaser ()
 
void setPhase (unsigned char channel, unsigned char value)
 
void setPhase (unsigned char ch0, unsigned char ch1, unsigned char ch2, unsigned char ch3)
 
unsigned int phase (unsigned int ch)
 
void read ()
 
void write ()
 
void help ()
 
StatusCode init ()
 
void reset ()
 
void update ()
 
Registerreg ()
 
- Public Member Functions inherited from Element
 Element ()
 Standard constructor. More...
 
virtual ~Element ()
 Destructor. More...
 
void recursiveInitElement ()
 
void recursiveInitCommunications ()
 
StatusCode setConnection (Hierarchy *)
 
Hierarchyconnection ()
 
- Public Member Functions inherited from Hierarchy
 Hierarchy ()
 Standard constructor. More...
 
virtual ~Hierarchy ()
 Destructor. More...
 
void clear ()
 
void setParent (Hierarchy *parent)
 
Hierarchyparent ()
 
Hierarchyparent (std::string)
 
Hierarchyorigin ()
 
virtual void addChild (Hierarchy *element)
 
std::vector< Hierarchy * > children ()
 
Hierarchychild (std::string)
 
HierarchychildTyped (std::string)
 
unsigned long numberOfChildren ()
 
bool hasChildren ()
 
void delChild (Hierarchy *)
 
void delChild (std::string)
 
std::string path (std::string=std::string(""))
 
std::string pathTyped (std::string=std::string(""))
 
void tree (std::string indent=std::string(""))
 
void tree ()
 
- Public Member Functions inherited from Object
 Object ()
 Standard constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
std::string name () const
 
std::string type ()
 
unsigned char id ()
 
std::string title ()
 
void msgSvc (int level, std::string msg, std::string name)
 
void msg (std::string mymsg)
 
void verbose (std::string mymsg)
 
void debug (std::string mymsg)
 
void info (std::string mymsg)
 
void warning (std::string mymsg)
 
void error (std::string mymsg)
 
void fatal (std::string mymsg)
 
void msg (std::string mymsg, std::string name)
 
void verbose (std::string mymsg, std::string name)
 
void debug (std::string mymsg, std::string name)
 
void info (std::string mymsg, std::string name)
 
void warning (std::string mymsg, std::string name)
 
void error (std::string mymsg, std::string name)
 
void fatal (std::string mymsg, std::string name)
 
void setName (std::string name)
 
void setType (std::string type)
 
void setId (unsigned char id)
 
void setTitle (std::string title)
 
void setDllName (std::string dllName)
 
std::string dllName ()
 
- Public Member Functions inherited from Attrib
 Attrib ()
 Standard constructor. More...
 
virtual ~Attrib ()
 Destructor. More...
 
bool is (int attribut)
 
void add (int attribut)
 
void remove (int attribut)
 
std::string attributs ()
 

Private Attributes

unsigned char m_address
 
unsigned char m_phase [4]
 
Registerm_reg
 

Additional Inherited Members

- Protected Attributes inherited from Element
Hierarchym_connection
 
- Protected Attributes inherited from Attrib
std::string m_attribString [10]
 

Detailed Description

Definition at line 19 of file Phaser.h.

Member Typedef Documentation

◆ U16

typedef unsigned short Phaser::U16

Definition at line 22 of file Phaser.h.

◆ U32

typedef unsigned long Phaser::U32

Definition at line 21 of file Phaser.h.

◆ U8

typedef unsigned char Phaser::U8

Definition at line 23 of file Phaser.h.

Constructor & Destructor Documentation

◆ Phaser()

Phaser::Phaser ( )
inline

Definition at line 24 of file Phaser.h.

References Attrib::add(), Hierarchy::addChild(), Object::debug(), IOdata::defDataU8(), Attrib::ELEMENT, Attrib::HARDWARE, IOobject::io(), m_phase, m_reg, Object::setId(), and Object::setType().

24  {
25  setType("Phaser");
26  setId(0);
28  debug("Phaser built.","Phaser::Phaser");
29  m_phase[0]=99;
30  m_phase[1]=99;
31  m_phase[2]=99;
32  m_phase[3]=99;
33  m_reg=new Register();
34  m_reg->io()->defDataU8(3);
35  addChild(m_reg);
36  }
Register * m_reg
Definition: Phaser.h:108
unsigned char m_phase[4]
Definition: Phaser.h:107
void add(int attribut)
Definition: Attrib.h:67
void setType(std::string type)
Definition: Object.h:52
void setId(unsigned char id)
Definition: Object.h:53
void debug(std::string mymsg)
Definition: Object.h:37
virtual void addChild(Hierarchy *element)
Definition: Hierarchy.cpp:83
void defDataU8(unsigned long size)
Definition: IOdata.h:179
IOdata * io()
Definition: IOobject.h:66

◆ ~Phaser()

Phaser::~Phaser ( )
inline

Definition at line 38 of file Phaser.h.

38  {
39 // delete m_reg;
40  }

Member Function Documentation

◆ help()

void Phaser::help ( )
inlinevirtual

printout help for the element

Implements Element.

Definition at line 74 of file Phaser.h.

References Object::info(), and Object::name().

74 { info("Phaser "+name()+". No help.","Phaser::help"); };
void info(std::string mymsg)
Definition: Object.h:38
std::string name() const
Definition: Object.h:28

◆ init()

StatusCode Phaser::init ( )
inlinevirtual

init the component

Returns
void

Implements Element.

Definition at line 80 of file Phaser.h.

References StatusCode::SUCCESS.

80  {
81  return StatusCode::SUCCESS;
82  };

◆ phase()

unsigned int Phaser::phase ( unsigned int  ch)
inline

Definition at line 63 of file Phaser.h.

References m_phase, read(), and write().

Referenced by BOOST_PYTHON_MODULE(), PhaserRampExec::execute(), and PhaserRampExec::initialize().

63  {
64  read() ;
65  return m_phase[ch];
66  }
unsigned char m_phase[4]
Definition: Phaser.h:107
void read()
Definition: Phaser.cpp:23

◆ read()

void Phaser::read ( )

Definition at line 23 of file Phaser.cpp.

References IOdata::dataU8(), Object::debug(), IOobject::io(), StatusCode::isFailure(), itos(), m_phase, m_reg, Object::name(), IOobject::read(), and Object::warning().

Referenced by BOOST_PYTHON_MODULE(), PhaserRampExec::execute(), PhaserRampExec::initialize(), phase(), and update().

23  {
24  if (m_reg->read().isFailure()){
25  warning("Phaser register read failure.","Phaser::read");
26  }
27  else {
28  U8* buffer=m_reg->io()->dataU8();
29  unsigned int d0 = ( buffer[0] & 0x1F );
30  unsigned int d1 = (( buffer[0] & 0xE0 ) >> 5 ) | (( buffer[1] & 0x3 ) << 3 );
31  unsigned int d2 = (( buffer[1] >> 2 ) & 0x1F );
32  unsigned int d3 = (( buffer[1] >> 7 ) & 0x1 ) | ((buffer[2] & 0xF) << 1);
33  debug("reading "+name()+" phases : "+
34  itos(d0)+" "+
35  itos(d1)+" "+
36  itos(d2)+" "+
37  itos(d3),
38  "Phaser::read");
39  m_phase[0]=d0;
40  m_phase[1]=d1;
41  m_phase[2]=d2;
42  m_phase[3]=d3;
43  }
44 }
std::string itos(int)
Definition: Tools.cpp:46
bool isFailure() const
Definition: StatusCode.h:68
Register * m_reg
Definition: Phaser.h:108
unsigned char m_phase[4]
Definition: Phaser.h:107
virtual StatusCode read()
Definition: IOobject.h:73
unsigned char U8
Definition: ICECALv3.h:55
void debug(std::string mymsg)
Definition: Object.h:37
U8 * dataU8()
Definition: IOdata.h:214
std::string name() const
Definition: Object.h:28
void warning(std::string mymsg)
Definition: Object.h:39
IOdata * io()
Definition: IOobject.h:66

◆ reg()

Register* Phaser::reg ( )
inline

Definition at line 101 of file Phaser.h.

References m_reg.

Referenced by BOOST_PYTHON_MODULE(), and Proto40MHz_v1::Proto40MHz_v1().

101  {
102  return m_reg;
103  }
Register * m_reg
Definition: Phaser.h:108

◆ reset()

void Phaser::reset ( )
inlinevirtual

Resets the Element so that is is in a standard and safe situation. Different from Element::init which configure the Element. Element::reset() is more an Emergency pull. It is often/usually called by the recursiveInitElement method at the start of the program.

Implements Element.

Definition at line 91 of file Phaser.h.

91  {
92  };

◆ setPhase() [1/2]

void Phaser::setPhase ( unsigned char  channel,
unsigned char  value 
)
inline

Definition at line 42 of file Phaser.h.

References Object::info(), itos(), m_phase, and write().

Referenced by BOOST_PYTHON_MODULE(), PhaserRampExec::execute(), and PhaserRampExec::finalize().

42  {
43  info("Set Phase "+itos(channel)+" to "+itos(value),"Phaser::setPhase");
44  m_phase[channel]=value;
45  write();
46  }
void info(std::string mymsg)
Definition: Object.h:38
std::string itos(int)
Definition: Tools.cpp:46
unsigned char m_phase[4]
Definition: Phaser.h:107
void write()
Definition: Phaser.cpp:46

◆ setPhase() [2/2]

void Phaser::setPhase ( unsigned char  ch0,
unsigned char  ch1,
unsigned char  ch2,
unsigned char  ch3 
)
inline

Definition at line 48 of file Phaser.h.

References Object::info(), itos(), m_phase, and write().

53  {
54  m_phase[0]=ch0;
55  m_phase[1]=ch1;
56  m_phase[2]=ch2;
57  m_phase[3]=ch3;
58  info("Set Phases to "+itos(ch0)+" "+itos(ch1)+" "
59  +itos(ch2)+" "+itos(ch3));
60  write();
61  }
void info(std::string mymsg)
Definition: Object.h:38
std::string itos(int)
Definition: Tools.cpp:46
unsigned char m_phase[4]
Definition: Phaser.h:107
void write()
Definition: Phaser.cpp:46

◆ update()

void Phaser::update ( )
inlinevirtual

◆ write()

void Phaser::write ( )

Definition at line 46 of file Phaser.cpp.

References IOdata::dataU8(), Object::debug(), IOobject::io(), StatusCode::isFailure(), itos(), m_phase, m_reg, Object::name(), Object::warning(), and IOobject::write().

Referenced by BOOST_PYTHON_MODULE(), PhaserRampExec::execute(), PhaserRampExec::finalize(), phase(), and setPhase().

46  {
47  U8* buffer=m_reg->io()->dataU8();
48  buffer[0]=(m_phase[0] & 0x1F) | ((m_phase[1] & 0x7)<<5);
49  buffer[1]=((m_phase[1]>>3)& 0x3) |
50  ((m_phase[2]& 0x1F)<<2) |
51  ((m_phase[3]&0x1)<<7);
52  buffer[2]=(m_phase[3]>>1)&0xF;
53  debug("setting "+name()+" phases : "+itos(m_phase[0])+" "+
54  itos(m_phase[1])+" "+itos(m_phase[2])+" "+itos(m_phase[3]),
55  "Phaser::write");
56  if (m_reg->write().isFailure()){
57  warning("Phaser register write failure.","Phaser::write");
58  }
59 }
std::string itos(int)
Definition: Tools.cpp:46
bool isFailure() const
Definition: StatusCode.h:68
Register * m_reg
Definition: Phaser.h:108
unsigned char m_phase[4]
Definition: Phaser.h:107
virtual StatusCode write()
Definition: IOobject.h:80
unsigned char U8
Definition: ICECALv3.h:55
void debug(std::string mymsg)
Definition: Object.h:37
U8 * dataU8()
Definition: IOdata.h:214
std::string name() const
Definition: Object.h:28
void warning(std::string mymsg)
Definition: Object.h:39
IOdata * io()
Definition: IOobject.h:66

Member Data Documentation

◆ m_address

unsigned char Phaser::m_address
private

Definition at line 106 of file Phaser.h.

◆ m_phase

unsigned char Phaser::m_phase[4]
private

Definition at line 107 of file Phaser.h.

Referenced by phase(), Phaser(), read(), setPhase(), and write().

◆ m_reg

Register* Phaser::m_reg
private

Definition at line 108 of file Phaser.h.

Referenced by Phaser(), read(), reg(), and write().


The documentation for this class was generated from the following files: