Fix incorrect definition/initialization of caches

This commit is contained in:
Allen Hill
2026-05-13 18:17:27 -07:00
parent 551cdaa23c
commit 042521a744
3 changed files with 28 additions and 17 deletions
+8 -7
View File
@@ -4,24 +4,25 @@
#include "avclandrv.h"
#include "queue.h"
void constructQueue(Queue_t *q, void *buf, uint8_t size, uint8_t len,
uint8_t constructFull) {
void constructQueue(Queue_t *q, void **slots, void *items, uint8_t itemSize,
uint8_t len, uint8_t constructFull) {
q->read = 0;
q->size = len;
q->buf = slots;
if (!!constructFull) {
q->write = len;
for (uint8_t i = 0; i < len; ++i) {
q->buf[i] = buf;
buf = (char *)buf + size;
q->buf[i] = items;
items = (char *)items + itemSize;
}
} else {
q->write = 0;
}
}
void constructEmptyQueue(Queue_t *q, uint8_t size, uint8_t len) {
constructQueue(q, NULL, size, len, 0);
void constructEmptyQueue(Queue_t *q, void **slots, uint8_t len) {
constructQueue(q, slots, NULL, 0, len, 0);
}
uint8_t isEmpty(const Queue_t *q) { return (q->write == q->read); }
@@ -43,7 +44,7 @@ uint8_t pushQueue(Queue_t *q, void *x) {
return 0;
}
const void *peekQueue(const Queue_t *q) {
void *peekQueue(const Queue_t *q) {
if (isEmpty(q))
return NULL;