Files
esp-idf/components/bt
Zhou Xiao 06478ec313 feat(ble_log): make TS sync unconditional with toggle-IO-only Kconfig
TS sync now always runs: the periodic tick (TS sample, OPEN transport
flush, internal snapshot) exists in every build, so the unified periodic
output no longer depends on BLE_LOG_TS_ENABLED and idle systems without
dispatch activity still flush every second.

- New BLE_LOG_TS_SYNC_TOGGLE_IO_ENABLED gates only the analyzer toggle
  IO (GPIO config, level writes, reset); with it unset, TS snapshots
  still sample the clocks and carry io_level = 0. BLE_LOG_TS_ENABLED
  keeps its prompt as a deprecated compatibility entry that selects
  BLE_LOG_TS_SYNC_TOGGLE_IO_ENABLED, so existing projects keep the old
  toggle behavior, and the TS trigger entries drop their dependency on
  it.
- ble_log_ts is no longer a separate module: its 95-line shell (clock
  sampling, toggle IO management) joins ble_log_rt.c, the only runtime
  that drives it. ble_log_ts_info_t moves to ble_log_lbm_v2.h (the
  snapshot interface that consumes it), the BLE_LOG_GET_LC_TS chip
  table moves next to its single caller, the init/deinit folds into
  ble_log_rt_init/deinit, the reset folds into ble_log_sync_enable, and
  the sampler becomes a void static now that its failure paths are gone.
- The runtime hook is gone: with the tick always present, its throttled
  defer-callback fallback for runtime-disabled sync served no one. The
  TS tick is the only periodic output source; ble_log_sync_enable(false)
  now means full periodic silence, and ble_log_rt_dispatch loses its
  return value. The version-info regression now arms the tick instead
  of the hook.
- BLE_LOG_GET_LC_TS branches on CONFIG_BT_DUAL_MODE_ARCH: the
  dual-mode-arch controllers (ESP32-H4, ESP32-S31) expose their link
  layer timer as r_sched_timer_getCurrentTimeU32, but the symbol is
  obfuscated in the current prebuilt libraries, so those targets report
  lc_ts = 0 for now; call the accessor once the libraries export it.
  The Gen 2 branch keeps r_ble_lll_timer_current_tick_get (defined by
  every C5/C6/C61/H2/H21 library, verified by nm and by linking
  ble_log_test for ESP32-C6); ESP32-H4 and ESP32-S31 fall out of it.
- ble_log_ts_info_update's old shape is gone entirely: the heap-allocated
  global ts_info and its critical section memcpy were leftovers from the
  pointer-return API; the sampler writes the caller object in place and
  keeps only the toggle IO phase as cross-call state. int_src_code is
  filled outside the critical section; the phase toggle stays inside to
  exclude the write in ble_log_sync_enable.

Idle systems no longer touch the controller clock: the legacy
accessors dereference controller state and INIT precedes controller
initialization, so the sampler returns lc_ts = 0 while the controller
is idle instead of reading it. The deferred dispatch callback drains
only the queue depth observed at entry and re-arms itself for arrivals
left behind, so it cannot monopolize the shared ESP timer task.
2026-09-10 15:39:56 +08:00
..