|
ICARUS OS (Intelligent Cooperative Architecture for Real-time Unified Systems) 0.1.0
Preemptive Real-Time Operating System for ARM Cortex-M7
|
USB CDC raw write helper implementation. More...
Go to the source code of this file.
Functions | |
| bool | CDC_Write (const uint8_t *data, uint16_t len) |
Push len bytes to the USB CDC IN endpoint. | |
| bool | CDC_WriteString (const char *s) |
| Convenience wrapper that pushes a NUL-terminated C string. | |
USB CDC raw write helper implementation.
Calls the ST USB CDC class driver (CDC_Transmit_FS from usbd_cdc_if.h) and busy-retries on USBD_BUSY using task_active_sleep(1) between attempts. The retry budget is bounded by CDC_WRITE_MAX_RETRIES so a stuck endpoint cannot block the caller forever.
Under HOST_TEST the ST middleware is unavailable, so the implementation is replaced by a small in-memory sink that stores the most recent payload — exposed to the unit tests via __cdc_host_* hooks declared in tests/src/test_cdc.c.
Definition in file cdc.c.
| bool CDC_Write | ( | const uint8_t * | data, |
| uint16_t | len | ||
| ) |
Push len bytes to the USB CDC IN endpoint.
| data | Pointer to the bytes to send (must be non-NULL when len > 0). |
| len | Number of bytes to send. |
true if the bytes were accepted by the CDC stack within CDC_WRITE_MAX_RETRIES busy-retries; false otherwise (caller's bytes were not sent).task_active_sleep(1) and would deadlock from an ISR.data must remain valid until the function returns. Definition at line 33 of file cdc.c.
References CDC_Transmit_FS(), CDC_WRITE_MAX_RETRIES, and task_active_sleep().
Referenced by CDC_WriteString().
| bool CDC_WriteString | ( | const char * | s | ) |
Convenience wrapper that pushes a NUL-terminated C string.
| s | NUL-terminated string. NULL is treated as a no-op success. |
true on success, false if the underlying CDC_Write could not flush within the retry budget. Definition at line 112 of file cdc.c.
References CDC_Write().