From 9804469a30a877a830e115361b0b78859eaa4d67 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Wed, 11 Dec 2019 03:50:14 +0100 Subject: cell fixed; cell voice test passed --- code/esp32/components/eos/net.c | 52 ++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 35 deletions(-) (limited to 'code/esp32/components/eos/net.c') diff --git a/code/esp32/components/eos/net.c b/code/esp32/components/eos/net.c index be4d0f1..a372e3a 100644 --- a/code/esp32/components/eos/net.c +++ b/code/esp32/components/eos/net.c @@ -19,10 +19,6 @@ #include "msgq.h" #include "net.h" -#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y)) -#define MAX(X, Y) (((X) > (Y)) ? (X) : (Y)) -#define NET_BUFQ_IDX_MASK(IDX) ((IDX) & (EOS_NET_SIZE_BUFQ - 1)) - #define SPI_GPIO_RTS 22 #define SPI_GPIO_CTS 21 #define SPI_GPIO_MOSI 23 @@ -30,13 +26,8 @@ #define SPI_GPIO_SCLK 18 #define SPI_GPIO_CS 5 -typedef struct EOSNetBufQ { - uint8_t idx_r; - uint8_t idx_w; - unsigned char *array[EOS_NET_SIZE_BUFQ]; -} EOSNetBufQ; - -static EOSNetBufQ net_buf_q; +static EOSBufQ net_buf_q; +static unsigned char *net_bufq_array[EOS_NET_SIZE_BUFQ]; static EOSMsgQ net_send_q; static EOSMsgItem net_sndq_array[EOS_NET_SIZE_SNDQ]; @@ -52,25 +43,6 @@ static void bad_handler(unsigned char mtype, unsigned char *buffer, uint16_t len ESP_LOGE(TAG, "NET RECV: bad handler: %d", mtype); } -static void net_bufq_init(void) { - int i; - - net_buf_q.idx_r = 0; - net_buf_q.idx_w = EOS_NET_SIZE_BUFQ; - for (i=0; i> 3)); + // ESP_LOGI(TAG, "RECV:%d", (buf_recv[0] >> 3)); repeat = 0; if (buf_recv[0] != 0) { mtype = (buf_recv[0] >> 3); @@ -184,8 +156,11 @@ void eos_net_init(void) { ret=spi_slave_initialize(HSPI_HOST, &buscfg, &slvcfg, 1); assert(ret==ESP_OK); - net_bufq_init(); eos_msgq_init(&net_send_q, net_sndq_array, EOS_NET_SIZE_SNDQ); + eos_bufq_init(&net_buf_q, net_bufq_array, EOS_NET_SIZE_BUFQ); + for (i=0; i