Skip to content

Commit

Permalink
Bluetooth: Controller: Fix building ticker without remainder support
Browse files Browse the repository at this point in the history
A few things were not flagged by CONFIG_BT_TICKER_REMAINDER_SUPPORT
that should have been; This caused building without it to fail

Signed-off-by: Troels Nilsson <[email protected]>
  • Loading branch information
Tronil committed Feb 26, 2025
1 parent 9cc8301 commit 048edf9
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions subsys/bluetooth/controller/ticker/ticker.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ struct ticker_node {

struct ticker_expire_info_internal {
uint32_t ticks_to_expire;
#if defined(CONFIG_BT_TICKER_REMAINDER_SUPPORT)
uint32_t remainder;
#endif /* CONFIG_BT_TICKER_REMAINDER_SUPPORT */
uint16_t lazy;
uint8_t ticker_id;
uint8_t outdated:1;
Expand Down Expand Up @@ -361,8 +363,9 @@ static struct ticker_instance _instance[TICKER_INSTANCE_MAX];
/*****************************************************************************
* Static Functions
****************************************************************************/

#if defined(CONFIG_BT_TICKER_REMAINDER_SUPPORT)
static inline uint8_t ticker_add_to_remainder(uint32_t *remainder, uint32_t to_add);
#endif /* CONFIG_BT_TICKER_REMAINDER_SUPPORT */

/**
* @brief Update elapsed index
Expand Down Expand Up @@ -1101,7 +1104,9 @@ static void ticker_get_expire_info(struct ticker_instance *instance, uint8_t to_
}

expire_info->ticks_to_expire = to_ticks - from_ticks;
#if defined(CONFIG_BT_TICKER_REMAINDER_SUPPORT)
expire_info->remainder = to_remainder;
#endif /* CONFIG_BT_TICKER_REMAINDER_SUPPORT */
expire_info->lazy = to_ticker->lazy_current;
expire_info->found = 1;
} else {
Expand Down Expand Up @@ -1576,6 +1581,7 @@ static void ticks_to_expire_prep(struct ticker_node *ticker,
ticker->ticks_to_expire_minus = ticks_to_expire_minus;
}

#if defined(CONFIG_BT_TICKER_REMAINDER_SUPPORT)
/**
* @brief Add to remainder
*
Expand Down Expand Up @@ -1605,7 +1611,6 @@ static inline uint8_t ticker_add_to_remainder(uint32_t *remainder, uint32_t to_a
return 0;
}

#if defined(CONFIG_BT_TICKER_REMAINDER_SUPPORT)
/**
* @brief Increment remainder
*
Expand Down Expand Up @@ -2245,7 +2250,9 @@ static inline void ticker_job_worker_bh(struct ticker_instance *instance,
count = 1 + ticker->lazy_periodic;
while (count--) {
ticks_to_expire += ticker->ticks_periodic;
#if defined(CONFIG_BT_TICKER_REMAINDER_SUPPORT)
ticks_to_expire += ticker_remainder_inc(ticker);
#endif /* CONFIG_BT_TICKER_REMAINDER_SUPPORT */
}

/* Skip intervals that have elapsed w.r.t. current
Expand All @@ -2256,7 +2263,9 @@ static inline void ticker_job_worker_bh(struct ticker_instance *instance,
/* Schedule to a tick in the future */
while (ticks_to_expire < ticks_latency) {
ticks_to_expire += ticker->ticks_periodic;
#if defined(CONFIG_BT_TICKER_REMAINDER_SUPPORT)
ticks_to_expire += ticker_remainder_inc(ticker);
#endif /* CONFIG_BT_TICKER_REMAINDER_SUPPORT */
lazy++;
}

Expand Down Expand Up @@ -2792,8 +2801,10 @@ static inline uint8_t ticker_job_insert(struct ticker_instance *instance,

/* occupied, try next interval */
if (ticker->ticks_periodic != 0U) {
ticker->ticks_to_expire += ticker->ticks_periodic +
ticker_remainder_inc(ticker);
ticker->ticks_to_expire += ticker->ticks_periodic;
#if defined(CONFIG_BT_TICKER_REMAINDER_SUPPORT)
ticker->ticks_to_expire += ticker_remainder_inc(ticker);
#endif /* CONFIG_BT_TICKER_REMAINDER_SUPPORT */
ticker->lazy_current++;

/* No. of times ticker has skipped its interval */
Expand Down

0 comments on commit 048edf9

Please sign in to comment.