|
esp-sdr-zephyr
Raw I/Q receive and transmit on the ESP32-S3/C6 Wi-Fi radio, for Zephyr
|
What apps/mch2022_coproc adds to the stock firmware of the MCH2022 badge's RP2040. More...
#include <stdint.h>Go to the source code of this file.
Data Structures | |
| struct | coproc_info |
| struct | coproc_stats |
Macros | |
| #define | COPROC_IF_WEBUSB_ESP32 4 |
| #define | COPROC_UART_ESP32 0 |
| #define | COPROC_F_LINK 0x0001U |
| #define | COPROC_REG_ID 100 |
| #define | COPROC_REG_RESET_MODE 0xF0 |
| #define | COPROC_REG_LINK_STATE 0xF1 |
| #define | COPROC_REG_UART0_BAUD 0xF2 |
| #define | COPROC_REG_BOOTSEL 0xF5 |
| #define | COPROC_ID 0x5AU |
Enumerations | |
| enum | coproc_req { COPROC_REQ_GET_INFO = 0x01 , COPROC_REQ_GET_STATS = 0x02 , COPROC_REQ_RESET_STATS = 0x03 , COPROC_REQ_SET_BAUD = 0x10 , COPROC_REQ_GET_BAUD = 0x11 , COPROC_REQ_ESP32_RESET = 0x20 , COPROC_REQ_FPGA_RESET = 0x21 , COPROC_REQ_BOOTSEL = 0x22 , COPROC_REQ_BOOTLOADER = 0x23 , COPROC_REQ_LINK_OPEN = 0x30 , COPROC_REQ_LINK_CLOSE = 0x31 , COPROC_REQ_FPGA_FASTLINK = 0x40 , COPROC_REQ_RESET_MODE = 0x50 , COPROC_REQ_GET_LOG = 0x60 , COPROC_REQ_TEST_MODE = 0x70 } |
| enum | coproc_reset_mode { COPROC_RESET_STOCK = 0 , COPROC_RESET_CIRCUIT = 1 } |
| enum | coproc_test_mode { COPROC_TEST_OFF = 0 , COPROC_TEST_SOURCE = 1 , COPROC_TEST_LOOPBACK = 2 , COPROC_TEST_CRASH = 3 } |
What apps/mch2022_coproc adds to the stock firmware of the MCH2022 badge's RP2040.
The stock USB interfaces, WebUSB requests and I2C registers stay as they are (https://github.com/badgeteam/mch2022-firmware-rp2040). New: USB interface 6 with its vendor requests, and registers the stock firmware leaves free. Little endian. Tools read the numbers from this file: keep every constant on its own line.
A host ends every write to interface 6's bulk OUT with a short packet, a zero-length one after a whole number of packets: without one the last bytes wait in the firmware for more to come.
| #define COPROC_F_LINK 0x0001U |
struct coproc_info.features and register COPROC_REG_FEATURES (bit 7 and below).
| #define COPROC_ID 0x5AU |
Register COPROC_REG_ID reads this.
| #define COPROC_IF_WEBUSB_ESP32 4 |
USB interfaces: CDC ACM 0 and 1 (ESP32), 2 and 3 (FPGA), then the vendor ones.
| #define COPROC_REG_BOOTSEL 0xF5 |
Write COPROC_BOOTSEL_MAGIC: reboot into the ROM's USB bootloader.
| #define COPROC_REG_ID 100 |
The registers beyond the stock map (I2C 0x17). Register 0 stays 0x0C: the stock launcher replaces anything below that and reads registers this firmware does not have above it. These tell this firmware from the stock one, where they read 0.
| #define COPROC_REG_LINK_STATE 0xF1 |
Read: bit 0, interface 6 owns UART0.
| #define COPROC_REG_RESET_MODE 0xF0 |
Read and write: enum coproc_reset_mode.
| #define COPROC_REG_UART0_BAUD 0xF2 |
Read: UART0's baud rate over 100, low byte first (3 bytes).
| #define COPROC_UART_ESP32 0 |
The UARTs, in the requests' wValue.
| enum coproc_req |
Vendor requests to interface 6 (bmRequestType 0x41 OUT, 0xC1 IN; wIndex 6).
| Enumerator | |
|---|---|
| COPROC_REQ_GET_INFO | IN struct coproc_info. |
| COPROC_REQ_GET_STATS | IN struct coproc_stats. |
| COPROC_REQ_RESET_STATS | OUT, no data: the counters to zero. |
| COPROC_REQ_SET_BAUD | OUT uint32_t baud rate of the UART wValue, while interface 6 owns it. |
| COPROC_REQ_GET_BAUD | IN uint32_t baud rate of the UART wValue. |
| COPROC_REQ_ESP32_RESET | OUT, no data: reset the ESP32; wValue 0 into its application, 1 into download mode. |
| COPROC_REQ_FPGA_RESET | OUT, no data: the FPGA's CRESET; wValue 0 held, 1 released, 2 a pulse. |
| COPROC_REQ_BOOTSEL | OUT, no data: reboot into the RP2040 ROM's USB bootloader. |
| COPROC_REQ_BOOTLOADER | OUT, no data: reboot into the badge's bootloader (register 0 then reads 0xFF). |
| COPROC_REQ_LINK_OPEN | OUT, no data: UART0 to and from interface 6, instead of its CDC ACM port. |
| COPROC_REQ_LINK_CLOSE | OUT, no data: UART0 back. |
| COPROC_REQ_FPGA_FASTLINK | OUT, no data: the FPGA's fast line into interface 6 at wValue times 100 kbaud, 0 off. Its UART pins change hands meanwhile: the RP2040 reads one and holds the other as a ready line. |
| COPROC_REQ_RESET_MODE | OUT, no data: how DTR and RTS reset the ESP32, wValue enum coproc_reset_mode. |
| COPROC_REQ_GET_LOG | IN: the next bytes of the firmware's log, as many as there are (at most wLength). |
| COPROC_REQ_TEST_MODE | OUT, no data: interface 6's bulk endpoints to wValue enum coproc_test_mode. |
| enum coproc_reset_mode |
| enum coproc_test_mode |
Interface 6's bulk endpoints in a test.