@@ -172,6 +172,9 @@ typedef pio_hw_t *PIO;
172172 */
173173#ifndef PIO_NUM
174174static_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
187190static_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
@@ -214,8 +220,13 @@ static_assert(DREQ_PIO0_TX1 == DREQ_PIO0_TX0 + 1, "");
214220static_assert (DREQ_PIO0_TX2 == DREQ_PIO0_TX0 + 2 , "" );
215221static_assert (DREQ_PIO0_TX3 == DREQ_PIO0_TX0 + 3 , "" );
216222static_assert (DREQ_PIO0_RX0 == DREQ_PIO0_TX0 + NUM_PIO_STATE_MACHINES , "" );
223+ static_assert (DREQ_PIO1_TX0 == DREQ_PIO0_RX0 + NUM_PIO_STATE_MACHINES , "" );
217224static_assert (DREQ_PIO1_RX0 == DREQ_PIO1_TX0 + NUM_PIO_STATE_MACHINES , "" );
218- #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)))
225+ #if NUM_PIOS > 2
226+ static_assert (DREQ_PIO2_TX0 == DREQ_PIO1_RX0 + NUM_PIO_STATE_MACHINES , "" );
227+ static_assert (DREQ_PIO2_RX0 == DREQ_PIO2_TX0 + NUM_PIO_STATE_MACHINES , "" );
228+ #endif
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)))
219230#endif
220231
221232/**
0 commit comments