#include <wg_mailbox.h>
|
bool | _readMailboxRepeatRequest (EthercatCom *com) |
|
bool | clearReadMailbox (EthercatCom *com) |
| Clears read mailbox by reading first and last byte. More...
|
|
void | diagnoseMailboxError (EthercatCom *com) |
| Runs diagnostic on read and write mailboxes. More...
|
|
bool | lockMailbox () |
|
int | readMailbox_ (EthercatCom *com, unsigned address, void *data, unsigned length) |
| Internal function. More...
|
|
bool | readMailboxInternal (EthercatCom *com, void *data, unsigned length) |
| Reads data from read mailbox. More...
|
|
bool | readMailboxRepeatRequest (EthercatCom *com) |
|
void | unlockMailbox () |
|
bool | verifyDeviceStateForMailboxOperation () |
|
bool | waitForReadMailboxReady (EthercatCom *com) |
| Waits until read mailbox is full or timeout. More...
|
|
bool | waitForWriteMailboxReady (EthercatCom *com) |
| Waits until write mailbox is empty or timeout. More...
|
|
int | writeMailbox_ (EthercatCom *com, unsigned address, void const *data, unsigned length) |
| Internal function. More...
|
|
bool | writeMailboxInternal (EthercatCom *com, void const *data, unsigned length) |
| Writes data to mailbox. More...
|
|
Definition at line 55 of file wg_mailbox.h.
◆ WGMailbox()
ethercat_hardware::WGMailbox::WGMailbox |
( |
| ) |
|
◆ _readMailboxRepeatRequest()
bool ethercat_hardware::WGMailbox::_readMailboxRepeatRequest |
( |
EthercatCom * |
com | ) |
|
|
protected |
◆ clearReadMailbox()
bool ethercat_hardware::WGMailbox::clearReadMailbox |
( |
EthercatCom * |
com | ) |
|
|
protected |
Clears read mailbox by reading first and last byte.
Mailbox lock should be held when this function is called.
- Parameters
-
com | used to perform communication with device |
- Returns
- returns true for success, false for failure
Definition at line 277 of file wg_mailbox.cpp.
◆ diagnoseMailboxError()
void ethercat_hardware::WGMailbox::diagnoseMailboxError |
( |
EthercatCom * |
com | ) |
|
|
protected |
Runs diagnostic on read and write mailboxes.
Collects and data from mailbox control registers.
- Todo:
- not implemented yet
- Parameters
-
com | used to perform communication with device |
- Returns
- returns true for success, false for failure
Definition at line 264 of file wg_mailbox.cpp.
◆ initialize()
bool ethercat_hardware::WGMailbox::initialize |
( |
EtherCAT_SlaveHandler * |
sh | ) |
|
◆ lockMailbox()
bool ethercat_hardware::WGMailbox::lockMailbox |
( |
| ) |
|
|
protected |
◆ publishMailboxDiagnostics()
◆ readMailbox()
int ethercat_hardware::WGMailbox::readMailbox |
( |
EthercatCom * |
com, |
|
|
unsigned |
address, |
|
|
void * |
data, |
|
|
unsigned |
length |
|
) |
| |
Read data from WG0X local bus using mailbox communication.
Internally a localbus read is done in two parts. First, a mailbox write of a command header that include local bus address and length. Second, a mailbox read of the result.
- Parameters
-
com | used to perform communication with device |
address | WG0X (FPGA) local bus address to read from |
data | pointer to buffer where read data can be stored, must be at least length in size |
length | amount of data to read, limited at 511 bytes. |
- Returns
- returns zero for success, non-zero for failure
Definition at line 812 of file wg_mailbox.cpp.
◆ readMailbox_()
int ethercat_hardware::WGMailbox::readMailbox_ |
( |
EthercatCom * |
com, |
|
|
unsigned |
address, |
|
|
void * |
data, |
|
|
unsigned |
length |
|
) |
| |
|
protected |
Internal function.
Aguments are the same as readMailbox() except that this assumes the mailbox lock is held.
Definition at line 831 of file wg_mailbox.cpp.
◆ readMailboxInternal()
bool ethercat_hardware::WGMailbox::readMailboxInternal |
( |
EthercatCom * |
com, |
|
|
void * |
data, |
|
|
unsigned |
length |
|
) |
| |
|
protected |
Reads data from read mailbox.
Will try to conserve bandwidth by reading length bytes of data and last byte of mailbox. Mailbox lock should be held when this function is called.
- Parameters
-
com | used to perform communication with device |
data | pointer to buffer where read data is stored. |
length | amount of data to read from mailbox |
- Returns
- returns true for success, false for failure
Definition at line 681 of file wg_mailbox.cpp.
◆ readMailboxRepeatRequest()
bool ethercat_hardware::WGMailbox::readMailboxRepeatRequest |
( |
EthercatCom * |
com | ) |
|
|
protected |
◆ unlockMailbox()
void ethercat_hardware::WGMailbox::unlockMailbox |
( |
| ) |
|
|
protected |
◆ verifyDeviceStateForMailboxOperation()
bool ethercat_hardware::WGMailbox::verifyDeviceStateForMailboxOperation |
( |
| ) |
|
|
protected |
◆ waitForReadMailboxReady()
bool ethercat_hardware::WGMailbox::waitForReadMailboxReady |
( |
EthercatCom * |
com | ) |
|
|
protected |
Waits until read mailbox is full or timeout.
Wait times out after 100msec. Mailbox lock should be held when this function is called.
- Parameters
-
com | used to perform communication with device |
- Returns
- returns true for success, false for failure or timeout
Definition at line 359 of file wg_mailbox.cpp.
◆ waitForWriteMailboxReady()
bool ethercat_hardware::WGMailbox::waitForWriteMailboxReady |
( |
EthercatCom * |
com | ) |
|
|
protected |
Waits until write mailbox is empty or timeout.
Wait times out after 100msec. Mailbox lock should be held when this function is called.
- Parameters
-
com | used to perform communication with device |
- Returns
- returns true for success, false for failure or timeout
Definition at line 411 of file wg_mailbox.cpp.
◆ writeMailbox()
int ethercat_hardware::WGMailbox::writeMailbox |
( |
EthercatCom * |
com, |
|
|
unsigned |
address, |
|
|
void const * |
data, |
|
|
unsigned |
length |
|
) |
| |
Write data to WG0X local bus using mailbox communication.
First, this puts a command header that include local bus address and length in write mailbox. Second it waits until device actually empties write mailbox.
- Parameters
-
com | used to perform communication with device |
address | WG0X (FPGA) local bus address to write data to |
data | pointer to buffer where write data is stored, must be at least length in size |
length | amount of data to write, limited at 507 bytes |
- Returns
- returns zero for success, non-zero for failure
Definition at line 939 of file wg_mailbox.cpp.
◆ writeMailbox_()
int ethercat_hardware::WGMailbox::writeMailbox_ |
( |
EthercatCom * |
com, |
|
|
unsigned |
address, |
|
|
void const * |
data, |
|
|
unsigned |
length |
|
) |
| |
|
protected |
Internal function.
Aguments are the same as writeMailbox() except that this assumes the mailbox lock is held.
Definition at line 959 of file wg_mailbox.cpp.
◆ writeMailboxInternal()
bool ethercat_hardware::WGMailbox::writeMailboxInternal |
( |
EthercatCom * |
com, |
|
|
void const * |
data, |
|
|
unsigned |
length |
|
) |
| |
|
protected |
Writes data to mailbox.
Will try to conserve bandwidth by only length bytes of data and last byte of mailbox. Mailbox lock should be held when this function is called.
- Parameters
-
com | used to perform communication with device |
data | pointer to buffer where read data is stored. |
length | amount of data to read from mailbox |
- Returns
- returns true for success, false for failure
Definition at line 466 of file wg_mailbox.cpp.
◆ mailbox_diagnostics_
◆ mailbox_lock_
pthread_mutex_t ethercat_hardware::WGMailbox::mailbox_lock_ |
|
protected |
◆ mailbox_publish_diagnostics_
MbxDiagnostics ethercat_hardware::WGMailbox::mailbox_publish_diagnostics_ |
|
protected |
◆ MBX_COMMAND_PHY_ADDR
const unsigned ethercat_hardware::WGMailbox::MBX_COMMAND_PHY_ADDR = 0x1400 |
|
static |
◆ MBX_COMMAND_SIZE
const unsigned ethercat_hardware::WGMailbox::MBX_COMMAND_SIZE = 512 |
|
static |
◆ MBX_COMMAND_SYNCMAN_NUM
const unsigned ethercat_hardware::WGMailbox::MBX_COMMAND_SYNCMAN_NUM = 2 |
|
static |
◆ MBX_STATUS_PHY_ADDR
const unsigned ethercat_hardware::WGMailbox::MBX_STATUS_PHY_ADDR = 0x2400 |
|
static |
◆ MBX_STATUS_SIZE
const unsigned ethercat_hardware::WGMailbox::MBX_STATUS_SIZE = 512 |
|
static |
◆ MBX_STATUS_SYNCMAN_NUM
const unsigned ethercat_hardware::WGMailbox::MBX_STATUS_SYNCMAN_NUM = 3 |
|
static |
◆ sh_
EtherCAT_SlaveHandler* ethercat_hardware::WGMailbox::sh_ |
|
protected |
The documentation for this class was generated from the following files: