요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
File operation과 event
firewire-cdev:62-106open, ioctl, poll 계열, read, mmap, munmap, close가 비동기 transaction과 isochronous I/O context를 관리합니다.
사용 library와 tool
firewire-cdev:108-111libraw1394, libdc1394, libhinawa와 linux-firewire-utils, fwhack 등이 이 ABI를 사용합니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
What: /dev/fw[0-9]+
Date: May 2007
KernelVersion: 2.6.22
Contact: linux1394-devel@lists.sourceforge.net
Description:
The character device files /dev/fw* are the interface between
firewire-core and IEEE 1394 device drivers implemented in
userspace. The ioctl(2)- and read(2)-based ABI is defined and
documented in <linux/firewire-cdev.h>.
This ABI offers most of the features which firewire-core also
exposes to kernelspace IEEE 1394 drivers.
Each /dev/fw* is associated with one IEEE 1394 node, which can
be remote or local nodes. Operations on a /dev/fw* file have
different scope:
- The 1394 node which is associated with the file:
- Asynchronous request transmission
- Get the Configuration ROM
- Query node ID
- Query maximum speed of the path between this node
and local node
- The 1394 bus (i.e. "card") to which the node is attached to:
- Isochronous stream transmission and reception
- Asynchronous stream transmission and reception
- Asynchronous broadcast request transmission
- PHY packet transmission and reception
- Allocate, reallocate, deallocate isochronous
resources (channels, bandwidth) at the bus's IRM
- Query node IDs of local node, root node, IRM, bus
manager
- Query cycle time
- Bus reset initiation, bus reset event reception
- All 1394 buses:
- Allocation of IEEE 1212 address ranges on the local
link layers, reception of inbound requests to such
an address range, asynchronous response transmission
to inbound requests
- Addition of descriptors or directories to the local
nodes' Configuration ROM
Due to the different scope of operations and in order to let
userland implement different access permission models, some
operations are restricted to /dev/fw* files that are associated
with a local node:
- Addition of descriptors or directories to the local
nodes' Configuration ROM
- PHY packet transmission and reception
A /dev/fw* file remains associated with one particular node
during its entire life time. Bus topology changes, and hence
node ID changes, are tracked by firewire-core. ABI users do not
need to be aware of topology.
The following file operations are supported:
open(2)
Currently the only useful flags are O_RDWR.
ioctl(2)
Initiate various actions. Some take immediate effect, others
are performed asynchronously while or after the ioctl returns.
See the inline documentation in <linux/firewire-cdev.h> for
descriptions of all ioctls.
poll(2), select(2), epoll_wait(2) etc.
Watch for events to become available to be read.
read(2)
Receive various events. There are solicited events like
outbound asynchronous transaction completion or isochronous
buffer completion, and unsolicited events such as bus resets,
request reception, or PHY packet reception. Always use a read
buffer which is large enough to receive the largest event that
could ever arrive. See <linux/firewire-cdev.h> for descriptions
of all event types and for which ioctls affect reception of
events.
mmap(2)
Allocate a DMA buffer for isochronous reception or transmission
and map it into the process address space. The arguments should
be used as follows: addr = NULL, length = the desired buffer
size, i.e. number of packets times size of largest packet,
prot = at least PROT_READ for reception and at least PROT_WRITE
for transmission, flags = MAP_SHARED, fd = the handle to the
/dev/fw*, offset = 0.
Isochronous reception works in packet-per-buffer fashion except
for multichannel reception which works in buffer-fill mode.
munmap(2)
Unmap the isochronous I/O buffer from the process address space.
close(2)
Besides stopping and freeing I/O contexts that were associated
with the file descriptor, back out any changes to the local
nodes' Configuration ROM. Deallocate isochronous channels and
bandwidth at the IRM that were marked for kernel-assisted
re- and deallocation.
Users: libraw1394;
libdc1394;
libhinawa;
tools like linux-firewire-utils, fwhack, ...
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
/dev/fw*와 firewire-core
1-16| 항목 | 값 |
|---|---|
| What | /dev/fw[0-9]+ |
| Date | 2007년 5월 |
| KernelVersion | 2.6.22 |
| Contact | linux1394-devel@lists.sourceforge.net |
/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 node | Asynchronous 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 bus | Local 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 | 요구 값 |
|---|---|
| addr | NULL |
| length | 원하는 buffer 크기, 즉 packet 수와 최대 packet 크기의 곱 |
| prot | 수신에는 적어도 PROT_READ, 전송에는 적어도 PROT_WRITE |
| flags | MAP_SHARED |
| fd | /dev/fw*의 handle |
| offset | 0 |
Isochronous 수신은 packet-per-buffer 방식으로 동작한다. 단, multichannel 수신은 buffer-fill mode로 동작한다.
ABI 사용자
108-111- libraw1394
- libdc1394
- libhinawa
- linux-firewire-utils, fwhack 등의 tool
동작 범위와 local node 제한
firewire-cdev:1-60하나의 /dev/fw*는 수명 전체에 걸쳐 특정 IEEE 1394 node와 연결되며 topology와 node ID 변화는 firewire-core가 추적합니다.