Zephyr API Documentation
4.2.0-rc3
A Scalable Open Source RTOS
4.2.0-rc3
Toggle main menu visibility
Main Page
Related Pages
Topics
Data Structures
Data Structures
Data Structure Index
Data Fields
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
Enumerator
Files
File List
Globals
All
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
$
a
b
c
d
f
g
h
i
k
l
m
n
o
p
r
s
t
u
x
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Macros
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
Loading...
Searching...
No Matches
usb_dfu.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: BSD-3-Clause */
2
3
/***************************************************************************
4
*
5
* Copyright(c) 2015,2016 Intel Corporation.
6
* Copyright(c) 2017 PHYTEC Messtechnik GmbH
7
*
8
* Redistribution and use in source and binary forms, with or without
9
* modification, are permitted provided that the following conditions
10
* are met:
11
*
12
* * Redistributions of source code must retain the above copyright
13
* notice, this list of conditions and the following disclaimer.
14
* * Redistributions in binary form must reproduce the above copyright
15
* notice, this list of conditions and the following disclaimer in
16
* the documentation and/or other materials provided with the
17
* distribution.
18
* * Neither the name of Intel Corporation nor the names of its
19
* contributors may be used to endorse or promote products derived
20
* from this software without specific prior written permission.
21
*
22
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
*
34
***************************************************************************/
35
43
44
#ifndef ZEPHYR_INCLUDE_USB_CLASS_USB_DFU_H_
45
#define ZEPHYR_INCLUDE_USB_CLASS_USB_DFU_H_
46
47
#include <
zephyr/sys_clock.h
>
48
50
#define DFU_SUBCLASS 0x01
51
53
#define DFU_RT_PROTOCOL 0x01
54
56
#define DFU_MODE_PROTOCOL 0x02
57
61
#define DFU_DETACH 0x00
62
#define DFU_DNLOAD 0x01
63
#define DFU_UPLOAD 0x02
64
#define DFU_GETSTATUS 0x03
65
#define DFU_CLRSTATUS 0x04
66
#define DFU_GETSTATE 0x05
67
#define DFU_ABORT 0x06
68
70
#define DFU_FUNC_DESC 0x21
71
73
#define DFU_ATTR_WILL_DETACH 0x08
74
#define DFU_ATTR_MANIFESTATION_TOLERANT 0x04
75
#define DFU_ATTR_CAN_UPLOAD 0x02
76
#define DFU_ATTR_CAN_DNLOAD 0x01
77
79
#define DFU_VERSION 0x0110
80
82
struct
dfu_runtime_descriptor
{
83
uint8_t
bLength
;
84
uint8_t
bDescriptorType
;
85
uint8_t
bmAttributes
;
86
uint16_t
wDetachTimeOut
;
87
uint16_t
wTransferSize
;
88
uint16_t
bcdDFUVersion
;
89
} __packed;
82
struct
dfu_runtime_descriptor
{
…
};
90
92
enum
dfu_status
{
93
statusOK
,
94
errTARGET
,
95
errFILE
,
96
errWRITE
,
97
errERASE
,
98
errCHECK_ERASED
,
99
errPROG
,
100
errVERIFY
,
101
errADDRESS
,
102
errNOTDONE
,
103
errFIRMWARE
,
104
errVENDOR
,
105
errUSB
,
106
errPOR
,
107
errUNKNOWN
,
108
errSTALLEDPKT
109
};
92
enum
dfu_status
{
…
};
110
112
enum
dfu_state
{
113
appIDLE
,
114
appDETACH
,
115
dfuIDLE
,
116
dfuDNLOAD_SYNC
,
117
dfuDNBUSY
,
118
dfuDNLOAD_IDLE
,
119
dfuMANIFEST_SYNC
,
120
dfuMANIFEST
,
121
dfuMANIFEST_WAIT_RST
,
122
dfuUPLOAD_IDLE
,
123
dfuERROR
,
124
};
112
enum
dfu_state
{
…
};
125
126
void
wait_for_usb_dfu
(
k_timeout_t
delay);
127
128
#endif
/* ZEPHYR_INCLUDE_USB_CLASS_USB_DFU_H_ */
uint8_t
__UINT8_TYPE__ uint8_t
Definition
stdint.h:88
uint16_t
__UINT16_TYPE__ uint16_t
Definition
stdint.h:89
dfu_runtime_descriptor
Run-Time Functional Descriptor.
Definition
usb_dfu.h:82
dfu_runtime_descriptor::bLength
uint8_t bLength
Definition
usb_dfu.h:83
dfu_runtime_descriptor::bcdDFUVersion
uint16_t bcdDFUVersion
Definition
usb_dfu.h:88
dfu_runtime_descriptor::bDescriptorType
uint8_t bDescriptorType
Definition
usb_dfu.h:84
dfu_runtime_descriptor::wTransferSize
uint16_t wTransferSize
Definition
usb_dfu.h:87
dfu_runtime_descriptor::bmAttributes
uint8_t bmAttributes
Definition
usb_dfu.h:85
dfu_runtime_descriptor::wDetachTimeOut
uint16_t wDetachTimeOut
Definition
usb_dfu.h:86
k_timeout_t
Kernel timeout type.
Definition
clock.h:65
sys_clock.h
dfu_state
dfu_state
bState values for the DFU_GETSTATUS response
Definition
usb_dfu.h:112
dfuMANIFEST_SYNC
@ dfuMANIFEST_SYNC
Definition
usb_dfu.h:119
dfuERROR
@ dfuERROR
Definition
usb_dfu.h:123
dfuUPLOAD_IDLE
@ dfuUPLOAD_IDLE
Definition
usb_dfu.h:122
dfuIDLE
@ dfuIDLE
Definition
usb_dfu.h:115
dfuDNLOAD_IDLE
@ dfuDNLOAD_IDLE
Definition
usb_dfu.h:118
appDETACH
@ appDETACH
Definition
usb_dfu.h:114
dfuMANIFEST_WAIT_RST
@ dfuMANIFEST_WAIT_RST
Definition
usb_dfu.h:121
appIDLE
@ appIDLE
Definition
usb_dfu.h:113
dfuMANIFEST
@ dfuMANIFEST
Definition
usb_dfu.h:120
dfuDNLOAD_SYNC
@ dfuDNLOAD_SYNC
Definition
usb_dfu.h:116
dfuDNBUSY
@ dfuDNBUSY
Definition
usb_dfu.h:117
wait_for_usb_dfu
void wait_for_usb_dfu(k_timeout_t delay)
dfu_status
dfu_status
bStatus values for the DFU_GETSTATUS response
Definition
usb_dfu.h:92
errSTALLEDPKT
@ errSTALLEDPKT
Definition
usb_dfu.h:108
errVENDOR
@ errVENDOR
Definition
usb_dfu.h:104
errVERIFY
@ errVERIFY
Definition
usb_dfu.h:100
errTARGET
@ errTARGET
Definition
usb_dfu.h:94
errFILE
@ errFILE
Definition
usb_dfu.h:95
errERASE
@ errERASE
Definition
usb_dfu.h:97
errWRITE
@ errWRITE
Definition
usb_dfu.h:96
errCHECK_ERASED
@ errCHECK_ERASED
Definition
usb_dfu.h:98
errUSB
@ errUSB
Definition
usb_dfu.h:105
errADDRESS
@ errADDRESS
Definition
usb_dfu.h:101
errFIRMWARE
@ errFIRMWARE
Definition
usb_dfu.h:103
errPOR
@ errPOR
Definition
usb_dfu.h:106
errUNKNOWN
@ errUNKNOWN
Definition
usb_dfu.h:107
errPROG
@ errPROG
Definition
usb_dfu.h:99
statusOK
@ statusOK
Definition
usb_dfu.h:93
errNOTDONE
@ errNOTDONE
Definition
usb_dfu.h:102
zephyr
usb
class
usb_dfu.h
Generated on
for Zephyr API Documentation by
1.14.0