no-OS
Loading...
Searching...
No Matches
basic_example.h File Reference

IO-Link protocol helpers and basic example interface. More...

#include <stdint.h>
Include dependency graph for basic_example.h:

Macros

#define IOL_READ   1
 
#define IOL_WRITE   0
 
#define IOL_CH_PROCESS   0
 
#define IOL_CH_PAGE   1
 
#define IOL_CH_DIAG   2
 
#define IOL_CH_ISDU   3
 
#define IOL_MC(rw, ch, addr)
 
#define IOL_CMD_MASTERIDENT   0x95
 
#define IOL_CMD_PREOPERATE   0x9A
 
#define IOL_CMD_OPERATE   0x99
 
#define IOL_ISDU_START   0x10
 
#define IOL_ISDU_IDLE   0x11
 
#define IOL_ISDU_READ_REQ   0x93
 
#define IOL_ISDU_READ_CMD(idx)
 
#define IOL_ISDU_BUSY   0x01
 
#define IOL_ISDU_ISERVICE_MSK   0xF0
 
#define IOL_ISDU_READ_ERROR   0xC0
 
#define IOL_ISDU_LEN_MSK   0x0F
 
#define IOL_ISDU_LONG_FORM   0x01
 
#define IOL_ISDU_LONG_HDR_OVERHEAD   3
 
#define IOL_ISDU_SHORT_HDR_OVERHEAD   2
 
#define IOL_MAX_OD   32
 
#define IOL_MAX_RX_FRAME   (2 * IOL_MAX_OD + 1)
 
#define IOL_MAX_ISDU_DATA   232
 

Enumerations

enum  iol_ckt {
  IOL_CKT_TYPE0 = 0x00 ,
  IOL_CKT_TYPE1 = 0x40 ,
  IOL_CKT_TYPE2 = 0x80
}
 
enum  iol_dpp {
  IOL_DPP_MASTERCMD = 0x00 ,
  IOL_DPP_CYCLETIME = 0x01 ,
  IOL_DPP_MINCYCLETIME = 0x02 ,
  IOL_DPP_MSEQCAP = 0x03 ,
  IOL_DPP_REVISIONID = 0x04 ,
  IOL_DPP_PDIN = 0x05 ,
  IOL_DPP_PDOUT = 0x06 ,
  IOL_DPP_VENDORID_MSB = 0x07 ,
  IOL_DPP_VENDORID_LSB = 0x08 ,
  IOL_DPP_DEVICEID_B1 = 0x09 ,
  IOL_DPP_DEVICEID_B2 = 0x0A ,
  IOL_DPP_DEVICEID_B3 = 0x0B ,
  IOL_DPP_FUNCTIONID_MSB = 0x0C ,
  IOL_DPP_FUNCTIONID_LSB = 0x0D
}
 
enum  iol_isdu_index {
  IOL_ISDU_VENDORNAME = 16 ,
  IOL_ISDU_VENDORTEXT = 17 ,
  IOL_ISDU_PRODUCTNAME = 18 ,
  IOL_ISDU_PRODUCTID = 19 ,
  IOL_ISDU_PRODUCTTEXT = 20 ,
  IOL_ISDU_SERIALNUMBER = 21
}
 

Functions

int basic_example_main (void)
 basic example main execution.
 

Detailed Description

IO-Link protocol helpers and basic example interface.

Author
Liviu Stan (liviu.nosp@m..sta.nosp@m.n@ana.nosp@m.log..nosp@m.com)

Copyright 2026(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ IOL_CH_DIAG

#define IOL_CH_DIAG   2

◆ IOL_CH_ISDU

#define IOL_CH_ISDU   3

◆ IOL_CH_PAGE

#define IOL_CH_PAGE   1

◆ IOL_CH_PROCESS

#define IOL_CH_PROCESS   0

◆ IOL_CMD_MASTERIDENT

#define IOL_CMD_MASTERIDENT   0x95

◆ IOL_CMD_OPERATE

#define IOL_CMD_OPERATE   0x99

◆ IOL_CMD_PREOPERATE

#define IOL_CMD_PREOPERATE   0x9A

◆ IOL_ISDU_BUSY

#define IOL_ISDU_BUSY   0x01

◆ IOL_ISDU_IDLE

#define IOL_ISDU_IDLE   0x11

◆ IOL_ISDU_ISERVICE_MSK

#define IOL_ISDU_ISERVICE_MSK   0xF0

◆ IOL_ISDU_LEN_MSK

#define IOL_ISDU_LEN_MSK   0x0F

◆ IOL_ISDU_LONG_FORM

#define IOL_ISDU_LONG_FORM   0x01

◆ IOL_ISDU_LONG_HDR_OVERHEAD

#define IOL_ISDU_LONG_HDR_OVERHEAD   3

◆ IOL_ISDU_READ_CMD

#define IOL_ISDU_READ_CMD ( idx)
Value:
{ IOL_ISDU_READ_REQ, (idx), \
#define IOL_ISDU_READ_REQ
Definition basic_example.h:73

◆ IOL_ISDU_READ_ERROR

#define IOL_ISDU_READ_ERROR   0xC0

◆ IOL_ISDU_READ_REQ

#define IOL_ISDU_READ_REQ   0x93

◆ IOL_ISDU_SHORT_HDR_OVERHEAD

#define IOL_ISDU_SHORT_HDR_OVERHEAD   2

◆ IOL_ISDU_START

#define IOL_ISDU_START   0x10

◆ IOL_MAX_ISDU_DATA

#define IOL_MAX_ISDU_DATA   232

◆ IOL_MAX_OD

#define IOL_MAX_OD   32

◆ IOL_MAX_RX_FRAME

#define IOL_MAX_RX_FRAME   (2 * IOL_MAX_OD + 1)

◆ IOL_MC

#define IOL_MC ( rw,
ch,
addr )
Value:
(((rw) << 7) | ((ch) << 5) | (addr))

◆ IOL_READ

#define IOL_READ   1

◆ IOL_WRITE

#define IOL_WRITE   0

Enumeration Type Documentation

◆ iol_ckt

enum iol_ckt
Enumerator
IOL_CKT_TYPE0 
IOL_CKT_TYPE1 
IOL_CKT_TYPE2 

◆ iol_dpp

enum iol_dpp
Enumerator
IOL_DPP_MASTERCMD 
IOL_DPP_CYCLETIME 
IOL_DPP_MINCYCLETIME 
IOL_DPP_MSEQCAP 
IOL_DPP_REVISIONID 
IOL_DPP_PDIN 
IOL_DPP_PDOUT 
IOL_DPP_VENDORID_MSB 
IOL_DPP_VENDORID_LSB 
IOL_DPP_DEVICEID_B1 
IOL_DPP_DEVICEID_B2 
IOL_DPP_DEVICEID_B3 
IOL_DPP_FUNCTIONID_MSB 
IOL_DPP_FUNCTIONID_LSB 

◆ iol_isdu_index

Enumerator
IOL_ISDU_VENDORNAME 
IOL_ISDU_VENDORTEXT 
IOL_ISDU_PRODUCTNAME 
IOL_ISDU_PRODUCTID 
IOL_ISDU_PRODUCTTEXT 
IOL_ISDU_SERIALNUMBER 

Function Documentation

◆ basic_example_main()

int basic_example_main ( )

basic example main execution.

Returns
ret - Result of the example execution. If working correctly, will execute print the sample data.

basic example main execution.

Returns
ret - Result of the example execution. If working correctly, will execute continuously function basic_app_run and will not return.
ret - Result of the example execution. If working correctly, will execute print the sample data.

basic example main execution.

Returns
ret - Result of the example execution. If working correctly, will execute continuously function basic_app_run and will not return.

basic example main execution.

Demonstrates a full IO-Link communication cycle without an IO-Link stack:

  1. STARTUP - establish communication, read device identity from DPP
  2. PREOPERATE - read ISDU parameters (vendor name, serial number, etc.)
  3. OPERATE - exchange cyclic process data
Returns
0 on success, negative error code otherwise.

basic example main execution.

Returns
ret - Result of the example execution.

basic example main execution.

Initialises the UART peripheral, prints a banner, then loops forever printing a counter message once per second.

Returns
0 on success, negative error code on failure.