IO-Link Master2.02.03
 
Loading...
Searching...
No Matches
SMI General

Overview

SMI General.

Functions

IOL_FUNC_DECL void IOLM_SMI_vGenericReq (IOLM_SMI_SHeader *psuHeader_p, INT8U *pu8ArgBlock_p)
 SMI generic request.
 
IOL_FUNC_DECL void IOLM_SMI_vSaveNvFinished (void)
 Save configuration finished.
 
void IOLM_SMI_vExtRsp (IOL_EErrorType eError_p, INT8U *pu8Data_p, INT16U u16Length_p)
 SMI extension response.
 
IOL_FUNC_DECL void IOLM_SMI_vRun (void)
 SMI Mainloop.
 
IOL_FUNC_DECL void IOLM_SMI_vInit (IOLM_SMI_SCallbacks *psuCallbacks_p)
 Initialize SMI interface.
 
IOL_FUNC_DECL IOLM_SMasterCfgIOLM_SMI_psuGetInternalConfig (void)
 Get Internal configuration.
 

Function Documentation

◆ IOLM_SMI_psuGetInternalConfig()

IOL_FUNC_DECL IOLM_SMasterCfg * IOLM_SMI_psuGetInternalConfig ( void  )

Get Internal configuration.

This functions returns a pointer to internal configuration structure. Values should be modified before first communication. Some of the values are also changeable during runtime.

Example
pCfg->u32ProcessingTimeUs = 500; // ensure enough time for stable communication
IOLM_SMI_vInit(&suSMICallbacks_g);
...
void IOLM_SMI_vInit(IOLM_SMI_SCallbacks *psuCallbacks_p)
Initialize SMI interface.
Definition IOLM_SMI.c:397
IOL_FUNC_DECL IOLM_SMasterCfg * IOLM_SMI_psuGetInternalConfig(void)
Get Internal configuration.
Definition IOLM_SMI.c:392
This structure is used for the stack configuration.
Definition IOLM_Types.h:1080

◆ IOLM_SMI_vExtRsp()

void IOLM_SMI_vExtRsp ( IOL_EErrorType  eError_p,
INT8U pu8Data_p,
INT16U  u16Length_p 
)

SMI extension response.

Responses of extension functions which are proprietary and not included in the IOL/IOLW specification.

Parameters
[in]eError_pError message as IOL_EErrorType.
[in]pu8Data_pPointer to the response data.
[in]u16Length_pLength of the response data
Example
void IOLM_SMI_vExtensionService(INT8U u8Instance_p, INT8U *pu8Data_p, INT16U u16Length_p)
{
IOL_EErrorType eErrorResponse;
INT8U *pu8DataResponse;
// ToDo: Insert application specific code here
// Response to stack
IOLM_SMI_vExtRsp(eErrorResponse, pu8DataResponse, 0);
}
IOL_EErrorType
This enumeration indicates the permissible ISDU ErrorTypes resulting from the Device application.
Definition IOL_Types.h:554
uint16_t INT16U
16 bit unsigned integer
Definition IOL_Port_Types.h:54
uint8_t INT8U
8 bit unsigned integer
Definition IOL_Port_Types.h:52
void IOLM_SMI_vExtRsp(IOL_EErrorType eError_p, INT8U *pu8Data_p, INT16U u16Length_p)
SMI extension response.
Definition IOLM_SMI.c:3225
See also
IOLM_SMI_CBSMIExt

◆ IOLM_SMI_vGenericReq()

IOL_FUNC_DECL void IOLM_SMI_vGenericReq ( IOLM_SMI_SHeader psuHeader_p,
INT8U pu8ArgBlock_p 
)

SMI generic request.

The function is used for a generic access of all services of the SMI. The answer to this request is the callback function IOLM_SMI_CBGenericCnf.

Parameters
[in]psuHeader_pHeader.
[in]pu8ArgBlock_pGeneric ArgBlock.
Example
// Allocate header memory
INT8U au8HeaderMem[sizeof(IOLM_SMI_SHeader)];
IOLM_SMI_SHeader *psuHeader = (IOLM_SMI_SHeader *)au8HeaderMem;
// Allocate ArgBlock memory (pu8Data contains the data of length u16DataLength)
INT16U u16ArgBlockLength = sizeof(IOLM_SMI_SGeneralArgBlock) + u16DataLength;
INT8U au8ArgBlockMem[u16ArgBlockLength];
IOLM_SMI_SGeneralArgBlock *psuArgblock = (IOLM_SMI_SGeneralArgBlock *)au8ArgBlockMem;
// Fill header
psuHeader->u16ArgBlockLength = u16ArgBlockLength;
psuHeader->u8Service = ...
...
// Fill request
psuArgblock->u16ArgBlockID = IOLM_SMI_ENDIAN_16(IOLM_SMI_SGeneralArgBlock); // ArgBlock ID (little endian)
...
// Copy user data into ArgBlock request
memcpy(psuArgblock + sizeof(IOLM_SMI_SGeneralArgBlock), pu8Data, u16ArgBlockLength);
// ToDo: Insert application specific code here
// Send request
IOLM_SMI_vGenericReq(psuHeader, (INT8U *)psuArgblock);
// wait for IOLM_SMI_CBGenericCnf
IOL_FUNC_DECL void IOLM_SMI_vGenericReq(IOLM_SMI_SHeader *psuHeader_p, INT8U *pu8ArgBlock_p)
SMI generic request.
Definition IOLM_SMI_API.c:635
SGI dependent types.
Definition IOLM_SMI_Types.h:1352
This structure is used as general and void ArgBlock.
Definition IOLM_SMI_Types.h:573
INT16U u16ArgBlockID
Big endian.
Definition IOLM_SMI_Types.h:574

◆ IOLM_SMI_vInit()

IOL_FUNC_DECL void IOLM_SMI_vInit ( IOLM_SMI_SCallbacks psuCallbacks_p)

Initialize SMI interface.

Initializes the SMI Interface, sets initial values, loads saved configuration (if present), etc. Must be called once before SMI Mainloop (IOLM_SMI_vRun).

Parameters
[in]psuCallbacks_pSet of callback functions.
Example
// ToDo: Setup the desired callbacks
IOLM_SMI_SCallbacks suSMICallbacks_g =
{
.cbGenericCnf = IOLM_SMI_cbGenericCnf,
.cbPortConfigurationCnf = IOLM_SMI_cbPortConfigurationCn,
.cbReadbackPortConfigurationCnf = IOLM_SMI_cbReadbackPortConfigurationCnf,
.cbPortStatusCnf ...
...
};
// Initialize stack and SMI (suSMICallbacks_g must 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:5039
SMI Callbacks. Must be initialized via IOLM_SMI_vInit.
Definition IOLM_SMI.h:2929
IOLM_SMI_CBGenericCnf cbGenericCnf
Callback for IOLM_SMI_vGenericReq.
Definition IOLM_SMI.h:2933
See also
IOLM_SMI_SCallbacks

◆ IOLM_SMI_vRun()

IOL_FUNC_DECL void IOLM_SMI_vRun ( void  )

SMI Mainloop.

Runs periodically to execute the next jobs in the queue, etc. Must be called at least once every millisecond to guarantee a stable stack environment.

Example
// ToDo: Setup the desired callbacks
IOLM_SMI_SCallbacks suSMICallbacks_g =
{
.cbGenericCnf = IOLM_SMI_vGenericCnf,
.cbMemFree = IOLM_SMI_vMemFree,
.cbMemAlloc = LOLM_SMI_pu8ArgBlockAlloc,
.cbLoadNvCfg = ...
...
};
// Initialize stack and SMI (suSMICallbacks_g must 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
}

◆ IOLM_SMI_vSaveNvFinished()

IOL_FUNC_DECL void IOLM_SMI_vSaveNvFinished ( void  )

Save configuration finished.

This service needs to be called by the application code, to inform the stack, that the configuration is successfully written to the non volatile memory function in the application code (which can take a few hundred milliseconds).

void LOLM_SMI_vSaveNVCfg(INT8U u8Instance_p, INT8U *pu8Data_p, INT32U u32Length_p)
{
// Create local configuration struct in your application
IOLM_SMI_SNVConfiguration *psuNVConfiguration = (IOLM_SMI_SNVConfiguration *)pu8Data_p;
// Save configuration to non-volatile memory
// ToDo: Insert hardware specific code here
// Tell the stack that saving the configuration is finished
}
uint32_t INT32U
32 bit unsigned integer
Definition IOL_Port_Types.h:56
void IOLM_SMI_vSaveNvFinished(void)
Save configuration finished.
Definition IOLM_SMI.c:617
Definition IOLM_SMI.h:351
See also
IOLM_SMI_CBSaveNVCfg