Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * USB IrDA Bridge Device Definition
0004  */
0005 
0006 #ifndef __LINUX_USB_IRDA_H
0007 #define __LINUX_USB_IRDA_H
0008 
0009 /* This device should use Application-specific class */
0010 
0011 #define USB_SUBCLASS_IRDA           0x02
0012 
0013 /*-------------------------------------------------------------------------*/
0014 
0015 /* Class-Specific requests (bRequest field) */
0016 
0017 #define USB_REQ_CS_IRDA_RECEIVING       1
0018 #define USB_REQ_CS_IRDA_CHECK_MEDIA_BUSY    3
0019 #define USB_REQ_CS_IRDA_RATE_SNIFF      4
0020 #define USB_REQ_CS_IRDA_UNICAST_LIST        5
0021 #define USB_REQ_CS_IRDA_GET_CLASS_DESC      6
0022 
0023 /*-------------------------------------------------------------------------*/
0024 
0025 /* Class-Specific descriptor */
0026 
0027 #define USB_DT_CS_IRDA              0x21
0028 
0029 /*-------------------------------------------------------------------------*/
0030 
0031 /* Data sizes */
0032 
0033 #define USB_IRDA_DS_2048            (1 << 5)
0034 #define USB_IRDA_DS_1024            (1 << 4)
0035 #define USB_IRDA_DS_512             (1 << 3)
0036 #define USB_IRDA_DS_256             (1 << 2)
0037 #define USB_IRDA_DS_128             (1 << 1)
0038 #define USB_IRDA_DS_64              (1 << 0)
0039 
0040 /* Window sizes */
0041 
0042 #define USB_IRDA_WS_7               (1 << 6)
0043 #define USB_IRDA_WS_6               (1 << 5)
0044 #define USB_IRDA_WS_5               (1 << 4)
0045 #define USB_IRDA_WS_4               (1 << 3)
0046 #define USB_IRDA_WS_3               (1 << 2)
0047 #define USB_IRDA_WS_2               (1 << 1)
0048 #define USB_IRDA_WS_1               (1 << 0)
0049 
0050 /* Min turnaround times in usecs */
0051 
0052 #define USB_IRDA_MTT_0              (1 << 7)
0053 #define USB_IRDA_MTT_10             (1 << 6)
0054 #define USB_IRDA_MTT_50             (1 << 5)
0055 #define USB_IRDA_MTT_100            (1 << 4)
0056 #define USB_IRDA_MTT_500            (1 << 3)
0057 #define USB_IRDA_MTT_1000           (1 << 2)
0058 #define USB_IRDA_MTT_5000           (1 << 1)
0059 #define USB_IRDA_MTT_10000          (1 << 0)
0060 
0061 /* Baud rates */
0062 
0063 #define USB_IRDA_BR_4000000         (1 << 8)
0064 #define USB_IRDA_BR_1152000         (1 << 7)
0065 #define USB_IRDA_BR_576000          (1 << 6)
0066 #define USB_IRDA_BR_115200          (1 << 5)
0067 #define USB_IRDA_BR_57600           (1 << 4)
0068 #define USB_IRDA_BR_38400           (1 << 3)
0069 #define USB_IRDA_BR_19200           (1 << 2)
0070 #define USB_IRDA_BR_9600            (1 << 1)
0071 #define USB_IRDA_BR_2400            (1 << 0)
0072 
0073 /* Additional BOFs */
0074 
0075 #define USB_IRDA_AB_0               (1 << 7)
0076 #define USB_IRDA_AB_1               (1 << 6)
0077 #define USB_IRDA_AB_2               (1 << 5)
0078 #define USB_IRDA_AB_3               (1 << 4)
0079 #define USB_IRDA_AB_6               (1 << 3)
0080 #define USB_IRDA_AB_12              (1 << 2)
0081 #define USB_IRDA_AB_24              (1 << 1)
0082 #define USB_IRDA_AB_48              (1 << 0)
0083 
0084 /* IRDA Rate Sniff */
0085 
0086 #define USB_IRDA_RATE_SNIFF         1
0087 
0088 /*-------------------------------------------------------------------------*/
0089 
0090 struct usb_irda_cs_descriptor {
0091     __u8    bLength;
0092     __u8    bDescriptorType;
0093 
0094     __le16  bcdSpecRevision;
0095     __u8    bmDataSize;
0096     __u8    bmWindowSize;
0097     __u8    bmMinTurnaroundTime;
0098     __le16  wBaudRate;
0099     __u8    bmAdditionalBOFs;
0100     __u8    bIrdaRateSniff;
0101     __u8    bMaxUnicastList;
0102 } __attribute__ ((packed));
0103 
0104 /*-------------------------------------------------------------------------*/
0105 
0106 /* Data Format */
0107 
0108 #define USB_IRDA_STATUS_MEDIA_BUSY  (1 << 7)
0109 
0110 /* The following is a 4-bit value used for both
0111  * inbound and outbound headers:
0112  *
0113  * 0 - speed ignored
0114  * 1 - 2400 bps
0115  * 2 - 9600 bps
0116  * 3 - 19200 bps
0117  * 4 - 38400 bps
0118  * 5 - 57600 bps
0119  * 6 - 115200 bps
0120  * 7 - 576000 bps
0121  * 8 - 1.152 Mbps
0122  * 9 - 4 Mbps
0123  * 10..15 - Reserved
0124  */
0125 #define USB_IRDA_STATUS_LINK_SPEED  0x0f
0126 
0127 #define USB_IRDA_LS_NO_CHANGE       0
0128 #define USB_IRDA_LS_2400        1
0129 #define USB_IRDA_LS_9600        2
0130 #define USB_IRDA_LS_19200       3
0131 #define USB_IRDA_LS_38400       4
0132 #define USB_IRDA_LS_57600       5
0133 #define USB_IRDA_LS_115200      6
0134 #define USB_IRDA_LS_576000      7
0135 #define USB_IRDA_LS_1152000     8
0136 #define USB_IRDA_LS_4000000     9
0137 
0138 /* The following is a 4-bit value used only for
0139  * outbound header:
0140  *
0141  * 0 - No change (BOF ignored)
0142  * 1 - 48 BOFs
0143  * 2 - 24 BOFs
0144  * 3 - 12 BOFs
0145  * 4 - 6 BOFs
0146  * 5 - 3 BOFs
0147  * 6 - 2 BOFs
0148  * 7 - 1 BOFs
0149  * 8 - 0 BOFs
0150  * 9..15 - Reserved
0151  */
0152 #define USB_IRDA_EXTRA_BOFS     0xf0
0153 
0154 struct usb_irda_inbound_header {
0155     __u8        bmStatus;
0156 };
0157 
0158 struct usb_irda_outbound_header {
0159     __u8        bmChange;
0160 };
0161 
0162 #endif /* __LINUX_USB_IRDA_H */
0163