8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3baf6b5 commit 522d454Copy full SHA for 522d454
stmhal/dma.c
@@ -33,7 +33,8 @@
33
#include "py/obj.h"
34
#include "irq.h"
35
36
-#define NSTREAMS_PER_CONTROLLER (8)
+#define NSTREAMS_PER_CONTROLLER_LOG2 (3)
37
+#define NSTREAMS_PER_CONTROLLER (1 << NSTREAMS_PER_CONTROLLER_LOG2)
38
#define NCONTROLLERS (2)
39
#define NSTREAM (NCONTROLLERS * NSTREAMS_PER_CONTROLLER)
40
@@ -117,11 +118,7 @@ static int get_dma_id(DMA_Stream_TypeDef *dma_stream) {
117
118
119
// Resets the idle counter for the DMA controller associated with dma_id.
120
static void dma_tickle(int dma_id) {
- if (dma_id < NSTREAMS_PER_CONTROLLER) {
121
- dma_idle.counter[0] = 1;
122
- } else {
123
- dma_idle.counter[1] = 1;
124
- }
+ dma_idle.counter[(dma_id >> NSTREAMS_PER_CONTROLLER_LOG2) & 1] = 1;
125
}
126
127
static void dma_enable_clock(int dma_id) {
0 commit comments