EtherCAT Router component. More...
#include <ethercat_router.h>
Public Member Functions | |
EtherCAT_Router (EtherCAT_AL *_m_al_instance, EC_Logic *_m_logic_instance, EtherCAT_DataLinkLayer *_m_dll_instance) | |
bool | is_running () const |
Router running? | |
void | route (void) const |
Actual routing code. | |
void | start () |
Start routing. | |
void | stop () |
Stop routing. | |
Public Attributes | |
EtherCAT_AL * | m_al_instance |
Pointer to AL instance. | |
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_DataLinkLayer * | m_dll_instance |
Pointer to DLL instance. | |
bool | m_is_running |
Usage counter. | |
EC_Logic * | m_logic_instance |
Pointer to EC_Logic. |
EtherCAT Router component.
Definition at line 46 of file ethercat_router.h.
EtherCAT_Router::EtherCAT_Router | ( | EtherCAT_AL * | _m_al_instance, |
EC_Logic * | _m_logic_instance, | ||
EtherCAT_DataLinkLayer * | _m_dll_instance | ||
) |
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 |
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.
Pointer to AL instance.
Definition at line 79 of file ethercat_router.h.
Pointer to DLL instance.
Definition at line 84 of file ethercat_router.h.
bool EtherCAT_Router::m_is_running [private] |
Usage counter.
Definition at line 86 of file ethercat_router.h.
EC_Logic* EtherCAT_Router::m_logic_instance [private] |
Pointer to EC_Logic.
Definition at line 82 of file ethercat_router.h.