diff options
author | Uros Majstorovic <majstor@majstor.org> | 2019-12-08 16:07:50 +0100 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2019-12-08 16:07:50 +0100 |
commit | 078898fb69ec692e8a051746f423ad3171ff4d7c (patch) | |
tree | 8122ca1f9ed7be632f1d8887fd56e636a4466eb2 /code/fe310 | |
parent | d5fe860ad42d69100f6f62f15d7c45edad1809c5 (diff) |
net bufq size macro made public
Diffstat (limited to 'code/fe310')
-rw-r--r-- | code/fe310/eos/net.c | 16 | ||||
-rw-r--r-- | code/fe310/eos/net.h | 3 | ||||
-rw-r--r-- | code/fe310/eos/net_def.h | 3 |
3 files changed, 11 insertions, 11 deletions
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_BUFQ; i++) { + net_buf_q.idx_w = EOS_NET_SIZE_BUFQ; + for (i=0; i<EOS_NET_SIZE_BUFQ; i++) { net_buf_q.array[i] = net_bufq_array[i]; } } @@ -175,7 +175,7 @@ static void net_handler_xchg(void) { _eos_spi_state_len = ((_eos_spi_state_len + 2)/4 + 1) * 4 - 2; } - if (_eos_spi_state_len > 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<EOS_NET_MAX_MTYPE; i++) { evt_handler[i] = eos_evtq_bad_handler; } diff --git a/code/fe310/eos/net.h b/code/fe310/eos/net.h index e0fdbf9..982ee1b 100644 --- a/code/fe310/eos/net.h +++ b/code/fe310/eos/net.h @@ -1,6 +1,9 @@ #include <stdint.h> #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 |