/
dfu.h
46 lines (40 loc) · 1.47 KB
/
dfu.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
* This file is part of the stfuboot project.
*
* Copyright (C) 2012 Innovative Converged Devices (ICD)
*
* Author(s):
* Andrey Smirnov <andrey.smirnov@convergeddevices.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __DFU_DEVICE_H__
#define __DFU_DEVICE_H__
#include <libopencm3/usb/dfu.h>
#include <libopencm3/usb/usbd.h>
#include "printf.h"
enum stfub_memory_region_altsetting {
STFUB_AS_MAIN_MEMORY = 0,
STFUB_AS_SYSTEM_MEMORY,
STFUB_AS_OPTION_BYTES,
};
int stfub_dfu_handle_control_request(usbd_device *udbddev,
struct usb_setup_data *req,
u8 **buf, u16 *len,
void (**complete)(usbd_device *usbddev,
struct usb_setup_data *req));
void stfub_dfu_tick(void);
void stfub_dfu_init(const struct usb_dfu_descriptor *descr);
void stfub_dfu_switch_altsetting(usbd_device *usbd_dev, u16 interface, u16 altsetting);
#endif