Embedded SDK
Embedded SDK
usbd_hid_impl.h
Go to the documentation of this file.
1 
2 /*******************************************************************************
3  * Ledger Nano S - Secure firmware
4  * (c) 2022 Ledger
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  ********************************************************************************/
18 
19 #ifndef USBD_HID_IMPL_H
20 #define USBD_HID_IMPL_H
21 
22 // ================================================
23 // HIDGEN
24 
25 #define HID_INTF 0
26 
27 #define HID_EPIN_ADDR 0x82
28 #define HID_EPIN_SIZE 0x40
29 
30 #define HID_EPOUT_ADDR 0x02
31 #define HID_EPOUT_SIZE 0x40
32 
33 #ifdef HAVE_IO_U2F
34 // ================================================
35 // HID U2F
36 
37 #define U2F_INTF 1
38 
39 #define U2F_EPIN_ADDR 0x81
40 #define U2F_EPIN_SIZE 0x40
41 
42 #define U2F_EPOUT_ADDR 0x01
43 #define U2F_EPOUT_SIZE 0x40
44 #endif // HAVE_IO_U2F
45 
46 #ifdef HAVE_WEBUSB
47 
48 #define WEBUSB_EPIN_ADDR 0x83
49 #define WEBUSB_EPIN_SIZE 0x40
50 #define WEBUSB_EPOUT_ADDR 0x03
51 #define WEBUSB_EPOUT_SIZE 0x40
52 
53 #ifdef HAVE_USB_CLASS_CCID
54 #error Unsupported CCID+WEBUSB, not enough endpoints
55 #endif // HAVE_USB_CLASS_CCID
56 
57 #ifdef HAVE_IO_U2F
58 #define WEBUSB_INTF 2
59 #else // HAVE_IO_U2F
60 #define WEBUSB_INTF 1
61 #endif // HAVE_IO_U2F
62 #endif // HAVE_WEBUSB
63 
64 #endif // USBD_HID_IMPL_H