PROFINET Device4.2.0
 
Loading...
Searching...
No Matches

◆ PN_API_IOD_storeRemaMemCbf

typedef uint32_t(* PN_API_IOD_storeRemaMemCbf) (PN_API_IOD_Handle_t *const pnHandle, PN_API_IOD_RemaDataType_t type, const uint32_t instance, const uint32_t memSize, uint8_t *const srcMem)

Callback function prototype to request NV data storage.

This function is called by Profinet stack to transfer all received PDev records to the user application to store them in the NV memory. The user application needs not to change or interpret the data. It just needs to store it, and then during the next startup, restore it using PN_API_IOD_restoreRemaData() and transfer it to the stack.

Parameters
[in]pnHandleProfinet API Handle.
[in]typetype of content to be stored
[in]instanceinstance of type
[in]memSizeSize of the PDev buffer that needs to be written to NV memory.
[in]srcMemPointer to the buffer holding PDev data.
Returns
result of the operation as uint32_t.
Return values
PN_API_OKSuccess.
PN_API_ERR_PARAMInvalid parameter.
PN_API_ERR_FLASH_STORENV memory write operation failed.
Example
#include "pn_api_iod_bsp.h"
#include "pn_api_iod_callbacks.h"
#include "pn_api_iod_startup.h"
//Implement the callback function in the user application
PN_API_IOD_Handle_t *const pnHandle,
PN_API_IOD_RemaDataType_t type, sconst uint32_t instance,
uint32_t memSize, uint8_t *srcMem)
{
PN_API_IOD_dataStoreComplete(pnHandle, memSize);
...
}
PN_API_IOD_Handle_t* pnHandle = NULL;
uint32_t status;
pnHandle = PN_API_IOD_new();
//Store callback functions implemented by the user application
...}
//Register callback function
status = PN_API_IOD_registerCallbacks(pnHandle, &callbacks);
void PN_API_IOD_dataStoreComplete(PN_API_IOD_Handle_t *pnHandle, uint32_t lenWritten)
Non volatile store completed.
PN_API_IOD_Handle_t * PN_API_IOD_new(void)
Creates Profinet API handle.
uint32_t PN_API_IOD_registerCallbacks(PN_API_IOD_Handle_t *const pnHandle, PN_API_IOD_Callbacks_t *callbacksInst)
Register callback functions.
PN_API_IOD_RemaDataType_t
Type of remanent data.
Definition pn_api_iod_types.h:83
struct PN_API_IOD_Handle PN_API_IOD_Handle_t
API handle instance which holds IO device's info.
Definition pn_api_iod_types.h:61
uint32_t PN_APP_IOD_cbStoreRemaMem(PN_API_IOD_Handle_t *const pnHandle, PN_API_IOD_RemaDataType_t type, const uint32_t instance, const uint32_t memSize, uint8_t *const srcMem)
Callback function to request to store remanent data in NV memory.
PN_API_IOD_storeRemaMemCbf storeRemaMem
Definition pn_api_iod_callbacks.h:46
Structure representing a set of callbacks.
Definition pn_api_iod_callbacks.h:41