162306a36Sopenharmony_ciWhat: /dev/fw[0-9]+ 262306a36Sopenharmony_ciDate: May 2007 362306a36Sopenharmony_ciKernelVersion: 2.6.22 462306a36Sopenharmony_ciContact: linux1394-devel@lists.sourceforge.net 562306a36Sopenharmony_ciDescription: 662306a36Sopenharmony_ci The character device files /dev/fw* are the interface between 762306a36Sopenharmony_ci firewire-core and IEEE 1394 device drivers implemented in 862306a36Sopenharmony_ci userspace. The ioctl(2)- and read(2)-based ABI is defined and 962306a36Sopenharmony_ci documented in <linux/firewire-cdev.h>. 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci This ABI offers most of the features which firewire-core also 1262306a36Sopenharmony_ci exposes to kernelspace IEEE 1394 drivers. 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci Each /dev/fw* is associated with one IEEE 1394 node, which can 1562306a36Sopenharmony_ci be remote or local nodes. Operations on a /dev/fw* file have 1662306a36Sopenharmony_ci different scope: 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci - The 1394 node which is associated with the file: 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci - Asynchronous request transmission 2162306a36Sopenharmony_ci - Get the Configuration ROM 2262306a36Sopenharmony_ci - Query node ID 2362306a36Sopenharmony_ci - Query maximum speed of the path between this node 2462306a36Sopenharmony_ci and local node 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_ci - The 1394 bus (i.e. "card") to which the node is attached to: 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ci - Isochronous stream transmission and reception 2962306a36Sopenharmony_ci - Asynchronous stream transmission and reception 3062306a36Sopenharmony_ci - Asynchronous broadcast request transmission 3162306a36Sopenharmony_ci - PHY packet transmission and reception 3262306a36Sopenharmony_ci - Allocate, reallocate, deallocate isochronous 3362306a36Sopenharmony_ci resources (channels, bandwidth) at the bus's IRM 3462306a36Sopenharmony_ci - Query node IDs of local node, root node, IRM, bus 3562306a36Sopenharmony_ci manager 3662306a36Sopenharmony_ci - Query cycle time 3762306a36Sopenharmony_ci - Bus reset initiation, bus reset event reception 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci - All 1394 buses: 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci - Allocation of IEEE 1212 address ranges on the local 4262306a36Sopenharmony_ci link layers, reception of inbound requests to such 4362306a36Sopenharmony_ci an address range, asynchronous response transmission 4462306a36Sopenharmony_ci to inbound requests 4562306a36Sopenharmony_ci - Addition of descriptors or directories to the local 4662306a36Sopenharmony_ci nodes' Configuration ROM 4762306a36Sopenharmony_ci 4862306a36Sopenharmony_ci Due to the different scope of operations and in order to let 4962306a36Sopenharmony_ci userland implement different access permission models, some 5062306a36Sopenharmony_ci operations are restricted to /dev/fw* files that are associated 5162306a36Sopenharmony_ci with a local node: 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_ci - Addition of descriptors or directories to the local 5462306a36Sopenharmony_ci nodes' Configuration ROM 5562306a36Sopenharmony_ci - PHY packet transmission and reception 5662306a36Sopenharmony_ci 5762306a36Sopenharmony_ci A /dev/fw* file remains associated with one particular node 5862306a36Sopenharmony_ci during its entire life time. Bus topology changes, and hence 5962306a36Sopenharmony_ci node ID changes, are tracked by firewire-core. ABI users do not 6062306a36Sopenharmony_ci need to be aware of topology. 6162306a36Sopenharmony_ci 6262306a36Sopenharmony_ci The following file operations are supported: 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci open(2) 6562306a36Sopenharmony_ci Currently the only useful flags are O_RDWR. 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_ci ioctl(2) 6862306a36Sopenharmony_ci Initiate various actions. Some take immediate effect, others 6962306a36Sopenharmony_ci are performed asynchronously while or after the ioctl returns. 7062306a36Sopenharmony_ci See the inline documentation in <linux/firewire-cdev.h> for 7162306a36Sopenharmony_ci descriptions of all ioctls. 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci poll(2), select(2), epoll_wait(2) etc. 7462306a36Sopenharmony_ci Watch for events to become available to be read. 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci read(2) 7762306a36Sopenharmony_ci Receive various events. There are solicited events like 7862306a36Sopenharmony_ci outbound asynchronous transaction completion or isochronous 7962306a36Sopenharmony_ci buffer completion, and unsolicited events such as bus resets, 8062306a36Sopenharmony_ci request reception, or PHY packet reception. Always use a read 8162306a36Sopenharmony_ci buffer which is large enough to receive the largest event that 8262306a36Sopenharmony_ci could ever arrive. See <linux/firewire-cdev.h> for descriptions 8362306a36Sopenharmony_ci of all event types and for which ioctls affect reception of 8462306a36Sopenharmony_ci events. 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci mmap(2) 8762306a36Sopenharmony_ci Allocate a DMA buffer for isochronous reception or transmission 8862306a36Sopenharmony_ci and map it into the process address space. The arguments should 8962306a36Sopenharmony_ci be used as follows: addr = NULL, length = the desired buffer 9062306a36Sopenharmony_ci size, i.e. number of packets times size of largest packet, 9162306a36Sopenharmony_ci prot = at least PROT_READ for reception and at least PROT_WRITE 9262306a36Sopenharmony_ci for transmission, flags = MAP_SHARED, fd = the handle to the 9362306a36Sopenharmony_ci /dev/fw*, offset = 0. 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_ci Isochronous reception works in packet-per-buffer fashion except 9662306a36Sopenharmony_ci for multichannel reception which works in buffer-fill mode. 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci munmap(2) 9962306a36Sopenharmony_ci Unmap the isochronous I/O buffer from the process address space. 10062306a36Sopenharmony_ci 10162306a36Sopenharmony_ci close(2) 10262306a36Sopenharmony_ci Besides stopping and freeing I/O contexts that were associated 10362306a36Sopenharmony_ci with the file descriptor, back out any changes to the local 10462306a36Sopenharmony_ci nodes' Configuration ROM. Deallocate isochronous channels and 10562306a36Sopenharmony_ci bandwidth at the IRM that were marked for kernel-assisted 10662306a36Sopenharmony_ci re- and deallocation. 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ciUsers: libraw1394; 10962306a36Sopenharmony_ci libdc1394; 11062306a36Sopenharmony_ci libhinawa; 11162306a36Sopenharmony_ci tools like linux-firewire-utils, fwhack, ... 112