]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/USBDevice/USBDevice/USBEndpoints_Maxim.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / USBDevice / USBDevice / USBEndpoints_Maxim.h
1 /*******************************************************************************
2  * Copyright (C) 2015 Maxim Integrated Products, Inc., All Rights Reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17  * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
18  * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20  * OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * Except as contained in this notice, the name of Maxim Integrated
23  * Products, Inc. shall not be used except as stated in the Maxim Integrated
24  * Products, Inc. Branding Policy.
25  *
26  * The mere transfer of this software does not imply any licenses
27  * of trade secrets, proprietary technology, copyrights, patents,
28  * trademarks, maskwork rights, or any other form of intellectual
29  * property whatsoever. Maxim Integrated Products, Inc. retains all
30  * ownership rights.
31  *******************************************************************************
32  */
33
34 #define NUMBER_OF_LOGICAL_ENDPOINTS   (8)
35 #define NUMBER_OF_PHYSICAL_ENDPOINTS  (NUMBER_OF_LOGICAL_ENDPOINTS * 2)
36
37 #define DIR_OUT       0x00
38 #define DIR_IN        0x01
39 #define EP_NUM(ep)    (ep >> 1)
40 #define IN_EP(ep)     (ep & DIR_IN)
41 #define OUT_EP(ep)    (!(ep & DIR_IN))
42
43 /* Define physical endpoint numbers */
44
45 /*      Endpoint    No.   */
46 /*      ----------------  */
47 #define EP0OUT      ((0 << 1) | DIR_OUT)
48 #define EP0IN       ((0 << 1) | DIR_IN)
49 #define EP1OUT      ((1 << 1) | DIR_OUT)
50 #define EP1IN       ((1 << 1) | DIR_IN)
51 #define EP2OUT      ((2 << 1) | DIR_OUT)
52 #define EP2IN       ((2 << 1) | DIR_IN)
53 #define EP3OUT      ((3 << 1) | DIR_OUT)
54 #define EP3IN       ((3 << 1) | DIR_IN)
55 #define EP4OUT      ((4 << 1) | DIR_OUT)
56 #define EP4IN       ((4 << 1) | DIR_IN)
57 #define EP5OUT      ((5 << 1) | DIR_OUT)
58 #define EP5IN       ((5 << 1) | DIR_IN)
59 #define EP6OUT      ((6 << 1) | DIR_OUT)
60 #define EP6IN       ((6 << 1) | DIR_IN)
61 #define EP7OUT      ((7 << 1) | DIR_OUT)
62 #define EP7IN       ((7 << 1) | DIR_IN)
63
64 /* Maximum Packet sizes */
65
66 #define MAX_PACKET_SIZE_EP0  (64)
67 #define MAX_PACKET_SIZE_EP1  (64)
68 #define MAX_PACKET_SIZE_EP2  (64)
69 #define MAX_PACKET_SIZE_EP3  (64)
70 #define MAX_PACKET_SIZE_EP4  (64)
71 #define MAX_PACKET_SIZE_EP5  (64)
72 #define MAX_PACKET_SIZE_EP6  (64)
73 #define MAX_PACKET_SIZE_EP7  (64)
74
75 /* Generic endpoints - intended to be portable accross devices */
76 /* and be suitable for simple USB devices. */
77
78 /* Bulk endpoints */
79 #define EPBULK_OUT  (EP1OUT)
80 #define EPBULK_IN   (EP2IN)
81 #define EPBULK_OUT_callback   EP1_OUT_callback
82 #define EPBULK_IN_callback    EP2_IN_callback
83 /* Interrupt endpoints */
84 #define EPINT_OUT   (EP3OUT)
85 #define EPINT_IN    (EP4IN)
86 #define EPINT_OUT_callback    EP3_OUT_callback
87 #define EPINT_IN_callback     EP4_IN_callback
88
89 #define MAX_PACKET_SIZE_EPBULK  (64)
90 #define MAX_PACKET_SIZE_EPINT   (64)