From 8c6c68e92d6b4c8aa5e2fcc784ed52da40845acc Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sun, 13 Oct 2019 02:05:03 +0200 Subject: net refactor; rename cmd -> type --- code/fe310/eos/msgq.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'code/fe310/eos/msgq.c') diff --git a/code/fe310/eos/msgq.c b/code/fe310/eos/msgq.c index d242c69..2c31662 100644 --- a/code/fe310/eos/msgq.c +++ b/code/fe310/eos/msgq.c @@ -12,50 +12,50 @@ void eos_msgq_init(EOSMsgQ *msgq, EOSMsgItem *array, uint8_t size) { msgq->size = size; } -int eos_msgq_push(EOSMsgQ *msgq, unsigned char cmd, unsigned char *buffer, uint16_t len) { +int eos_msgq_push(EOSMsgQ *msgq, unsigned char type, unsigned char *buffer, uint16_t len) { if (msgq->idx_w - msgq->idx_r == msgq->size) return EOS_ERR_Q_FULL; uint8_t idx = EOS_MSGQ_IDX_MASK(msgq->idx_w, msgq->size); - msgq->array[idx].cmd = cmd; + msgq->array[idx].type = type; msgq->array[idx].buffer = buffer; msgq->array[idx].len = len; msgq->idx_w++; return EOS_OK; } -void eos_msgq_pop(EOSMsgQ *msgq, unsigned char *cmd, unsigned char **buffer, uint16_t *len) { +void eos_msgq_pop(EOSMsgQ *msgq, unsigned char *type, unsigned char **buffer, uint16_t *len) { if (msgq->idx_r == msgq->idx_w) { - *cmd = 0; + *type = 0; *buffer = NULL; } else { uint8_t idx = EOS_MSGQ_IDX_MASK(msgq->idx_r, msgq->size); - *cmd = msgq->array[idx].cmd; + *type = msgq->array[idx].type; *buffer = msgq->array[idx].buffer; *len = msgq->array[idx].len; msgq->idx_r++; } } -void eos_msgq_get(EOSMsgQ *msgq, unsigned char cmd, unsigned char **buffer, uint16_t *len) { +void eos_msgq_get(EOSMsgQ *msgq, unsigned char type, unsigned char **buffer, uint16_t *len) { uint8_t idx = EOS_MSGQ_IDX_MASK(msgq->idx_r, msgq->size); - unsigned char _cmd = msgq->array[idx].cmd; + unsigned char _type = msgq->array[idx].type; EOSMsgItem *tmp_item = &msgq->array[idx]; *buffer = msgq->array[idx].buffer; *len = msgq->array[idx].len; - if (_cmd == cmd) { + if (_type == type) { msgq->idx_r++; return; } for (idx = msgq->idx_r + 1; idx < msgq->idx_w; idx++) { *tmp_item = msgq->array[EOS_MSGQ_IDX_MASK(idx, msgq->size)]; - msgq->array[EOS_MSGQ_IDX_MASK(idx, msgq->size)].cmd = _cmd; + msgq->array[EOS_MSGQ_IDX_MASK(idx, msgq->size)].type = _type; msgq->array[EOS_MSGQ_IDX_MASK(idx, msgq->size)].buffer = *buffer; msgq->array[EOS_MSGQ_IDX_MASK(idx, msgq->size)].len = *len; - _cmd = tmp_item->cmd; + _type = tmp_item->type; *buffer = tmp_item->buffer; *len = tmp_item->len; - if (_cmd == cmd) { + if (_type == type) { msgq->idx_r++; return; } -- cgit v1.2.3