1 /*
2  * Copyright (c) 2018-2019 Nordic Semiconductor ASA
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #define EVENT_OVERHEAD_XTAL_US        1500
8 #define EVENT_OVERHEAD_PREEMPT_US     0    /* if <= min, then dynamic preempt */
9 #define EVENT_OVERHEAD_PREEMPT_MIN_US 150
10 #define EVENT_OVERHEAD_PREEMPT_MAX_US EVENT_OVERHEAD_XTAL_US
11 #define EVENT_OVERHEAD_START_US       300
12 /* Worst-case time margin needed after event end-time in the air
13  * (done/preempt race margin + power-down/chain delay)
14  */
15 #define EVENT_OVERHEAD_END_US         40
16 #define EVENT_JITTER_US               16
17 /* Ticker resolution margin
18  * Needed due to the lack of fine timing resolution in ticker_start
19  * and ticker_update. Set to 32 us, which is ~1 tick with 32768 Hz
20  * clock.
21  */
22 #define EVENT_TICKER_RES_MARGIN_US    32
23 
24 #define EVENT_RX_JITTER_US(phy) 16    /* Radio Rx timing uncertainty */
25 #define EVENT_RX_TO_US(phy) ((((((phy)&0x03) + 4)<<3)/BIT((((phy)&0x3)>>1))) + \
26 				  EVENT_RX_JITTER_US(phy))
27 
28 /* TODO - fix up numbers re. HW */
29 #define EVENT_RX_TX_TURNAROUND(phy)  ((phy) == 1?100:((phy) == 2 ? 80:900))
30