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