aboutsummaryrefslogtreecommitdiff
path: root/embassy-rp/src/flash.rs
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-rp/src/flash.rs')
-rw-r--r--embassy-rp/src/flash.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/embassy-rp/src/flash.rs b/embassy-rp/src/flash.rs
index fbc8b35ec..b30cbdd36 100644
--- a/embassy-rp/src/flash.rs
+++ b/embassy-rp/src/flash.rs
@@ -4,7 +4,7 @@ use core::marker::PhantomData;
4use core::pin::Pin; 4use core::pin::Pin;
5use core::task::{Context, Poll}; 5use core::task::{Context, Poll};
6 6
7use embassy_hal_internal::{into_ref, Peripheral, PeripheralRef}; 7use embassy_hal_internal::{Peri, PeripheralType};
8use embedded_storage::nor_flash::{ 8use embedded_storage::nor_flash::{
9 check_erase, check_read, check_write, ErrorType, MultiwriteNorFlash, NorFlash, NorFlashError, NorFlashErrorKind, 9 check_erase, check_read, check_write, ErrorType, MultiwriteNorFlash, NorFlash, NorFlashError, NorFlashErrorKind,
10 ReadNorFlash, 10 ReadNorFlash,
@@ -114,7 +114,7 @@ impl<'a, 'd, T: Instance, const FLASH_SIZE: usize> Drop for BackgroundRead<'a, '
114 114
115/// Flash driver. 115/// Flash driver.
116pub struct Flash<'d, T: Instance, M: Mode, const FLASH_SIZE: usize> { 116pub struct Flash<'d, T: Instance, M: Mode, const FLASH_SIZE: usize> {
117 dma: Option<PeripheralRef<'d, AnyChannel>>, 117 dma: Option<Peri<'d, AnyChannel>>,
118 phantom: PhantomData<(&'d mut T, M)>, 118 phantom: PhantomData<(&'d mut T, M)>,
119} 119}
120 120
@@ -253,7 +253,7 @@ impl<'d, T: Instance, M: Mode, const FLASH_SIZE: usize> Flash<'d, T, M, FLASH_SI
253 253
254impl<'d, T: Instance, const FLASH_SIZE: usize> Flash<'d, T, Blocking, FLASH_SIZE> { 254impl<'d, T: Instance, const FLASH_SIZE: usize> Flash<'d, T, Blocking, FLASH_SIZE> {
255 /// Create a new flash driver in blocking mode. 255 /// Create a new flash driver in blocking mode.
256 pub fn new_blocking(_flash: impl Peripheral<P = T> + 'd) -> Self { 256 pub fn new_blocking(_flash: Peri<'d, T>) -> Self {
257 Self { 257 Self {
258 dma: None, 258 dma: None,
259 phantom: PhantomData, 259 phantom: PhantomData,
@@ -263,10 +263,9 @@ impl<'d, T: Instance, const FLASH_SIZE: usize> Flash<'d, T, Blocking, FLASH_SIZE
263 263
264impl<'d, T: Instance, const FLASH_SIZE: usize> Flash<'d, T, Async, FLASH_SIZE> { 264impl<'d, T: Instance, const FLASH_SIZE: usize> Flash<'d, T, Async, FLASH_SIZE> {
265 /// Create a new flash driver in async mode. 265 /// Create a new flash driver in async mode.
266 pub fn new(_flash: impl Peripheral<P = T> + 'd, dma: impl Peripheral<P = impl Channel> + 'd) -> Self { 266 pub fn new(_flash: Peri<'d, T>, dma: Peri<'d, impl Channel>) -> Self {
267 into_ref!(dma);
268 Self { 267 Self {
269 dma: Some(dma.map_into()), 268 dma: Some(dma.into()),
270 phantom: PhantomData, 269 phantom: PhantomData,
271 } 270 }
272 } 271 }
@@ -316,7 +315,7 @@ impl<'d, T: Instance, const FLASH_SIZE: usize> Flash<'d, T, Async, FLASH_SIZE> {
316 const XIP_AUX_BASE: *const u32 = 0x50500000 as *const _; 315 const XIP_AUX_BASE: *const u32 = 0x50500000 as *const _;
317 let transfer = unsafe { 316 let transfer = unsafe {
318 crate::dma::read( 317 crate::dma::read(
319 self.dma.as_mut().unwrap(), 318 self.dma.as_mut().unwrap().reborrow(),
320 XIP_AUX_BASE, 319 XIP_AUX_BASE,
321 data, 320 data,
322 pac::dma::vals::TreqSel::XIP_STREAM, 321 pac::dma::vals::TreqSel::XIP_STREAM,
@@ -965,7 +964,7 @@ trait SealedMode {}
965 964
966/// Flash instance. 965/// Flash instance.
967#[allow(private_bounds)] 966#[allow(private_bounds)]
968pub trait Instance: SealedInstance {} 967pub trait Instance: SealedInstance + PeripheralType {}
969/// Flash mode. 968/// Flash mode.
970#[allow(private_bounds)] 969#[allow(private_bounds)]
971pub trait Mode: SealedMode {} 970pub trait Mode: SealedMode {}