Skip to content

Commit

Permalink
lint: C sources
Browse files Browse the repository at this point in the history
  • Loading branch information
fischeti committed Jul 15, 2024
1 parent 5fb1d0c commit 79188c6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
8 changes: 6 additions & 2 deletions sw/snRuntime/src/dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ inline void snrt_dma_wait_all_channel(uint32_t channel) {
"1: \n"
"dmstat %[tmp], %[cfg] \n"
"bne %[tmp], zero, 1b \n"
: [ tmp ] "=&r"(tmp) : [ cfg ] "r"(cfg) :"t0");
: [ tmp ] "=&r"(tmp)
: [ cfg ] "r"(cfg)
: "t0");
}

/// Wait until all channels are idle
Expand All @@ -249,7 +251,9 @@ inline void snrt_dma_wait_all_channels(uint32_t num_channels) {
"1: \n"
"dmstat %[tmp], %[cfg] \n"
"bne %[tmp], zero, 1b \n"
: [ tmp ] "=&r"(tmp) : [ cfg ] "r"(cfg) :"t0");
: [ tmp ] "=&r"(tmp)
: [ cfg ] "r"(cfg)
: "t0");
}
}

Expand Down
14 changes: 8 additions & 6 deletions sw/tests/dma_mchan.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,21 @@ int main() {
}

// Start slow 2D transfer from L3 to L1 on channel 0.
snrt_dma_start_2d_channel(buffer_dst_l1_1, buffer_src_l3, TRANSFER_SIZE,
0, TRANSFER_SIZE, TRANSFER_REP, 0);
snrt_dma_start_2d_channel(buffer_dst_l1_1, buffer_src_l3, TRANSFER_SIZE, 0,
TRANSFER_SIZE, TRANSFER_REP, 0);

// Start fast 2D transfer from L1 to L1 on channel 1.
snrt_dma_start_1d_channel(buffer_dst_l1_2, buffer_src_l1, TRANSFER_SIZE, 1);

// Check that the fast transfer can finish first.
uint32_t busy_slow, busy_fast;
do {
asm volatile ("dmstati %0, 2" : "=r"(busy_slow));
asm volatile ("dmstati %0, 6" : "=r"(busy_fast));
asm volatile("dmstati %0, 2" : "=r"(busy_slow));
asm volatile("dmstati %0, 6" : "=r"(busy_fast));
} while (busy_fast);

// Check that the fast transfer has finished and the slow transfer is still busy.
// Check that the fast transfer has finished and the slow transfer is still
// busy.
if (!busy_slow) {
errors++;
}
Expand All @@ -51,7 +52,8 @@ int main() {

// Check that the main memory buffer contains the correct data.
for (uint32_t i = 0; i < TRANSFER_LEN; i++) {
errors += (buffer_dst_l1_1[i] != TRANSFER_LEN * (TRANSFER_REP - 1) + i + 1);
errors +=
(buffer_dst_l1_1[i] != TRANSFER_LEN * (TRANSFER_REP - 1) + i + 1);
errors += (buffer_dst_l1_2[i] != 0xAAAAAAAA);
}

Expand Down

0 comments on commit 79188c6

Please sign in to comment.