From e2ada1a9f417fa1192898b4b7bfade1ef4784c9e Mon Sep 17 00:00:00 2001 From: Pierre Guillod Date: Mon, 23 Oct 2023 15:25:32 +0200 Subject: [PATCH] revert i2s, swap 0/1 by TX/RX, iffifo fifo instance typo --- hw/ip/i2s/data/i2s.hjson | 2 +- hw/ip/i2s/rtl/i2s.sv | 1 + hw/ip_examples/iffifo/rtl/iffifo.sv | 2 +- sw/applications/example_iffifo/main.c | 8 +++++--- sw/device/lib/drivers/dma/dma.h | 4 ++-- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/hw/ip/i2s/data/i2s.hjson b/hw/ip/i2s/data/i2s.hjson index 3a2f01317..95b1e3be4 100644 --- a/hw/ip/i2s/data/i2s.hjson +++ b/hw/ip/i2s/data/i2s.hjson @@ -109,7 +109,7 @@ hwext: "true" hwre: "true" fields: [ - { bits: "31:0", name: "RXDATA", desc: "latest rx data if DATA_READY flag is set" } + { bits: "31:0", name: "RXDATA", desc: "latest rx data if DATA_READY flag is set", hwaccess: "hrw"} ] } diff --git a/hw/ip/i2s/rtl/i2s.sv b/hw/ip/i2s/rtl/i2s.sv index 80735eca8..aa101e62a 100644 --- a/hw/ip/i2s/rtl/i2s.sv +++ b/hw/ip/i2s/rtl/i2s.sv @@ -98,6 +98,7 @@ module i2s #( ); + // Core logic i2s_core #( .MaxWordWidth(MaxWordWidth), diff --git a/hw/ip_examples/iffifo/rtl/iffifo.sv b/hw/ip_examples/iffifo/rtl/iffifo.sv index af141b8f8..f7114bf96 100644 --- a/hw/ip_examples/iffifo/rtl/iffifo.sv +++ b/hw/ip_examples/iffifo/rtl/iffifo.sv @@ -47,7 +47,7 @@ module iffifo #( fifo_v3 #( .DEPTH(DEPTH), .DATA_WIDTH(WIDTH) - ) pdm2pcm_fifo_i ( + ) iffifo_fifo_i ( .clk_i, .rst_ni, .flush_i(1'b0), diff --git a/sw/applications/example_iffifo/main.c b/sw/applications/example_iffifo/main.c index e1fd6f973..4b00dc9f1 100644 --- a/sw/applications/example_iffifo/main.c +++ b/sw/applications/example_iffifo/main.c @@ -30,7 +30,7 @@ int32_t to_fifo [3] __attribute__ ((aligned (4))) = { 1, 2, 3 }; int32_t from_fifo[3] __attribute__ ((aligned (4))) = { 0, 0, 0 }; -int8_t dma_intr_flag; +int8_t dma_intr_flag = 0; void dma_intr_handler_trans_done(void) { dma_intr_flag = 1; @@ -72,7 +72,7 @@ int main(int argc, char *argv[]) { tgt_dst.ptr = IFFIFO_START_ADDRESS + IFFIFO_FIFO_IN_REG_OFFSET; tgt_dst.inc_du = 0; - tgt_dst.trig = DMA_TRIG_SLOT_EXT0; + tgt_dst.trig = DMA_TRIG_SLOT_TX; tgt_dst.type = DMA_DATA_TYPE_WORD; trans.src = &tgt_src; @@ -89,9 +89,11 @@ int main(int argc, char *argv[]) { PRINTF("Launch MM -> Stream DMA\n"); dma_launch( &trans ); + if (!dma_intr_flag) { wait_for_interrupt(); } + tgt_src.ptr = IFFIFO_START_ADDRESS + IFFIFO_FIFO_OUT_REG_OFFSET; tgt_src.inc_du = 0; - tgt_src.trig = DMA_TRIG_SLOT_EXT1; + tgt_src.trig = DMA_TRIG_SLOT_RX; tgt_src.type = DMA_DATA_TYPE_WORD; tgt_src.size_du = 3; diff --git a/sw/device/lib/drivers/dma/dma.h b/sw/device/lib/drivers/dma/dma.h index d05912776..ccccb5b5a 100644 --- a/sw/device/lib/drivers/dma/dma.h +++ b/sw/device/lib/drivers/dma/dma.h @@ -104,8 +104,8 @@ typedef enum DMA_TRIG_SLOT_SPI_FLASH_RX = 4, /*!< Slot 3 (MEM < SPI FLASH). */ DMA_TRIG_SLOT_SPI_FLASH_TX = 8, /*!< Slot 4 (MEM > SPI FLASH). */ DMA_TRIG_SLOT_I2S = 16,/*!< Slot 5 (I2S). */ - DMA_TRIG_SLOT_EXT0 = 32,/*!< Slot 6 (External peripherals 0). */ - DMA_TRIG_SLOT_EXT1 = 64,/*!< Slot 7 (External peripherals 1). */ + DMA_TRIG_SLOT_TX = 32,/*!< Slot 6 (External peripherals TX). */ + DMA_TRIG_SLOT_RX = 64,/*!< Slot 7 (External peripherals RX). */ DMA_TRIG__size, /*!< Not used, only for sanity checks. */ DMA_TRIG__undef, /*!< DMA will not be used. */ } dma_trigger_slot_mask_t;