Communication Protocols
Copyright IXXAT Automation GmbH
86
IEM Manual, 1.5
tional addressing level, the
API
(
A
pplication
P
rocess
I
dentifier) that is used for
the definition of user profiles (PROFIsafe, PROFIdrive, etc.).
The internal structure of the IO-Device, namely, a number of the APIs and a
set of the modules/submodules from the corresponding GSDML file has to be
delivered to the IEM during the start-up phase (in case of the dynamic recon-
figuration, within the operation mode). This is called physical or virtual “plug-
ging” of a specific module/submodule in a corresponding slot/subslot. For an
example of adding an API and plugging slot/subslot see Figure 5-1.
COM_t_BOARD_REF td_brdRef = ...
COM_e_ERROR e_ret;
COM_t_CMD_REQUEST s_cmd;
COM_t_PNIO_ADD_API *ps_addApi;
COM_t_PNIO_PLUG_MODULE *ps_plugModCmd;
COM_t_PNIO_PLUG_SUBMODULE *ps_plugSubmodCmd;
COM_t_CMD_RESPONSE s_response;
memset(&s_cmd, 0x00, sizeof(COM_t_CMD_REQUEST));
s_cmd.dw_command = COM_k_PNIO_API_ADD;
ps_addApi = (COM_t_PNIO_ADD_API*)&s_cmd.ab_comData[0];
ps_addApi->dw_apiNum = 0xABCDEF00;
// register a new API
e_ret = EMI_cmdChannelConfigure(td_brdRef,&s_cmd,TRUE,&s_response); // blocking
memset(&s_cmd, 0x00, sizeof(COM_t_CMD_REQUEST));
s_cmd.dw_command = COM_k_PNIO_MOD_PLUG;
ps_plugModCmd = (COM_t_PNIO_PLUG_MODULE*)&s_cmd.ab_comData[0];
ps_plugModCmd->dw_apiNum = 0xABCDEF00;
ps_plugModCmd->dw_modId = 0x201; // Module ID from the GSDML file
ps_plugModCmd->dw_attributes = 0;
ps_plugModCmd->w_slotNum = 1; // Slot where the module has to be plugged in
// plug a module
e_ret = EMI_cmdChannelConfigure(td_brdRef,&s_cmd,TRUE,&s_response); // blocking
memset(&s_cmd, 0x00, sizeof(COM_t_CMD_REQUEST));
s_cmd.dw_command = COM_k_PNIO_SUBMOD_PLUG;
ps_plugSubmodCmd = (COM_t_PNIO_PLUG_SUBMODULE*)&s_cmd.ab_comData[0];
ps_plugSubmodCmd->dw_apiNum = 0xABCDEF00;
ps_plugSubmodCmd->dw_submodId = 0x1; // Submodule ID from the GSDML file
ps_plugSubmodCmd->w_attributes = COM_k_PNIO_MODULE_INPUT;
ps_plugSubmodCmd->w_im0support = COM_k_PNIO_IM0_SUBMODULE;
ps_plugSubmodCmd->w_slotNum = 1; //Slot where the submodule has to be plugged in
ps_plugSubmodCmd->w_slotNum = 1; //Subslot where the submodule has to be plugged
in
// plug a submodule
e_ret = EMI_cmdChannelConfigure(td_brdRef,&s_cmd,TRUE,&s_response); // blocking
Figure 5-1: Registering of the device structure in the IEM