TwiceAsNice  2019-02-18
Public Member Functions | Private Attributes | List of all members
Laos::RfmInterface Class Reference

Reflective Memory Interface. More...

#include <RfmInterface.h>

Inheritance diagram for Laos::RfmInterface:
Inheritance graph
Collaboration diagram for Laos::RfmInterface:
Collaboration graph

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

Detailed Description

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.

Author
Frank Kittmann
Version
07.09.25
Date
2007.09.25

Constructor & Destructor Documentation

◆ RfmInterface()

Laos::RfmInterface::RfmInterface ( )

default constructor

Parameters
-

◆ ~RfmInterface()

Laos::RfmInterface::~RfmInterface ( )

default destructor

Parameters
-

Member Function Documentation

◆ cancelWaitForEvent()

void Laos::RfmInterface::cancelWaitForEvent ( const RFM2GEVENTTYPE  _eventType)


Cancels any pending waitForEvent() calls for a specified event type.

Parameters
_eventTypeSpecifies which interrupt event to cancel. Interrupts correlate to the following event IDs:
Returns
Data passed with event or -1 if timed out
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
Exceptions
Laos::Rfm::nullHandleException
Laos::Rfm::osException
Laos::Rfm::closeDeviceException
Laos::Rfm::notImplementedException
Laos::Rfm::invalidEventTypeException
Laos::Rfm::eventNotInUseException
Laos::Rfm::unknownEventException

◆ checkRingCont()

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.

Returns

◆ clearEvent()

void Laos::RfmInterface::clearEvent ( RFM2GEVENTTYPE  _eventType)

Retrieves the current ON/OFF state of the Reflective Memory board's STATUS LED.

Returns
led status - true led is switched on; false led is switched off
Exceptions
Laos::Rfm::nullHandleException
Laos::Rfm::osException
Laos::Rfm::closeDeviceException
Laos::Rfm::notImplementedExceptionclears any or all pending interrupt events from a specified event FIFO
Parameters
_eventType[in] The event FIFO to clear
Returns
void

◆ close()

void Laos::RfmInterface::close ( )

Closes an open RFM2g handle and releases resources allocated to it.

Exceptions
Laos::Rfm::nullHandleException
Laos::Rfm::osException
Laos::Rfm::closeDeviceException
Laos::Rfm::notImplementedException

◆ disableEvent()

void Laos::RfmInterface::disableEvent ( const RFM2GEVENTTYPE  _eventType)


Disables the reception of an RFM2g event.

Parameters
_eventTypeSpecifies 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
Exceptions
Laos::Rfm::nullHandleException
Laos::Rfm::osException
Laos::Rfm::closeDeviceException
Laos::Rfm::notImplementedException
Laos::Rfm::invalidEventTypeException
Laos::Rfm::internalDriverException
Laos::Rfm::unknownEventException

◆ disableEventCallback()

void Laos::RfmInterface::disableEventCallback ( RFM2GEVENTTYPE  _eventType)

disables interrupt notification for one event

Parameters
_eventTypeSpecifies which interrupt event to disable
Returns
void

◆ enableEvent()

void Laos::RfmInterface::enableEvent ( const RFM2GEVENTTYPE  _eventType)


Enables reception of an RFM2g interrupt event.

Parameters
_eventTypeSpecifies 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
Warning
The specified event is already enabled.
Exceptions
Laos::Rfm::nullHandleException
Laos::Rfm::osException
Laos::Rfm::closeDeviceException
Laos::Rfm::notImplementedException
Laos::Rfm::invalidEventTypeException
Laos::Rfm::internalDriverException
Laos::Rfm::unknownEventException

◆ enableEventCallback()

void Laos::RfmInterface::enableEventCallback ( RFM2GEVENTTYPE  _eventType,
RFM2G_EVENT_FUNCPTR  _pEventFunc 
)

Enables the interrupt notification for one event on one board.

Parameters
_eventType[in] Specifies which interrupt event to act upon
_pEventFunc[in] The address of the function to be called when the event occurs
Returns
void

◆ getBoardID()

unsigned int Laos::RfmInterface::getBoardID ( )

Returns the ID of the board corresponding to the passed-in handle.

Returns
boardId - Board ID of the currently opened RFM2g device.
Exceptions
Laos::Rfm::nullHandleException
Laos::Rfm::osException
Laos::Rfm::closeDeviceException
Laos::Rfm::notImplementedException

◆ getDeviceName()

std::string Laos::RfmInterface::getDeviceName ( )

Returns the device name associated with an RFM2g handle.

Returns
device name - a null-terminated string containing the first 64 characters of the device file name associated with the given RFM2g file handle.
Exceptions
Laos::Rfm::nullHandleException
Laos::Rfm::osException
Laos::Rfm::closeDeviceException
Laos::Rfm::notImplementedException

◆ getDriverVersion()

std::string Laos::RfmInterface::getDriverVersion ( )

Returns the RFM2g device driver version.

Returns
driver version - an ASCII string with which an application program can determine the GE Fanuc Embedded Systems production release version of the underlying RFM2g device driver.
Exceptions
Laos::Rfm::nullHandleException
Laos::Rfm::osException
Laos::Rfm::closeDeviceException
Laos::Rfm::notImplementedException

◆ getLedStatus()

bool Laos::RfmInterface::getLedStatus ( )

◆ getLowestOffset()

unsigned int Laos::RfmInterface::getLowestOffset ( )

Returns the first available RFM2g offset.

Returns
lowest offset - Width-aligned offset to Reflective Memory at which to begin the read or write. Valid offset values are 0x0 to 0x3FFFFFF for 64MB cards, 0x0 to 0x7FFFFFF for 128MB cards and 0x0 to 0x0FFFFFF for 256MB cards.
Exceptions
Laos::Rfm::nullHandleException
Laos::Rfm::osException
Laos::Rfm::closeDeviceException
Laos::Rfm::notImplementedException

◆ getMemorySize()

unsigned int Laos::RfmInterface::getMemorySize ( )

Returns the total amount of memory space available on the RFM2g device.

Returns
memory size - the total amount of memory space available on the RFM2g device.
Exceptions
Laos::Rfm::nullHandleException
Laos::Rfm::osException
Laos::Rfm::closeDeviceException
Laos::Rfm::notImplementedException

◆ getNodeID()

unsigned short int Laos::RfmInterface::getNodeID ( )

Returns the RFM2g device node ID.

Returns
nodeId - Node ID of the currently opened RFM2g device.
Exceptions
Laos::Rfm::nullHandleException
Laos::Rfm::osException
Laos::Rfm::closeDeviceException
Laos::Rfm::notImplementedException

◆ open()

void Laos::RfmInterface::open ( char *  _devicePath)

Opens the RFM2g driver and returns an RFM2g handle.

Parameters
_devicePathPath to special device file. Refer to your driver-specific manual for the format of DevicePath.
Warning
RFM2g device has bad board ID.
Exceptions
Laos::Rfm::invalidDevicePath
Laos::Rfm::nullHandleException
Laos::Rfm::nullHandlePointerException
Laos::Rfm::osException
Laos::Rfm::closeDeviceException
Laos::Rfm::notImplementedException
Laos::Rfm::lowMemoryException
Laos::Rfm::deviceNotFoundException

◆ peek32()

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

Parameters
_offset[in] Offset in Reflective Memory from which to read
Returns
unsigned int

◆ poke32()

void Laos::RfmInterface::poke32 ( const unsigned int  _offset,
const unsigned int  _value 
)

used to update a value in the RFM2g using a 32-bit longword.

No attempt at RFM2g shared memory locking is performed.

Parameters
_offset[in] Offset in Reflective Memory from which to read
_value[in] Value written to Offset
Returns
void

◆ read()

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.

Parameters
_offsetWidth-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.
_bufferPointer to where data is copied from Reflective Memory.
_lengththe length of the _buffer array in bytes
Returns
buffer - a copie of the Reflective Memory
Exceptions
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

◆ sendEvent()

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.

Parameters
_toNodeWho will receive the interrupt event (RFM2G_NODE_ALL sends the event to all nodes). NOTE: A node cannot send an event to itself.
_eventTypeThe 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
_extendedDataUser-defined data.
Returns
-
Exceptions
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

◆ setLedStatus()

void Laos::RfmInterface::setLedStatus ( const bool  _ledStatus)

Sets the ON/OFF state of the Reflective Memory board's STATUS LED.

Parameters
_ledStatusThe state of the LED: true -> on, false -> off
Returns
led status - true led is switched on, false led is switched off
Exceptions
Laos::Rfm::nullHandleException
Laos::Rfm::osException
Laos::Rfm::closeDeviceException
Laos::Rfm::notImplementedException

◆ waitForEvent()

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.

Parameters
_eventTypeSpecifies 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
_timeoutIndicates 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.
Exceptions
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

◆ write()

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.

Parameters
_offsetWidth-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.
_bufferPointer to where data is copied to Reflective Memory.
_lengththe length of the _buffer array
Exceptions
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

Member Data Documentation

◆ m_connected

bool Laos::RfmInterface::m_connected
private

Member variable indicates the status of the connection.

true - connected; false - disconnected

◆ m_handle

RFM2GHANDLE Laos::RfmInterface::m_handle
private

The handle indentify the connection between the application program and the opened RFM2g interface.


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