Removed the ENDPOINT_DESCRIPTOR_DIR_* macros in favour of the shorter ENDPOINT_DIR_...
[pub/USBasp.git] / LUFA / Drivers / USB / Core / USBController.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2011.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7 */
8
9 /*
10 Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
20
21 The author disclaim all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
28 this software.
29 */
30
31 /** \file
32 * \brief Common USB Controller definitions for all architectures.
33 * \copydetails Group_USBManagement
34 *
35 * \note This file should not be included directly. It is automatically included as needed by the USB driver
36 * dispatch header located in LUFA/Drivers/USB/USB.h.
37 */
38
39 /** \ingroup Group_USB
40 * \defgroup Group_USBManagement USB Interface Management
41 * \brief USB Controller definitions for general USB controller management.
42 *
43 * Functions, macros, variables, enums and types related to the setup and management of the USB interface.
44 *
45 * @{
46 */
47
48 #ifndef __USBCONTROLLER_H__
49 #define __USBCONTROLLER_H__
50
51 /* Includes: */
52 #include "../../../Common/Common.h"
53 #include "USBMode.h"
54
55 /* Enable C linkage for C++ Compilers: */
56 #if defined(__cplusplus)
57 extern "C" {
58 #endif
59
60 /* Preprocessor Checks and Defines: */
61 #if !defined(__INCLUDE_FROM_USB_DRIVER)
62 #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
63 #endif
64
65 /* Defines: */
66 /** \name Endpoint Direction Masks */
67 //@{
68 /** Endpoint direction mask, for masking against endpoint addresses to retrieve the endpoint's
69 * direction for comparing with the \c ENDPOINT_DIR_* masks.
70 */
71 #define ENDPOINT_DIR_MASK 0x80
72
73 /** Endpoint address direction mask for an OUT direction (Host to Device) endpoint. This may be ORed with
74 * the index of the address within a device to obtain the full endpoint address.
75 */
76 #define ENDPOINT_DIR_OUT 0x00
77
78 /** Endpoint address direction mask for an IN direction (Device to Host) endpoint. This may be ORed with
79 * the index of the address within a device to obtain the full endpoint address.
80 */
81 #define ENDPOINT_DIR_IN 0x80
82 //@}
83
84 /** \name Endpoint/Pipe Type Masks */
85 //@{
86 /** Mask for determining the type of an endpoint from an endpoint descriptor. This should then be compared
87 * with the \c EP_TYPE_* masks to determine the exact type of the endpoint.
88 */
89 #define EP_TYPE_MASK 0x03
90
91 /** Mask for a CONTROL type endpoint or pipe.
92 *
93 * \note See \ref Group_EndpointManagement and \ref Group_PipeManagement for endpoint/pipe functions.
94 */
95 #define EP_TYPE_CONTROL 0x00
96
97 /** Mask for an ISOCHRONOUS type endpoint or pipe.
98 *
99 * \note See \ref Group_EndpointManagement and \ref Group_PipeManagement for endpoint/pipe functions.
100 */
101 #define EP_TYPE_ISOCHRONOUS 0x01
102
103 /** Mask for a BULK type endpoint or pipe.
104 *
105 * \note See \ref Group_EndpointManagement and \ref Group_PipeManagement for endpoint/pipe functions.
106 */
107 #define EP_TYPE_BULK 0x02
108
109 /** Mask for an INTERRUPT type endpoint or pipe.
110 *
111 * \note See \ref Group_EndpointManagement and \ref Group_PipeManagement for endpoint/pipe functions.
112 */
113 #define EP_TYPE_INTERRUPT 0x03
114 //@}
115
116 /* Architecture Includes: */
117 #if (ARCH == ARCH_AVR8)
118 #include "AVR8/USBController_AVR8.h"
119 #elif (ARCH == ARCH_UC3)
120 #include "UC3/USBController_UC3.h"
121 #elif (ARCH == ARCH_XMEGA)
122 #include "XMEGA/USBController_XMEGA.h"
123 #endif
124
125 /* Disable C linkage for C++ Compilers: */
126 #if defined(__cplusplus)
127 }
128 #endif
129
130 #endif
131
132 /** @} */
133