1f9a82c48SSven Van Asbroeck                       Fieldbus-Device Subsystem
2f9a82c48SSven Van Asbroeck               ============================================
3f9a82c48SSven Van Asbroeck
4f9a82c48SSven Van AsbroeckPart 0 - What is a Fieldbus Device ?
5f9a82c48SSven Van Asbroeck------------------------------------
6f9a82c48SSven Van Asbroeck
7f9a82c48SSven Van AsbroeckFieldbus is the name of a family of industrial computer network protocols used
8f9a82c48SSven Van Asbroeckfor real-time distributed control, standardized as IEC 61158.
9f9a82c48SSven Van Asbroeck
10f9a82c48SSven Van AsbroeckA complex automated industrial system -- such as manufacturing assembly line --
11f9a82c48SSven Van Asbroeckusually needs a distributed control system -- an organized hierarchy of
12f9a82c48SSven Van Asbroeckcontroller systems -- to function. In this hierarchy, there is usually a
13f9a82c48SSven Van AsbroeckHuman Machine Interface (HMI) at the top, where an operator can monitor or
14f9a82c48SSven Van Asbroeckoperate the system. This is typically linked to a middle layer of programmable
15f9a82c48SSven Van Asbroecklogic controllers (PLC) via a non-time-critical communications system
16f9a82c48SSven Van Asbroeck(e.g. Ethernet). At the bottom of the control chain is the fieldbus that links
17f9a82c48SSven Van Asbroeckthe PLCs to the components that actually do the work, such as sensors,
18f9a82c48SSven Van Asbroeckactuators, electric motors, console lights, switches, valves and contactors.
19f9a82c48SSven Van Asbroeck
20f9a82c48SSven Van Asbroeck(Source: Wikipedia)
21f9a82c48SSven Van Asbroeck
22f9a82c48SSven Van AsbroeckA "Fieldbus Device" is such an actuator, motor, console light, switch, ...
23f9a82c48SSven Van Asbroeckcontrolled via the Fieldbus by a PLC aka "Fieldbus Controller".
24f9a82c48SSven Van Asbroeck
25f9a82c48SSven Van AsbroeckCommunication between PLC and device typically happens via process data memory,
26f9a82c48SSven Van Asbroeckseparated into input and output areas. The Fieldbus then cyclically transfers
27f9a82c48SSven Van Asbroeckthe PLC's output area to the device's input area, and vice versa.
28f9a82c48SSven Van Asbroeck
29f9a82c48SSven Van AsbroeckPart I - Why do we need this subsystem?
30f9a82c48SSven Van Asbroeck---------------------------------------
31f9a82c48SSven Van Asbroeck
32f9a82c48SSven Van AsbroeckFieldbus device (client) adapters are commercially available. They allow data
33f9a82c48SSven Van Asbroeckexchange with a PLC aka "Fieldbus Controller" via process data memory.
34f9a82c48SSven Van Asbroeck
35f9a82c48SSven Van AsbroeckThey are typically used when a Linux device wants to expose itself as an
36f9a82c48SSven Van Asbroeckactuator, motor, console light, switch, etc. over the fieldbus.
37f9a82c48SSven Van Asbroeck
38f9a82c48SSven Van AsbroeckThe purpose of this subsystem is:
39f9a82c48SSven Van Asbroecka) present a general, standardized, extensible API/ABI to userspace; and
40f9a82c48SSven Van Asbroeckb) present a convenient interface to drivers.
41f9a82c48SSven Van Asbroeck
42f9a82c48SSven Van AsbroeckPart II - How can drivers use the subsystem?
43f9a82c48SSven Van Asbroeck--------------------------------------------
44f9a82c48SSven Van Asbroeck
45f9a82c48SSven Van AsbroeckAny driver that wants to register as a Fieldbus Device should allocate and
46f9a82c48SSven Van Asbroeckpopulate a 'struct fieldbus_dev' (from include/linux/fieldbus_dev.h).
47f9a82c48SSven Van AsbroeckRegistration then happens by calling fieldbus_dev_register().
48f9a82c48SSven Van Asbroeck
49f9a82c48SSven Van AsbroeckPart III - How can userspace use the subsystem?
50f9a82c48SSven Van Asbroeck-----------------------------------------------
51f9a82c48SSven Van Asbroeck
52f9a82c48SSven Van AsbroeckFieldbus protocols and adapters are diverse and varied. However, they share
53f9a82c48SSven Van Asbroecka limited few common behaviours and properties. This allows us to define
54f9a82c48SSven Van Asbroecka simple interface consisting of a character device and a set of sysfs files:
55f9a82c48SSven Van Asbroeck
56f9a82c48SSven Van AsbroeckSee:
57cb1aaebeSMauro Carvalho Chehabdrivers/staging/fieldbus/Documentation/ABI/sysfs-class-fieldbus-dev
58cb1aaebeSMauro Carvalho Chehabdrivers/staging/fieldbus/Documentation/ABI/fieldbus-dev-cdev
59f9a82c48SSven Van Asbroeck
60f9a82c48SSven Van AsbroeckNote that this simple interface does not provide a way to modify adapter
61f9a82c48SSven Van Asbroeckconfiguration settings. It is therefore useful only for adapters that get their
62f9a82c48SSven Van Asbroeckconfiguration settings some other way, e.g. non-volatile memory on the adapter,
63f9a82c48SSven Van Asbroeckthrough the network, ...
64f9a82c48SSven Van Asbroeck
65f9a82c48SSven Van AsbroeckAt a later phase, this simple interface can easily co-exist with a future
66f9a82c48SSven Van Asbroeck(netlink-based ?) configuration settings interface.
67