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