Skip to content

Commit 6c62ca1

Browse files
committed
minor clarifications
1 parent a9fe6e0 commit 6c62ca1

File tree

1 file changed

+7
-1
lines changed
  • src/rp2_common/hardware_pio/include/hardware

1 file changed

+7
-1
lines changed

src/rp2_common/hardware_pio/include/hardware/pio.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ typedef pio_hw_t *PIO;
172172
*/
173173
#ifndef PIO_NUM
174174
static_assert(PIO1_BASE - PIO0_BASE == (1u << 20), "hardware layout mismatch");
175+
#if NUM_PIOS > 2
176+
static_assert(PIO2_BASE - PIO0_BASE == (2u << 20), "hardware layout mismatch");
177+
#endif
175178
#define PIO_NUM(pio) (((uintptr_t)(pio) - PIO0_BASE) >> 20)
176179
#endif
177180

@@ -185,6 +188,9 @@ static_assert(PIO1_BASE - PIO0_BASE == (1u << 20), "hardware layout mismatch");
185188
*/
186189
#ifndef PIO_INSTANCE
187190
static_assert(PIO1_BASE - PIO0_BASE == (1u << 20), "hardware layout mismatch");
191+
#if NUM_PIOS > 2
192+
static_assert(PIO2_BASE - PIO0_BASE == (2u << 20), "hardware layout mismatch");
193+
#endif
188194
#define PIO_INSTANCE(instance) ((pio_hw_t *)(PIO0_BASE + (instance) * (1u << 20)))
189195
#endif
190196

@@ -220,7 +226,7 @@ static_assert(DREQ_PIO1_RX0 == DREQ_PIO1_TX0 + NUM_PIO_STATE_MACHINES, "");
220226
static_assert(DREQ_PIO2_TX0 == DREQ_PIO1_RX0 + NUM_PIO_STATE_MACHINES, "");
221227
static_assert(DREQ_PIO2_RX0 == DREQ_PIO2_TX0 + NUM_PIO_STATE_MACHINES, "");
222228
#endif
223-
#define PIO_DREQ_NUM(pio, sm, is_tx) ((sm) + (((is_tx) ? 0 : NUM_PIO_STATE_MACHINES) + PIO_NUM(pio) * (DREQ_PIO1_TX0 - DREQ_PIO0_TX0)))
229+
#define PIO_DREQ_NUM(pio, sm, is_tx) (DREQ_PIO0_TX0 + (sm) + (((is_tx) ? 0 : NUM_PIO_STATE_MACHINES) + PIO_NUM(pio) * (DREQ_PIO1_TX0 - DREQ_PIO0_TX0)))
224230
#endif
225231

226232
/**

0 commit comments

Comments
 (0)