IO-Link Master  1.03.03

Overview

Port API.

Functions

IOL_FUNC_DECL void IOLM_API_PL_vTransferInd (INT8U u8Port_p, INT8U u8DataLength_p, IOL_ETransferStatus eStatus_p)
 Data receive processing finished. More...
 
IOL_FUNC_DECL void IOLM_API_vTimerExpired (INT8U u8Port_p)
 Port timer expired. More...
 
IOL_FUNC_DECL void IOLM_API_PL_u8WakeAck (INT8U u8Port_p)
 Acknowledge wake-up. More...
 
IOL_FUNC_DECL void IOLM_API_PL_vSwitchPortPower (INT8U u8Port_p, TBOOL boOn_p, INT16U u16WaitTimeMs_p)
 Switch port power L+ off or on. More...
 
IOL_FUNC_DECL void IOLM_API_DS_vStoreComplete (INT8U u8Port_p, INT16U u16Length_p)
 None volatile store completed. More...
 
IOL_FUNC_DECL void IOLM_Port_PL_vSetMode (INT8U u8Port_p, IOL_ETargetMode eTargetMode_p)
 Set physical layer mode. More...
 
IOL_FUNC_DECL IOLM_EWakeupMode IOLM_Port_PL_eWakeUp (INT8U u8Port_p)
 Send wake-up pulse. More...
 
IOL_FUNC_DECL void IOLM_Port_PL_vTransferPrepare (INT8U u8Port_p, const INT8U *pu8Data_p, INT8U u8DataLength_p, INT8U *pu8ResponseData_p, INT8U u8ResponseLength_p)
 Prepare data exchange. More...
 
IOL_FUNC_DECL void IOLM_Port_PL_vTransferTrig (INT8U u8Port_p)
 Start frame transmission. More...
 
IOL_FUNC_DECL void IOLM_Port_PL_vSetDO (INT8U u8Port_p, TBOOL boOutValue_p)
 Set output pin value. More...
 
IOL_FUNC_DECL TBOOL IOLM_Port_PL_boGetDI (INT8U u8Port_p)
 Get input pin value. More...
 
IOL_FUNC_DECL void IOLM_Port_PL_vSetIQ (INT8U u8Port_p, TBOOL boOutValue_p)
 Set IQ output pin value. More...
 
IOL_FUNC_DECL TBOOL IOLM_Port_PL_boGetIQ (INT8U u8Port_p)
 Get IQ input pin value. More...
 
IOL_FUNC_DECL void IOLM_Port_PL_vSetIQMode (INT8U u8Port_p, IOL_EIQMode eIQMode_p)
 Set IQ mode. More...
 
IOL_FUNC_DECL void IOLM_Port_PL_vSetPhyCycleTimer (INT8U u8Port_p, INT32U u32TimeUs_p)
 Cycle timer setup. More...
 
IOL_FUNC_DECL void IOLM_Port_vStartTimer (INT8U u8Port_p, INT32U u32TimeUs_p)
 Start port hardware timer. More...
 
IOL_FUNC_DECL INT32S IOLM_Port_s32SysTickVal (void)
 Get SysTick value. More...
 
IOL_FUNC_DECL void IOLM_Port_vCriticalStart (void)
 Enter critical section. More...
 
IOL_FUNC_DECL void IOLM_Port_vCriticalEnd (void)
 Enter critical section. More...
 
IOL_FUNC_DECL INT8UIOLM_Port_pu8MemAlloc (INT32U u32Length_p)
 Allocate memory callback. More...
 
IOL_FUNC_DECL void IOLM_Port_vMemFree (INT8U *pu8Mem_p)
 Free memory callback. More...
 
IOL_FUNC_DECL void IOLM_Port_DS_vStoreData (INT8U u8Port_p, INT8U *pu8Data_p, INT16U u16Length_p)
 Store DS content. More...
 
IOL_FUNC_DECL INT16U IOLM_Port_DS_u16LoadData (INT8U u8Port_p, INT8U *pu8Data_p, INT16U u16Length_p)
 Load DS content. More...
 
IOL_FUNC_DECL void IOLM_Port_PL_vSetCqMode (INT8U u8Port_p, IOL_ECqMode eCqMode_p)
 Set CQ Mode Logic for Port u8PortNum_p of Instance u8Instance_p. More...
 
IOL_FUNC_DECL IOL_ECqMode IOLM_Port_PL_eGetCqMode (INT8U u8Port_p)
 Get CQ Mode Logic for Port u8PortNum_p. More...
 
IOL_FUNC_DECL void IOLM_Port_PL_vSwitchPortPower (INT8U u8Port_p, TBOOL boOn_p)
 Switch port power on or off. More...
 

Function Documentation

◆ IOLM_API_DS_vStoreComplete()

IOL_FUNC_DECL void IOLM_API_DS_vStoreComplete ( INT8U  u8Port_p,
INT16U  u16Length_p 
)

None volatile store completed.

This function has to be called if the operation requested by IOLM_Port_DS_vStoreData is completed. It triggers further store requests if available.

Parameters
[in]u8Port_pThe port number of the affected port.
[in]u16Length_pNumber of bytes written.
Returns
void
Precondition
The port number must be smaller than IOLM_PORT_COUNT.
Postcondition
None.
IRQ-safe
No Function needs to be called in Mainloop context.

◆ IOLM_API_PL_u8WakeAck()

IOL_FUNC_DECL void IOLM_API_PL_u8WakeAck ( INT8U  u8Port_p)

Acknowledge wake-up.

This function indicates a finished wake-up pulse if wake-up mode is IOLM_eWakeupMode_Ack is used. It starts a timer and initiates the following procedure.

Parameters
[in]u8Port_pThe port number of the affected port.
Returns
void
Postcondition
  • Wake-up procedure proceed.
IRQ-safe
Yes Function can be called in interrupt context.

◆ IOLM_API_PL_vSwitchPortPower()

IOL_FUNC_DECL void IOLM_API_PL_vSwitchPortPower ( INT8U  u8Port_p,
TBOOL  boOn_p,
INT16U  u16WaitTimeMs_p 
)

Switch port power L+ off or on.

This function switches port power L+. The minimum power down time for u16WaitTimeMs_p is 500ms. If boOn_p is false and u16WaitTimeMs_p >= 500 L+ is switched off and after the defined time u16WaitTimeMs_p switched on again. If boOn_p is false and u16WaitTimeMs_p < 500 L+ is switched off permanently.

If boOn_p is true L+ is switched on permanently regardless of u16WaitTimeMs_p.

Parameters
[in]u8Port_pThe port number of the affected port.
[in]boOn_pTRUE for on, FALSE for off
[in]u16WaitTimeMs_pTime in ms the port should stay off
Returns
void
Precondition
The port number must be smaller than IOLM_PORT_COUNT.
Postcondition
None
IRQ-safe
Yes Function can be called in interrupt context.

◆ IOLM_API_PL_vTransferInd()

IOL_FUNC_DECL void IOLM_API_PL_vTransferInd ( INT8U  u8Port_p,
INT8U  u8DataLength_p,
IOL_ETransferStatus  eStatus_p 
)

Data receive processing finished.

The PL Transfer Indication indicates a completed receive processing. The function expects the number of Device response bytes as requested by IOLM_Port_PL_vTransferPrepare. If the status is not IOL_eTransferStatus_OK or the length is invalid, the receive is failed and the retry procedure is triggered.

u8DataLength_p = 0xFF is interpreted as the expected length.

If IOLM_IRQ_PROCESSING is 0, the data is passed to Mainloop where it will be processed. If the value is 1, all time critical data is interpreted in this function.

Parameters
[in]u8Port_pThe port number of the affected port.
[in]u8DataLength_pNumber of received bytes.
[in]eStatus_pStatus information about the received Data.
Returns
void
Precondition
The port number must be smaller than IOLM_PORT_COUNT.
Postcondition
Needs Mainloop run for further processing.
IRQ-safe
Yes Function can be called in interrupt context.

◆ IOLM_API_vTimerExpired()

IOL_FUNC_DECL void IOLM_API_vTimerExpired ( INT8U  u8Port_p)

Port timer expired.

The timer expired callback is used to signal that the timer started by IOLM_Port_vStartTimer is timed out. This triggers internal state machines and start transmission of the next frame.

If IOLM_IRQ_PROCESSING is 0, the Tx frame is prepared in Mainloop. If set to 1, the Tx frame is prepared in this function which leads to a longer runtime.

Parameters
[in]u8Port_pThe port number of the affected port.
Returns
void
Precondition
The port number must be smaller than IOLM_PORT_COUNT.
Postcondition
Needs Mainloop run for further processing.
IRQ-safe
Yes Function can be called in interrupt context.

◆ IOLM_Port_DS_u16LoadData()

IOL_FUNC_DECL INT16U IOLM_Port_DS_u16LoadData ( INT8U  u8Port_p,
INT8U pu8Data_p,
INT16U  u16Length_p 
)

Load DS content.

This function loads the Data Storage content of a specific port from a non volatile memory. This is a blocking function and only called during initialization. The return value is the content length. This should only be >0 if the data is valid.

Parameters
[in]u8Port_pThe port number of the affected port.
[in]pu8Data_pData area to load.
[in]u16Length_pLength of data pointer.
Returns
valid data length loaded
Precondition
The port number must be smaller than IOLM_PORT_COUNT.
Postcondition
None.
IRQ-safe
No Function will be called from Mainloop context.

◆ IOLM_Port_DS_vStoreData()

IOL_FUNC_DECL void IOLM_Port_DS_vStoreData ( INT8U  u8Port_p,
INT8U pu8Data_p,
INT16U  u16Length_p 
)

Store DS content.

This function save the Data Storage content of a specific port in a non volatile memory. This function should not block for longer time (cyclic communication must be handled). After completion IOLM_API_DS_vStoreComplete has to be called.

Parameters
[in]u8Port_pThe port number of the affected port.
[in]pu8Data_pData to be stored.
[in]u16Length_pLength of data.
Returns
void
Precondition
The port number must be smaller than IOLM_PORT_COUNT.
Postcondition
None.
IRQ-safe
No Function will be called from Mainloop context.

◆ IOLM_Port_PL_boGetDI()

IOL_FUNC_DECL TBOOL IOLM_Port_PL_boGetDI ( INT8U  u8Port_p)

Get input pin value.

The PL get DI function is used if the port is in DI mode. It reads the input value from the corresponding port.

Parameters
[in]u8Port_pThe port number of the affected port.
Returns
Value of the corresponding pin
Precondition
Postcondition
None.
IRQ-safe
Yes Function can be called in interrupt context.

◆ IOLM_Port_PL_boGetIQ()

IOL_FUNC_DECL TBOOL IOLM_Port_PL_boGetIQ ( INT8U  u8Port_p)

Get IQ input pin value.

The PL get IQ function reads the input value from IQ Pin (e.g. M12 Pin 2) of the corresponding port.

Parameters
[in]u8Port_pThe port number of the affected port.
Returns
Value of the corresponding pin
Precondition
Postcondition
None.
IRQ-safe
Yes Function can be called in interrupt context.

◆ IOLM_Port_PL_eGetCqMode()

IOL_FUNC_DECL IOL_ECqMode IOLM_Port_PL_eGetCqMode ( INT8U  u8Port_p)

Get CQ Mode Logic for Port u8PortNum_p.

This function reads the set CQ Pin Mode/Logic - either NPN, PNP or PushPull for SIO Mode.

Parameters
[in]u8Port_pThe port number of the affected port.
Returns
IOL_ECqMode, which can be either IOL_eCqMode_NPN, IOL_eCqMode_PNP, IOL_eCqMode_PUSHPULL or IOL_eCqMode_INACTIVE.
Precondition
The port number must be smaller than IOLM_PORT_COUNT.
Postcondition
None.

Function will be called from setDO context.

◆ IOLM_Port_PL_eWakeUp()

IOL_FUNC_DECL IOLM_EWakeupMode IOLM_Port_PL_eWakeUp ( INT8U  u8Port_p)

Send wake-up pulse.

The PL-WakeUp service initiates a specific sequence which prepares the physical layer to send and receive communication requests (see 5.3.3.3). The function returns the wake-up mode of the Phy.

If IOLM_eWakeupMode_Done is returned, the wake-up pulse will be generated without further activity of the stack.

IOLM_eWakeupMode_Phy indicates a phy with frame handler. The stack needs only to trigger retries if communication can't be established or is lost.

IOLM_eWakeupMode_Stack is used, if the stack should generate the wake-up pulse using the timer and SIO interface.

IOLM_eWakeupMode_Ack is used when wake-up is done by application and later acknowledged by IOLM_API_PL_u8WakeAck.

Parameters
[in]u8Port_pThe port number of the affected port.
Returns
IOLM_EWakeupMode Wake-up mode.
Precondition
The port number must be smaller than IOLM_PORT_COUNT.
Postcondition
None.
IRQ-safe
No Function will be called from Mainloop context.

◆ IOLM_Port_PL_vSetCqMode()

IOL_FUNC_DECL void IOLM_Port_PL_vSetCqMode ( INT8U  u8Port_p,
IOL_ECqMode  eCqMode_p 
)

Set CQ Mode Logic for Port u8PortNum_p of Instance u8Instance_p.

This function sets the CQ Pin Mode/Logic - either NPN, PNP or PushPull for SIO Mode.

Parameters
[in]u8Port_pThe port number of the affected port.
[in]eCqMode_pIOL Master Port CQ Mode / Logic
Precondition
The port number must be smaller than IOLM_PORT_COUNT.
Postcondition
None.

Function will be called from IOLM_SOC_setMode context.

◆ IOLM_Port_PL_vSetDO()

IOL_FUNC_DECL void IOLM_Port_PL_vSetDO ( INT8U  u8Port_p,
TBOOL  boOutValue_p 
)

Set output pin value.

The PL set DO function is used if the port is in DO Mode. It sets the output pin to the corresponding value.

Parameters
[in]u8Port_pThe port number of the affected port.
[in]boOutValue_pValue of the output pin.
Returns
void
Precondition
Postcondition
None.
IRQ-safe
Yes Function can be called in interrupt context.

◆ IOLM_Port_PL_vSetIQ()

IOL_FUNC_DECL void IOLM_Port_PL_vSetIQ ( INT8U  u8Port_p,
TBOOL  boOutValue_p 
)

Set IQ output pin value.

The PL set IQ function sets the IQ output pin (e.g. M12 Pin 2) to the corresponding value.

Parameters
[in]u8Port_pThe port number of the affected port.
[in]boOutValue_pValue of the output pin.
Returns
void
Precondition
Postcondition
None.
IRQ-safe
Yes Function can be called in interrupt context.

◆ IOLM_Port_PL_vSetIQMode()

IOL_FUNC_DECL void IOLM_Port_PL_vSetIQMode ( INT8U  u8Port_p,
IOL_EIQMode  eIQMode_p 
)

Set IQ mode.

The PL set IQ mode function sets the mode for IQ pin (e.g. M12 Pin 2).

Parameters
[in]u8Port_pThe port number of the affected port.
[in]eIQMode_pValue of IQ mode.
Returns
void
Precondition
Postcondition
None.
IRQ-safe
Yes Function can be called in interrupt context.

◆ IOLM_Port_PL_vSetMode()

IOL_FUNC_DECL void IOLM_Port_PL_vSetMode ( INT8U  u8Port_p,
IOL_ETargetMode  eTargetMode_p 
)

Set physical layer mode.

The PL-SetMode service is used to setup the electrical characteristics and configurations of the physical layer.

Parameters
[in]u8Port_pThe port number of the affected port.
[in]eTargetMode_pIndicates the requested operational mode of the port.
Returns
void
Precondition
The port number must be smaller than IOLM_PORT_COUNT.
Postcondition
None.
IRQ-safe
Yes Function can be called in interrupt context.

◆ IOLM_Port_PL_vSetPhyCycleTimer()

IOL_FUNC_DECL void IOLM_Port_PL_vSetPhyCycleTimer ( INT8U  u8Port_p,
INT32U  u32TimeUs_p 
)

Cycle timer setup.

This function indicates a cycle timer configuration change. The information can be used to configure an external Phy cycle timer.

Parameters
[in]u8Port_pThe port number of the affected port.
[in]u32TimeUs_pCycle time in microseconds.
Precondition
Postcondition
None.
IRQ-safe
Yes Function can be called in interrupt context.

◆ IOLM_Port_PL_vSwitchPortPower()

IOL_FUNC_DECL void IOLM_Port_PL_vSwitchPortPower ( INT8U  u8Port_p,
TBOOL  boOn_p 
)

Switch port power on or off.

This function is called to switch on/off L+.

Parameters
[in]u8Port_pPort number.
[in]boOn_pTRUE = switch on, FALSE = switch off.
Returns
void
Precondition
The port number must be smaller than IOLM_PORT_COUNT.
Postcondition
None.

◆ IOLM_Port_PL_vTransferPrepare()

IOL_FUNC_DECL void IOLM_Port_PL_vTransferPrepare ( INT8U  u8Port_p,
const INT8U pu8Data_p,
INT8U  u8DataLength_p,
INT8U pu8ResponseData_p,
INT8U  u8ResponseLength_p 
)

Prepare data exchange.

The PL-transfer service is used to exchange the SDCI data between data link layer and physical layer. The prepare function setups Tx/Rx (maybe with DMA). The transfer start follows later.

Parameters
[in]u8Port_pThe port number of the affected port.
[in]pu8Data_pContains the data value which is transferred over the SDCI interface.
[in]u8DataLength_pThe size of the data in byte.
[in]pu8ResponseData_pMemory for the response data.
[in]u8ResponseLength_pThe size of the expected response data in byte.
Returns
void
Precondition
  • The port number must be smaller than IOLM_PORT_COUNT.
  • The given pointer(s) must be valid.
Postcondition
None.
IRQ-safe
If IOLM_IRQ_PROCESSING is set, the functions is called from IRQ context. If not, the function is called from Mainloop.

◆ IOLM_Port_PL_vTransferTrig()

IOL_FUNC_DECL void IOLM_Port_PL_vTransferTrig ( INT8U  u8Port_p)

Start frame transmission.

The PL-transfer service triggers the transmission of the prepared frame. If all expected bytes are received or an error happens, the function IOLM_API_PL_vTransferInd has to be called.

Parameters
[in]u8Port_pThe port number of the affected port.
Returns
void
Precondition
The port number must be smaller than IOLM_PORT_COUNT.
Postcondition
None.
IRQ-safe
Yes Function can be called in interrupt context.

◆ IOLM_Port_pu8MemAlloc()

IOL_FUNC_DECL INT8U* IOLM_Port_pu8MemAlloc ( INT32U  u32Length_p)

Allocate memory callback.

This callback is called by the stack to allocate memory resources.

Parameters
[in]u32Length_pLength of ArgBlock.
Returns
New pointer to allocated memory.

◆ IOLM_Port_s32SysTickVal()

IOL_FUNC_DECL INT32S IOLM_Port_s32SysTickVal ( void  )

Get SysTick value.

This function is used to read the SysTick counter value. The tick rate of this counter should be IOLM_SYSTICK_INTERVAL_MS milliseconds.

Returns
Tick value
Precondition
The port number must be smaller than IOLM_PORT_COUNT.
Postcondition
None.
IRQ-safe
No Function will be called from Mainloop context.

◆ IOLM_Port_vCriticalEnd()

IOL_FUNC_DECL void IOLM_Port_vCriticalEnd ( void  )

Enter critical section.

This function is called before call of critical sections and need to disable interrupts

◆ IOLM_Port_vCriticalStart()

IOL_FUNC_DECL void IOLM_Port_vCriticalStart ( void  )

Enter critical section.

This function is called before call of critical sections and need to disable interrupts

◆ IOLM_Port_vMemFree()

IOL_FUNC_DECL void IOLM_Port_vMemFree ( INT8U pu8Mem_p)

Free memory callback.

This callback is called by the stack to free the resources for an ArgBlock. Since this is hardware specific, it has to be implemented in the application code.

Parameters
[in]pu8Mem_pData pointer to the memory location.

◆ IOLM_Port_vStartTimer()

IOL_FUNC_DECL void IOLM_Port_vStartTimer ( INT8U  u8Port_p,
INT32U  u32TimeUs_p 
)

Start port hardware timer.

The start timer function is used to start a hardware timer for the specified port. After expiration the IOLM_API_vTimerExpired callback has to be called. If there is no phy cycle timer present this handles all hardware timers.

Parameters
[in]u8Port_pThe port number of the affected port.
[in]u32TimeUs_pTimeout in microseconds.
Returns
void
Precondition
Postcondition
None.
IRQ-safe
Yes Function can be called in interrupt context.