#include <ABBdaemon.h>
Public Member Functions | |
ABBdaemonClient (const char *name="mprace-0", int role=0) | |
virtual | ~ABBdaemonClient () |
void | setReg (uint32_t reg, uint32_t value) |
void | enableDebugMessages (bool enable) |
uint32_t | submitReset (uint32_t reset=RESET_ALL) |
uint32_t | submitPut (uint32_t rocid, uint32_t retid, uint32_t addr, uint32_t value) |
uint32_t | submitNPut (uint32_t rocid, uint32_t retid, int n, uint32_t *addr, uint32_t *values, uint32_t *retvals=0) |
uint32_t | submitGet (uint32_t rocid, uint32_t retid, uint32_t addr, uint32_t *value) |
uint32_t | submitNGet (uint32_t rocid, uint32_t retid, int n, uint32_t *addr, uint32_t *value, uint32_t *retvals=0) |
uint32_t | submitNOper (uint32_t rocid, uint32_t retid, int n, uint32_t *addr, uint32_t *value, uint32_t *retvals=0) |
uint32_t | submitPutDLM (uint32_t value) |
uint32_t | submitGetDLM (uint32_t *value) |
uint32_t | readDMAserialized (const unsigned int address, DMABUFFER_HANDLE buffer_handle, const unsigned int count, const unsigned int offset=0, const bool inc=true, const bool lock=true, const float timeout=0.0) |
DMABUFFER_HANDLE | registerBuffer (unsigned int len, void *address) |
void | syncBuffer (DMABUFFER_HANDLE buffer) |
void | unregisterBuffer (DMABUFFER_HANDLE buffer) |
uint32_t | getFIFOStatus () |
uint32_t | getCTLStatus () |
void | getDesignID (uint32_t *version, uint32_t *major, uint32_t *author, uint32_t *minor) |
Protected Attributes | |
mprace::ABB * | board |
std::ostream * | debug |
Definition at line 47 of file ABBdaemon.h.
abbdaemon::ABBdaemonClient::ABBdaemonClient | ( | const char * | name = "mprace-0" , |
|
int | role = 0 | |||
) |
Definition at line 36 of file ABBdaemon.cxx.
abbdaemon::ABBdaemonClient::~ABBdaemonClient | ( | ) | [virtual] |
Destructor. Will clean up the connection.
Definition at line 49 of file ABBdaemon.cxx.
References board.
void abbdaemon::ABBdaemonClient::enableDebugMessages | ( | bool | enable | ) |
Enables or disables debug messages.
enable | If true, debug messages will be enabled. |
Definition at line 55 of file ABBdaemon.cxx.
References debug.
uint32_t abbdaemon::ABBdaemonClient::getCTLStatus | ( | ) |
Gets the FIFO status for the CTL FIFO (communication with the ROC). See the ABB (see ABB user guide section 3.1.16).
Definition at line 283 of file ABBdaemon.cxx.
References board, and CTL_STATUS.
Referenced by main().
void abbdaemon::ABBdaemonClient::getDesignID | ( | uint32_t * | version, | |
uint32_t * | major, | |||
uint32_t * | author, | |||
uint32_t * | minor | |||
) |
Gets the ABB design ID and stores the different parts of it in the given variables.
version | will hold the Design version | |
major | will hold the Design major revision | |
author | will hold the author code | |
minor | will hold the design minor revision |
Definition at line 290 of file ABBdaemon.cxx.
Referenced by main().
uint32_t abbdaemon::ABBdaemonClient::getFIFOStatus | ( | ) |
Gets the FIFO status (how many quad-words are inside the FIFO at the moment).
Definition at line 275 of file ABBdaemon.cxx.
References board, and EVENT_BUFFER_STATUS.
Referenced by main(), roc::AbbTransport::Read_Complete(), and roc::AbbTransport::Read_Size().
uint32_t abbdaemon::ABBdaemonClient::readDMAserialized | ( | const unsigned int | address, | |
DMABUFFER_HANDLE | buffer_handle, | |||
const unsigned int | count, | |||
const unsigned int | offset = 0 , |
|||
const bool | inc = true , |
|||
const bool | lock = true , |
|||
const float | timeout = 0.0 | |||
) |
Issue a readDMA, but properly lock before doing it so that multiple processes can use DMA.
board | The board to perform the DMA on | |
address | Address in the board. | |
buf | the mprace DMA buffer | |
count | Number of values to read from the board in dwords. | |
timeout | Timeout for the DMA read in milliseconds |
Definition at line 232 of file ABBdaemon.cxx.
Referenced by main(), and roc::AbbTransport::Read_Complete().
abbdaemon::DMABUFFER_HANDLE abbdaemon::ABBdaemonClient::registerBuffer | ( | unsigned int | len, | |
void * | address | |||
) |
Registers the given buffer for use with the ABBdaemon.
len | length in bytes of the given buffer | |
address | Address of the buffer |
Definition at line 251 of file ABBdaemon.cxx.
Referenced by main(), and roc::AbbTransport::ProcessPoolChanged().
void abbdaemon::ABBdaemonClient::setReg | ( | uint32_t | reg, | |
uint32_t | value | |||
) |
Extra functionality compare to normal daemon - Method to set register on ABB board directly
Definition at line 302 of file ABBdaemon.cxx.
References board.
Referenced by main().
uint32_t abbdaemon::ABBdaemonClient::submitGet | ( | uint32_t | rocid, | |
uint32_t | retid, | |||
uint32_t | addr, | |||
uint32_t * | value | |||
) |
Reads the value of the given address using the ABB daemon.
rocid | ROC id to send the message to | |
retid | Return host id to receive the data | |
addr | Address on the device from where to read the value | |
value | Pointer where to store the value |
Definition at line 180 of file ABBdaemon.cxx.
References submitNOper().
Referenced by roc::AbbDevice::CreateTransport(), roc::AbbDevice::ExecuteCommand(), and main().
uint32_t abbdaemon::ABBdaemonClient::submitGetDLM | ( | uint32_t * | value | ) |
Get a DLM from the port.
value | Pointer on where to write the incoming message. |
Definition at line 205 of file ABBdaemon.cxx.
uint32_t abbdaemon::ABBdaemonClient::submitNGet | ( | uint32_t | rocid, | |
uint32_t | retid, | |||
int | n, | |||
uint32_t * | addr, | |||
uint32_t * | value, | |||
uint32_t * | retvals = 0 | |||
) |
Read an array of n uint32_t addr and value pairs.
Definition at line 185 of file ABBdaemon.cxx.
References submitNOper().
uint32_t abbdaemon::ABBdaemonClient::submitNOper | ( | uint32_t | rocid, | |
uint32_t | retid, | |||
int | n, | |||
uint32_t * | addr, | |||
uint32_t * | value, | |||
uint32_t * | retvals = 0 | |||
) |
Reads or writes an array of n uint32_t addr and value pairs. The type of the operation is specified in the MSB of the address value (if the MSB is set the operation is write, if it is not set, the operation is read).
retvals | Array to store the return values of each command. |
Definition at line 89 of file ABBdaemon.cxx.
Referenced by roc::AbbDevice::ExecuteCommand(), main(), submitGet(), submitNGet(), submitNPut(), and submitPut().
uint32_t abbdaemon::ABBdaemonClient::submitNPut | ( | uint32_t | rocid, | |
uint32_t | retid, | |||
int | n, | |||
uint32_t * | addr, | |||
uint32_t * | values, | |||
uint32_t * | retvals = 0 | |||
) |
Submit an array of n uint32_t addr and value pairs. Internally, not only the main message queue is used, but another one is created with message size n * sizeof(uint32_t) and two messages max. The first message will be the addr array, the second one the value array. This queue will be removed by the server after processing the request.
retvals | An arry of n * sizeof(uint32_t) size which will store the return values for each put request. You can pass NULL to signalize that you are not interested in the return values. |
when | NULL-pointers are passed |
Definition at line 168 of file ABBdaemon.cxx.
References submitNOper().
uint32_t abbdaemon::ABBdaemonClient::submitPut | ( | uint32_t | rocid, | |
uint32_t | retid, | |||
uint32_t | addr, | |||
uint32_t | value | |||
) |
Writes a value at the given address using the ABB daemon.
rocid | ROC id to send the message to | |
retid | Return host id to receive the ackowledge | |
addr | Address on the device where to write the given value | |
value | The value to write at the specified address |
Definition at line 162 of file ABBdaemon.cxx.
References submitNOper().
Referenced by roc::AbbDevice::ExecuteCommand(), and main().
uint32_t abbdaemon::ABBdaemonClient::submitPutDLM | ( | uint32_t | value | ) |
Writes a DLM to the port.
value | The message to send. Only the 4 lsb are used. |
Definition at line 191 of file ABBdaemon.cxx.
References board, debug, DLM_H2R, and DLM_MASK.
Referenced by roc::AbbDevice::ExecuteCommand(), and main().
uint32_t abbdaemon::ABBdaemonClient::submitReset | ( | uint32_t | reset = RESET_ALL |
) |
Reset the CTL FIFOs in the ABB board.
Definition at line 60 of file ABBdaemon.cxx.
References board, CTL_CONTROL, CTL_FIFO_RESET, CTL_STATUS, debug, EVENT_BUFFER_RESET, EVENT_BUFFER_STATUS, GSR, abbdaemon::RESET_ABB, abbdaemon::RESET_ALL, abbdaemon::RESET_CTL_FIFO, and abbdaemon::RESET_FIFO_TIMEOUT.
Referenced by roc::AbbContextRef::CreateDaemon(), roc::AbbDevice::ExecuteCommand(), and main().
void abbdaemon::ABBdaemonClient::syncBuffer | ( | DMABUFFER_HANDLE | buffer | ) |
Synchronize the content of the given buffer, which has been registered with registerBuffer before. This should be done after a non-locking DMA is completed to ensure proper memory read.
Definition at line 260 of file ABBdaemon.cxx.
void abbdaemon::ABBdaemonClient::unregisterBuffer | ( | DMABUFFER_HANDLE | buffer | ) |
Unregisters (frees) the given buffer, which has been registered with registerBuffer before.
Definition at line 267 of file ABBdaemon.cxx.
References debug.
Referenced by main(), and roc::AbbTransport::ProcessPoolChanged().
mprace::ABB* abbdaemon::ABBdaemonClient::board [protected] |
Definition at line 49 of file ABBdaemon.h.
Referenced by ABBdaemonClient(), getCTLStatus(), getDesignID(), getFIFOStatus(), readDMAserialized(), registerBuffer(), setReg(), submitGetDLM(), submitNOper(), submitPutDLM(), submitReset(), and ~ABBdaemonClient().
std::ostream* abbdaemon::ABBdaemonClient::debug [protected] |
Definition at line 50 of file ABBdaemon.h.
Referenced by ABBdaemonClient(), enableDebugMessages(), readDMAserialized(), registerBuffer(), submitGetDLM(), submitNOper(), submitPutDLM(), submitReset(), and unregisterBuffer().