~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/uapi/linux/usb/functionfs.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/uapi/linux/usb/functionfs.h (Architecture ppc) and /include/uapi/linux/usb/functionfs.h (Architecture mips)


  1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux      1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2 #ifndef _UAPI__LINUX_FUNCTIONFS_H__                 2 #ifndef _UAPI__LINUX_FUNCTIONFS_H__
  3 #define _UAPI__LINUX_FUNCTIONFS_H__                 3 #define _UAPI__LINUX_FUNCTIONFS_H__
  4                                                     4 
  5                                                     5 
  6 #include <linux/const.h>                            6 #include <linux/const.h>
  7 #include <linux/types.h>                            7 #include <linux/types.h>
  8 #include <linux/ioctl.h>                            8 #include <linux/ioctl.h>
  9                                                     9 
 10 #include <linux/usb/ch9.h>                         10 #include <linux/usb/ch9.h>
 11                                                    11 
 12                                                    12 
 13 enum {                                             13 enum {
 14         FUNCTIONFS_DESCRIPTORS_MAGIC = 1,          14         FUNCTIONFS_DESCRIPTORS_MAGIC = 1,
 15         FUNCTIONFS_STRINGS_MAGIC = 2,              15         FUNCTIONFS_STRINGS_MAGIC = 2,
 16         FUNCTIONFS_DESCRIPTORS_MAGIC_V2 = 3,       16         FUNCTIONFS_DESCRIPTORS_MAGIC_V2 = 3,
 17 };                                                 17 };
 18                                                    18 
 19 enum functionfs_flags {                            19 enum functionfs_flags {
 20         FUNCTIONFS_HAS_FS_DESC = 1,                20         FUNCTIONFS_HAS_FS_DESC = 1,
 21         FUNCTIONFS_HAS_HS_DESC = 2,                21         FUNCTIONFS_HAS_HS_DESC = 2,
 22         FUNCTIONFS_HAS_SS_DESC = 4,                22         FUNCTIONFS_HAS_SS_DESC = 4,
 23         FUNCTIONFS_HAS_MS_OS_DESC = 8,             23         FUNCTIONFS_HAS_MS_OS_DESC = 8,
 24         FUNCTIONFS_VIRTUAL_ADDR = 16,              24         FUNCTIONFS_VIRTUAL_ADDR = 16,
 25         FUNCTIONFS_EVENTFD = 32,                   25         FUNCTIONFS_EVENTFD = 32,
 26         FUNCTIONFS_ALL_CTRL_RECIP = 64,            26         FUNCTIONFS_ALL_CTRL_RECIP = 64,
 27         FUNCTIONFS_CONFIG0_SETUP = 128,            27         FUNCTIONFS_CONFIG0_SETUP = 128,
 28 };                                                 28 };
 29                                                    29 
 30 /* Descriptor of an non-audio endpoint */          30 /* Descriptor of an non-audio endpoint */
 31 struct usb_endpoint_descriptor_no_audio {          31 struct usb_endpoint_descriptor_no_audio {
 32         __u8  bLength;                             32         __u8  bLength;
 33         __u8  bDescriptorType;                     33         __u8  bDescriptorType;
 34                                                    34 
 35         __u8  bEndpointAddress;                    35         __u8  bEndpointAddress;
 36         __u8  bmAttributes;                        36         __u8  bmAttributes;
 37         __le16 wMaxPacketSize;                     37         __le16 wMaxPacketSize;
 38         __u8  bInterval;                           38         __u8  bInterval;
 39 } __attribute__((packed));                         39 } __attribute__((packed));
 40                                                    40 
 41 /**                                                41 /**
 42  * struct usb_dfu_functional_descriptor - DFU      42  * struct usb_dfu_functional_descriptor - DFU Functional descriptor
 43  * @bLength:            Size of the descriptor     43  * @bLength:            Size of the descriptor (bytes)
 44  * @bDescriptorType:    USB_DT_DFU_FUNCTIONAL      44  * @bDescriptorType:    USB_DT_DFU_FUNCTIONAL
 45  * @bmAttributes:       DFU attributes             45  * @bmAttributes:       DFU attributes
 46  * @wDetachTimeOut:     Maximum time to wait a     46  * @wDetachTimeOut:     Maximum time to wait after DFU_DETACH (ms, le16)
 47  * @wTransferSize:      Maximum number of byte     47  * @wTransferSize:      Maximum number of bytes per control-write (le16)
 48  * @bcdDFUVersion:      DFU Spec version (BCD,     48  * @bcdDFUVersion:      DFU Spec version (BCD, le16)
 49  */                                                49  */
 50 struct usb_dfu_functional_descriptor {             50 struct usb_dfu_functional_descriptor {
 51         __u8  bLength;                             51         __u8  bLength;
 52         __u8  bDescriptorType;                     52         __u8  bDescriptorType;
 53         __u8  bmAttributes;                        53         __u8  bmAttributes;
 54         __le16 wDetachTimeOut;                     54         __le16 wDetachTimeOut;
 55         __le16 wTransferSize;                      55         __le16 wTransferSize;
 56         __le16 bcdDFUVersion;                      56         __le16 bcdDFUVersion;
 57 } __attribute__ ((packed));                        57 } __attribute__ ((packed));
 58                                                    58 
 59 /* from DFU functional descriptor bmAttributes     59 /* from DFU functional descriptor bmAttributes */
 60 #define DFU_FUNC_ATT_CAN_DOWNLOAD       _BITUL     60 #define DFU_FUNC_ATT_CAN_DOWNLOAD       _BITUL(0)
 61 #define DFU_FUNC_ATT_CAN_UPLOAD         _BITUL     61 #define DFU_FUNC_ATT_CAN_UPLOAD         _BITUL(1)
 62 #define DFU_FUNC_ATT_MANIFEST_TOLERANT  _BITUL     62 #define DFU_FUNC_ATT_MANIFEST_TOLERANT  _BITUL(2)
 63 #define DFU_FUNC_ATT_WILL_DETACH        _BITUL     63 #define DFU_FUNC_ATT_WILL_DETACH        _BITUL(3)
 64                                                    64 
 65                                                    65 
 66 struct usb_functionfs_descs_head_v2 {              66 struct usb_functionfs_descs_head_v2 {
 67         __le32 magic;                              67         __le32 magic;
 68         __le32 length;                             68         __le32 length;
 69         __le32 flags;                              69         __le32 flags;
 70         /*                                         70         /*
 71          * __le32 fs_count, hs_count, fs_count     71          * __le32 fs_count, hs_count, fs_count; must be included manually in
 72          * the structure taking flags into con     72          * the structure taking flags into consideration.
 73          */                                        73          */
 74 } __attribute__((packed));                         74 } __attribute__((packed));
 75                                                    75 
 76 /* Legacy format, deprecated as of 3.14. */        76 /* Legacy format, deprecated as of 3.14. */
 77 struct usb_functionfs_descs_head {                 77 struct usb_functionfs_descs_head {
 78         __le32 magic;                              78         __le32 magic;
 79         __le32 length;                             79         __le32 length;
 80         __le32 fs_count;                           80         __le32 fs_count;
 81         __le32 hs_count;                           81         __le32 hs_count;
 82 } __attribute__((packed, deprecated));             82 } __attribute__((packed, deprecated));
 83                                                    83 
 84 /* MS OS Descriptor header */                      84 /* MS OS Descriptor header */
 85 struct usb_os_desc_header {                        85 struct usb_os_desc_header {
 86         __u8    interface;                         86         __u8    interface;
 87         __le32  dwLength;                          87         __le32  dwLength;
 88         __le16  bcdVersion;                        88         __le16  bcdVersion;
 89         __le16  wIndex;                            89         __le16  wIndex;
 90         union {                                    90         union {
 91                 struct {                           91                 struct {
 92                         __u8    bCount;            92                         __u8    bCount;
 93                         __u8    Reserved;          93                         __u8    Reserved;
 94                 };                                 94                 };
 95                 __le16  wCount;                    95                 __le16  wCount;
 96         };                                         96         };
 97 } __attribute__((packed));                         97 } __attribute__((packed));
 98                                                    98 
 99 struct usb_ext_compat_desc {                       99 struct usb_ext_compat_desc {
100         __u8    bFirstInterfaceNumber;            100         __u8    bFirstInterfaceNumber;
101         __u8    Reserved1;                        101         __u8    Reserved1;
102         __struct_group(/* no tag */, IDs, /* n    102         __struct_group(/* no tag */, IDs, /* no attrs */,
103                 __u8    CompatibleID[8];          103                 __u8    CompatibleID[8];
104                 __u8    SubCompatibleID[8];       104                 __u8    SubCompatibleID[8];
105         );                                        105         );
106         __u8    Reserved2[6];                     106         __u8    Reserved2[6];
107 };                                                107 };
108                                                   108 
109 struct usb_ext_prop_desc {                        109 struct usb_ext_prop_desc {
110         __le32  dwSize;                           110         __le32  dwSize;
111         __le32  dwPropertyDataType;               111         __le32  dwPropertyDataType;
112         __le16  wPropertyNameLength;              112         __le16  wPropertyNameLength;
113 } __attribute__((packed));                        113 } __attribute__((packed));
114                                                   114 
115 /* Flags for usb_ffs_dmabuf_transfer_req->flag    115 /* Flags for usb_ffs_dmabuf_transfer_req->flags (none for now) */
116 #define USB_FFS_DMABUF_TRANSFER_MASK    0x0       116 #define USB_FFS_DMABUF_TRANSFER_MASK    0x0
117                                                   117 
118 /**                                               118 /**
119  * struct usb_ffs_dmabuf_transfer_req - Transf    119  * struct usb_ffs_dmabuf_transfer_req - Transfer request for a DMABUF object
120  * @fd:         file descriptor of the DMABUF     120  * @fd:         file descriptor of the DMABUF object
121  * @flags:      one or more USB_FFS_DMABUF_TRA    121  * @flags:      one or more USB_FFS_DMABUF_TRANSFER_* flags
122  * @length:     number of bytes used in this D    122  * @length:     number of bytes used in this DMABUF for the data transfer.
123  *              Should generally be set to the    123  *              Should generally be set to the DMABUF's size.
124  */                                               124  */
125 struct usb_ffs_dmabuf_transfer_req {              125 struct usb_ffs_dmabuf_transfer_req {
126         int fd;                                   126         int fd;
127         __u32 flags;                              127         __u32 flags;
128         __u64 length;                             128         __u64 length;
129 } __attribute__((packed));                        129 } __attribute__((packed));
130                                                   130 
131 #ifndef __KERNEL__                                131 #ifndef __KERNEL__
132                                                   132 
133 /**                                               133 /**
134  * DOC: descriptors                               134  * DOC: descriptors
135  *                                                135  *
136  * Descriptors format:                            136  * Descriptors format:
137  *                                                137  *
138  * +-----+-----------+--------------+---------    138  * +-----+-----------+--------------+--------------------------------------+
139  * | off | name      | type         | descript    139  * | off | name      | type         | description                          |
140  * +-----+-----------+--------------+---------    140  * +-----+-----------+--------------+--------------------------------------+
141  * |   0 | magic     | LE32         | FUNCTION    141  * |   0 | magic     | LE32         | FUNCTIONFS_DESCRIPTORS_MAGIC_V2      |
142  * +-----+-----------+--------------+---------    142  * +-----+-----------+--------------+--------------------------------------+
143  * |   4 | length    | LE32         | length o    143  * |   4 | length    | LE32         | length of the whole data chunk       |
144  * +-----+-----------+--------------+---------    144  * +-----+-----------+--------------+--------------------------------------+
145  * |   8 | flags     | LE32         | combinat    145  * |   8 | flags     | LE32         | combination of functionfs_flags      |
146  * +-----+-----------+--------------+---------    146  * +-----+-----------+--------------+--------------------------------------+
147  * |     | eventfd   | LE32         | eventfd     147  * |     | eventfd   | LE32         | eventfd file descriptor              |
148  * +-----+-----------+--------------+---------    148  * +-----+-----------+--------------+--------------------------------------+
149  * |     | fs_count  | LE32         | number o    149  * |     | fs_count  | LE32         | number of full-speed descriptors     |
150  * +-----+-----------+--------------+---------    150  * +-----+-----------+--------------+--------------------------------------+
151  * |     | hs_count  | LE32         | number o    151  * |     | hs_count  | LE32         | number of high-speed descriptors     |
152  * +-----+-----------+--------------+---------    152  * +-----+-----------+--------------+--------------------------------------+
153  * |     | ss_count  | LE32         | number o    153  * |     | ss_count  | LE32         | number of super-speed descriptors    |
154  * +-----+-----------+--------------+---------    154  * +-----+-----------+--------------+--------------------------------------+
155  * |     | os_count  | LE32         | number o    155  * |     | os_count  | LE32         | number of MS OS descriptors          |
156  * +-----+-----------+--------------+---------    156  * +-----+-----------+--------------+--------------------------------------+
157  * |     | fs_descrs | Descriptor[] | list of     157  * |     | fs_descrs | Descriptor[] | list of full-speed descriptors       |
158  * +-----+-----------+--------------+---------    158  * +-----+-----------+--------------+--------------------------------------+
159  * |     | hs_descrs | Descriptor[] | list of     159  * |     | hs_descrs | Descriptor[] | list of high-speed descriptors       |
160  * +-----+-----------+--------------+---------    160  * +-----+-----------+--------------+--------------------------------------+
161  * |     | ss_descrs | Descriptor[] | list of     161  * |     | ss_descrs | Descriptor[] | list of super-speed descriptors      |
162  * +-----+-----------+--------------+---------    162  * +-----+-----------+--------------+--------------------------------------+
163  * |     | os_descrs | OSDesc[]     | list of     163  * |     | os_descrs | OSDesc[]     | list of MS OS descriptors            |
164  * +-----+-----------+--------------+---------    164  * +-----+-----------+--------------+--------------------------------------+
165  *                                                165  *
166  * Depending on which flags are set, various f    166  * Depending on which flags are set, various fields may be missing in the
167  * structure.  Any flags that are not recognis    167  * structure.  Any flags that are not recognised cause the whole block to be
168  * rejected with -ENOSYS.                         168  * rejected with -ENOSYS.
169  *                                                169  *
170  * Legacy descriptors format (deprecated as of    170  * Legacy descriptors format (deprecated as of 3.14):
171  *                                                171  *
172  * +-----+-----------+--------------+---------    172  * +-----+-----------+--------------+--------------------------------------+
173  * | off | name      | type         | descript    173  * | off | name      | type         | description                          |
174  * +-----+-----------+--------------+---------    174  * +-----+-----------+--------------+--------------------------------------+
175  * |   0 | magic     | LE32         | FUNCTION    175  * |   0 | magic     | LE32         | FUNCTIONFS_DESCRIPTORS_MAGIC         |
176  * +-----+-----------+--------------+---------    176  * +-----+-----------+--------------+--------------------------------------+
177  * |   4 | length    | LE32         | length o    177  * |   4 | length    | LE32         | length of the whole data chunk       |
178  * +-----+-----------+--------------+---------    178  * +-----+-----------+--------------+--------------------------------------+
179  * |   8 | fs_count  | LE32         | number o    179  * |   8 | fs_count  | LE32         | number of full-speed descriptors     |
180  * +-----+-----------+--------------+---------    180  * +-----+-----------+--------------+--------------------------------------+
181  * |  12 | hs_count  | LE32         | number o    181  * |  12 | hs_count  | LE32         | number of high-speed descriptors     |
182  * +-----+-----------+--------------+---------    182  * +-----+-----------+--------------+--------------------------------------+
183  * |  16 | fs_descrs | Descriptor[] | list of     183  * |  16 | fs_descrs | Descriptor[] | list of full-speed descriptors       |
184  * +-----+-----------+--------------+---------    184  * +-----+-----------+--------------+--------------------------------------+
185  * |     | hs_descrs | Descriptor[] | list of     185  * |     | hs_descrs | Descriptor[] | list of high-speed descriptors       |
186  * +-----+-----------+--------------+---------    186  * +-----+-----------+--------------+--------------------------------------+
187  *                                                187  *
188  * All numbers must be in little endian order.    188  * All numbers must be in little endian order.
189  *                                                189  *
190  * Descriptor[] is an array of valid USB descr    190  * Descriptor[] is an array of valid USB descriptors which have the following
191  * format:                                        191  * format:
192  *                                                192  *
193  * +-----+-----------------+------+-----------    193  * +-----+-----------------+------+--------------------------+
194  * | off | name            | type | descriptio    194  * | off | name            | type | description              |
195  * +-----+-----------------+------+-----------    195  * +-----+-----------------+------+--------------------------+
196  * |   0 | bLength         | U8   | length of     196  * |   0 | bLength         | U8   | length of the descriptor |
197  * +-----+-----------------+------+-----------    197  * +-----+-----------------+------+--------------------------+
198  * |   1 | bDescriptorType | U8   | descriptor    198  * |   1 | bDescriptorType | U8   | descriptor type          |
199  * +-----+-----------------+------+-----------    199  * +-----+-----------------+------+--------------------------+
200  * |   2 | payload         |      | descriptor    200  * |   2 | payload         |      | descriptor's payload     |
201  * +-----+-----------------+------+-----------    201  * +-----+-----------------+------+--------------------------+
202  *                                                202  *
203  * OSDesc[] is an array of valid MS OS Feature    203  * OSDesc[] is an array of valid MS OS Feature Descriptors which have one of
204  * the following formats:                         204  * the following formats:
205  *                                                205  *
206  * +-----+-----------------+------+-----------    206  * +-----+-----------------+------+--------------------------+
207  * | off | name            | type | descriptio    207  * | off | name            | type | description              |
208  * +-----+-----------------+------+-----------    208  * +-----+-----------------+------+--------------------------+
209  * |   0 | inteface        | U8   | related in    209  * |   0 | inteface        | U8   | related interface number |
210  * +-----+-----------------+------+-----------    210  * +-----+-----------------+------+--------------------------+
211  * |   1 | dwLength        | U32  | length of     211  * |   1 | dwLength        | U32  | length of the descriptor |
212  * +-----+-----------------+------+-----------    212  * +-----+-----------------+------+--------------------------+
213  * |   5 | bcdVersion      | U16  | currently     213  * |   5 | bcdVersion      | U16  | currently supported: 1   |
214  * +-----+-----------------+------+-----------    214  * +-----+-----------------+------+--------------------------+
215  * |   7 | wIndex          | U16  | currently     215  * |   7 | wIndex          | U16  | currently supported: 4   |
216  * +-----+-----------------+------+-----------    216  * +-----+-----------------+------+--------------------------+
217  * |   9 | bCount          | U8   | number of     217  * |   9 | bCount          | U8   | number of ext. compat.   |
218  * +-----+-----------------+------+-----------    218  * +-----+-----------------+------+--------------------------+
219  * |  10 | Reserved        | U8   | 0             219  * |  10 | Reserved        | U8   | 0                        |
220  * +-----+-----------------+------+-----------    220  * +-----+-----------------+------+--------------------------+
221  * |  11 | ExtCompat[]     |      | list of ex    221  * |  11 | ExtCompat[]     |      | list of ext. compat. d.  |
222  * +-----+-----------------+------+-----------    222  * +-----+-----------------+------+--------------------------+
223  *                                                223  *
224  * +-----+-----------------+------+-----------    224  * +-----+-----------------+------+--------------------------+
225  * | off | name            | type | descriptio    225  * | off | name            | type | description              |
226  * +-----+-----------------+------+-----------    226  * +-----+-----------------+------+--------------------------+
227  * |   0 | inteface        | U8   | related in    227  * |   0 | inteface        | U8   | related interface number |
228  * +-----+-----------------+------+-----------    228  * +-----+-----------------+------+--------------------------+
229  * |   1 | dwLength        | U32  | length of     229  * |   1 | dwLength        | U32  | length of the descriptor |
230  * +-----+-----------------+------+-----------    230  * +-----+-----------------+------+--------------------------+
231  * |   5 | bcdVersion      | U16  | currently     231  * |   5 | bcdVersion      | U16  | currently supported: 1   |
232  * +-----+-----------------+------+-----------    232  * +-----+-----------------+------+--------------------------+
233  * |   7 | wIndex          | U16  | currently     233  * |   7 | wIndex          | U16  | currently supported: 5   |
234  * +-----+-----------------+------+-----------    234  * +-----+-----------------+------+--------------------------+
235  * |   9 | wCount          | U16  | number of     235  * |   9 | wCount          | U16  | number of ext. compat.   |
236  * +-----+-----------------+------+-----------    236  * +-----+-----------------+------+--------------------------+
237  * |  11 | ExtProp[]       |      | list of ex    237  * |  11 | ExtProp[]       |      | list of ext. prop. d.    |
238  * +-----+-----------------+------+-----------    238  * +-----+-----------------+------+--------------------------+
239  *                                                239  *
240  * ExtCompat[] is an array of valid Extended C    240  * ExtCompat[] is an array of valid Extended Compatiblity descriptors
241  * which have the following format:               241  * which have the following format:
242  *                                                242  *
243  * +-----+-----------------------+------+-----    243  * +-----+-----------------------+------+-------------------------------------+
244  * | off | name                  | type | desc    244  * | off | name                  | type | description                         |
245  * +-----+-----------------------+------+-----    245  * +-----+-----------------------+------+-------------------------------------+
246  * |   0 | bFirstInterfaceNumber | U8   | inde    246  * |   0 | bFirstInterfaceNumber | U8   | index of the interface or of the 1st|
247  * +-----+-----------------------+------+-----    247  * +-----+-----------------------+------+-------------------------------------+
248  * |     |                       |      | inte    248  * |     |                       |      | interface in an IAD group           |
249  * +-----+-----------------------+------+-----    249  * +-----+-----------------------+------+-------------------------------------+
250  * |   1 | Reserved              | U8   | 1       250  * |   1 | Reserved              | U8   | 1                                   |
251  * +-----+-----------------------+------+-----    251  * +-----+-----------------------+------+-------------------------------------+
252  * |   2 | CompatibleID          | U8[8]| comp    252  * |   2 | CompatibleID          | U8[8]| compatible ID string                |
253  * +-----+-----------------------+------+-----    253  * +-----+-----------------------+------+-------------------------------------+
254  * |  10 | SubCompatibleID       | U8[8]| subc    254  * |  10 | SubCompatibleID       | U8[8]| subcompatible ID string             |
255  * +-----+-----------------------+------+-----    255  * +-----+-----------------------+------+-------------------------------------+
256  * |  18 | Reserved              | U8[6]| 0       256  * |  18 | Reserved              | U8[6]| 0                                   |
257  * +-----+-----------------------+------+-----    257  * +-----+-----------------------+------+-------------------------------------+
258  *                                                258  *
259  * ExtProp[] is an array of valid Extended Pro    259  * ExtProp[] is an array of valid Extended Properties descriptors
260  * which have the following format:               260  * which have the following format:
261  *                                                261  *
262  * +-----+-----------------------+------+-----    262  * +-----+-----------------------+------+-------------------------------------+
263  * | off | name                  | type | desc    263  * | off | name                  | type | description                         |
264  * +-----+-----------------------+------+-----    264  * +-----+-----------------------+------+-------------------------------------+
265  * |   0 | dwSize                | U32  | leng    265  * |   0 | dwSize                | U32  | length of the descriptor            |
266  * +-----+-----------------------+------+-----    266  * +-----+-----------------------+------+-------------------------------------+
267  * |   4 | dwPropertyDataType    | U32  | 1..7    267  * |   4 | dwPropertyDataType    | U32  | 1..7                                |
268  * +-----+-----------------------+------+-----    268  * +-----+-----------------------+------+-------------------------------------+
269  * |   8 | wPropertyNameLength   | U16  | bPro    269  * |   8 | wPropertyNameLength   | U16  | bPropertyName length (NL)           |
270  * +-----+-----------------------+------+-----    270  * +-----+-----------------------+------+-------------------------------------+
271  * |  10 | bPropertyName         |U8[NL]| name    271  * |  10 | bPropertyName         |U8[NL]| name of this property               |
272  * +-----+-----------------------+------+-----    272  * +-----+-----------------------+------+-------------------------------------+
273  * |10+NL| dwPropertyDataLength  | U32  | bPro    273  * |10+NL| dwPropertyDataLength  | U32  | bPropertyData length (DL)           |
274  * +-----+-----------------------+------+-----    274  * +-----+-----------------------+------+-------------------------------------+
275  * |14+NL| bProperty             |U8[DL]| payl    275  * |14+NL| bProperty             |U8[DL]| payload of this property            |
276  * +-----+-----------------------+------+-----    276  * +-----+-----------------------+------+-------------------------------------+
277  */                                               277  */
278                                                   278 
279 struct usb_functionfs_strings_head {              279 struct usb_functionfs_strings_head {
280         __le32 magic;                             280         __le32 magic;
281         __le32 length;                            281         __le32 length;
282         __le32 str_count;                         282         __le32 str_count;
283         __le32 lang_count;                        283         __le32 lang_count;
284 } __attribute__((packed));                        284 } __attribute__((packed));
285                                                   285 
286 /*                                                286 /*
287  * Strings format:                                287  * Strings format:
288  *                                                288  *
289  * | off | name       | type                      289  * | off | name       | type                  | description                |
290  * |-----+------------+-----------------------    290  * |-----+------------+-----------------------+----------------------------|
291  * |   0 | magic      | LE32                      291  * |   0 | magic      | LE32                  | FUNCTIONFS_STRINGS_MAGIC   |
292  * |   4 | length     | LE32                      292  * |   4 | length     | LE32                  | length of the data chunk   |
293  * |   8 | str_count  | LE32                      293  * |   8 | str_count  | LE32                  | number of strings          |
294  * |  12 | lang_count | LE32                      294  * |  12 | lang_count | LE32                  | number of languages        |
295  * |  16 | stringtab  | StringTab[lang_count]     295  * |  16 | stringtab  | StringTab[lang_count] | table of strings per lang  |
296  *                                                296  *
297  * For each language there is one stringtab en    297  * For each language there is one stringtab entry (ie. there are lang_count
298  * stringtab entires).  Each StringTab has fol    298  * stringtab entires).  Each StringTab has following format:
299  *                                                299  *
300  * | off | name    | type              | descr    300  * | off | name    | type              | description                        |
301  * |-----+---------+-------------------+------    301  * |-----+---------+-------------------+------------------------------------|
302  * |   0 | lang    | LE16              | langu    302  * |   0 | lang    | LE16              | language code                      |
303  * |   2 | strings | String[str_count] | array    303  * |   2 | strings | String[str_count] | array of strings in given language |
304  *                                                304  *
305  * For each string there is one strings entry     305  * For each string there is one strings entry (ie. there are str_count
306  * string entries).  Each String is a NUL term    306  * string entries).  Each String is a NUL terminated string encoded in
307  * UTF-8.                                         307  * UTF-8.
308  */                                               308  */
309                                                   309 
310 #endif                                            310 #endif
311                                                   311 
312                                                   312 
313 /*                                                313 /*
314  * Events are delivered on the ep0 file descri    314  * Events are delivered on the ep0 file descriptor, when the user mode driver
315  * reads from this file descriptor after writi    315  * reads from this file descriptor after writing the descriptors.  Don't
316  * stop polling this descriptor.                  316  * stop polling this descriptor.
317  */                                               317  */
318                                                   318 
319 enum usb_functionfs_event_type {                  319 enum usb_functionfs_event_type {
320         FUNCTIONFS_BIND,                          320         FUNCTIONFS_BIND,
321         FUNCTIONFS_UNBIND,                        321         FUNCTIONFS_UNBIND,
322                                                   322 
323         FUNCTIONFS_ENABLE,                        323         FUNCTIONFS_ENABLE,
324         FUNCTIONFS_DISABLE,                       324         FUNCTIONFS_DISABLE,
325                                                   325 
326         FUNCTIONFS_SETUP,                         326         FUNCTIONFS_SETUP,
327                                                   327 
328         FUNCTIONFS_SUSPEND,                       328         FUNCTIONFS_SUSPEND,
329         FUNCTIONFS_RESUME                         329         FUNCTIONFS_RESUME
330 };                                                330 };
331                                                   331 
332 /* NOTE:  this structure must stay the same si    332 /* NOTE:  this structure must stay the same size and layout on
333  * both 32-bit and 64-bit kernels.                333  * both 32-bit and 64-bit kernels.
334  */                                               334  */
335 struct usb_functionfs_event {                     335 struct usb_functionfs_event {
336         union {                                   336         union {
337                 /* SETUP: packet; DATA phase i    337                 /* SETUP: packet; DATA phase i/o precedes next event
338                  *(setup.bmRequestType & USB_D    338                  *(setup.bmRequestType & USB_DIR_IN) flags direction */
339                 struct usb_ctrlrequest  setup;    339                 struct usb_ctrlrequest  setup;
340         } __attribute__((packed)) u;              340         } __attribute__((packed)) u;
341                                                   341 
342         /* enum usb_functionfs_event_type */      342         /* enum usb_functionfs_event_type */
343         __u8                            type;     343         __u8                            type;
344         __u8                            _pad[3    344         __u8                            _pad[3];
345 } __attribute__((packed));                        345 } __attribute__((packed));
346                                                   346 
347                                                   347 
348 /* Endpoint ioctls */                             348 /* Endpoint ioctls */
349 /* The same as in gadgetfs */                     349 /* The same as in gadgetfs */
350                                                   350 
351 /* IN transfers may be reported to the gadget     351 /* IN transfers may be reported to the gadget driver as complete
352  *      when the fifo is loaded, before the ho    352  *      when the fifo is loaded, before the host reads the data;
353  * OUT transfers may be reported to the host's    353  * OUT transfers may be reported to the host's "client" driver as
354  *      complete when they're sitting in the F    354  *      complete when they're sitting in the FIFO unread.
355  * THIS returns how many bytes are "unclaimed"    355  * THIS returns how many bytes are "unclaimed" in the endpoint fifo
356  * (needed for precise fault handling, when th    356  * (needed for precise fault handling, when the hardware allows it)
357  */                                               357  */
358 #define FUNCTIONFS_FIFO_STATUS  _IO('g', 1)       358 #define FUNCTIONFS_FIFO_STATUS  _IO('g', 1)
359                                                   359 
360 /* discards any unclaimed data in the fifo. */    360 /* discards any unclaimed data in the fifo. */
361 #define FUNCTIONFS_FIFO_FLUSH   _IO('g', 2)       361 #define FUNCTIONFS_FIFO_FLUSH   _IO('g', 2)
362                                                   362 
363 /* resets endpoint halt+toggle; used to implem    363 /* resets endpoint halt+toggle; used to implement set_interface.
364  * some hardware (like pxa2xx) can't support t    364  * some hardware (like pxa2xx) can't support this.
365  */                                               365  */
366 #define FUNCTIONFS_CLEAR_HALT   _IO('g', 3)       366 #define FUNCTIONFS_CLEAR_HALT   _IO('g', 3)
367                                                   367 
368 /* Specific for functionfs */                     368 /* Specific for functionfs */
369                                                   369 
370 /*                                                370 /*
371  * Returns reverse mapping of an interface.  C    371  * Returns reverse mapping of an interface.  Called on EP0.  If there
372  * is no such interface returns -EDOM.  If fun    372  * is no such interface returns -EDOM.  If function is not active
373  * returns -ENODEV.                               373  * returns -ENODEV.
374  */                                               374  */
375 #define FUNCTIONFS_INTERFACE_REVMAP     _IO('g    375 #define FUNCTIONFS_INTERFACE_REVMAP     _IO('g', 128)
376                                                   376 
377 /*                                                377 /*
378  * Returns real bEndpointAddress of an endpoin    378  * Returns real bEndpointAddress of an endpoint. If endpoint shuts down
379  * during the call, returns -ESHUTDOWN.           379  * during the call, returns -ESHUTDOWN.
380  */                                               380  */
381 #define FUNCTIONFS_ENDPOINT_REVMAP      _IO('g    381 #define FUNCTIONFS_ENDPOINT_REVMAP      _IO('g', 129)
382                                                   382 
383 /*                                                383 /*
384  * Returns endpoint descriptor. If endpoint sh    384  * Returns endpoint descriptor. If endpoint shuts down during the call,
385  * returns -ESHUTDOWN.                            385  * returns -ESHUTDOWN.
386  */                                               386  */
387 #define FUNCTIONFS_ENDPOINT_DESC        _IOR('    387 #define FUNCTIONFS_ENDPOINT_DESC        _IOR('g', 130, \
388                                              s    388                                              struct usb_endpoint_descriptor)
389                                                   389 
390 /*                                                390 /*
391  * Attach the DMABUF object, identified by its    391  * Attach the DMABUF object, identified by its file descriptor, to the
392  * data endpoint. Returns zero on success, and    392  * data endpoint. Returns zero on success, and a negative errno value
393  * on error.                                      393  * on error.
394  */                                               394  */
395 #define FUNCTIONFS_DMABUF_ATTACH        _IOW('    395 #define FUNCTIONFS_DMABUF_ATTACH        _IOW('g', 131, int)
396                                                   396 
397                                                   397 
398 /*                                                398 /*
399  * Detach the given DMABUF object, identified     399  * Detach the given DMABUF object, identified by its file descriptor,
400  * from the data endpoint. Returns zero on suc    400  * from the data endpoint. Returns zero on success, and a negative
401  * errno value on error. Note that closing the    401  * errno value on error. Note that closing the endpoint's file
402  * descriptor will automatically detach all at    402  * descriptor will automatically detach all attached DMABUFs.
403  */                                               403  */
404 #define FUNCTIONFS_DMABUF_DETACH        _IOW('    404 #define FUNCTIONFS_DMABUF_DETACH        _IOW('g', 132, int)
405                                                   405 
406 /*                                                406 /*
407  * Enqueue the previously attached DMABUF to t    407  * Enqueue the previously attached DMABUF to the transfer queue.
408  * The argument is a structure that packs the     408  * The argument is a structure that packs the DMABUF's file descriptor,
409  * the size in bytes to transfer (which should    409  * the size in bytes to transfer (which should generally correspond to
410  * the size of the DMABUF), and a 'flags' fiel    410  * the size of the DMABUF), and a 'flags' field which is unused
411  * for now. Returns zero on success, and a neg    411  * for now. Returns zero on success, and a negative errno value on
412  * error.                                         412  * error.
413  */                                               413  */
414 #define FUNCTIONFS_DMABUF_TRANSFER      _IOW('    414 #define FUNCTIONFS_DMABUF_TRANSFER      _IOW('g', 133, \
415                                              s    415                                              struct usb_ffs_dmabuf_transfer_req)
416                                                   416 
417 #endif /* _UAPI__LINUX_FUNCTIONFS_H__ */          417 #endif /* _UAPI__LINUX_FUNCTIONFS_H__ */
418                                                   418 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php