Skip to content

Commit

Permalink
Add PO2SO hook including context, fixes OpenEtherCATsociety#230
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Karlsson committed Jun 10, 2019
1 parent 8c1e83e commit cc417d4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions soem/ethercatconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,10 @@ static int ecx_map_coe_soe(ecx_contextt *context, uint16 slave, int thread_n)
{
context->slavelist[slave].PO2SOconfig(slave);
}
if (context->slavelist[slave].PO2SOconfigx) /* only if registered */
{
context->slavelist[slave].PO2SOconfigx(context, slave);
}
/* if slave not found in configlist find IO mapping in slave self */
if (!context->slavelist[slave].configindex)
{
Expand Down
7 changes: 5 additions & 2 deletions soem/ethercatmain.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ PACKED_END

#define EC_SMENABLEMASK 0xfffeffff

typedef struct ecx_context ecx_contextt;

/** for list of ethercat slaves detected */
typedef struct ec_slave
{
Expand Down Expand Up @@ -225,8 +227,10 @@ typedef struct ec_slave
uint8 FMMUunused;
/** Boolean for tracking whether the slave is (not) responding, not used/set by the SOEM library */
boolean islost;
/** registered configuration function PO->SO */
/** registered configuration function PO->SO, (DEPRECATED)*/
int (*PO2SOconfig)(uint16 slave);
/** registered configuration function PO->SO */
int (*PO2SOconfigx)(ecx_contextt * context, uint16 slave);
/** readable name */
char name[EC_MAXNAME + 1];
} ec_slavet;
Expand Down Expand Up @@ -377,7 +381,6 @@ typedef struct PACKED ec_PDOdesc
PACKED_END

/** Context structure , referenced by all ecx functions*/
typedef struct ecx_context ecx_contextt;
struct ecx_context
{
/** port reference, may include red_port */
Expand Down

0 comments on commit cc417d4

Please sign in to comment.