From db36e9d2dc88e91a1e0ec77c476d7523a252604d Mon Sep 17 00:00:00 2001 From: Luka Macan Date: Wed, 15 Nov 2023 12:23:00 +0100 Subject: [PATCH] Add mchan_check_end_policy flag to hw_desc --- dory/Hardware_targets/PULP/Common/Templates/Makefile.t | 3 +++ dory/Hardware_targets/PULP/Common/Utils/dory_dma.c | 2 -- dory/Hardware_targets/PULP/GAP8/HW_description.json | 3 ++- dory/Hardware_targets/PULP/GAP8_L2/HW_description.json | 4 ++-- dory/Hardware_targets/PULP/GAP9/HW_description.json | 3 ++- dory/Hardware_targets/PULP/PULP_gvsoc/HW_description.json | 3 ++- dory/Utils/Templates_writer/Makefile_template_writer.py | 5 +++++ 7 files changed, 16 insertions(+), 7 deletions(-) diff --git a/dory/Hardware_targets/PULP/Common/Templates/Makefile.t b/dory/Hardware_targets/PULP/Common/Templates/Makefile.t index 19679e5d..656ee284 100644 --- a/dory/Hardware_targets/PULP/Common/Templates/Makefile.t +++ b/dory/Hardware_targets/PULP/Common/Templates/Makefile.t @@ -58,6 +58,9 @@ APP_CFLAGS += -DALWAYS_BLOCK_DMA_TRANSFERS % if single_core_dma: APP_CFLAGS += -DSINGLE_CORE_DMA % endif +% if mchan_check_end_policy: +APP_CFLAGS += -DMCHAN_${mchan_check_end_policy.upper()} +% endif include ${prefix}vars.mk diff --git a/dory/Hardware_targets/PULP/Common/Utils/dory_dma.c b/dory/Hardware_targets/PULP/Common/Utils/dory_dma.c index a5f64e29..c673196c 100644 --- a/dory/Hardware_targets/PULP/Common/Utils/dory_dma.c +++ b/dory/Hardware_targets/PULP/Common/Utils/dory_dma.c @@ -8,8 +8,6 @@ // GAP8 hardware to be tested... #define MCHAN_BASE_ADDR (ARCHI_MCHAN_DEMUX_ADDR) // CLUSTER_MCHAN_ADDR #endif -#define MCHAN_EVENT -//#define MCHAN_POLLED #ifdef MCHAN_EVENT #define MCHAN_EVENT_BIT (ARCHI_CL_EVT_DMA0) // 8 #endif diff --git a/dory/Hardware_targets/PULP/GAP8/HW_description.json b/dory/Hardware_targets/PULP/GAP8/HW_description.json index a2f46f9c..36213d7e 100644 --- a/dory/Hardware_targets/PULP/GAP8/HW_description.json +++ b/dory/Hardware_targets/PULP/GAP8/HW_description.json @@ -41,5 +41,6 @@ }, "double_buffering": 1, "split_ints": true, - "blocking_dma_transfers": true + "blocking_dma_transfers": true, + "mchan_check_end_policy": "polled" } diff --git a/dory/Hardware_targets/PULP/GAP8_L2/HW_description.json b/dory/Hardware_targets/PULP/GAP8_L2/HW_description.json index 98a1489f..23e09c84 100644 --- a/dory/Hardware_targets/PULP/GAP8_L2/HW_description.json +++ b/dory/Hardware_targets/PULP/GAP8_L2/HW_description.json @@ -34,6 +34,6 @@ "accelerator core1-7 stack": 3400 }, "split_ints": true, - "double_buffering": 1 - + "double_buffering": 1, + "mchan_check_end_policy": "polled" } diff --git a/dory/Hardware_targets/PULP/GAP9/HW_description.json b/dory/Hardware_targets/PULP/GAP9/HW_description.json index 46b28b5c..a2c4bf06 100644 --- a/dory/Hardware_targets/PULP/GAP9/HW_description.json +++ b/dory/Hardware_targets/PULP/GAP9/HW_description.json @@ -43,5 +43,6 @@ "double_buffering": 2, "split_ints": true, "blocking_dma_transfers": false, - "single_core_dma": true + "single_core_dma": true, + "mchan_check_end_policy": "event" } diff --git a/dory/Hardware_targets/PULP/PULP_gvsoc/HW_description.json b/dory/Hardware_targets/PULP/PULP_gvsoc/HW_description.json index d9270ad8..8c24c3a5 100644 --- a/dory/Hardware_targets/PULP/PULP_gvsoc/HW_description.json +++ b/dory/Hardware_targets/PULP/PULP_gvsoc/HW_description.json @@ -39,5 +39,6 @@ "accelerator core1-7 stack": 3600 }, "split_ints": true, - "blocking_dma_transfers": false + "blocking_dma_transfers": false, + "mchan_check_end_policy": "event" } diff --git a/dory/Utils/Templates_writer/Makefile_template_writer.py b/dory/Utils/Templates_writer/Makefile_template_writer.py index 9968c57c..46238359 100644 --- a/dory/Utils/Templates_writer/Makefile_template_writer.py +++ b/dory/Utils/Templates_writer/Makefile_template_writer.py @@ -51,6 +51,11 @@ def print_template_Makefile( except KeyError: print("Makefile template writer: key 'single_core_dma' not found in HW description, using multi-core transfers!") single_core_dma = False + if 'mchan_check_end_policy' in HW_description: + supported_policies = ["polled", "event", "interrupt"] + assert HW_description['mchan_check_end_policy'] in supported_policies, \ + f"Requested mchan check end policy {HW_description['mchan_check_end_policy']} not supported: {supported_policies}" + tk['mchan_check_end_policy'] = HW_description['mchan_check_end_policy'] tk['single_core_dma'] = single_core_dma root = os.path.realpath(os.path.dirname(__file__)) tmpl = Template(filename=os.path.join(root, "../../Hardware_targets", HW_description["name"], template_location_rel))