Skip to content

Commit 0d181b5

Browse files
rugeGerritsenrlubos
authored andcommitted
mpsl: hwres: dppi: Adapt ppib_get_domain for bsim
We need to update the changes done in 00bd43c to support compiling the code for bsim. A switch case statement cannot be used because it requires compile time constants in each label. When compiling for babblesim this is not the case. Simply transforming it to a set of if statements also works. Signed-off-by: Rubin Gerritsen <[email protected]>
1 parent 8458f8b commit 0d181b5

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

subsys/mpsl/hwres/mpsl_hwres.c

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,20 @@ bool mpsl_hwres_dppi_channel_alloc(NRF_DPPIC_Type *p_dppic, uint8_t *p_dppi_ch)
3535
#include <soc/interconnect/nrfx_gppi_lumos.h>
3636
static uint32_t ppib_get_domain(NRF_PPIB_Type *p_ppib)
3737
{
38-
switch ((uint32_t)p_ppib) {
39-
case (uint32_t)NRF_PPIB00:
40-
/* fall through */
41-
case (uint32_t)NRF_PPIB10:
38+
if ((uint32_t)p_ppib == (uint32_t)NRF_PPIB00 ||
39+
(uint32_t)p_ppib == (uint32_t)NRF_PPIB10) {
4240
return NRFX_GPPI_NODE_PPIB00_10;
43-
case (uint32_t)NRF_PPIB11:
44-
/* fall through */
45-
case (uint32_t)NRF_PPIB21:
41+
} else if ((uint32_t)p_ppib == (uint32_t)NRF_PPIB11 ||
42+
(uint32_t)p_ppib == (uint32_t)NRF_PPIB21) {
4643
return NRFX_GPPI_NODE_PPIB11_21;
47-
case (uint32_t)NRF_PPIB01:
48-
/* fall through */
49-
case (uint32_t)NRF_PPIB20:
44+
} else if ((uint32_t)p_ppib == (uint32_t)NRF_PPIB01 ||
45+
(uint32_t)p_ppib == (uint32_t)NRF_PPIB20) {
5046
return NRFX_GPPI_NODE_PPIB01_20;
51-
case (uint32_t)NRF_PPIB22:
52-
/* fall through */
53-
case (uint32_t)NRF_PPIB30:
47+
} else if ((uint32_t)p_ppib == (uint32_t)NRF_PPIB22 ||
48+
(uint32_t)p_ppib == (uint32_t)NRF_PPIB30) {
5449
return NRFX_GPPI_NODE_PPIB22_30;
55-
default:
56-
__ASSERT_NO_MSG("Unexpected PPIB");
50+
} else {
51+
__ASSERT(false, "Unexpected PPIB");
5752
return 0;
5853
}
5954
}

0 commit comments

Comments
 (0)