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

◆ PN_API_IOD_arOwnershipCbf

typedef void(* PN_API_IOD_arOwnershipCbf) (PN_API_IOD_Handle_t *const pnHandle, uint32_t arNum, PN_API_IOD_Exp_t *ownSubmod)

Callback function prototype to inform the user application about the submodule configuration assumed by the IO controller and to ask the IO device to claim the ownership of these submodules.

Prior to engaging in data exchange within AR, it is imperative to have the same module/submodule configuration on bother IO controller and IO device's sides. Failing to do so will result in the inability to exchange valid data. The user application is responsible for confirming that the configuration received from the IO controller aligns with the expected one. Subsequently, the application must communicate with the stack, asserting AR ownership for each submodule if the configurations match, or rejecting the submodule to prevent the exchange of valid IO data if a discrepancy is identified. The application can also use this function to dynamically plug/pull submodules to align the actual configuration with the expected one.

Warning
A subslot can be allocated to a maximum of one AR, indicating that only a single AR can take ownership of a subslot among multiple ARs. For the remaining ARs, this particular submodule is designated as "superordinated locked."
Parameters
[in]pnHandleProfinet API Handle.
[in]arNumAR number.
[in,out]ownSubmodConfigured submodule list to be verified. User application needs to set the following values:
ownSubmod->submod[i].ownSessionKey = 0, if AR ownership is NOT assumed.
ownSubmod->submod[i].isWrongSubmod = true, if submodule ownership is NOT assumed. Otherwise, true.
Example
#include "pn_api_iod_callbacks.h"
#include "pn_api_iod_communication.h"
#include "pn_api_iod_startup.h"
//Implement the callback function in the user application
uint32_t arNum, PN_API_IOD_Exp_t *pOwnSub)
{...}
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);
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.
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
void PN_APP_IOD_cbArOwnershipInd(PN_API_IOD_Handle_t *const pnHandle, uint32_t arNum, PN_API_IOD_Exp_t *expSubmodsCfg)
Callback function to dynamically reconfigure the submodules and claiming their ownership.
Module/Submodule properties.
Definition pn_api_iod_types.h:506
PN_API_IOD_arOwnershipCbf arOwnership
Definition pn_api_iod_callbacks.h:52
Structure representing a set of callbacks.
Definition pn_api_iod_callbacks.h:41