Refactored stack reset to ecx_clearindex.
parent
e4d625bf5a
commit
9cc335ef33
|
@ -1623,6 +1623,18 @@ static int ecx_pullindex(ecx_contextt *context)
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the idx stack.
|
||||||
|
*
|
||||||
|
* @param context = context struct
|
||||||
|
*/
|
||||||
|
static void ecx_clearindex(ecx_contextt *context) {
|
||||||
|
|
||||||
|
context->idxstack->pushed = 0;
|
||||||
|
context->idxstack->pulled = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/** Transmit processdata to slaves.
|
/** Transmit processdata to slaves.
|
||||||
* Uses LRW, or LRD/LWR if LRW is not allowed (blockLRW).
|
* Uses LRW, or LRD/LWR if LRW is not allowed (blockLRW).
|
||||||
* Both the input and output processdata are transmitted.
|
* Both the input and output processdata are transmitted.
|
||||||
|
@ -1655,11 +1667,7 @@ int ecx_send_processdata_group(ecx_contextt *context, uint8 group)
|
||||||
LogAdr = context->grouplist[group].logstartaddr;
|
LogAdr = context->grouplist[group].logstartaddr;
|
||||||
if (length)
|
if (length)
|
||||||
{
|
{
|
||||||
if(!group)
|
|
||||||
{
|
|
||||||
context->idxstack->pushed = 0;
|
|
||||||
context->idxstack->pulled = 0;
|
|
||||||
}
|
|
||||||
wkc = 1;
|
wkc = 1;
|
||||||
/* LRW blocked by one or more slaves ? */
|
/* LRW blocked by one or more slaves ? */
|
||||||
if (context->grouplist[group].blockLRW)
|
if (context->grouplist[group].blockLRW)
|
||||||
|
@ -1863,10 +1871,7 @@ int ecx_receive_processdata_group(ecx_contextt *context, uint8 group, int timeou
|
||||||
pos = ecx_pullindex(context);
|
pos = ecx_pullindex(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos == -1) {
|
ecx_clearindex(context);
|
||||||
context->idxstack->pushed = 0;
|
|
||||||
context->idxstack->pulled = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if no frames has arrived */
|
/* if no frames has arrived */
|
||||||
if (valid_wkc == 0)
|
if (valid_wkc == 0)
|
||||||
|
|
Loading…
Reference in New Issue