1 /*
2  * Copyright (c) 2020, Nordic Semiconductor ASA
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright notice, this
11  *    list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
18  *    contributors may be used to endorse or promote products derived from this
19  *    software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  */
34 
35 #ifndef NRF_802154_SL_RSCH_H__
36 #define NRF_802154_SL_RSCH_H__
37 
38 #include <stdbool.h>
39 #include <stddef.h>
40 #include <stdint.h>
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /**
47  * @defgroup nrf_802154_sl_rsch Resource Scheduler Service
48  * @{
49  * @ingroup nrf_802154_sl_rsch
50  * @brief The Resource Scheduler Service for the 802.15.4 Service Layer
51  */
52 
53 #define NRF_802154_SL_RSCH_TS_PRIORITY_LOWEST 0U   /**< Lowest possible priority of a timeslot. */
54 #define NRF_802154_SL_RSCH_SESSION_PRIV_SIZE  1U   /**< Number of words needed for private fields of a session. */
55 #define NRF_802154_SL_RSCH_DEFAULT_MARGIN_US  100U /**< Default margin in microseconds. Refer to @ref nrf_802154_sl_rsch_ts_param_t. */
56 
57 /** @brief Scheduler's return codes.
58  *
59  * Possible values:
60  * @ref NRF_802154_SL_RSCH_RET_SUCCESS
61  * @ref NRF_802154_SL_RSCH_RET_ALREADY_REQUESTED
62  * @ref NRF_802154_SL_RSCH_RET_INVALID_PARAM
63  * @ref NRF_802154_SL_RSCH_RET_HIGHER_PRIO
64  * @ref NRF_802154_SL_RSCH_RET_RSRC_DENIED
65  * @ref NRF_802154_SL_RSCH_RET_TIMESLOT_INACTIVE
66  * @ref NRF_802154_SL_RSCH_RET_DURATION_TIMEOUT
67  * @ref NRF_802154_SL_RSCH_RET_NO_MEMORY
68 
69  */
70 typedef uint32_t nrf_802154_sl_rsch_ret_t;
71 
72 #define NRF_802154_SL_RSCH_RET_SUCCESS           0U /**< Operation finished successfully. */
73 #define NRF_802154_SL_RSCH_RET_ALREADY_REQUESTED 1U /**< Operation failed because there is an already requested timeslot. */
74 #define NRF_802154_SL_RSCH_RET_INVALID_PARAM     2U /**< Operation failed because the provided parameters are invalid. */
75 #define NRF_802154_SL_RSCH_RET_HIGHER_PRIO       3U /**< Operation failed because of a higher priority request that overlaps in time. */
76 #define NRF_802154_SL_RSCH_RET_RSRC_DENIED       4U /**< Operation failed because of a denied resource. */
77 #define NRF_802154_SL_RSCH_RET_TIMESLOT_INACTIVE 5U /**< Operation failed because the timeslot's state does not allow it. */
78 #define NRF_802154_SL_RSCH_RET_DURATION_TIMEOUT  6U /**< Operation finished because its requested duration expired. */
79 #define NRF_802154_SL_RSCH_RET_NO_MEMORY         7U /**< Operation failed because there was no memory to complete it. */
80 
81 /** @brief Flags indicating resources that can be accessed in a timeslot.
82  *
83  * This type is a mask of bits that represent access to different resources that may be necessary
84  * for successful operation inside a timeslot.
85  *
86  * Possible masks:
87  * @ref NRF_802154_SL_RSCH_RSRC_NONE
88  * @ref NRF_802154_SL_RSCH_RSRC_RADIO
89  * @ref NRF_802154_SL_RSCH_RSRC_RF
90  */
91 typedef uint32_t nrf_802154_sl_rsch_resource_t;
92 
93 #define NRF_802154_SL_RSCH_RSRC_NONE  0U       /**< Indicates that no resources are required. */
94 #define NRF_802154_SL_RSCH_RSRC_RADIO (1 << 0) /**< Indicates that exclusive access to RADIO peripheral is required. */
95 #define NRF_802154_SL_RSCH_RSRC_RF    (1 << 1) /**< Indicates that exclusive access to radio wave medium is required. */
96 
97 /** @brief Types 802.15.4 operations.
98  *
99  * Possible values:
100  * @ref NRF_802154_SL_RSCH_OP_NONE
101  * @ref NRF_802154_SL_RSCH_OP_LISTEN
102  * @ref NRF_802154_SL_RSCH_OP_RX
103  * @ref NRF_802154_SL_RSCH_OP_TX
104  */
105 typedef uint32_t nrf_802154_sl_rsch_operation_t;
106 
107 #define NRF_802154_SL_RSCH_OP_NONE   0U /**< Non-802.15.4 related operation. */
108 #define NRF_802154_SL_RSCH_OP_LISTEN 1U /**< 802.15.4 idle listening. */
109 #define NRF_802154_SL_RSCH_OP_RX     2U /**< 802.15.4 active reception. */
110 #define NRF_802154_SL_RSCH_OP_TX     3U /**< 802.15.4 transmission. */
111 
112 /** @brief Structure that represents private fields of a session required by the implementation. */
113 typedef struct
114 {
115     uint32_t placeholder[NRF_802154_SL_RSCH_SESSION_PRIV_SIZE];
116 } nrf_802154_sl_rsch_session_priv_placeholder_t;
117 
118 /** @brief Structure that represents the parameters of a session. */
119 typedef struct
120 {
121     nrf_802154_sl_rsch_session_priv_placeholder_t priv;
122 } nrf_802154_sl_rsch_session_t;
123 
124 /** @brief Structure that holds metadata passed in @ref nrf_802154_sl_rsch_ts_start_callback_t.
125  */
126 typedef struct
127 {
128     /** @brief Identifier of the started timeslot. */
129     uint32_t                       ts_id;
130 
131     /** @brief Time in microseconds that the started timeslot is expected to last. */
132     uint32_t                       duration_us;
133 
134     /** @brief Pointer to session that the started timeslot belongs to. */
135     nrf_802154_sl_rsch_session_t * p_session;
136 
137 } nrf_802154_sl_rsch_ts_start_callback_metadata_t;
138 
139 /** @brief Structure that holds metadata passed in @ref nrf_802154_sl_rsch_ts_end_callback_t.
140  */
141 typedef struct
142 {
143     /** @brief Identifier of the ending timeslot. */
144     uint32_t                 ts_id;
145 
146     /** @brief Return code that informs about the reason of timeslot end. */
147     nrf_802154_sl_rsch_ret_t ret;
148 
149     /** @brief Pointer to resources that are to be handed over and do not require deconfiguration.
150      *
151      * When a timeslot is about to end, it's possible that there are other timeslots scheduled to
152      * occur immediately after it such that their required resources overlap with the resources
153      * requested by the ending timeslot. In order to avoid unnecessary deconfiguration
154      * and reconfiguration of resources that are continuously granted and required by consecutive
155      * timeslots, the scheduler fills this field with resources that need not be deconfigured
156      * upon the timeslot end so that they can be handed over to the following session. All remaining
157      * resources requested by the session must be deconfigured completely before
158      * @ref nrf_802154_sl_rsch_ts_release is called.
159      *
160      * @note If this field is set to NULL, all resources requested upon request must be deconfigured
161      * completely before @ref nrf_802154_sl_rsch_ts_release is called.
162      */
163     nrf_802154_sl_rsch_resource_t * p_rsrc;
164 
165     /** @brief Pointer to session the ending timeslot belongs to. */
166     nrf_802154_sl_rsch_session_t  * p_session;
167 
168 } nrf_802154_sl_rsch_ts_end_callback_metadata_t;
169 
170 /** @brief Structure that holds metadata passed in @ref nrf_802154_sl_rsch_ts_cancelled_callback_t. */
171 typedef struct
172 {
173     /** @brief Identifier of the cancelled timeslot. */
174     uint32_t                       ts_id;
175 
176     /** @brief Return code that informs about the reason of timeslot cancellation. */
177     nrf_802154_sl_rsch_ret_t       ret;
178 
179     /** @brief Pointer to session the cancelled timeslot belongs to. */
180     nrf_802154_sl_rsch_session_t * p_session;
181 
182 } nrf_802154_sl_rsch_ts_cancelled_callback_metadata_t;
183 
184 /** @brief Structure that holds metadata passed in @ref nrf_802154_sl_rsch_ts_cleanup_callback_t. */
185 typedef struct
186 {
187     /** @brief Identifier of the timeslot that should be cleaned up. */
188     uint32_t                        ts_id;
189 
190     /** @brief Pointer to resources that ought to be deconfigured. */
191     nrf_802154_sl_rsch_resource_t * p_rsrc;
192 
193     /** @brief Pointer to session the timeslot belongs to. */
194     nrf_802154_sl_rsch_session_t  * p_session;
195 
196 } nrf_802154_sl_rsch_ts_cleanup_callback_metadata_t;
197 
198 /** @brief Function called by the scheduler to indicate that a requested timeslot has started.
199  *
200  * After this function is called, the session has exclusive access to the resources specified
201  * upon request.
202  *
203  * @param[in]  p_context   Pointer to data provided by the user.
204  * @param[in]  p_metadata  Pointer to data containing information regarding the started timeslot.
205  */
206 typedef void (* nrf_802154_sl_rsch_ts_start_callback_t)(
207     void * p_context, nrf_802154_sl_rsch_ts_start_callback_metadata_t * p_metadata);
208 
209 /** @brief Function called by the scheduler to indicate that a requested and successfully started
210  *         timeslot is about to end.
211  *
212  * The scheduler issues this call to occur when only a period of time specified upon timeslot
213  * request is left until the expected end of the timeslot. The call can be a result of a number
214  * of events, e.g. a preemption performed by a higher priority request, required resource denied
215  * by an external arbiter or timeout of the specified duration of the timeslot. After this function
216  * is called, the session is responsible for releasing exclusive access to the requested resources
217  * by calling @ref nrf_802154_sl_rsch_ts_release. Failing to do so in the specified time margin
218  * might result in blocking other 802.15.4 operations as well as other radio protocols.
219  *
220  * @param[in]  p_context   Pointer to data provided by the user.
221  * @param[in]  p_metadata  Pointer to data containing information regarding the ending timeslot.
222  */
223 typedef void (* nrf_802154_sl_rsch_ts_end_callback_t)(
224     void * p_context, nrf_802154_sl_rsch_ts_end_callback_metadata_t * p_metadata);
225 
226 /** @brief Function called by the scheduler to indicate that a requested and not yet started
227  *         timeslot was cancelled by the scheduler.
228  *
229  * This function is called when a successful request from the past is cancelled by the scheduler
230  * before the requested timeslot is started. The call can be a result of a higher priority timeslot
231  * requested for the same period of time or a required resource certain to be unavailable
232  * at the specified period of time.
233  *
234  * @param[in]  p_context   Pointer to data provided by the user.
235  * @param[in]  p_metadata  Pointer to data containing information regarding the cancelled timeslot.
236  */
237 typedef void (* nrf_802154_sl_rsch_ts_cancelled_callback_t)(
238     void * p_context, nrf_802154_sl_rsch_ts_cancelled_callback_metadata_t * p_metadata);
239 
240 /** @brief Function called by the scheduler to indicate that a requested and not yet started
241  *         timeslot requires deconfiguration of resources that were handed over to it.
242  *
243  * It might happen that a timeslot had had its resources handed over, but they became unavailable
244  * before the timeslot could start. Although the timeslot never starts, it must deconfigure
245  * the resources that were handed over to it and that were denied by the scheduler. Therefore
246  * the session gains exclusive access to the resources it requested, but only to deconfigure
247  * those of them that are not granted anymore. After this function is called, the session
248  * is responsible for releasing exclusive access to the requested resources by calling
249  * @ref nrf_802154_sl_rsch_ts_release. Failing to do so in the specified time margin might result
250  * in blocking other 802.15.4 operations as well as other radio protocols.
251  */
252 typedef void (* nrf_802154_sl_rsch_ts_cleanup_callback_t)(
253     void * p_context, nrf_802154_sl_rsch_ts_cleanup_callback_metadata_t * p_metadata);
254 
255 /** @brief Structure that represents the parameters of a timeslot. */
256 typedef struct
257 {
258     /** @brief Resources necessary for the operations inside the timeslot to be successful.
259      */
260     nrf_802154_sl_rsch_resource_t rsrc;
261 
262     /** @brief Type of the operation to be performed inside the timeslot.
263      */
264     nrf_802154_sl_rsch_operation_t op;
265 
266     /** @brief Function called by the scheduler to indicate that timeslot has started.
267      */
268     nrf_802154_sl_rsch_ts_start_callback_t start;
269 
270     /** @brief Function called by the scheduler to indicate that timeslot is about to end.
271      */
272     nrf_802154_sl_rsch_ts_end_callback_t end;
273 
274     /** @brief Function called by the scheduler to indicate that timeslot was cancelled.
275      */
276     nrf_802154_sl_rsch_ts_cancelled_callback_t cancelled;
277 
278     /** @brief Pointer to data provided by the caller that is unmodified by the scheduler
279      *         and passed back to the caller in callbacks.
280      */
281     void * p_context;
282 
283     /** @brief Flag that indicates if timeslot should be started immediately.
284      */
285     bool immediate;
286 
287     /** @brief Absolute time in microseconds that the timeslot should start in.
288      *
289      * @note This field is used only if @p immediate is false.
290      */
291     uint32_t target_time;
292 
293     /** @brief Requested time in microseconds that the timeslot is expected to last.
294      *
295      * If the timeslot's priority is set to the lowest priority possible, setting this field
296      * to 0 makes the timeslot last for an indefinite period of time. Such timeslot finished
297      * with a @ref nrf_802154_sl_rsch_ts_release call or when its end callback is called.
298      *
299      * @note If this field is set to 0 when the timeslot's priority is not the lowest possible,
300      * @ref nrf_802154_sl_rsch_ts_request returns @ref NRF_802154_SL_RSCH_RET_INVALID_PARAM
301      * and the timeslot is not scheduled.
302      */
303     uint32_t duration_us;
304 
305     /** @brief Minimum time in microseconds that the timeslot can last to serve its purpose.
306      *
307      * If the caller wishes to allocate timeslot shorter than defined by @p duration_us
308      * that can be started earlier, this field should be set to a value indicating minimum
309      * duration of the timeslot that can be utilized by the caller. If the caller cannot
310      * utilize shorter timeslots than requested, this field shall be set to 0.
311      */
312     uint32_t min_duration_us;
313 
314     /** @brief Minimum time in microseconds that a session needs to clean up after their timeslot.
315      *
316      * When a timeslot is about to be finished, @p end callback is issued to the session that
317      * requested it. This parameter specifies the minimum time that the session might need to
318      * perform all actions that need to be done before releasing the timeslot with
319      * @ref nrf_802154_sl_rsch_ts_release.
320      */
321     uint32_t margin_us;
322 
323     /** @brief Priority of the timeslot.
324      *
325      * The lowest possible priority of a timeslot is equal @ref NRF_802154_SL_RSCH_TS_PRIORITY_LOWEST.
326      * Any number larger than that value indicates a higher priority.
327      */
328     uint8_t priority;
329 
330 } nrf_802154_sl_rsch_ts_param_t;
331 
332 /** @brief Structure that represents timeslot parameters that can be updated. */
333 typedef struct
334 {
335     /** @brief Resources necessary for the operations inside the timeslot to be successful.
336      */
337     nrf_802154_sl_rsch_resource_t rsrc;
338 
339     /** @brief Type of the operation to be performed inside the timeslot.
340      */
341     nrf_802154_sl_rsch_operation_t op;
342 
343     /** @brief Requested time in microseconds that the timeslot is expected to last.
344      */
345     uint32_t duration_us;
346 
347     /** @brief Priority of the timeslot.
348      *
349      * The lowest possible priority of a timeslot is equal @ref NRF_802154_SL_RSCH_TS_PRIORITY_LOWEST.
350      * Any number larger than that value indicates a higher priority.
351      */
352     uint8_t priority;
353 
354 } nrf_802154_sl_rsch_ts_update_param_t;
355 
356 /** @brief Initializes the scheduler.
357  *
358  * @note This function must be called once, before any other function from this module.
359  *
360  * @note No timeslots are requested after initialization. In order to start radio activity,
361  *       @ref nrf_802154_sl_rsch_ts_request should be called.
362  */
363 void nrf_802154_sl_rsch_init(void);
364 
365 /** @brief Deinitializes the scheduler. */
366 void nrf_802154_sl_rsch_deinit(void);
367 
368 /** @brief Initializes a session.
369  *
370  * @param[out]  p_session   Pointer to a session structure.
371  *
372  * @retval  NRF_802154_SL_RSCH_RET_SUCCESS           Session was initialized successfully.
373  * @retval  NRF_802154_SL_RSCH_RET_ALREADY_REQUESTED Initialization failed. Session was initialized already.
374  * @retval  NRF_802154_SL_RSCH_NO_MEMORY             Initialization failed. The amount of available memory
375  *                                                   is insufficient.
376  */
377 nrf_802154_sl_rsch_ret_t nrf_802154_sl_rsch_session_init(nrf_802154_sl_rsch_session_t * p_session);
378 
379 /** @brief Requests a timeslot.
380  *
381  * @note There can only be a single scheduled timeslot in a given session.
382  *
383  * When a timeslot is requested successfully and this function returns
384  * @ref NRF_802154_SL_RSCH_RET_SUCCESS, the scheduler assigns it a unique (within the provided
385  * session) identifier passed to the caller through @p p_ts_id. This identifier must be used
386  * in order to update parameters of a timeslot with @ref nrf_802154_sl_rsch_ts_param_update
387  * or release it by calling @ref nrf_802154_sl_rsch_ts_release. The identifier is also passed
388  * as a parameter of all callbacks registered by the caller upon request.
389  *
390  * @param[inout] p_session   Pointer to the session that the timeslot belongs to.
391  * @param[in]    p_param     Pointer to structure that holds parameters defining the timeslot.
392  * @param[out]   p_ts_id     Pointer to the timeslot's identifier within a session.
393  *
394  * @retval  NRF_802154_SL_RSCH_RET_SUCCESS            Timeslot was requested successfully.
395  * @retval  NRF_802154_SL_RSCH_RET_ALREADY_REQUESTED  The specified session already has a timeslot
396  *                                                    request pending.
397  * @retval  NRF_802154_SL_RSCH_RET_INVALID_PARAM      The provided parameters are invalid.
398  * @retval  NRF_802154_SL_RSCH_RET_HIGHER_PRIO        There's a higher priority timeslot scheduled
399  *                                                    for an overlapping period of time.
400  */
401 nrf_802154_sl_rsch_ret_t nrf_802154_sl_rsch_ts_request(
402     nrf_802154_sl_rsch_session_t        * p_session,
403     const nrf_802154_sl_rsch_ts_param_t * p_param,
404     uint32_t                            * p_ts_id);
405 
406 /** @brief Releases a timeslot.
407  *
408  * Calling this function on behalf of a successfully requested but not yet started timeslot
409  * cancels that request. After calling this function the timeslot is not scheduled and is not
410  * going to start.
411  *
412  * Calling this function on behalf of an active (successfully requested and started) or ending
413  * (i.e. after end callback was issued) timeslot ends that timeslot. Its resources are released
414  * and can be used immediately by other sessions.
415  *
416  * @note The caller of this API is assumed to act cooperatively. Failing to release a timeslot
417  * in the specified time margin after receiving its end callback might lead to blocking other
418  * 802.15.4 operations as well as other radio protocols.
419  *
420  * @param[inout] p_session  Pointer to the session that the timeslot belongs to.
421  * @param[in]    ts_id      Identifier of the timeslot to be released.
422  *
423  * @retval  NRF_802154_SL_RSCH_RET_SUCCESS            The timeslot was released successfully.
424  * @retval  NRF_802154_SL_RSCH_RET_TIMESLOT_INACTIVE  The timeslot could not be released because
425  *                                                    it has already been released or it was not
426  *                                                    requested at all.
427  */
428 nrf_802154_sl_rsch_ret_t nrf_802154_sl_rsch_ts_release(nrf_802154_sl_rsch_session_t * p_session,
429                                                        uint32_t                       ts_id);
430 
431 /** @brief Updates parameters of an active timeslot.
432  *
433  * This function can be called only to modify parameters of a currently active timeslot,
434  * i.e. a timeslot that started and was not yet released. Only a limited subset of all timeslot
435  * parameters can be modified when it is already active: its required resources, operation to be
436  * performed inside of it, its duration and priority.
437  *
438  * If there is another active timeslot running in parallel, which is using a separate subset
439  * of resources, and the resources passed in this function overlap with that separate subset,
440  * the scheduler chooses timeslots based on priority. If the updated priority is higher than
441  * the already running parallel timeslot, that timeslot is preempted with an end callback and its
442  * resources can be granted to the higher priority updated timeslot. If the priorities are equal,
443  * the already running timeslot is preferred and the update fails. If the updated priority is
444  * lower than the already running timeslot, the update fails.
445  *
446  * @note The caller of this API is assumed to act cooperatively. Repeatably extending timeslot's
447  * duration and increasing its priority might lead to blocking other 802.15.4 operations as well as
448  * other radio protocols.
449  *
450  * @note If the update is successful, the scheduler notifies the caller about the required resources
451  * being granted with a start callback.
452  *
453  * @note If the update fails, the original timeslot is not ended and its parameters still hold.
454  *
455  * @note If the update is not carried out before the timeslot ends, the session receives
456  * an end callback and it shall release the timeslot immediately.
457  *
458  * @note Irrespectively of whether the update is successful, the timeslot's identifier is not modified.
459  *
460  * @param[in]  p_session    Pointer to the session that the timeslot belongs to.
461  * @param[in]  p_param      Pointer to structure that holds timeslot parameters that can be updated.
462  * @param[in]  ts_id        Identifier of the timeslot to be updated.
463  *
464  * @retval  NRF_802154_SL_RSCH_RET_SUCCESS            Timeslot's parameters were updated successfully.
465  * @retval  NRF_802154_SL_RSCH_RET_HIGHER_PRIO        The update failed because the updated priority
466  *                                                    was not high enough to perform it.
467  * @retval  NRF_802154_SL_RSCH_RET_TIMESLOT_INACTIVE  The update failed because the timeslot is inactive.
468  */
469 nrf_802154_sl_rsch_ret_t nrf_802154_sl_rsch_ts_param_update(
470     const nrf_802154_sl_rsch_session_t         * p_session,
471     const nrf_802154_sl_rsch_ts_update_param_t * p_update_param);
472 
473 /** @brief Initializes timeslot request parameters to default values.
474  *
475  * @param[out] p_param  Pointer to structure that holds timeslot parameters to be set to default.
476  */
nrf_802154_sl_rsch_ts_param_init(nrf_802154_sl_rsch_ts_param_t * p_param)477 static inline void nrf_802154_sl_rsch_ts_param_init(nrf_802154_sl_rsch_ts_param_t * p_param)
478 {
479     p_param->rsrc            = NRF_802154_SL_RSCH_RSRC_NONE;
480     p_param->op              = NRF_802154_SL_RSCH_OP_NONE;
481     p_param->start           = NULL;
482     p_param->end             = NULL;
483     p_param->cancelled       = NULL;
484     p_param->p_context       = NULL;
485     p_param->immediate       = true;
486     p_param->target_time     = 0;
487     p_param->duration_us     = 0;
488     p_param->min_duration_us = 0;
489     p_param->margin_us       = NRF_802154_SL_RSCH_DEFAULT_MARGIN_US;
490     p_param->priority        = NRF_802154_SL_RSCH_TS_PRIORITY_LOWEST + 1;
491 }
492 
493 /**
494  *@}
495  **/
496 
497 #ifdef __cplusplus
498 }
499 #endif
500 
501 #endif // NRF_802154_SL_RSCH_H__
502