ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
Loading...
Searching...
No Matches
ra8_io_stream_usbcdc.h File Reference

ra8_io byte-stream sink over a USB-CDC endpoint. More...

#include <stdint.h>
#include "ra8_err.h"
#include "ra8_io_stream.h"
Include dependency graph for ra8_io_stream_usbcdc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ra8_io_stream_usbcdc_state_t
 Caller-owned private state for a USB-CDC stream sink. More...

Functions

ra8_err_t ra8_io_stream_usbcdc_init (ra8_io_stream_t *s, ra8_io_stream_usbcdc_state_t *state, uint8_t ep_addr)
 Bind a USB-CDC stream sink into a caller-owned stream handle.

Detailed Description

ra8_io byte-stream sink over a USB-CDC endpoint.

Tag
[Ring 4 / PAL] {World: NS}

Streams bytes to the host over a USB-CDC bulk-IN endpoint via ra8_usb_pal – the "print to the host over USB serial" target. The application must have brought the USB device stack and the CDC class up first. The data path is exercised on ra8_emulator / HIL; on the host this sink binds and validates only.

Since
0.1.0

Definition in file ra8_io_stream_usbcdc.h.

Function Documentation

◆ ra8_io_stream_usbcdc_init()

ra8_err_t ra8_io_stream_usbcdc_init ( ra8_io_stream_t * s,
ra8_io_stream_usbcdc_state_t * state,
uint8_t ep_addr )
nodiscard

Bind a USB-CDC stream sink into a caller-owned stream handle.

Parameters
[out]sStream handle to bind (zero-initialised by the caller).
[out]stateCaller-owned sink state to populate.
[in]ep_addrUSB bulk-IN endpoint address to write to.
Returns
ra8_err_t Error code.
Return values
k_ra8_okSink bound; s is usable.
k_ra8_err_null_ptrs or state was NULL.
Precondition
The USB device stack + CDC class are up and ep_addr is configured.
s and state out-live every call made through the stream.
Postcondition
On success s sends bytes through ep_addr.
On any non-ok return s and state are left unbound/untouched.
Note
Not thread-safe with respect to the same stream.
Since
0.1.0

Definition at line 100 of file ra8_io_stream_usbcdc.c.

References ra8_io_stream_usbcdc_state_t::ep_addr, RA8_CHECK_NULL_PTR, ra8_io_stream_bind(), s_tag, and s_usbcdc_iface.