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