From 39a5937695e05223496a93b3917f0217ded4d86d Mon Sep 17 00:00:00 2001 From: Paul Scheffler Date: Thu, 28 Nov 2024 22:47:01 +0100 Subject: [PATCH] sw/tests: Backport idea of feature checks --- sw/tests/axirt_hello.c | 7 +++++++ sw/tests/dma_2d.c | 3 +++ 2 files changed, 10 insertions(+) diff --git a/sw/tests/axirt_hello.c b/sw/tests/axirt_hello.c index 2d84e5d55..c7c63284b 100644 --- a/sw/tests/axirt_hello.c +++ b/sw/tests/axirt_hello.c @@ -17,6 +17,13 @@ #include "util.h" int main(void) { + // Immediately return an error if AXI_REALM or DMA are not present + CHECK_ASSERT(-1, chs_hw_feature_present(CHESHIRE_HW_FEATURES_AXIRT_BIT)); + CHECK_ASSERT(-2, chs_hw_feature_present(CHESHIRE_HW_FEATURES_DMA_BIT)); + + // This test requires at least two subordinate regions + CHECK_ASSERT(-3, AXI_RT_PARAM_NUM_SUB >= 2); + char str[] = "Hello AXI-RT!\r\n"; uint32_t rtc_freq = *reg32(&__base_regs, CHESHIRE_RTC_FREQ_REG_OFFSET); uint64_t reset_freq = clint_get_core_freq(rtc_freq, 2500); diff --git a/sw/tests/dma_2d.c b/sw/tests/dma_2d.c index e262f0b30..faf42cc18 100644 --- a/sw/tests/dma_2d.c +++ b/sw/tests/dma_2d.c @@ -11,6 +11,9 @@ #include "dif/dma.h" int main(void) { + // Immediately return an error if DMA is not present + CHECK_ASSERT(-2, chs_hw_feature_present(CHESHIRE_HW_FEATURES_DMA_BIT)); + volatile char src_cached[] = "This is a DMA test"; volatile char gold[] = "This ishis is is is as is a DMA test!";