1 /*
2  * SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #pragma once
8 
9 #include <stdint.h>
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 // USB persistence flags.
16 
17 //This bit indicates persistence has been enabled, that is, the USB initialization routines should not
18 //reset the USB device as the device still is initialized and the host detected it with the same cdcacm/dfu
19 //descriptor as the ROM uses; we can just re-initialize the software side and have at 'er.
20 #define USBDC_PERSIST_ENA (1<<31)
21 
22 //This bit indicates to the ROM that we rebooted because of a request to go into DFU mode; the ROM should
23 //honour this request.
24 #define USBDC_BOOT_DFU (1<<30)
25 
26 
27 //This being non-0 indicates a memory location where a 'testament' is stored, aka a piece of text that should be output
28 //after a reboot. Can contain core dump info or something.
29 #define USBDC_TESTAMENT_LOC_MASK 0x7FFFF //bits 19-0; this is added to a base address of 0x3FF80000.
30 
31 //The testament is a FIFO. The ROM will output all data between textstart and textend; if textend is lower than textstart it will
32 //output everything from textstart to memend, then memstart to textend.
33 typedef struct {
34     char *memstart; //start of memory region
35     char *memend;   //end of memory region
36     char *textstart; //start of text to output
37     char *textend;
38 } usbdc_testament_t;
39 
40 #ifdef __cplusplus
41 }
42 #endif
43