/** * (c) 2026, Micro:bit Educational Foundation and contributors * * SPDX-License-Identifier: MIT */ /** * CDC pipeline saturation * * DAPLink's CDC serial path and WebUSB vendor serial reads share the same * UART ring buffer. After a physical USB connection, CDC consumes early * serial bytes before our vendor reads can get them, causing truncated * output. See: https://github.com/ARMmbed/DAPLink/issues/903 * * Workaround: before flashing, push dummy data through the target's UART * to fill DAPLink's internal buffers. When nobody is reading from the CDC * serial port, the CDC TX buffer fills first, then cdc_process_event() * stops pulling from the UART RX ring buffer, and that fills too. Once * both are full, all subsequent UART data overflows harmlessly and * post-flash serial output is left for our vendor reads. * * V1 (nRF51) uses a Thumb blob for the legacy byte-at-a-time UART. * V2 (nRF52833) uses SWD register writes to trigger a UARTE DMA transfer. * * V1 DAPLink defaults to 9600 baud on fresh USB connection, so we call * setBaudrate(115200) before saturation to ensure DAPLink can decode the * bytes we send. */ import { BoardVersion } from "../device.js"; import { Logging } from "../logging.js"; import { type USBDeviceWrapper } from "./device-wrapper.js"; /** * Push dummy data through the target's UART to fill DAPLink's internal * CDC buffers, preventing CDC from consuming post-flash serial output. * Must be called while the target is halted. */ export declare function saturateCdcPipeline(device: USBDeviceWrapper, boardVersion: BoardVersion, logging: Logging): Promise;