Module capsules_extra::nonvolatile_to_pages
source · Expand description
Map arbitrary nonvolatile reads and writes to page operations.
This splits non-page-aligned reads and writes into a series of page level
reads and writes. While it is handling a read or write it returns BUSY
to
all additional requests.
This module is designed to be used on top of any flash storage and below any
user of NonvolatileStorage
. This module handles different sized pages.
hil::nonvolatile_storage::NonvolatileStorage
┌─────────────┐
│ │
│ This module │
│ │
└─────────────┘
hil::flash::Flash
§Usage
ⓘ
sam4l::flashcalw::FLASH_CONTROLLER.configure();
let page_buffer = static_init!(
sam4l::flashcalw::Sam4lPage,
sam4l::flashcalw::Sam4lPage::default()
);
let nv_to_page = static_init!(
capsules::nonvolatile_to_pages::NonvolatileToPages<'static, sam4l::flashcalw::FLASHCALW>,
capsules::nonvolatile_to_pages::NonvolatileToPages::new(
&mut sam4l::flashcalw::FLASH_CONTROLLER,
page_buffer));
hil::flash::HasClient::set_client(&sam4l::flashcalw::FLASH_CONTROLLER, nv_to_page);