forked from pulp-platform/snitch_cluster
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sw: Fix
snrt_dma_wait
implementation (pulp-platform#153)
The previous implementation of `snrt_dma_wait` was incorrect as it had an infinite loop in the case that `tid` was the last completed transaction. Looking at the documentation, the snippet in custom_instructions.md shows the correct way of implementing the transaction check (get last completed tid and loop if it's less than the one we are waiting for) except it had its register operands swapped. This PR uses that implementation instead, fixes the small bug in the documentation and changes one of the waits in `dma_simple.c` to make sure we don't regress either. --------- Co-authored-by: Luca Colagrande <[email protected]>
- Loading branch information
Showing
5 changed files
with
32 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2020 ETH Zurich and University of Bologna. | ||
// Licensed under the Apache License, Version 2.0, see LICENSE for details. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include <snrt.h> | ||
|
||
// Allocate a buffer in the main memory which we will use to copy data around | ||
// with the DMA. | ||
uint32_t buffer[32]; | ||
|
||
int main() { | ||
if (snrt_global_core_idx() != 8) return 0; // only DMA core | ||
|
||
// Populate source buffer. | ||
uint32_t buffer_src[32]; | ||
for (uint32_t i = 0; i < 32; i++) { | ||
buffer_src[i] = i + 1; | ||
} | ||
|
||
// Start a DMA transfer of zero size. | ||
snrt_dma_txid_t id = snrt_dma_start_1d(buffer, buffer_src, 0); | ||
snrt_dma_wait(id); | ||
|
||
// Test is successful if the previous transfer doesn't block. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters