Draft
tests: bluetooth: add native_sim unit test for lll_prepare_resolve#28
Conversation
Updated implementation of Constant Latency and to use RRAMC in Standby mode for having low latencies. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Rename hal_radio_tx/rx_ready_delay_ns_get to differentiate with ready delay inside tIFS. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Introduce BT_CTLR_TIFS_PLLEN feature. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fixing event resolution margin in cis_offset_min calculation that caused ACL to overlap CIG when the event jitters due to the coarse units of the sleep clock used by ticker. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix window widening for Periodic Advertising Sync and ISO Synchronized Receiver to correctly consider ULL skipped and LLL prepare skipped events. Relates to commit 2b49185 ("Bluetooth: Controller: Fix window widening on connection update"). Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing window widening and permitted sleep clock jitter in the ACL connection, Periodic Advertising Sync and ISO Sync Receiver time reservations. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing implementation to handle instant_latency for Central ISO setup. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
The instant_latency handling logic in the Central ISO branch largely duplicates the Peripheral ISO branch (lost_cig_events/lost_payloads/cis_offset correction/event counters). Extract this into a shared static helper cis_instant_latency_apply() to reduce the risk of future fixes being applied to one path but not the other. The Peripheral ISO branch retains its window-widening adjustment for iso_interval_us_frac after calling the shared helper, as that is peripheral-specific. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
…heck Add an assertion check to ensure the value of acl_latency_us does not overflow 32-bit when calculating the cis_offset at the instant a CIS is established. Add a debug assertion check to ensure event_expire does not overflow 16-bit when adjusting the count down value for the number of lost CIG events. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix LLL prepare at margin to correctly set the flag when preempt timeout expires while an event has been placed back as resume event. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ISO Rx Sched from directly calling k_sem_give from Zero Latency IRQ. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix single timer implementation of radio switching so that the radio_tmr_aa_get() returns an accumulated timestamp instead of an incorrect timestamp relative to previously re-started radio switch timer hardware. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Use access address timestamp for calculating aux_offset by Extended Scanning, Periodic Sync and ISO Sync Receiver. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix incorrect aux_offset used when Extended Scanning using the single timer implementation of tIFS software switching. The Radio END timestamp was not captured and hence the packet timing was not accumulated. Passive scanning on the primary channel reception for single timer implementation did not config the DPPI that was used for Timer Clear and Radio END capture. The bug was present when LLL scheduling was used for auxiliary PDU reception, where the auxiliary PDU followed closely after the primary channel PDU. Relates to commit ebc023b ("Bluetooth: Controller: Fix incorrect aux offset using single timer"). Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add a test that validates under perfect conditions (no PHY loss, 100% listening duty cycle, no overlap) all extended advertising packets can be received. Signed-off-by: Jordan Yates <jordan@embeint.com>
Add tests for the nRF54L15 using extended advertising, as this SoC uses `CONFIG_BT_CTLR_SW_SWITCH_SINGLE_TIMER` due to hardware limitations. Signed-off-by: Jordan Yates <jordan@embeint.com>
Fix extended connection create failure ending up in all future connection create to fail, needing a restart of the Controller or device. If the CONNECT_REQ PDU has been enqueued or transmitted and the radio event is aborted with `initiated` and `is_stop` flag set, then all subsequent scanning radio event is aborted early. Related commit 5071ba4 ("Bluetooth: Controller: Fix continuous scan initiator from being aborted"). Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ticker implementation for tickers with drift in window to yield when overlapping with other ticker nodes. When resolving collision do not consider unreserved tickers' ticks_slot to take the minimum ticks_slot value. Consider then to not overlap with expiring ticker. Reschedule in window between an end minimum and maximum value. Relates to commit 852b3e9 ("Bluetooth: Controller: Reschedule unreserved ticker with slot window"). Relates to commit 9df4b54 ("Bluetooth: Controller: Ext Adv Auxiliary PDUs with ticks_slot_window"). Fixes commit b838b17 ("Bluetooth: Controller: Introduce ticker reschedule with drift"). Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add explicit BT_CTLR_ADV_SLOT_WINDOW Kconfig to enable placing Advertising Primary PDUs after overlapping states/ roles at end of its slot window so that it does not take the interval of the overlapping states/roles. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add explicit BT_CTLR_SCAN_SLOT_WINDOW Kconfig to enable placing primary scan window after overlapping states/ roles at end of its slot window so that it does not take the interval of the overlapping states/roles. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix out-of-bound memory access calling ull_sched_mfy_after_cen_offset_get() when being an initiator. Fix a redundant static scope declaration. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix mfy_aux_offset_get mayfly_enqueue assert when multiple auxliary advertising sets enqueue while previous enqueue is pending to be processed or in-progress in the ULL_LOW context. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix assertion calculating auxiliary PDU offset. ASSERTION FAIL [id != ((uint8_t)((uint8_t)0 - 1))] @ WEST_TOPDIR/zephyr/subsys/bluetooth/controller/ll_sw/ ull_adv_aux.c:3290 Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Update BT_TICKER_EXT Kconfig default to y when there is broadcaster, peripheral or extended advertising is enabled. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix in-system ticker_start and ticker_stop tests when supporting BT_TICKER_EXT_EXPIRE_INFO. Fixes commit d82c1dc ("Bluetooth: Controller: In-system ticker_start and ticker_stop tests"). Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ticker ULL_HIGH and LLL operation queue count for scan auxiliary context scheduling and worst case preemption requested LLL context enqueue elements. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ticker start from failing when bottom half does not run for tickers that expire immediately, i.e. ticks_to_expire of value 0, are requested to start again. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix missing ticks_drift value reset when ticker is inserted back at its next periodic interval. Without this rescheduled expiry had the value of ticks_slot_window as the ticks_drift value. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ticker is_drift_in_window to not take the interval of the overlapping node, and also, mitigate repeated drift at every interval. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Fix ticker yield at every overlapping interval when updated to drift, instead be placed at the start of the available ticks slot window. This way new drift update can happen when the ticker get to expires. Otherwise, it would infinitely lock into yielding on every interval it is overlapping when the end of the slot window also overlaps. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Replace prepare pipeline with ordered linked list. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Updated in-system profiling for CPU usage with on target measurements and added assertion checks. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
nrf54h20 cpurad bt_ll_sw_split support. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
FICR compile error fixed ECB compile error fixed SWI compile error fixed draft modification for radio Update radio.c due to miss some device check Signed-off-by: Jui-Chou Chung <jui-chou.chung@nordicsemi.no> Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add use of NRF_ECB, NRF_CCM and NRF_AAR to have encryption and accelerated address resolution support in nRF54H20 SoC. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Added initial implementation for nrf54hx LF clock control. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Added initial implementation for nrf54hx GRTC use for Radio. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Added initial implementation for nrf54hx HF clock control. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Added initial implementation for nrf54hx MRAM no latency control. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Added implementation to mitigate nrf54hx MRAM no latency control race. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
nRF54H20 cpuapp peripheral_hr quirks. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
nRF54H20 cpuapp hci_usb quirks. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
nRF54H20 cpurad hci_ipc quirks for ISO support Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
nRF54H20 cpurad hci_usb quirks for ISO support Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
bap broadcast source/sink nRF54H20DK with USB Audio Device support. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Review rework updates. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
Add a native_sim unit test that covers all control paths of the lll_prepare_resolve() function as implemented in the Nordic lll.c (no CONFIG_BT_CTLR_LOW_LAT, no CONFIG_BT_CTLR_LOW_LAT_ULL_DONE, no CONFIG_BT_CTLR_LLL_PREPARE_AT_MARGIN configuration). The test consists of: - src/uut.c : Unit Under Test - the internal event struct, static helpers (is_done_sync, prepare_dequeue_iter_ready_get, preempt_ticker_start/stop, preempt_ticker_cb, preempt) and lll_prepare_resolve() extracted from nordic/lll/lll.c, plus test-visible state manipulation helpers. - src/uut.h : Test-visible interface to uut.c. - src/main.c : FFF-based fakes for all external symbols (ull_prepare_enqueue, ull_prepare_dequeue_iter, ticker_start, ticker_stop, ticker_ticks_diff_get, mayfly_enqueue) and 12 ZTEST test cases covering every branch. Control paths exercised: execute path - no active event, empty pipeline (prepare_cb invoked) execute path - is_dequeue=1 bypasses is_done_sync check execute path - ready event has non-earlier ticks (not short) execute path - ready event has zero diff (not short) execute path - after prepare_cb a next event triggers preempt ticker execute path - ready event same prepare_param pointer → not short enqueue path - event.curr.abort_cb != NULL (active event) enqueue path - earlier ready event in pipeline (ready_short) enqueue path - is_resume=1 with ready event → no preempt ticker enqueue path - defer=1 → enqueue without preempt ticker enqueue path - is_resume=1 with active event → no ticker enqueue path - active event + is_dequeue=1 → still enqueues All 12 tests pass on native_sim. Agent-Logs-Url: https://github.com/cvinayak/zephyr/sessions/8069d1c0-3cf0-4854-8390-a0731f6393c4 Co-authored-by: cvinayak <6350656+cvinayak@users.noreply.github.com>
- Reset g_dequeue_iter_call_count in before_each() to ensure proper state isolation between test cases - Remove dead variable 'same_evt_ptr' from test_execute_ready_same_event - Remove dead variables 'call_count' and 'evt' from test_execute_with_next_in_pipeline - Remove dead variable 'local_call_cnt' from test_execute_ready_same_event - Move g_dequeue_iter_call_count declaration to file scope before before_each Agent-Logs-Url: https://github.com/cvinayak/zephyr/sessions/8069d1c0-3cf0-4854-8390-a0731f6393c4 Co-authored-by: cvinayak <6350656+cvinayak@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
cvinayak
May 3, 2026 05:43
View session
d5d7c48 to
7241d7e
Compare
7241d7e to
809af1b
Compare
809af1b to
09e74ef
Compare
09e74ef to
908ab0e
Compare
5f1da2e to
562f336
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a
native_simunit test that covers all control paths oflll_prepare_resolve()as implemented insubsys/bluetooth/controller/ll_sw/nordic/lll/lll.c.The test targets the default (most common) build configuration:
!CONFIG_BT_CTLR_LOW_LAT,!CONFIG_BT_CTLR_LOW_LAT_ULL_DONE,!CONFIG_BT_CTLR_LLL_PREPARE_AT_MARGIN.Files
testcase.yamlnative_simplatformprj.confCONFIG_ZTEST=y)CMakeLists.txtsrc/uut.hevent.curraccessorssrc/uut.ceventstruct, static helpers (is_done_sync,prepare_dequeue_iter_ready_get,preempt_ticker_start/stop,preempt_ticker_cb,preempt) andlll_prepare_resolve()extracted fromlll.c, plus test helperssrc/main.cControl paths exercised (12 tests)
Execute path (prepare_cb is called):
is_dequeue=1, no active eventticks_at_expire(MSbit set → not short)prepare_cb, a next event triggers preempt tickerprepare_parampointer (not short)Enqueue path (
-EINPROGRESSreturned):7.
event.curr.abort_cb != NULL(active event) → enqueue + preempt ticker8. Earlier ready event in pipeline (
ready_short != NULL) → enqueue + ticker9.
is_resume=1with ready event → enqueue, no preempt ticker10.
defer=1→ enqueue, no preempt ticker11.
is_resume=1with active event → enqueue, no preempt ticker12. Active event +
is_dequeue=1→ still enqueuesTesting
All 12 tests pass on
native_sim:External dependencies mocked with FFF
ull_prepare_enqueue— returns a non-NULLlll_event *ull_prepare_dequeue_iter— sequenced to simulate pipeline statesull_prepare_dequeue— stubbed (called via mayfly in preempt path)ticker_start/ticker_stop— stubbed returningTICKER_STATUS_SUCCESSticker_ticks_diff_get— return value controlled per testmayfly_enqueue— stubbed