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
+13 -4
View File
@@ -37,11 +37,18 @@
const char *const offon[] = {"OFF", "ON"};
#define CACHE_SIZE 16
_Static_assert((CACHE_SIZE & (CACHE_SIZE - 1)) == 0,
"CACHE_SIZE must be a power of two (qMask depends on it)");
AVCLAN_frame_t frames[CACHE_SIZE];
RFrame_t responses[CACHE_SIZE];
uint8_t framesdata[CACHE_SIZE][MAXMSGLEN];
void *cacheSlots[CACHE_SIZE];
void *rcacheSlots[CACHE_SIZE];
void *incomingSlots[CACHE_SIZE];
void *outgoingSlots[CACHE_SIZE];
Queue_t cache, rcache, incoming, outgoing;
volatile uint8_t enqueueStatus = 0;
@@ -107,11 +114,13 @@ int main() {
frames[i].data = framesdata[i];
}
constructQueue(&cache, frames, sizeof(AVCLAN_frame_t), CACHE_SIZE, 1);
constructEmptyQueue(&incoming, sizeof(AVCLAN_frame_t), CACHE_SIZE);
constructQueue(&cache, cacheSlots, frames, sizeof(AVCLAN_frame_t), CACHE_SIZE,
1);
constructEmptyQueue(&incoming, incomingSlots, CACHE_SIZE);
constructQueue(&rcache, responses, sizeof(RFrame_t), CACHE_SIZE, 1);
constructEmptyQueue(&outgoing, sizeof(RFrame_t), CACHE_SIZE);
constructQueue(&rcache, rcacheSlots, responses, sizeof(RFrame_t), CACHE_SIZE,
1);
constructEmptyQueue(&outgoing, outgoingSlots, CACHE_SIZE);
Setup();
print_help();