This chapter provides guidance to the developers who want to optimize the access to the process data. The SDK uses by default the process data buffers provided by the Beckhoff Stack if none is provided. The PDO setter and getter functions listed in the PDO Help functions copy the process data from one memory area to another. Those functions have time and performance costs, therefore, the SDK allows to register callbacks to access the customer specific memory areas and enable zero copy behavior.
The SDK provides the following API to register the customer callbacks :
| Function | Description |
|---|---|
| EC_API_SLV_cbRegisterPreSeqInputPDBuffer | Request a buffer to read input process data |
| EC_API_SLV_cbRegisterPreSeqOutputPDBuffer | Request a buffer to write output process data |
| EC_API_SLV_cbRegisterPostSeqInputPDBuffer | Triggered after input process data has been read |
| EC_API_SLV_cbRegisterPostSeqOutputPDBuffer | Triggered after output process data has been written |
The output process data buffer is updated by PDO_OutputMapping(), which is synchronized to SYNC0/SM event. In this function, the callback registered with EC_API_SLV_cbRegisterPreSeqOutputPDBuffer() is called to acquire the output process data buffer handled by the application and update it with the latest data from the output process data Sync Manager. Once the update is complete, it calls the callback registered with EC_API_SLV_cbRegisterPostSeqOutputPDBuffer() to release the acquired output process data buffer back to the application.
The input process data buffer is read by PDO_InputMapping(), which is synchronized to SYNC0/SM event. In this function, the callback registered with EC_API_SLV_cbRegisterPreSeqInputPDBuffer() is called to acquire the input process data buffer handled by the application and update the input process data Sync Manager with the latest data. Once the update is complete, it calls the callback registered with EC_API_SLV_cbRegisterPostSeqInputPDBuffer() to release the acquired input process data buffer back to the application.
Using these functions, the end user can register its own callbacks and handle the process data on its own will. For instance, the customer can implement a triple buffer mechanism in a Dual Port RAM and the SDK will get and set the data from it.