1 /*
2  * Copyright (c) 2017 Oticon A/S
3  * Copyright (c) 2023 Nordic Semiconductor ASA
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  *
7  * This file includes the RADIO TASKS registers side-effecting functions
8  * The actual tasks logic does not below here.
9  */
10 
11 #include "NRF_RADIO.h"
12 #include "bs_tracing.h"
13 
14 
15 #define RADIO_TASK_SIDEFFECT_FUNC(x) \
16 void nrf_radio_regw_sideeffects_TASKS_##x() { \
17   if (NRF_RADIO_regs.TASKS_##x ) { \
18     NRF_RADIO_regs.TASKS_##x = 0; \
19     nrf_radio_tasks_##x(); \
20   }\
21 }
22 
23 RADIO_TASK_SIDEFFECT_FUNC(TXEN)
RADIO_TASK_SIDEFFECT_FUNC(RXEN)24 RADIO_TASK_SIDEFFECT_FUNC(RXEN)
25 RADIO_TASK_SIDEFFECT_FUNC(START)
26 RADIO_TASK_SIDEFFECT_FUNC(STOP)
27 RADIO_TASK_SIDEFFECT_FUNC(DISABLE)
28 
29 void nrf_radio_regw_sideeffects_TASKS_RSSISTART() {
30   //We don't need to model this yet
31   if ( NRF_RADIO_regs.TASKS_RSSISTART ){
32     NRF_RADIO_regs.TASKS_RSSISTART = 0;
33     bs_trace_warning_line_time("RADIO: Sampling RSSI by writing to TASK_RSSISTART register is not supported by the model yet\n");
34   }
35 }
36 
nrf_radio_regw_sideeffects_TASKS_RSSISTOP()37 void nrf_radio_regw_sideeffects_TASKS_RSSISTOP() {
38   //We don't need to model this yet
39   if ( NRF_RADIO_regs.TASKS_RSSISTOP ){
40     NRF_RADIO_regs.TASKS_RSSISTOP = 0;
41     bs_trace_warning_line_time("RADIO: Sampling RSSI by writing to TASK_RSSISTOP register is not supported by the model yet\n");
42   }
43 }
44 
45 RADIO_TASK_SIDEFFECT_FUNC(BCSTART)
46 RADIO_TASK_SIDEFFECT_FUNC(BCSTOP)
47 RADIO_TASK_SIDEFFECT_FUNC(EDSTART)
48 RADIO_TASK_SIDEFFECT_FUNC(EDSTOP)
49 RADIO_TASK_SIDEFFECT_FUNC(CCASTART)
50 RADIO_TASK_SIDEFFECT_FUNC(CCASTOP)
51 
52