Skip to content

Commit 8c1bb9c

Browse files
committed
blank_check: add pattern argument based on cmsis-dap
CMSIS-DAP has a `BlankCheck` function available that is very close to the `blank_check` function already. Add a `u8` argument that describes a `pattern` in order to bring them up to parity. Signed-off-by: Sean Cross <[email protected]>
1 parent d7943dd commit 8c1bb9c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,9 @@ pub trait FlashAlgorithm: Sized + 'static {
9292
///
9393
/// * `address` - The start address of the flash to check.
9494
/// * `size` - The length of the area to check.
95+
/// * `pattern` - A pattern to be checked. The algorithm may choose ignore this value.
9596
#[cfg(feature = "blank-check")]
96-
fn blank_check(&mut self, address: u32, size: u32) -> Result<(), ErrorCode>;
97+
fn blank_check(&mut self, address: u32, size: u32, pattern: u8) -> Result<(), ErrorCode>;
9798
}
9899

99100
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
@@ -385,14 +386,14 @@ macro_rules! blank_check {
385386
($type:ty) => {
386387
#[no_mangle]
387388
#[link_section = ".entry"]
388-
pub unsafe extern "C" fn BlankCheck(addr: u32, size: u32) -> u32 {
389+
pub unsafe extern "C" fn BlankCheck(addr: u32, size: u32, pattern: u8) -> u32 {
389390
let this = unsafe {
390391
if !_IS_INIT {
391392
return 1;
392393
}
393394
&mut *_ALGO_INSTANCE.as_mut_ptr()
394395
};
395-
match <$type as $crate::FlashAlgorithm>::blank_check(this, addr, size) {
396+
match <$type as $crate::FlashAlgorithm>::blank_check(this, addr, size, pattern) {
396397
Ok(()) => 0,
397398
Err(e) => e.get(),
398399
}

0 commit comments

Comments
 (0)