diff options
author | Patrick Boettcher <devnull@localhost> | 2005-06-07 15:54:59 +0000 |
---|---|---|
committer | Patrick Boettcher <devnull@localhost> | 2005-06-07 15:54:59 +0000 |
commit | 0eab64d68e21555ab2a63619bfc97042e20de58b (patch) | |
tree | 6e790f7b9b27bf2d3802d3374bfcf2cda60adf93 /linux | |
parent | 6409ab9c7611918d543a83f7241035687908224a (diff) | |
download | mediapointer-dvb-s2-0eab64d68e21555ab2a63619bfc97042e20de58b.tar.gz mediapointer-dvb-s2-0eab64d68e21555ab2a63619bfc97042e20de58b.tar.bz2 |
Fixed isochronous transfers. Thanks to Alan Stern and David Brownell for the usb-devel-list.
Signed-off-by: Patrick Boettcher <pb@linuxtv.org>
Diffstat (limited to 'linux')
-rw-r--r-- | linux/drivers/media/dvb/dvb-usb/dvb-usb-urb.c | 61 |
1 files changed, 29 insertions, 32 deletions
diff --git a/linux/drivers/media/dvb/dvb-usb/dvb-usb-urb.c b/linux/drivers/media/dvb/dvb-usb/dvb-usb-urb.c index b48ae3e1c..dcd8c2f91 100644 --- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-urb.c +++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-urb.c @@ -24,6 +24,7 @@ int dvb_usb_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf, if ((ret = down_interruptible(&d->usb_sem))) return ret; + deb_xfer(">>> "); debug_dump(wbuf,wlen,deb_xfer); ret = usb_bulk_msg(d->udev,usb_sndbulkpipe(d->udev, @@ -46,8 +47,10 @@ int dvb_usb_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, u8 *rbuf, if (ret) err("recv bulk message failed: %d",ret); - else + else { + deb_xfer("<<< "); debug_dump(rbuf,actlen,deb_xfer); + } } up(&d->usb_sem); @@ -66,13 +69,14 @@ EXPORT_SYMBOL(dvb_usb_generic_write); static void dvb_usb_urb_complete(struct urb *urb, struct pt_regs *ptregs) { struct dvb_usb_device *d = urb->context; - int eptype = usb_pipetype(urb->pipe); - int i,s=0; + int ptype = usb_pipetype(urb->pipe); + int i; u8 *b; - deb_ts("'%s' urb completed. feedcount: %d, status: %d, length: %d\n", - eptype == PIPE_ISOCHRONOUS ? "isoc" : "bulk", d->feedcount, - urb->status,urb->actual_length); + deb_ts("'%s' urb completed. feedcount: %d, status: %d, length: %d/%d, pack_num: %d, errors: %d\n", + ptype == PIPE_ISOCHRONOUS ? "isoc" : "bulk", d->feedcount, + urb->status,urb->actual_length,urb->transfer_buffer_length, + urb->number_of_packets,urb->error_count); switch (urb->status) { case 0: /* success */ @@ -87,34 +91,26 @@ static void dvb_usb_urb_complete(struct urb *urb, struct pt_regs *ptregs) break; } - if (d->feedcount > 0 && urb->actual_length > 0) { + if (d->feedcount > 0) { if (d->state & DVB_USB_STATE_DVB) { - switch (eptype) { + switch (ptype) { case PIPE_ISOCHRONOUS: + b = (u8 *) urb->transfer_buffer; for (i = 0; i < urb->number_of_packets; i++) { - if (urb->iso_frame_desc[i].status < 0) { - err("iso frame descriptor %d has an error: %d\n",i,urb->iso_frame_desc[i].status); - } else - if (urb->iso_frame_desc[i].actual_length > 0) { - b = ((u8 *) urb->transfer_buffer) + urb->iso_frame_desc[i].offset; - s += urb->iso_frame_desc[i].actual_length; - dvb_dmx_swfilter(&d->demux,b,urb->iso_frame_desc[i].actual_length); + if (urb->iso_frame_desc[i].status != 0) + deb_ts("iso frame descriptor has an error: %d\n",urb->iso_frame_desc[i].status); + else if (urb->iso_frame_desc[i].actual_length > 0) { + dvb_dmx_swfilter(&d->demux,b + urb->iso_frame_desc[i].offset, + urb->iso_frame_desc[i].actual_length); } urb->iso_frame_desc[i].status = 0; urb->iso_frame_desc[i].actual_length = 0; } - for (i = 0; i < urb->transfer_buffer_length; i++) - if (((u8 *) urb->transfer_buffer)[i] != 0x00) { - deb_ts("first non-zero byte found in buffer %02x at %d ",((u8 *) urb->transfer_buffer)[i],i); - break; - } - deb_ts("buffer: %p ",(u8 *) urb->transfer_buffer); - deb_ts("passed %d bytes to the demux ",s); - debug_dump(((u8 *) urb->transfer_buffer),20,deb_ts); - + debug_dump(b,20,deb_ts); break; case PIPE_BULK: - dvb_dmx_swfilter(&d->demux, (u8 *) urb->transfer_buffer,urb->actual_length); + if (urb->actual_length > 0) + dvb_dmx_swfilter(&d->demux, (u8 *) urb->transfer_buffer,urb->actual_length); break; default: err("unkown endpoint type in completition handler."); @@ -200,7 +196,7 @@ static int dvb_usb_allocate_stream_buffers(struct dvb_usb_device *d, int num, un dvb_usb_free_stream_buffers(d); return -ENOMEM; } - deb_mem("buffer %d: %p\n",d->buf_num,d->buf_list[d->buf_num]); + deb_mem("buffer %d: %p (dma: %d)\n",d->buf_num,d->buf_list[d->buf_num],d->dma_addr[d->buf_num]); memset(d->buf_list[d->buf_num],0,size); } deb_mem("allocation successful\n"); @@ -218,7 +214,7 @@ static int dvb_usb_bulk_urb_init(struct dvb_usb_device *d) /* allocate the URBs */ for (i = 0; i < d->props.urb.count; i++) { - if (!(d->urb_list[i] = usb_alloc_urb(0,GFP_ATOMIC))) + if ((d->urb_list[i] = usb_alloc_urb(0,GFP_ATOMIC)) == NULL) return -ENOMEM; usb_fill_bulk_urb( d->urb_list[i], d->udev, @@ -245,8 +241,8 @@ static int dvb_usb_isoc_urb_init(struct dvb_usb_device *d) for (i = 0; i < d->props.urb.count; i++) { struct urb *urb; int frame_offset = 0; - if (!(d->urb_list[i] = - usb_alloc_urb(d->props.urb.u.isoc.framesperurb,GFP_ATOMIC))) + if ((d->urb_list[i] = + usb_alloc_urb(d->props.urb.u.isoc.framesperurb,GFP_ATOMIC)) == NULL) return -ENOMEM; urb = d->urb_list[i]; @@ -255,11 +251,12 @@ static int dvb_usb_isoc_urb_init(struct dvb_usb_device *d) urb->context = d; urb->complete = dvb_usb_urb_complete; urb->pipe = usb_rcvisocpipe(d->udev,d->props.urb.endpoint); - urb->transfer_flags = URB_ISO_ASAP; + urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; urb->interval = d->props.urb.u.isoc.interval; urb->number_of_packets = d->props.urb.u.isoc.framesperurb; urb->transfer_buffer_length = d->buf_size; urb->transfer_buffer = d->buf_list[i]; + urb->transfer_dma = d->dma_addr[i]; for (j = 0; j < d->props.urb.u.isoc.framesperurb; j++) { urb->iso_frame_desc[j].offset = frame_offset; @@ -309,8 +306,6 @@ int dvb_usb_urb_exit(struct dvb_usb_device *d) dvb_usb_urb_kill(d); - dvb_usb_free_stream_buffers(d); - if (d->state & DVB_USB_STATE_URB_LIST) { for (i = 0; i < d->urbs_initialized; i++) { if (d->urb_list[i] != NULL) { @@ -324,5 +319,7 @@ int dvb_usb_urb_exit(struct dvb_usb_device *d) kfree(d->urb_list); d->state &= ~DVB_USB_STATE_URB_LIST; } + + dvb_usb_free_stream_buffers(d); return 0; } |