summaryrefslogtreecommitdiff
path: root/usb/device/dfu/dfu_runtime.c
blob: 5ad10387cec401621e54f83bbc51de6dcbf66655 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

#include <board.h>
#include <core_cm3.h>

#include <usb/device/core/USBD.h>
#include <usb/device/dfu/dfu.h>


void DFURT_SwitchToDFU(void)
{
	unsigned int *dfu_except_tbl = (unsigned int *)AT91C_IFLASH0;
	void (*toDFU)(void) = (void *)dfu_except_tbl[1];

	*(unsigned int *)USB_DFU_MAGIC_ADDR = USB_DFU_MAGIC;

	USBD_Disconnect();
	__disable_irq();

	toDFU();
}
personal git repositories of Harald Welte. Your mileage may vary