Open FFBoard
Open source force feedback firmware
dfu.h
Go to the documentation of this file.
1/*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2021 XMOS LIMITED
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 *
24 * This file is part of the TinyUSB stack.
25 */
26
27#ifndef _TUSB_DFU_H_
28#define _TUSB_DFU_H_
29
30#include "common/tusb_common.h"
31
32#ifdef __cplusplus
33 extern "C" {
34#endif
35
36//--------------------------------------------------------------------+
37// Common Definitions
38//--------------------------------------------------------------------+
39
40// DFU Protocol
41typedef enum
42{
43 DFU_PROTOCOL_RT = 0x01,
44 DFU_PROTOCOL_DFU = 0x02,
45} dfu_protocol_type_t;
46
47// DFU Descriptor Type
48typedef enum
49{
52
53// DFU Requests
54typedef enum {
63
64// DFU States
65typedef enum {
78
79// DFU Status
80typedef enum {
98
99#define DFU_ATTR_CAN_DOWNLOAD (1u << 0)
100#define DFU_ATTR_CAN_UPLOAD (1u << 1)
101#define DFU_ATTR_MANIFESTATION_TOLERANT (1u << 2)
102#define DFU_ATTR_WILL_DETACH (1u << 3)
103
104// DFU Status Request Payload
105typedef struct TU_ATTR_PACKED
106{
107 uint8_t bStatus;
108 uint8_t bwPollTimeout[3];
109 uint8_t bState;
110 uint8_t iString;
112
113TU_VERIFY_STATIC( sizeof(dfu_status_response_t) == 6, "size is not correct");
114
115#ifdef __cplusplus
116 }
117#endif
118
119#endif /* _TUSB_DFU_H_ */
dfu_state_t
Definition: dfu.h:65
@ APP_DETACH
Definition: dfu.h:67
@ DFU_IDLE
Definition: dfu.h:68
@ DFU_DNBUSY
Definition: dfu.h:70
@ DFU_MANIFEST
Definition: dfu.h:73
@ APP_IDLE
Definition: dfu.h:66
@ DFU_DNLOAD_SYNC
Definition: dfu.h:69
@ DFU_MANIFEST_SYNC
Definition: dfu.h:72
@ DFU_MANIFEST_WAIT_RESET
Definition: dfu.h:74
@ DFU_UPLOAD_IDLE
Definition: dfu.h:75
@ DFU_DNLOAD_IDLE
Definition: dfu.h:71
@ DFU_ERROR
Definition: dfu.h:76
dfu_descriptor_type_t
Definition: dfu.h:49
@ DFU_DESC_FUNCTIONAL
Definition: dfu.h:50
dfu_requests_t
Definition: dfu.h:54
@ DFU_REQUEST_UPLOAD
Definition: dfu.h:57
@ DFU_REQUEST_GETSTATUS
Definition: dfu.h:58
@ DFU_REQUEST_ABORT
Definition: dfu.h:61
@ DFU_REQUEST_GETSTATE
Definition: dfu.h:60
@ DFU_REQUEST_CLRSTATUS
Definition: dfu.h:59
@ DFU_REQUEST_DETACH
Definition: dfu.h:55
@ DFU_REQUEST_DNLOAD
Definition: dfu.h:56
dfu_status_t
Definition: dfu.h:80
@ DFU_STATUS_ERR_CHECK_ERASED
Definition: dfu.h:86
@ DFU_STATUS_ERR_PROG
Definition: dfu.h:87
@ DFU_STATUS_OK
Definition: dfu.h:81
@ DFU_STATUS_ERR_POR
Definition: dfu.h:94
@ DFU_STATUS_ERR_FILE
Definition: dfu.h:83
@ DFU_STATUS_ERR_ERASE
Definition: dfu.h:85
@ DFU_STATUS_ERR_WRITE
Definition: dfu.h:84
@ DFU_STATUS_ERR_STALLEDPKT
Definition: dfu.h:96
@ DFU_STATUS_ERR_TARGET
Definition: dfu.h:82
@ DFU_STATUS_ERR_NOTDONE
Definition: dfu.h:90
@ DFU_STATUS_ERR_FIRMWARE
Definition: dfu.h:91
@ DFU_STATUS_ERR_VERIFY
Definition: dfu.h:88
@ DFU_STATUS_ERR_ADDRESS
Definition: dfu.h:89
@ DFU_STATUS_ERR_USBR
Definition: dfu.h:93
@ DFU_STATUS_ERR_VENDOR
Definition: dfu.h:92
@ DFU_STATUS_ERR_UNKNOWN
Definition: dfu.h:95
struct TU_ATTR_PACKED dfu_status_response_t
TU_VERIFY_STATIC(sizeof(dfu_status_response_t)==6, "size is not correct")
AUDIO Channel Cluster Descriptor (4.1)
Definition: audio.h:647
uint8_t iString
Definition: dfu.h:110
uint8_t bwPollTimeout[3]
Definition: dfu.h:108
uint8_t bState
Definition: dfu.h:109
uint8_t bStatus
Definition: dfu.h:107