4.5. Transmitting Packets

Similar to reception, raw1394 maintains a fixed-size ringbuffer of packets in kernel memory. The buffer is filled by your application as it queues packets to be sent. The buffer is drained by the hardware driver as it transmits packets on the 1394 bus.

The isochronous transmit handler you provided will be called from raw1394_loop_iterate() whenever there is space in the buffer to queue another packet. The handler is passed a pointer to the first byte of the buffer space for the packet's data payload, pointers to words containing the data length in bytes (not counting the isochronous header), "tag" and "sy" fields, and the isochronous cycle number at which this packet will be transmitted. The handler must write the packet's data payload into the supplied buffer space, and set the values pointed to by "len", "tag", and "sy" to the appropriate values. The handler is permitted to write any number of data bytes, up and including to the value of max_packet_size passed to raw1394_iso_xmit_init().

Note: If you passed -1 as the starting cycle to raw1394_iso_xmit_init(), the cycle number provided to your handler will be incorrect until after one buffer's worth of packets have been transmitted.

The transmit handler is also passed a "packet(s) dropped" flag. If this flag is nonzero, it means that one or more outgoing packets have been dropped since the last call to your handler (usually this is because the kernel buffer has gone completely empty or a bus reset has occurred).