-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up external function declarations
- Loading branch information
Showing
11 changed files
with
144 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,24 @@ | ||
use crate::maybe_with_critical_section; | ||
|
||
const ESP_ROM_SPIFLASH_READ: u32 = 0x4000013c; | ||
const ESP_ROM_SPIFLASH_UNLOCK: u32 = 0x40000140; | ||
const ESP_ROM_SPIFLASH_ERASE_SECTOR: u32 = 0x40000130; | ||
const ESP_ROM_SPIFLASH_WRITE: u32 = 0x40000138; | ||
crate::rom_fn! { | ||
fn esp_rom_spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 = 0x4000013c, | ||
fn esp_rom_spiflash_unlock() -> i32 = 0x40000140, | ||
fn esp_rom_spiflash_erase_sector(sector_number: u32) -> i32 = 0x40000130, | ||
fn esp_rom_spiflash_write(dest_addr: u32, data: *const u32, len: u32) -> i32 = 0x40000138, | ||
} | ||
|
||
pub(crate) fn esp_rom_spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 { | ||
maybe_with_critical_section(|| unsafe { | ||
let esp_rom_spiflash_read: unsafe extern "C" fn(u32, *const u32, u32) -> i32 = | ||
core::mem::transmute(ESP_ROM_SPIFLASH_READ); | ||
esp_rom_spiflash_read(src_addr, data, len) | ||
}) | ||
pub(crate) fn spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 { | ||
maybe_with_critical_section(|| esp_rom_spiflash_read(src_addr, data, len)) | ||
} | ||
|
||
pub(crate) fn esp_rom_spiflash_unlock() -> i32 { | ||
maybe_with_critical_section(|| unsafe { | ||
let esp_rom_spiflash_unlock: unsafe extern "C" fn() -> i32 = | ||
core::mem::transmute(ESP_ROM_SPIFLASH_UNLOCK); | ||
esp_rom_spiflash_unlock() | ||
}) | ||
pub(crate) fn spiflash_unlock() -> i32 { | ||
maybe_with_critical_section(esp_rom_spiflash_unlock) | ||
} | ||
|
||
pub(crate) fn esp_rom_spiflash_erase_sector(sector_number: u32) -> i32 { | ||
maybe_with_critical_section(|| unsafe { | ||
let esp_rom_spiflash_erase_sector: unsafe extern "C" fn(u32) -> i32 = | ||
core::mem::transmute(ESP_ROM_SPIFLASH_ERASE_SECTOR); | ||
esp_rom_spiflash_erase_sector(sector_number) | ||
}) | ||
pub(crate) fn spiflash_erase_sector(sector_number: u32) -> i32 { | ||
maybe_with_critical_section(|| esp_rom_spiflash_erase_sector(sector_number)) | ||
} | ||
|
||
pub(crate) fn esp_rom_spiflash_write(dest_addr: u32, data: *const u32, len: u32) -> i32 { | ||
maybe_with_critical_section(|| unsafe { | ||
let esp_rom_spiflash_write: unsafe extern "C" fn(u32, *const u32, u32) -> i32 = | ||
core::mem::transmute(ESP_ROM_SPIFLASH_WRITE); | ||
esp_rom_spiflash_write(dest_addr, data, len) | ||
}) | ||
pub(crate) fn spiflash_write(dest_addr: u32, data: *const u32, len: u32) -> i32 { | ||
maybe_with_critical_section(|| esp_rom_spiflash_write(dest_addr, data, len)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,24 @@ | ||
use crate::maybe_with_critical_section; | ||
|
||
const ESP_ROM_SPIFLASH_READ: u32 = 0x40000130; | ||
const ESP_ROM_SPIFLASH_UNLOCK: u32 = 0x40000140; | ||
const ESP_ROM_SPIFLASH_ERASE_SECTOR: u32 = 0x40000128; | ||
const ESP_ROM_SPIFLASH_WRITE: u32 = 0x4000012c; | ||
crate::rom_fn! { | ||
fn esp_rom_spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 = 0x40000130, | ||
fn esp_rom_spiflash_unlock() -> i32 = 0x40000140, | ||
fn esp_rom_spiflash_erase_sector(sector_number: u32) -> i32 = 0x40000128, | ||
fn esp_rom_spiflash_write(dest_addr: u32, data: *const u32, len: u32) -> i32 = 0x4000012c, | ||
} | ||
|
||
pub(crate) fn esp_rom_spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 { | ||
maybe_with_critical_section(|| unsafe { | ||
let esp_rom_spiflash_read: unsafe extern "C" fn(u32, *const u32, u32) -> i32 = | ||
core::mem::transmute(ESP_ROM_SPIFLASH_READ); | ||
esp_rom_spiflash_read(src_addr, data, len) | ||
}) | ||
pub(crate) fn spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 { | ||
maybe_with_critical_section(|| esp_rom_spiflash_read(src_addr, data, len)) | ||
} | ||
|
||
pub(crate) fn esp_rom_spiflash_unlock() -> i32 { | ||
maybe_with_critical_section(|| unsafe { | ||
let esp_rom_spiflash_unlock: unsafe extern "C" fn() -> i32 = | ||
core::mem::transmute(ESP_ROM_SPIFLASH_UNLOCK); | ||
esp_rom_spiflash_unlock() | ||
}) | ||
pub(crate) fn spiflash_unlock() -> i32 { | ||
maybe_with_critical_section(esp_rom_spiflash_unlock) | ||
} | ||
|
||
pub(crate) fn esp_rom_spiflash_erase_sector(sector_number: u32) -> i32 { | ||
maybe_with_critical_section(|| unsafe { | ||
let esp_rom_spiflash_erase_sector: unsafe extern "C" fn(u32) -> i32 = | ||
core::mem::transmute(ESP_ROM_SPIFLASH_ERASE_SECTOR); | ||
esp_rom_spiflash_erase_sector(sector_number) | ||
}) | ||
pub(crate) fn spiflash_erase_sector(sector_number: u32) -> i32 { | ||
maybe_with_critical_section(|| esp_rom_spiflash_erase_sector(sector_number)) | ||
} | ||
|
||
pub(crate) fn esp_rom_spiflash_write(dest_addr: u32, data: *const u32, len: u32) -> i32 { | ||
maybe_with_critical_section(|| unsafe { | ||
let esp_rom_spiflash_write: unsafe extern "C" fn(u32, *const u32, u32) -> i32 = | ||
core::mem::transmute(ESP_ROM_SPIFLASH_WRITE); | ||
esp_rom_spiflash_write(dest_addr, data, len) | ||
}) | ||
pub(crate) fn spiflash_write(dest_addr: u32, data: *const u32, len: u32) -> i32 { | ||
maybe_with_critical_section(|| esp_rom_spiflash_write(dest_addr, data, len)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,24 @@ | ||
use crate::maybe_with_critical_section; | ||
|
||
const ESP_ROM_SPIFLASH_READ: u32 = 0x40000150; | ||
const ESP_ROM_SPIFLASH_UNLOCK: u32 = 0x40000154; | ||
const ESP_ROM_SPIFLASH_ERASE_SECTOR: u32 = 0x40000144; | ||
const ESP_ROM_SPIFLASH_WRITE: u32 = 0x4000014c; | ||
crate::rom_fn! { | ||
fn esp_rom_spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 = 0x40000150, | ||
fn esp_rom_spiflash_unlock() -> i32 = 0x40000154, | ||
fn esp_rom_spiflash_erase_sector(sector_number: u32) -> i32 = 0x40000144, | ||
fn esp_rom_spiflash_write(dest_addr: u32, data: *const u32, len: u32) -> i32 = 0x4000014c, | ||
} | ||
|
||
pub(crate) fn esp_rom_spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 { | ||
maybe_with_critical_section(|| unsafe { | ||
let esp_rom_spiflash_read: unsafe extern "C" fn(u32, *const u32, u32) -> i32 = | ||
core::mem::transmute(ESP_ROM_SPIFLASH_READ); | ||
esp_rom_spiflash_read(src_addr, data, len) | ||
}) | ||
pub(crate) fn spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 { | ||
maybe_with_critical_section(|| esp_rom_spiflash_read(src_addr, data, len)) | ||
} | ||
|
||
pub(crate) fn esp_rom_spiflash_unlock() -> i32 { | ||
maybe_with_critical_section(|| unsafe { | ||
let esp_rom_spiflash_unlock: unsafe extern "C" fn() -> i32 = | ||
core::mem::transmute(ESP_ROM_SPIFLASH_UNLOCK); | ||
esp_rom_spiflash_unlock() | ||
}) | ||
pub(crate) fn spiflash_unlock() -> i32 { | ||
maybe_with_critical_section(esp_rom_spiflash_unlock) | ||
} | ||
|
||
pub(crate) fn esp_rom_spiflash_erase_sector(sector_number: u32) -> i32 { | ||
maybe_with_critical_section(|| unsafe { | ||
let esp_rom_spiflash_erase_sector: unsafe extern "C" fn(u32) -> i32 = | ||
core::mem::transmute(ESP_ROM_SPIFLASH_ERASE_SECTOR); | ||
esp_rom_spiflash_erase_sector(sector_number) | ||
}) | ||
pub(crate) fn spiflash_erase_sector(sector_number: u32) -> i32 { | ||
maybe_with_critical_section(|| esp_rom_spiflash_erase_sector(sector_number)) | ||
} | ||
|
||
pub(crate) fn esp_rom_spiflash_write(dest_addr: u32, data: *const u32, len: u32) -> i32 { | ||
maybe_with_critical_section(|| unsafe { | ||
let esp_rom_spiflash_write: unsafe extern "C" fn(u32, *const u32, u32) -> i32 = | ||
core::mem::transmute(ESP_ROM_SPIFLASH_WRITE); | ||
esp_rom_spiflash_write(dest_addr, data, len) | ||
}) | ||
pub(crate) fn spiflash_write(dest_addr: u32, data: *const u32, len: u32) -> i32 { | ||
maybe_with_critical_section(|| esp_rom_spiflash_write(dest_addr, data, len)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,24 @@ | ||
use crate::maybe_with_critical_section; | ||
|
||
const ESP_ROM_SPIFLASH_READ: u32 = 0x4000012c; | ||
const ESP_ROM_SPIFLASH_UNLOCK: u32 = 0x40000130; | ||
const ESP_ROM_SPIFLASH_ERASE_SECTOR: u32 = 0x40000120; | ||
const ESP_ROM_SPIFLASH_WRITE: u32 = 0x40000128; | ||
crate::rom_fn! { | ||
fn esp_rom_spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 = 0x4000012c, | ||
fn esp_rom_spiflash_unlock() -> i32 = 0x40000130, | ||
fn esp_rom_spiflash_erase_sector(sector_number: u32) -> i32 = 0x40000120, | ||
fn esp_rom_spiflash_write(dest_addr: u32, data: *const u32, len: u32) -> i32 = 0x40000128, | ||
} | ||
|
||
pub(crate) fn esp_rom_spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 { | ||
maybe_with_critical_section(|| unsafe { | ||
let esp_rom_spiflash_read: unsafe extern "C" fn(u32, *const u32, u32) -> i32 = | ||
core::mem::transmute(ESP_ROM_SPIFLASH_READ); | ||
esp_rom_spiflash_read(src_addr, data, len) | ||
}) | ||
pub(crate) fn spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 { | ||
maybe_with_critical_section(|| esp_rom_spiflash_read(src_addr, data, len)) | ||
} | ||
|
||
pub(crate) fn esp_rom_spiflash_unlock() -> i32 { | ||
maybe_with_critical_section(|| unsafe { | ||
let esp_rom_spiflash_unlock: unsafe extern "C" fn() -> i32 = | ||
core::mem::transmute(ESP_ROM_SPIFLASH_UNLOCK); | ||
esp_rom_spiflash_unlock() | ||
}) | ||
pub(crate) fn spiflash_unlock() -> i32 { | ||
maybe_with_critical_section(esp_rom_spiflash_unlock) | ||
} | ||
|
||
pub(crate) fn esp_rom_spiflash_erase_sector(sector_number: u32) -> i32 { | ||
maybe_with_critical_section(|| unsafe { | ||
let esp_rom_spiflash_erase_sector: unsafe extern "C" fn(u32) -> i32 = | ||
core::mem::transmute(ESP_ROM_SPIFLASH_ERASE_SECTOR); | ||
esp_rom_spiflash_erase_sector(sector_number) | ||
}) | ||
pub(crate) fn spiflash_erase_sector(sector_number: u32) -> i32 { | ||
maybe_with_critical_section(|| esp_rom_spiflash_erase_sector(sector_number)) | ||
} | ||
|
||
pub(crate) fn esp_rom_spiflash_write(dest_addr: u32, data: *const u32, len: u32) -> i32 { | ||
maybe_with_critical_section(|| unsafe { | ||
let esp_rom_spiflash_write: unsafe extern "C" fn(u32, *const u32, u32) -> i32 = | ||
core::mem::transmute(ESP_ROM_SPIFLASH_WRITE); | ||
esp_rom_spiflash_write(dest_addr, data, len) | ||
}) | ||
pub(crate) fn spiflash_write(dest_addr: u32, data: *const u32, len: u32) -> i32 { | ||
maybe_with_critical_section(|| esp_rom_spiflash_write(dest_addr, data, len)) | ||
} |
Oops, something went wrong.