mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
sys/riotboot: add tinyUSB DFU support
This commit is contained in:
parent
5b543692cd
commit
152213692b
38
sys/riotboot/tinyusb_dfu.c
Normal file
38
sys/riotboot/tinyusb_dfu.c
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (C) 2022 Gunar Schorcht
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup sys_riotboot_usb_dfu
|
||||
* @ingroup pkg_tinyusb_dfu
|
||||
* @{
|
||||
* @file tinyUSB Device Firmware Upgrade initialization for riotboot
|
||||
*
|
||||
* @author Gunar Schorcht <gunar@schorcht.net>
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include "riotboot/magic.h"
|
||||
|
||||
#include "tinyusb.h"
|
||||
#include "tinyusb_dfu.h"
|
||||
|
||||
#define ENABLE_DEBUG 0
|
||||
#include "debug.h"
|
||||
|
||||
extern void tinyusb_dfu_init(void);
|
||||
|
||||
void riotboot_usb_dfu_init(unsigned forced)
|
||||
{
|
||||
uint32_t *reset_addr = (uint32_t *)RIOTBOOT_MAGIC_ADDR;
|
||||
|
||||
if (forced == 1 || *reset_addr == RIOTBOOT_MAGIC_NUMBER) {
|
||||
*reset_addr = 0;
|
||||
tinyusb_setup();
|
||||
tinyusb_dfu_init();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user