aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-rp/src/pio.rs252
1 files changed, 90 insertions, 162 deletions
diff --git a/embassy-rp/src/pio.rs b/embassy-rp/src/pio.rs
index 756f0e928..088944b66 100644
--- a/embassy-rp/src/pio.rs
+++ b/embassy-rp/src/pio.rs
@@ -32,7 +32,6 @@ impl Wakers {
32 } 32 }
33} 33}
34 34
35const PIOS: [&pac::pio::Pio; 2] = [&pac::PIO0, &pac::PIO1];
36const NEW_AW: AtomicWaker = AtomicWaker::new(); 35const NEW_AW: AtomicWaker = AtomicWaker::new();
37const PIO_WAKERS_INIT: Wakers = Wakers([NEW_AW; 12]); 36const PIO_WAKERS_INIT: Wakers = Wakers([NEW_AW; 12]);
38static WAKERS: [Wakers; 2] = [PIO_WAKERS_INIT; 2]; 37static WAKERS: [Wakers; 2] = [PIO_WAKERS_INIT; 2];
@@ -122,7 +121,7 @@ impl<'d, PIO: PioInstance, SM: PioStateMachine + Unpin> Future for FifoOutFuture
122 } else { 121 } else {
123 WAKERS[PIO::PIO_NO as usize].fifo_out()[SM::Sm::SM_NO as usize].register(cx.waker()); 122 WAKERS[PIO::PIO_NO as usize].fifo_out()[SM::Sm::SM_NO as usize].register(cx.waker());
124 unsafe { 123 unsafe {
125 PIOS[PIO::PIO_NO as usize].irqs(0).inte().write_set(|m| { 124 PIO::PIO.irqs(0).inte().write_set(|m| {
126 m.0 = TXNFULL_MASK << SM::Sm::SM_NO; 125 m.0 = TXNFULL_MASK << SM::Sm::SM_NO;
127 }); 126 });
128 } 127 }
@@ -135,7 +134,7 @@ impl<'d, PIO: PioInstance, SM: PioStateMachine + Unpin> Future for FifoOutFuture
135impl<'d, PIO: PioInstance, SM: PioStateMachine + Unpin> Drop for FifoOutFuture<'d, PIO, SM> { 134impl<'d, PIO: PioInstance, SM: PioStateMachine + Unpin> Drop for FifoOutFuture<'d, PIO, SM> {
136 fn drop(&mut self) { 135 fn drop(&mut self) {
137 unsafe { 136 unsafe {
138 PIOS[PIO::PIO_NO as usize].irqs(0).inte().write_clear(|m| { 137 PIO::PIO.irqs(0).inte().write_clear(|m| {
139 m.0 = TXNFULL_MASK << SM::Sm::SM_NO; 138 m.0 = TXNFULL_MASK << SM::Sm::SM_NO;
140 }); 139 });
141 } 140 }
@@ -167,7 +166,7 @@ impl<'d, PIO: PioInstance, SM: PioStateMachine> Future for FifoInFuture<'d, PIO,
167 } else { 166 } else {
168 WAKERS[PIO::PIO_NO as usize].fifo_in()[SM::Sm::SM_NO as usize].register(cx.waker()); 167 WAKERS[PIO::PIO_NO as usize].fifo_in()[SM::Sm::SM_NO as usize].register(cx.waker());
169 unsafe { 168 unsafe {
170 PIOS[PIO::PIO_NO as usize].irqs(0).inte().write_set(|m| { 169 PIO::PIO.irqs(0).inte().write_set(|m| {
171 m.0 = RXNEMPTY_MASK << SM::Sm::SM_NO; 170 m.0 = RXNEMPTY_MASK << SM::Sm::SM_NO;
172 }); 171 });
173 } 172 }
@@ -180,7 +179,7 @@ impl<'d, PIO: PioInstance, SM: PioStateMachine> Future for FifoInFuture<'d, PIO,
180impl<'d, PIO: PioInstance, SM: PioStateMachine> Drop for FifoInFuture<'d, PIO, SM> { 179impl<'d, PIO: PioInstance, SM: PioStateMachine> Drop for FifoInFuture<'d, PIO, SM> {
181 fn drop(&mut self) { 180 fn drop(&mut self) {
182 unsafe { 181 unsafe {
183 PIOS[PIO::PIO_NO as usize].irqs(0).inte().write_clear(|m| { 182 PIO::PIO.irqs(0).inte().write_clear(|m| {
184 m.0 = RXNEMPTY_MASK << SM::Sm::SM_NO; 183 m.0 = RXNEMPTY_MASK << SM::Sm::SM_NO;
185 }); 184 });
186 } 185 }
@@ -210,7 +209,7 @@ impl<'d, PIO: PioInstance> Future for IrqFuture<PIO> {
210 209
211 // Check if IRQ flag is already set 210 // Check if IRQ flag is already set
212 if critical_section::with(|_| unsafe { 211 if critical_section::with(|_| unsafe {
213 let irq_flags = PIOS[PIO::PIO_NO as usize].irq(); 212 let irq_flags = PIO::PIO.irq();
214 if irq_flags.read().0 & (1 << self.irq_no) != 0 { 213 if irq_flags.read().0 & (1 << self.irq_no) != 0 {
215 irq_flags.write(|m| { 214 irq_flags.write(|m| {
216 m.0 = 1 << self.irq_no; 215 m.0 = 1 << self.irq_no;
@@ -225,7 +224,7 @@ impl<'d, PIO: PioInstance> Future for IrqFuture<PIO> {
225 224
226 WAKERS[PIO::PIO_NO as usize].irq()[self.irq_no as usize].register(cx.waker()); 225 WAKERS[PIO::PIO_NO as usize].irq()[self.irq_no as usize].register(cx.waker());
227 unsafe { 226 unsafe {
228 PIOS[PIO::PIO_NO as usize].irqs(0).inte().write_set(|m| { 227 PIO::PIO.irqs(0).inte().write_set(|m| {
229 m.0 = SMIRQ_MASK << self.irq_no; 228 m.0 = SMIRQ_MASK << self.irq_no;
230 }); 229 });
231 } 230 }
@@ -236,7 +235,7 @@ impl<'d, PIO: PioInstance> Future for IrqFuture<PIO> {
236impl<'d, PIO: PioInstance> Drop for IrqFuture<PIO> { 235impl<'d, PIO: PioInstance> Drop for IrqFuture<PIO> {
237 fn drop(&mut self) { 236 fn drop(&mut self) {
238 unsafe { 237 unsafe {
239 PIOS[PIO::PIO_NO as usize].irqs(0).inte().write_clear(|m| { 238 PIO::PIO.irqs(0).inte().write_clear(|m| {
240 m.0 = SMIRQ_MASK << self.irq_no; 239 m.0 = SMIRQ_MASK << self.irq_no;
241 }); 240 });
242 } 241 }
@@ -299,7 +298,7 @@ impl<PIO: PioInstance> PioPin<PIO> {
299 pub fn set_input_sync_bypass<'a>(&mut self, bypass: bool) { 298 pub fn set_input_sync_bypass<'a>(&mut self, bypass: bool) {
300 let mask = 1 << self.pin(); 299 let mask = 1 << self.pin();
301 unsafe { 300 unsafe {
302 PIOS[PIO::PIO_NO as usize] 301 PIO::PIO
303 .input_sync_bypass() 302 .input_sync_bypass()
304 .modify(|w| *w = if bypass { *w & !mask } else { *w | mask }); 303 .modify(|w| *w = if bypass { *w & !mask } else { *w | mask });
305 } 304 }
@@ -340,7 +339,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
340 fn restart(&mut self) { 339 fn restart(&mut self) {
341 let _ = self; 340 let _ = self;
342 unsafe { 341 unsafe {
343 PIOS[Self::Pio::PIO_NO as usize] 342 Self::Pio::PIO
344 .ctrl() 343 .ctrl()
345 .modify(|w| w.set_sm_restart(1u8 << Self::Sm::SM_NO)); 344 .modify(|w| w.set_sm_restart(1u8 << Self::Sm::SM_NO));
346 } 345 }
@@ -349,7 +348,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
349 let _ = self; 348 let _ = self;
350 let mask = 1u8 << Self::Sm::SM_NO; 349 let mask = 1u8 << Self::Sm::SM_NO;
351 unsafe { 350 unsafe {
352 PIOS[Self::Pio::PIO_NO as usize] 351 Self::Pio::PIO
353 .ctrl() 352 .ctrl()
354 .modify(|w| w.set_sm_enable((w.sm_enable() & !mask) | (if enable { mask } else { 0 }))); 353 .modify(|w| w.set_sm_enable((w.sm_enable() & !mask) | (if enable { mask } else { 0 })));
355 } 354 }
@@ -357,46 +356,44 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
357 356
358 fn is_enabled(&self) -> bool { 357 fn is_enabled(&self) -> bool {
359 let _ = self; 358 let _ = self;
360 unsafe { PIOS[Self::Pio::PIO_NO as usize].ctrl().read().sm_enable() & (1u8 << Self::Sm::SM_NO) != 0 } 359 unsafe { Self::Pio::PIO.ctrl().read().sm_enable() & (1u8 << Self::Sm::SM_NO) != 0 }
361 } 360 }
362 361
363 fn is_tx_empty(&self) -> bool { 362 fn is_tx_empty(&self) -> bool {
364 let _ = self; 363 let _ = self;
365 unsafe { PIOS[Self::Pio::PIO_NO as usize].fstat().read().txempty() & (1u8 << Self::Sm::SM_NO) != 0 } 364 unsafe { Self::Pio::PIO.fstat().read().txempty() & (1u8 << Self::Sm::SM_NO) != 0 }
366 } 365 }
367 fn is_tx_full(&self) -> bool { 366 fn is_tx_full(&self) -> bool {
368 let _ = self; 367 let _ = self;
369 unsafe { PIOS[Self::Pio::PIO_NO as usize].fstat().read().txfull() & (1u8 << Self::Sm::SM_NO) != 0 } 368 unsafe { Self::Pio::PIO.fstat().read().txfull() & (1u8 << Self::Sm::SM_NO) != 0 }
370 } 369 }
371 370
372 fn is_rx_empty(&self) -> bool { 371 fn is_rx_empty(&self) -> bool {
373 let _ = self; 372 let _ = self;
374 unsafe { PIOS[Self::Pio::PIO_NO as usize].fstat().read().rxempty() & (1u8 << Self::Sm::SM_NO) != 0 } 373 unsafe { Self::Pio::PIO.fstat().read().rxempty() & (1u8 << Self::Sm::SM_NO) != 0 }
375 } 374 }
376 fn is_rx_full(&self) -> bool { 375 fn is_rx_full(&self) -> bool {
377 let _ = self; 376 let _ = self;
378 unsafe { PIOS[Self::Pio::PIO_NO as usize].fstat().read().rxfull() & (1u8 << Self::Sm::SM_NO) != 0 } 377 unsafe { Self::Pio::PIO.fstat().read().rxfull() & (1u8 << Self::Sm::SM_NO) != 0 }
379 } 378 }
380 379
381 fn tx_level(&self) -> u8 { 380 fn tx_level(&self) -> u8 {
382 unsafe { 381 unsafe {
383 let flevel = PIOS[Self::Pio::PIO_NO as usize].flevel().read().0; 382 let flevel = Self::Pio::PIO.flevel().read().0;
384 (flevel >> (Self::Sm::SM_NO * 8)) as u8 & 0x0f 383 (flevel >> (Self::Sm::SM_NO * 8)) as u8 & 0x0f
385 } 384 }
386 } 385 }
387 386
388 fn rx_level(&self) -> u8 { 387 fn rx_level(&self) -> u8 {
389 unsafe { 388 unsafe {
390 let flevel = PIOS[Self::Pio::PIO_NO as usize].flevel().read().0; 389 let flevel = Self::Pio::PIO.flevel().read().0;
391 (flevel >> (Self::Sm::SM_NO * 8 + 4)) as u8 & 0x0f 390 (flevel >> (Self::Sm::SM_NO * 8 + 4)) as u8 & 0x0f
392 } 391 }
393 } 392 }
394 393
395 fn push_tx(&mut self, v: u32) { 394 fn push_tx(&mut self, v: u32) {
396 unsafe { 395 unsafe {
397 PIOS[Self::Pio::PIO_NO as usize] 396 Self::Pio::PIO.txf(Self::Sm::SM_NO as usize).write_value(v);
398 .txf(Self::Sm::SM_NO as usize)
399 .write_value(v);
400 } 397 }
401 } 398 }
402 399
@@ -409,7 +406,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
409 } 406 }
410 407
411 fn pull_rx(&mut self) -> u32 { 408 fn pull_rx(&mut self) -> u32 {
412 unsafe { PIOS[Self::Pio::PIO_NO as usize].rxf(Self::Sm::SM_NO as usize).read() } 409 unsafe { Self::Pio::PIO.rxf(Self::Sm::SM_NO as usize).read() }
413 } 410 }
414 411
415 fn try_pull_rx(&mut self) -> Option<u32> { 412 fn try_pull_rx(&mut self) -> Option<u32> {
@@ -421,7 +418,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
421 418
422 fn set_clkdiv(&mut self, div_x_256: u32) { 419 fn set_clkdiv(&mut self, div_x_256: u32) {
423 unsafe { 420 unsafe {
424 PIOS[Self::Pio::PIO_NO as usize] 421 Self::Pio::PIO
425 .sm(Self::Sm::SM_NO as usize) 422 .sm(Self::Sm::SM_NO as usize)
426 .clkdiv() 423 .clkdiv()
427 .write(|w| w.0 = div_x_256 << 8); 424 .write(|w| w.0 = div_x_256 << 8);
@@ -429,20 +426,13 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
429 } 426 }
430 427
431 fn get_clkdiv(&self) -> u32 { 428 fn get_clkdiv(&self) -> u32 {
432 unsafe { 429 unsafe { Self::Pio::PIO.sm(Self::Sm::SM_NO as usize).clkdiv().read().0 >> 8 }
433 PIOS[Self::Pio::PIO_NO as usize]
434 .sm(Self::Sm::SM_NO as usize)
435 .clkdiv()
436 .read()
437 .0
438 >> 8
439 }
440 } 430 }
441 431
442 fn clkdiv_restart(&mut self) { 432 fn clkdiv_restart(&mut self) {
443 let _ = self; 433 let _ = self;
444 unsafe { 434 unsafe {
445 PIOS[Self::Pio::PIO_NO as usize] 435 Self::Pio::PIO
446 .ctrl() 436 .ctrl()
447 .modify(|w| w.set_clkdiv_restart(1u8 << Self::Sm::SM_NO)); 437 .modify(|w| w.set_clkdiv_restart(1u8 << Self::Sm::SM_NO));
448 } 438 }
@@ -450,7 +440,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
450 440
451 fn set_side_enable(&self, enable: bool) { 441 fn set_side_enable(&self, enable: bool) {
452 unsafe { 442 unsafe {
453 PIOS[Self::Pio::PIO_NO as usize] 443 Self::Pio::PIO
454 .sm(Self::Sm::SM_NO as usize) 444 .sm(Self::Sm::SM_NO as usize)
455 .execctrl() 445 .execctrl()
456 .modify(|w| w.set_side_en(enable)); 446 .modify(|w| w.set_side_en(enable));
@@ -458,18 +448,12 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
458 } 448 }
459 449
460 fn is_side_enabled(&self) -> bool { 450 fn is_side_enabled(&self) -> bool {
461 unsafe { 451 unsafe { Self::Pio::PIO.sm(Self::Sm::SM_NO as usize).execctrl().read().side_en() }
462 PIOS[Self::Pio::PIO_NO as usize]
463 .sm(Self::Sm::SM_NO as usize)
464 .execctrl()
465 .read()
466 .side_en()
467 }
468 } 452 }
469 453
470 fn set_side_pindir(&mut self, pindir: bool) { 454 fn set_side_pindir(&mut self, pindir: bool) {
471 unsafe { 455 unsafe {
472 PIOS[Self::Pio::PIO_NO as usize] 456 Self::Pio::PIO
473 .sm(Self::Sm::SM_NO as usize) 457 .sm(Self::Sm::SM_NO as usize)
474 .execctrl() 458 .execctrl()
475 .modify(|w| w.set_side_pindir(pindir)); 459 .modify(|w| w.set_side_pindir(pindir));
@@ -478,7 +462,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
478 462
479 fn is_side_pindir(&self) -> bool { 463 fn is_side_pindir(&self) -> bool {
480 unsafe { 464 unsafe {
481 PIOS[Self::Pio::PIO_NO as usize] 465 Self::Pio::PIO
482 .sm(Self::Sm::SM_NO as usize) 466 .sm(Self::Sm::SM_NO as usize)
483 .execctrl() 467 .execctrl()
484 .read() 468 .read()
@@ -488,7 +472,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
488 472
489 fn set_jmp_pin(&mut self, pin: u8) { 473 fn set_jmp_pin(&mut self, pin: u8) {
490 unsafe { 474 unsafe {
491 PIOS[Self::Pio::PIO_NO as usize] 475 Self::Pio::PIO
492 .sm(Self::Sm::SM_NO as usize) 476 .sm(Self::Sm::SM_NO as usize)
493 .execctrl() 477 .execctrl()
494 .modify(|w| w.set_jmp_pin(pin)); 478 .modify(|w| w.set_jmp_pin(pin));
@@ -496,34 +480,22 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
496 } 480 }
497 481
498 fn get_jmp_pin(&mut self) -> u8 { 482 fn get_jmp_pin(&mut self) -> u8 {
499 unsafe { 483 unsafe { Self::Pio::PIO.sm(Self::Sm::SM_NO as usize).execctrl().read().jmp_pin() }
500 PIOS[Self::Pio::PIO_NO as usize]
501 .sm(Self::Sm::SM_NO as usize)
502 .execctrl()
503 .read()
504 .jmp_pin()
505 }
506 } 484 }
507 485
508 fn set_wrap(&self, source: u8, target: u8) { 486 fn set_wrap(&self, source: u8, target: u8) {
509 unsafe { 487 unsafe {
510 PIOS[Self::Pio::PIO_NO as usize] 488 Self::Pio::PIO.sm(Self::Sm::SM_NO as usize).execctrl().modify(|w| {
511 .sm(Self::Sm::SM_NO as usize) 489 w.set_wrap_top(source);
512 .execctrl() 490 w.set_wrap_bottom(target)
513 .modify(|w| { 491 });
514 w.set_wrap_top(source);
515 w.set_wrap_bottom(target)
516 });
517 } 492 }
518 } 493 }
519 494
520 /// Get wrapping addresses. Returns (source, target). 495 /// Get wrapping addresses. Returns (source, target).
521 fn get_wrap(&self) -> (u8, u8) { 496 fn get_wrap(&self) -> (u8, u8) {
522 unsafe { 497 unsafe {
523 let r = PIOS[Self::Pio::PIO_NO as usize] 498 let r = Self::Pio::PIO.sm(Self::Sm::SM_NO as usize).execctrl().read();
524 .sm(Self::Sm::SM_NO as usize)
525 .execctrl()
526 .read();
527 (r.wrap_top(), r.wrap_bottom()) 499 (r.wrap_top(), r.wrap_bottom())
528 } 500 }
529 } 501 }
@@ -535,21 +507,15 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
535 FifoJoin::TxOnly => (false, true), 507 FifoJoin::TxOnly => (false, true),
536 }; 508 };
537 unsafe { 509 unsafe {
538 PIOS[Self::Pio::PIO_NO as usize] 510 Self::Pio::PIO.sm(Self::Sm::SM_NO as usize).shiftctrl().modify(|w| {
539 .sm(Self::Sm::SM_NO as usize) 511 w.set_fjoin_rx(rx);
540 .shiftctrl() 512 w.set_fjoin_tx(tx)
541 .modify(|w| { 513 });
542 w.set_fjoin_rx(rx);
543 w.set_fjoin_tx(tx)
544 });
545 } 514 }
546 } 515 }
547 fn get_fifo_join(&self) -> FifoJoin { 516 fn get_fifo_join(&self) -> FifoJoin {
548 unsafe { 517 unsafe {
549 let r = PIOS[Self::Pio::PIO_NO as usize] 518 let r = Self::Pio::PIO.sm(Self::Sm::SM_NO as usize).shiftctrl().read();
550 .sm(Self::Sm::SM_NO as usize)
551 .shiftctrl()
552 .read();
553 // Ignores the invalid state when both bits are set 519 // Ignores the invalid state when both bits are set
554 if r.fjoin_rx() { 520 if r.fjoin_rx() {
555 FifoJoin::RxOnly 521 FifoJoin::RxOnly
@@ -564,9 +530,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
564 fn clear_fifos(&mut self) { 530 fn clear_fifos(&mut self) {
565 // Toggle FJOIN_RX to flush FIFOs 531 // Toggle FJOIN_RX to flush FIFOs
566 unsafe { 532 unsafe {
567 let shiftctrl = PIOS[Self::Pio::PIO_NO as usize] 533 let shiftctrl = Self::Pio::PIO.sm(Self::Sm::SM_NO as usize).shiftctrl();
568 .sm(Self::Sm::SM_NO as usize)
569 .shiftctrl();
570 shiftctrl.modify(|w| { 534 shiftctrl.modify(|w| {
571 w.set_fjoin_rx(!w.fjoin_rx()); 535 w.set_fjoin_rx(!w.fjoin_rx());
572 }); 536 });
@@ -578,7 +542,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
578 542
579 fn set_pull_threshold(&mut self, threshold: u8) { 543 fn set_pull_threshold(&mut self, threshold: u8) {
580 unsafe { 544 unsafe {
581 PIOS[Self::Pio::PIO_NO as usize] 545 Self::Pio::PIO
582 .sm(Self::Sm::SM_NO as usize) 546 .sm(Self::Sm::SM_NO as usize)
583 .shiftctrl() 547 .shiftctrl()
584 .modify(|w| w.set_pull_thresh(threshold)); 548 .modify(|w| w.set_pull_thresh(threshold));
@@ -587,16 +551,13 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
587 551
588 fn get_pull_threshold(&self) -> u8 { 552 fn get_pull_threshold(&self) -> u8 {
589 unsafe { 553 unsafe {
590 let r = PIOS[Self::Pio::PIO_NO as usize] 554 let r = Self::Pio::PIO.sm(Self::Sm::SM_NO as usize).shiftctrl().read();
591 .sm(Self::Sm::SM_NO as usize)
592 .shiftctrl()
593 .read();
594 r.pull_thresh() 555 r.pull_thresh()
595 } 556 }
596 } 557 }
597 fn set_push_threshold(&mut self, threshold: u8) { 558 fn set_push_threshold(&mut self, threshold: u8) {
598 unsafe { 559 unsafe {
599 PIOS[Self::Pio::PIO_NO as usize] 560 Self::Pio::PIO
600 .sm(Self::Sm::SM_NO as usize) 561 .sm(Self::Sm::SM_NO as usize)
601 .shiftctrl() 562 .shiftctrl()
602 .modify(|w| w.set_push_thresh(threshold)); 563 .modify(|w| w.set_push_thresh(threshold));
@@ -605,17 +566,14 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
605 566
606 fn get_push_threshold(&self) -> u8 { 567 fn get_push_threshold(&self) -> u8 {
607 unsafe { 568 unsafe {
608 let r = PIOS[Self::Pio::PIO_NO as usize] 569 let r = Self::Pio::PIO.sm(Self::Sm::SM_NO as usize).shiftctrl().read();
609 .sm(Self::Sm::SM_NO as usize)
610 .shiftctrl()
611 .read();
612 r.push_thresh() 570 r.push_thresh()
613 } 571 }
614 } 572 }
615 573
616 fn set_out_shift_dir(&mut self, dir: ShiftDirection) { 574 fn set_out_shift_dir(&mut self, dir: ShiftDirection) {
617 unsafe { 575 unsafe {
618 PIOS[Self::Pio::PIO_NO as usize] 576 Self::Pio::PIO
619 .sm(Self::Sm::SM_NO as usize) 577 .sm(Self::Sm::SM_NO as usize)
620 .shiftctrl() 578 .shiftctrl()
621 .modify(|w| w.set_out_shiftdir(dir == ShiftDirection::Right)); 579 .modify(|w| w.set_out_shiftdir(dir == ShiftDirection::Right));
@@ -623,7 +581,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
623 } 581 }
624 fn get_out_shiftdir(&self) -> ShiftDirection { 582 fn get_out_shiftdir(&self) -> ShiftDirection {
625 unsafe { 583 unsafe {
626 if PIOS[Self::Pio::PIO_NO as usize] 584 if Self::Pio::PIO
627 .sm(Self::Sm::SM_NO as usize) 585 .sm(Self::Sm::SM_NO as usize)
628 .shiftctrl() 586 .shiftctrl()
629 .read() 587 .read()
@@ -638,7 +596,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
638 596
639 fn set_in_shift_dir(&mut self, dir: ShiftDirection) { 597 fn set_in_shift_dir(&mut self, dir: ShiftDirection) {
640 unsafe { 598 unsafe {
641 PIOS[Self::Pio::PIO_NO as usize] 599 Self::Pio::PIO
642 .sm(Self::Sm::SM_NO as usize) 600 .sm(Self::Sm::SM_NO as usize)
643 .shiftctrl() 601 .shiftctrl()
644 .modify(|w| w.set_in_shiftdir(dir == ShiftDirection::Right)); 602 .modify(|w| w.set_in_shiftdir(dir == ShiftDirection::Right));
@@ -646,7 +604,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
646 } 604 }
647 fn get_in_shiftdir(&self) -> ShiftDirection { 605 fn get_in_shiftdir(&self) -> ShiftDirection {
648 unsafe { 606 unsafe {
649 if PIOS[Self::Pio::PIO_NO as usize] 607 if Self::Pio::PIO
650 .sm(Self::Sm::SM_NO as usize) 608 .sm(Self::Sm::SM_NO as usize)
651 .shiftctrl() 609 .shiftctrl()
652 .read() 610 .read()
@@ -661,7 +619,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
661 619
662 fn set_autopull(&mut self, auto: bool) { 620 fn set_autopull(&mut self, auto: bool) {
663 unsafe { 621 unsafe {
664 PIOS[Self::Pio::PIO_NO as usize] 622 Self::Pio::PIO
665 .sm(Self::Sm::SM_NO as usize) 623 .sm(Self::Sm::SM_NO as usize)
666 .shiftctrl() 624 .shiftctrl()
667 .modify(|w| w.set_autopull(auto)); 625 .modify(|w| w.set_autopull(auto));
@@ -670,7 +628,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
670 628
671 fn is_autopull(&self) -> bool { 629 fn is_autopull(&self) -> bool {
672 unsafe { 630 unsafe {
673 PIOS[Self::Pio::PIO_NO as usize] 631 Self::Pio::PIO
674 .sm(Self::Sm::SM_NO as usize) 632 .sm(Self::Sm::SM_NO as usize)
675 .shiftctrl() 633 .shiftctrl()
676 .read() 634 .read()
@@ -680,7 +638,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
680 638
681 fn set_autopush(&mut self, auto: bool) { 639 fn set_autopush(&mut self, auto: bool) {
682 unsafe { 640 unsafe {
683 PIOS[Self::Pio::PIO_NO as usize] 641 Self::Pio::PIO
684 .sm(Self::Sm::SM_NO as usize) 642 .sm(Self::Sm::SM_NO as usize)
685 .shiftctrl() 643 .shiftctrl()
686 .modify(|w| w.set_autopush(auto)); 644 .modify(|w| w.set_autopush(auto));
@@ -689,7 +647,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
689 647
690 fn is_autopush(&self) -> bool { 648 fn is_autopush(&self) -> bool {
691 unsafe { 649 unsafe {
692 PIOS[Self::Pio::PIO_NO as usize] 650 Self::Pio::PIO
693 .sm(Self::Sm::SM_NO as usize) 651 .sm(Self::Sm::SM_NO as usize)
694 .shiftctrl() 652 .shiftctrl()
695 .read() 653 .read()
@@ -699,16 +657,13 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
699 657
700 fn get_addr(&self) -> u8 { 658 fn get_addr(&self) -> u8 {
701 unsafe { 659 unsafe {
702 let r = PIOS[Self::Pio::PIO_NO as usize] 660 let r = Self::Pio::PIO.sm(Self::Sm::SM_NO as usize).addr().read();
703 .sm(Self::Sm::SM_NO as usize)
704 .addr()
705 .read();
706 r.addr() 661 r.addr()
707 } 662 }
708 } 663 }
709 fn set_sideset_count(&mut self, count: u8) { 664 fn set_sideset_count(&mut self, count: u8) {
710 unsafe { 665 unsafe {
711 PIOS[Self::Pio::PIO_NO as usize] 666 Self::Pio::PIO
712 .sm(Self::Sm::SM_NO as usize) 667 .sm(Self::Sm::SM_NO as usize)
713 .pinctrl() 668 .pinctrl()
714 .modify(|w| w.set_sideset_count(count)); 669 .modify(|w| w.set_sideset_count(count));
@@ -717,10 +672,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
717 672
718 fn get_sideset_count(&self) -> u8 { 673 fn get_sideset_count(&self) -> u8 {
719 unsafe { 674 unsafe {
720 let r = PIOS[Self::Pio::PIO_NO as usize] 675 let r = Self::Pio::PIO.sm(Self::Sm::SM_NO as usize).pinctrl().read();
721 .sm(Self::Sm::SM_NO as usize)
722 .pinctrl()
723 .read();
724 r.sideset_count() 676 r.sideset_count()
725 } 677 }
726 } 678 }
@@ -747,7 +699,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
747 699
748 fn set_sideset_base_pin(&mut self, base_pin: &PioPin<Self::Pio>) { 700 fn set_sideset_base_pin(&mut self, base_pin: &PioPin<Self::Pio>) {
749 unsafe { 701 unsafe {
750 PIOS[Self::Pio::PIO_NO as usize] 702 Self::Pio::PIO
751 .sm(Self::Sm::SM_NO as usize) 703 .sm(Self::Sm::SM_NO as usize)
752 .pinctrl() 704 .pinctrl()
753 .modify(|w| w.set_sideset_base(base_pin.pin())); 705 .modify(|w| w.set_sideset_base(base_pin.pin()));
@@ -756,10 +708,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
756 708
757 fn get_sideset_base(&self) -> u8 { 709 fn get_sideset_base(&self) -> u8 {
758 unsafe { 710 unsafe {
759 let r = PIOS[Self::Pio::PIO_NO as usize] 711 let r = Self::Pio::PIO.sm(Self::Sm::SM_NO as usize).pinctrl().read();
760 .sm(Self::Sm::SM_NO as usize)
761 .pinctrl()
762 .read();
763 r.sideset_base() 712 r.sideset_base()
764 } 713 }
765 } 714 }
@@ -768,30 +717,24 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
768 fn set_set_range(&mut self, base: u8, count: u8) { 717 fn set_set_range(&mut self, base: u8, count: u8) {
769 assert!(base + count < 32); 718 assert!(base + count < 32);
770 unsafe { 719 unsafe {
771 PIOS[Self::Pio::PIO_NO as usize] 720 Self::Pio::PIO.sm(Self::Sm::SM_NO as usize).pinctrl().modify(|w| {
772 .sm(Self::Sm::SM_NO as usize) 721 w.set_set_base(base);
773 .pinctrl() 722 w.set_set_count(count)
774 .modify(|w| { 723 });
775 w.set_set_base(base);
776 w.set_set_count(count)
777 });
778 } 724 }
779 } 725 }
780 726
781 /// Get the range of out pins affected by a set instruction. Returns (base, count). 727 /// Get the range of out pins affected by a set instruction. Returns (base, count).
782 fn get_set_range(&self) -> (u8, u8) { 728 fn get_set_range(&self) -> (u8, u8) {
783 unsafe { 729 unsafe {
784 let r = PIOS[Self::Pio::PIO_NO as usize] 730 let r = Self::Pio::PIO.sm(Self::Sm::SM_NO as usize).pinctrl().read();
785 .sm(Self::Sm::SM_NO as usize)
786 .pinctrl()
787 .read();
788 (r.set_base(), r.set_count()) 731 (r.set_base(), r.set_count())
789 } 732 }
790 } 733 }
791 734
792 fn set_in_base_pin(&mut self, base: &PioPin<Self::Pio>) { 735 fn set_in_base_pin(&mut self, base: &PioPin<Self::Pio>) {
793 unsafe { 736 unsafe {
794 PIOS[Self::Pio::PIO_NO as usize] 737 Self::Pio::PIO
795 .sm(Self::Sm::SM_NO as usize) 738 .sm(Self::Sm::SM_NO as usize)
796 .pinctrl() 739 .pinctrl()
797 .modify(|w| w.set_in_base(base.pin())); 740 .modify(|w| w.set_in_base(base.pin()));
@@ -800,10 +743,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
800 743
801 fn get_in_base(&self) -> u8 { 744 fn get_in_base(&self) -> u8 {
802 unsafe { 745 unsafe {
803 let r = PIOS[Self::Pio::PIO_NO as usize] 746 let r = Self::Pio::PIO.sm(Self::Sm::SM_NO as usize).pinctrl().read();
804 .sm(Self::Sm::SM_NO as usize)
805 .pinctrl()
806 .read();
807 r.in_base() 747 r.in_base()
808 } 748 }
809 } 749 }
@@ -811,23 +751,17 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
811 fn set_out_range(&mut self, base: u8, count: u8) { 751 fn set_out_range(&mut self, base: u8, count: u8) {
812 assert!(base + count < 32); 752 assert!(base + count < 32);
813 unsafe { 753 unsafe {
814 PIOS[Self::Pio::PIO_NO as usize] 754 Self::Pio::PIO.sm(Self::Sm::SM_NO as usize).pinctrl().modify(|w| {
815 .sm(Self::Sm::SM_NO as usize) 755 w.set_out_base(base);
816 .pinctrl() 756 w.set_out_count(count)
817 .modify(|w| { 757 });
818 w.set_out_base(base);
819 w.set_out_count(count)
820 });
821 } 758 }
822 } 759 }
823 760
824 /// Get the range of out pins affected by a set instruction. Returns (base, count). 761 /// Get the range of out pins affected by a set instruction. Returns (base, count).
825 fn get_out_range(&self) -> (u8, u8) { 762 fn get_out_range(&self) -> (u8, u8) {
826 unsafe { 763 unsafe {
827 let r = PIOS[Self::Pio::PIO_NO as usize] 764 let r = Self::Pio::PIO.sm(Self::Sm::SM_NO as usize).pinctrl().read();
828 .sm(Self::Sm::SM_NO as usize)
829 .pinctrl()
830 .read();
831 (r.out_base(), r.out_count()) 765 (r.out_base(), r.out_count())
832 } 766 }
833 } 767 }
@@ -855,18 +789,12 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
855 } 789 }
856 790
857 fn get_current_instr() -> u32 { 791 fn get_current_instr() -> u32 {
858 unsafe { 792 unsafe { Self::Pio::PIO.sm(Self::Sm::SM_NO as usize).instr().read().0 }
859 PIOS[Self::Pio::PIO_NO as usize]
860 .sm(Self::Sm::SM_NO as usize)
861 .instr()
862 .read()
863 .0
864 }
865 } 793 }
866 794
867 fn exec_instr(&mut self, instr: u16) { 795 fn exec_instr(&mut self, instr: u16) {
868 unsafe { 796 unsafe {
869 PIOS[Self::Pio::PIO_NO as usize] 797 Self::Pio::PIO
870 .sm(Self::Sm::SM_NO as usize) 798 .sm(Self::Sm::SM_NO as usize)
871 .instr() 799 .instr()
872 .write(|w| w.set_instr(instr)); 800 .write(|w| w.set_instr(instr));
@@ -879,6 +807,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
879 { 807 {
880 let _ = self; 808 let _ = self;
881 write_instr( 809 write_instr(
810 Self::Pio::PIO,
882 Self::Pio::PIO_NO, 811 Self::Pio::PIO_NO,
883 start, 812 start,
884 instrs, 813 instrs,
@@ -889,14 +818,14 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
889 fn is_irq_set(&self, irq_no: u8) -> bool { 818 fn is_irq_set(&self, irq_no: u8) -> bool {
890 assert!(irq_no < 8); 819 assert!(irq_no < 8);
891 unsafe { 820 unsafe {
892 let irq_flags = PIOS[Self::Pio::PIO_NO as usize].irq(); 821 let irq_flags = Self::Pio::PIO.irq();
893 irq_flags.read().0 & (1 << irq_no) != 0 822 irq_flags.read().0 & (1 << irq_no) != 0
894 } 823 }
895 } 824 }
896 825
897 fn clear_irq(&mut self, irq_no: usize) { 826 fn clear_irq(&mut self, irq_no: usize) {
898 assert!(irq_no < 8); 827 assert!(irq_no < 8);
899 unsafe { PIOS[Self::Pio::PIO_NO as usize].irq().write(|w| w.set_irq(1 << irq_no)) } 828 unsafe { Self::Pio::PIO.irq().write(|w| w.set_irq(1 << irq_no)) }
900 } 829 }
901 830
902 fn wait_push<'a>(&'a mut self, value: u32) -> FifoOutFuture<'a, Self::Pio, Self> { 831 fn wait_push<'a>(&'a mut self, value: u32) -> FifoOutFuture<'a, Self::Pio, Self> {
@@ -913,7 +842,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
913 842
914 fn has_tx_stalled(&self) -> bool { 843 fn has_tx_stalled(&self) -> bool {
915 unsafe { 844 unsafe {
916 let fdebug = PIOS[Self::Pio::PIO_NO as usize].fdebug(); 845 let fdebug = Self::Pio::PIO.fdebug();
917 let ret = fdebug.read().txstall() & (1 << Self::Sm::SM_NO) != 0; 846 let ret = fdebug.read().txstall() & (1 << Self::Sm::SM_NO) != 0;
918 fdebug.write(|w| w.set_txstall(1 << Self::Sm::SM_NO)); 847 fdebug.write(|w| w.set_txstall(1 << Self::Sm::SM_NO));
919 ret 848 ret
@@ -922,7 +851,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
922 851
923 fn has_tx_overflowed(&self) -> bool { 852 fn has_tx_overflowed(&self) -> bool {
924 unsafe { 853 unsafe {
925 let fdebug = PIOS[Self::Pio::PIO_NO as usize].fdebug(); 854 let fdebug = Self::Pio::PIO.fdebug();
926 let ret = fdebug.read().txover() & (1 << Self::Sm::SM_NO) != 0; 855 let ret = fdebug.read().txover() & (1 << Self::Sm::SM_NO) != 0;
927 fdebug.write(|w| w.set_txover(1 << Self::Sm::SM_NO)); 856 fdebug.write(|w| w.set_txover(1 << Self::Sm::SM_NO));
928 ret 857 ret
@@ -931,7 +860,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
931 860
932 fn has_rx_stalled(&self) -> bool { 861 fn has_rx_stalled(&self) -> bool {
933 unsafe { 862 unsafe {
934 let fdebug = PIOS[Self::Pio::PIO_NO as usize].fdebug(); 863 let fdebug = Self::Pio::PIO.fdebug();
935 let ret = fdebug.read().rxstall() & (1 << Self::Sm::SM_NO) != 0; 864 let ret = fdebug.read().rxstall() & (1 << Self::Sm::SM_NO) != 0;
936 fdebug.write(|w| w.set_rxstall(1 << Self::Sm::SM_NO)); 865 fdebug.write(|w| w.set_rxstall(1 << Self::Sm::SM_NO));
937 ret 866 ret
@@ -940,7 +869,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
940 869
941 fn has_rx_underflowed(&self) -> bool { 870 fn has_rx_underflowed(&self) -> bool {
942 unsafe { 871 unsafe {
943 let fdebug = PIOS[Self::Pio::PIO_NO as usize].fdebug(); 872 let fdebug = Self::Pio::PIO.fdebug();
944 let ret = fdebug.read().rxunder() & (1 << Self::Sm::SM_NO) != 0; 873 let ret = fdebug.read().rxunder() & (1 << Self::Sm::SM_NO) != 0;
945 fdebug.write(|w| w.set_rxunder(1 << Self::Sm::SM_NO)); 874 fdebug.write(|w| w.set_rxunder(1 << Self::Sm::SM_NO));
946 ret 875 ret
@@ -954,7 +883,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
954 let p = ch.regs(); 883 let p = ch.regs();
955 p.read_addr().write_value(data.as_ptr() as u32); 884 p.read_addr().write_value(data.as_ptr() as u32);
956 p.write_addr() 885 p.write_addr()
957 .write_value(PIOS[pio_no as usize].txf(sm_no as usize).ptr() as u32); 886 .write_value(Self::Pio::PIO.txf(sm_no as usize).ptr() as u32);
958 p.trans_count().write_value(data.len() as u32); 887 p.trans_count().write_value(data.len() as u32);
959 p.ctrl_trig().write(|w| { 888 p.ctrl_trig().write(|w| {
960 // Set TX DREQ for this statemachine 889 // Set TX DREQ for this statemachine
@@ -977,7 +906,7 @@ pub trait PioStateMachine: sealed::PioStateMachine + Sized + Unpin {
977 let p = ch.regs(); 906 let p = ch.regs();
978 p.write_addr().write_value(data.as_ptr() as u32); 907 p.write_addr().write_value(data.as_ptr() as u32);
979 p.read_addr() 908 p.read_addr()
980 .write_value(PIOS[pio_no as usize].rxf(sm_no as usize).ptr() as u32); 909 .write_value(Self::Pio::PIO.rxf(sm_no as usize).ptr() as u32);
981 p.trans_count().write_value(data.len() as u32); 910 p.trans_count().write_value(data.len() as u32);
982 p.ctrl_trig().write(|w| { 911 p.ctrl_trig().write(|w| {
983 // Set TX DREQ for this statemachine 912 // Set TX DREQ for this statemachine
@@ -1032,7 +961,7 @@ impl<PIO: PioInstance> sealed::PioCommon for PioCommonInstance<PIO> {
1032} 961}
1033impl<PIO: PioInstance> PioCommon for PioCommonInstance<PIO> {} 962impl<PIO: PioInstance> PioCommon for PioCommonInstance<PIO> {}
1034 963
1035fn write_instr<I>(pio_no: u8, start: usize, instrs: I, mem_user: u32) 964fn write_instr<I>(pio: &pac::pio::Pio, pio_no: u8, start: usize, instrs: I, mem_user: u32)
1036where 965where
1037 I: Iterator<Item = u16>, 966 I: Iterator<Item = u16>,
1038{ 967{
@@ -1044,7 +973,7 @@ where
1044 addr 973 addr
1045 ); 974 );
1046 unsafe { 975 unsafe {
1047 PIOS[pio_no as usize].instr_mem(addr as usize).write(|w| { 976 pio.instr_mem(addr as usize).write(|w| {
1048 w.set_instr_mem(instr); 977 w.set_instr_mem(instr);
1049 }); 978 });
1050 instr_mem_set_status(pio_no, addr, mem_user); 979 instr_mem_set_status(pio_no, addr, mem_user);
@@ -1058,37 +987,33 @@ pub trait PioCommon: sealed::PioCommon + Sized {
1058 I: Iterator<Item = u16>, 987 I: Iterator<Item = u16>,
1059 { 988 {
1060 let _ = self; 989 let _ = self;
1061 write_instr(Self::Pio::PIO_NO, start, instrs, MEM_USED_BY_COMMON); 990 write_instr(Self::Pio::PIO, Self::Pio::PIO_NO, start, instrs, MEM_USED_BY_COMMON);
1062 } 991 }
1063 992
1064 fn clear_irq(&mut self, irq_no: usize) { 993 fn clear_irq(&mut self, irq_no: usize) {
1065 assert!(irq_no < 8); 994 assert!(irq_no < 8);
1066 unsafe { PIOS[Self::Pio::PIO_NO as usize].irq().write(|w| w.set_irq(1 << irq_no)) } 995 unsafe { Self::Pio::PIO.irq().write(|w| w.set_irq(1 << irq_no)) }
1067 } 996 }
1068 997
1069 fn clear_irqs(&mut self, mask: u8) { 998 fn clear_irqs(&mut self, mask: u8) {
1070 unsafe { PIOS[Self::Pio::PIO_NO as usize].irq().write(|w| w.set_irq(mask)) } 999 unsafe { Self::Pio::PIO.irq().write(|w| w.set_irq(mask)) }
1071 } 1000 }
1072 1001
1073 fn force_irq(&mut self, irq_no: usize) { 1002 fn force_irq(&mut self, irq_no: usize) {
1074 assert!(irq_no < 8); 1003 assert!(irq_no < 8);
1075 unsafe { 1004 unsafe { Self::Pio::PIO.irq_force().write(|w| w.set_irq_force(1 << irq_no)) }
1076 PIOS[Self::Pio::PIO_NO as usize]
1077 .irq_force()
1078 .write(|w| w.set_irq_force(1 << irq_no))
1079 }
1080 } 1005 }
1081 1006
1082 fn set_input_sync_bypass<'a>(&'a mut self, bypass: u32, mask: u32) { 1007 fn set_input_sync_bypass<'a>(&'a mut self, bypass: u32, mask: u32) {
1083 unsafe { 1008 unsafe {
1084 PIOS[Self::Pio::PIO_NO as usize] 1009 Self::Pio::PIO
1085 .input_sync_bypass() 1010 .input_sync_bypass()
1086 .modify(|w| *w = (*w & !mask) | (bypass & mask)); 1011 .modify(|w| *w = (*w & !mask) | (bypass & mask));
1087 } 1012 }
1088 } 1013 }
1089 1014
1090 fn get_input_sync_bypass(&self) -> u32 { 1015 fn get_input_sync_bypass(&self) -> u32 {
1091 unsafe { PIOS[Self::Pio::PIO_NO as usize].input_sync_bypass().read() } 1016 unsafe { Self::Pio::PIO.input_sync_bypass().read() }
1092 } 1017 }
1093} 1018}
1094 1019
@@ -1145,6 +1070,7 @@ pub trait PioPeripheral: sealed::PioPeripheral + Sized {
1145mod sealed { 1070mod sealed {
1146 pub trait PioInstance { 1071 pub trait PioInstance {
1147 const PIO_NO: u8; 1072 const PIO_NO: u8;
1073 const PIO: &'static crate::pac::pio::Pio;
1148 } 1074 }
1149 1075
1150 pub trait PioCommon { 1076 pub trait PioCommon {
@@ -1172,11 +1098,13 @@ pub trait PioInstance: sealed::PioInstance + Unpin {}
1172 1098
1173impl sealed::PioInstance for PioInstanceBase<0> { 1099impl sealed::PioInstance for PioInstanceBase<0> {
1174 const PIO_NO: u8 = 0; 1100 const PIO_NO: u8 = 0;
1101 const PIO: &'static pac::pio::Pio = &pac::PIO0;
1175} 1102}
1176impl PioInstance for PioInstanceBase<0> {} 1103impl PioInstance for PioInstanceBase<0> {}
1177 1104
1178impl sealed::PioInstance for PioInstanceBase<1> { 1105impl sealed::PioInstance for PioInstanceBase<1> {
1179 const PIO_NO: u8 = 1; 1106 const PIO_NO: u8 = 1;
1107 const PIO: &'static pac::pio::Pio = &pac::PIO1;
1180} 1108}
1181impl PioInstance for PioInstanceBase<1> {} 1109impl PioInstance for PioInstanceBase<1> {}
1182 1110