Skip to content

Commit d60f21b

Browse files
authored
Merge pull request alexmoon#25 from alexmoon/nrfxlib-2.7
Nrfxlib 2.7
2 parents 1140645 + 3f759fb commit d60f21b

File tree

14 files changed

+179
-432
lines changed

14 files changed

+179
-432
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.5-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.5-branch"
20+
branch = "v2.7-branch"

examples/src/bin/adv-simple.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,19 @@ use bt_hci::cmd::SyncCmd;
66
use bt_hci::param::BdAddr;
77
use defmt::unwrap;
88
use embassy_executor::Spawner;
9-
use embassy_nrf::bind_interrupts;
109
use embassy_nrf::gpio::{Level, Output, OutputDrive};
10+
use embassy_nrf::peripherals::RNG;
11+
use embassy_nrf::rng::Rng;
12+
use embassy_nrf::{bind_interrupts, rng};
1113
use embassy_time::{Duration, Timer};
1214
use nrf_sdc::{self as sdc, mpsl, pac};
1315
use sdc::mpsl::MultiprotocolServiceLayer;
14-
use sdc::rng_pool::RngPool;
1516
use sdc::vendor::ZephyrWriteBdAddr;
1617
use static_cell::StaticCell;
1718
use {defmt_rtt as _, panic_probe as _};
1819

1920
bind_interrupts!(struct Irqs {
20-
RNG => sdc::rng_pool::InterruptHandler;
21+
RNG => rng::InterruptHandler<RNG>;
2122
SWI0_EGU0 => mpsl::LowPrioInterruptHandler;
2223
POWER_CLOCK => mpsl::ClockInterruptHandler;
2324
RADIO => mpsl::HighPrioInterruptHandler;
@@ -27,7 +28,7 @@ bind_interrupts!(struct Irqs {
2728

2829
fn build_sdc<'d, const N: usize>(
2930
p: nrf_sdc::Peripherals<'d>,
30-
rng: &'d RngPool,
31+
rng: &'d mut Rng<RNG>,
3132
mpsl: &'d MultiprotocolServiceLayer,
3233
mem: &'d mut sdc::Mem<N>,
3334
) -> Result<nrf_sdc::SoftdeviceController<'d>, nrf_sdc::Error> {
@@ -80,11 +81,10 @@ async fn main(spawner: Spawner) {
8081
p.PPI_CH25, p.PPI_CH26, p.PPI_CH27, p.PPI_CH28, p.PPI_CH29,
8182
);
8283

83-
let mut pool = [0; 256];
84-
let rng = sdc::rng_pool::RngPool::new(p.RNG, Irqs, &mut pool, 64);
84+
let mut rng = Rng::new(p.RNG, Irqs);
8585

8686
let mut sdc_mem = sdc::Mem::<1648>::new();
87-
let sdc = unwrap!(build_sdc(sdc_p, &rng, mpsl, &mut sdc_mem));
87+
let sdc = unwrap!(build_sdc(sdc_p, &mut rng, mpsl, &mut sdc_mem));
8888

8989
// Set the bluetooth address
9090
unwrap!(ZephyrWriteBdAddr::new(bd_addr()).exec(&sdc).await);

nrf-mpsl-sys/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ 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")
85-
.header("./third_party/nordic/nrfxlib/mpsl/include/mpsl_radio_notification.h")
8686
.header("./third_party/nordic/nrfxlib/mpsl/include/mpsl_temp.h")
8787
.header("./third_party/nordic/nrfxlib/mpsl/include/mpsl_timeslot.h")
8888
.header("./third_party/nordic/nrfxlib/mpsl/include/mpsl_tx_power.h")
Submodule nrfx updated 759 files
Submodule nrfxlib updated 1476 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 759 files

0 commit comments

Comments
 (0)