fdhwlib
2.0.25
|
#include <FltRegister.h>
Standard class to account for the registers on the FLT board.
There are functions to read/write to the register. A special option allows to send a broadcast to the same type of register on all slots with one command.
Here a register is a long word at a defined address <addr> in the PBUS memory. The <addr> is calculated by the constructor from the base address of the module, the channel ID and the register ID as given in the FLT manual (s. 32bit PBUS address).
Registers often contain independant bits of information. To modify only several bits without changing the rest of the register it is necessary to read the register before writing the new data. To ensure a sane result in a multi process enironment the Bits methods are introduced. It is not possible to apply the the broadcast feature to this commands as there is no "broadcast reading".
Changes:
Definition at line 54 of file FltRegister.h.
FltRegister::FltRegister | ( | const char * | name, |
int | slotID, | ||
int | regID, | ||
int | r, | ||
int | w | ||
) |
virtual FltRegister::~FltRegister | ( | ) | [virtual] |
void FltRegister::broadcast | ( | unsigned long | data | ) |
Write to all register of this type on all available slots.
void FltRegister::get | ( | FEunitData ** | data | ) |
Read the unit data of this class.
unsigned long FltRegister::getAddr | ( | ) |
Get address.
const char* FltRegister::getName | ( | ) |
bool FltRegister::isReadable | ( | ) |
bool FltRegister::isWriteable | ( | ) |
unsigned long FltRegister::read | ( | ) |
Read the register.
unsigned long FltRegister::read | ( | unsigned long | addr | ) |
Read with an offset address.
This command is intended for memories that fit in the register address scheme
Reimplemented from Pbus.
void FltRegister::readBlock | ( | unsigned long | addr, |
unsigned long * | data, | ||
unsigned long | n | ||
) |
Read a block of the memory.
This command is intended for memories that fit in the register address scheme
void FltRegister::setBitsToHigh | ( | unsigned long | mask | ) |
All bits in the <mask> with the value 1 are set 1 (high).
All bits corresponding to a 0 in the mask are not changed.
Example: Set bits 2 and 16 to high. setBitsToHigh(0x00010004)
void FltRegister::setBitsToLow | ( | unsigned long | mask | ) |
All bits in the <mask> with the value 1 are set 0 (low).
All bits corresponding to a 0 in the mask are not changed.
Example: Set bits in the first byte to low. setBitsToLow(0x000000ff)
void FltRegister::write | ( | unsigned long | data | ) |
Write to the register.
void FltRegister::write | ( | unsigned long | addr, |
unsigned long | data | ||
) |
Write with an offset address.
This command is intended for memories that fit in the register address scheme
Reimplemented from Pbus.
void FltRegister::writeBits | ( | unsigned long | data, |
unsigned long | mask, | ||
int | shift | ||
) |
Write the <data> to the certain bit sequence.
The bit sequence starts <shift> bits from the lowest bit. Starting from there a bit is changed if the <mask> contains a '1'.
Example: Write 14 to the bits 23-19 (5 bits) writeBits(14,0x1f,19);
virtual int FltRegister::writeBitsByName | ( | char * | name, |
unsigned long | data | ||
) | [virtual] |
Set a bit field by name.
The bit field have to be defined in the specialized classes. Standard operations known are
name | name of the bit field |
data | vaues to write to the specified bit field |
Reimplemented in FltCntrlStatus, and FltMargins.
unsigned long FltRegister::addr [private] |
Definition at line 145 of file FltRegister.h.
const char* FltRegister::name [private] |
Definition at line 148 of file FltRegister.h.
bool FltRegister::readable [private] |
Definition at line 151 of file FltRegister.h.
bool FltRegister::writeable [private] |
Definition at line 154 of file FltRegister.h.