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

#include <ICPhaser.h>

Inheritance diagram for ICPhaser:
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

 ICPhaser ()
 
 ~ICPhaser ()
 
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 status ()
 
void help ()
 
StatusCode init ()
 
void reset ()
 
void update ()
 
RegisterregConfig ()
 
RegisterregStatus ()
 
void setAddress (U8 address)
 
U8 address ()
 
- 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

U8 m_address
 
unsigned char m_phase [4]
 
Registerm_regConfig
 
Registerm_regStatus
 

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 ICPhaser.h.

Member Typedef Documentation

◆ U16

typedef unsigned short ICPhaser::U16

Definition at line 22 of file ICPhaser.h.

◆ U32

typedef unsigned long ICPhaser::U32

Definition at line 21 of file ICPhaser.h.

◆ U8

typedef unsigned char ICPhaser::U8

Definition at line 23 of file ICPhaser.h.

Constructor & Destructor Documentation

◆ ICPhaser()

ICPhaser::ICPhaser ( )
inline

Definition at line 24 of file ICPhaser.h.

References Attrib::add(), Hierarchy::addChild(), IOdata::Byte, Object::debug(), IOdata::defDataU8(), Attrib::ELEMENT, Attrib::HARDWARE, IOobject::io(), m_phase, m_regConfig, m_regStatus, Object::setId(), Object::setName(), IOdata::setSubAddress(), Object::setType(), and IOdata::setWordSize().

24  {
25  setType("ICPhaser");
26  setId(0);
27 
29  debug("ICPhaser built.","ICPhaser::ICPhaser");
30 
31  m_phase[0]=99;
32  m_phase[1]=99;
33  m_phase[2]=99;
34  m_phase[3]=99;
35 
36  m_regConfig=new Register();
37  m_regStatus=new Register();
38 
39  m_regConfig->setName("ConfigRegister");
40  m_regStatus->setName("StatusRegister");
41 
44 
45  m_regConfig->io()->defDataU8(3);
46  m_regStatus->io()->defDataU8(2);
47 
50 
53  }
unsigned char m_phase[4]
Definition: ICPhaser.h:139
void add(int attribut)
Definition: Attrib.h:67
void setName(std::string name)
Definition: Object.h:51
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
StatusCode setSubAddress(U32 subAddress)
Definition: IOdata.h:81
virtual void addChild(Hierarchy *element)
Definition: Hierarchy.cpp:83
StatusCode setWordSize(IOdata::WordSize wordSize)
Definition: IOdata.h:126
Register * m_regConfig
Definition: ICPhaser.h:140
void defDataU8(unsigned long size)
Definition: IOdata.h:179
Register * m_regStatus
Definition: ICPhaser.h:141
IOdata * io()
Definition: IOobject.h:66

◆ ~ICPhaser()

ICPhaser::~ICPhaser ( )
inline

Definition at line 55 of file ICPhaser.h.

55  {
56  }

Member Function Documentation

◆ address()

U8 ICPhaser::address ( )
inline

Definition at line 133 of file ICPhaser.h.

References m_address.

Referenced by BOOST_PYTHON_MODULE(), read(), setAddress(), and status().

133  {
134  return m_address;
135  }
U8 m_address
Definition: ICPhaser.h:138

◆ help()

void ICPhaser::help ( )
inlinevirtual

printout help for the element

Implements Element.

Definition at line 92 of file ICPhaser.h.

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

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

◆ init()

StatusCode ICPhaser::init ( )
inlinevirtual

init the component

Returns
void

Implements Element.

Definition at line 99 of file ICPhaser.h.

References reset(), and StatusCode::SUCCESS.

99  {
100  return StatusCode::SUCCESS;
101  };

◆ phase()

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

Definition at line 80 of file ICPhaser.h.

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

80  {
81  read() ;
82  return m_phase[ch];
83  }
void read()
Definition: ICPhaser.cpp:16
unsigned char m_phase[4]
Definition: ICPhaser.h:139

◆ read()

void ICPhaser::read ( )

Definition at line 16 of file ICPhaser.cpp.

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

Referenced by BOOST_PYTHON_MODULE(), phase(), and update().

16  {
18  U8* buffer=m_regConfig->io()->dataU8();
19  buffer[2]=((m_regConfig->io()->subAddress())&0x1F)+(128);
20  buffer[1]=0;
21  buffer[0]=0;
22  if (m_regConfig->read().isFailure()){
23  warning("ICPhaser configuration register read failure.","ICPhaser::read");
24  }
25  else {
26  U8* buffer=m_regConfig->io()->dataU8();
27  m_phase[0] = buffer[0];
28  m_phase[1] = buffer[1];
29  debug("reading "+name()+" phases : "+
30  itos(m_phase[0])+" "+
31  itos(m_phase[1])+" "+
32  itos(m_phase[2])+" "+
33  itos(m_phase[3]),
34  "ICPhaser::read");
35  }
36 }
std::string itos(int)
Definition: Tools.cpp:46
bool isFailure() const
Definition: StatusCode.h:68
unsigned char m_phase[4]
Definition: ICPhaser.h:139
virtual StatusCode read()
Definition: IOobject.h:73
unsigned char U8
Definition: ICECALv3.h:55
void debug(std::string mymsg)
Definition: Object.h:37
StatusCode setAddress(U32 address)
Definition: IOdata.h:51
U8 * dataU8()
Definition: IOdata.h:214
std::string name() const
Definition: Object.h:28
U8 address()
Definition: ICPhaser.h:133
Register * m_regConfig
Definition: ICPhaser.h:140
U32 subAddress()
Definition: IOdata.h:89
void warning(std::string mymsg)
Definition: Object.h:39
IOdata * io()
Definition: IOobject.h:66

◆ regConfig()

Register* ICPhaser::regConfig ( )
inline

Definition at line 119 of file ICPhaser.h.

References m_regConfig.

Referenced by BOOST_PYTHON_MODULE().

119  {
120  return m_regConfig;
121  }
Register * m_regConfig
Definition: ICPhaser.h:140

◆ regStatus()

Register* ICPhaser::regStatus ( )
inline

Definition at line 123 of file ICPhaser.h.

References m_regStatus.

Referenced by BOOST_PYTHON_MODULE().

123  {
124  return m_regStatus;
125  }
Register * m_regStatus
Definition: ICPhaser.h:141

◆ reset()

void ICPhaser::reset ( )
virtual

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 49 of file ICPhaser.cpp.

References IOdata::dataU8(), IOobject::io(), StatusCode::isFailure(), m_regConfig, Object::warning(), and IOobject::write().

Referenced by BOOST_PYTHON_MODULE(), and init().

49  {
50  U8* buffer=m_regConfig->io()->dataU8();
51  buffer[2]=64;
52  buffer[1]=0;
53  buffer[0]=0;
54  if (m_regConfig->write().isFailure()){
55  warning("ICPhaser configuration register write failure. Cannot reset ICPhaser",
56  "ICPhaser::write");
57  }
58 }
bool isFailure() const
Definition: StatusCode.h:68
virtual StatusCode write()
Definition: IOobject.h:80
unsigned char U8
Definition: ICECALv3.h:55
U8 * dataU8()
Definition: IOdata.h:214
Register * m_regConfig
Definition: ICPhaser.h:140
void warning(std::string mymsg)
Definition: Object.h:39
IOdata * io()
Definition: IOobject.h:66

◆ setAddress()

void ICPhaser::setAddress ( U8  address)
inline

Definition at line 127 of file ICPhaser.h.

References address(), m_address, m_regConfig, m_regStatus, and IOobject::setAddress().

Referenced by BOOST_PYTHON_MODULE().

127  {
131  }
U8 m_address
Definition: ICPhaser.h:138
void setAddress(U32 address)
Definition: IOobject.h:84
U8 address()
Definition: ICPhaser.h:133
Register * m_regConfig
Definition: ICPhaser.h:140
Register * m_regStatus
Definition: ICPhaser.h:141

◆ setPhase() [1/2]

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

Definition at line 58 of file ICPhaser.h.

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

Referenced by BOOST_PYTHON_MODULE().

58  {
59  info("Set Phase "+itos(channel)+" to "
60  +itos(value),"ICPhaser::setPhase");
61  m_phase[channel]=value;
62  write();
63  }
void info(std::string mymsg)
Definition: Object.h:38
std::string itos(int)
Definition: Tools.cpp:46
unsigned char m_phase[4]
Definition: ICPhaser.h:139
void write()
Definition: ICPhaser.cpp:60

◆ setPhase() [2/2]

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

Definition at line 65 of file ICPhaser.h.

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

70  {
71  m_phase[0]=ch0;
72  m_phase[1]=ch1;
73  m_phase[2]=ch2;
74  m_phase[3]=ch3;
75  info("Set Phases to "+itos(ch0)+" "+itos(ch1)+" "
76  +itos(ch2)+" "+itos(ch3));
77  write();
78  }
void info(std::string mymsg)
Definition: Object.h:38
std::string itos(int)
Definition: Tools.cpp:46
unsigned char m_phase[4]
Definition: ICPhaser.h:139
void write()
Definition: ICPhaser.cpp:60

◆ status()

void ICPhaser::status ( )

Definition at line 38 of file ICPhaser.cpp.

References address(), IOdata::dataU8(), IOdata::dump(), IOobject::io(), StatusCode::isFailure(), m_regStatus, IOobject::read(), IOdata::setAddress(), IOdata::subAddress(), and Object::warning().

Referenced by BOOST_PYTHON_MODULE(), and phase().

38  {
40  U8* buffer=m_regStatus->io()->dataU8();
41  buffer[1]=((m_regStatus->io()->subAddress())&0x1F)+(160);
42  buffer[0]=0;
43  if (m_regStatus->read().isFailure()){
44  warning("ICPhaser status register read failure.","ICPhaser::read");
45  }
46  m_regStatus->io()->dump(1);
47 }
bool isFailure() const
Definition: StatusCode.h:68
void dump(unsigned int printout=0)
Definition: IOdata.cpp:94
virtual StatusCode read()
Definition: IOobject.h:73
unsigned char U8
Definition: ICECALv3.h:55
StatusCode setAddress(U32 address)
Definition: IOdata.h:51
U8 * dataU8()
Definition: IOdata.h:214
U8 address()
Definition: ICPhaser.h:133
U32 subAddress()
Definition: IOdata.h:89
void warning(std::string mymsg)
Definition: Object.h:39
Register * m_regStatus
Definition: ICPhaser.h:141
IOdata * io()
Definition: IOobject.h:66

◆ update()

void ICPhaser::update ( )
inlinevirtual

◆ write()

void ICPhaser::write ( )

Definition at line 60 of file ICPhaser.cpp.

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

Referenced by BOOST_PYTHON_MODULE(), phase(), and setPhase().

60  {
61  U8* buffer=m_regConfig->io()->dataU8();
62  buffer[2]=(m_regConfig->io()->subAddress())&0x1F;
63  buffer[1]=m_phase[0]&0xff;
64  buffer[0]=m_phase[1]&0xff;
65  // phase[2] and phase[3] not implemented - only for test purpose
66  debug("Setting "+name()+" phases : "+itos(m_phase[0])+" "+
67  itos(m_phase[1])+" "+itos(m_phase[2])+" "+itos(m_phase[3]),
68  "ICPhaser::write");
69  m_regConfig->io()->dump(0);
70  if (m_regConfig->write().isFailure()){
71  warning("ICPhaser configuration register write failure.",
72  "ICPhaser::write");
73  }
74 }
std::string itos(int)
Definition: Tools.cpp:46
bool isFailure() const
Definition: StatusCode.h:68
unsigned char m_phase[4]
Definition: ICPhaser.h:139
virtual StatusCode write()
Definition: IOobject.h:80
void dump(unsigned int printout=0)
Definition: IOdata.cpp:94
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
Register * m_regConfig
Definition: ICPhaser.h:140
U32 subAddress()
Definition: IOdata.h:89
void warning(std::string mymsg)
Definition: Object.h:39
IOdata * io()
Definition: IOobject.h:66

Member Data Documentation

◆ m_address

U8 ICPhaser::m_address
private

Definition at line 138 of file ICPhaser.h.

Referenced by address(), and setAddress().

◆ m_phase

unsigned char ICPhaser::m_phase[4]
private

Definition at line 139 of file ICPhaser.h.

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

◆ m_regConfig

Register* ICPhaser::m_regConfig
private

Definition at line 140 of file ICPhaser.h.

Referenced by ICPhaser(), read(), regConfig(), reset(), setAddress(), and write().

◆ m_regStatus

Register* ICPhaser::m_regStatus
private

Definition at line 141 of file ICPhaser.h.

Referenced by ICPhaser(), regStatus(), setAddress(), and status().


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