|
63 | 63 | #include "common/log.h"
|
64 | 64 | #include "hal/debug.h"
|
65 | 65 |
|
66 |
| -/* When both central and peripheral are supported, one each Rx node will be |
67 |
| - * needed by connectable advertising and the initiator to generate connection |
68 |
| - * complete event, hence conditionally set the count. |
69 |
| - */ |
70 |
| -#if defined(CONFIG_BT_MAX_CONN) |
71 |
| -#if defined(CONFIG_BT_CENTRAL) && defined(CONFIG_BT_PERIPHERAL) |
72 |
| -#define BT_CTLR_MAX_CONNECTABLE 2 |
73 |
| -#else |
74 |
| -#define BT_CTLR_MAX_CONNECTABLE 1 |
75 |
| -#endif |
76 |
| -#define BT_CTLR_MAX_CONN CONFIG_BT_MAX_CONN |
77 |
| -#else |
78 |
| -#define BT_CTLR_MAX_CONNECTABLE 0 |
79 |
| -#define BT_CTLR_MAX_CONN 0 |
80 |
| -#endif |
81 |
| - |
82 |
| -#if !defined(TICKER_USER_LLL_VENDOR_OPS) |
83 |
| -#define TICKER_USER_LLL_VENDOR_OPS 0 |
84 |
| -#endif /* TICKER_USER_LLL_VENDOR_OPS */ |
85 |
| - |
86 |
| -#if !defined(TICKER_USER_ULL_HIGH_VENDOR_OPS) |
87 |
| -#define TICKER_USER_ULL_HIGH_VENDOR_OPS 0 |
88 |
| -#endif /* TICKER_USER_ULL_HIGH_VENDOR_OPS */ |
89 |
| - |
90 |
| -#if !defined(TICKER_USER_THREAD_VENDOR_OPS) |
91 |
| -#define TICKER_USER_THREAD_VENDOR_OPS 0 |
92 |
| -#endif /* TICKER_USER_THREAD_VENDOR_OPS */ |
93 |
| - |
94 |
| -/* Define ticker nodes and user operations */ |
95 |
| -#if defined(CONFIG_BT_CTLR_LOW_LAT) && \ |
96 |
| - (CONFIG_BT_CTLR_LLL_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO) |
97 |
| -#define TICKER_USER_LLL_OPS (3 + TICKER_USER_LLL_VENDOR_OPS + 1) |
98 |
| -/* NOTE: When ticker job is disabled inside radio events then all advertising, |
99 |
| - * scanning, and slave latency cancel ticker operations will be deferred, |
100 |
| - * requiring increased ticker thread context operation queue count. |
101 |
| - */ |
102 |
| -#define TICKER_USER_THREAD_OPS (BT_CTLR_ADV_SET + BT_CTLR_SCAN_SET + \ |
103 |
| - BT_CTLR_CONN_MAX + \ |
104 |
| - TICKER_USER_THREAD_VENDOR_OPS + 1) |
105 |
| -#else /* !CONFIG_BT_CTLR_LOW_LAT */ |
106 |
| -#define TICKER_USER_LLL_OPS (2 + TICKER_USER_LLL_VENDOR_OPS + 1) |
107 |
| -#define TICKER_USER_THREAD_OPS (1 + TICKER_USER_THREAD_VENDOR_OPS + 1) |
108 |
| -#endif /* !CONFIG_BT_CTLR_LOW_LAT */ |
109 |
| - |
110 |
| -#define TICKER_USER_ULL_HIGH_OPS (3 + TICKER_USER_ULL_HIGH_VENDOR_OPS + 1) |
111 |
| -#define TICKER_USER_ULL_LOW_OPS (1 + 1) |
112 |
| - |
113 | 66 | #if defined(CONFIG_BT_BROADCASTER)
|
114 | 67 | #define BT_ADV_TICKER_NODES ((TICKER_ID_ADV_LAST) - (TICKER_ID_ADV_STOP) + 1)
|
115 | 68 | #if defined(CONFIG_BT_CTLR_ADV_EXT) && (CONFIG_BT_CTLR_ADV_AUX_SET > 0)
|
|
158 | 111 | #define BT_CONN_TICKER_NODES 0
|
159 | 112 | #endif
|
160 | 113 |
|
161 |
| -#if defined(CONFIG_SOC_FLASH_NRF_RADIO_SYNC_TICKER) |
162 |
| -#define FLASH_TICKER_NODES 2 /* No. of tickers reserved for flashing */ |
163 |
| -#define FLASH_TICKER_USER_APP_OPS 1 /* No. of additional ticker operations */ |
164 |
| -#else |
165 |
| -#define FLASH_TICKER_NODES 0 |
166 |
| -#define FLASH_TICKER_USER_APP_OPS 0 |
167 |
| -#endif |
168 |
| - |
169 | 114 | #if defined(CONFIG_BT_CTLR_USER_EXT)
|
170 | 115 | #define USER_TICKER_NODES CONFIG_BT_CTLR_USER_TICKER_ID_RANGE
|
171 | 116 | #else
|
172 | 117 | #define USER_TICKER_NODES 0
|
173 | 118 | #endif
|
174 | 119 |
|
| 120 | +#if defined(CONFIG_SOC_FLASH_NRF_RADIO_SYNC_TICKER) |
| 121 | +#define FLASH_TICKER_NODES 2 /* No. of tickers reserved for flash |
| 122 | + * driver |
| 123 | + */ |
| 124 | +#define TICKER_USER_ULL_HIGH_FLASH_OPS 1 /* No. of additional ticker ULL_HIGH |
| 125 | + * context operations |
| 126 | + */ |
| 127 | +#define TICKER_USER_THREAD_FLASH_OPS 1 /* No. of additional ticker thread |
| 128 | + * context operations |
| 129 | + */ |
| 130 | +#else |
| 131 | +#define FLASH_TICKER_NODES 0 |
| 132 | +#define TICKER_USER_ULL_HIGH_FLASH_OPS 0 |
| 133 | +#define TICKER_USER_THREAD_FLASH_OPS 0 |
| 134 | +#endif |
| 135 | + |
| 136 | +/* Define ticker nodes */ |
| 137 | +/* NOTE: FLASH_TICKER_NODES shall be after Link Layer's list of ticker id |
| 138 | + * allocations, refer to ll_timeslice_ticker_id_get on how ticker id |
| 139 | + * used by flash driver is returned. |
| 140 | + */ |
175 | 141 | #define TICKER_NODES (TICKER_ID_ULL_BASE + \
|
176 | 142 | BT_ADV_TICKER_NODES + \
|
177 | 143 | BT_ADV_AUX_TICKER_NODES + \
|
|
180 | 146 | BT_SCAN_AUX_TICKER_NODES + \
|
181 | 147 | BT_SCAN_SYNC_TICKER_NODES + \
|
182 | 148 | BT_CONN_TICKER_NODES + \
|
183 |
| - FLASH_TICKER_NODES + \ |
184 |
| - USER_TICKER_NODES) |
185 |
| -#define TICKER_USER_APP_OPS (TICKER_USER_THREAD_OPS + \ |
186 |
| - FLASH_TICKER_USER_APP_OPS) |
| 149 | + USER_TICKER_NODES + \ |
| 150 | + FLASH_TICKER_NODES) |
| 151 | + |
| 152 | +/* When both central and peripheral are supported, one each Rx node will be |
| 153 | + * needed by connectable advertising and the initiator to generate connection |
| 154 | + * complete event, hence conditionally set the count. |
| 155 | + */ |
| 156 | +#if defined(CONFIG_BT_MAX_CONN) |
| 157 | +#if defined(CONFIG_BT_CENTRAL) && defined(CONFIG_BT_PERIPHERAL) |
| 158 | +#define BT_CTLR_MAX_CONNECTABLE 2 |
| 159 | +#else |
| 160 | +#define BT_CTLR_MAX_CONNECTABLE 1 |
| 161 | +#endif |
| 162 | +#define BT_CTLR_MAX_CONN CONFIG_BT_MAX_CONN |
| 163 | +#else |
| 164 | +#define BT_CTLR_MAX_CONNECTABLE 0 |
| 165 | +#define BT_CTLR_MAX_CONN 0 |
| 166 | +#endif |
| 167 | + |
| 168 | +#if !defined(TICKER_USER_LLL_VENDOR_OPS) |
| 169 | +#define TICKER_USER_LLL_VENDOR_OPS 0 |
| 170 | +#endif /* TICKER_USER_LLL_VENDOR_OPS */ |
| 171 | + |
| 172 | +#if !defined(TICKER_USER_ULL_HIGH_VENDOR_OPS) |
| 173 | +#define TICKER_USER_ULL_HIGH_VENDOR_OPS 0 |
| 174 | +#endif /* TICKER_USER_ULL_HIGH_VENDOR_OPS */ |
| 175 | + |
| 176 | +#if !defined(TICKER_USER_THREAD_VENDOR_OPS) |
| 177 | +#define TICKER_USER_THREAD_VENDOR_OPS 0 |
| 178 | +#endif /* TICKER_USER_THREAD_VENDOR_OPS */ |
| 179 | + |
| 180 | +/* Define ticker user operations */ |
| 181 | +#if defined(CONFIG_BT_CTLR_LOW_LAT) && \ |
| 182 | + (CONFIG_BT_CTLR_LLL_PRIO == CONFIG_BT_CTLR_ULL_LOW_PRIO) |
| 183 | +#define TICKER_USER_LLL_OPS (3 + TICKER_USER_LLL_VENDOR_OPS + 1) |
| 184 | +/* NOTE: When ticker job is disabled inside radio events then all advertising, |
| 185 | + * scanning, and slave latency cancel ticker operations will be deferred, |
| 186 | + * requiring increased ticker thread context operation queue count. |
| 187 | + */ |
| 188 | +#define TICKER_USER_THREAD_OPS (BT_CTLR_ADV_SET + BT_CTLR_SCAN_SET + \ |
| 189 | + BT_CTLR_MAX_CONN + \ |
| 190 | + TICKER_USER_THREAD_VENDOR_OPS + \ |
| 191 | + TICKER_USER_THREAD_FLASH_OPS + \ |
| 192 | + 1) |
| 193 | +#else /* !CONFIG_BT_CTLR_LOW_LAT */ |
| 194 | +#define TICKER_USER_LLL_OPS (2 + TICKER_USER_LLL_VENDOR_OPS + 1) |
| 195 | +/* NOTE: As ticker job is not disabled inside radio events, no need for extra |
| 196 | + * thread operations queue element for flash driver. |
| 197 | + */ |
| 198 | +#define TICKER_USER_THREAD_OPS (1 + TICKER_USER_THREAD_VENDOR_OPS + 1) |
| 199 | +#endif /* !CONFIG_BT_CTLR_LOW_LAT */ |
| 200 | + |
| 201 | +/* NOTE: When ULL_LOW priority is configured to lower than ULL_HIGH, then extra |
| 202 | + * ULL_HIGH operations queue elements are required to buffer the |
| 203 | + * requested ticker operations. |
| 204 | + */ |
| 205 | +#define TICKER_USER_ULL_HIGH_OPS (3 + TICKER_USER_ULL_HIGH_VENDOR_OPS + \ |
| 206 | + TICKER_USER_ULL_HIGH_FLASH_OPS + 1) |
| 207 | + |
| 208 | +#define TICKER_USER_ULL_LOW_OPS (1 + 1) |
| 209 | + |
187 | 210 | #define TICKER_USER_OPS (TICKER_USER_LLL_OPS + \
|
188 | 211 | TICKER_USER_ULL_HIGH_OPS + \
|
189 | 212 | TICKER_USER_ULL_LOW_OPS + \
|
190 |
| - TICKER_USER_THREAD_OPS + \ |
191 |
| - FLASH_TICKER_USER_APP_OPS) |
| 213 | + TICKER_USER_THREAD_OPS) |
192 | 214 |
|
193 | 215 | /* Memory for ticker nodes/instances */
|
194 | 216 | static uint8_t MALIGN(4) ticker_nodes[TICKER_NODES][TICKER_NODE_T_SIZE];
|
@@ -363,7 +385,7 @@ int ll_init(struct k_sem *sem_rx)
|
363 | 385 | ticker_users[MAYFLY_CALL_ID_0][0] = TICKER_USER_LLL_OPS;
|
364 | 386 | ticker_users[MAYFLY_CALL_ID_1][0] = TICKER_USER_ULL_HIGH_OPS;
|
365 | 387 | ticker_users[MAYFLY_CALL_ID_2][0] = TICKER_USER_ULL_LOW_OPS;
|
366 |
| - ticker_users[MAYFLY_CALL_ID_PROGRAM][0] = TICKER_USER_APP_OPS; |
| 388 | + ticker_users[MAYFLY_CALL_ID_PROGRAM][0] = TICKER_USER_THREAD_OPS; |
367 | 389 |
|
368 | 390 | err = ticker_init(TICKER_INSTANCE_ID_CTLR,
|
369 | 391 | TICKER_NODES, &ticker_nodes[0],
|
@@ -1282,10 +1304,10 @@ void ll_tx_ack_put(uint16_t handle, struct node_tx *node_tx)
|
1282 | 1304 | #endif /* CONFIG_BT_CONN */
|
1283 | 1305 |
|
1284 | 1306 | void ll_timeslice_ticker_id_get(uint8_t * const instance_index,
|
1285 |
| - uint8_t * const user_id) |
| 1307 | + uint8_t * const ticker_id) |
1286 | 1308 | {
|
1287 | 1309 | *instance_index = TICKER_INSTANCE_ID_CTLR;
|
1288 |
| - *user_id = (TICKER_NODES - FLASH_TICKER_NODES); |
| 1310 | + *ticker_id = (TICKER_NODES - FLASH_TICKER_NODES); |
1289 | 1311 | }
|
1290 | 1312 |
|
1291 | 1313 | void ll_radio_state_abort(void)
|
|
0 commit comments