Public Member Functions | Private Member Functions | Private Attributes

UdpSimulator Class Reference

#include <Simulator.h>

Collaboration diagram for UdpSimulator:
Collaboration graph
[legend]

Public Member Functions

 UdpSimulator (int rocid, int syncscale=2, int period0=0, int period1=0, int ctrlport=0)
 Constructor.
virtual ~UdpSimulator ()
bool initNewSockets ()
void dispatchNewSockets (int tmout=1000)
void OnRawData (int number, const char *buf, int len, struct sockaddr *, socklen_t)
int checkCtrlOperationAllowed (roc::UdpMessageFull *pkt, in_addr_t src_ip, int src_port)
void mainLoop ()
uint32_t PutReg (int nodekind, uint32_t addr, uint32_t val, uint8_t *rawdata)
uint32_t GetReg (int nodekind, uint32_t addr, uint32_t *retVal, void *rawdata=0, int *rawdatasize=0)
uint32_t NOper (int nodekind, uint32_t num, uint32_t *oper)
void fillRareSyncData (uint8_t *target, uint16_t numOfDatas)
void makeSysMessage (uint8_t typ, uint32_t arg=0)
void processDataRequest (roc::UdpDataRequestFull *pkt)
void setLostRates (double recv=0., double send=0.)

Private Member Functions

uint32_t & syncMDelay ()
uint32_t & gpioConfig ()
bool doRecvLost ()
bool doSendLost ()
void resetSimulator ()
bool sendDataPacket (uint32_t pktid)

Private Attributes

uint32_t nxRegister [NX_REG_SIZE]
uint32_t gpioRegs [GPIO_REG_SIZE]
int s_data
int s_ctrl
long double clockScrewUp
uint64_t nextTimeHit
unsigned nextHitCounter
uint64_t nextEventNumber
uint64_t nextTimeNoise
uint64_t nextTimeSync
uint64_t nextTimeAUX0
bool nextAUX0Falling
uint64_t periodAUX0
uint64_t nextTimeAUX1
bool nextAUX1Falling
uint64_t periodAUX1
uint32_t lastEpoch
uint64_t nextSyncEvent
double recvLostRate
double sendLostRate
unsigned recvLostCounter
unsigned sendLostCounter
uint64_t totalSendCounter
uint64_t totalSendLosts
uint64_t totalRecvCounter
uint64_t totalRecvLosts
uint32_t recvDataSize
uint32_t sendDataSize
uint32_t takeDataSize
roc::BoardStatistic fStat

Detailed Description

SysCore Simulator class

The UdpSimulator class is implemented to simulate the behavior of the ROC Board. You can use and test the roc::Board class and the DAQ analysis system without having an actual ROC at your hands.

Definition at line 137 of file Simulator.h.


Constructor & Destructor Documentation

UdpSimulator::UdpSimulator ( int  rocid,
int  syncscale = 2,
int  period0 = 0,
int  period1 = 0,
int  ctrlport = 0 
)
UdpSimulator::~UdpSimulator (  )  [virtual]

Definition at line 198 of file Simulator.cxx.

References s_ctrl, and s_data.


Member Function Documentation

int UdpSimulator::checkCtrlOperationAllowed ( roc::UdpMessageFull pkt,
in_addr_t  src_ip,
int  src_port 
)
void UdpSimulator::dispatchNewSockets ( int  tmout = 1000  ) 

Definition at line 297 of file Simulator.cxx.

References OnRawData(), s_ctrl, and s_data.

Referenced by mainLoop().

bool UdpSimulator::doRecvLost (  )  [private]

Definition at line 227 of file Simulator.cxx.

References recvLostCounter, recvLostRate, totalRecvCounter, and totalRecvLosts.

Referenced by OnRawData().

bool UdpSimulator::doSendLost (  )  [private]

Definition at line 245 of file Simulator.cxx.

References sendLostCounter, sendLostRate, totalSendCounter, and totalSendLosts.

Referenced by OnRawData(), and sendDataPacket().

void UdpSimulator::fillRareSyncData ( uint8_t *  target,
uint16_t  numOfDatas 
)
uint32_t UdpSimulator::GetReg ( int  nodekind,
uint32_t  addr,
uint32_t *  retVal,
void *  rawdata = 0,
int *  rawdatasize = 0 
)
uint32_t& UdpSimulator::gpioConfig (  )  [inline, private]

Definition at line 143 of file Simulator.h.

References gpioRegs.

Referenced by fillRareSyncData(), and UdpSimulator().

bool UdpSimulator::initNewSockets (  ) 

Definition at line 274 of file Simulator.cxx.

References sc_config::ctrlPort, sc_config::dataPort, gC, s_ctrl, s_data, and StartUdp().

Referenced by main().

void UdpSimulator::mainLoop (  ) 
void UdpSimulator::makeSysMessage ( uint8_t  typ,
uint32_t  arg = 0 
)
uint32_t UdpSimulator::NOper ( int  nodekind,
uint32_t  num,
uint32_t *  oper 
)

Definition at line 778 of file Simulator.cxx.

References GetReg(), NOPER_GET, NOPER_PUT, and PutReg().

Referenced by OnRawData().

void UdpSimulator::OnRawData ( int  number,
const char *  buf,
int  len,
struct sockaddr *  sa_from,
socklen_t  sa_len 
)
void UdpSimulator::processDataRequest ( roc::UdpDataRequestFull pkt  ) 
uint32_t UdpSimulator::PutReg ( int  nodekind,
uint32_t  addr,
uint32_t  val,
uint8_t *  rawdata 
)

Definition at line 625 of file Simulator.cxx.

References sc_data::buf, sc_data::cmdListPtr, sc_data::cmdsList, sc_data::controlConnected, sc_data::controlIp, sc_data::controlLocked, sc_data::controlPort, sc_data::daqState, sc_data::data_taking_on, sc_data::droppkt_id, sc_config::flushTimeout, gC, gD, get_clock(), base::GPIO_CONFIG, GPIO_REG_SIZE, gpioRegs, sc_data::headid, sc_data::high_water, sc_data::last_req_pkt_id, sc_data::lastControlPacketId, sc_data::lastFlushTime, sc_data::lastMasterPacketId, sc_data::low_water, makeSysMessage(), sc_data::masterConnected, sc_data::masterDataPort, sc_data::masterIp, sc_data::masterPort, sc_data::next_send_id, NODE_CONTROL, NODE_MASTER, NX_REG_SIZE, nxRegister, sc_data::resend_size, resetSimulator(), ROC_ADDSYSMSG, ROC_CMD_LST_ACTIVE, ROC_CMD_LST_MEM, ROC_CMD_LST_NR, ROC_CMD_LST_NUMBER, ROC_CMD_LST_SIZE, ROC_ETH_BUFFER_FLUSH_TIMER, ROC_ETH_CONSOLE_CMD, ROC_ETH_CONSOLE_OUTPUT, ROC_ETH_DLM, ROC_ETH_HIGHWATER, ROC_ETH_LOWWATER, ROC_ETH_MASTER_DATAPORT, ROC_ETH_MASTER_LOGIN, ROC_ETH_MASTER_LOGOUT, ROC_ETH_OCM, ROC_ETH_START_DAQ, ROC_ETH_STOP_DAQ, ROC_ETH_SUSPEND_DAQ, ROC_NX_FIFO_RESET, ROC_NX_HWV, ROC_NX_I2C_DATA, ROC_NX_I2C_REGISTER, ROC_NX_I2C_REGRESET, ROC_NX_I2C_RESET, ROC_NX_I2C_SLAVEADDR, ROC_NX_I2C_SWITCH, ROC_NX_NXACTIVE, ROC_ROCID, sc_config::rocNumber, sc_data::send_limit, sendLostRate, roc::SYSMSG_DAQ_FINISH, roc::SYSMSG_DAQ_START, roc::SYSMSG_USER, totalRecvCounter, totalRecvLosts, totalSendCounter, and totalSendLosts.

Referenced by mainLoop(), NOper(), and OnRawData().

void UdpSimulator::resetSimulator (  )  [private]
bool UdpSimulator::sendDataPacket ( uint32_t  pktid  )  [private]
void UdpSimulator::setLostRates ( double  recv = 0.,
double  send = 0. 
)
uint32_t& UdpSimulator::syncMDelay (  )  [inline, private]

Definition at line 142 of file Simulator.h.

References base::GPIO_SYNCM_SCALEDOWN, and gpioRegs.

Referenced by fillRareSyncData(), and UdpSimulator().


Field Documentation

long double UdpSimulator::clockScrewUp [private]

Definition at line 148 of file Simulator.h.

Referenced by fillRareSyncData(), and resetSimulator().

Definition at line 176 of file Simulator.h.

Referenced by GetReg(), mainLoop(), and UdpSimulator().

uint32_t UdpSimulator::gpioRegs[GPIO_REG_SIZE] [private]

Definition at line 140 of file Simulator.h.

Referenced by GetReg(), gpioConfig(), PutReg(), syncMDelay(), and UdpSimulator().

uint32_t UdpSimulator::lastEpoch [private]

Definition at line 160 of file Simulator.h.

Referenced by fillRareSyncData(), and resetSimulator().

Definition at line 155 of file Simulator.h.

Referenced by fillRareSyncData(), and resetSimulator().

Definition at line 158 of file Simulator.h.

Referenced by fillRareSyncData(), and resetSimulator().

uint64_t UdpSimulator::nextEventNumber [private]

Definition at line 151 of file Simulator.h.

Referenced by fillRareSyncData(), and resetSimulator().

unsigned UdpSimulator::nextHitCounter [private]

Definition at line 150 of file Simulator.h.

Referenced by fillRareSyncData(), and resetSimulator().

uint64_t UdpSimulator::nextSyncEvent [private]

Definition at line 161 of file Simulator.h.

Referenced by fillRareSyncData(), and resetSimulator().

uint64_t UdpSimulator::nextTimeAUX0 [private]

Definition at line 154 of file Simulator.h.

Referenced by fillRareSyncData(), and resetSimulator().

uint64_t UdpSimulator::nextTimeAUX1 [private]

Definition at line 157 of file Simulator.h.

Referenced by fillRareSyncData(), and resetSimulator().

uint64_t UdpSimulator::nextTimeHit [private]

Definition at line 149 of file Simulator.h.

Referenced by fillRareSyncData(), and resetSimulator().

uint64_t UdpSimulator::nextTimeNoise [private]

Definition at line 152 of file Simulator.h.

Referenced by fillRareSyncData(), and resetSimulator().

uint64_t UdpSimulator::nextTimeSync [private]

Definition at line 153 of file Simulator.h.

Referenced by fillRareSyncData(), and resetSimulator().

uint32_t UdpSimulator::nxRegister[NX_REG_SIZE] [private]

Definition at line 139 of file Simulator.h.

Referenced by GetReg(), PutReg(), and UdpSimulator().

uint64_t UdpSimulator::periodAUX0 [private]

Definition at line 156 of file Simulator.h.

Referenced by fillRareSyncData(), resetSimulator(), and UdpSimulator().

uint64_t UdpSimulator::periodAUX1 [private]

Definition at line 159 of file Simulator.h.

Referenced by fillRareSyncData(), resetSimulator(), and UdpSimulator().

uint32_t UdpSimulator::recvDataSize [private]

Definition at line 173 of file Simulator.h.

Referenced by mainLoop(), OnRawData(), and UdpSimulator().

unsigned UdpSimulator::recvLostCounter [private]

Definition at line 167 of file Simulator.h.

Referenced by doRecvLost(), and setLostRates().

double UdpSimulator::recvLostRate [private]

Definition at line 164 of file Simulator.h.

Referenced by doRecvLost(), and setLostRates().

int UdpSimulator::s_ctrl [private]
int UdpSimulator::s_data [private]
uint32_t UdpSimulator::sendDataSize [private]

Definition at line 174 of file Simulator.h.

Referenced by mainLoop(), OnRawData(), sendDataPacket(), and UdpSimulator().

unsigned UdpSimulator::sendLostCounter [private]

Definition at line 168 of file Simulator.h.

Referenced by doSendLost(), and setLostRates().

double UdpSimulator::sendLostRate [private]

Definition at line 165 of file Simulator.h.

Referenced by doSendLost(), PutReg(), and setLostRates().

uint32_t UdpSimulator::takeDataSize [private]

Definition at line 175 of file Simulator.h.

Referenced by mainLoop(), and UdpSimulator().

uint64_t UdpSimulator::totalRecvCounter [private]

Definition at line 171 of file Simulator.h.

Referenced by doRecvLost(), mainLoop(), PutReg(), and setLostRates().

uint64_t UdpSimulator::totalRecvLosts [private]

Definition at line 171 of file Simulator.h.

Referenced by doRecvLost(), mainLoop(), PutReg(), and setLostRates().

uint64_t UdpSimulator::totalSendCounter [private]

Definition at line 170 of file Simulator.h.

Referenced by doSendLost(), mainLoop(), PutReg(), and setLostRates().

uint64_t UdpSimulator::totalSendLosts [private]

Definition at line 170 of file Simulator.h.

Referenced by doSendLost(), mainLoop(), PutReg(), and setLostRates().


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