int raw1394_loop_iterate(raw1394handle_t handle) { if (!handle) { errno = EINVAL; return -1; } if (handle->is_fw) return fw_loop_iterate(handle); else return ieee1394_loop_iterate(handle); }
int ieee1394_iso_xmit_write(raw1394handle_t handle, unsigned char *data, unsigned int len, unsigned char tag, unsigned char sy) { ieee1394handle_t ihandle = handle->mode.ieee1394; struct raw1394_iso_status *stat = &ihandle->iso_status; struct raw1394_iso_packets packets; struct raw1394_iso_packet_info info; if(ihandle->iso_mode != ISO_XMIT || ihandle->iso_xmit_handler != NULL) { errno = EINVAL; return -1; } /* wait until buffer space is available */ while(ihandle->iso_status.n_packets <= 1) { /* if the file descriptor has been set non-blocking, return immediately */ if(fcntl(ihandle->fd, F_GETFL) & O_NONBLOCK) { errno = EAGAIN; return -1; } if(ieee1394_loop_iterate(handle)) { return -1; } } /* copy the data to the packet buffer */ info.offset = ihandle->next_packet * ihandle->iso_buf_stride; info.len = len; info.tag = tag; info.sy = sy; memcpy(ihandle->iso_buffer + info.offset, data, len); packets.n_packets = 1; packets.infos = &info; if(ioctl(ihandle->fd, RAW1394_IOC_ISO_XMIT_PACKETS, &packets)) return -1; stat->n_packets--; ihandle->next_packet = increment_and_wrap(ihandle->next_packet, stat->config.buf_packets); if(stat->xmit_cycle != -1) stat->xmit_cycle = increment_and_wrap(stat->xmit_cycle, 8000); return 0; }