Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sw: Fix snrt_dma_wait implementation #153

Merged
merged 2 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/rm/custom_instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ The DMSTATI instruction can be used to implement a blocking wait for the complet

dmcpyi a0, ...
1: dmstati t0, 0
bltu a0, t0, 1b
bltu t0, a0, 1b

Similarly, waiting for the completion of *all* DMA transfers:

Expand Down
3 changes: 1 addition & 2 deletions sw/snRuntime/src/dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ inline void snrt_dma_wait(snrt_dma_txid_t tid) {
( 0b000 << 12) | \
( (5) << 7) | \
(0b0101011 << 0) \n"
"sub t0, t0, %0 \n"
"blez t0, 1b \n" ::"r"(tid)
"bltu t0, %0, 1b \n" ::"r"(tid)
: "t0");
}

Expand Down
4 changes: 2 additions & 2 deletions sw/tests/dma_simple.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ int main() {
}

// Copy data to main memory.
snrt_dma_start_1d(buffer, buffer_src, sizeof(buffer));
snrt_dma_wait_all();
snrt_dma_txid_t id = snrt_dma_start_1d(buffer, buffer_src, sizeof(buffer));
snrt_dma_wait(id);

// Check that the main memory buffer contains the correct data.
for (uint32_t i = 0; i < 32; i++) {
Expand Down
Loading