18c2ecf20Sopenharmony_ciWhat: /dev/fw[0-9]+ 28c2ecf20Sopenharmony_ciDate: May 2007 38c2ecf20Sopenharmony_ciKernelVersion: 2.6.22 48c2ecf20Sopenharmony_ciContact: linux1394-devel@lists.sourceforge.net 58c2ecf20Sopenharmony_ciDescription: 68c2ecf20Sopenharmony_ci The character device files /dev/fw* are the interface between 78c2ecf20Sopenharmony_ci firewire-core and IEEE 1394 device drivers implemented in 88c2ecf20Sopenharmony_ci userspace. The ioctl(2)- and read(2)-based ABI is defined and 98c2ecf20Sopenharmony_ci documented in <linux/firewire-cdev.h>. 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci This ABI offers most of the features which firewire-core also 128c2ecf20Sopenharmony_ci exposes to kernelspace IEEE 1394 drivers. 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci Each /dev/fw* is associated with one IEEE 1394 node, which can 158c2ecf20Sopenharmony_ci be remote or local nodes. Operations on a /dev/fw* file have 168c2ecf20Sopenharmony_ci different scope: 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci - The 1394 node which is associated with the file: 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci - Asynchronous request transmission 218c2ecf20Sopenharmony_ci - Get the Configuration ROM 228c2ecf20Sopenharmony_ci - Query node ID 238c2ecf20Sopenharmony_ci - Query maximum speed of the path between this node 248c2ecf20Sopenharmony_ci and local node 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci - The 1394 bus (i.e. "card") to which the node is attached to: 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci - Isochronous stream transmission and reception 298c2ecf20Sopenharmony_ci - Asynchronous stream transmission and reception 308c2ecf20Sopenharmony_ci - Asynchronous broadcast request transmission 318c2ecf20Sopenharmony_ci - PHY packet transmission and reception 328c2ecf20Sopenharmony_ci - Allocate, reallocate, deallocate isochronous 338c2ecf20Sopenharmony_ci resources (channels, bandwidth) at the bus's IRM 348c2ecf20Sopenharmony_ci - Query node IDs of local node, root node, IRM, bus 358c2ecf20Sopenharmony_ci manager 368c2ecf20Sopenharmony_ci - Query cycle time 378c2ecf20Sopenharmony_ci - Bus reset initiation, bus reset event reception 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci - All 1394 buses: 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci - Allocation of IEEE 1212 address ranges on the local 428c2ecf20Sopenharmony_ci link layers, reception of inbound requests to such 438c2ecf20Sopenharmony_ci an address range, asynchronous response transmission 448c2ecf20Sopenharmony_ci to inbound requests 458c2ecf20Sopenharmony_ci - Addition of descriptors or directories to the local 468c2ecf20Sopenharmony_ci nodes' Configuration ROM 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci Due to the different scope of operations and in order to let 498c2ecf20Sopenharmony_ci userland implement different access permission models, some 508c2ecf20Sopenharmony_ci operations are restricted to /dev/fw* files that are associated 518c2ecf20Sopenharmony_ci with a local node: 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci - Addition of descriptors or directories to the local 548c2ecf20Sopenharmony_ci nodes' Configuration ROM 558c2ecf20Sopenharmony_ci - PHY packet transmission and reception 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci A /dev/fw* file remains associated with one particular node 588c2ecf20Sopenharmony_ci during its entire life time. Bus topology changes, and hence 598c2ecf20Sopenharmony_ci node ID changes, are tracked by firewire-core. ABI users do not 608c2ecf20Sopenharmony_ci need to be aware of topology. 618c2ecf20Sopenharmony_ci 628c2ecf20Sopenharmony_ci The following file operations are supported: 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci open(2) 658c2ecf20Sopenharmony_ci Currently the only useful flags are O_RDWR. 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci ioctl(2) 688c2ecf20Sopenharmony_ci Initiate various actions. Some take immediate effect, others 698c2ecf20Sopenharmony_ci are performed asynchronously while or after the ioctl returns. 708c2ecf20Sopenharmony_ci See the inline documentation in <linux/firewire-cdev.h> for 718c2ecf20Sopenharmony_ci descriptions of all ioctls. 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_ci poll(2), select(2), epoll_wait(2) etc. 748c2ecf20Sopenharmony_ci Watch for events to become available to be read. 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci read(2) 778c2ecf20Sopenharmony_ci Receive various events. There are solicited events like 788c2ecf20Sopenharmony_ci outbound asynchronous transaction completion or isochronous 798c2ecf20Sopenharmony_ci buffer completion, and unsolicited events such as bus resets, 808c2ecf20Sopenharmony_ci request reception, or PHY packet reception. Always use a read 818c2ecf20Sopenharmony_ci buffer which is large enough to receive the largest event that 828c2ecf20Sopenharmony_ci could ever arrive. See <linux/firewire-cdev.h> for descriptions 838c2ecf20Sopenharmony_ci of all event types and for which ioctls affect reception of 848c2ecf20Sopenharmony_ci events. 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_ci mmap(2) 878c2ecf20Sopenharmony_ci Allocate a DMA buffer for isochronous reception or transmission 888c2ecf20Sopenharmony_ci and map it into the process address space. The arguments should 898c2ecf20Sopenharmony_ci be used as follows: addr = NULL, length = the desired buffer 908c2ecf20Sopenharmony_ci size, i.e. number of packets times size of largest packet, 918c2ecf20Sopenharmony_ci prot = at least PROT_READ for reception and at least PROT_WRITE 928c2ecf20Sopenharmony_ci for transmission, flags = MAP_SHARED, fd = the handle to the 938c2ecf20Sopenharmony_ci /dev/fw*, offset = 0. 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci Isochronous reception works in packet-per-buffer fashion except 968c2ecf20Sopenharmony_ci for multichannel reception which works in buffer-fill mode. 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci munmap(2) 998c2ecf20Sopenharmony_ci Unmap the isochronous I/O buffer from the process address space. 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci close(2) 1028c2ecf20Sopenharmony_ci Besides stopping and freeing I/O contexts that were associated 1038c2ecf20Sopenharmony_ci with the file descriptor, back out any changes to the local 1048c2ecf20Sopenharmony_ci nodes' Configuration ROM. Deallocate isochronous channels and 1058c2ecf20Sopenharmony_ci bandwidth at the IRM that were marked for kernel-assisted 1068c2ecf20Sopenharmony_ci re- and deallocation. 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ciUsers: libraw1394; 1098c2ecf20Sopenharmony_ci libdc1394; 1108c2ecf20Sopenharmony_ci libhinawa; 1118c2ecf20Sopenharmony_ci tools like linux-firewire-utils, fwhack, ... 112