@@ -2562,7 +2562,48 @@ void radio_ccm_disable(void)
25622562#endif /* CONFIG_BT_CTLR_LE_ENC || CONFIG_BT_CTLR_BROADCAST_ISO_ENC */
25632563
25642564#if defined(CONFIG_BT_CTLR_PRIVACY )
2565+ #if defined(CONFIG_SOC_COMPATIBLE_NRF54LX )
2566+ struct aar_job_ptr {
2567+ void * ptr ;
2568+ struct {
2569+ uint32_t length :24 ;
2570+ uint32_t attribute :8 ;
2571+ } __packed ;
2572+ } __packed ;
2573+
2574+ #define AAR_JOB_PTR_ATTRIBUTE_HASH 11U
2575+ #define AAR_JOB_PTR_ATTRIBUTE_PRAND 12U
2576+ #define AAR_JOB_PTR_ATTRIBUTE_IRK 13U
2577+ #define AAR_JOB_PTR_ATTRIBUTE_INDEX 11U
2578+
2579+ #define AAR_JOB_OUT_MAX_RESOLVED 1U
2580+
2581+ #define AAR_IRK_SIZE 16U
2582+
2583+ #define RADIO_PACKET_PTR_TO_PDU_OFFSET 3U
2584+
2585+ #define BDADDR_HASH_OFFSET 0U
2586+ #define BDADDR_HASH_SIZE 3U
2587+ #define BDADDR_PRND_OFFSET 3U
2588+ #define BDADDR_PRND_SIZE 3U
2589+
2590+ /* AAR HAL global memory referenced by the h/w peripheral and its DMA */
2591+ static struct {
2592+ /* Index of the IRK match in the AAR job list, on successful resolution */
2593+ uint32_t status ;
2594+
2595+ /* Input AAR job list; list of Hash, Prand, IRKs and a terminating empty job entry */
2596+ struct aar_job_ptr in [CONFIG_BT_CTLR_RL_SIZE + 3 ];
2597+
2598+ /* Output AAR job list of one entry */
2599+ struct aar_job_ptr out [AAR_JOB_OUT_MAX_RESOLVED ];
2600+
2601+ /* NOTE: Refer to the AAR section in the SoC product specification for details */
2602+ } aar_job ;
2603+
2604+ #else /* !CONFIG_SOC_COMPATIBLE_NRF54LX */
25652605static uint8_t MALIGN (4 ) _aar_scratch [3 ];
2606+ #endif /* !CONFIG_SOC_COMPATIBLE_NRF54LX */
25662607
25672608void radio_ar_configure (uint32_t nirk , void * irk , uint8_t flags )
25682609{
@@ -2599,10 +2640,57 @@ void radio_ar_configure(uint32_t nirk, void *irk, uint8_t flags)
25992640
26002641 NRF_AAR -> ENABLE = (AAR_ENABLE_ENABLE_Enabled << AAR_ENABLE_ENABLE_Pos ) &
26012642 AAR_ENABLE_ENABLE_Msk ;
2643+
2644+ #if defined(CONFIG_SOC_COMPATIBLE_NRF54LX )
2645+ /* Input, Resolvable Address Hash offset in the legacy or extended advertising PDU.
2646+ * Radio packet pointer offset by 3 compared to legacy AAR in nRF51/52/53 SoCs that took
2647+ * Radio packet pointer value.
2648+ */
2649+ aar_job .in [0 ].ptr = (uint8_t * )addrptr + RADIO_PACKET_PTR_TO_PDU_OFFSET +
2650+ BDADDR_HASH_OFFSET ;
2651+ aar_job .in [0 ].length = BDADDR_HASH_SIZE ;
2652+ aar_job .in [0 ].attribute = AAR_JOB_PTR_ATTRIBUTE_HASH ;
2653+
2654+ /* Input, Resolvable Address Random offset in the legacy or extended advertising PDU.
2655+ * Radio packet pointer offset by 3 compared to legacy AAR in nRF51/52/53 SoCs that took
2656+ * Radio packet pointer, plus offset of the 24-bit random in the legacy or extended
2657+ * advertising PDU after the 24-bit Hash in the Resolvable Address.
2658+ */
2659+ aar_job .in [1 ].ptr = (uint8_t * )addrptr + RADIO_PACKET_PTR_TO_PDU_OFFSET +
2660+ BDADDR_PRND_OFFSET ;
2661+ aar_job .in [1 ].length = BDADDR_PRND_SIZE ;
2662+ aar_job .in [1 ].attribute = AAR_JOB_PTR_ATTRIBUTE_PRAND ;
2663+
2664+ /* Input, list of IRKs used for resolution */
2665+ for (uint32_t i = 0 ; i < nirk ; i ++ ) {
2666+ aar_job .in [2U + i ].ptr = (void * )(((uint8_t * )irk ) + (AAR_IRK_SIZE * i ));
2667+ aar_job .in [2U + i ].length = AAR_IRK_SIZE ;
2668+ aar_job .in [2U + i ].attribute = AAR_JOB_PTR_ATTRIBUTE_IRK ;
2669+ }
2670+
2671+ /* A terminating empty job entry */
2672+ aar_job .in [2U + nirk ].ptr = 0U ;
2673+ aar_job .in [2U + nirk ].length = 0U ;
2674+ aar_job .in [2U + nirk ].attribute = 0U ;
2675+
2676+ /* Reset match index to invalid value ( >= CONFIG_BT_CTLR_RL_SIZE ) */
2677+ aar_job .status = UINT32_MAX ;
2678+
2679+ /* Output, single job entry that populates the `status` value with match index */
2680+ aar_job .out [0 ].ptr = & aar_job .status ;
2681+ aar_job .out [0 ].length = sizeof (aar_job .status );
2682+ aar_job .out [0 ].attribute = AAR_JOB_PTR_ATTRIBUTE_INDEX ;
2683+
2684+ NRF_AAR -> IN .PTR = (uint32_t )& aar_job .in [0 ];
2685+ NRF_AAR -> OUT .PTR = (uint32_t )& aar_job .out [0 ];
2686+ NRF_AAR -> MAXRESOLVED = AAR_JOB_OUT_MAX_RESOLVED ;
2687+
2688+ #else /* !CONFIG_SOC_COMPATIBLE_NRF54LX */
26022689 NRF_AAR -> NIRK = nirk ;
26032690 NRF_AAR -> IRKPTR = (uint32_t )irk ;
26042691 NRF_AAR -> ADDRPTR = addrptr ;
26052692 NRF_AAR -> SCRATCHPTR = (uint32_t )& _aar_scratch [0 ];
2693+ #endif /* !CONFIG_SOC_COMPATIBLE_NRF54LX */
26062694
26072695 nrf_aar_event_clear (NRF_AAR , NRF_AAR_EVENT_END );
26082696 nrf_aar_event_clear (NRF_AAR , NRF_AAR_EVENT_RESOLVED );
@@ -2617,7 +2705,11 @@ void radio_ar_configure(uint32_t nirk, void *irk, uint8_t flags)
26172705
26182706uint32_t radio_ar_match_get (void )
26192707{
2708+ #if defined(CONFIG_SOC_COMPATIBLE_NRF54LX )
2709+ return aar_job .status ;
2710+ #else /* !CONFIG_SOC_COMPATIBLE_NRF54LX */
26202711 return NRF_AAR -> STATUS ;
2712+ #endif /* !CONFIG_SOC_COMPATIBLE_NRF54LX */
26212713}
26222714
26232715void radio_ar_status_reset (void )
@@ -2660,7 +2752,25 @@ uint8_t radio_ar_resolve(const uint8_t *addr)
26602752 NRF_AAR -> ENABLE = (AAR_ENABLE_ENABLE_Enabled << AAR_ENABLE_ENABLE_Pos ) &
26612753 AAR_ENABLE_ENABLE_Msk ;
26622754
2755+ #if defined(CONFIG_SOC_COMPATIBLE_NRF54LX )
2756+ /* Input, Resolvable Address Hash offset in the supplied address buffer */
2757+ aar_job .in [0 ].ptr = (void * )& addr [BDADDR_HASH_OFFSET ];
2758+
2759+ /* Input, Resolvable Address Prand offset in the supplied address buffer */
2760+ aar_job .in [1 ].ptr = (void * )& addr [BDADDR_PRND_OFFSET ];
2761+
2762+ /* Reset match index to invalid value ( >= CONFIG_BT_CTLR_RL_SIZE ) */
2763+ aar_job .status = UINT32_MAX ;
2764+
2765+ /* NOTE: Other `aar_job` structure members are initialized in `radio_ar_configure()` */
2766+
2767+ NRF_AAR -> IN .PTR = (uint32_t )& aar_job .in [0 ];
2768+ NRF_AAR -> OUT .PTR = (uint32_t )& aar_job .out [0 ];
2769+ NRF_AAR -> MAXRESOLVED = AAR_JOB_OUT_MAX_RESOLVED ;
2770+
2771+ #else /* !CONFIG_SOC_COMPATIBLE_NRF54LX */
26632772 NRF_AAR -> ADDRPTR = (uint32_t )addr - 3 ;
2773+ #endif /* !CONFIG_SOC_COMPATIBLE_NRF54LX */
26642774
26652775 nrf_aar_event_clear (NRF_AAR , NRF_AAR_EVENT_END );
26662776 nrf_aar_event_clear (NRF_AAR , NRF_AAR_EVENT_RESOLVED );
0 commit comments