aboutsummaryrefslogtreecommitdiffstats
path: root/sysmoOCTSIM/usb_descriptors.h
blob: ea47d07cc677f863e08dad786dad7af8cc4f9fc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
 * Copyright (C) 2019 sysmocom -s.f.m.c. GmbH, Author: Eric Wild <ewild@sysmocom.de>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/

#ifndef USB_DESCRIPTORS_H_
#define USB_DESCRIPTORS_H_

#include "ccid_device.h"
#include "dfu_descriptors.h"

#define CCID_NUM_CLK_SUPPORTED 4

/* aggregate descriptors for the combined CDC-ACM + CCID device that we expose
 * from sysmoQMOD */

enum str_desc_num {
	STR_DESC_MANUF = 1,
	STR_DESC_PRODUCT,
	STR_DESC_CONFIG,
	STR_DESC_INTF_ACM_COMM,
	STR_DESC_INTF_ACM_DATA,
	STR_DESC_INTF_CCID,
	STR_DESC_SERIAL,
	STR_DESC_INTF_DFURT,
};

/* a struct of structs representing the concatenated collection of USB descriptors */
struct usb_desc_collection {
	struct usb_dev_desc dev;
	struct usb_config_desc cfg;

	/* CDC-ACM: Two interfaces, one with IRQ EP and one with BULK IN + OUT */
	struct {
		struct {
			struct usb_iface_desc iface;
			struct usb_cdc_hdr_desc cdc_hdr;
			struct usb_cdc_call_mgmt_desc cdc_call_mgmt;
			struct usb_cdc_acm_desc cdc_acm;
			struct usb_cdc_union_desc cdc_union;
			struct usb_ep_desc ep[1];
		} comm;
		struct {
			struct usb_iface_desc iface;
			struct usb_ep_desc ep[2];
		} data;
	} cdc;

	/* CCID: One interface with CCID class descriptor and three endpoints */
	struct {
		struct usb_iface_desc iface;
		struct usb_ccid_class_descriptor class;
		struct usb_ep_desc ep[3];
	} ccid;
	DFURT_IF_DESCRIPTOR_STRUCT
	uint8_t str[176];
} __attribute__((packed));

#endif /* USB_DESCRIPTORS_H_ */