xref: /linux/Documentation/ABI/stable/firewire-cdev (revision 5759139469899ea402c5953a8a38dd4f4c345b3c)
1f6a7cd02SStefan RichterWhat:		/dev/fw[0-9]+
2f6a7cd02SStefan RichterDate:		May 2007
3f6a7cd02SStefan RichterKernelVersion:	2.6.22
4f6a7cd02SStefan RichterContact:	linux1394-devel@lists.sourceforge.net
5f6a7cd02SStefan RichterDescription:
6f6a7cd02SStefan Richter		The character device files /dev/fw* are the interface between
7f6a7cd02SStefan Richter		firewire-core and IEEE 1394 device drivers implemented in
8f6a7cd02SStefan Richter		userspace.  The ioctl(2)- and read(2)-based ABI is defined and
9f6a7cd02SStefan Richter		documented in <linux/firewire-cdev.h>.
10f6a7cd02SStefan Richter
11f6a7cd02SStefan Richter		This ABI offers most of the features which firewire-core also
12f6a7cd02SStefan Richter		exposes to kernelspace IEEE 1394 drivers.
13f6a7cd02SStefan Richter
14f6a7cd02SStefan Richter		Each /dev/fw* is associated with one IEEE 1394 node, which can
15f6a7cd02SStefan Richter		be remote or local nodes.  Operations on a /dev/fw* file have
16f6a7cd02SStefan Richter		different scope:
17f6a7cd02SStefan Richter		  - The 1394 node which is associated with the file:
18f6a7cd02SStefan Richter			  - Asynchronous request transmission
19f6a7cd02SStefan Richter			  - Get the Configuration ROM
20f6a7cd02SStefan Richter			  - Query node ID
21f6a7cd02SStefan Richter			  - Query maximum speed of the path between this node
22f6a7cd02SStefan Richter			    and local node
23f6a7cd02SStefan Richter		  - The 1394 bus (i.e. "card") to which the node is attached to:
24f6a7cd02SStefan Richter			  - Isochronous stream transmission and reception
25f6a7cd02SStefan Richter			  - Asynchronous stream transmission and reception
26f6a7cd02SStefan Richter			  - Asynchronous broadcast request transmission
27f6a7cd02SStefan Richter			  - PHY packet transmission and reception
28f6a7cd02SStefan Richter			  - Allocate, reallocate, deallocate isochronous
29f6a7cd02SStefan Richter			    resources (channels, bandwidth) at the bus's IRM
30f6a7cd02SStefan Richter			  - Query node IDs of local node, root node, IRM, bus
31f6a7cd02SStefan Richter			    manager
32f6a7cd02SStefan Richter			  - Query cycle time
33f6a7cd02SStefan Richter			  - Bus reset initiation, bus reset event reception
34f6a7cd02SStefan Richter		  - All 1394 buses:
35f6a7cd02SStefan Richter			  - Allocation of IEEE 1212 address ranges on the local
36f6a7cd02SStefan Richter			    link layers, reception of inbound requests to such
37f6a7cd02SStefan Richter			    an address range, asynchronous response transmission
38f6a7cd02SStefan Richter			    to inbound requests
39f6a7cd02SStefan Richter			  - Addition of descriptors or directories to the local
40f6a7cd02SStefan Richter			    nodes' Configuration ROM
41f6a7cd02SStefan Richter
42f6a7cd02SStefan Richter		Due to the different scope of operations and in order to let
43f6a7cd02SStefan Richter		userland implement different access permission models, some
44f6a7cd02SStefan Richter		operations are restricted to /dev/fw* files that are associated
45f6a7cd02SStefan Richter		with a local node:
46f6a7cd02SStefan Richter			  - Addition of descriptors or directories to the local
47f6a7cd02SStefan Richter			    nodes' Configuration ROM
48f6a7cd02SStefan Richter			  - PHY packet transmission and reception
49f6a7cd02SStefan Richter
50f6a7cd02SStefan Richter		A /dev/fw* file remains associated with one particular node
51f6a7cd02SStefan Richter		during its entire life time.  Bus topology changes, and hence
52f6a7cd02SStefan Richter		node ID changes, are tracked by firewire-core.  ABI users do not
53f6a7cd02SStefan Richter		need to be aware of topology.
54f6a7cd02SStefan Richter
55f6a7cd02SStefan Richter		The following file operations are supported:
56f6a7cd02SStefan Richter
57f6a7cd02SStefan Richter		open(2)
58f6a7cd02SStefan Richter		Currently the only useful flags are O_RDWR.
59f6a7cd02SStefan Richter
60f6a7cd02SStefan Richter		ioctl(2)
61f6a7cd02SStefan Richter		Initiate various actions.  Some take immediate effect, others
62f6a7cd02SStefan Richter		are performed asynchronously while or after the ioctl returns.
63f6a7cd02SStefan Richter		See the inline documentation in <linux/firewire-cdev.h> for
64f6a7cd02SStefan Richter		descriptions of all ioctls.
65f6a7cd02SStefan Richter
66f6a7cd02SStefan Richter		poll(2), select(2), epoll_wait(2) etc.
67f6a7cd02SStefan Richter		Watch for events to become available to be read.
68f6a7cd02SStefan Richter
69f6a7cd02SStefan Richter		read(2)
70f6a7cd02SStefan Richter		Receive various events.  There are solicited events like
71f6a7cd02SStefan Richter		outbound asynchronous transaction completion or isochronous
72f6a7cd02SStefan Richter		buffer completion, and unsolicited events such as bus resets,
73f6a7cd02SStefan Richter		request reception, or PHY packet reception.  Always use a read
74f6a7cd02SStefan Richter		buffer which is large enough to receive the largest event that
75f6a7cd02SStefan Richter		could ever arrive.  See <linux/firewire-cdev.h> for descriptions
76f6a7cd02SStefan Richter		of all event types and for which ioctls affect reception of
77f6a7cd02SStefan Richter		events.
78f6a7cd02SStefan Richter
79f6a7cd02SStefan Richter		mmap(2)
80f6a7cd02SStefan Richter		Allocate a DMA buffer for isochronous reception or transmission
81f6a7cd02SStefan Richter		and map it into the process address space.  The arguments should
82f6a7cd02SStefan Richter		be used as follows:  addr = NULL, length = the desired buffer
83f6a7cd02SStefan Richter		size, i.e. number of packets times size of largest packet,
84f6a7cd02SStefan Richter		prot = at least PROT_READ for reception and at least PROT_WRITE
85f6a7cd02SStefan Richter		for transmission, flags = MAP_SHARED, fd = the handle to the
86f6a7cd02SStefan Richter		/dev/fw*, offset = 0.
87f6a7cd02SStefan Richter
88f6a7cd02SStefan Richter		Isochronous reception works in packet-per-buffer fashion except
89f6a7cd02SStefan Richter		for multichannel reception which works in buffer-fill mode.
90f6a7cd02SStefan Richter
91f6a7cd02SStefan Richter		munmap(2)
92f6a7cd02SStefan Richter		Unmap the isochronous I/O buffer from the process address space.
93f6a7cd02SStefan Richter
94f6a7cd02SStefan Richter		close(2)
95f6a7cd02SStefan Richter		Besides stopping and freeing I/O contexts that were associated
96f6a7cd02SStefan Richter		with the file descriptor, back out any changes to the local
97f6a7cd02SStefan Richter		nodes' Configuration ROM.  Deallocate isochronous channels and
98f6a7cd02SStefan Richter		bandwidth at the IRM that were marked for kernel-assisted
99f6a7cd02SStefan Richter		re- and deallocation.
100f6a7cd02SStefan Richter
101f6a7cd02SStefan RichterUsers:		libraw1394
102f6a7cd02SStefan Richter		libdc1394
103*57591394SStefan Richter		tools like linux-firewire-utils, fwhack, ...
104