Line data Source code
1 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 :
36 : /**
37 : * @file
38 : * @brief USB Device Firmware Upgrade (DFU) public header
39 : *
40 : * @deprecated This API is deprecated.
41 : *
42 : * Header follows the Device Class Specification for
43 : * Device Firmware Upgrade Version 1.1
44 : */
45 :
46 : #ifndef ZEPHYR_INCLUDE_USB_CLASS_USB_DFU_H_
47 : #define ZEPHYR_INCLUDE_USB_CLASS_USB_DFU_H_
48 :
49 : #include <zephyr/sys_clock.h>
50 :
51 : /** DFU Class Subclass */
52 1 : #define DFU_SUBCLASS 0x01 __DEPRECATED_MACRO
53 :
54 : /** DFU Class runtime Protocol */
55 1 : #define DFU_RT_PROTOCOL 0x01 __DEPRECATED_MACRO
56 :
57 : /** DFU Class DFU mode Protocol */
58 1 : #define DFU_MODE_PROTOCOL 0x02 __DEPRECATED_MACRO
59 :
60 : /**
61 : * @brief DFU Class Specific Requests
62 : */
63 1 : #define DFU_DETACH 0x00 __DEPRECATED_MACRO
64 0 : #define DFU_DNLOAD 0x01 __DEPRECATED_MACRO
65 0 : #define DFU_UPLOAD 0x02 __DEPRECATED_MACRO
66 0 : #define DFU_GETSTATUS 0x03 __DEPRECATED_MACRO
67 0 : #define DFU_CLRSTATUS 0x04 __DEPRECATED_MACRO
68 0 : #define DFU_GETSTATE 0x05 __DEPRECATED_MACRO
69 0 : #define DFU_ABORT 0x06 __DEPRECATED_MACRO
70 :
71 : /** DFU FUNCTIONAL descriptor type */
72 1 : #define DFU_FUNC_DESC 0x21 __DEPRECATED_MACRO
73 :
74 : /** DFU attributes DFU Functional Descriptor */
75 1 : #define DFU_ATTR_WILL_DETACH 0x08 __DEPRECATED_MACRO
76 0 : #define DFU_ATTR_MANIFESTATION_TOLERANT 0x04 __DEPRECATED_MACRO
77 0 : #define DFU_ATTR_CAN_UPLOAD 0x02 __DEPRECATED_MACRO
78 0 : #define DFU_ATTR_CAN_DNLOAD 0x01 __DEPRECATED_MACRO
79 :
80 : /** DFU Specification release */
81 1 : #define DFU_VERSION 0x0110 __DEPRECATED_MACRO
82 :
83 : /** Run-Time Functional Descriptor */
84 1 : struct dfu_runtime_descriptor {
85 0 : uint8_t bLength;
86 0 : uint8_t bDescriptorType;
87 0 : uint8_t bmAttributes;
88 0 : uint16_t wDetachTimeOut;
89 0 : uint16_t wTransferSize;
90 0 : uint16_t bcdDFUVersion;
91 : } __packed;
92 :
93 : /** bStatus values for the DFU_GETSTATUS response */
94 0 : enum dfu_status {
95 : statusOK,
96 : errTARGET,
97 : errFILE,
98 : errWRITE,
99 : errERASE,
100 : errCHECK_ERASED,
101 : errPROG,
102 : errVERIFY,
103 : errADDRESS,
104 : errNOTDONE,
105 : errFIRMWARE,
106 : errVENDOR,
107 : errUSB,
108 : errPOR,
109 : errUNKNOWN,
110 : errSTALLEDPKT
111 : };
112 :
113 : /** bState values for the DFU_GETSTATUS response */
114 0 : enum dfu_state {
115 : appIDLE,
116 : appDETACH,
117 : dfuIDLE,
118 : dfuDNLOAD_SYNC,
119 : dfuDNBUSY,
120 : dfuDNLOAD_IDLE,
121 : dfuMANIFEST_SYNC,
122 : dfuMANIFEST,
123 : dfuMANIFEST_WAIT_RST,
124 : dfuUPLOAD_IDLE,
125 : dfuERROR,
126 : };
127 :
128 0 : __deprecated void wait_for_usb_dfu(k_timeout_t delay);
129 :
130 : #endif /* ZEPHYR_INCLUDE_USB_CLASS_USB_DFU_H_ */
|