Add support to choose if manual or automatic state change is done by config functions, fixes #189
This commit is contained in:
parent
cc417d4c0c
commit
817435066f
@ -589,8 +589,16 @@ int ecx_config_init(ecx_contextt *context, uint8 usetable)
|
||||
}
|
||||
/* some slaves need eeprom available to PDI in init->preop transition */
|
||||
ecx_eeprom2pdi(context, slave);
|
||||
/* request pre_op for slave */
|
||||
ecx_FPWRw(context->port, configadr, ECT_REG_ALCTL, htoes(EC_STATE_PRE_OP | EC_STATE_ACK) , EC_TIMEOUTRET3); /* set preop status */
|
||||
/* User may override automatic state change */
|
||||
if (context->manualstatechange == 0)
|
||||
{
|
||||
/* request pre_op for slave */
|
||||
ecx_FPWRw(context->port,
|
||||
configadr,
|
||||
ECT_REG_ALCTL,
|
||||
htoes(EC_STATE_PRE_OP | EC_STATE_ACK),
|
||||
EC_TIMEOUTRET3); /* set preop status */
|
||||
}
|
||||
}
|
||||
}
|
||||
return wkc;
|
||||
@ -1273,8 +1281,16 @@ int ecx_config_map_group(ecx_contextt *context, void *pIOmap, uint8 group)
|
||||
}
|
||||
|
||||
ecx_eeprom2pdi(context, slave); /* set Eeprom control to PDI */
|
||||
ecx_FPWRw(context->port, configadr, ECT_REG_ALCTL, htoes(EC_STATE_SAFE_OP) , EC_TIMEOUTRET3); /* set safeop status */
|
||||
|
||||
/* User may override automatic state change */
|
||||
if (context->manualstatechange == 0)
|
||||
{
|
||||
/* request safe_op for slave */
|
||||
ecx_FPWRw(context->port,
|
||||
configadr,
|
||||
ECT_REG_ALCTL,
|
||||
htoes(EC_STATE_SAFE_OP),
|
||||
EC_TIMEOUTRET3); /* set safeop status */
|
||||
}
|
||||
if (context->slavelist[slave].blockLRW)
|
||||
{
|
||||
context->grouplist[group].blockLRW++;
|
||||
@ -1409,8 +1425,16 @@ int ecx_config_overlap_map_group(ecx_contextt *context, void *pIOmap, uint8 grou
|
||||
}
|
||||
|
||||
ecx_eeprom2pdi(context, slave); /* set Eeprom control to PDI */
|
||||
ecx_FPWRw(context->port, configadr, ECT_REG_ALCTL, htoes(EC_STATE_SAFE_OP), EC_TIMEOUTRET3); /* set safeop status */
|
||||
|
||||
/* User may override automatic state change */
|
||||
if (context->manualstatechange == 0)
|
||||
{
|
||||
/* request safe_op for slave */
|
||||
ecx_FPWRw(context->port,
|
||||
configadr,
|
||||
ECT_REG_ALCTL,
|
||||
htoes(EC_STATE_SAFE_OP),
|
||||
EC_TIMEOUTRET3);
|
||||
}
|
||||
if (context->slavelist[slave].blockLRW)
|
||||
{
|
||||
context->grouplist[group].blockLRW++;
|
||||
|
@ -119,7 +119,8 @@ ecx_contextt ecx_context = {
|
||||
&ec_SM, // .eepSM =
|
||||
&ec_FMMU, // .eepFMMU =
|
||||
NULL, // .FOEhook()
|
||||
NULL // .EOEhook()
|
||||
NULL, // .EOEhook()
|
||||
0 // .manualstatechange
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -427,6 +427,8 @@ struct ecx_context
|
||||
int (*FOEhook)(uint16 slave, int packetnumber, int datasize);
|
||||
/** registered EoE hook */
|
||||
int (*EOEhook)(ecx_contextt * context, uint16 slave, void * eoembx);
|
||||
/** flag to control legacy automatic state change or manual state change */
|
||||
int manualstatechange;
|
||||
};
|
||||
|
||||
#ifdef EC_VER1
|
||||
|
Loading…
x
Reference in New Issue
Block a user