dfu.h
1 /*
2  * Copyright (C) 2020 Mesotic SAS
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for
6  * more details.
7  */
8 
9 #pragma once
10 
21 #include "usb/dfu.h"
22 #include "riotboot/flashwrite.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
31 typedef struct usbus_dfu_device {
36 #ifdef MODULE_RIOTBOOT_USB_DFU
37  usbus_interface_alt_t iface_alt_slot1;
38  usbus_string_t slot1_str;
39  riotboot_flashwrite_t writer;
40 #endif
43  unsigned mode;
44  unsigned selected_slot;
47 
55 void usbus_dfu_init(usbus_t *usbus, usbus_dfu_device_t *handler, unsigned mode);
56 
57 #ifdef __cplusplus
58 }
59 #endif
60 
Definition for USB DFU interfaces.
usb_dfu_state_t
USBUS DFU internal state.
Definition: dfu.h:94
struct usbus_dfu_device usbus_dfu_device_t
USBUS DFU device interface context.
void usbus_dfu_init(usbus_t *usbus, usbus_dfu_device_t *handler, unsigned mode)
DFU initialization function.
riotboot flash writing module
firmware update state structure
Definition: flashwrite.h:105
USBUS descriptor generator.
Definition: usbus.h:297
USBUS DFU device interface context.
Definition: dfu.h:31
usbus_interface_t iface
Control interface.
Definition: dfu.h:33
usb_dfu_state_t dfu_state
Internal DFU state machine.
Definition: dfu.h:45
usbus_string_t slot0_str
Descriptor string for Slot 0.
Definition: dfu.h:35
unsigned mode
0 - APP mode, 1 DFU mode
Definition: dfu.h:43
bool skip_signature
Skip RIOTBOOT signature status.
Definition: dfu.h:41
unsigned selected_slot
Slot used for upgrade.
Definition: dfu.h:44
usbus_handler_t handler_ctrl
Control interface handler.
Definition: dfu.h:32
usbus_descr_gen_t dfu_descr
DFU descriptor generator.
Definition: dfu.h:34
usbus_t * usbus
Ptr to the USBUS context.
Definition: dfu.h:42
USBUS handler struct.
Definition: usbus.h:435
USBUS interface alternative setting.
Definition: usbus.h:340
USBUS interface.
Definition: usbus.h:352
USBUS string type.
Definition: usbus.h:209
USBUS context struct.
Definition: usbus.h:447