From e57fbcb24bb8fc79e288ea4ee489100d598815be Mon Sep 17 00:00:00 2001 From: rusefi Date: Sun, 21 Jun 2020 15:50:21 -0400 Subject: [PATCH] refactoring --- firmware/console/binary/tunerstudio_io.cpp | 2 ++ firmware/console/binary/tunerstudio_io.h | 17 -------------- firmware/console/connector_uart_dma.h | 26 ++++++++++++++++++++++ 3 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 firmware/console/connector_uart_dma.h diff --git a/firmware/console/binary/tunerstudio_io.cpp b/firmware/console/binary/tunerstudio_io.cpp index e5ba1217cb..403dcf8444 100644 --- a/firmware/console/binary/tunerstudio_io.cpp +++ b/firmware/console/binary/tunerstudio_io.cpp @@ -9,6 +9,8 @@ #include "os_access.h" #include "tunerstudio_io.h" #include "console_io.h" +#include "connector_uart_dma.h" + #if EFI_SIMULATOR #include "rusEfiFunctionalTest.h" #endif diff --git a/firmware/console/binary/tunerstudio_io.h b/firmware/console/binary/tunerstudio_io.h index ee9541fa1c..c2fd5b7700 100644 --- a/firmware/console/binary/tunerstudio_io.h +++ b/firmware/console/binary/tunerstudio_io.h @@ -31,23 +31,6 @@ typedef struct { char crcReadBuffer[BLOCKING_FACTOR + 30]; } ts_channel_s; -// See uart_dma_s -#define TS_FIFO_BUFFER_SIZE (BLOCKING_FACTOR + 30) -// This must be a power of 2! -#define TS_DMA_BUFFER_SIZE 32 - -// struct needed for async DMA transfer mode (see TS_UART_DMA_MODE) -typedef struct { - // circular DMA buffer - uint8_t dmaBuffer[TS_DMA_BUFFER_SIZE]; - // current read position for the DMA buffer - volatile int readPos; - // secondary FIFO buffer for async. transfer - uint8_t buffer[TS_FIFO_BUFFER_SIZE]; - // input FIFO Rx queue - input_queue_t fifoRxQueue; -} uart_dma_s; - // These commands are used exclusively by the rusEfi console #define TS_TEST_COMMAND 't' // 0x74 #define TS_GET_FILE_RANGE '2' // 0x32 diff --git a/firmware/console/connector_uart_dma.h b/firmware/console/connector_uart_dma.h new file mode 100644 index 0000000000..56aa6b83fd --- /dev/null +++ b/firmware/console/connector_uart_dma.h @@ -0,0 +1,26 @@ +/* + * @file connector_uart_dma.h + * + * @date Jun 21, 2020 + * @author Andrey Belomutskiy, (c) 2012-2020 + */ + +#pragma once +#include "global.h" + +// See uart_dma_s +#define TS_FIFO_BUFFER_SIZE (BLOCKING_FACTOR + 30) +// This must be a power of 2! +#define TS_DMA_BUFFER_SIZE 32 + +// struct needed for async DMA transfer mode (see TS_UART_DMA_MODE) +typedef struct { + // circular DMA buffer + uint8_t dmaBuffer[TS_DMA_BUFFER_SIZE]; + // current read position for the DMA buffer + volatile int readPos; + // secondary FIFO buffer for async. transfer + uint8_t buffer[TS_FIFO_BUFFER_SIZE]; + // input FIFO Rx queue + input_queue_t fifoRxQueue; +} uart_dma_s;