]> git.gir.st - tmk_keyboard.git/blob - protocol/lufa/LUFA-120730/LUFA/Drivers/USB/Core/Endpoint.h
Squashed 'tmk_core/' changes from b9e0ea0..caca2c0
[tmk_keyboard.git] / protocol / lufa / LUFA-120730 / LUFA / Drivers / USB / Core / Endpoint.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2012.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.lufa-lib.org
7 */
8
9 /*
10 Copyright 2012 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 USB Endpoint definitions for all architectures.
33 * \copydetails Group_EndpointManagement
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_EndpointManagement
40 * \defgroup Group_EndpointRW Endpoint Data Reading and Writing
41 * \brief Endpoint data read/write definitions.
42 *
43 * Functions, macros, variables, enums and types related to data reading and writing from and to endpoints.
44 */
45
46 /** \ingroup Group_EndpointRW
47 * \defgroup Group_EndpointPrimitiveRW Read/Write of Primitive Data Types
48 * \brief Endpoint data primitive read/write definitions.
49 *
50 * Functions, macros, variables, enums and types related to data reading and writing of primitive data types
51 * from and to endpoints.
52 */
53
54 /** \ingroup Group_EndpointManagement
55 * \defgroup Group_EndpointPacketManagement Endpoint Packet Management
56 * \brief USB Endpoint package management definitions.
57 *
58 * Functions, macros, variables, enums and types related to packet management of endpoints.
59 */
60
61 /** \ingroup Group_USB
62 * \defgroup Group_EndpointManagement Endpoint Management
63 * \brief Endpoint management definitions.
64 *
65 * Functions, macros and enums related to endpoint management when in USB Device mode. This
66 * module contains the endpoint management macros, as well as endpoint interrupt and data
67 * send/receive functions for various data types.
68 *
69 * @{
70 */
71
72 #ifndef __ENDPOINT_H__
73 #define __ENDPOINT_H__
74
75 /* Includes: */
76 #include "../../../Common/Common.h"
77 #include "USBMode.h"
78
79 /* Enable C linkage for C++ Compilers: */
80 #if defined(__cplusplus)
81 extern "C" {
82 #endif
83
84 /* Preprocessor Checks: */
85 #if !defined(__INCLUDE_FROM_USB_DRIVER)
86 #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
87 #endif
88
89 /* Public Interface - May be used in end-application: */
90 /* Type Defines: */
91 /** Type define for a endpoint table entry, used to configure endpoints in groups via
92 * \ref Endpoint_ConfigureEndpointTable().
93 */
94 typedef struct
95 {
96 uint8_t Address; /**< Address of the endpoint to configure, or zero if the table entry is to be unused. */
97 uint16_t Size; /**< Size of the endpoint bank, in bytes. */
98 uint8_t Type; /**< Type of the endpoint, a \c EP_TYPE_* mask. */
99 uint8_t Banks; /**< Number of hardware banks to use for the endpoint. */
100 } USB_Endpoint_Table_t;
101
102 /* Macros: */
103 /** Endpoint number mask, for masking against endpoint addresses to retrieve the endpoint's
104 * numerical address in the device.
105 */
106 #define ENDPOINT_EPNUM_MASK 0x0F
107
108 /** Endpoint address for the default control endpoint, which always resides in address 0. This is
109 * defined for convenience to give more readable code when used with the endpoint macros.
110 */
111 #define ENDPOINT_CONTROLEP 0
112
113 /* Architecture Includes: */
114 #if (ARCH == ARCH_AVR8)
115 #include "AVR8/Endpoint_AVR8.h"
116 #elif (ARCH == ARCH_UC3)
117 #include "UC3/Endpoint_UC3.h"
118 #elif (ARCH == ARCH_XMEGA)
119 #include "XMEGA/Endpoint_XMEGA.h"
120 #endif
121
122 /* Disable C linkage for C++ Compilers: */
123 #if defined(__cplusplus)
124 }
125 #endif
126
127 #endif
128
129 /** @} */
130
Imprint / Impressum