From 078898fb69ec692e8a051746f423ad3171ff4d7c Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sun, 8 Dec 2019 16:07:50 +0100 Subject: net bufq size macro made public --- code/fe310/eos/net.c | 16 ++++++++-------- code/fe310/eos/net.h | 3 +++ code/fe310/eos/net_def.h | 3 --- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'code') diff --git a/code/fe310/eos/net.c b/code/fe310/eos/net.c index f3a82b8..ac2084d 100644 --- a/code/fe310/eos/net.c +++ b/code/fe310/eos/net.c @@ -18,19 +18,19 @@ #define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) #define MAX(X, Y) (((X) > (Y)) ? (X) : (Y)) -#define NET_BUFQ_IDX_MASK(IDX) ((IDX) & (NET_SIZE_BUFQ - 1)) +#define NET_BUFQ_IDX_MASK(IDX) ((IDX) & (EOS_NET_SIZE_BUFQ - 1)) typedef struct EOSNetBufQ { uint8_t idx_r; uint8_t idx_w; - unsigned char *array[NET_SIZE_BUFQ]; + unsigned char *array[EOS_NET_SIZE_BUFQ]; } EOSNetBufQ; static EOSMsgQ net_send_q; -static EOSMsgItem net_sndq_array[NET_SIZE_BUFQ]; +static EOSMsgItem net_sndq_array[EOS_NET_SIZE_BUFQ]; static EOSNetBufQ net_buf_q; -static unsigned char net_bufq_array[NET_SIZE_BUFQ][NET_SIZE_BUF]; +static unsigned char net_bufq_array[EOS_NET_SIZE_BUFQ][EOS_NET_SIZE_BUF]; static uint8_t net_state_flags = 0; static unsigned char net_state_type = 0; @@ -53,8 +53,8 @@ static void net_bufq_init(void) { int i; net_buf_q.idx_r = 0; - net_buf_q.idx_w = NET_SIZE_BUFQ; - for (i=0; i NET_SIZE_BUF) { + if (_eos_spi_state_len > EOS_NET_SIZE_BUF) { SPI1_REG(SPI_REG_CSMODE) = SPI_CSMODE_AUTO; SPI1_REG(SPI_REG_IE) = 0x0; } @@ -222,7 +222,7 @@ void eos_net_init(void) { int i; net_bufq_init(); - eos_msgq_init(&net_send_q, net_sndq_array, NET_SIZE_BUFQ); + eos_msgq_init(&net_send_q, net_sndq_array, EOS_NET_SIZE_BUFQ); for (i=0; i #include "event.h" +#define EOS_NET_SIZE_BUF 1500 +#define EOS_NET_SIZE_BUFQ 2 + #define EOS_NET_FLAG_BACQ 0x1 #define EOS_NET_FLAG_BFREE 0x2 diff --git a/code/fe310/eos/net_def.h b/code/fe310/eos/net_def.h index e38216d..ec795b1 100644 --- a/code/fe310/eos/net_def.h +++ b/code/fe310/eos/net_def.h @@ -1,6 +1,3 @@ -#define NET_SIZE_BUF 1500 -#define NET_SIZE_BUFQ 2 - #define NET_PIN_RTS 20 #define NET_PIN_CTS 22 -- cgit v1.2.3