Skip to content

Commit

Permalink
sw/tests: Backport idea of feature checks
Browse files Browse the repository at this point in the history
  • Loading branch information
paulsc96 committed Nov 28, 2024
1 parent dee9900 commit c372247
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sw/tests/axirt_hello.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
#include "util.h"

int main(void) {
// Immediately return an error if AXI_REALM, DMA, or UART 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));
CHECK_ASSERT(-3, chs_hw_feature_present(CHESHIRE_HW_FEATURES_UART_BIT));

// This test requires at least two subordinate regions
CHECK_ASSERT(-4, 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);
Expand Down
3 changes: 3 additions & 0 deletions sw/tests/dma_2d.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
#include "dif/dma.h"

int main(void) {
// Immediately return an error if DMA is not present
CHECK_ASSERT(-1, 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!";

Expand Down

0 comments on commit c372247

Please sign in to comment.