IO-Link Masterv2.01.01
 
Loading...
Searching...
No Matches
SMI

This section provides an overview of all interface functions that can be used with the SMI disabled. The great advantage of SMI is that most of the API functionality is handled by the SMI and doesn't have to be set manually. To deactivate the SMI, the IOLM_SMI_ENABLED definition must be set to 0. For more details, see the corresponding function descriptions and the following sections.

General API

The stack needs to be initialized once during startup with the following function:

To proceed the internal state machines and send notifications to the application layer, the main run function must be called periodically. This must be done at least once during an IO-Link cycle.

Timing API

The following functions are used for timing:

For details see Timer System.

Physical Layer API

The following functions are used to access the physical layer:

For details see Physical Layer.

Port Configuration

The configuration of device specific stack values (like IOLM_PORT_COUNT for the number of available ports on the Master, IOLM_SMI_ENABLED, etc.) needs to be set in IO-Link Port Definitions and in IO-Link Master Port Definitions.

System Management API

The System Management is used to configure the port modes and indicate their current state.

Process Data API

The following functions are used to access the process image:

If the Port is in a SIO Mode, the process image length is 1 byte and used as boolean for the state of the pin.

The following function indicates that there is new input process image available:

The following function indicate the end of a Process Data cycle:

The following functions are used to set/indicate the status of the Process Data:

ISDU/Parameter API

The ISDU/Parameter API is used to access parameters of a device. Requests are sent with the Req functions. If the request is finished (which takes multiple IO-Link cycles), the corresponding Cnf function is called with the result. If a device needs too much time to respond, the request can be aborted. There is also a auto timeout of IOL_ISDU_TIMEOUT_MS milliseconds.

Event API

Events are indicated by the following function:

Events must always be acknowledged. The application will receive no further device Event until the last one is acknowledged by the following function.

Data Storage API

The following functions are used to access the Data Storage:

For a detailed description see Data Storage.

The Standardized Master Interface (SMI) is a generic interface which is set on top of the regular API of the stack. It matches the interface with other IO-Link standards and acts as a connecting interface for multiple clients. It also includes the configuration management and event dispatching.

Architecture

Most services have ArgBlocks as their parameters. These ArgBlocks are made up of an identifier and contain with different content, depending on its type. The supported ArgBlocks are listed in a following chapter (see IOLM_SMI_EArgBlockID). If no ArgBlock is used "NULL" is passed instead of the ArgBlock parameter, e.g. for a request. Most SMI services are acknowledged by a separate confirmation. They are executed in the Mainloop. Some simple services are also available with direct confirmation. The normal API should not be used if the SMI is enabled.

Initialization and Run

The following code snippet shows how to initialize the SMI interface.

// Setup the desired callbacks
IOLM_SMI_SCallbacks suSMICallbacks_g =
{
.cbGenericCnf = IOLM_SMI_vGenericCnf,
.cbMemFree = IOLM_SMI_vMemFree,
.cbMemAlloc = LOLM_SMI_pu8ArgBlockAlloc,
.cbLoadNvCfg = IOLM_SMI_LoadNVCfg,
.cbDeviceEventInd = IOLM_SMI_DeviceEventInd,
.cbPortEventInd = IOLM_SMI_PortEventInd,
.cbDeviceWriteCnf = IOLM_SMI_DeviceWriteCnf,
.cbDeviceReadCnf = IOLM_SMI_DeviceReadCnf,
};
// Initialize stack and SMI (suSMICallbacks_g has to be global)
IOLM_SMI_vInit(&suSMICallbacks_g);
// Application Mainloop
while (1)
{
IOLM_SMI_vRun(); // SMI Mainloop (at least once per ms)
User_Application(); // ToDo: Insert application specific code here
}
void IOLM_SMI_vRun(void)
SMI Mainloop.
Definition IOLM_SMI.c:5017
void IOLM_SMI_vInit(IOLM_SMI_SCallbacks *psuCallbacks_p)
Initialize SMI interface.
Definition IOLM_SMI.c:409
SMI Callbacks. Must be initialized via IOLM_SMI_vInit.
Definition IOLM_SMI.h:2932
IOLM_SMI_CBGenericCnf cbGenericCnf
Callback for IOLM_SMI_vGenericReq.
Definition IOLM_SMI.h:2936

It is only required to provide the desired callbacks. There is a generic API for all services, or an API for each single service.

Services

Callbacks

  • IOLM_SMI_CBGenericCnf
  • IOLM_SMI_CBMasterIdentificationCnf
  • IOLM_SMI_CBLoadMasterIdentification
  • IOLM_SMI_CBMasterConfigurationCnf
  • IOLM_SMI_CBPortConfigurationCnf
  • IOLM_SMI_CBReadbackPortConfigurationCnf
  • IOLM_SMI_CBPortStatusCnf
  • IOLM_SMI_CBDSBackupToParServCnf
  • IOLM_SMI_CBDSBackupFromParServCnf
  • IOLM_SMI_CBDeviceWriteCnf
  • IOLM_SMI_CBDeviceReadCnf
  • IOLM_SMI_CBDeviceEventInd
  • IOLM_SMI_CBPortEventInd
  • IOLM_SMI_CBPDInCnf
  • IOLM_SMI_CBPDOutCnf
  • IOLM_SMI_CBPDInOutCnf
  • IOLM_SMI_CBPDInIQCnf
  • IOLM_SMI_CBPDOutIQCnf
  • #IOLM_SMI_CBFSPDInOutCnf
  • IOLM_SMI_CBLoadNVCfg
  • IOLM_SMI_CBSaveNVCfg

ArgBlocks

The ArgBlock IDs are listed in IOLM_SMI_EArgBlockID. The following structures are available

Direct Services