Skip to content

Commit 3f759fb

Browse files
committed
update to nrfxlib 2.7 and nrfx 3.6
- Move ECB functionality into mpsl - Adapt to API changes
1 parent c90c92d commit 3f759fb

File tree

9 files changed

+25
-16
lines changed

9 files changed

+25
-16
lines changed

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
[submodule "nrf-mpsl-sys/third_party/nordic/nrfxlib"]
1414
path = nrf-mpsl-sys/third_party/nordic/nrfxlib
1515
url = https://github.com/nrfconnect/sdk-nrfxlib.git
16-
branch = "v2.6-branch"
16+
branch = "v2.7-branch"
1717
[submodule "nrf-sdc-sys/third_party/nordic/nrfxlib"]
1818
path = nrf-sdc-sys/third_party/nordic/nrfxlib
1919
url = https://github.com/nrfconnect/sdk-nrfxlib.git
20-
branch = "v2.6-branch"
20+
branch = "v2.7-branch"

nrf-mpsl-sys/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ fn main() {
8080
.header("./include/stdlib.h")
8181
.header("./third_party/nordic/nrfxlib/mpsl/include/mpsl.h")
8282
.header("./third_party/nordic/nrfxlib/mpsl/include/mpsl_clock.h")
83+
.header("./third_party/nordic/nrfxlib/mpsl/include/mpsl_ecb.h")
8384
.header("./third_party/nordic/nrfxlib/mpsl/include/mpsl_coex.h")
8485
.header("./third_party/nordic/nrfxlib/mpsl/include/mpsl_cx_abstract_interface.h")
8586
.header("./third_party/nordic/nrfxlib/mpsl/include/mpsl_temp.h")
Submodule nrfx updated 270 files
Submodule nrfxlib updated 550 files

nrf-mpsl/src/mpsl.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,21 @@ impl<'d> MultiprotocolServiceLayer<'d> {
145145
pub async fn request_hfclk(&self) -> Result<hfclk::Hfclk, Error> {
146146
hfclk::Hfclk::new()
147147
}
148+
149+
pub fn ecb_block_encrypt(&self, key: &[u8; 16], cleartext: &[u8], ciphertext: &mut [u8]) -> Result<(), Error> {
150+
assert_eq!(cleartext.len(), 16);
151+
assert_eq!(ciphertext.len(), 16);
152+
unsafe {
153+
raw::mpsl_ecb_block_encrypt_extended(
154+
key.as_ptr(),
155+
cleartext.as_ptr(),
156+
ciphertext.as_mut_ptr(),
157+
// TODO: Support flags
158+
0,
159+
)
160+
};
161+
Ok(())
162+
}
148163
}
149164

150165
#[repr(align(4))]

nrf-sdc-sys/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ fn bindgen(target: &Target, mem_fns: Rc<RefCell<Vec<u8>>>) -> bindgen::Builder {
178178
.clang_arg(format!("-mfloat-abi={}", target.float_abi))
179179
.clang_arg("-mthumb")
180180
.clang_arg("-I./third_party/arm/CMSIS_5/CMSIS/Core/Include")
181+
.clang_arg("-I./third_party/nordic/nrfx")
181182
.clang_arg("-I./third_party/nordic/nrfx/mdk")
182183
.clang_arg("-I./third_party/nordic/nrfxlib/softdevice_controller/include")
183184
.clang_arg(format!("-D{}", target.chip))
Submodule nrfx updated 270 files
Submodule nrfxlib updated 550 files

nrf-sdc/src/sdc.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,6 @@ impl Builder {
402402
"SoftdeviceController already initialized!"
403403
);
404404
let rand_source = raw::sdc_rand_source_t {
405-
rand_prio_low_get: None,
406-
rand_prio_high_get: None,
407405
rand_poll: Some(rand_blocking::<R>),
408406
};
409407
let ret = unsafe { raw::sdc_rand_source_register(&rand_source) };
@@ -474,7 +472,8 @@ impl<'d> SoftdeviceController<'d> {
474472
pub fn try_hci_get(&self, buf: &mut [u8]) -> Result<bt_hci::PacketKind, Error> {
475473
assert!(buf.len() >= raw::HCI_MSG_BUFFER_MAX_SIZE as usize);
476474
let mut msg_type: raw::sdc_hci_msg_type_t = 0;
477-
let ret = unsafe { raw::sdc_hci_get(buf.as_mut_ptr(), &mut msg_type) };
475+
476+
let ret = unsafe { raw::sdc_hci_get(buf.as_mut_ptr(), (&mut msg_type) as *mut _ as *mut u8) };
478477
RetVal::from(ret).to_result()?;
479478
let kind = match msg_type {
480479
raw::SDC_HCI_MSG_TYPE_DATA => bt_hci::PacketKind::AclData,
@@ -517,13 +516,6 @@ impl<'d> SoftdeviceController<'d> {
517516
WAKER.register(waker);
518517
}
519518

520-
pub fn ecb_block_encrypt(&self, key: &[u8; 16], cleartext: &[u8], ciphertext: &mut [u8]) -> Result<(), Error> {
521-
assert_eq!(cleartext.len(), 16);
522-
assert_eq!(ciphertext.len(), 16);
523-
let ret = unsafe { raw::sdc_soc_ecb_block_encrypt(key.as_ptr(), cleartext.as_ptr(), ciphertext.as_mut_ptr()) };
524-
RetVal::from(ret).to_result().and(Ok(()))
525-
}
526-
527519
#[inline(always)]
528520
unsafe fn raw_cmd(&self, f: unsafe extern "C" fn() -> u8) -> Result<(), bt_hci::param::Error> {
529521
bt_hci::param::Status::from(f()).to_result()

0 commit comments

Comments
 (0)