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