Add PO2SO hook including context, fixes #230

feature/soem_140
Andreas Karlsson 2019-06-10 09:23:02 +02:00
parent 8c1e83ee8e
commit cc417d4c0c
2 changed files with 9 additions and 2 deletions

View File

@ -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)
{

View File

@ -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
{
@ -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;
@ -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 */