Skip to content

Commit

Permalink
[sw] update DMA test programs
Browse files Browse the repository at this point in the history
  • Loading branch information
stnolting committed Oct 7, 2023
1 parent af5060d commit 6d5e80f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 4 additions & 5 deletions sw/example/demo_dma/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,7 @@ int main() {
neorv32_cpu_sleep();

// check if transfer was successful
rc = neorv32_dma_status();
if ((rc == DMA_STATUS_ERR_RD) || (rc == DMA_STATUS_ERR_WR)) {
if (neorv32_dma_status() != DMA_STATUS_IDLE) {
neorv32_uart0_printf("Transfer failed!\n");
}

Expand Down Expand Up @@ -242,9 +241,9 @@ int main() {
// sleep until interrupt (from DMA)
neorv32_cpu_sleep();

// check DMA status
rc = neorv32_dma_status();
if ((rc == DMA_STATUS_ERR_RD) || (rc == DMA_STATUS_ERR_WR)) {
// transfer successful (and actually executed)?
if ((neorv32_dma_done() == 0) || // check if the DMA has actually completed a transfer
(neorv32_dma_status() != DMA_STATUS_IDLE)) { // DMA is in idle mode without errors
neorv32_uart0_printf("Transfer failed!\n");
}

Expand Down
1 change: 1 addition & 0 deletions sw/example/processor_check/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1489,6 +1489,7 @@ int main() {

if ((neorv32_cpu_csr_read(CSR_MCAUSE) == DMA_TRAP_CODE) && // correct interrupt source
(neorv32_crc_get() == 0x31DC476E) && // correct CRC sum
(neorv32_dma_done() != 0) && // DMA has actually attempted a transfer
(neorv32_dma_status() == DMA_STATUS_IDLE)) { // DMA back in idle mode without errors
test_ok();
}
Expand Down

0 comments on commit 6d5e80f

Please sign in to comment.