Limit expected working counter per ESC

Add one to the expected working counter per
ESC/Slave, not for every syncmanager/fmmu.
Use case, if the slave define more input/output
syncmanager/fmmus it still only generate maximum
working counter of 3 for a RW command.

fixes 374
pull/393/head
Andreas Karlsson 2020-03-03 10:27:37 +01:00 committed by nakarlsson
parent 7fe05b5b4b
commit 093311561c
1 changed files with 24 additions and 9 deletions

View File

@ -900,6 +900,7 @@ static void ecx_config_create_input_mappings(ecx_contextt *context, void *pIOmap
int ByteCount = 0;
int FMMUsize = 0;
int FMMUdone = 0;
int AddToInputsWKC = 0;
uint8 SMc = 0;
uint16 EndAddr;
uint16 SMlength;
@ -1002,8 +1003,9 @@ static void ecx_config_create_input_mappings(ecx_contextt *context, void *pIOmap
/* program FMMU for input */
ecx_FPWR(context->port, configadr, ECT_REG_FMMU0 + (sizeof(ec_fmmut) * FMMUc),
sizeof(ec_fmmut), &(context->slavelist[slave].FMMU[FMMUc]), EC_TIMEOUTRET3);
/* add one for an input FMMU */
context->grouplist[group].inputsWKC++;
/* Set flag to add one for an input FMMU,
a single ESC can only contribute once */
AddToInputsWKC = 1;
}
if (!context->slavelist[slave].inputs)
{
@ -1029,6 +1031,10 @@ static void ecx_config_create_input_mappings(ecx_contextt *context, void *pIOmap
FMMUc++;
}
context->slavelist[slave].FMMUunused = FMMUc;
/* Add one WKC for an input if flag is true */
if (AddToInputsWKC)
context->grouplist[group].inputsWKC++;
}
static void ecx_config_create_output_mappings(ecx_contextt *context, void *pIOmap,
@ -1038,6 +1044,7 @@ static void ecx_config_create_output_mappings(ecx_contextt *context, void *pIOma
int ByteCount = 0;
int FMMUsize = 0;
int FMMUdone = 0;
int AddToOutputsWKC = 0;
uint8 SMc = 0;
uint16 EndAddr;
uint16 SMlength;
@ -1126,13 +1133,18 @@ static void ecx_config_create_output_mappings(ecx_contextt *context, void *pIOma
*BitPos = 0;
}
FMMUdone += FMMUsize;
context->slavelist[slave].FMMU[FMMUc].PhysStartBit = 0;
context->slavelist[slave].FMMU[FMMUc].FMMUtype = 2;
context->slavelist[slave].FMMU[FMMUc].FMMUactive = 1;
/* program FMMU for output */
ecx_FPWR(context->port, configadr, ECT_REG_FMMU0 + (sizeof(ec_fmmut) * FMMUc),
sizeof(ec_fmmut), &(context->slavelist[slave].FMMU[FMMUc]), EC_TIMEOUTRET3);
context->grouplist[group].outputsWKC++;
if (context->slavelist[slave].FMMU[FMMUc].LogLength)
{
context->slavelist[slave].FMMU[FMMUc].PhysStartBit = 0;
context->slavelist[slave].FMMU[FMMUc].FMMUtype = 2;
context->slavelist[slave].FMMU[FMMUc].FMMUactive = 1;
/* program FMMU for output */
ecx_FPWR(context->port, configadr, ECT_REG_FMMU0 + (sizeof(ec_fmmut) * FMMUc),
sizeof(ec_fmmut), &(context->slavelist[slave].FMMU[FMMUc]), EC_TIMEOUTRET3);
/* Set flag to add one for an output FMMU,
a single ESC can only contribute once */
AddToOutputsWKC = 1;
}
if (!context->slavelist[slave].outputs)
{
if (group)
@ -1158,6 +1170,9 @@ static void ecx_config_create_output_mappings(ecx_contextt *context, void *pIOma
FMMUc++;
}
context->slavelist[slave].FMMUunused = FMMUc;
/* Add one WKC for an output if flag is true */
if (AddToOutputsWKC)
context->grouplist[group].outputsWKC++;
}
/** Map all PDOs in one group of slaves to IOmap with Outputs/Inputs