Date: Tue, 26 Aug 2008 18:35:26 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 148538 for review Message-ID: <200808261835.m7QIZQPh095925@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=148538 Change 148538 by hselasky@hselasky_laptop001 on 2008/08/26 18:34:51 Device Side driver related change: Allow different IN and OUT endpoint buffer sizes. Affected files ... .. //depot/projects/usb/src/sys/dev/usb2/controller/at91dci.c#10 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/usb2_controller.h#3 edit .. //depot/projects/usb/src/sys/dev/usb2/controller/uss820dci.c#9 edit .. //depot/projects/usb/src/sys/dev/usb2/template/usb2_template.c#6 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb2/controller/at91dci.c#10 (text+ko) ==== @@ -131,12 +131,14 @@ at91dci_ep_profile[AT91_UDP_EP_MAX] = { [0] = { - .max_frame_size = 8, + .max_in_frame_size = 8, + .max_out_frame_size = 8, .is_simplex = 1, .support_control = 1, }, [1] = { - .max_frame_size = 64, + .max_in_frame_size = 64, + .max_out_frame_size = 64, .is_simplex = 1, .support_multi_buffer = 1, .support_bulk = 1, @@ -146,7 +148,8 @@ .support_out = 1, }, [2] = { - .max_frame_size = 64, + .max_in_frame_size = 64, + .max_out_frame_size = 64, .is_simplex = 1, .support_multi_buffer = 1, .support_bulk = 1, @@ -157,14 +160,16 @@ }, [3] = { /* can also do BULK */ - .max_frame_size = 8, + .max_in_frame_size = 8, + .max_out_frame_size = 8, .is_simplex = 1, .support_interrupt = 1, .support_in = 1, .support_out = 1, }, [4] = { - .max_frame_size = 256, + .max_in_frame_size = 256, + .max_out_frame_size = 256, .is_simplex = 1, .support_multi_buffer = 1, .support_bulk = 1, @@ -174,7 +179,8 @@ .support_out = 1, }, [5] = { - .max_frame_size = 256, + .max_in_frame_size = 256, + .max_out_frame_size = 256, .is_simplex = 1, .support_multi_buffer = 1, .support_bulk = 1, ==== //depot/projects/usb/src/sys/dev/usb2/controller/usb2_controller.h#3 (text+ko) ==== @@ -103,7 +103,8 @@ * endpoint supports. */ struct usb2_hw_ep_profile { - uint16_t max_frame_size; + uint16_t max_in_frame_size; /* IN-token direction */ + uint16_t max_out_frame_size; /* OUT-token direction */ uint8_t is_simplex:1; uint8_t support_multi_buffer:1; uint8_t support_bulk:1; ==== //depot/projects/usb/src/sys/dev/usb2/controller/uss820dci.c#9 (text+ko) ==== @@ -107,12 +107,14 @@ uss820dci_ep_profile[] = { [0] = { - .max_frame_size = 32, + .max_in_frame_size = 32, + .max_out_frame_size = 32, .is_simplex = 0, .support_control = 1, }, [1] = { - .max_frame_size = 64, + .max_in_frame_size = 64, + .max_out_frame_size = 64, .is_simplex = 0, .support_multi_buffer = 1, .support_bulk = 1, @@ -121,7 +123,8 @@ .support_out = 1, }, [2] = { - .max_frame_size = 8, + .max_in_frame_size = 8, + .max_out_frame_size = 8, .is_simplex = 0, .support_multi_buffer = 1, .support_bulk = 1, @@ -130,7 +133,8 @@ .support_out = 1, }, [3] = { - .max_frame_size = 256, + .max_in_frame_size = 256, + .max_out_frame_size = 256, .is_simplex = 0, .support_multi_buffer = 1, .support_isochronous = 1, @@ -1437,16 +1441,21 @@ uss820dci_get_hw_ep_profile(NULL, &pf, n); + /* the maximum frame sizes should be the same */ + if (pf->max_in_frame_size != pf->max_out_frame_size) { + DPRINTF("Max frame size mismatch %u != %u\n", + pf->max_in_frame_size, pf->max_out_frame_size); + } if (pf->support_isochronous) { - if (pf->max_frame_size <= 64) { + if (pf->max_in_frame_size <= 64) { temp = (USS820_TXCON_FFSZ_16_64 | USS820_TXCON_TXISO | USS820_TXCON_ATM); - } else if (pf->max_frame_size <= 256) { + } else if (pf->max_in_frame_size <= 256) { temp = (USS820_TXCON_FFSZ_64_256 | USS820_TXCON_TXISO | USS820_TXCON_ATM); - } else if (pf->max_frame_size <= 512) { + } else if (pf->max_in_frame_size <= 512) { temp = (USS820_TXCON_FFSZ_8_512 | USS820_TXCON_TXISO | USS820_TXCON_ATM); @@ -1456,14 +1465,14 @@ USS820_TXCON_ATM); } } else { - if ((pf->max_frame_size <= 8) && + if ((pf->max_in_frame_size <= 8) && (sc->sc_flags.mcsr_feat)) { temp = (USS820_TXCON_FFSZ_8_512 | USS820_TXCON_ATM); - } else if (pf->max_frame_size <= 16) { + } else if (pf->max_in_frame_size <= 16) { temp = (USS820_TXCON_FFSZ_16_64 | USS820_TXCON_ATM); - } else if ((pf->max_frame_size <= 32) && + } else if ((pf->max_in_frame_size <= 32) && (sc->sc_flags.mcsr_feat)) { temp = (USS820_TXCON_FFSZ_32_1024 | USS820_TXCON_ATM); ==== //depot/projects/usb/src/sys/dev/usb2/template/usb2_template.c#6 (text+ko) ==== @@ -492,6 +492,7 @@ const struct usb2_hw_ep_profile *pf; uint16_t distance; uint16_t temp; + uint16_t max_frame_size; uint8_t n; uint8_t best_n; uint8_t dir_in; @@ -547,8 +548,15 @@ /* mismatch */ continue; } - if (pf->max_frame_size >= ep->max_frame_size) { - temp = (pf->max_frame_size - ep->max_frame_size); + /* get maximum frame size */ + if (dir_in) + max_frame_size = pf->max_in_frame_size; + else + max_frame_size = pf->max_out_frame_size; + + /* check if we have a matching profile */ + if (max_frame_size >= ep->max_frame_size) { + temp = (max_frame_size - ep->max_frame_size); if (distance > temp) { distance = temp; best_n = n; @@ -557,7 +565,7 @@ } else if ((ep->needs_ep_type == UE_BULK) || (ep->needs_ep_type == UE_CONTROL)) { /* frame size is not so important */ - temp = (ep->max_frame_size - pf->max_frame_size); + temp = (ep->max_frame_size - max_frame_size); if (distance > temp) { distance = temp; best_n = n; @@ -571,6 +579,12 @@ /* get the correct profile */ pf = ep->pf; + /* get maximum frame size */ + if (dir_in) + max_frame_size = pf->max_in_frame_size; + else + max_frame_size = pf->max_out_frame_size; + /* reserve IN-endpoint */ if (dir_in || pf->is_simplex) { ues->bmInAlloc[best_n / 8] |= @@ -588,8 +602,8 @@ * Frame Size than we wanted, we need to update the Maximum * Frame Size ! */ - if (ep->max_frame_size > pf->max_frame_size) { - ep->max_frame_size = pf->max_frame_size; + if (ep->max_frame_size > max_frame_size) { + ep->max_frame_size = max_frame_size; } return (0); /* got a match */ } @@ -809,7 +823,7 @@ */ while (1) { /* check if "mps" is ok */ - if (pf->max_frame_size >= mps) { + if (pf->max_in_frame_size >= mps) { break; } /* reduce maximum packet size */ @@ -829,7 +843,7 @@ mps = 512; } /* Check if we support the specified wMaxPacketSize */ - if (pf->max_frame_size < mps) { + if (pf->max_in_frame_size < mps) { return (USB_ERR_INVAL); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200808261835.m7QIZQPh095925>