libraw1394: version 2.0.4
Prev | Chapter 4. Isochronous Transmission and Reception | Next

# 4.2. Initialization

When a raw1394 handle is first created, no isochronous stream is assocated with it. To begin isochronous operations, call either `raw1394_iso_xmit_init()` (transmission) or `raw1394_iso_recv_init()` (reception). The parameters to these functions are as follows:

`handler` is your function for queueing packets to be sent (transmission) or processing received packets (reception).

`buf_packets` is the number of packets that will be buffered at the kernel level. A larger packet buffer will be more forgiving of IRQ and application latency, however it will consume more kernel memory. For most applications, it is sufficient to buffer 2000-16000 packets (0.25 seconds to 2.0 seconds maximum latency).

`max_packet_size` is the size, in bytes, of the largest isochronous packet you intend to handle. This size does not include the isochronous header but it does include the CIP header specified by many isochronous protocols.

`channel` is the isochronous channel on which you wish to receive or transmit. (currently there is no facility for multi-channel transmission or reception).

`speed` is the isochronous speed at which you wish to operate. Possible values are `RAW1394_ISO_SPEED_100`, `RAW1394_ISO_SPEED_200`, and `RAW1394_ISO_SPEED_400`.

`irq_interval` is the maximum latency of the kernel buffer, in packets. (To avoid excessive IRQ rates, the low-level drivers only trigger an interrupt every irq_interval packets). Pass -1 to receive a default value that should be suitable for most applications.

`mode` for `raw1394_iso_recv_init()` sets whether to use packet-per-buffer or buffer-fill receive mode. Possible values are `RAW1394_DMA_DEFAULT` (bufferfill on ohci1394), `RAW1394_DMA_BUFFERFILL`, and `RAW1394_DMA_PACKET_PER_BUFFER`.

If `raw1394_iso_xmit/recv_init()` retuns successfully, then you may start isochronous operations. You may not call `raw1394_iso_xmit/recv_init()` again on the same handle without first shutting down the isochronous operation with `raw1394_iso_shutdown()`.

Note that `raw1394_iso_xmit_init()` and `raw1394_iso_recv_init()` involve potentially time-consuming operations like allocating kernel and device resources. If you intend to transmit or receive several isochronous streams simultaneously, it is advisable to initialize all streams before starting any packet transmission or reception.

Prev | Home | Next
Isochronous Transmission and Reception | Up | Stopping and Starting