TwiceAsNice
2019-02-18
|
Reflective Memory Interface. More...
#include <RfmInterface.h>
Public Member Functions | |
RfmInterface () | |
default constructor More... | |
~RfmInterface () | |
default destructor More... | |
void | open (char *_devicePath) |
Opens the RFM2g driver and returns an RFM2g handle. More... | |
void | close () |
Closes an open RFM2g handle and releases resources allocated to it. More... | |
unsigned short int | getNodeID () |
Returns the RFM2g device node ID. More... | |
unsigned int | getBoardID () |
Returns the ID of the board corresponding to the passed-in handle. More... | |
unsigned int | getMemorySize () |
Returns the total amount of memory space available on the RFM2g device. More... | |
unsigned int | getLowestOffset () |
Returns the first available RFM2g offset. More... | |
std::string | getDeviceName () |
Returns the device name associated with an RFM2g handle. More... | |
std::string | getDriverVersion () |
Returns the RFM2g device driver version. More... | |
void | read (const unsigned int _offset, char *_buffer, const unsigned int _length) |
Reads one or more bytes starting at an offset in Reflective Memory. More... | |
unsigned int | peek32 (const unsigned int _offset) |
return the contents of the specified RFM2g offset. More... | |
void | write (const unsigned int _offset, const unsigned short int *_buffer, const unsigned int _length) |
Writes one or more bytes starting at an offset in Reflective Memory. More... | |
void | poke32 (const unsigned int _offset, const unsigned int _value) |
used to update a value in the RFM2g using a 32-bit longword. More... | |
void | enableEvent (const RFM2GEVENTTYPE _eventType) |
Enables reception of an RFM2g interrupt event. More... | |
void | disableEvent (const RFM2GEVENTTYPE _eventType) |
Disables the reception of an RFM2g event. More... | |
void | sendEvent (const signed short int _toNode, const RFM2GEVENTTYPE _eventType, const signed int _extendedData=0x0) |
Transmits the specified RFM2g interrupt event to one or all other RFM2g node IDs. More... | |
bool | waitForEvent (const RFM2GEVENTTYPE _eventType, const unsigned int _timeout, int &_extendedInfo) |
Blocks the calling process until an occurrence of the specified RFM2g interrupt event is received or a timeout (if enabled) expires. More... | |
void | cancelWaitForEvent (const RFM2GEVENTTYPE _eventType) |
Cancels any pending waitForEvent() calls for a specified event type. More... | |
void | enableEventCallback (RFM2GEVENTTYPE _eventType, RFM2G_EVENT_FUNCPTR _pEventFunc) |
Enables the interrupt notification for one event on one board. More... | |
void | disableEventCallback (RFM2GEVENTTYPE _eventType) |
disables interrupt notification for one event More... | |
void | clearEvent (RFM2GEVENTTYPE _eventType) |
Retrieves the current ON/OFF state of the Reflective Memory board's STATUS LED. More... | |
bool | getLedStatus () |
void | setLedStatus (const bool _ledStatus) |
Sets the ON/OFF state of the Reflective Memory board's STATUS LED. More... | |
bool | checkRingCont () |
shows whether or not the fiber ring is continuous through all nodes in the ring More... | |
Private Attributes | |
bool | m_connected |
Member variable indicates the status of the connection. More... | |
RFM2GHANDLE | m_handle |
The handle indentify the connection between the application program and the opened RFM2g interface. More... | |
Reflective Memory Interface.
This class wraps the interface from the Rfm and provides an simplyfied object oriented interface. It includes additional log messages as well as exception.
Laos::RfmInterface::RfmInterface | ( | ) |
default constructor
- |
Laos::RfmInterface::~RfmInterface | ( | ) |
default destructor
- |
void Laos::RfmInterface::cancelWaitForEvent | ( | const RFM2GEVENTTYPE | _eventType | ) |
Cancels any pending waitForEvent() calls for a specified event type.
_eventType | Specifies which interrupt event to cancel. Interrupts correlate to the following event IDs: |
Interrupt Event ID Reset Interrupt RFM2GEVENT_RESET Network Interrupt 1 RFM2GEVENT_INTR1 Network Interrupt 2 RFM2GEVENT_INTR2 Network Interrupt 3 RFM2GEVENT_INTR3 Network Interrupt 4 (Init Interrupt) RFM2GEVENT_INTR4 Bad Data Interrupt RFM2GEVENT_BAD_DATA RX FIFO Full Interrupt RFM2GEVENT_RXFIFO_FULL Rogue Packet Detected and Removed Interrupt RFM2GEVENT_ROGUE_PKT RX FIFO Almost Full Interrupt RFM2GEVENT_RXFIFO_AFULL Sync Loss Occurred Interrupt RFM2GEVENT_SYNC_LOSS Memory Write Inhibited RFM2GEVENT_MEM_WRITE_INHIBITED Memory Parity Error RFM2GEVENT_LOCAL_MEM_PARITY_ERR
Laos::Rfm::nullHandleException | |
Laos::Rfm::osException | |
Laos::Rfm::closeDeviceException | |
Laos::Rfm::notImplementedException | |
Laos::Rfm::invalidEventTypeException | |
Laos::Rfm::eventNotInUseException | |
Laos::Rfm::unknownEventException |
bool Laos::RfmInterface::checkRingCont | ( | ) |
shows whether or not the fiber ring is continuous through all nodes in the ring
No data is written to the Reflective Memory locations.
void Laos::RfmInterface::clearEvent | ( | RFM2GEVENTTYPE | _eventType | ) |
Retrieves the current ON/OFF state of the Reflective Memory board's STATUS LED.
Laos::Rfm::nullHandleException | |
Laos::Rfm::osException | |
Laos::Rfm::closeDeviceException | |
Laos::Rfm::notImplementedException | clears any or all pending interrupt events from a specified event FIFO |
_eventType | [in] The event FIFO to clear |
void Laos::RfmInterface::close | ( | ) |
Closes an open RFM2g handle and releases resources allocated to it.
Laos::Rfm::nullHandleException | |
Laos::Rfm::osException | |
Laos::Rfm::closeDeviceException | |
Laos::Rfm::notImplementedException |
void Laos::RfmInterface::disableEvent | ( | const RFM2GEVENTTYPE | _eventType | ) |
Disables the reception of an RFM2g event.
_eventType | Specifies which interrupt event to disable. Interrupts correlate to the following event IDs: Interrupt Event ID Reset Interrupt RFM2GEVENT_RESET Network Interrupt 1 RFM2GEVENT_INTR1 Network Interrupt 2 RFM2GEVENT_INTR2 Network Interrupt 3 RFM2GEVENT_INTR3 Network Interrupt 4 (Init Interrupt) RFM2GEVENT_INTR4 Bad Data Interrupt RFM2GEVENT_BAD_DATA RX FIFO Full Interrupt RFM2GEVENT_RXFIFO_FULL Rogue Packet Detected and Removed Interrupt RFM2GEVENT_ROGUE_PKT RX FIFO Almost Full Interrupt RFM2GEVENT_RXFIFO_AFULL Sync Loss Occurred Interrupt RFM2GEVENT_SYNC_LOSS Memory Write Inhibited RFM2GEVENT_MEM_WRITE_INHIBITED Memory Parity Error RFM2GEVENT_LOCAL_MEM_PARITY_ERR |
Laos::Rfm::nullHandleException | |
Laos::Rfm::osException | |
Laos::Rfm::closeDeviceException | |
Laos::Rfm::notImplementedException | |
Laos::Rfm::invalidEventTypeException | |
Laos::Rfm::internalDriverException | |
Laos::Rfm::unknownEventException |
void Laos::RfmInterface::disableEventCallback | ( | RFM2GEVENTTYPE | _eventType | ) |
disables interrupt notification for one event
_eventType | Specifies which interrupt event to disable |
void Laos::RfmInterface::enableEvent | ( | const RFM2GEVENTTYPE | _eventType | ) |
Enables reception of an RFM2g interrupt event.
_eventType | Specifies which interrupt event to enable. Interrupts correlate to the following event IDs: Interrupt Event ID Reset Interrupt RFM2GEVENT_RESET Network Interrupt 1 RFM2GEVENT_INTR1 Network Interrupt 2 RFM2GEVENT_INTR2 Network Interrupt 3 RFM2GEVENT_INTR3 Network Interrupt 4 (Init Interrupt) RFM2GEVENT_INTR4 Bad Data Interrupt RFM2GEVENT_BAD_DATA RX FIFO Full Interrupt RFM2GEVENT_RXFIFO_FULL Rogue Packet Detected and Removed Interrupt RFM2GEVENT_ROGUE_PKT RX FIFO Almost Full Interrupt RFM2GEVENT_RXFIFO_AFULL Sync Loss Occurred Interrupt RFM2GEVENT_SYNC_LOSS Memory Write Inhibited RFM2GEVENT_MEM_WRITE_INHIBITED Memory Parity Error RFM2GEVENT_LOCAL_MEM_PARITY_ERR |
Laos::Rfm::nullHandleException | |
Laos::Rfm::osException | |
Laos::Rfm::closeDeviceException | |
Laos::Rfm::notImplementedException | |
Laos::Rfm::invalidEventTypeException | |
Laos::Rfm::internalDriverException | |
Laos::Rfm::unknownEventException |
void Laos::RfmInterface::enableEventCallback | ( | RFM2GEVENTTYPE | _eventType, |
RFM2G_EVENT_FUNCPTR | _pEventFunc | ||
) |
Enables the interrupt notification for one event on one board.
_eventType | [in] Specifies which interrupt event to act upon |
_pEventFunc | [in] The address of the function to be called when the event occurs |
unsigned int Laos::RfmInterface::getBoardID | ( | ) |
Returns the ID of the board corresponding to the passed-in handle.
Laos::Rfm::nullHandleException | |
Laos::Rfm::osException | |
Laos::Rfm::closeDeviceException | |
Laos::Rfm::notImplementedException |
std::string Laos::RfmInterface::getDeviceName | ( | ) |
Returns the device name associated with an RFM2g handle.
Laos::Rfm::nullHandleException | |
Laos::Rfm::osException | |
Laos::Rfm::closeDeviceException | |
Laos::Rfm::notImplementedException |
std::string Laos::RfmInterface::getDriverVersion | ( | ) |
Returns the RFM2g device driver version.
Laos::Rfm::nullHandleException | |
Laos::Rfm::osException | |
Laos::Rfm::closeDeviceException | |
Laos::Rfm::notImplementedException |
bool Laos::RfmInterface::getLedStatus | ( | ) |
unsigned int Laos::RfmInterface::getLowestOffset | ( | ) |
Returns the first available RFM2g offset.
Laos::Rfm::nullHandleException | |
Laos::Rfm::osException | |
Laos::Rfm::closeDeviceException | |
Laos::Rfm::notImplementedException |
unsigned int Laos::RfmInterface::getMemorySize | ( | ) |
Returns the total amount of memory space available on the RFM2g device.
Laos::Rfm::nullHandleException | |
Laos::Rfm::osException | |
Laos::Rfm::closeDeviceException | |
Laos::Rfm::notImplementedException |
unsigned short int Laos::RfmInterface::getNodeID | ( | ) |
Returns the RFM2g device node ID.
Laos::Rfm::nullHandleException | |
Laos::Rfm::osException | |
Laos::Rfm::closeDeviceException | |
Laos::Rfm::notImplementedException |
void Laos::RfmInterface::open | ( | char * | _devicePath | ) |
Opens the RFM2g driver and returns an RFM2g handle.
_devicePath | Path to special device file. Refer to your driver-specific manual for the format of DevicePath. |
Laos::Rfm::invalidDevicePath | |
Laos::Rfm::nullHandleException | |
Laos::Rfm::nullHandlePointerException | |
Laos::Rfm::osException | |
Laos::Rfm::closeDeviceException | |
Laos::Rfm::notImplementedException | |
Laos::Rfm::lowMemoryException | |
Laos::Rfm::deviceNotFoundException |
unsigned int Laos::RfmInterface::peek32 | ( | const unsigned int | _offset | ) |
return the contents of the specified RFM2g offset.
The specified memory offset is accessed as a 32-bit longword
_offset | [in] Offset in Reflective Memory from which to read |
used to update a value in the RFM2g using a 32-bit longword.
No attempt at RFM2g shared memory locking is performed.
_offset | [in] Offset in Reflective Memory from which to read |
_value | [in] Value written to Offset |
void Laos::RfmInterface::read | ( | const unsigned int | _offset, |
char * | _buffer, | ||
const unsigned int | _length | ||
) |
Reads one or more bytes starting at an offset in Reflective Memory.
_offset | Width-aligned offset to Reflective Memory at which to begin the read . Valid offset values are 0x0 to 0x3FFFFFF for 64MB cards, 0x0 to 0x7FFFFFF for 128MB cards and 0x0 to 0x0FFFFFF for 256MB cards. |
_buffer | Pointer to where data is copied from Reflective Memory. |
_length | the length of the _buffer array in bytes |
Laos::Rfm::nullHandleException | |
Laos::Rfm::osException | |
Laos::Rfm::closeDeviceException | |
Laos::Rfm::notImplementedException | |
Laos::Rfm::nullDataException | |
Laos::Rfm::unalignedLengthException | |
Laos::Rfm::outOfRangeException | |
Laos::Rfm::dmaException | |
Laos::Rfm::unalignedOffsetException | |
Laos::Rfm::readDataException | |
Laos::Rfm::lSeekException | |
Laos::Rfm::unalignedAddressException |
void Laos::RfmInterface::sendEvent | ( | const signed short int | _toNode, |
const RFM2GEVENTTYPE | _eventType, | ||
const signed int | _extendedData = 0x0 |
||
) |
Transmits the specified RFM2g interrupt event to one or all other RFM2g node IDs.
_toNode | Who will receive the interrupt event (RFM2G_NODE_ALL sends the event to all nodes). NOTE: A node cannot send an event to itself. |
_eventType | The type of interrupt event to send. Interrupts correlate to the following event IDs: Interrupt Event ID Reset Interrupt RFM2GEVENT_RESET Network Interrupt 1 RFM2GEVENT_INTR1 Network Interrupt 2 RFM2GEVENT_INTR2 Network Interrupt 3 RFM2GEVENT_INTR3 Network Interrupt 4 RFM2GEVENT_INTR4 |
_extendedData | User-defined data. |
Laos::Rfm::nullHandleException | |
Laos::Rfm::osException | |
Laos::Rfm::closeDeviceException | |
Laos::Rfm::notImplementedException | |
Laos::Rfm::invalidEventTypeException | |
Laos::Rfm::internalDriverException | |
Laos::Rfm::nodeIdSelfException | |
Laos::Rfm::invalideToNodeException | |
Laos::Rfm::unknownEventException |
Sets the ON/OFF state of the Reflective Memory board's STATUS LED.
_ledStatus | The state of the LED: true -> on, false -> off |
Laos::Rfm::nullHandleException | |
Laos::Rfm::osException | |
Laos::Rfm::closeDeviceException | |
Laos::Rfm::notImplementedException |
bool Laos::RfmInterface::waitForEvent | ( | const RFM2GEVENTTYPE | _eventType, |
const unsigned int | _timeout, | ||
int & | _extendedInfo | ||
) |
Blocks the calling process until an occurrence of the specified RFM2g interrupt event is received or a timeout (if enabled) expires.
_eventType | Specifies which interrupt event to wait upon (I). Interrupts correlate to the following event IDs: Interrupt Event ID Reset Interrupt RFM2GEVENT_RESET Network Interrupt 1 RFM2GEVENT_INTR1 Network Interrupt 2 RFM2GEVENT_INTR2 Network Interrupt 3 RFM2GEVENT_INTR3 Network Interrupt 4 (Init Interrupt) RFM2GEVENT_INTR4 Bad Data Interrupt RFM2GEVENT_BAD_DATA RX FIFO Full Interrupt RFM2GEVENT_RXFIFO_FULL Rogue Packet Detected and Removed Interrupt RFM2GEVENT_ROGUE_PKT RX FIFO Almost Full Inturrupt RFM2GEVENT_RXFIFO_AFULL Sync Loss Occurred Interrupt RFM2GEVENT_SYNC_LOSS Memory Write Inhibited RFM2GEVENT_MEM_WRITE_INHIBITED Memory Parity Error RFM2GEVENT_LOCAL_MEM_PARITY_ERR |
_timeout | Indicates the timeout, in milliseconds, to wait for the event before returning. Non-zero values use a timeout, as determined by the following criteria: Value Description RFM2G_INFINITE_TIMEOUT Wait forever for event to occur. RFM2G_NOWAIT Do not wait for event to occur. [value] Number of milliseconds to wait for event to occur. |
Laos::Rfm::nullHandleException | |
Laos::Rfm::osException | |
Laos::Rfm::closeDeviceException | |
Laos::Rfm::notImplementedException | |
Laos::Rfm::invalidEventInfoException | |
Laos::Rfm::eventInUseException | |
Laos::Rfm::waitEventTimeOutException | |
Laos::Rfm::waitEventCanceledException | |
Laos::Rfm::internalDriverException | |
Laos::Rfm::unknownEventException |
void Laos::RfmInterface::write | ( | const unsigned int | _offset, |
const unsigned short int * | _buffer, | ||
const unsigned int | _length | ||
) |
Writes one or more bytes starting at an offset in Reflective Memory.
_offset | Width-aligned offset to Reflective Memory at which to begin the write. Valid offset values are 0x0 to 0x3FFFFFF for 64MB cards, 0x0 to 0x7FFFFFF for 128MB cards and 0x0 to 0x0FFFFFF for 256MB cards. |
_buffer | Pointer to where data is copied to Reflective Memory. |
_length | the length of the _buffer array |
Laos::Rfm::nullHandleException | |
Laos::Rfm::osException | |
Laos::Rfm::closeDeviceException | |
Laos::Rfm::notImplementedException | |
Laos::Rfm::nullDataException | |
Laos::Rfm::unalignedLengthException | |
Laos::Rfm::outOfRangeException | |
Laos::Rfm::dmaException | |
Laos::Rfm::unalignedOffsetException | |
Laos::Rfm::writeDataException | |
Laos::Rfm::lSeekException | |
Laos::Rfm::unalignedAddressException |
|
private |
Member variable indicates the status of the connection.
true - connected; false - disconnected
|
private |
The handle indentify the connection between the application program and the opened RFM2g interface.