diff --git a/porting/himax/we2/drivers/drv_shared_cfg.h b/porting/himax/we2/drivers/drv_shared_cfg.h index a77cd511..bca8530f 100644 --- a/porting/himax/we2/drivers/drv_shared_cfg.h +++ b/porting/himax/we2/drivers/drv_shared_cfg.h @@ -51,19 +51,34 @@ static_assert(YUV422_BASE_SIZE <= SRAM_1_TAIL_SIZE, "SRAM1 is not enough"); #define JPEG_BASE_SIZE_EXP(w, h) \ (((623 + (size_t)(w / 16) * (size_t)(h / 16) * 128 + 35) >> 2) << 2) // 4x quantization -#define JPEG_BASE_ADDR ALIGN_32BIT(WDMA_1_BASE_ADDR + WDMA_1_BASE_SIZE) -#define JPEG_BASE_SIZE JPEG_BASE_SIZE_EXP(FRAME_WIDTH_MAX, FRAME_HEIGHT_MAX) // 150KB - -#define JPEG_FILL_BASE_ADDR ALIGN_32BIT(JPEG_BASE_ADDR + JPEG_BASE_SIZE) -#define JPEG_FILL_SIZE 0x1000 // 4KB - -#define SPI_TRANSPORT_TX_BASE_ADDR ALIGN_32BIT(JPEG_FILL_BASE_ADDR + JPEG_FILL_SIZE) -#define SPI_TRANSPORT_TX_BASE_SIZE 64 * 1024 // 64KB -#define SPI_TRANSPORT_RX_BASE_ADDR ALIGN_32BIT(SPI_TRANSPORT_TX_BASE_ADDR + SPI_TRANSPORT_TX_BASE_SIZE) -#define SPI_TRANSPORT_RX_BASE_SIZE 8 * 1024 // 8KB - -#define SRAM_2_START_ADDR_FREE (SPI_TRANSPORT_RX_BASE_ADDR + SPI_TRANSPORT_RX_BASE_SIZE) -#define SRAM_2_SIZE_FREE (SRAM_2_SIZE - (SRAM_2_START_ADDR_FREE - SRAM_2_START_ADDR)) +#define JPEG_BASE_ADDR ALIGN_32BIT(WDMA_1_BASE_ADDR + WDMA_1_BASE_SIZE) +#define JPEG_BASE_SIZE JPEG_BASE_SIZE_EXP(FRAME_WIDTH_MAX, FRAME_HEIGHT_MAX) // 150KB + +#define JPEG_FILL_BASE_ADDR ALIGN_32BIT(JPEG_BASE_ADDR + JPEG_BASE_SIZE) +#define JPEG_FILL_SIZE 0x1000 // 4KB + +#define SPI_TRANSPORT_TX_BASE_ADDR ALIGN_32BIT(JPEG_FILL_BASE_ADDR + JPEG_FILL_SIZE) +#define SPI_TRANSPORT_TX_BASE_SIZE 64 * 1024 // 64KB +#define SPI_TRANSPORT_RX_BASE_ADDR ALIGN_32BIT(SPI_TRANSPORT_TX_BASE_ADDR + SPI_TRANSPORT_TX_BASE_SIZE) +#define SPI_TRANSPORT_RX_BASE_SIZE 8 * 1024 // 8KB + +#define SERIAL1_TRANSPORT_TX_BASE_ADDR ALIGN_32BIT(SPI_TRANSPORT_RX_BASE_ADDR + SPI_TRANSPORT_RX_BASE_SIZE) +#define SERIAL1_TRANSPORT_TX_BASE_SIZE 32 * 1024 +#define SERIAL1_TRANSPORT_RX_BASE_ADDR ALIGN_32BIT(SERIAL1_TRANSPORT_TX_BASE_ADDR + SERIAL1_TRANSPORT_TX_BASE_SIZE) +#define SERIAL1_TRANSPORT_RX_BASE_SIZE 8 * 1024 + +#define SERIAL2_TRANSPORT_TX_BASE_ADDR ALIGN_32BIT(SERIAL1_TRANSPORT_RX_BASE_ADDR + SERIAL1_TRANSPORT_RX_BASE_SIZE) +#define SERIAL2_TRANSPORT_TX_BASE_SIZE 32 * 1024 +#define SERIAL2_TRANSPORT_RX_BASE_ADDR ALIGN_32BIT(SERIAL2_TRANSPORT_TX_BASE_ADDR + SERIAL2_TRANSPORT_TX_BASE_SIZE) +#define SERIAL2_TRANSPORT_RX_BASE_SIZE 8 * 1024 + +#define WIRE_TRANSPORT_TX_BASE_ADDR ALIGN_32BIT(SERIAL2_TRANSPORT_RX_BASE_ADDR + SERIAL2_TRANSPORT_RX_BASE_SIZE) +#define WIRE_TRANSPORT_TX_BASE_SIZE 32 * 1024 +#define WIRE_TRANSPORT_RX_BASE_ADDR ALIGN_32BIT(WIRE_TRANSPORT_TX_BASE_ADDR + WIRE_TRANSPORT_TX_BASE_SIZE) +#define WIRE_TRANSPORT_RX_BASE_SIZE 8 * 1024 + +#define SRAM_2_START_ADDR_FREE (WIRE_TRANSPORT_TX_BASE_ADDR + WIRE_TRANSPORT_TX_BASE_SIZE) +#define SRAM_2_SIZE_FREE (SRAM_2_SIZE - (SRAM_2_START_ADDR_FREE - SRAM_2_START_ADDR)) static_assert(SRAM_2_SIZE_FREE > 0, "SRAM2 is not enough"); diff --git a/porting/himax/we2/el_flash_we2.cpp b/porting/himax/we2/el_flash_we2.cpp index f1eaf56d..be6b7191 100644 --- a/porting/himax/we2/el_flash_we2.cpp +++ b/porting/himax/we2/el_flash_we2.cpp @@ -75,11 +75,7 @@ bool _el_flash_enable_xip() { bool el_flash_mmap_init(uint32_t* flash_addr, uint32_t* size, const uint8_t** mmap, uint32_t* handler) { *flash_addr = 0x00400000; -#ifdef CONFIG_EL_BOARD_GROVE_VISION_AI_WE2 - *size = 0x00400000; -#else *size = 0x00A00000; -#endif if (!_el_flash_init()) [[unlikely]] return false; diff --git a/porting/himax/we2/el_serial2_we2.cpp b/porting/himax/we2/el_serial2_we2.cpp index 526af7d8..12a11725 100644 --- a/porting/himax/we2/el_serial2_we2.cpp +++ b/porting/himax/we2/el_serial2_we2.cpp @@ -85,10 +85,10 @@ el_err_code_t Serial2WE2::init() { _console_uart->uart_open(UART_BAUDRATE_921600); if (!_rb_rx) [[likely]] - _rb_rx = new lwRingBuffer{8192}; + _rb_rx = new lwRingBuffer{(char*)SERIAL2_TRANSPORT_RX_BASE_ADDR, SERIAL2_TRANSPORT_RX_BASE_SIZE}; if (!_rb_tx) [[likely]] - _rb_tx = new lwRingBuffer{32768}; + _rb_tx = new lwRingBuffer{(char*)SERIAL2_TRANSPORT_TX_BASE_ADDR, SERIAL2_TRANSPORT_TX_BASE_SIZE}; _mutex_tx = xSemaphoreCreateMutex(); diff --git a/porting/himax/we2/el_serial_we2.cpp b/porting/himax/we2/el_serial_we2.cpp index 03c2471a..0bb316fd 100644 --- a/porting/himax/we2/el_serial_we2.cpp +++ b/porting/himax/we2/el_serial_we2.cpp @@ -77,10 +77,10 @@ el_err_code_t SerialWE2::init() { _console_uart->uart_open(UART_BAUDRATE_921600); if (!_rb_rx) [[likely]] - _rb_rx = new lwRingBuffer{8192}; + _rb_rx = new lwRingBuffer{(char*)SERIAL1_TRANSPORT_RX_BASE_ADDR, SERIAL1_TRANSPORT_RX_BASE_SIZE}; if (!_rb_tx) [[likely]] - _rb_tx = new lwRingBuffer{32768}; + _rb_tx = new lwRingBuffer{(char*)SERIAL1_TRANSPORT_TX_BASE_ADDR, SERIAL1_TRANSPORT_TX_BASE_SIZE}; _mutex_tx = xSemaphoreCreateMutex(); diff --git a/porting/himax/we2/el_wire_we2.cpp b/porting/himax/we2/el_wire_we2.cpp index f64afcaf..c2fced15 100644 --- a/porting/himax/we2/el_wire_we2.cpp +++ b/porting/himax/we2/el_wire_we2.cpp @@ -171,8 +171,8 @@ el_err_code_t WireWE2::init() { this->_is_present = this->i2c ? true : false; - this->rx_ring_buffer = new lwRingBuffer(1024); - this->tx_ring_buffer = new lwRingBuffer(1024 * 24); + this->rx_ring_buffer = new lwRingBuffer((char*)WIRE_TRANSPORT_RX_BASE_ADDR, WIRE_TRANSPORT_RX_BASE_SIZE); + this->tx_ring_buffer = new lwRingBuffer((char*)WIRE_TRANSPORT_TX_BASE_ADDR, WIRE_TRANSPORT_TX_BASE_SIZE); this->wire_read_enable(sizeof(this->tx_buffer));