Add debug logging to overflow/error paths, fix pipeline=2 drop
This commit is contained in:
@@ -13,15 +13,17 @@ struct ring_buffer {
|
||||
uint16_t free() const { return N - used(); }
|
||||
bool empty() const { return head == tail; }
|
||||
|
||||
void push(std::span<const T> src) {
|
||||
if (src.size() > free()) return;
|
||||
bool push(std::span<const T> src) {
|
||||
if (src.size() > free()) return false;
|
||||
for (auto& v : src)
|
||||
data[(tail++) % N] = v;
|
||||
return true;
|
||||
}
|
||||
|
||||
void push(const T& v) {
|
||||
if (free() == 0) return;
|
||||
bool push(const T& v) {
|
||||
if (free() == 0) return false;
|
||||
data[(tail++) % N] = v;
|
||||
return true;
|
||||
}
|
||||
|
||||
void push_overwrite(const T& v) {
|
||||
|
||||
@@ -8,9 +8,10 @@
|
||||
struct usb_cdc {
|
||||
ring_buffer<uint8_t, 8192> tx;
|
||||
|
||||
void send(std::span<const uint8_t> data) {
|
||||
tx.push(data);
|
||||
bool send(std::span<const uint8_t> data) {
|
||||
if (!tx.push(data)) return false;
|
||||
drain();
|
||||
return true;
|
||||
}
|
||||
|
||||
void send(const std::vector<uint8_t>& data) {
|
||||
|
||||
Reference in New Issue
Block a user