MFp4 //depot/projects/usb@159871

- bugfixes after the memory usage reduction patch
- Use "udev->pipes_max" instead of USB_EP_MAX
- Use correct "bmRequestType" for getting the config descriptor.

Submitted by:	Hans Petter Selasky
This commit is contained in:
Andrew Thompson 2009-04-05 18:20:03 +00:00
parent bdd4120608
commit 63521bbc5a
2 changed files with 8 additions and 7 deletions

View file

@ -105,7 +105,7 @@ struct usb2_pipe *
usb2_get_pipe_by_addr(struct usb2_device *udev, uint8_t ea_val)
{
struct usb2_pipe *pipe = udev->pipes;
struct usb2_pipe *pipe_end = udev->pipes + USB_EP_MAX;
struct usb2_pipe *pipe_end = udev->pipes + udev->pipes_max;
enum {
EA_MASK = (UE_DIR_IN | UE_DIR_OUT | UE_ADDR),
};
@ -160,7 +160,7 @@ usb2_get_pipe(struct usb2_device *udev, uint8_t iface_index,
const struct usb2_config *setup)
{
struct usb2_pipe *pipe = udev->pipes;
struct usb2_pipe *pipe_end = udev->pipes + USB_EP_MAX;
struct usb2_pipe *pipe_end = udev->pipes + udev->pipes_max;
uint8_t index = setup->ep_index;
uint8_t ea_mask;
uint8_t ea_val;
@ -320,7 +320,7 @@ usb2_init_pipe(struct usb2_device *udev, uint8_t iface_index,
struct usb2_pipe *
usb2_pipe_foreach(struct usb2_device *udev, struct usb2_pipe *pipe)
{
struct usb2_pipe *pipe_end = udev->pipes + USB_EP_MAX;
struct usb2_pipe *pipe_end = udev->pipes + udev->pipes_max;
/* be NULL safe */
if (udev == NULL)
@ -924,7 +924,7 @@ usb2_reset_iface_endpoints(struct usb2_device *udev, uint8_t iface_index)
usb2_error_t err;
pipe = udev->pipes;
pipe_end = udev->pipes + USB_EP_MAX;
pipe_end = udev->pipes + udev->pipes_max;
for (; pipe != pipe_end; pipe++) {

View file

@ -97,7 +97,7 @@ usb2_do_clear_stall_callback(struct usb2_xfer *xfer)
struct usb2_pipe *pipe;
struct usb2_pipe *pipe_end;
struct usb2_pipe *pipe_first;
uint8_t to = USB_EP_MAX;
uint8_t to;
udev = xfer->xroot->udev;
@ -106,8 +106,9 @@ usb2_do_clear_stall_callback(struct usb2_xfer *xfer)
/* round robin pipe clear stall */
pipe = udev->pipe_curr;
pipe_end = udev->pipes + USB_EP_MAX;
pipe_end = udev->pipes + udev->pipes_max;
pipe_first = udev->pipes;
to = udev->pipes_max;
if (pipe == NULL) {
pipe = pipe_first;
}
@ -854,7 +855,7 @@ usb2_req_get_config_desc_ptr(struct usb2_device *udev,
if (udev->flags.usb2_mode != USB_MODE_DEVICE)
return (USB_ERR_INVAL);
req.bmRequestType = UT_READ_CLASS_DEVICE;
req.bmRequestType = UT_READ_DEVICE;
req.bRequest = UR_GET_DESCRIPTOR;
USETW2(req.wValue, UDESC_CONFIG, config_index);
USETW(req.wIndex, 0);