7#include "lockfree_queue.hpp"
8#include "operation.hpp"
无锁队列实现 / Lock-free queue implementation
可写原始数据视图 / Mutable raw data view
ReadPort class for handling read operations.
bool Readable()
Checks if read operations are supported.
ReadFun read_fun_
Driver/backend read notification entry. 底层驱动或后端读取通知入口。
void Finish(bool in_isr, ErrorCode ans, ReadInfoBlock &info)
完成已由队列路径认领的读取操作。 Completes a read operation already claimed by the queue path.
ReadPort(size_t buffer_size=128)
Constructs a ReadPort with queue sizes.
ErrorCode block_result_
Final status for the current BLOCK read.
@ IDLE
No active waiter and no pending completion. 无等待者、无挂起完成。
std::atomic< BusyState > busy_
Shared read-progress handoff state. 共享的读进度交接状态。
size_t EmptySize()
获取队列的剩余可用空间。 Gets the remaining available space in the queue.
LockFreeQueue< uint8_t > * queue_data_
RX payload queue. 接收数据字节队列。
ErrorCode operator()(RawData data, ReadOperation &op, bool in_isr=false)
读取操作符重载,用于执行读取操作。 Overloaded function call operator to perform a read operation.
void ProcessPendingReads(bool in_isr)
Processes pending reads.
ReadPort & operator=(ReadFun fun)
赋值运算符重载,用于设置读取函数。 Overloaded assignment operator to set the read function.
size_t Size()
获取当前队列的已使用大小。 Gets the currently used size of the queue.
void FailAndClearAll(ErrorCode reason, bool in_isr)
失败完成并清空当前所有挂起读操作。
virtual void OnRxDequeue(bool)
RX 数据从软件队列成功出队后的通知。 Notification after bytes are popped from RX data queue.
ReadInfoBlock info_
In-flight read request metadata. 当前在途读取请求的元数据。
void MarkAsRunning(ReadInfoBlock &info)
标记读取操作为运行中。 Marks the read operation as running.
@ OK
操作成功 | Operation successful
ErrorCode(* ReadFun)(ReadPort &port, bool in_isr)
Function pointer type for read notifications.
Read information block structure.