diff options
| author | Peter Krull <[email protected]> | 2023-04-23 15:50:46 +0200 |
|---|---|---|
| committer | Peter Krull <[email protected]> | 2023-04-23 15:50:46 +0200 |
| commit | cc5bca8e83b4fe372d8d87b35d82ff466d1a290a (patch) | |
| tree | 8d079f818f8aa75768d800f60e45d72f3a3c0486 | |
| parent | fb27594b2eb2cca2aea25dd92a7b730c185b6ecc (diff) | |
Added feature flag to embassy-rp intrinsics to avoid conflicts with rp2040-hal
| -rw-r--r-- | embassy-rp/src/intrinsics.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/embassy-rp/src/intrinsics.rs b/embassy-rp/src/intrinsics.rs index 3b63846d4..50934e04f 100644 --- a/embassy-rp/src/intrinsics.rs +++ b/embassy-rp/src/intrinsics.rs | |||
| @@ -402,6 +402,7 @@ macro_rules! division_function { | |||
| 402 | }; | 402 | }; |
| 403 | } | 403 | } |
| 404 | 404 | ||
| 405 | #[cfg(all(target_arch = "arm", feature = "intrinsics"))] | ||
| 405 | division_function! { | 406 | division_function! { |
| 406 | unsigned_divmod __aeabi_uidivmod __aeabi_uidiv ( u32 ) { | 407 | unsigned_divmod __aeabi_uidivmod __aeabi_uidiv ( u32 ) { |
| 407 | "str r0, [r2, #0x060]", // DIV_UDIVIDEND | 408 | "str r0, [r2, #0x060]", // DIV_UDIVIDEND |
| @@ -409,6 +410,7 @@ division_function! { | |||
| 409 | } | 410 | } |
| 410 | } | 411 | } |
| 411 | 412 | ||
| 413 | #[cfg(all(target_arch = "arm", feature = "intrinsics"))] | ||
| 412 | division_function! { | 414 | division_function! { |
| 413 | signed_divmod __aeabi_idivmod __aeabi_idiv ( i32 ) { | 415 | signed_divmod __aeabi_idivmod __aeabi_idiv ( i32 ) { |
| 414 | "str r0, [r2, #0x068]", // DIV_SDIVIDEND | 416 | "str r0, [r2, #0x068]", // DIV_SDIVIDEND |
| @@ -416,6 +418,7 @@ division_function! { | |||
| 416 | } | 418 | } |
| 417 | } | 419 | } |
| 418 | 420 | ||
| 421 | #[cfg(all(target_arch = "arm", feature = "intrinsics"))] | ||
| 419 | fn divider_unsigned(n: u32, d: u32) -> DivResult<u32> { | 422 | fn divider_unsigned(n: u32, d: u32) -> DivResult<u32> { |
| 420 | let packed = unsafe { unsigned_divmod(n, d) }; | 423 | let packed = unsafe { unsigned_divmod(n, d) }; |
| 421 | DivResult { | 424 | DivResult { |
| @@ -424,6 +427,7 @@ fn divider_unsigned(n: u32, d: u32) -> DivResult<u32> { | |||
| 424 | } | 427 | } |
| 425 | } | 428 | } |
| 426 | 429 | ||
| 430 | #[cfg(all(target_arch = "arm", feature = "intrinsics"))] | ||
| 427 | fn divider_signed(n: i32, d: i32) -> DivResult<i32> { | 431 | fn divider_signed(n: i32, d: i32) -> DivResult<i32> { |
| 428 | let packed = unsafe { signed_divmod(n, d) }; | 432 | let packed = unsafe { signed_divmod(n, d) }; |
| 429 | // Double casts to avoid sign extension | 433 | // Double casts to avoid sign extension |
| @@ -441,6 +445,7 @@ struct DivResult<T> { | |||
| 441 | pub remainder: T, | 445 | pub remainder: T, |
| 442 | } | 446 | } |
| 443 | 447 | ||
| 448 | #[cfg(all(target_arch = "arm", feature = "intrinsics"))] | ||
| 444 | intrinsics! { | 449 | intrinsics! { |
| 445 | extern "C" fn __udivsi3(n: u32, d: u32) -> u32 { | 450 | extern "C" fn __udivsi3(n: u32, d: u32) -> u32 { |
| 446 | divider_unsigned(n, d).quotient | 451 | divider_unsigned(n, d).quotient |
