Merge pull request #16 from rp-rs/rom-functions

rom: Make rom_funcs functions call function instead of returning it
This commit is contained in:
Evan Older 2021-02-03 16:56:29 -05:00 committed by GitHub
commit be7dd11057
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,8 +35,9 @@ macro_rules! rom_funcs {
) => { ) => {
$( $(
$(#[$outer])* $(#[$outer])*
pub fn $name() -> extern "C" fn( $( $aname : $aty ),* ) -> $ret { pub fn $name($( $aname:$aty ),*) -> $ret{
rom_table_lookup(FUNC_TABLE, *$c) let func: extern "C" fn( $( $aty ),* ) -> $ret = rom_table_lookup(FUNC_TABLE, *$c);
func($( $aname ),*)
} }
)* )*
} }
@ -90,7 +91,7 @@ rom_funcs! {
/// Program data to a range of flash addresses starting at addr (offset from the start of flash) /// Program data to a range of flash addresses starting at addr (offset from the start of flash)
/// and count bytesin size. addr must be aligned to a 256-byte boundary, and count must be a /// and count bytesin size. addr must be aligned to a 256-byte boundary, and count must be a
/// multiple of 256. /// multiple of 256.
b"RP" flash_range_program(addr: u32, data: *mut u8, count: usize) -> (); b"RP" flash_range_program(addr: u32, data: *const u8, count: usize) -> ();
/// Flush and enable the XIP cache. Also clears the IO forcing on QSPI CSn, so that the SSI can /// Flush and enable the XIP cache. Also clears the IO forcing on QSPI CSn, so that the SSI can
/// drive the flashchip select as normal. /// drive the flashchip select as normal.