static void
rx_iso_complete(struct urb *urb)
{
	iso_urb_struct *context_iso_urb = (iso_urb_struct *) urb->context;
	usb_fifo *fifo = context_iso_urb->owner_fifo;
	hfcusb_data *hfc = fifo->hfc;
	int k, len, errcode, offset, num_isoc_packets, fifon, maxlen,
		status;
	unsigned int iso_status;
	__u8 *buf;
	static __u8 eof[8];

	fifon = fifo->fifonum;
	status = urb->status;

	if (urb->status == -EOVERFLOW) {
		DBG(HFCUSB_DBG_VERBOSE_USB,
		    "HFC-USB: ignoring USB DATAOVERRUN fifo(%i)", fifon);
		status = 0;
	}

	/* ISO transfer only partially completed,
	   look at individual frame status for details */
	if (status == -EXDEV) {
		DBG(HFCUSB_DBG_VERBOSE_USB, "HFC-S USB: rx_iso_complete with -EXDEV "
		    "urb->status %d, fifonum %d\n",
		    status, fifon);
		status = 0;
	}

	if (fifo->active && !status) {
		num_isoc_packets = iso_packets[fifon];
		maxlen = fifo->usb_packet_maxlen;
		for (k = 0; k < num_isoc_packets; ++k) {
			len = urb->iso_frame_desc[k].actual_length;
			offset = urb->iso_frame_desc[k].offset;
			buf = context_iso_urb->buffer + offset;
			iso_status = urb->iso_frame_desc[k].status;

			if (iso_status && !hfc->disc_flag)
				DBG(HFCUSB_DBG_VERBOSE_USB,
				    "HFC-S USB: rx_iso_complete "
				    "ISO packet %i, status: %i\n",
				    k, iso_status);

			if (fifon == HFCUSB_D_RX) {
				DBG(HFCUSB_DBG_VERBOSE_USB,
				    "HFC-S USB: ISO-D-RX lst_urblen:%2d "
				    "act_urblen:%2d max-urblen:%2d EOF:0x%0x",
				    fifo->last_urblen, len, maxlen,
				    eof[5]);

				DBG_PACKET(HFCUSB_DBG_VERBOSE_USB, buf, len);
			}

			if (fifo->last_urblen != maxlen) {
				/* the threshold mask is in the 2nd status byte */
				hfc->threshold_mask = buf[1];
				/* care for L1 state only for D-Channel
				   to avoid overlapped iso completions */
				if (fifon == HFCUSB_D_RX) {
					/* the S0 state is in the upper half
					   of the 1st status byte */
					s0_state_handler(hfc, buf[0] >> 4);
				}
				eof[fifon] = buf[0] & 1;
				if (len > 2)
					collect_rx_frame(fifo, buf + 2,
							 len - 2,
							 (len < maxlen) ?
							 eof[fifon] : 0);
			} else {
Exemple #2
0
static void
rx_iso_complete(struct urb *urb)
{
	iso_urb_struct *context_iso_urb = (iso_urb_struct *) urb->context;
	usb_fifo *fifo = context_iso_urb->owner_fifo;
	hfcusb_data *hfc = fifo->hfc;
	int k, len, errcode, offset, num_isoc_packets, fifon, maxlen,
	    status;
	unsigned int iso_status;
	__u8 *buf;
	static __u8 eof[8];
#ifdef CONFIG_HISAX_DEBUG
	__u8 i;
#endif

	fifon = fifo->fifonum;
	status = urb->status;

	if (urb->status == -EOVERFLOW) {
#ifdef CONFIG_HISAX_DEBUG
		DBG(USB_DBG,
		    "HFC-USB: ignoring USB DATAOVERRUN  for fifo  %i \n",
		    fifon);
#endif
		status = 0;
	}
	if (fifo->active && !status) {
		num_isoc_packets = iso_packets[fifon];
		maxlen = fifo->usb_packet_maxlen;
		for (k = 0; k < num_isoc_packets; ++k) {
			len = urb->iso_frame_desc[k].actual_length;
			offset = urb->iso_frame_desc[k].offset;
			buf = context_iso_urb->buffer + offset;
			iso_status = urb->iso_frame_desc[k].status;
#ifdef CONFIG_HISAX_DEBUG
			if (iso_status && !hfc->disc_flag)
				DBG(USB_DBG,
				    "HFC-S USB: ISO packet failure - status:%x",
				    iso_status);

			if ((fifon == 5) && (debug > 1)) {
				printk(KERN_INFO
				       "HFC-S USB: ISO-D-RX lst_urblen:%2d "
				       "act_urblen:%2d max-urblen:%2d "
				       "EOF:0x%0x DATA: ",
				       fifo->last_urblen, len, maxlen,
				       eof[5]);
				for (i = 0; i < len; i++)
					printk("%.2x ", buf[i]);
				printk("\n");
			}
#endif
			if (fifo->last_urblen != maxlen) {
				/* the threshold mask is in the 2nd status byte */
				hfc->threshold_mask = buf[1];
				/* care for L1 state only for D-Channel
				   to avoid overlapped iso completions */
				if (fifon == 5) {
					/* the S0 state is in the upper half
					   of the 1st status byte */
					state_handler(hfc, buf[0] >> 4);
				}
				eof[fifon] = buf[0] & 1;
				if (len > 2)
					collect_rx_frame(fifo, buf + 2,
							 len - 2,
							 (len <
							  maxlen) ?
							 eof[fifon] : 0);
			} else {