Use new async stream ioctl
This implements asynchronous streams on juju, i.e. enables raw1394_async_stream() and raw1394_start_async_stream() to work with the new firewire kernel stack. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
This commit is contained in:
parent
49dda1ef90
commit
efb814334e
|
@ -459,7 +459,7 @@ int raw1394_async_stream(raw1394handle_t handle, unsigned int channel,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (handle->is_fw)
|
if (handle->is_fw)
|
||||||
return fw_async_stream(handle->mode.fw, channel, tag, sy, speed, length, data);
|
return fw_async_stream(handle, channel, tag, sy, speed, length, data);
|
||||||
else
|
else
|
||||||
return ieee1394_async_stream(handle, channel, tag, sy, speed, length, data);
|
return ieee1394_async_stream(handle, channel, tag, sy, speed, length, data);
|
||||||
}
|
}
|
||||||
|
|
54
src/fw.c
54
src/fw.c
|
@ -946,6 +946,18 @@ send_request(fw_handle_t handle, int tcode,
|
||||||
int ioctl_nr = FW_CDEV_IOC_SEND_REQUEST;
|
int ioctl_nr = FW_CDEV_IOC_SEND_REQUEST;
|
||||||
int fd, i;
|
int fd, i;
|
||||||
|
|
||||||
|
#ifdef FW_CDEV_IOC_SEND_STREAM_PACKET /* added in kernel 2.6.30 */
|
||||||
|
if (tcode == TCODE_STREAM_DATA) {
|
||||||
|
ioctl_nr = FW_CDEV_IOC_SEND_STREAM_PACKET;
|
||||||
|
fd = handle->ioctl_fd;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (tcode == TCODE_STREAM_DATA) {
|
||||||
|
errno = ENOSYS;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef FW_CDEV_IOC_SEND_BROADCAST_REQUEST /* added in kernel 2.6.30 */
|
#ifdef FW_CDEV_IOC_SEND_BROADCAST_REQUEST /* added in kernel 2.6.30 */
|
||||||
if (node == 0xffff) {
|
if (node == 0xffff) {
|
||||||
ioctl_nr = FW_CDEV_IOC_SEND_BROADCAST_REQUEST;
|
ioctl_nr = FW_CDEV_IOC_SEND_BROADCAST_REQUEST;
|
||||||
|
@ -990,11 +1002,27 @@ node_id_ok:
|
||||||
|
|
||||||
request = (struct fw_cdev_send_request *) handle->buffer;
|
request = (struct fw_cdev_send_request *) handle->buffer;
|
||||||
request->tcode = tcode;
|
request->tcode = tcode;
|
||||||
request->generation = handle->generation;
|
|
||||||
request->offset = addr;
|
|
||||||
request->length = in_length > out_length ? in_length : out_length;
|
request->length = in_length > out_length ? in_length : out_length;
|
||||||
|
request->offset = addr;
|
||||||
request->closure = ptr_to_u64(closure);
|
request->closure = ptr_to_u64(closure);
|
||||||
request->data = ptr_to_u64(in);
|
request->data = ptr_to_u64(in);
|
||||||
|
request->generation = handle->generation;
|
||||||
|
|
||||||
|
#ifdef FW_CDEV_IOC_SEND_STREAM_PACKET
|
||||||
|
if (tcode == TCODE_STREAM_DATA) {
|
||||||
|
struct fw_cdev_send_stream_packet *p
|
||||||
|
= (struct fw_cdev_send_stream_packet *) request;
|
||||||
|
|
||||||
|
p->length = in_length;
|
||||||
|
p->tag = (addr >> 14) & 0x3;
|
||||||
|
p->channel = (addr >> 8) & 0x3f;
|
||||||
|
p->sy = addr & 0xf;
|
||||||
|
p->closure = ptr_to_u64(closure);
|
||||||
|
p->data = ptr_to_u64(in);
|
||||||
|
p->generation = handle->generation;
|
||||||
|
p->speed = (addr >> 4) & 0x7;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return ioctl(fd, ioctl_nr, request);
|
return ioctl(fd, ioctl_nr, request);
|
||||||
}
|
}
|
||||||
|
@ -1115,9 +1143,13 @@ fw_start_async_stream(fw_handle_t handle, unsigned int channel,
|
||||||
unsigned int speed, size_t length, quadlet_t *data,
|
unsigned int speed, size_t length, quadlet_t *data,
|
||||||
unsigned long rawtag)
|
unsigned long rawtag)
|
||||||
{
|
{
|
||||||
/* FIXME: implement this? */
|
nodeaddr_t addr = (tag & 0x3) << 14 |
|
||||||
errno = ENOSYS;
|
(channel & 0x3f) << 8 |
|
||||||
return -1;
|
(speed & 0x7) << 4 |
|
||||||
|
(sy & 0xf);
|
||||||
|
|
||||||
|
return send_request(handle, TCODE_STREAM_DATA,
|
||||||
|
0, addr, length, data, 0, NULL, rawtag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1242,13 +1274,17 @@ fw_lock64(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
fw_async_stream(fw_handle_t handle, unsigned int channel,
|
fw_async_stream(raw1394handle_t handle, unsigned int channel,
|
||||||
unsigned int tag, unsigned int sy, unsigned int speed,
|
unsigned int tag, unsigned int sy, unsigned int speed,
|
||||||
size_t length, quadlet_t *data)
|
size_t length, quadlet_t *data)
|
||||||
{
|
{
|
||||||
/* FIXME: implement this? */
|
nodeaddr_t addr = (tag & 0x3) << 14 |
|
||||||
errno = ENOSYS;
|
(channel & 0x3f) << 8 |
|
||||||
return -1;
|
(speed & 0x7) << 4 |
|
||||||
|
(sy & 0xf);
|
||||||
|
|
||||||
|
return send_request_sync(handle, TCODE_STREAM_DATA,
|
||||||
|
0, addr, length, data, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
2
src/fw.h
2
src/fw.h
|
@ -189,7 +189,7 @@ int fw_lock(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
|
||||||
int fw_lock64(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
|
int fw_lock64(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr,
|
||||||
unsigned int extcode, octlet_t data, octlet_t arg,
|
unsigned int extcode, octlet_t data, octlet_t arg,
|
||||||
octlet_t *result);
|
octlet_t *result);
|
||||||
int fw_async_stream(fw_handle_t handle, unsigned int channel,
|
int fw_async_stream(raw1394handle_t handle, unsigned int channel,
|
||||||
unsigned int tag, unsigned int sy, unsigned int speed,
|
unsigned int tag, unsigned int sy, unsigned int speed,
|
||||||
size_t length, quadlet_t *data);
|
size_t length, quadlet_t *data);
|
||||||
int fw_async_send(fw_handle_t handle,
|
int fw_async_send(fw_handle_t handle,
|
||||||
|
|
Reference in New Issue