Process Image • 131
Internal Bus Driver (kbus.ko)
WAGO-I/O-SYSTEM 750
Linux Fieldbus Coupler
6.5 Internal Bus Driver (kbus.ko)
The internal bus driver
kbus
is a char device driver. It is therefore possible to
access the connected I/O modules using the standard device interface. The
driver is started automatically via the /
etc/startwago
file when the Linux
fieldbus controller is started.
In order not to have to create definitions manually, the header file
kbusapi.h
can be used in its own program. Functions that are additionally available in the
file (e.g., KbusUpdate) are no longer required and only included for
compatibility reasons.
Note:
The file
kbusapi.h
provides several macros that make it easier to access the
process image, however, they are not essential.
It may be beneficial to customize structures with meaningful names taken
from the control process.
Source code files:
~
/
uclinux-dist/
user/kbusapi/kbusapi.h
Driver/Kernel module:
kbus.ko (internal bus support)
Function Description
The internal bus driver can be used with the following functions:
•
open(„/dev/kbus“, O_WRONLY)
Opens the kbus driver.
•
ioctl(iFD, IOCTL_KBUSUPDATE, &ulTmp)
Writes the modified data of the output process image to the modules and
simultaneously reads the current data of the input modules back in.
•
ioctl(iFD, IOCTL_GETBINOUTPUTOFFSET, &ulOutputOffset)
Reads out the
Offset
value. The first digital output module in the output
process image has the
Offset
value. It is therefore easier to access the
digital I/O modules.
•
ioctl(iFD, IOCTL_GETBININPUTOFFSET, &ulInputOffset)
Reads out the
Offset
value. The first digital input module in the input
process image has the
Offset
value. It is therefore easier to access the
digital I/O modules.