irda.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /*
  2. * USB IrDA Bridge Device Definition
  3. */
  4. #ifndef __LINUX_USB_IRDA_H
  5. #define __LINUX_USB_IRDA_H
  6. /* This device should use Application-specific class */
  7. #define USB_SUBCLASS_IRDA 0x02
  8. /*-------------------------------------------------------------------------*/
  9. /* Class-Specific requests (bRequest field) */
  10. #define USB_REQ_CS_IRDA_RECEIVING 1
  11. #define USB_REQ_CS_IRDA_CHECK_MEDIA_BUSY 3
  12. #define USB_REQ_CS_IRDA_RATE_SNIFF 4
  13. #define USB_REQ_CS_IRDA_UNICAST_LIST 5
  14. #define USB_REQ_CS_IRDA_GET_CLASS_DESC 6
  15. /*-------------------------------------------------------------------------*/
  16. /* Class-Specific descriptor */
  17. #define USB_DT_CS_IRDA 0x21
  18. /*-------------------------------------------------------------------------*/
  19. /* Data sizes */
  20. #define USB_IRDA_DS_2048 (1 << 5)
  21. #define USB_IRDA_DS_1024 (1 << 4)
  22. #define USB_IRDA_DS_512 (1 << 3)
  23. #define USB_IRDA_DS_256 (1 << 2)
  24. #define USB_IRDA_DS_128 (1 << 1)
  25. #define USB_IRDA_DS_64 (1 << 0)
  26. /* Window sizes */
  27. #define USB_IRDA_WS_7 (1 << 6)
  28. #define USB_IRDA_WS_6 (1 << 5)
  29. #define USB_IRDA_WS_5 (1 << 4)
  30. #define USB_IRDA_WS_4 (1 << 3)
  31. #define USB_IRDA_WS_3 (1 << 2)
  32. #define USB_IRDA_WS_2 (1 << 1)
  33. #define USB_IRDA_WS_1 (1 << 0)
  34. /* Min turnaround times in usecs */
  35. #define USB_IRDA_MTT_0 (1 << 7)
  36. #define USB_IRDA_MTT_10 (1 << 6)
  37. #define USB_IRDA_MTT_50 (1 << 5)
  38. #define USB_IRDA_MTT_100 (1 << 4)
  39. #define USB_IRDA_MTT_500 (1 << 3)
  40. #define USB_IRDA_MTT_1000 (1 << 2)
  41. #define USB_IRDA_MTT_5000 (1 << 1)
  42. #define USB_IRDA_MTT_10000 (1 << 0)
  43. /* Baud rates */
  44. #define USB_IRDA_BR_4000000 (1 << 8)
  45. #define USB_IRDA_BR_1152000 (1 << 7)
  46. #define USB_IRDA_BR_576000 (1 << 6)
  47. #define USB_IRDA_BR_115200 (1 << 5)
  48. #define USB_IRDA_BR_57600 (1 << 4)
  49. #define USB_IRDA_BR_38400 (1 << 3)
  50. #define USB_IRDA_BR_19200 (1 << 2)
  51. #define USB_IRDA_BR_9600 (1 << 1)
  52. #define USB_IRDA_BR_2400 (1 << 0)
  53. /* Additional BOFs */
  54. #define USB_IRDA_AB_0 (1 << 7)
  55. #define USB_IRDA_AB_1 (1 << 6)
  56. #define USB_IRDA_AB_2 (1 << 5)
  57. #define USB_IRDA_AB_3 (1 << 4)
  58. #define USB_IRDA_AB_6 (1 << 3)
  59. #define USB_IRDA_AB_12 (1 << 2)
  60. #define USB_IRDA_AB_24 (1 << 1)
  61. #define USB_IRDA_AB_48 (1 << 0)
  62. /* IRDA Rate Sniff */
  63. #define USB_IRDA_RATE_SNIFF 1
  64. /*-------------------------------------------------------------------------*/
  65. struct usb_irda_cs_descriptor {
  66. __u8 bLength;
  67. __u8 bDescriptorType;
  68. __le16 bcdSpecRevision;
  69. __u8 bmDataSize;
  70. __u8 bmWindowSize;
  71. __u8 bmMinTurnaroundTime;
  72. __le16 wBaudRate;
  73. __u8 bmAdditionalBOFs;
  74. __u8 bIrdaRateSniff;
  75. __u8 bMaxUnicastList;
  76. } __attribute__ ((packed));
  77. /*-------------------------------------------------------------------------*/
  78. /* Data Format */
  79. #define USB_IRDA_STATUS_MEDIA_BUSY (1 << 7)
  80. /* The following is a 4-bit value used for both
  81. * inbound and outbound headers:
  82. *
  83. * 0 - speed ignored
  84. * 1 - 2400 bps
  85. * 2 - 9600 bps
  86. * 3 - 19200 bps
  87. * 4 - 38400 bps
  88. * 5 - 57600 bps
  89. * 6 - 115200 bps
  90. * 7 - 576000 bps
  91. * 8 - 1.152 Mbps
  92. * 9 - 5 mbps
  93. * 10..15 - Reserved
  94. */
  95. #define USB_IRDA_STATUS_LINK_SPEED 0x0f
  96. /* The following is a 4-bit value used only for
  97. * outbound header:
  98. *
  99. * 0 - No change (BOF ignored)
  100. * 1 - 48 BOFs
  101. * 2 - 24 BOFs
  102. * 3 - 12 BOFs
  103. * 4 - 6 BOFs
  104. * 5 - 3 BOFs
  105. * 6 - 2 BOFs
  106. * 7 - 1 BOFs
  107. * 8 - 0 BOFs
  108. * 9..15 - Reserved
  109. */
  110. #define USB_IRDA_EXTRA_BOFS 0xf0
  111. struct usb_irda_inbound_header {
  112. __u8 bmStatus;
  113. };
  114. struct usb_irda_outbound_header {
  115. __u8 bmChange;
  116. };
  117. #endif /* __LINUX_USB_IRDA_H */