Skip to content

Commit

Permalink
Tweak syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Sep 2, 2024
1 parent d818e79 commit f1e0300
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 32 deletions.
14 changes: 7 additions & 7 deletions esp-storage/src/esp32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ const FLASH_CHIP_ADDR: u32 = 0x3ffae270;
const FLASH_DUMMY_LEN_PLUS_ADDR: u32 = 0x3ffae290;

crate::rom_fn! {
fn esp_rom_cache_flush(cpu_num: u32) = 0x40009a14,
fn esp_rom_cache_read_enable(cpu_num: u32) = 0x40009a84,
fn esp_rom_spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 = 0x40062ed8,
fn esp_rom_spiflash_erase_sector(sector_number: u32) -> i32 = 0x40062ccc,
fn esp_rom_cache_flush(cpu_num: u32) = 0x40009a14;
fn esp_rom_cache_read_enable(cpu_num: u32) = 0x40009a84;
fn esp_rom_spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 = 0x40062ed8;
fn esp_rom_spiflash_erase_sector(sector_number: u32) -> i32 = 0x40062ccc;
fn esp_rom_spi_read_status_high(
flash_chip: *const EspRomSpiflashChipT,
status: *mut u32
) -> i32 = 0x40062448,
fn esp_rom_spi_read_status(flash_chip: *const EspRomSpiflashChipT, status: *mut u32) -> i32 = 0x4006226c,
fn esp_rom_spi_write_status(flash_chip: *const EspRomSpiflashChipT, status_value: u32) -> i32 = 0x400622f0,
) -> i32 = 0x40062448;
fn esp_rom_spi_read_status(flash_chip: *const EspRomSpiflashChipT, status: *mut u32) -> i32 = 0x4006226c;
fn esp_rom_spi_write_status(flash_chip: *const EspRomSpiflashChipT, status_value: u32) -> i32 = 0x400622f0;
}

#[inline(always)]
Expand Down
8 changes: 4 additions & 4 deletions esp-storage/src/esp32c2.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::maybe_with_critical_section;

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,
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 spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 {
Expand Down
8 changes: 4 additions & 4 deletions esp-storage/src/esp32c3.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::maybe_with_critical_section;

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,
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 spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 {
Expand Down
8 changes: 4 additions & 4 deletions esp-storage/src/esp32c6.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::maybe_with_critical_section;

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,
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 spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 {
Expand Down
8 changes: 4 additions & 4 deletions esp-storage/src/esp32h2.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::maybe_with_critical_section;

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,
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 spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 {
Expand Down
8 changes: 4 additions & 4 deletions esp-storage/src/esp32s2.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::maybe_with_critical_section;

crate::rom_fn! {
fn esp_rom_spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 = 0x4001728c,
fn esp_rom_spiflash_unlock() -> i32 = 0x40016e88,
fn esp_rom_spiflash_erase_sector(sector_number: u32) -> i32 = 0x4001716c,
fn esp_rom_spiflash_write(dest_addr: u32, data: *const u32, len: u32) -> i32 = 0x400171cc,
fn esp_rom_spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 = 0x4001728c;
fn esp_rom_spiflash_unlock() -> i32 = 0x40016e88;
fn esp_rom_spiflash_erase_sector(sector_number: u32) -> i32 = 0x4001716c;
fn esp_rom_spiflash_write(dest_addr: u32, data: *const u32, len: u32) -> i32 = 0x400171cc;
}

pub(crate) fn spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 {
Expand Down
8 changes: 4 additions & 4 deletions esp-storage/src/esp32s3.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::maybe_with_critical_section;

crate::rom_fn! {
fn esp_rom_spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 = 0x40000a20,
fn esp_rom_spiflash_unlock() -> i32 = 0x40000a2c,
fn esp_rom_spiflash_erase_sector(sector_number: u32) -> i32 = 0x400009fc,
fn esp_rom_spiflash_write(dest_addr: u32, data: *const u32, len: u32) -> i32 = 0x40000a14,
fn esp_rom_spiflash_read(src_addr: u32, data: *const u32, len: u32) -> i32 = 0x40000a20;
fn esp_rom_spiflash_unlock() -> i32 = 0x40000a2c;
fn esp_rom_spiflash_erase_sector(sector_number: u32) -> i32 = 0x400009fc;
fn esp_rom_spiflash_write(dest_addr: u32, data: *const u32, len: u32) -> i32 = 0x40000a14;
}

#[inline(always)]
Expand Down
2 changes: 1 addition & 1 deletion esp-storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ macro_rules! rom_fn {
}
};

($($(#[$attrs:meta])* fn $name:ident($($arg:tt: $ty:ty),*) $(-> $retval:ty)? = $addr:expr),+ $(,)?) => {
($($(#[$attrs:meta])* fn $name:ident($($arg:tt: $ty:ty),*) $(-> $retval:ty)? = $addr:expr)+;) => {
$(
$crate::rom_fn!(fn $name($($arg: $ty),*) $(-> $retval)? = $addr);
)+
Expand Down

0 comments on commit f1e0300

Please sign in to comment.