aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32-wpan/src/wba/linklayer_plat.rs
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-stm32-wpan/src/wba/linklayer_plat.rs')
-rw-r--r--embassy-stm32-wpan/src/wba/linklayer_plat.rs333
1 files changed, 149 insertions, 184 deletions
diff --git a/embassy-stm32-wpan/src/wba/linklayer_plat.rs b/embassy-stm32-wpan/src/wba/linklayer_plat.rs
index be9c49ab3..99afc78d6 100644
--- a/embassy-stm32-wpan/src/wba/linklayer_plat.rs
+++ b/embassy-stm32-wpan/src/wba/linklayer_plat.rs
@@ -75,10 +75,6 @@
75#![cfg(feature = "wba")] 75#![cfg(feature = "wba")]
76#![allow(clippy::missing_safety_doc)] 76#![allow(clippy::missing_safety_doc)]
77 77
78//! STM32WBA Link Layer platform adaptation layer.
79//!
80//! Based on STMicroelectronics original C source `linklayer_plat.c` (2024).
81
82use core::hint::spin_loop; 78use core::hint::spin_loop;
83use core::ptr; 79use core::ptr;
84use core::sync::atomic::{AtomicBool, AtomicI32, AtomicPtr, AtomicU32, Ordering}; 80use core::sync::atomic::{AtomicBool, AtomicI32, AtomicPtr, AtomicU32, Ordering};
@@ -278,36 +274,31 @@ pub unsafe fn run_radio_sw_low_isr() {
278 } 274 }
279} 275}
280 276
281/// Initialize radio-related clock prerequisites. 277// /**
282/// 278// * @brief Configure the necessary clock sources for the radio.
283/// Currently this touches the sleep timer to ensure the Link Layer common 279// * @param None
284/// interface is initialized. It does not actively reconfigure clocks. 280// * @retval None
285/// 281// */
286/// # Safety
287/// Called from the vendor Link Layer. Must run in a context where accessing
288/// the LL common interface is safe.
289#[unsafe(no_mangle)] 282#[unsafe(no_mangle)]
290pub unsafe extern "C" fn LINKLAYER_PLAT_ClockInit() { 283pub unsafe extern "C" fn LINKLAYER_PLAT_ClockInit() {
291 let _ = link_layer::ll_intf_cmn_get_slptmr_value(); 284 let _ = link_layer::ll_intf_cmn_get_slptmr_value();
292} 285}
293 286
294/// Busy-wait for the requested duration in microseconds. 287// /**
295/// 288// * @brief Link Layer active waiting loop.
296/// Blocks the current context until `delay` microseconds have elapsed. 289// * @param delay: delay in us
297/// 290// * @retval None
298/// # Safety 291// */
299/// Must be called only in contexts where busy-waiting is acceptable (e.g. no
300/// hard real-time deadlines are violated).
301#[unsafe(no_mangle)] 292#[unsafe(no_mangle)]
302pub unsafe extern "C" fn LINKLAYER_PLAT_DelayUs(delay: u32) { 293pub unsafe extern "C" fn LINKLAYER_PLAT_DelayUs(delay: u32) {
303 block_for(Duration::from_micros(u64::from(delay))); 294 block_for(Duration::from_micros(u64::from(delay)));
304} 295}
305 296
306/// Assert a condition and panic if it is false. 297// /**
307/// 298// * @brief Link Layer assertion API
308/// # Safety 299// * @param condition: conditional statement to be checked.
309/// None beyond general panic considerations; will abort/panic the program if 300// * @retval None
310/// `condition == 0`. 301// */
311#[unsafe(no_mangle)] 302#[unsafe(no_mangle)]
312pub unsafe extern "C" fn LINKLAYER_PLAT_Assert(condition: u8) { 303pub unsafe extern "C" fn LINKLAYER_PLAT_Assert(condition: u8) {
313 if condition == 0 { 304 if condition == 0 {
@@ -315,13 +306,11 @@ pub unsafe extern "C" fn LINKLAYER_PLAT_Assert(condition: u8) {
315 } 306 }
316} 307}
317 308
318/// Wait for the AHB5 clock domain to be ready after low-power entry. 309// /**
319/// 310// * @brief Enable/disable the Link Layer active clock (baseband clock).
320/// If the platform flagged AHB5 as switched off before WFI, this waits until 311// * @param enable: boolean value to enable (1) or disable (0) the clock.
321/// the sleep timer ticks, indicating the bus has resumed. 312// * @retval None
322/// 313// */
323/// # Safety
324/// Spins while waiting; must be safe to busy-wait in the calling context.
325#[unsafe(no_mangle)] 314#[unsafe(no_mangle)]
326pub unsafe extern "C" fn LINKLAYER_PLAT_WaitHclkRdy() { 315pub unsafe extern "C" fn LINKLAYER_PLAT_WaitHclkRdy() {
327 if AHB5_SWITCHED_OFF.swap(false, Ordering::AcqRel) { 316 if AHB5_SWITCHED_OFF.swap(false, Ordering::AcqRel) {
@@ -332,23 +321,24 @@ pub unsafe extern "C" fn LINKLAYER_PLAT_WaitHclkRdy() {
332 } 321 }
333} 322}
334 323
335/// Notify that the system is entering WFI and AHB5 may be turned off depending 324// /**
336/// on radio state. 325// * @brief Notify the Link Layer platform layer the system will enter in WFI
337/// 326// * and AHB5 clock may be turned of regarding the 2.4Ghz radio state.
338/// # Safety 327// * @param None
339/// None; this only updates internal state used to resynchronize after WFI. 328// * @retval None
329// */
340#[unsafe(no_mangle)] 330#[unsafe(no_mangle)]
341pub unsafe extern "C" fn LINKLAYER_PLAT_NotifyWFIEnter() { 331pub unsafe extern "C" fn LINKLAYER_PLAT_NotifyWFIEnter() {
342 AHB5_SWITCHED_OFF.store(true, Ordering::Release); 332 AHB5_SWITCHED_OFF.store(true, Ordering::Release);
343} 333}
344 334
345/// Notify that the system exited WFI and capture a reference sleep timer value. 335// /**
346/// 336// * @brief Notify the Link Layer platform layer the system exited WFI and AHB5
347/// If AHB5 was flagged as switched off on entry, records the current sleep 337// * clock may be resynchronized as is may have been turned of during
348/// timer value for later synchronization in [`LINKLAYER_PLAT_WaitHclkRdy`]. 338// * low power mode entry.
349/// 339// * @param None
350/// # Safety 340// * @retval None
351/// None; reads a monotonic timer from the LL common interface. 341// */
352#[unsafe(no_mangle)] 342#[unsafe(no_mangle)]
353pub unsafe extern "C" fn LINKLAYER_PLAT_NotifyWFIExit() { 343pub unsafe extern "C" fn LINKLAYER_PLAT_NotifyWFIExit() {
354 if AHB5_SWITCHED_OFF.load(Ordering::Acquire) { 344 if AHB5_SWITCHED_OFF.load(Ordering::Acquire) {
@@ -357,24 +347,20 @@ pub unsafe extern "C" fn LINKLAYER_PLAT_NotifyWFIExit() {
357 } 347 }
358} 348}
359 349
360/// Control the active clock (placeholder). 350// /**
361/// 351// * @brief Active wait on bus clock readiness.
362/// Currently a no-op. Present for API compatibility with vendor code. 352// * @param None
363/// 353// * @retval None
364/// # Safety 354// */
365/// None; function does nothing.
366#[unsafe(no_mangle)] 355#[unsafe(no_mangle)]
367pub unsafe extern "C" fn LINKLAYER_PLAT_AclkCtrl(_enable: u8) {} 356pub unsafe extern "C" fn LINKLAYER_PLAT_AclkCtrl(_enable: u8) {}
368 357
369/// Fill a buffer with pseudo-random bytes. 358// /**
370/// 359// * @brief Link Layer RNG request.
371/// This uses a xorshift32 PRNG seeded from the sleep timer and core clock. 360// * @param ptr_rnd: pointer to the variable that hosts the number.
372/// It is not cryptographically secure and is intended only for non-security 361// * @param len: number of byte of anthropy to get.
373/// purposes. 362// * @retval None
374/// 363// */
375/// # Safety
376/// - `ptr_rnd` must be valid for writes of `len` bytes.
377/// - The memory region must not alias mutable references elsewhere.
378#[unsafe(no_mangle)] 364#[unsafe(no_mangle)]
379pub unsafe extern "C" fn LINKLAYER_PLAT_GetRNG(ptr_rnd: *mut u8, len: u32) { 365pub unsafe extern "C" fn LINKLAYER_PLAT_GetRNG(ptr_rnd: *mut u8, len: u32) {
380 if ptr_rnd.is_null() || len == 0 { 366 if ptr_rnd.is_null() || len == 0 {
@@ -387,14 +373,11 @@ pub unsafe extern "C" fn LINKLAYER_PLAT_GetRNG(ptr_rnd: *mut u8, len: u32) {
387 } 373 }
388} 374}
389 375
390/// Configure the radio high-priority interrupt callback and NVIC state. 376// /**
391/// 377// * @brief Initialize Link Layer radio high priority interrupt.
392/// When `intr_cb` is `Some`, sets the NVIC priority to 378// * @param intr_cb: function pointer to assign for the radio high priority ISR routine.
393/// `RADIO_INTR_PRIO_HIGH` and unmasks the interrupt. Passing `None` disables 379// * @retval None
394/// the interrupt. 380// */
395///
396/// # Safety
397/// `intr_cb` must be an ISR-safe function. Alters NVIC state globally.
398#[unsafe(no_mangle)] 381#[unsafe(no_mangle)]
399pub unsafe extern "C" fn LINKLAYER_PLAT_SetupRadioIT(intr_cb: Option<Callback>) { 382pub unsafe extern "C" fn LINKLAYER_PLAT_SetupRadioIT(intr_cb: Option<Callback>) {
400 store_callback(&RADIO_CALLBACK, intr_cb); 383 store_callback(&RADIO_CALLBACK, intr_cb);
@@ -407,14 +390,11 @@ pub unsafe extern "C" fn LINKLAYER_PLAT_SetupRadioIT(intr_cb: Option<Callback>)
407 } 390 }
408} 391}
409 392
410/// Configure the software low-priority radio interrupt callback and NVIC state. 393// /**
411/// 394// * @brief Initialize Link Layer SW low priority interrupt.
412/// When `intr_cb` is `Some`, sets the NVIC priority to 395// * @param intr_cb: function pointer to assign for the SW low priority ISR routine.
413/// `RADIO_SW_LOW_INTR_PRIO` and unmasks the interrupt. Passing `None` 396// * @retval None
414/// disables the interrupt. 397// */
415///
416/// # Safety
417/// `intr_cb` must be ISR-safe. Alters NVIC state globally.
418#[unsafe(no_mangle)] 398#[unsafe(no_mangle)]
419pub unsafe extern "C" fn LINKLAYER_PLAT_SetupSwLowIT(intr_cb: Option<Callback>) { 399pub unsafe extern "C" fn LINKLAYER_PLAT_SetupSwLowIT(intr_cb: Option<Callback>) {
420 store_callback(&LOW_ISR_CALLBACK, intr_cb); 400 store_callback(&LOW_ISR_CALLBACK, intr_cb);
@@ -427,13 +407,11 @@ pub unsafe extern "C" fn LINKLAYER_PLAT_SetupSwLowIT(intr_cb: Option<Callback>)
427 } 407 }
428} 408}
429 409
430/// Trigger the software low-priority radio interrupt. 410// /**
431/// 411// * @brief Trigger the link layer SW low interrupt.
432/// If `priority` is non-zero, elevates the interrupt to the low radio priority 412// * @param None
433/// for this trigger or the next run when already active. 413// * @retval None
434/// 414// */
435/// # Safety
436/// Alters NVIC pending and priority state; must be safe for the system.
437#[unsafe(no_mangle)] 415#[unsafe(no_mangle)]
438pub unsafe extern "C" fn LINKLAYER_PLAT_TriggerSwLowIT(priority: u8) { 416pub unsafe extern "C" fn LINKLAYER_PLAT_TriggerSwLowIT(priority: u8) {
439 let active = nvic_get_active(RADIO_SW_LOW_INTR_NUM); 417 let active = nvic_get_active(RADIO_SW_LOW_INTR_NUM);
@@ -452,13 +430,11 @@ pub unsafe extern "C" fn LINKLAYER_PLAT_TriggerSwLowIT(priority: u8) {
452 nvic_set_pending(RADIO_SW_LOW_INTR_NUM); 430 nvic_set_pending(RADIO_SW_LOW_INTR_NUM);
453} 431}
454 432
455/// Enable interrupts using a reference-counted scheme. 433// /**
456/// 434// * @brief Enable interrupts.
457/// When the internal counter reaches zero, restores the previous PRIMASK 435// * @param None
458/// snapshot and enables or keeps interrupts disabled accordingly. 436// * @retval None
459/// 437// */
460/// # Safety
461/// Must be paired with prior calls to [`LINKLAYER_PLAT_DisableIRQ`].
462#[unsafe(no_mangle)] 438#[unsafe(no_mangle)]
463pub unsafe extern "C" fn LINKLAYER_PLAT_EnableIRQ() { 439pub unsafe extern "C" fn LINKLAYER_PLAT_EnableIRQ() {
464 if counter_release(&IRQ_COUNTER) { 440 if counter_release(&IRQ_COUNTER) {
@@ -471,13 +447,11 @@ pub unsafe extern "C" fn LINKLAYER_PLAT_EnableIRQ() {
471 } 447 }
472} 448}
473 449
474/// Disable interrupts using a reference-counted scheme. 450// /**
475/// 451// * @brief Disable interrupts.
476/// Captures the current PRIMASK state on the first disable and then disables 452// * @param None
477/// interrupts. Must be balanced with [`LINKLAYER_PLAT_EnableIRQ`]. 453// * @retval None
478/// 454// */
479/// # Safety
480/// Affects global interrupt state; may impact system timing and ISRs.
481#[unsafe(no_mangle)] 455#[unsafe(no_mangle)]
482pub unsafe extern "C" fn LINKLAYER_PLAT_DisableIRQ() { 456pub unsafe extern "C" fn LINKLAYER_PLAT_DisableIRQ() {
483 if counter_acquire(&IRQ_COUNTER) { 457 if counter_acquire(&IRQ_COUNTER) {
@@ -487,16 +461,16 @@ pub unsafe extern "C" fn LINKLAYER_PLAT_DisableIRQ() {
487 cortex_m::interrupt::disable(); 461 cortex_m::interrupt::disable();
488} 462}
489 463
490/// Enable specific Link Layer interrupt groups. 464// /**
491/// 465// * @brief Enable specific interrupt group.
492/// - `LL_HIGH_ISR_ONLY`: Unmask high-priority radio ISR. 466// * @param isr_type: mask for interrupt group to enable.
493/// - `LL_LOW_ISR_ONLY`: Unmask software low-priority radio ISR. 467// * This parameter can be one of the following:
494/// - `SYS_LOW_ISR`: Lower BASEPRI mask to re-enable lower-priority system ISRs. 468// * @arg LL_HIGH_ISR_ONLY: enable link layer high priority ISR.
495/// 469// * @arg LL_LOW_ISR_ONLY: enable link layer SW low priority ISR.
496/// Uses internal reference counters so multiple disables/enables can be nested. 470// * @arg SYS_LOW_ISR: mask interrupts for all the other system ISR with
497/// 471// * lower priority that link layer SW low interrupt.
498/// # Safety 472// * @retval None
499/// Alters NVIC and BASEPRI state globally. 473// */
500#[unsafe(no_mangle)] 474#[unsafe(no_mangle)]
501pub unsafe extern "C" fn LINKLAYER_PLAT_EnableSpecificIRQ(isr_type: u8) { 475pub unsafe extern "C" fn LINKLAYER_PLAT_EnableSpecificIRQ(isr_type: u8) {
502 if (isr_type & link_layer::LL_HIGH_ISR_ONLY as u8) != 0 { 476 if (isr_type & link_layer::LL_HIGH_ISR_ONLY as u8) != 0 {
@@ -519,16 +493,16 @@ pub unsafe extern "C" fn LINKLAYER_PLAT_EnableSpecificIRQ(isr_type: u8) {
519 } 493 }
520} 494}
521 495
522/// Disable specific Link Layer interrupt groups. 496// /**
523/// 497// * @brief Disable specific interrupt group.
524/// - `LL_HIGH_ISR_ONLY`: Mask high-priority radio ISR. 498// * @param isr_type: mask for interrupt group to disable.
525/// - `LL_LOW_ISR_ONLY`: Mask software low-priority radio ISR. 499// * This parameter can be one of the following:
526/// - `SYS_LOW_ISR`: Raise BASEPRI to mask system ISRs lower than SW low-priority. 500// * @arg LL_HIGH_ISR_ONLY: disable link layer high priority ISR.
527/// 501// * @arg LL_LOW_ISR_ONLY: disable link layer SW low priority ISR.
528/// Uses internal reference counters so multiple disables/enables can be nested. 502// * @arg SYS_LOW_ISR: unmask interrupts for all the other system ISR with
529/// 503// * lower priority that link layer SW low interrupt.
530/// # Safety 504// * @retval None
531/// Alters NVIC and BASEPRI state globally. 505// */
532#[unsafe(no_mangle)] 506#[unsafe(no_mangle)]
533pub unsafe extern "C" fn LINKLAYER_PLAT_DisableSpecificIRQ(isr_type: u8) { 507pub unsafe extern "C" fn LINKLAYER_PLAT_DisableSpecificIRQ(isr_type: u8) {
534 if (isr_type & link_layer::LL_HIGH_ISR_ONLY as u8) != 0 { 508 if (isr_type & link_layer::LL_HIGH_ISR_ONLY as u8) != 0 {
@@ -552,107 +526,100 @@ pub unsafe extern "C" fn LINKLAYER_PLAT_DisableSpecificIRQ(isr_type: u8) {
552 } 526 }
553} 527}
554 528
555/// Unmask the radio high-priority interrupt. 529// /**
556/// 530// * @brief Enable link layer high priority ISR only.
557/// # Safety 531// * @param None
558/// Alters NVIC state globally. 532// * @retval None
533// */
559#[unsafe(no_mangle)] 534#[unsafe(no_mangle)]
560pub unsafe extern "C" fn LINKLAYER_PLAT_EnableRadioIT() { 535pub unsafe extern "C" fn LINKLAYER_PLAT_EnableRadioIT() {
561 nvic_enable(mac::RADIO_INTR_NUM); 536 nvic_enable(mac::RADIO_INTR_NUM);
562} 537}
563 538
564/// Mask the radio high-priority interrupt. 539// /**
565/// 540// * @brief Disable link layer high priority ISR only.
566/// # Safety 541// * @param None
567/// Alters NVIC state globally. 542// * @retval None
543// */
568#[unsafe(no_mangle)] 544#[unsafe(no_mangle)]
569pub unsafe extern "C" fn LINKLAYER_PLAT_DisableRadioIT() { 545pub unsafe extern "C" fn LINKLAYER_PLAT_DisableRadioIT() {
570 nvic_disable(mac::RADIO_INTR_NUM); 546 nvic_disable(mac::RADIO_INTR_NUM);
571} 547}
572 548
573/// Notify that a radio activity is starting. 549// /**
574/// 550// * @brief Link Layer notification for radio activity start.
575/// Sets the radio interrupt priority to high and unmasks it. 551// * @param None
576/// 552// * @retval None
577/// # Safety 553// */
578/// Alters NVIC state globally.
579#[unsafe(no_mangle)] 554#[unsafe(no_mangle)]
580pub unsafe extern "C" fn LINKLAYER_PLAT_StartRadioEvt() { 555pub unsafe extern "C" fn LINKLAYER_PLAT_StartRadioEvt() {
581 nvic_set_priority(mac::RADIO_INTR_NUM, pack_priority(mac::RADIO_INTR_PRIO_HIGH)); 556 nvic_set_priority(mac::RADIO_INTR_NUM, pack_priority(mac::RADIO_INTR_PRIO_HIGH));
582 nvic_enable(mac::RADIO_INTR_NUM); 557 nvic_enable(mac::RADIO_INTR_NUM);
583} 558}
584 559
585/// Notify that a radio activity ended. 560// /**
586/// 561// * @brief Link Layer notification for radio activity end.
587/// Lowers the radio interrupt priority to its low setting. 562// * @param None
588/// 563// * @retval None
589/// # Safety 564// */
590/// Alters NVIC state globally.
591#[unsafe(no_mangle)] 565#[unsafe(no_mangle)]
592pub unsafe extern "C" fn LINKLAYER_PLAT_StopRadioEvt() { 566pub unsafe extern "C" fn LINKLAYER_PLAT_StopRadioEvt() {
593 nvic_set_priority(mac::RADIO_INTR_NUM, pack_priority(mac::RADIO_INTR_PRIO_LOW)); 567 nvic_set_priority(mac::RADIO_INTR_NUM, pack_priority(mac::RADIO_INTR_PRIO_LOW));
594} 568}
595 569
596/// Notify that RCO calibration is starting (placeholder). 570// /**
597/// 571// * @brief Link Layer notification for RCO calibration start.
598/// Currently a no-op. 572// * @param None
599/// 573// * @retval None
600/// # Safety 574// */
601/// None.
602#[unsafe(no_mangle)] 575#[unsafe(no_mangle)]
603pub unsafe extern "C" fn LINKLAYER_PLAT_RCOStartClbr() {} 576pub unsafe extern "C" fn LINKLAYER_PLAT_RCOStartClbr() {}
604 577
605/// Notify that RCO calibration ended (placeholder). 578// /**
606/// 579// * @brief Link Layer notification for RCO calibration end.
607/// Currently a no-op. 580// * @param None
608/// 581// * @retval None
609/// # Safety 582// */
610/// None.
611#[unsafe(no_mangle)] 583#[unsafe(no_mangle)]
612pub unsafe extern "C" fn LINKLAYER_PLAT_RCOStopClbr() {} 584pub unsafe extern "C" fn LINKLAYER_PLAT_RCOStopClbr() {}
613 585
614/// Request a temperature measurement for radio calibration (placeholder). 586// /**
615/// 587// * @brief Link Layer requests temperature.
616/// Currently a no-op. 588// * @param None
617/// 589// * @retval None
618/// # Safety 590// */
619/// None.
620#[unsafe(no_mangle)] 591#[unsafe(no_mangle)]
621pub unsafe extern "C" fn LINKLAYER_PLAT_RequestTemperature() {} 592pub unsafe extern "C" fn LINKLAYER_PLAT_RequestTemperature() {}
622 593
623/// Notify that PHY calibration is starting (placeholder). 594// /**
624/// 595// * @brief PHY Start calibration.
625/// Currently a no-op. 596// * @param None
626/// 597// * @retval None
627/// # Safety 598// */
628/// None.
629#[unsafe(no_mangle)] 599#[unsafe(no_mangle)]
630pub unsafe extern "C" fn LINKLAYER_PLAT_PhyStartClbr() {} 600pub unsafe extern "C" fn LINKLAYER_PLAT_PhyStartClbr() {}
631 601
632/// Notify that PHY calibration ended (placeholder). 602// /**
633/// 603// * @brief PHY Stop calibration.
634/// Currently a no-op. 604// * @param None
635/// 605// * @retval None
636/// # Safety 606// */
637/// None.
638#[unsafe(no_mangle)] 607#[unsafe(no_mangle)]
639pub unsafe extern "C" fn LINKLAYER_PLAT_PhyStopClbr() {} 608pub unsafe extern "C" fn LINKLAYER_PLAT_PhyStopClbr() {}
640 609
641/// Notify that new Link Layer scheduler timings have been applied (placeholder). 610// /**
642/// 611// * @brief Notify the upper layer that new Link Layer timings have been applied.
643/// Currently a no-op. 612// * @param evnt_timing[in]: Evnt_timing_t pointer to structure contains drift time , execution time and scheduling time
644/// 613// * @retval None.
645/// # Safety 614// */
646/// None.
647#[unsafe(no_mangle)] 615#[unsafe(no_mangle)]
648pub unsafe extern "C" fn LINKLAYER_PLAT_SCHLDR_TIMING_UPDATE_NOT(_timings: *const link_layer::Evnt_timing_t) {} 616pub unsafe extern "C" fn LINKLAYER_PLAT_SCHLDR_TIMING_UPDATE_NOT(_timings: *const link_layer::Evnt_timing_t) {}
649 617
650/// Return the STMicroelectronics Bluetooth SIG Company Identifier. 618// /**
651/// 619// * @brief Get the ST company ID.
652/// Value: `0x0030`. 620// * @param None
653/// 621// * @retval Company ID
654/// # Safety 622// */
655/// None.
656#[unsafe(no_mangle)] 623#[unsafe(no_mangle)]
657pub unsafe extern "C" fn LINKLAYER_PLAT_GetSTCompanyID() -> u32 { 624pub unsafe extern "C" fn LINKLAYER_PLAT_GetSTCompanyID() -> u32 {
658 // STMicroelectronics Bluetooth SIG Company Identifier 625 // STMicroelectronics Bluetooth SIG Company Identifier
@@ -660,13 +627,11 @@ pub unsafe extern "C" fn LINKLAYER_PLAT_GetSTCompanyID() -> u32 {
660 0x0030 627 0x0030
661} 628}
662 629
663/// Return the lower 32 bits of the STM32 unique 96-bit device identifier. 630// /**
664/// 631// * @brief Get the Unique Device Number (UDN).
665/// Note: This may differ from the ST-defined UDN encoding found in some device 632// * @param None
666/// registers/documents; it returns the first word of the unique ID. 633// * @retval UDN
667/// 634// */
668/// # Safety
669/// None.
670#[unsafe(no_mangle)] 635#[unsafe(no_mangle)]
671pub unsafe extern "C" fn LINKLAYER_PLAT_GetUDN() -> u32 { 636pub unsafe extern "C" fn LINKLAYER_PLAT_GetUDN() -> u32 {
672 // Read the first 32 bits of the STM32 unique 96-bit ID 637 // Read the first 32 bits of the STM32 unique 96-bit ID