diff options
author | Julia Lawall <julia@diku.dk> | 2008-12-29 16:48:19 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-03-24 19:20:27 -0400 |
commit | 4d6914b72966862f37de634299a80ca2a4b1829f (patch) | |
tree | 1c7dec08838b413a6a32343879f1209362bda491 /include/linux/usb/ch9.h | |
parent | ee069fb1185895e725ad942c7a529f947e25166d (diff) |
USB: Move definitions from usb.h to usb/ch9.h
The functions:
usb_endpoint_dir_in(epd)
usb_endpoint_dir_out(epd)
usb_endpoint_is_bulk_in(epd)
usb_endpoint_is_bulk_out(epd)
usb_endpoint_is_int_in(epd)
usb_endpoint_is_int_out(epd)
usb_endpoint_is_isoc_in(epd)
usb_endpoint_is_isoc_out(epd)
usb_endpoint_num(epd)
usb_endpoint_type(epd)
usb_endpoint_xfer_bulk(epd)
usb_endpoint_xfer_control(epd)
usb_endpoint_xfer_int(epd)
usb_endpoint_xfer_isoc(epd)
are moved from include/linux/usb.h to include/linux/usb/ch9.h.
include/linux/usb/ch9.h makes more sense for these functions because they
only depend on constants that are defined in this file.
Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/usb/ch9.h')
-rw-r--r-- | include/linux/usb/ch9.h | 179 |
1 files changed, 179 insertions, 0 deletions
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 9b42baed3900..fa777db7f7eb 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h | |||
@@ -353,6 +353,185 @@ struct usb_endpoint_descriptor { | |||
353 | #define USB_ENDPOINT_XFER_INT 3 | 353 | #define USB_ENDPOINT_XFER_INT 3 |
354 | #define USB_ENDPOINT_MAX_ADJUSTABLE 0x80 | 354 | #define USB_ENDPOINT_MAX_ADJUSTABLE 0x80 |
355 | 355 | ||
356 | /*-------------------------------------------------------------------------*/ | ||
357 | |||
358 | /** | ||
359 | * usb_endpoint_num - get the endpoint's number | ||
360 | * @epd: endpoint to be checked | ||
361 | * | ||
362 | * Returns @epd's number: 0 to 15. | ||
363 | */ | ||
364 | static inline int usb_endpoint_num(const struct usb_endpoint_descriptor *epd) | ||
365 | { | ||
366 | return epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; | ||
367 | } | ||
368 | |||
369 | /** | ||
370 | * usb_endpoint_type - get the endpoint's transfer type | ||
371 | * @epd: endpoint to be checked | ||
372 | * | ||
373 | * Returns one of USB_ENDPOINT_XFER_{CONTROL, ISOC, BULK, INT} according | ||
374 | * to @epd's transfer type. | ||
375 | */ | ||
376 | static inline int usb_endpoint_type(const struct usb_endpoint_descriptor *epd) | ||
377 | { | ||
378 | return epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; | ||
379 | } | ||
380 | |||
381 | /** | ||
382 | * usb_endpoint_dir_in - check if the endpoint has IN direction | ||
383 | * @epd: endpoint to be checked | ||
384 | * | ||
385 | * Returns true if the endpoint is of type IN, otherwise it returns false. | ||
386 | */ | ||
387 | static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd) | ||
388 | { | ||
389 | return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN); | ||
390 | } | ||
391 | |||
392 | /** | ||
393 | * usb_endpoint_dir_out - check if the endpoint has OUT direction | ||
394 | * @epd: endpoint to be checked | ||
395 | * | ||
396 | * Returns true if the endpoint is of type OUT, otherwise it returns false. | ||
397 | */ | ||
398 | static inline int usb_endpoint_dir_out( | ||
399 | const struct usb_endpoint_descriptor *epd) | ||
400 | { | ||
401 | return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT); | ||
402 | } | ||
403 | |||
404 | /** | ||
405 | * usb_endpoint_xfer_bulk - check if the endpoint has bulk transfer type | ||
406 | * @epd: endpoint to be checked | ||
407 | * | ||
408 | * Returns true if the endpoint is of type bulk, otherwise it returns false. | ||
409 | */ | ||
410 | static inline int usb_endpoint_xfer_bulk( | ||
411 | const struct usb_endpoint_descriptor *epd) | ||
412 | { | ||
413 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | ||
414 | USB_ENDPOINT_XFER_BULK); | ||
415 | } | ||
416 | |||
417 | /** | ||
418 | * usb_endpoint_xfer_control - check if the endpoint has control transfer type | ||
419 | * @epd: endpoint to be checked | ||
420 | * | ||
421 | * Returns true if the endpoint is of type control, otherwise it returns false. | ||
422 | */ | ||
423 | static inline int usb_endpoint_xfer_control( | ||
424 | const struct usb_endpoint_descriptor *epd) | ||
425 | { | ||
426 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | ||
427 | USB_ENDPOINT_XFER_CONTROL); | ||
428 | } | ||
429 | |||
430 | /** | ||
431 | * usb_endpoint_xfer_int - check if the endpoint has interrupt transfer type | ||
432 | * @epd: endpoint to be checked | ||
433 | * | ||
434 | * Returns true if the endpoint is of type interrupt, otherwise it returns | ||
435 | * false. | ||
436 | */ | ||
437 | static inline int usb_endpoint_xfer_int( | ||
438 | const struct usb_endpoint_descriptor *epd) | ||
439 | { | ||
440 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | ||
441 | USB_ENDPOINT_XFER_INT); | ||
442 | } | ||
443 | |||
444 | /** | ||
445 | * usb_endpoint_xfer_isoc - check if the endpoint has isochronous transfer type | ||
446 | * @epd: endpoint to be checked | ||
447 | * | ||
448 | * Returns true if the endpoint is of type isochronous, otherwise it returns | ||
449 | * false. | ||
450 | */ | ||
451 | static inline int usb_endpoint_xfer_isoc( | ||
452 | const struct usb_endpoint_descriptor *epd) | ||
453 | { | ||
454 | return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | ||
455 | USB_ENDPOINT_XFER_ISOC); | ||
456 | } | ||
457 | |||
458 | /** | ||
459 | * usb_endpoint_is_bulk_in - check if the endpoint is bulk IN | ||
460 | * @epd: endpoint to be checked | ||
461 | * | ||
462 | * Returns true if the endpoint has bulk transfer type and IN direction, | ||
463 | * otherwise it returns false. | ||
464 | */ | ||
465 | static inline int usb_endpoint_is_bulk_in( | ||
466 | const struct usb_endpoint_descriptor *epd) | ||
467 | { | ||
468 | return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd)); | ||
469 | } | ||
470 | |||
471 | /** | ||
472 | * usb_endpoint_is_bulk_out - check if the endpoint is bulk OUT | ||
473 | * @epd: endpoint to be checked | ||
474 | * | ||
475 | * Returns true if the endpoint has bulk transfer type and OUT direction, | ||
476 | * otherwise it returns false. | ||
477 | */ | ||
478 | static inline int usb_endpoint_is_bulk_out( | ||
479 | const struct usb_endpoint_descriptor *epd) | ||
480 | { | ||
481 | return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd)); | ||
482 | } | ||
483 | |||
484 | /** | ||
485 | * usb_endpoint_is_int_in - check if the endpoint is interrupt IN | ||
486 | * @epd: endpoint to be checked | ||
487 | * | ||
488 | * Returns true if the endpoint has interrupt transfer type and IN direction, | ||
489 | * otherwise it returns false. | ||
490 | */ | ||
491 | static inline int usb_endpoint_is_int_in( | ||
492 | const struct usb_endpoint_descriptor *epd) | ||
493 | { | ||
494 | return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd)); | ||
495 | } | ||
496 | |||
497 | /** | ||
498 | * usb_endpoint_is_int_out - check if the endpoint is interrupt OUT | ||
499 | * @epd: endpoint to be checked | ||
500 | * | ||
501 | * Returns true if the endpoint has interrupt transfer type and OUT direction, | ||
502 | * otherwise it returns false. | ||
503 | */ | ||
504 | static inline int usb_endpoint_is_int_out( | ||
505 | const struct usb_endpoint_descriptor *epd) | ||
506 | { | ||
507 | return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd)); | ||
508 | } | ||
509 | |||
510 | /** | ||
511 | * usb_endpoint_is_isoc_in - check if the endpoint is isochronous IN | ||
512 | * @epd: endpoint to be checked | ||
513 | * | ||
514 | * Returns true if the endpoint has isochronous transfer type and IN direction, | ||
515 | * otherwise it returns false. | ||
516 | */ | ||
517 | static inline int usb_endpoint_is_isoc_in( | ||
518 | const struct usb_endpoint_descriptor *epd) | ||
519 | { | ||
520 | return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd)); | ||
521 | } | ||
522 | |||
523 | /** | ||
524 | * usb_endpoint_is_isoc_out - check if the endpoint is isochronous OUT | ||
525 | * @epd: endpoint to be checked | ||
526 | * | ||
527 | * Returns true if the endpoint has isochronous transfer type and OUT direction, | ||
528 | * otherwise it returns false. | ||
529 | */ | ||
530 | static inline int usb_endpoint_is_isoc_out( | ||
531 | const struct usb_endpoint_descriptor *epd) | ||
532 | { | ||
533 | return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd)); | ||
534 | } | ||
356 | 535 | ||
357 | /*-------------------------------------------------------------------------*/ | 536 | /*-------------------------------------------------------------------------*/ |
358 | 537 | ||