ARMEBS4
revision-26.06.2015
Main Page
Modules
Data Structures
Files
File List
Globals
include
stm32
usb
usbd_dfu_core.h
1
#include "
heivs/config.h
"
2
#if (USE_STM32_USB_HOST_MODE || USE_STM32_USB_USE_DEVICE_MODE || USE_STM32_USB_OTG_MODE)
3
/**
4
******************************************************************************
5
* @file usbd_dfu_core.h
6
* @author MCD Application Team
7
* @version V1.1.0
8
* @date 19-March-2012
9
* @brief header file for the usbd_dfu_core.c file.
10
******************************************************************************
11
* @attention
12
*
13
* <h2><center>© COPYRIGHT 2012 STMicroelectronics</center></h2>
14
*
15
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
16
* You may not use this file except in compliance with the License.
17
* You may obtain a copy of the License at:
18
*
19
* http://www.st.com/software_license_agreement_liberty_v2
20
*
21
* Unless required by applicable law or agreed to in writing, software
22
* distributed under the License is distributed on an "AS IS" BASIS,
23
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
* See the License for the specific language governing permissions and
25
* limitations under the License.
26
*
27
******************************************************************************
28
*/
29
30
/* Includes ------------------------------------------------------------------*/
31
32
#ifndef __USB_DFU_CORE_H_
33
#define __USB_DFU_CORE_H_
34
35
#include "usbd_ioreq.h"
36
#include "usbd_dfu_mal.h"
37
38
/** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
39
* @{
40
*/
41
42
/** @defgroup usbd_dfu
43
* @brief This file is the Header file for USBD_dfu.c
44
* @{
45
*/
46
47
48
/** @defgroup usbd_dfu_Exported_Defines
49
* @{
50
*/
51
#define USB_DFU_CONFIG_DESC_SIZ (18 + (9 * USBD_ITF_MAX_NUM))
52
#define USB_DFU_DESC_SIZ 9
53
54
#define DFU_DESCRIPTOR_TYPE 0x21
55
56
57
/*---------------------------------------------------------------------*/
58
/* DFU definitions */
59
/*---------------------------------------------------------------------*/
60
61
62
63
/**************************************************/
64
/* DFU Requests DFU states */
65
/**************************************************/
66
67
68
#define STATE_appIDLE 0
69
#define STATE_appDETACH 1
70
#define STATE_dfuIDLE 2
71
#define STATE_dfuDNLOAD_SYNC 3
72
#define STATE_dfuDNBUSY 4
73
#define STATE_dfuDNLOAD_IDLE 5
74
#define STATE_dfuMANIFEST_SYNC 6
75
#define STATE_dfuMANIFEST 7
76
#define STATE_dfuMANIFEST_WAIT_RESET 8
77
#define STATE_dfuUPLOAD_IDLE 9
78
#define STATE_dfuERROR 10
79
80
/**************************************************/
81
/* DFU Requests DFU status */
82
/**************************************************/
83
84
#define STATUS_OK 0x00
85
#define STATUS_ERRTARGET 0x01
86
#define STATUS_ERRFILE 0x02
87
#define STATUS_ERRWRITE 0x03
88
#define STATUS_ERRERASE 0x04
89
#define STATUS_ERRCHECK_ERASED 0x05
90
#define STATUS_ERRPROG 0x06
91
#define STATUS_ERRVERIFY 0x07
92
#define STATUS_ERRADDRESS 0x08
93
#define STATUS_ERRNOTDONE 0x09
94
#define STATUS_ERRFIRMWARE 0x0A
95
#define STATUS_ERRVENDOR 0x0B
96
#define STATUS_ERRUSBR 0x0C
97
#define STATUS_ERRPOR 0x0D
98
#define STATUS_ERRUNKNOWN 0x0E
99
#define STATUS_ERRSTALLEDPKT 0x0F
100
101
/**************************************************/
102
/* DFU Requests DFU states Manifestation State */
103
/**************************************************/
104
105
#define Manifest_complete 0x00
106
#define Manifest_In_Progress 0x01
107
108
109
/**************************************************/
110
/* Special Commands with Download Request */
111
/**************************************************/
112
113
#define CMD_GETCOMMANDS 0x00
114
#define CMD_SETADDRESSPOINTER 0x21
115
#define CMD_ERASE 0x41
116
117
/**************************************************/
118
/* Other defines */
119
/**************************************************/
120
/* Bit Detach capable = bit 3 in bmAttributes field */
121
#define DFU_DETACH_MASK (uint8_t)(1 << 4)
122
/**
123
* @}
124
*/
125
126
127
/** @defgroup USBD_CORE_Exported_TypesDefinitions
128
* @{
129
*/
130
/**************************************************/
131
/* DFU Requests */
132
/**************************************************/
133
134
typedef
enum
_DFU_REQUESTS {
135
DFU_DETACH = 0,
136
DFU_DNLOAD = 1,
137
DFU_UPLOAD,
138
DFU_GETSTATUS,
139
DFU_CLRSTATUS,
140
DFU_GETSTATE,
141
DFU_ABORT
142
} DFU_REQUESTS;
143
144
typedef
void (*pFunction)(void);
145
/**
146
* @}
147
*/
148
149
150
151
/** @defgroup USBD_CORE_Exported_Macros
152
* @{
153
*/
154
/********** Descriptor of DFU interface 0 Alternate setting n ****************/
155
#define USBD_DFU_IF_DESC(n) 0x09,
/* bLength: Interface Descriptor size */
\
156
USB_INTERFACE_DESCRIPTOR_TYPE,
/* bDescriptorType */
\
157
0x00,
/* bInterfaceNumber: Number of Interface */
\
158
(n),
/* bAlternateSetting: Alternate setting */
\
159
0x00,
/* bNumEndpoints*/
\
160
0xFE,
/* bInterfaceClass: Application Specific Class Code */
\
161
0x01,
/* bInterfaceSubClass : Device Firmware Upgrade Code */
\
162
0x02,
/* nInterfaceProtocol: DFU mode protocol */
\
163
USBD_IDX_INTERFACE_STR + (n) + 1
/* iInterface: Index of string descriptor */
\
164
/* 18 */
165
166
/**
167
* @}
168
*/
169
170
/** @defgroup USBD_CORE_Exported_Variables
171
* @{
172
*/
173
174
extern
USBD_Class_cb_TypeDef DFU_cb;
175
/**
176
* @}
177
*/
178
179
/** @defgroup USB_CORE_Exported_Functions
180
* @{
181
*/
182
/**
183
* @}
184
*/
185
186
#endif // __USB_DFU_CORE_H_
187
/**
188
* @}
189
*/
190
191
/**
192
* @}
193
*/
194
195
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
196
#endif
/* (USE_STM32_USB_HOST_MODE || USE_STM32_USB_USE_DEVICE_MODE || USE_STM32_USB_OTG_MODE) */
config.h
libheivs configuration file
Generated on Fri Jun 26 2015 13:11:51 for ARMEBS4 by
1.8.9.1