esp_storage/
esp32c6.rs

1use crate::maybe_with_critical_section;
2
3crate::rom_fn! {
4    fn esp_rom_spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 = 0x40000150;
5    fn esp_rom_spiflash_unlock() -> i32 = 0x40000154;
6    fn esp_rom_spiflash_erase_sector(sector_number: u32) -> i32 = 0x40000144;
7    fn esp_rom_spiflash_write(dest_addr: u32, data: *const u32, len: u32) -> i32 = 0x4000014c;
8}
9
10pub(crate) fn spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 {
11    maybe_with_critical_section(|| esp_rom_spiflash_read(src_addr, data, len))
12}
13
14pub(crate) fn spiflash_unlock() -> i32 {
15    maybe_with_critical_section(esp_rom_spiflash_unlock)
16}
17
18pub(crate) fn spiflash_erase_sector(sector_number: u32) -> i32 {
19    maybe_with_critical_section(|| esp_rom_spiflash_erase_sector(sector_number))
20}
21
22pub(crate) fn spiflash_write(dest_addr: u32, data: *const u32, len: u32) -> i32 {
23    maybe_with_critical_section(|| esp_rom_spiflash_write(dest_addr, data, len))
24}