Deleted Added
full compact
usb_device.c (190730) usb_device.c (190731)
1/* $FreeBSD: head/sys/dev/usb/usb_device.c 190730 2009-04-05 18:19:52Z thompsa $ */
1/* $FreeBSD: head/sys/dev/usb/usb_device.c 190731 2009-04-05 18:20:03Z thompsa $ */
2/*-
3 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.

--- 90 unchanged lines hidden (view full) ---

100 * Returns:
101 * NULL: Failure
102 * Else: Success
103 *------------------------------------------------------------------------*/
104struct usb2_pipe *
105usb2_get_pipe_by_addr(struct usb2_device *udev, uint8_t ea_val)
106{
107 struct usb2_pipe *pipe = udev->pipes;
2/*-
3 * Copyright (c) 2008 Hans Petter Selasky. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.

--- 90 unchanged lines hidden (view full) ---

100 * Returns:
101 * NULL: Failure
102 * Else: Success
103 *------------------------------------------------------------------------*/
104struct usb2_pipe *
105usb2_get_pipe_by_addr(struct usb2_device *udev, uint8_t ea_val)
106{
107 struct usb2_pipe *pipe = udev->pipes;
108 struct usb2_pipe *pipe_end = udev->pipes + USB_EP_MAX;
108 struct usb2_pipe *pipe_end = udev->pipes + udev->pipes_max;
109 enum {
110 EA_MASK = (UE_DIR_IN | UE_DIR_OUT | UE_ADDR),
111 };
112
113 /*
114 * According to the USB specification not all bits are used
115 * for the endpoint address. Keep defined bits only:
116 */

--- 38 unchanged lines hidden (view full) ---

155 * NULL: No match.
156 * Else: Pointer to "struct usb2_pipe".
157 *------------------------------------------------------------------------*/
158struct usb2_pipe *
159usb2_get_pipe(struct usb2_device *udev, uint8_t iface_index,
160 const struct usb2_config *setup)
161{
162 struct usb2_pipe *pipe = udev->pipes;
109 enum {
110 EA_MASK = (UE_DIR_IN | UE_DIR_OUT | UE_ADDR),
111 };
112
113 /*
114 * According to the USB specification not all bits are used
115 * for the endpoint address. Keep defined bits only:
116 */

--- 38 unchanged lines hidden (view full) ---

155 * NULL: No match.
156 * Else: Pointer to "struct usb2_pipe".
157 *------------------------------------------------------------------------*/
158struct usb2_pipe *
159usb2_get_pipe(struct usb2_device *udev, uint8_t iface_index,
160 const struct usb2_config *setup)
161{
162 struct usb2_pipe *pipe = udev->pipes;
163 struct usb2_pipe *pipe_end = udev->pipes + USB_EP_MAX;
163 struct usb2_pipe *pipe_end = udev->pipes + udev->pipes_max;
164 uint8_t index = setup->ep_index;
165 uint8_t ea_mask;
166 uint8_t ea_val;
167 uint8_t type_mask;
168 uint8_t type_val;
169
170 DPRINTFN(10, "udev=%p iface_index=%d address=0x%x "
171 "type=0x%x dir=0x%x index=%d\n",

--- 143 unchanged lines hidden (view full) ---

315 *
316 * Return values:
317 * NULL: End of USB pipes
318 * Else: Pointer to next USB pipe
319 *------------------------------------------------------------------------*/
320struct usb2_pipe *
321usb2_pipe_foreach(struct usb2_device *udev, struct usb2_pipe *pipe)
322{
164 uint8_t index = setup->ep_index;
165 uint8_t ea_mask;
166 uint8_t ea_val;
167 uint8_t type_mask;
168 uint8_t type_val;
169
170 DPRINTFN(10, "udev=%p iface_index=%d address=0x%x "
171 "type=0x%x dir=0x%x index=%d\n",

--- 143 unchanged lines hidden (view full) ---

315 *
316 * Return values:
317 * NULL: End of USB pipes
318 * Else: Pointer to next USB pipe
319 *------------------------------------------------------------------------*/
320struct usb2_pipe *
321usb2_pipe_foreach(struct usb2_device *udev, struct usb2_pipe *pipe)
322{
323 struct usb2_pipe *pipe_end = udev->pipes + USB_EP_MAX;
323 struct usb2_pipe *pipe_end = udev->pipes + udev->pipes_max;
324
325 /* be NULL safe */
326 if (udev == NULL)
327 return (NULL);
328
329 /* get next pipe */
330 if (pipe == NULL)
331 pipe = udev->pipes;

--- 587 unchanged lines hidden (view full) ---

919usb2_error_t
920usb2_reset_iface_endpoints(struct usb2_device *udev, uint8_t iface_index)
921{
922 struct usb2_pipe *pipe;
923 struct usb2_pipe *pipe_end;
924 usb2_error_t err;
925
926 pipe = udev->pipes;
324
325 /* be NULL safe */
326 if (udev == NULL)
327 return (NULL);
328
329 /* get next pipe */
330 if (pipe == NULL)
331 pipe = udev->pipes;

--- 587 unchanged lines hidden (view full) ---

919usb2_error_t
920usb2_reset_iface_endpoints(struct usb2_device *udev, uint8_t iface_index)
921{
922 struct usb2_pipe *pipe;
923 struct usb2_pipe *pipe_end;
924 usb2_error_t err;
925
926 pipe = udev->pipes;
927 pipe_end = udev->pipes + USB_EP_MAX;
927 pipe_end = udev->pipes + udev->pipes_max;
928
929 for (; pipe != pipe_end; pipe++) {
930
931 if ((pipe->edesc == NULL) ||
932 (pipe->iface_index != iface_index)) {
933 continue;
934 }
935 /* simulate a clear stall from the peer */

--- 1505 unchanged lines hidden ---
928
929 for (; pipe != pipe_end; pipe++) {
930
931 if ((pipe->edesc == NULL) ||
932 (pipe->iface_index != iface_index)) {
933 continue;
934 }
935 /* simulate a clear stall from the peer */

--- 1505 unchanged lines hidden ---