forked from espressif/esp-usb-bridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ubp_config.h
180 lines (145 loc) · 4.32 KB
/
ubp_config.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#ifndef _UBP_CONFIG_H
#define _UBP_CONFIG_H
#include <assert.h>
#include "bsp/board.h"
#define FWVER_MAJOR (0)
#define FWVER_MINOR (3)
/*
* RP2040's can generally be over-clocked up to 260mhz without any problems. This
* brings our FLASH frequency up to 130mhz which is right at the maximum speed for
* W25Q flash ICs (unless it's a really really old one)
*/
#define RP2040_OVERCLOCK_ENABLED (1)
/*
* PICO_DEFAULT_WS2812_PIN is generally defined in the boards header file for those that have it.
* You can specify your board at the top of the parent CMakeList.txt file.
* EG: set(PICO_BOARD tzt_rgb_usbc_rp2040)
*
* The board header files are located in the pico-sdk in the folder pico-sdk/src/boards/include/boards
*
* If you have a custom board with a WS2812 you can define WS2812_PIN here.
*/
#if defined(PICO_DEFAULT_WS2812_PIN) && !defined(WS2812_PIN)
#define WS2812_PIN PICO_DEFAULT_WS2812_PIN
#endif
/*
* Serial Programming Interface PIN assignments
* NOTE: These can also be set with a project define or from the
* make command line.
*/
#ifndef GPIO_BOOT
#define GPIO_BOOT (6)
#endif
#ifndef GPIO_RST
#define GPIO_RST (7)
#endif
#ifndef GPIO_TXD
#define GPIO_TXD (4)
#endif
#ifndef GPIO_RXD
#define GPIO_RXD (5)
#endif
////////////////////////////////////////////////////////////////////
/*
* Serial Programming Interface UART
* NOTE: These can also be set with a project define or from the
* make command line.
*/
/* Some dev boards don't route out uart1 pins in which case you can
* use uart0 and change GPIO_TXD, GPIO_RXD accordingly.
*/
#ifndef PROG_UART
#define PROG_UART uart1
#endif
#ifndef PROG_UART_BUF_SIZE
#define PROG_UART_BUF_SIZE (2 * 1024)
#endif
#ifndef PROG_UART_BITRATE
#define PROG_UART_BITRATE 115200
#endif
/*
* JTAG debugging Interface PIN assignments
* NOTE: These can also be set with a project define or from the
* make command line.
*/
#ifndef GPIO_TCK
#define GPIO_TCK (29)
#endif
#ifndef GPIO_TDI
#define GPIO_TDI (27)
#endif
#ifndef GPIO_TMS
#define GPIO_TMS (28)
#endif
#ifndef GPIO_TDO
#define GPIO_TDO (14)
#endif
////////////////////////////////////////////////////////////////////
_Static_assert(GPIO_TMS == GPIO_TDI+1, "TDI and TMS pins must be sequential! EG: If TDI=27 then TMS must be 28");
#define CONFIG_BRIDGE_MSC_VOLUME_LABEL "ESPPROG_MSC"
#define GET_BYTE(n, b) (((n) >> ((b) * 8)) & 0xFF)
#define CORE_AFFINITY_USB_TASK (1)
#define CORE_AFFINITY_WS2812_TASK (2)
#define CORE_AFFINITY_LOGGER_TASK (2)
#define CORE_AFFINITY_JTAG_TASK (1)
#define CORE_AFFINITY_SERIAL_TASK (1)
#define CORE_AFFINITY_MSC_TASK (1)
/**
* @brief Chip models
*/
typedef enum
{
CHIP_ESP32 = 1, //!< ESP32
CHIP_ESP32S2 = 2, //!< ESP32-S2
CHIP_ESP32S3 = 9, //!< ESP32-S3
CHIP_ESP32C3 = 5, //!< ESP32-C3
CHIP_ESP32H2 = 6, //!< ESP32-H2
} esp_chip_model_t;
// espressif uses a uint8_t StackType_t in there freertos port. Most everyone else uses a uint32_t
#define STACK_SIZE_FROM_BYTES(stackSizeInBytes) ((stackSizeInBytes)/sizeof(StackType_t))
#define eub_abort() do{ printf("eub_abort!!\r\n"); for(;;); }while(1)
// Log level defines (higher is more logging)
#define ESP_LOG_NONE (-1)
#define ESP_LOG_ERROR (0)
#define ESP_LOG_WARN (1)
#define ESP_LOG_INFO (2)
#define ESP_LOG_DEBUG (3)
#define ESP_LOG_VERBOSE (4)
/*
* PIO UART logger UART TX pin.
*
* This can be ANY unused pin since it doesn't use an actual UART peripheral.
* NOTE: These can also be set with a project define or from the
* make command line.
*/
#ifndef LOGGER_UART_TX_PIN
#define LOGGER_UART_TX_PIN (0)
#endif
/*
* NOTE: Since by default we are running the logger uart rate really fast (1.5M),
* we are using 2 stop bits. If you lower the baudrate, you may want to decrease
* this to 1 for slightly faster logging.
*/
#ifndef LOGGER_UART_STOPBITS
#define LOGGER_UART_STOPBITS (2)
#endif
/*
* NOTE: This may be to high for some serial ICs!
* I use a CH340G for logging and 1.5M works better than 921600.
* Presumably, the CH340G osc can hit 1.5M with 0% error.
*/
#ifndef LOGGER_UART_BITRATE
#define LOGGER_UART_BITRATE (1500000)
#endif
/*
* Only show warning and errors by default
*/
#ifndef LOG_LEVEL
#define LOG_LEVEL (ESP_LOG_NONE)
#endif
////////////////////////////////////////////////////////////////////
#define LOGGING_ENABLED() (LOG_LEVEL > ESP_LOG_NONE)
#ifndef MSC_ENABLED
#define MSC_ENABLED 0
#endif
#endif