Skip to content

Commit bbe7010

Browse files
committed
custom-blank-check: rename from blank-check
Rename blank-check to custom-blank-check. This is because `BlankCheck` is already a CMSIS-DAP function, and we don't want to collide. Signed-off-by: Sean Cross <[email protected]>
1 parent d7943dd commit bbe7010

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ description = "A crate to write CMSIS-DAP flash algorithms for flashing embedded
1212

1313
[features]
1414
default = ["erase-chip", "panic-handler"]
15-
blank-check = []
15+
custom-blank-check = []
1616
erase-chip = []
1717
panic-handler = []
1818
read-flash = []

src/lib.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn panic(_info: &core::panic::PanicInfo) -> ! {
3030
pub const FUNCTION_ERASE: u32 = 1;
3131
pub const FUNCTION_PROGRAM: u32 = 2;
3232
pub const FUNCTION_VERIFY: u32 = 3;
33-
pub const FUNCTION_BLANKCHECK: u32 = 4;
33+
pub const FUNCTION_CUSTOMBLANKCHECK: u32 = 4;
3434

3535
pub type ErrorCode = core::num::NonZeroU32;
3636

@@ -92,16 +92,16 @@ 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-
#[cfg(feature = "blank-check")]
96-
fn blank_check(&mut self, address: u32, size: u32) -> Result<(), ErrorCode>;
95+
#[cfg(feature = "custom-blank-check")]
96+
fn custom_blank_check(&mut self, address: u32, size: u32) -> Result<(), ErrorCode>;
9797
}
9898

9999
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
100100
pub enum Function {
101101
Erase = 1,
102102
Program = 2,
103103
Verify = 3,
104-
BlankCheck = 4,
104+
CustomBlankCheck = 4,
105105
}
106106

107107
/// A macro to define a new flash algoritm.
@@ -142,7 +142,7 @@ macro_rules! algorithm {
142142
1 => $crate::Function::Erase,
143143
2 => $crate::Function::Program,
144144
3 => $crate::Function::Verify,
145-
4 => $crate::Function::BlankCheck,
145+
4 => $crate::Function::CustomBlankCheck,
146146
_ => core::panic!("This branch can only be reached if the host library sent an unknown function code.")
147147
};
148148
match <$type as $crate::FlashAlgorithm>::new(addr, clock, function) {
@@ -199,7 +199,7 @@ macro_rules! algorithm {
199199
$crate::erase_chip!($type);
200200
$crate::read_flash!($type);
201201
$crate::verify!($type);
202-
$crate::blank_check!($type);
202+
$crate::custom_blank_check!($type);
203203

204204
#[allow(non_upper_case_globals)]
205205
#[no_mangle]
@@ -374,25 +374,25 @@ macro_rules! verify {
374374

375375
#[doc(hidden)]
376376
#[macro_export]
377-
#[cfg(not(feature = "blank-check"))]
378-
macro_rules! blank_check {
377+
#[cfg(not(feature = "custom-blank-check"))]
378+
macro_rules! custom_blank_check {
379379
($type:ty) => {};
380380
}
381381
#[doc(hidden)]
382382
#[macro_export]
383-
#[cfg(feature = "blank-check")]
384-
macro_rules! blank_check {
383+
#[cfg(feature = "custom-blank-check")]
384+
macro_rules! custom_blank_check {
385385
($type:ty) => {
386386
#[no_mangle]
387387
#[link_section = ".entry"]
388-
pub unsafe extern "C" fn BlankCheck(addr: u32, size: u32) -> u32 {
388+
pub unsafe extern "C" fn CustomBlankCheck(addr: u32, size: u32) -> u32 {
389389
let this = unsafe {
390390
if !_IS_INIT {
391391
return 1;
392392
}
393393
&mut *_ALGO_INSTANCE.as_mut_ptr()
394394
};
395-
match <$type as $crate::FlashAlgorithm>::blank_check(this, addr, size) {
395+
match <$type as $crate::FlashAlgorithm>::custom_blank_check(this, addr, size) {
396396
Ok(()) => 0,
397397
Err(e) => e.get(),
398398
}

0 commit comments

Comments
 (0)