1 '\" te
   2 .\" Copyright (c) 2009, Sun Microsystems, Inc. All Rights Reserved
   3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
   4 .\"  See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the
   5 .\" fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
   6 .TH IEC61883 7I "Mar 27, 2009"
   7 .SH NAME
   8 iec61883 \- IEC 61883 interfaces
   9 .SH SYNOPSIS
  10 .LP
  11 .nf
  12 #include <sys/av/iec61883.h>
  13 .fi
  14 
  15 .SH DESCRIPTION
  16 .sp
  17 .LP
  18 The set of interfaces described in this man page can be used to control and
  19 exchange data with consumer audio/video devices using protocols specified
  20 in\fIIEC 61883 Consumer Electronic Audio/Video Equipment - Digital
  21 Interface\fR, including Common Isochronous Packet (CIP), Connection Management
  22 Procedures (CMP) and Function Control Protocol (FCP).
  23 .sp
  24 .LP
  25 An \fBiec61883\fR compliant driver exports two device nodes for isochronous and
  26 for asynchronous transactions. See the \fBFILES\fR section of this man page for
  27 the namespace definition.
  28 .SS "Isochronous Transfers"
  29 .sp
  30 .LP
  31 Two methods are provided to receive/transmit isochronous data: using
  32 \fBmmap\fR(2) in combination with \fBioctl\fR(2), and \fBread\fR(2) or
  33 \fBwrite\fR(2).
  34 .SS "Mmap/Ioctl"
  35 .sp
  36 .LP
  37 This method provides better performance and finer-grained control than
  38 read/write, and is a method of choice for most applications. The data buffer is
  39 mapped into a user process address space, which means no data copying between
  40 the kernel and an application is necessary. Synchronization between user
  41 processes and the driver is performed using \fBioctl\fR(2) commands.
  42 .sp
  43 .LP
  44 An application allocates resources for isochronous transfer using
  45 \fBIEC61883_ISOCH_INIT\fR. Then the data buffer can be mapped into the process
  46 space using \fBmmap\fR(2).
  47 .sp
  48 .LP
  49 A circular data buffer consists of one or more equal size frame buffers
  50 (further referred to as frames, unless to avoid ambiguity with AV frames).
  51 Frames are numbered starting with zero and are always transferred sequentially.
  52 Frames consist equal sized packets. Each packet contains a CIP header and one
  53 or more data blocks.
  54 .sp
  55 .LP
  56 A driver and an application act as a producer and a consumer: producer supplies
  57 \fBfull\fR frames (filled with data) to the consumer, and the producer is not
  58 allowed to access those frames until the consumer claims them \fBempty\fR.
  59 .sp
  60 .LP
  61 A transfer can be initiated and suspended with \fBIEC61883_START\fR and
  62 \fBIEC61883_STOP\fR commands respectively. \fBIEC61883_RECV\fR or
  63 \fBIEC61883_XMIT\fR is used for producer-consumer synchronization.
  64 .SS "Read/Write"
  65 .sp
  66 .LP
  67 Using this method, an application calls \fBread\fR(2) or \fBwrite\fR(2) to
  68 receive or transmit a specified amount of data. Bus-specific overhead, such as
  69 isochronous packet headers, is handled by the driver and is not exposed to
  70 applications. Data returned by \fBread\fR(2) contains CIP headers and data
  71 blocks. Empty packets are not returned by \fBread\fR(2). \fBwrite\fR(2) data
  72 should meet the same requirements.
  73 .sp
  74 .LP
  75 If one or more channels have been allocated since \fBopen\fR(2) (see
  76 \fBIEC61883_ISOCH_INIT\fR), the data is received/transmitted using channel that
  77 was created the last.
  78 .sp
  79 .LP
  80 If no channels were allocated, the driver uses the broadcast channel by default
  81 and allocates the default-size data buffer. During transmit, the first packet's
  82 CIP header is used to auto-detect the data format. If it is one of the formats
  83 supported by the driver, it is properly transmitted (with inserted empty
  84 packets and timestamps).
  85 .sp
  86 .LP
  87 For both methods, if during transmit the driver runs out of data, it transmits
  88 empty packets containing only a CIP header of the next to be transmitted
  89 packet, as defined in \fIIEC 61883-1\fR.
  90 .SS "Connection Management Procedures"
  91 .sp
  92 .LP
  93 Applications wishing to follow Connection Management Procedures (CMP) in
  94 combination with isochronous transfers should use the \fBioctl\fR(2)
  95 \fBIEC61883_PLUG_INIT, IEC61883_PLUG_FINI, IEC61883_PLUG_REG_READ\fR and
  96 \fBIEC61883_PLUG_REG_CAS\fR commands.
  97 .SS "Asynchronous Transactions"
  98 .sp
  99 .LP
 100 \fBread\fR(2), \fBwrite\fR(2), \fBioctl\fR(2), and \fBpoll\fR(2) can be used
 101 with asynchronous nodes. Asynchronous data exchange between a driver and an
 102 application utilizes a common data structure called asynchronous request (ARQ):
 103 .sp
 104 .in +2
 105 .nf
 106 typedef struct iec61883_arq {
 107         int        arq_type;
 108         int        arq_len;
 109         union {
 110                 uint32_t   quadlet;
 111                 uint64_t   octlet;
 112                 uint8_t    buf[8];
 113         } arq_data;
 114 } iec61883_arq_t;
 115 .fi
 116 .in -2
 117 .sp
 118 
 119 .sp
 120 .LP
 121 \fBarq_type\fR contains \fBARQ\fR type:
 122 .sp
 123 .ne 2
 124 .na
 125 \fB\fBIEC61883_ARQ_FCP_CMD\fR\fR
 126 .ad
 127 .br
 128 .na
 129 \fB\fBIEC61883_ARQ_FCP_RESP\fR\fR
 130 .ad
 131 .sp .6
 132 .RS 4n
 133 \fBFCP\fR command and response frame respectively. Outgoing frames are sent
 134 using \fBwrite\fR(2), incoming frames are received with \fBread\fR(2).
 135 .sp
 136 See \fIIEC 61883-1\fR for the FCP frame structure definition.
 137 .RE
 138 
 139 .sp
 140 .ne 2
 141 .na
 142 \fB\fBIEC61883_ARQ_BUS_RESET\fR\fR
 143 .ad
 144 .sp .6
 145 .RS 4n
 146 Returned by the driver when a bus reset occurs. There is no data associated
 147 with this request type, and \fBarq_len\fR is set to 0.
 148 .RE
 149 
 150 .sp
 151 .LP
 152 If \fBarq_len\fR is 4 or 8, then data should be supplied in
 153 \fBarq_data.quadlet\fR or \fBarq_data.octlet\fR respectively, otherwise up to 8
 154 bytes can be put in \fBarq_data.buf\fR, with the rest of the data following
 155 immediately after.
 156 .SS "write(2)"
 157 .sp
 158 .LP
 159 For a request to be sent to a target, an \fBiec61883_arq_t\fR structure along
 160 with associated data is passed to the driver using \fBwrite\fR(2).
 161 \fBwrite()\fR blocks until the request is completed.
 162 .SS "read(2)"
 163 .sp
 164 .LP
 165 A driver collects incoming ARQs in the internal buffer. Buffer size can be
 166 changed using the \fBioctl\fR(2) command \fBIEC61883_FCP_SET_IBUF_SIZE\fR.
 167 .sp
 168 .LP
 169 Reading an ARQ takes one or two steps depending on data length. An application
 170 first reads \fBsizeof (iec61883_arq_t)\fR bytes: if \fBarq_len\fR is less than
 171 or equal 4, which is usually the case, no additional step is needed. Otherwise,
 172 the remaining \fBarq_len - 4\fR bytes should be read and concatenated.
 173 .sp
 174 .LP
 175 \fBread\fR(2) blocks until the specified amount of data is available, unless
 176 \fBO_NONBLOCK\fR or \fBO_NDELAY\fR flag was set during \fBopen\fR(2), in which
 177 case \fBread\fR(2) returns immediately.
 178 .SS "poll(2)"
 179 .sp
 180 .LP
 181 Applications can \fBpoll\fR(2) asynchronous nodes on the \fBPOLLIN\fR event.
 182 .SS "Bus Reset"
 183 .sp
 184 .LP
 185 In case of a bus reset, the driver notifies an application by generating an
 186 \fBARQ\fR of type \fBIEC61883_ARQ_BUS_RESET\fR.
 187 .sp
 188 .LP
 189 If there were established isochronous connections before bus reset, the driver
 190 attempts to restore all connections as described in \fIIEC 61883\fR and resume
 191 any active transfers that were in progress.
 192 .SH IOCTLS
 193 .sp
 194 .LP
 195 The following commands only apply to isochronous nodes:
 196 .sp
 197 .ne 2
 198 .na
 199 \fB\fBIEC61883_ISOCH_INIT\fR\fR
 200 .ad
 201 .sp .6
 202 .RS 4n
 203 This command allocates a data buffer and isochronous resources (if necessary)
 204 for the isochronous transfer. The argument is a pointer to the structure:
 205 .sp
 206 .in +2
 207 .nf
 208 typedef struct iec61883_isoch_init {
 209       int ii_version;       /* interface version */
 210       int   ii_pkt_size;    /* packet size */
 211       int   ii_frame_size;  /* packets/frame */
 212       int   ii_frame_cnt;   /* # of frames */
 213       int   ii_direction;   /* xfer direction */
 214       int   ii_bus_speed;   /* bus speed */
 215       uint64_t ii_channel;  /* channel mask */
 216       int   ii_dbs;         /* DBS */
 217       int   ii_fn;          /* FN */
 218       int   ii_rate_n;      /* rate numerator */
 219       int   ii_rate_d;      /* rate denominator */
 220       int   ii_ts_mode;     /* timestamp mode */
 221       int   ii_flags;       /* flags */
 222       int   ii_handle;      /* isoch handle */
 223       int   ii_frame_rcnt;  /* # of frames */
 224       off_t   *ii_mmap_off  /* mmap offset */
 225       int   ii_rchannel;    /* channel */
 226       int   ii_error;       /* error code */
 227 } iec61883_isoch_init_t;
 228 .fi
 229 .in -2
 230 .sp
 231 
 232 \fBii_version\fR should be set to \fBIEC61883_V1_0\fR.
 233 .sp
 234 The driver attempts to allocate a data buffer consisting of \fBii_frame_cnt\fR
 235 frames, with \fBii_frame_size\fR packets in each frame. Packet size in bytes is
 236 specified by \fBii_pkt_size\fR specifies and should be a multiple of 512 and
 237 compatible with \fBii_bus_speed\fR.
 238 .sp
 239 \fBii_direction\fR can take one of the following values:
 240 .sp
 241 .ne 2
 242 .na
 243 \fB\fBIEC61883_DIR_RECV\fR\fR
 244 .ad
 245 .sp .6
 246 .RS 4n
 247 Receiving isochronous data.
 248 .RE
 249 
 250 .sp
 251 .ne 2
 252 .na
 253 \fB\fBIEC61883_DIR_XMIT\fR\fR
 254 .ad
 255 .sp .6
 256 .RS 4n
 257 Transmitting isochronous data.
 258 .RE
 259 
 260 \fBii_bus_speed\fR chooses bus speed to be used and can be either
 261 \fBIEC61883_S100, IEC61883_S200\fR or \fBIEC61883_S400\fR.
 262 .sp
 263 \fBii_channel\fR is a mask that specifies an isochronous channel number to be
 264 used, with the \fIN\fRth bit representing channel \fIN\fR. When transmitting
 265 data, several bits can be set at a time, in which case the driver chooses one,
 266 for example, \fB0x3FF\fR means a range from 0 to 9. In case of receive, only
 267 one bit can be set.
 268 .sp
 269 \fBii_dbs\fR specifies data block size in quadlets, for example, DBS value for
 270 \fBSD-DVCR\fR is \fB0x78\fR. Refer to \fIIEC 61883\fR for more details on DBS.
 271 .sp
 272 ii_fn specifies fraction number, which defines the number of blocks in which a
 273 source packet is divided. Allowed values are from 0 to 3. Refer to IEC 61883
 274 for more details on FN.
 275 .sp
 276 Data rate expected by the AV device can be lower than the bus speed, in which
 277 case the driver has to periodically insert empty packets into the data stream
 278 to avoid device buffer overflows. This rate is specified with a fraction N/D,
 279 set by \fBii_rate_n\fR and \fBii_rate_d\fR respectively. Any integer numbers
 280 can be used, or the following predefined constants:
 281 .sp
 282 .ne 2
 283 .na
 284 \fB\fBIEC61883_RATE_N_DV_NTSC IEC61883_RATE_D_DV_NTSC\fR\fR
 285 .ad
 286 .sp .6
 287 .RS 4n
 288 Data rate expected by \fBDV-NTSC\fR devices.
 289 .RE
 290 
 291 .sp
 292 .ne 2
 293 .na
 294 \fB\fBIEC61883_RATE_N_DV_PAL IEC61883_RATE_D_DV_PAL\fR\fR
 295 .ad
 296 .sp .6
 297 .RS 4n
 298 Data rate expected by \fBDV-PAL\fR devices.
 299 .RE
 300 
 301 During data transmission, a timestamp based on the current value of the cycle
 302 timer is usually required. \fBii_ts_mode\fR defines timestamp mode to be used:
 303 .sp
 304 .ne 2
 305 .na
 306 \fB\fBIEC61883_TS_SYT\fR\fR
 307 .ad
 308 .sp .6
 309 .RS 4n
 310 Driver puts a timestamp in the SYT field of the first CIP header of each frame.
 311 .RE
 312 
 313 .sp
 314 .ne 2
 315 .na
 316 \fB\fBIEC61883_TS_NONE\fR\fR
 317 .ad
 318 .sp .6
 319 .RS 4n
 320 No timestamps.
 321 .RE
 322 
 323 \fBii_dbs, ii_fn, ii_rate_n, ii_rate_d\fR and \fBii_ts_mode\fR are only
 324 required for transmission. In other case these should be set to 0.
 325 .sp
 326 \fBii_flags\fR should be set to 0.
 327 .sp
 328 If command succeeds, \fBii_handle\fR contains a handle that should be used with
 329 other isochronous commands. \fBii_frame_rcnt\fR contains the number of
 330 allocated frames (can be less than \fBii_frame_cnt\fR). \fBii_mmap_off\fR
 331 contains an offset to be used in \fBmmap\fR(2), for example, to map an entire
 332 data receive buffer:
 333 .sp
 334 .in +2
 335 .nf
 336 pa = mmap(NULL, init.ii_pkt_size *
 337       init.ii_frame_size * init.ii_frame_rcnt,
 338       PROT_READ, MAP_PRIVATE, fd, init.ii_mmap_off);
 339 .fi
 340 .in -2
 341 .sp
 342 
 343 \fBii_rchannel\fR contains channel number.
 344 .sp
 345 In case of command success, \fBii_error\fR is set to 0; otherwise one of the
 346 following values can be returned:
 347 .sp
 348 .ne 2
 349 .na
 350 \fB\fBIEC61883_ERR_NOMEM\fR\fR
 351 .ad
 352 .sp .6
 353 .RS 4n
 354 Not enough memory for the data buffer.
 355 .RE
 356 
 357 .sp
 358 .ne 2
 359 .na
 360 \fB\fBIEC61883_ERR_NOCHANNEL\fR\fR
 361 .ad
 362 .sp .6
 363 .RS 4n
 364 Cannot allocate isochronous channel.
 365 .RE
 366 
 367 .sp
 368 .ne 2
 369 .na
 370 \fB\fBIEC61883_ERR_PKT_SIZE\fR\fR
 371 .ad
 372 .sp .6
 373 .RS 4n
 374 Packet size is not allowed at this bus speed.
 375 .RE
 376 
 377 .sp
 378 .ne 2
 379 .na
 380 \fB\fBIEC61883_ERR_VERSION\fR\fR
 381 .ad
 382 .sp .6
 383 .RS 4n
 384 Interface version is not supported.
 385 .RE
 386 
 387 .sp
 388 .ne 2
 389 .na
 390 \fB\fBIEC61883_ERR_INVAL\fR\fR
 391 .ad
 392 .sp .6
 393 .RS 4n
 394 One or more the parameters are invalid
 395 .RE
 396 
 397 .sp
 398 .ne 2
 399 .na
 400 \fB\fBIEC61883_ERR_OTHER\fR\fR
 401 .ad
 402 .sp .6
 403 .RS 4n
 404 Unspecified error type.
 405 .RE
 406 
 407 .RE
 408 
 409 .sp
 410 .ne 2
 411 .na
 412 \fB\fBIEC61883_ISOCH_FINI\fR\fR
 413 .ad
 414 .sp .6
 415 .RS 4n
 416 Argument is a handle returned by \fBIEC61883_ISOCH_INIT\fR. This command frees
 417 any resources associated with this handle. There must be no active transfers
 418 and the data buffer must be unmapped; otherwise the command fails.
 419 .RE
 420 
 421 .sp
 422 .ne 2
 423 .na
 424 \fB\fBIEC61883_START\fR\fR
 425 .ad
 426 .sp .6
 427 .RS 4n
 428 This command starts an isochronous transfer. The argument is a handle returned
 429 by \fBIEC61883_ISOCH_INIT\fR.
 430 .RE
 431 
 432 .sp
 433 .ne 2
 434 .na
 435 \fB\fBIEC61883_STOP\fR\fR
 436 .ad
 437 .sp .6
 438 .RS 4n
 439 This command stops an isochronous transfer. The argument is a handle returned
 440 by \fBIEC61883_ISOCH_INIT\fR.
 441 .RE
 442 
 443 .sp
 444 .ne 2
 445 .na
 446 \fB\fBIEC61883_RECV\fR\fR
 447 .ad
 448 .sp .6
 449 .RS 4n
 450 This command is used to receive full frames and return empty frames to the
 451 driver. The argument is a pointer to the structure:
 452 .sp
 453 .in +2
 454 .nf
 455 typedef struct iec61883_recv {
 456         int rx_handle;     /* isoch handle */
 457         int rx_flags;      /* flags */
 458 iec61883_xfer_t rx_xfer;   /* xfer params */
 459 } iec61883_recv_t;
 460 
 461 typedef struct iec61883_xfer {
 462         int   xf_empty_idx; /* first empty frame */
 463         int xf_empty_cnt;   /* empty frame count */
 464         int   xf_full_idx;  /* first full frame */
 465         int   xf_full_cnt;  /* full frame count */
 466         int   xf_error;     /* error */
 467 } iec61883_xfer_t;
 468 .fi
 469 .in -2
 470 .sp
 471 
 472 \fBrx_flags\fR should be set to 0.
 473 .sp
 474 An application sets \fBxf_empty_idx\fR and \fBxf_empty_cnt\fR to indicate
 475 frames it no longer needs. E.g. if a buffer consists of 6 frames,
 476 \fBxf_empty_idx\fR is 4, \fBxf_empty_cnt\fR is 3 - means that frames 4, 5 and 0
 477 can now be reused by the driver. If there are no empty frames, for example, the
 478 first time this command is called, \fBxf_empty_cnt\fR should be set to 0.
 479 .sp
 480 When the command returns, \fBxf_full_idx\fR and \fBxf_full_cnt\fR specifies the
 481 frames that are full. \fBxf_error\fR is always 0.
 482 .sp
 483 In general, AV frame boundaries are not aligned with the frame buffer
 484 boundaries, because the first received packet might not be the first packet of
 485 an AV frame, and, in contrast with the read/write method, the driver does not
 486 remove empty CIP packets.
 487 .sp
 488 Applications should detect empty packets by comparing adjacent packets'
 489 continuity counters (DBC field of the CIP header).
 490 .RE
 491 
 492 .sp
 493 .ne 2
 494 .na
 495 \fB\fBIEC61883_XMIT\fR\fR
 496 .ad
 497 .sp .6
 498 .RS 4n
 499 This command is used to transmit full frames and get more empty frames from the
 500 driver. The argument is a pointer to the structure:
 501 .sp
 502 .in +2
 503 .nf
 504 typedef struct iec61883_xmit {
 505         int   tx_handle;         /* isoch handle */
 506         int   tx_flags;          /* flags */
 507         iec61883_xfer_t tx_xfer; /* xfer params */
 508         int   tx_miss_cnt;       /* missed cycles */
 509  } iec61883_xmit_t;
 510 .fi
 511 .in -2
 512 .sp
 513 
 514 \fBtx_flags\fR should be set to zero.
 515 .sp
 516 The application sets \fBxf_full_idx\fR and \fBxf_full_cnt\fR to specify frames
 517 it wishes to transmit. If there are no frames to transmit (e.g. the first time
 518 this command is called), \fBxf_full_cnt\fR should be set to 0.
 519 .sp
 520 When the command returns, \fBxf_empty_idx\fR and \fBxf_empty_cnt\fR specifies
 521 empty frames which can be to transmit more data. \fBxf_error\fR is always 0.
 522 .sp
 523 \fBtx_miss_cnt\fR contains the number of isochronous cycles missed since last
 524 transfer due to data buffer under run. This can happen when an application does
 525 not supply data fast enough.
 526 .sp
 527 For the purposes of time stamping, the driver considers the first packet in a
 528 frame buffer to be the first packet of an AV frame.
 529 .RE
 530 
 531 .sp
 532 .ne 2
 533 .na
 534 \fB\fBIEC61883_PLUG_INIT\fR\fR
 535 .ad
 536 .sp .6
 537 .RS 4n
 538 This command returns a handle for the specified plug. The argument is a pointer
 539 to the structure:
 540 .sp
 541 .in +2
 542 .nf
 543 typedef struct iec61883_plug_init {
 544         int   pi_ver;     /* interface version */
 545         int   pi_loc;     /* plug location */
 546         int   pi_type;    /* plug type */
 547         int   pi_num;     /* plug number */
 548         int   pi_flags;   /* flags */
 549         int   pi_handle;  /* plug handle */
 550         int   pi_rnum;    /* plug number */
 551  } iec61883_plug_init_t;
 552 .fi
 553 .in -2
 554 .sp
 555 
 556 \fBpi_ver\fR should be set to \fBIEC61883_V1_0\fR.
 557 .sp
 558 \fBpi_loc\fR specifies plug location:
 559 .sp
 560 .ne 2
 561 .na
 562 \fB\fBIEC61883_LOC_LOCAL\fR\fR
 563 .ad
 564 .sp .6
 565 .RS 4n
 566 On the local unit (local plug). A plug control register (PCR) is allocated.
 567 Command fails if the plug already exists
 568 .RE
 569 
 570 .sp
 571 .ne 2
 572 .na
 573 \fB\fBIEC61883_LOC_REMOTE\fR\fR
 574 .ad
 575 .sp .6
 576 .RS 4n
 577 On the remote unit (remote plug). The plug should exist on the remote unit,
 578 otherwise the command fails.
 579 .RE
 580 
 581 \fBpi_type\fR specifies isochronous plug type:
 582 .sp
 583 .ne 2
 584 .na
 585 \fB\fBIEC61883_PLUG_IN IEC61883_PLUG_OUT\fR\fR
 586 .ad
 587 .sp .6
 588 .RS 4n
 589 Input or output plugs.
 590 .RE
 591 
 592 .sp
 593 .ne 2
 594 .na
 595 \fB\fBIEC61883_PLUG_MASTER_IN IEC61883_PLUG_MASTER_OUT\fR\fR
 596 .ad
 597 .sp .6
 598 .RS 4n
 599 Master input or master output plug. These plugs always exist on the local unit.
 600 .RE
 601 
 602 \fBpi_num\fR specifies plug number. This should be 0 for master plugs, and from
 603 0 to 31 for input/output plugs. Alternatively, a special value
 604 \fBIEC61883_PLUG_ANY\fR can be used to let the driver choose a free plug
 605 number, create the plug and return the number in \fBpi_rnum\fR.
 606 .sp
 607 \fBpi_flags\fR should be set to 0.
 608 .sp
 609 If the command succeeds, \fBpi_handle\fR contains a handle that should be used
 610 with other plug commands.
 611 .RE
 612 
 613 .sp
 614 .ne 2
 615 .na
 616 \fB\fBIEC61883_PLUG_FINI\fR\fR
 617 .ad
 618 .sp .6
 619 .RS 4n
 620 Argument is a handle returned by \fBIEC61883_PLUG_INIT\fR. This command frees
 621 any resources associated with this handle, including the PCR.
 622 .RE
 623 
 624 .sp
 625 .ne 2
 626 .na
 627 \fB\fBIEC61883_PLUG_REG_READ\fR\fR
 628 .ad
 629 .sp .6
 630 .RS 4n
 631 Read plug register value. The argument is a pointer to the structure:
 632 .sp
 633 .in +2
 634 .nf
 635 typedef struct iec61883_plug_reg_val {
 636         int         pr_handle; /* plug handle */
 637         uint32_t     pr_val;    /* register value */
 638 } iec61883_plug_reg_val_t;
 639 .fi
 640 .in -2
 641 .sp
 642 
 643 \fBpr_handle\fR is a handle returned by \fBIEC61883_PLUG_INIT\fR. Register
 644 value is returned in \fBpr_val\fR.
 645 .RE
 646 
 647 .sp
 648 .ne 2
 649 .na
 650 \fB\fBIEC61883_PLUG_REG_CAS\fR\fR
 651 .ad
 652 .sp .6
 653 .RS 4n
 654 Atomically compare and swap plug register value. The argument is a pointer to
 655 the structure:
 656 .sp
 657 .in +2
 658 .nf
 659 typedef struct iec61883_plug_reg_lock {
 660         int        pl_handle; /* plug handle */
 661         uint32_t   pl_arg;    /* compare arg */
 662         uint32_t   pl_data;   /* write value */
 663         UINT32_t   pl_old;    /* original value */
 664 } iec61883_plug_reg_lock_t;
 665 .fi
 666 .in -2
 667 .sp
 668 
 669 pr_handle is a handle returned by IEC61883_PLUG_INIT.
 670 .sp
 671 Original register value is compared with pl_arg and if they are equal, register
 672 value is replaced with pl_data. In any case, the original value is stored in
 673 pl_old.
 674 .RE
 675 
 676 .sp
 677 .LP
 678 The following commands only apply to asynchronous nodes:
 679 .sp
 680 .ne 2
 681 .na
 682 \fB\fBIEC61883_ARQ_GET_IBUF_SIZE\fR\fR
 683 .ad
 684 .sp .6
 685 .RS 4n
 686 This command returns current incoming ARQ buffer size. The argument is a
 687 pointer to \fBint\fR.
 688 .RE
 689 
 690 .sp
 691 .ne 2
 692 .na
 693 \fB\fBIEC61883_ARQ_SET_IBUF_SIZE\fR\fR
 694 .ad
 695 .sp .6
 696 .RS 4n
 697 This command changes incoming ARQ buffer size. The argument is the new buffer
 698 size in bytes.
 699 .RE
 700 
 701 .SH FILES
 702 .sp
 703 .ne 2
 704 .na
 705 \fB\fB/dev/av/N/async\fR\fR
 706 .ad
 707 .RS 19n
 708 Device node for asynchronous data
 709 .RE
 710 
 711 .sp
 712 .ne 2
 713 .na
 714 \fB\fB/dev/av/N/isoch\fR\fR
 715 .ad
 716 .RS 19n
 717 Device has been disconnected
 718 .RE
 719 
 720 .SH ERRORS
 721 .sp
 722 .ne 2
 723 .na
 724 \fB\fBEIO\fR\fR
 725 .ad
 726 .RS 10n
 727 Bus operation failed.
 728 .sp
 729 DMA failure.
 730 .RE
 731 
 732 .sp
 733 .ne 2
 734 .na
 735 \fB\fBEFAULT\fR\fR
 736 .ad
 737 .RS 10n
 738 \fBioctl\fR(2) argument points to an illegal address.
 739 .RE
 740 
 741 .sp
 742 .ne 2
 743 .na
 744 \fB\fBEINVAL\fR\fR
 745 .ad
 746 .RS 10n
 747 Invalid argument or argument combination.
 748 .RE
 749 
 750 .sp
 751 .ne 2
 752 .na
 753 \fB\fBENODEV\fR\fR
 754 .ad
 755 .RS 10n
 756 Device has been disconnected.
 757 .RE
 758 
 759 .SH ATTRIBUTES
 760 .sp
 761 .LP
 762 See \fBattributes\fR(5) for descriptions of the following attributes:
 763 .sp
 764 
 765 .sp
 766 .TS
 767 box;
 768 c | c
 769 l | l .
 770 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 771 _
 772 Architecture    All
 773 _
 774 Stability level Committed
 775 .TE
 776 
 777 .SH SEE ALSO
 778 .sp
 779 .LP
 780 \fBioctl\fR(2), \fBmmap\fR(2), \fBopen\fR(2), \fBpoll\fR(2), \fBread\fR(2),
 781 \fBwrite\fR(2), \fBattributes\fR(5), \fBav1394\fR(7D)
 782 .sp
 783 .LP
 784 \fIIEC 61883 Consumer audio/video equipment - Digital interface\fR
 785 .sp
 786 .LP
 787 \fIIEEE Std 1394-1995 Standard for a High Performance Serial Bus\fR