EtherCAT Router component. More...
#include <ethercat_router.h>
Public Member Functions | |
bool | is_running () const |
Router running? | |
void | route (void) const |
Actual routing code. | |
void | start () |
Start routing. | |
void | stop () |
Stop routing. | |
Static Public Member Functions | |
static EtherCAT_Router * | instance () |
Singleton. | |
Protected Member Functions | |
EtherCAT_Router () | |
Private Member Functions | |
bool | check_mbx (const EtherCAT_SlaveHandler *sh) const |
Check and deliver post from slave. | |
bool | post_mbxmsg (EtherCAT_MbxMsg *msg, const EtherCAT_SlaveHandler *from_sh) const |
Post a msg from a certain slave. | |
Private Attributes | |
EtherCAT_AL * | m_al_instance |
Pointer to AL instance. | |
EtherCAT_DataLinkLayer * | m_dll_instance |
Pointer to DLL instance. | |
unsigned int | m_is_running |
Usage counter. | |
EC_Logic * | m_logic_instance |
Pointer to EC_Logic. | |
Static Private Attributes | |
static EtherCAT_Router * | m_instance |
EtherCAT Router component.
Definition at line 46 of file ethercat_router.h.
EtherCAT_Router::EtherCAT_Router | ( | ) | [protected] |
bool EtherCAT_Router::check_mbx | ( | const EtherCAT_SlaveHandler * | sh | ) | const [private] |
Check and deliver post from slave.
Check if slave posted something in its mailbox and if positive, deliver msgs to destination.
sh | Slave Handler to query |
static EtherCAT_Router* EtherCAT_Router::instance | ( | ) | [static] |
Singleton.
bool EtherCAT_Router::is_running | ( | ) | const [inline] |
Router running?
Definition at line 57 of file ethercat_router.h.
bool EtherCAT_Router::post_mbxmsg | ( | EtherCAT_MbxMsg * | msg, |
const EtherCAT_SlaveHandler * | from_sh | ||
) | const [private] |
Post a msg from a certain slave.
msg | mbx_msg to be posted |
from_sh | "poster" of the msg (The EtherCAT protocol does not provide a From: header in its messages) |
void EtherCAT_Router::route | ( | void | ) | const |
Actual routing code.
This method should not be public, but since it is used in a C-function and I don't know how I could declare a C-function to be a friend of a class...
The current implementation simply polls the sync manager data area of each slave and checks if wkc is incremented. Another solution is to configure FMMU's of each slave and query the slaves with one logical EtherCAT msg. This has the advantage of only using one message per slave, but it "sacrifices" an extra FMMU per slave, which might not always be possible. In that case, the master would---during the start_mbx_communication() call of slaves---configure an FMMU of the slave which listens to the written bit of sync manager 0.
void EtherCAT_Router::start | ( | ) |
Start routing.
void EtherCAT_Router::stop | ( | ) |
Stop routing.
EtherCAT_AL* EtherCAT_Router::m_al_instance [private] |
Pointer to AL instance.
Definition at line 82 of file ethercat_router.h.
Pointer to DLL instance.
Definition at line 86 of file ethercat_router.h.
EtherCAT_Router* EtherCAT_Router::m_instance [static, private] |
Definition at line 88 of file ethercat_router.h.
unsigned int EtherCAT_Router::m_is_running [private] |
Usage counter.
Definition at line 90 of file ethercat_router.h.
EC_Logic* EtherCAT_Router::m_logic_instance [private] |
Pointer to EC_Logic.
Definition at line 84 of file ethercat_router.h.