summaryrefslogtreecommitdiff
path: root/code/fe310/eos/msgq.c
diff options
context:
space:
mode:
Diffstat (limited to 'code/fe310/eos/msgq.c')
-rw-r--r--code/fe310/eos/msgq.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/code/fe310/eos/msgq.c b/code/fe310/eos/msgq.c
index 07ea70f..e76090c 100644
--- a/code/fe310/eos/msgq.c
+++ b/code/fe310/eos/msgq.c
@@ -79,6 +79,10 @@ int eos_msgq_get(EOSMsgQ *msgq, unsigned char type, unsigned char *selector, uin
return 0;
}
+uint8_t eos_msgq_len(EOSMsgQ *msgq) {
+ return (uint8_t)(msgq->idx_w - msgq->idx_r);
+}
+
void eos_bufq_init(EOSBufQ *bufq, unsigned char **array, uint8_t size) {
bufq->idx_r = 0;
bufq->idx_w = 0;
@@ -99,3 +103,6 @@ unsigned char *eos_bufq_pop(EOSBufQ *bufq) {
return bufq->array[IDX_MASK(bufq->idx_r++, bufq->size)];
}
+uint8_t eos_bufq_len(EOSBufQ *bufq) {
+ return (uint8_t)(bufq->idx_w - bufq->idx_r);
+}