Tool/software:
Hello
I am using your LP-AM243 board to evaluate the EtherCAT Slave Stack
The SDK version is ind_comms_sdk_am243x_09_02_00_08
The sample project uses 401_simple from EtherCAT Slave.
I registered the callback function for registering the process data buffer and the user application callback function with reference to the Buffer Handling API chapter.
InputPD pre-read callback: appPreSeqInputPD()
OutputPD pre-write callback: appPreSeqOutputPD()
InputPD after loading callback: appPostSeqInputPD()
OutputPD after loading callback: appPostSeqOutputPD()
User application callback: EC_SLV_APP_SS_applicationRun()
My question is, if I register the callback functions as above, is the order in which the callback functions are called guaranteed as follows?
1. Frame reception
↓
2. appPreSeqInputPD()
↓
3. appPostSeqInputPD()
↓
4. EC_SLV_APP_SS_applicationRun()
↓
5. appPreSeqOutputPD()
↓
6. appPostSeqOutputPD()
When managing flags for process data buffering, we are concerned that if callbacks are called in a different order than expected, such as appPreSeqOutputPD() being called before EC_SLV_APP_SS_applicationRun(), the flag management sequence will be disrupted.
For reference, the following is an excerpt from the custom source code for the callback function registration process.
// InputPD pre-read callback function registration
error = EC_API_SLV_cbRegisterPreSeqInputPDBuffer(
pApplicationInstance_p->ptEcSlvApi,
(EC_API_SLV_CBPreSeqInputPD_t)appPreSeqInputPD,
pApplicationInstance_p
);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("Register PreSeqInputPD Error code: 0x%08x\r\n", error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
OSAL_printf("Register PreSeqInputPD Callback\r\n");
// OutputPD pre-write callback function registration
error = EC_API_SLV_cbRegisterPreSeqOutputPDBuffer(
pApplicationInstance_p->ptEcSlvApi,
(EC_API_SLV_CBPreSeqOutputPD_t)appPreSeqOutputPD,
pApplicationInstance_p
);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("Register PreSeqOutputPD Error code: 0x%08x\r\n", error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
OSAL_printf("Register PreSeqOutputPD Callback\r\n");
// InputPD Loading Callback Function Registration
error = EC_API_SLV_cbRegisterPostSeqInputPDBuffer(
pApplicationInstance_p->ptEcSlvApi,
(EC_API_SLV_CBPostSeqInputPD_t)appPostSeqInputPD,
pApplicationInstance_p
);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("Register PostSeqInputPD Error code: 0x%08x\r\n", error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
OSAL_printf("Register PostSeqInputPD Callback\r\n");
// Register callback function after writing to OutputPD
error = EC_API_SLV_cbRegisterPostSeqOutputPDBuffer(
pApplicationInstance_p->ptEcSlvApi,
(EC_API_SLV_CBPostSeqOutputPD_t)appPostSeqOutputPD,
pApplicationInstance_p
);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("Register PostSeqOutputPD Error code: 0x%08x\r\n", error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}
// Register callback function User ApplicationRun
EC_API_SLV_cbRegisterUserApplicationRun(
pApplicationInstance_p->ptEcSlvApi,
EC_SLV_APP_SS_applicationRun,
pApplicationInstance_p
);
if (error != EC_API_eERR_NONE)
{
OSAL_printf("Register EC_SLV_APP_SS_applicationRun Error code: 0x%08x\r\n", error);
/* @cppcheck_justify{misra-c2012-15.1} goto is used to assure single point of exit */
/* cppcheck-suppress misra-c2012-15.1 */
goto Exit;
}