From f44072c299cfd88a86e5cabb82422b33bc5e8e18 Mon Sep 17 00:00:00 2001 From: Alexandre Bailon Date: Mon, 29 Apr 2024 12:31:30 +0200 Subject: [PATCH] drivers: ieee802154: cc13xx_cc26xx: Fixup a bus error Sometime, the radio causes a bus error. This happens because we cast a struct and access to a member that doesn't exists in the original struct. This updates the driver to use the right struct to make the cast safe. Signed-off-by: Alexandre Bailon --- drivers/ieee802154/ieee802154_cc13xx_cc26xx.c | 6 ++++++ drivers/ieee802154/ieee802154_cc13xx_cc26xx.h | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/drivers/ieee802154/ieee802154_cc13xx_cc26xx.c b/drivers/ieee802154/ieee802154_cc13xx_cc26xx.c index 263b98d2823..06e6e6aaab6 100644 --- a/drivers/ieee802154/ieee802154_cc13xx_cc26xx.c +++ b/drivers/ieee802154/ieee802154_cc13xx_cc26xx.c @@ -777,7 +777,13 @@ static struct ieee802154_cc13xx_cc26xx_data ieee802154_cc13xx_cc26xx_data = { }, .cmd_radio_setup = { +#if defined(CONFIG_SOC_CC1352R) || defined(CONFIG_SOC_CC2652R) || \ + defined(CONFIG_SOC_CC1352R7) || defined(CONFIG_SOC_CC2652R7) .commandNo = CMD_RADIO_SETUP, +#elif defined(CONFIG_SOC_CC1352P) || defined(CONFIG_SOC_CC2652P) || \ + defined(CONFIG_SOC_CC1352P7) || defined(CONFIG_SOC_CC2652P7) + .commandNo = CMD_RADIO_SETUP_PA, +#endif /* CONFIG_SOC_CCxx52x */ .status = IDLE, .pNextOp = NULL, .startTrigger.triggerType = TRIG_NOW, diff --git a/drivers/ieee802154/ieee802154_cc13xx_cc26xx.h b/drivers/ieee802154/ieee802154_cc13xx_cc26xx.h index 185e445a175..4d4ee4588df 100644 --- a/drivers/ieee802154/ieee802154_cc13xx_cc26xx.h +++ b/drivers/ieee802154/ieee802154_cc13xx_cc26xx.h @@ -80,7 +80,15 @@ struct ieee802154_cc13xx_cc26xx_data { volatile rfc_CMD_IEEE_CSMA_t cmd_ieee_csma; volatile rfc_CMD_IEEE_TX_t cmd_ieee_tx; volatile rfc_CMD_IEEE_RX_ACK_t cmd_ieee_rx_ack; +#if defined(CONFIG_SOC_CC1352R) || defined(CONFIG_SOC_CC2652R) || \ + defined(CONFIG_SOC_CC1352R7) || defined(CONFIG_SOC_CC2652R7) volatile rfc_CMD_RADIO_SETUP_t cmd_radio_setup; +#elif defined(CONFIG_SOC_CC1352P) || defined(CONFIG_SOC_CC2652P) || \ + defined(CONFIG_SOC_CC1352P7) || defined(CONFIG_SOC_CC2652P7) + volatile rfc_CMD_RADIO_SETUP_PA_t cmd_radio_setup; +#else + BUILD_ASSERT(false, "unknown model"); +#endif /* CONFIG_SOC_CCxx52x */ volatile int16_t saved_cmdhandle; };