ICARUS OS (Intelligent Cooperative Architecture for Real-time Unified Systems) 0.1.0
Preemptive Real-Time Operating System for ARM Cortex-M7
Loading...
Searching...
No Matches
cdc_rx.h File Reference

USB CDC receive ring buffer. More...

#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Macros

#define CDC_RX_BUF_SIZE   512
 

Functions

void cdc_rx_init (void)
 
bool cdc_rx_read_byte (uint8_t *out)
 
uint32_t cdc_rx_available (void)
 
void cdc_rx_push (const uint8_t *data, uint32_t len)
 Append bytes to the ring buffer.
 
void __cdc_rx_init (void)
 
void __cdc_rx_push (const uint8_t *data, uint32_t len)
 
bool __cdc_rx_read_byte (uint8_t *out)
 
uint32_t __cdc_rx_available (void)
 

Detailed Description

USB CDC receive ring buffer.

Single-producer (USB ISR) / single-consumer (consumer task) lock-free ring buffer for incoming serial data over the kernel's USB CDC class. Producer is the CDC_Receive_FS callback (ISR context); consumer is any RTOS task that wants to drain bytes.

Author
Souham Biswas
Date
2026

Definition in file cdc_rx.h.

Macro Definition Documentation

◆ CDC_RX_BUF_SIZE

#define CDC_RX_BUF_SIZE   512

Definition at line 29 of file cdc_rx.h.

Function Documentation

◆ __cdc_rx_available()

uint32_t __cdc_rx_available ( void  )

Definition at line 66 of file cdc_rx.c.

References CDC_RX_BUF_SIZE, rx_head, and rx_tail.

Referenced by cdc_rx_available(), and SVC_Handler_C().

◆ __cdc_rx_init()

void __cdc_rx_init ( void  )

Definition at line 38 of file cdc_rx.c.

References rx_head, and rx_tail.

Referenced by cdc_rx_init(), and SVC_Handler_C().

◆ __cdc_rx_push()

void __cdc_rx_push ( const uint8_t *  data,
uint32_t  len 
)

Definition at line 43 of file cdc_rx.c.

References CDC_RX_BUF_SIZE, rx_buf, rx_head, and rx_tail.

Referenced by cdc_rx_push().

◆ __cdc_rx_read_byte()

bool __cdc_rx_read_byte ( uint8_t *  out)

Definition at line 57 of file cdc_rx.c.

References CDC_RX_BUF_SIZE, rx_buf, rx_head, and rx_tail.

Referenced by cdc_rx_read_byte(), and SVC_Handler_C().

◆ cdc_rx_available()

uint32_t cdc_rx_available ( void  )

Definition at line 1296 of file svc.c.

References __cdc_rx_available(), and SVC_CDC_RX_AVAILABLE.

◆ cdc_rx_init()

void cdc_rx_init ( void  )

Definition at line 1264 of file svc.c.

References __cdc_rx_init(), and SVC_CDC_RX_INIT.

◆ cdc_rx_push()

void cdc_rx_push ( const uint8_t *  data,
uint32_t  len 
)

Append bytes to the ring buffer.

Note
Designed for the privileged USB CDC ISR. The wrapper calls the priv-mode implementation directly (no SVC) because issuing an SVC from a high-priority interrupt is unsafe. Thread-mode callers can use it too — the priv-mode access works because the wrapper itself runs in handler / privileged context when called from an ISR; on host tests it is just a direct call.

Definition at line 1275 of file svc.c.

References __cdc_rx_push().

◆ cdc_rx_read_byte()

bool cdc_rx_read_byte ( uint8_t *  out)

Definition at line 1279 of file svc.c.

References __cdc_rx_read_byte(), and SVC_CDC_RX_READ_BYTE.