-
Notifications
You must be signed in to change notification settings - Fork 1
/
dfu_desc.h
75 lines (67 loc) · 2.35 KB
/
dfu_desc.h
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
73
74
/*
*
* Copyright 2018 The wookey project team <[email protected]>
* - Ryad Benadjila
* - Arnauld Michelizza
* - Mathieu Renard
* - Philippe Thierry
* - Philippe Trebuchet
*
* This package is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* the Free Software Foundation; either version 2.1 of the License, or (at
* ur option) any later version.
*
* This package 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with this package; if not, write to the Free Software Foundation, Inc., 51
* Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/** @file usb_desc.h
* \brief Contains usb descriptors
*/
#ifndef _DFU_DESC_H
#define _DFU_DESC_H
#include "libc/types.h"
#include "autoconf.h"
#include "libusbctrl.h"
/* Classes, subclasses and protocols for DFU Runtime */
#define USB_NB_INTERFACE 1
#define USB_DESC_DFU_FUNC 0x21
#define USB_CLASS_DFU 0xFE
#define USB_SUBCLASS_DFU 0x01
#define USB_PROTOCOL_DFU_RTM 0x01
#define USB_PROTOCOL_DFU_DFU 0x02
#define DFU_DETACH_TIMEOUT 1000 /* in miliseconds */
/*
* DFU Class handle a class-level descriptor, named DFU class functional
* descriptor. This descriptor is return on GetConfiguration, at interface
* enumeration, using the below callback.
*/
typedef struct __packed {
uint8_t bLength;
uint8_t bDescriptorType;
struct {
uint8_t bitCanDnload:1;
uint8_t bitCanUpload:1;
uint8_t bitManifestationTolerant:1;
uint8_t bitWillDetach:1;
uint8_t reserved:4;
} bmAttributes;
uint16_t wDetachTimeOut;
uint16_t wTransferSize;
uint16_t bcdDFUVersion;
} dfu_class_functional_descriptor_t;
/**
* \brief Configuration descriptor
*
*/
mbed_error_t dfu_get_descriptor(uint8_t iface_id __attribute__((unused)),
uint8_t *buf,
uint8_t *desc_size,
uint32_t usbdci_handler __attribute__((unused)));
#endif /* !_DFU_DESC_H */