[CMAKE]
[reactos.git] / include / psdk / usbdi.h
1 /*
2 * usbdi.h
3 *
4 * USBD and USB device driver definitions
5 *
6 * FIXME : Obsolete header.. Use usb.h instead.
7 *
8 * This file is part of the ReactOS PSDK package.
9 *
10 * Contributors:
11 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
12 *
13 * THIS SOFTWARE IS NOT COPYRIGHTED
14 *
15 * This source code is offered for use in the public domain. You may
16 * use, modify or distribute it freely.
17 *
18 * This code is distributed in the hope that it will be useful but
19 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
20 * DISCLAIMED. This includes but is not limited to warranties of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22 *
23 */
24
25 #pragma once
26
27 /* Helper macro to enable gcc's extension. */
28 #ifndef __GNU_EXTENSION
29 #ifdef __GNUC__
30 #define __GNU_EXTENSION __extension__
31 #else
32 #define __GNU_EXTENSION
33 #endif
34 #endif
35
36 #include <usb.h>
37 #include <usbioctl.h>
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42
43 #define USBD_STATUS_CANCELLING ((USBD_STATUS)0x00020000L)
44 #define USBD_STATUS_CANCELING ((USBD_STATUS)0x00020000L)
45 #define USBD_STATUS_NO_MEMORY ((USBD_STATUS)0x80000100L)
46 #define USBD_STATUS_ERROR ((USBD_STATUS)0x80000000L)
47 #define USBD_STATUS_REQUEST_FAILED ((USBD_STATUS)0x80000500L)
48 #define USBD_STATUS_HALTED ((USBD_STATUS)0xC0000000L)
49
50
51 #define USBD_HALTED(Status) ((ULONG)(Status) >> 30 == 3)
52 #define USBD_STATUS(Status) ((ULONG)(Status) & 0x0FFFFFFFL)
53
54 #define URB_FUNCTION_RESERVED0 0x0016
55 #define URB_FUNCTION_RESERVED 0x001D
56 #define URB_FUNCTION_LAST 0x0029
57
58 #define USBD_PF_DOUBLE_BUFFER 0x00000002
59
60 #ifdef USBD_PF_VALID_MASK
61 #undef USBD_PF_VALID_MASK
62 #endif
63
64 #define USBD_PF_VALID_MASK (USBD_PF_CHANGE_MAX_PACKET | USBD_PF_DOUBLE_BUFFER | \
65 USBD_PF_ENABLE_RT_THREAD_ACCESS | USBD_PF_MAP_ADD_TRANSFERS)
66
67 #define USBD_TRANSFER_DIRECTION_BIT 0
68 #define USBD_SHORT_TRANSFER_OK_BIT 1
69 #define USBD_START_ISO_TRANSFER_ASAP_BIT 2
70
71 #ifdef USBD_TRANSFER_DIRECTION
72 #undef USBD_TRANSFER_DIRECTION
73 #endif
74
75 #define USBD_TRANSFER_DIRECTION(x) ((x) & USBD_TRANSFER_DIRECTION_IN)
76
77 #ifdef __cplusplus
78 }
79 #endif