JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
man pages section 7: Device and Network Interfaces     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

Introduction

Device and Network Interfaces

1394(7D)

aac(7D)

adpu320(7D)

afe(7D)

agpgart_io(7I)

AH(7P)

ahci(7D)

allkmem(7D)

amd8111s(7D)

arcmsr(7D)

arn(7D)

ARP(7P)

arp(7P)

ast(7D)

asy(7D)

ata(7D)

atge(7D)

ath(7D)

atu(7D)

audio1575(7D)

audio(7D)

audio(7I)

audio810(7D)

audiocmi(7D)

audiocs(7D)

audioemu10k(7D)

audioens(7D)

audiohd(7D)

audioixp(7D)

audiols(7D)

audiop16x(7D)

audiopci(7D)

audiosolo(7D)

audiots(7D)

audiovia823x(7D)

av1394(7D)

balloon(7D)

bbc_beep(7D)

bcm_sata(7D)

bfe(7D)

bge(7D)

blkdev(7D)

bmc(7D)

bnx(7D)

bnxe(7D)

bpf(7D)

bscbus(7D)

bscv(7D)

bufmod(7M)

cdio(7I)

chxge(7D)

cmdk(7D)

connld(7M)

console(7D)

cpqary3(7D)

cpr(7)

cpuid(7D)

ctfs(7FS)

cxge(7D)

dad(7D)

daplt(7D)

dca(7D)

dcam1394(7D)

dcfs(7FS)

dev(7FS)

devchassis(7FS)

devfs(7FS)

devinfo(7D)

dkio(7I)

dlcosmk(7ipp)

dlpi(7P)

dm2s(7D)

dmfe(7D)

dnet(7D)

dr(7d)

drmach(7d)

dscpmk(7ipp)

dsp(7I)

dtrace(7D)

e1000(7D)

e1000g(7D)

ecpp(7D)

efb(7D)

ehci(7D)

eibnx(7D)

elxl(7D)

emlxs(7D)

eoib(7D)

eri(7D)

ESP(7P)

evb(7P)

fas(7D)

fasttrap(7D)

fbio(7I)

fbt(7D)

fcip(7D)

fcoe(7D)

fcoei(7D)

fcoet(7D)

fcp(7D)

fctl(7D)

fipe(7D)

firewire(7D)

flowacct(7ipp)

fp(7d)

FSS(7)

gld(7D)

glm(7D)

hci1394(7D)

hdio(7I)

heci(7D)

hermon(7D)

hid(7D)

hme(7D)

hsfs(7FS)

hubd(7D)

hwa1480_fw(7D)

hwahc(7D)

hwarc(7D)

hxge(7D)

i2bsc(7D)

i915(7d)

ib(7D)

ibcm(7D)

ibdm(7D)

ibdma(7D)

ibmf(7)

ibp(7D)

ibtl(7D)

icmp6(7P)

ICMP(7P)

icmp(7P)

iec61883(7I)

ieee1394(7D)

if(7P)

ifp(7D)

if_tcp(7P)

igb(7D)

igbvf(7D)

ii(7D)

imraid_sas(7D)

inet6(7P)

inet(7P)

ip6(7P)

IP(7P)

ip(7P)

ipgpc(7ipp)

ipmi(7D)

ipnat(7I)

ipnet(7D)

ipqos(7ipp)

iprb(7D)

ipsec(7P)

ipsecah(7P)

ipsecesp(7P)

ipw(7D)

iscsi(7D)

isdnio(7I)

iser(7D)

isp(7D)

iwh(7D)

iwi(7D)

iwk(7D)

iwp(7D)

ixgb(7d)

ixgbe(7D)

ixgbevf(7D)

kb(7M)

kdmouse(7D)

kmdb(7d)

kmem(7D)

kstat(7D)

ksyms(7D)

ldterm(7M)

llc1(7D)

llc2(7D)

lo0(7D)

lockstat(7D)

lofi(7D)

lofs(7FS)

log(7D)

lsc(7D)

marvell88sx(7D)

mc-opl(7D)

mcxe(7D)

md(7D)

mediator(7D)

mega_sas(7D)

mem(7D)

mga(7D)

mhd(7i)

mixer(7I)

mpt(7D)

mpt_sas(7D)

mr_sas(7D)

msglog(7D)

mt(7D)

mtio(7I)

mwl(7D)

mxfe(7D)

myri10ge(7D)

n2cp(7d)

n2rng(7d)

nca(7d)

ncp(7D)

ngdr(7d)

ngdrmach(7d)

nge(7D)

npe(7D)

ntwdt(7D)

ntxn(7D)

null(7D)

nulldriver(7D)

nv_sata(7D)

nxge(7D)

objfs(7FS)

oce(7D)

ohci(7D)

openprom(7D)

oplkmdrv(7D)

oplmsu(7D)

oplpanel(7D)

packet(7P)

pcan(7D)

pcata(7D)

pcfs(7FS)

pcic(7D)

pcicmu(7D)

pcie_pci(7D)

pckt(7M)

pcmcia(7D)

pcn(7D)

pcser(7D)

pcwl(7D)

pf_key(7P)

pfmod(7M)

PF_PACKET(7P)

physmem(7D)

pipemod(7M)

pm(7D)

poll(7d)

prnio(7I)

profile(7D)

ptem(7M)

ptm(7D)

pts(7D)

pty(7D)

qfe(7d)

qlc(7D)

qlcnic(7D)

qlge(7D)

quotactl(7I)

radeon(7d)

ral(7D)

ramdisk(7D)

random(7D)

RARP(7P)

rarp(7P)

rge(7D)

route(7P)

routing(7P)

rtls(7D)

rtw(7D)

rum(7D)

rwd(7D)

rwn(7D)

sad(7D)

sata(7D)

scfd(7D)

scsa1394(7D)

scsa2usb(7D)

scsi_vhci(7D)

SCTP(7P)

sctp(7P)

scu(7D)

sd(7D)

sda(7D)

SDC(7)

sdcard(7D)

sdhost(7D)

sdp(7D)

sdt(7D)

se(7D)

se_hdlc(7D)

ses(7D)

sesio(7I)

sf(7D)

sfe(7D)

sgen(7D)

sharefs(7FS)

si3124(7D)

sip(7P)

slp(7P)

smbfs(7FS)

smbios(7D)

smbus(7D)

smp(7D)

snca(7d)

socal(7D)

sockio(7I)

sol_ofs(7D)

sol_ucma(7D)

sol_umad(7D)

sol_uverbs(7D)

sppptun(7M)

srpt(7D)

ssd(7D)

st(7D)

streamio(7I)

su(7D)

sv(7D)

sxge(7D)

sysmsg(7D)

systrace(7D)

TCP(7P)

tcp(7P)

termio(7I)

termiox(7I)

ticlts(7D)

ticots(7D)

ticotsord(7D)

timod(7M)

tirdwr(7M)

tmpfs(7FS)

todopl(7D)

tokenmt(7ipp)

tsalarm(7D)

tswtclmt(7ipp)

ttcompat(7M)

tty(7D)

ttymux(7D)

tzmon(7d)

uata(7D)

uath(7D)

udfs(7FS)

UDP(7P)

udp(7P)

ufs(7FS)

ugen(7D)

uhci(7D)

ural(7D)

urandom(7D)

urtw(7D)

usb(7D)

usba(7D)

usb_ac(7D)

usb_ah(7M)

usb_as(7D)

usbecm(7D)

usbftdi(7D)

usb_ia(7D)

usbkbm(7M)

usb_mid(7D)

usbms(7M)

usbprn(7D)

usbsacm(7D)

usbser_edge(7D)

usbsksp(7D)

usbsprl(7D)

usbvc(7D)

usbwcm(7M)

uscsi(7I)

usmp(7I)

uvfs(7FS)

uwb(7D)

uwba(7D)

virtualkm(7D)

visual_io(7I)

vni(7d)

vr(7D)

vt(7I)

vuid2ps2(7M)

vuid3ps2(7M)

vuidm3p(7M)

vuidm4p(7M)

vuidm5p(7M)

vuidmice(7M)

vxge(7D)

wpi(7D)

wscons(7D)

wusb_ca(7D)

wusb_df(7D)

xge(7D)

xhci(7D)

yge(7D)

zcons(7D)

zero(7D)

zfs(7FS)

zs(7D)

zsh(7D)

zyd(7D)

iec61883

- IEC 61883 interfaces

Synopsis

#include <sys/av/iec61883.h>

Description

The set of interfaces described in this man page can be used to control and exchange data with consumer audio/video devices using protocols specified inIEC 61883 Consumer Electronic Audio/Video Equipment - Digital Interface, including Common Isochronous Packet (CIP), Connection Management Procedures (CMP) and Function Control Protocol (FCP).

An iec61883 compliant driver exports two device nodes for isochronous and for asynchronous transactions. See the FILES section of this man page for the namespace definition.

Isochronous Transfers

Two methods are provided to receive/transmit isochronous data: using mmap(2) in combination with ioctl(2), and read(2) or write(2).

Mmap/Ioctl

This method provides better performance and finer-grained control than read/write, and is a method of choice for most applications. The data buffer is mapped into a user process address space, which means no data copying between the kernel and an application is necessary. Synchronization between user processes and the driver is performed using ioctl(2) commands.

An application allocates resources for isochronous transfer using IEC61883_ISOCH_INIT. Then the data buffer can be mapped into the process space using mmap(2).

A circular data buffer consists of one or more equal size frame buffers (further referred to as frames, unless to avoid ambiguity with AV frames). Frames are numbered starting with zero and are always transferred sequentially. Frames consist equal sized packets. Each packet contains a CIP header and one or more data blocks.

A driver and an application act as a producer and a consumer: producer supplies full frames (filled with data) to the consumer, and the producer is not allowed to access those frames until the consumer claims them empty.

A transfer can be initiated and suspended with IEC61883_START and IEC61883_STOP commands respectively. IEC61883_RECV or IEC61883_XMIT is used for producer-consumer synchronization.

Read/Write

Using this method, an application calls read(2) or write(2) to receive or transmit a specified amount of data. Bus-specific overhead, such as isochronous packet headers, is handled by the driver and is not exposed to applications. Data returned by read(2) contains CIP headers and data blocks. Empty packets are not returned by read(2). write(2) data should meet the same requirements.

If one or more channels have been allocated since open(2) (see IEC61883_ISOCH_INIT), the data is received/transmitted using channel that was created the last.

If no channels were allocated, the driver uses the broadcast channel by default and allocates the default-size data buffer. During transmit, the first packet's CIP header is used to auto-detect the data format. If it is one of the formats supported by the driver, it is properly transmitted (with inserted empty packets and timestamps).

For both methods, if during transmit the driver runs out of data, it transmits empty packets containing only a CIP header of the next to be transmitted packet, as defined in IEC 61883-1.

Connection Management Procedures

Applications wishing to follow Connection Management Procedures (CMP) in combination with isochronous transfers should use the ioctl(2) IEC61883_PLUG_INIT, IEC61883_PLUG_FINI, IEC61883_PLUG_REG_READ and IEC61883_PLUG_REG_CAS commands.

Asynchronous Transactions

read(2), write(2), ioctl(2), and poll(2) can be used with asynchronous nodes. Asynchronous data exchange between a driver and an application utilizes a common data structure called asynchronous request (ARQ):

typedef struct iec61883_arq {
        int        arq_type;
        int        arq_len;
        union {
                uint32_t   quadlet;
                uint64_t   octlet;
                uint8_t    buf[8];
        } arq_data;
} iec61883_arq_t;

arq_type contains ARQ type:

IEC61883_ARQ_FCP_CMD
IEC61883_ARQ_FCP_RESP

FCP command and response frame respectively. Outgoing frames are sent using write(2), incoming frames are received with read(2).

See IEC 61883-1 for the FCP frame structure definition.

IEC61883_ARQ_BUS_RESET

Returned by the driver when a bus reset occurs. There is no data associated with this request type, and arq_len is set to 0.

If arq_len is 4 or 8, then data should be supplied in arq_data.quadlet or arq_data.octlet respectively, otherwise up to 8 bytes can be put in arq_data.buf, with the rest of the data following immediately after.

write(2)

For a request to be sent to a target, an iec61883_arq_t structure along with associated data is passed to the driver using write(2). write() blocks until the request is completed.

read(2)

A driver collects incoming ARQs in the internal buffer. Buffer size can be changed using the ioctl(2) command IEC61883_FCP_SET_IBUF_SIZE.

Reading an ARQ takes one or two steps depending on data length. An application first reads sizeof (iec61883_arq_t) bytes: if arq_len is less than or equal 4, which is usually the case, no additional step is needed. Otherwise, the remaining arq_len - 4 bytes should be read and concatenated.

read(2) blocks until the specified amount of data is available, unless O_NONBLOCK or O_NDELAY flag was set during open(2), in which caseread(2) returns immediately.

poll(2)

Applications can poll(2) asynchronous nodes on the POLLIN event.

Bus Reset

In case of a bus reset, the driver notifies an application by generating an ARQ of type IEC61883_ARQ_BUS_RESET.

If there were established isochronous connections before bus reset, the driver attempts to restore all connections as described in IEC 61883 and resume any active transfers that were in progress.

ioctls

The following commands only apply to isochronous nodes:

IEC61883_ISOCH_INIT

This command allocates a data buffer and isochronous resources (if necessary) for the isochronous transfer. The argument is a pointer to the structure:

typedef struct iec61883_isoch_init {
      int ii_version;       /* interface version */
      int   ii_pkt_size;    /* packet size */
      int   ii_frame_size;  /* packets/frame */
      int   ii_frame_cnt;   /* # of frames */
      int   ii_direction;   /* xfer direction */
      int   ii_bus_speed;   /* bus speed */
      uint64_t ii_channel;  /* channel mask */
      int   ii_dbs;         /* DBS */
      int   ii_fn;          /* FN */
      int   ii_rate_n;      /* rate numerator */
      int   ii_rate_d;      /* rate denominator */
      int   ii_ts_mode;     /* timestamp mode */
      int   ii_flags;       /* flags */
      int   ii_handle;      /* isoch handle */
      int   ii_frame_rcnt;  /* # of frames */
      off_t   *ii_mmap_off  /* mmap offset */
      int   ii_rchannel;    /* channel */
      int   ii_error;       /* error code */
} iec61883_isoch_init_t;

ii_version should be set to IEC61883_V1_0.

The driver attempts to allocate a data buffer consisting of ii_frame_cnt frames, with ii_frame_size packets in each frame. Packet size in bytes is specified by ii_pkt_size specifies and should be a multiple of 512 and compatible with ii_bus_speed.

ii_direction can take one of the following values:

IEC61883_DIR_RECV

Receiving isochronous data.

IEC61883_DIR_XMIT

Transmitting isochronous data.

ii_bus_speed chooses bus speed to be used and can be either IEC61883_S100, IEC61883_S200 or IEC61883_S400.

ii_channel is a mask that specifies an isochronous channel number to be used, with the Nth bit representing channel N. When transmitting data, several bits can be set at a time, in which case the driver chooses one, for example, 0x3FF means a range from 0 to 9. In case of receive, only one bit can be set.

ii_dbs specifies data block size in quadlets, for example, DBS value for SD-DVCR is 0x78. Refer to IEC 61883 for more details on DBS.

ii_fn specifies fraction number, which defines the number of blocks in which a source packet is divided. Allowed values are from 0 to 3. Refer to IEC 61883 for more details on FN.

Data rate expected by the AV device can be lower than the bus speed, in which case the driver has to periodically insert empty packets into the data stream to avoid device buffer overflows. This rate is specified with a fraction N/D, set by ii_rate_n and ii_rate_d respectively. Any integer numbers can be used, or the following predefined constants:

IEC61883_RATE_N_DV_NTSC IEC61883_RATE_D_DV_NTSC

Data rate expected by DV-NTSC devices.

IEC61883_RATE_N_DV_PAL IEC61883_RATE_D_DV_PAL

Data rate expected by DV-PAL devices.

During data transmission, a timestamp based on the current value of the cycle timer is usually required. ii_ts_mode defines timestamp mode to be used:

IEC61883_TS_SYT

Driver puts a timestamp in the SYT field of the first CIP header of each frame.

IEC61883_TS_NONE

No timestamps.

ii_dbs, ii_fn, ii_rate_n, ii_rate_d and ii_ts_mode are only required for transmission. In other case these should be set to 0.

ii_flags should be set to 0.

If command succeeds, ii_handle contains a handle that should be used with other isochronous commands. ii_frame_rcnt contains the number of allocated frames (can be less than ii_frame_cnt). ii_mmap_off contains an offset to be used in mmap(2), for example, to map an entire data receive buffer:

pa = mmap(NULL, init.ii_pkt_size *
      init.ii_frame_size * init.ii_frame_rcnt,
      PROT_READ, MAP_PRIVATE, fd, init.ii_mmap_off);

ii_rchannel contains channel number.

In case of command success, ii_error is set to 0; otherwise one of the following values can be returned:

IEC61883_ERR_NOMEM

Not enough memory for the data buffer.

IEC61883_ERR_NOCHANNEL

Cannot allocate isochronous channel.

IEC61883_ERR_PKT_SIZE

Packet size is not allowed at this bus speed.

IEC61883_ERR_VERSION

Interface version is not supported.

IEC61883_ERR_INVAL

One or more the parameters are invalid

IEC61883_ERR_OTHER

Unspecified error type.

IEC61883_ISOCH_FINI

Argument is a handle returned by IEC61883_ISOCH_INIT. This command frees any resources associated with this handle. There must be no active transfers and the data buffer must be unmapped; otherwise the command fails.

IEC61883_START

This command starts an isochronous transfer. The argument is a handle returned by IEC61883_ISOCH_INIT.

IEC61883_STOP

This command stops an isochronous transfer. The argument is a handle returned by IEC61883_ISOCH_INIT.

IEC61883_RECV

This command is used to receive full frames and return empty frames to the driver. The argument is a pointer to the structure:

typedef struct iec61883_recv {
        int rx_handle;     /* isoch handle */
        int rx_flags;      /* flags */
iec61883_xfer_t rx_xfer;   /* xfer params */
} iec61883_recv_t;

typedef struct iec61883_xfer {
        int   xf_empty_idx; /* first empty frame */
        int xf_empty_cnt;   /* empty frame count */
        int   xf_full_idx;  /* first full frame */
        int   xf_full_cnt;  /* full frame count */
        int   xf_error;     /* error */
} iec61883_xfer_t;

rx_flags should be set to 0.

An application sets xf_empty_idx and xf_empty_cnt to indicate frames it no longer needs. E.g. if a buffer consists of 6 frames, xf_empty_idx is 4, xf_empty_cnt is 3 - means that frames 4, 5 and 0 can now be reused by the driver. If there are no empty frames, for example, the first time this command is called, xf_empty_cnt should be set to 0.

When the command returns, xf_full_idx and xf_full_cnt specifies the frames that are full. xf_error is always 0.

In general, AV frame boundaries are not aligned with the frame buffer boundaries, because the first received packet might not be the first packet of an AV frame, and, in contrast with the read/write method, the driver does not remove empty CIP packets.

Applications should detect empty packets by comparing adjacent packets' continuity counters (DBC field of the CIP header).

IEC61883_XMIT

This command is used to transmit full frames and get more empty frames from the driver. The argument is a pointer to the structure:

typedef struct iec61883_xmit {
        int   tx_handle;         /* isoch handle */
        int   tx_flags;          /* flags */
        iec61883_xfer_t tx_xfer; /* xfer params */
        int   tx_miss_cnt;       /* missed cycles */
 } iec61883_xmit_t;

tx_flags should be set to zero.

The application sets xf_full_idx and xf_full_cnt to specify frames it wishes to transmit. If there are no frames to transmit (e.g. the first time this command is called), xf_full_cnt should be set to 0.

When the command returns, xf_empty_idx and xf_empty_cnt specifies empty frames which can be to transmit more data. xf_error is always 0.

tx_miss_cnt contains the number of isochronous cycles missed since last transfer due to data buffer under run. This can happen when an application does not supply data fast enough.

For the purposes of time stamping, the driver considers the first packet in a frame buffer to be the first packet of an AV frame.

IEC61883_PLUG_INIT

This command returns a handle for the specified plug. The argument is a pointer to the structure:

typedef struct iec61883_plug_init {
        int   pi_ver;     /* interface version */
        int   pi_loc;     /* plug location */
        int   pi_type;    /* plug type */
        int   pi_num;     /* plug number */
        int   pi_flags;   /* flags */
        int   pi_handle;  /* plug handle */
        int   pi_rnum;    /* plug number */
 } iec61883_plug_init_t;

pi_ver should be set to IEC61883_V1_0.

pi_loc specifies plug location:

IEC61883_LOC_LOCAL

On the local unit (local plug). A plug control register (PCR) is allocated. Command fails if the plug already exists

IEC61883_LOC_REMOTE

On the remote unit (remote plug). The plug should exist on the remote unit, otherwise the command fails.

pi_type specifies isochronous plug type:

IEC61883_PLUG_IN IEC61883_PLUG_OUT

Input or output plugs.

IEC61883_PLUG_MASTER_IN IEC61883_PLUG_MASTER_OUT

Master input or master output plug. These plugs always exist on the local unit.

pi_num specifies plug number. This should be 0 for master plugs, and from 0 to 31 for input/output plugs. Alternatively, a special value IEC61883_PLUG_ANY can be used to let the driver choose a free plug number, create the plug and return the number in pi_rnum.

pi_flags should be set to 0.

If the command succeeds, pi_handle contains a handle that should be used with other plug commands.

IEC61883_PLUG_FINI

Argument is a handle returned by IEC61883_PLUG_INIT. This command frees any resources associated with this handle, including the PCR.

IEC61883_PLUG_REG_READ

Read plug register value. The argument is a pointer to the structure:

typedef struct iec61883_plug_reg_val {
        int         pr_handle; /* plug handle */
        uint32_t     pr_val;    /* register value */
} iec61883_plug_reg_val_t;

pr_handle is a handle returned by IEC61883_PLUG_INIT. Register value is returned in pr_val.

IEC61883_PLUG_REG_CAS

Atomically compare and swap plug register value. The argument is a pointer to the structure:

typedef struct iec61883_plug_reg_lock {
        int        pl_handle; /* plug handle */
        uint32_t   pl_arg;    /* compare arg */
        uint32_t   pl_data;   /* write value */
        UINT32_t   pl_old;    /* original value */
} iec61883_plug_reg_lock_t;

pr_handle is a handle returned by IEC61883_PLUG_INIT.

Original register value is compared with pl_arg and if they are equal, register value is replaced with pl_data. In any case, the original value is stored in pl_old.

The following commands only apply to asynchronous nodes:

IEC61883_ARQ_GET_IBUF_SIZE

This command returns current incoming ARQ buffer size. The argument is a pointer to int.

IEC61883_ARQ_SET_IBUF_SIZE

This command changes incoming ARQ buffer size. The argument is the new buffer size in bytes.

Files

/dev/av/N/async

Device node for asynchronous data

/dev/av/N/isoch

Device has been disconnected

Errors

EIO

Bus operation failed.

DMA failure.

EFAULT

ioctl(2) argument points to an illegal address.

EINVAL

Invalid argument or argument combination.

ENODEV

Device has been disconnected.

Attributes

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Architecture
All
Interface Stability
Committed

See Also

ioctl(2), mmap(2), open(2), poll(2), read(2), write(2), attributes(5), av1394(7D)

IEC 61883 Consumer audio/video equipment - Digital interface

IEEE Std 1394-1995 Standard for a High Performance Serial Bus