← Documents Documentation/ABI/stable/firewire-cdev GitHub 원문 ↗

Linux 6.18.37 · ABI / stable

FireWire character device ABI

/dev/fw*를 통한 IEEE 1394 node·bus·전체 bus 범위의 동작과 ioctl, event read, isochronous DMA mmap lifecycle을 설명합니다.

Source pathDocumentation/ABI/stable/firewire-cdev
Source versionLinux v6.18.37
TranslationDUJINLABS 전문 번역 + 해설

요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.

1. 요약·해설

원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.

동작 범위와 local node 제한

firewire-cdev:1-60

하나의 /dev/fw*는 수명 전체에 걸쳐 특정 IEEE 1394 node와 연결되며 topology와 node ID 변화는 firewire-core가 추적합니다.

File operation과 event

firewire-cdev:62-106

open, ioctl, poll 계열, read, mmap, munmap, close가 비동기 transaction과 isochronous I/O context를 관리합니다.

사용 library와 tool

firewire-cdev:108-111

libraw1394, libdc1394, libhinawa와 linux-firewire-utils, fwhack 등이 이 ABI를 사용합니다.

2. 영어 원문 전체

번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.

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

3. 한국어 전문 번역

영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.

/dev/fw*와 firewire-core

1-16
항목
What/dev/fw[0-9]+
Date2007년 5월
KernelVersion2.6.22
Contact[email protected]

/dev/fw* character device file은 firewire-core와 user space에 구현된 IEEE 1394 device driver 사이의 interface다. ioctl(2)과 read(2)에 기반한 ABI는 <linux/firewire-cdev.h>에 정의되고 문서화돼 있다.

이 ABI는 firewire-core가 kernel space IEEE 1394 driver에 제공하는 기능 대부분을 user space에도 제공한다. 각 /dev/fw*는 remote 또는 local IEEE 1394 node 하나와 연결되며, operation마다 적용 범위가 다르다.

동작이 적용되는 범위

18-60
범위제공 기능
파일과 연결된 1394 nodeAsynchronous request 전송, Configuration ROM 조회, node ID 조회, 이 node와 local node 사이 path의 최대 속도 조회
node가 연결된 1394 bus(card)Isochronous stream 송수신, asynchronous stream 송수신, asynchronous broadcast request 전송, PHY packet 송수신, bus IRM에서 isochronous channel·bandwidth 할당·재할당·해제, local/root/IRM/bus manager node ID 조회, cycle time 조회, bus reset 시작과 bus reset event 수신
모든 1394 busLocal link layer의 IEEE 1212 address range 할당, 해당 range로 들어온 request 수신과 asynchronous response 전송, local node Configuration ROM에 descriptor 또는 directory 추가

Operation의 범위가 서로 다르고 userland가 다양한 access permission model을 구현할 수 있어, 일부 operation은 local node와 연결된 /dev/fw*에서만 허용한다. 여기에 local node Configuration ROM의 descriptor·directory 추가와 PHY packet 송수신이 포함된다.

/dev/fw* file은 수명 전체에 걸쳐 특정 node 하나와 연결된 상태를 유지한다. Bus topology가 변하면 node ID도 바뀔 수 있지만 firewire-core가 이를 추적하므로 ABI 사용자는 topology를 직접 인식할 필요가 없다.

지원하는 file operation

62-106
operation동작
open(2)현재 유용한 flag는 O_RDWR뿐이다.
ioctl(2)여러 동작을 시작한다. 즉시 효력이 생기는 동작도 있고 ioctl이 반환되는 동안 또는 반환된 뒤 비동기로 수행되는 동작도 있다. 모든 ioctl 설명은 <linux/firewire-cdev.h>의 inline documentation을 참조한다.
poll(2), select(2), epoll_wait(2) 등read할 event가 준비되는지 감시한다.
read(2)여러 event를 수신한다. Outbound asynchronous transaction 완료와 isochronous buffer 완료처럼 요청에 따른 event, bus reset·request 수신·PHY packet 수신처럼 요청하지 않은 event가 있다.
mmap(2)Isochronous 수신 또는 전송용 DMA buffer를 할당하고 process address space에 mapping한다.
munmap(2)Isochronous I/O buffer를 process address space에서 unmap한다.
close(2)file descriptor와 연결된 I/O context를 중단·해제하고 local node Configuration ROM의 변경을 되돌린다. Kernel-assisted 재할당·해제로 표시된 isochronous channel과 bandwidth도 IRM에서 해제한다.

read(2) buffer는 도착할 가능성이 있는 가장 큰 event 전체를 받을 수 있을 만큼 항상 커야 한다. Event type과 event 수신에 영향을 주는 ioctl은 <linux/firewire-cdev.h>에 설명돼 있다.

mmap(2) argument

argument요구 값
addrNULL
length원하는 buffer 크기, 즉 packet 수와 최대 packet 크기의 곱
prot수신에는 적어도 PROT_READ, 전송에는 적어도 PROT_WRITE
flagsMAP_SHARED
fd/dev/fw*의 handle
offset0

Isochronous 수신은 packet-per-buffer 방식으로 동작한다. 단, multichannel 수신은 buffer-fill mode로 동작한다.

ABI 사용자

108-111
  • libraw1394
  • libdc1394
  • libhinawa
  • linux-firewire-utils, fwhack 등의 tool