From 08bda8bed790b440f74878271eb2c9e1f2eec4a1 Mon Sep 17 00:00:00 2001 From: Edvard Pettersen Date: Wed, 25 Jul 2018 16:59:28 +0200 Subject: [PATCH] Fixed compiler errors --- .../rf-settings/cc13x0/ble-tx-power.c | 2 +- arch/cpu/cc13xx-cc26xx/rf/ble-beacond.c | 9 +++---- arch/cpu/cc13xx-cc26xx/rf/prop-mode.c | 25 ++++++++++--------- arch/cpu/cc13xx-cc26xx/rf/sched.c | 17 +++++++++++-- arch/cpu/cc13xx-cc26xx/rf/settings.h | 13 +++++----- .../launchpad/cc1350-4/CC1350_LAUNCHXL_433.c | 23 +++++++++++++++++ .../launchpad/cc1350-4/CC1350_LAUNCHXL_433.h | 10 ++++++++ .../launchpad/cc1352p-2/CC1352P_2_LAUNCHXL.h | 10 ++++---- .../cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD.c | 1 - .../cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID.c | 1 - 10 files changed, 78 insertions(+), 33 deletions(-) diff --git a/arch/cpu/cc13xx-cc26xx/rf-settings/cc13x0/ble-tx-power.c b/arch/cpu/cc13xx-cc26xx/rf-settings/cc13x0/ble-tx-power.c index 16a5b37b7..a0ae346c5 100644 --- a/arch/cpu/cc13xx-cc26xx/rf-settings/cc13x0/ble-tx-power.c +++ b/arch/cpu/cc13xx-cc26xx/rf-settings/cc13x0/ble-tx-power.c @@ -82,7 +82,7 @@ tx_power_table_t rf_ble_tx_power_table_empty[] = }; /*---------------------------------------------------------------------------*/ /* TX power table, based on which board is used. */ -#elif defined(DEVICE_CC1350) || defined(DEVICE_CC1350_4) +#if defined(DEVICE_CC1350) || defined(DEVICE_CC1350_4) #define TX_POWER_TABLE rf_ble_tx_power_table_cc1350 #else diff --git a/arch/cpu/cc13xx-cc26xx/rf/ble-beacond.c b/arch/cpu/cc13xx-cc26xx/rf/ble-beacond.c index f4b693aa8..22b1a9658 100644 --- a/arch/cpu/cc13xx-cc26xx/rf/ble-beacond.c +++ b/arch/cpu/cc13xx-cc26xx/rf/ble-beacond.c @@ -62,11 +62,10 @@ #include #include /*---------------------------------------------------------------------------*/ -#if 0 -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif +/* Log configuration */ +#include "sys/log.h" +#define LOG_MODULE "Radio" +#define LOG_LEVEL LOG_LEVEL_NONE /*---------------------------------------------------------------------------*/ #if RF_BLE_BEACON_ENABLE /*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/cc13xx-cc26xx/rf/prop-mode.c b/arch/cpu/cc13xx-cc26xx/rf/prop-mode.c index a2ff18635..7aa906a3a 100644 --- a/arch/cpu/cc13xx-cc26xx/rf/prop-mode.c +++ b/arch/cpu/cc13xx-cc26xx/rf/prop-mode.c @@ -250,8 +250,8 @@ set_channel(uint16_t channel) rf_result_t res; if(!dot_15_4g_chan_in_range(channel)) { - PRINTF("set_channel: illegal channel %d, defaults to %d\n", - (int)channel, DOT_15_4G_DEFAULT_CHAN); + LOG_WARN("Supplied hannel %d is illegal, defaults to %d\n", + (int)channel, DOT_15_4G_DEFAULT_CHAN); channel = DOT_15_4G_DEFAULT_CHAN; } @@ -264,7 +264,7 @@ set_channel(uint16_t channel) const uint16_t freq = (uint16_t)(new_freq / 1000); const uint16_t frac = (uint16_t)(((new_freq - (freq * 1000)) * 0x10000) / 1000); - PRINTF("set_channel: %u = 0x%04x.0x%04x (%lu)\n", + LOG_DBG("Set channel to %d, frequency 0x%04X.0x%04X (%lu)\n", (int)channel, freq, frac, new_freq); cmd_fs.frequency = freq; @@ -315,7 +315,7 @@ transmit(unsigned short transmit_len) rf_result_t res; if(tx_is_active()) { - PRINTF("transmit: not allowed while transmitting\n"); + LOG_ERR("A transmission is already active\n"); return RADIO_TX_ERR; } @@ -392,7 +392,7 @@ read(void *buf, unsigned short buf_len) /* Sanity check that Frame is at least Frame Shave bytes long */ if(frame_len < FRAME_SHAVE) { - PRINTF("read: frame too short len=%d\n", frame_len); + LOG_ERR("Received rame is too short, len=%d\n", frame_len); data_queue_release_entry(); return 0; @@ -403,7 +403,8 @@ read(void *buf, unsigned short buf_len) /* Sanity check that Payload fits in Buffer */ if(payload_len > buf_len) { - PRINTF("read: payload too large for buffer len=%d buf_len=%d\n", payload_len, buf_len); + LOG_ERR("Payload of received frame is too large for local buffer, len=%d buf_len=%d\n", + payload_len, buf_len); data_queue_release_entry(); return 0; @@ -441,7 +442,7 @@ static int channel_clear(void) { if(tx_is_active()) { - PRINTF("channel_clear: called while in TX\n"); + LOG_ERR("Channel clear called while in TX\n"); return 0; } @@ -497,7 +498,7 @@ on(void) rf_result_t res; if(prop_radio.rf_is_on) { - PRINTF("on: Radio already on\n"); + LOG_WARN("Radio is already on\n"); return RF_RESULT_OK; } @@ -517,7 +518,7 @@ static int off(void) { if(!prop_radio.rf_is_on) { - PRINTF("off: Radio already off\n"); + LOG_WARN("Radio is already off\n"); return RF_RESULT_OK; } @@ -649,7 +650,7 @@ static int init(void) { if(prop_radio.rf_handle) { - PRINTF("init: Radio already initialized\n"); + LOG_WARN("Radio is already initialized\n"); return RF_RESULT_OK; } @@ -657,7 +658,7 @@ init(void) prop_radio.rf_is_on = false; /* Set configured RSSI threshold */ - prop_radio.rssi_threshold = PROP_MODE_RSSI_THRESHOLD; + prop_radio.rssi_threshold = PROP_MODE_CCA_RSSI_THRESHOLD; init_rf_params(); @@ -670,7 +671,7 @@ init(void) prop_radio.rf_handle = netstack_open(&rf_params); if(prop_radio.rf_handle == NULL) { - PRINTF("init: unable to open RF driver\n"); + LOG_ERR("Unable to open RF driver during initialization\n"); return RF_RESULT_ERROR; } diff --git a/arch/cpu/cc13xx-cc26xx/rf/sched.c b/arch/cpu/cc13xx-cc26xx/rf/sched.c index 85e7f5e7e..73957e33b 100644 --- a/arch/cpu/cc13xx-cc26xx/rf/sched.c +++ b/arch/cpu/cc13xx-cc26xx/rf/sched.c @@ -83,14 +83,17 @@ #define EVENTS_CMD_DONE(events) (((events) & RF_EVENTS_CMD_DONE) != 0) /*---------------------------------------------------------------------------*/ /* Synth re-calibration every 3 minutes */ -#define SYNTH_RECAL_INTERVAL (CLOCK_SECOND * 60 * 3) +#define SYNTH_RECAL_INTERVAL (CLOCK_SECOND * 60 * 3) /* Set re-calibration interval with a jitter of 10 seconds */ -#define SYNTH_RECAL_JITTER (CLOCK_SECOND * 10) +#define SYNTH_RECAL_JITTER (CLOCK_SECOND * 10) static struct etimer synth_recal_timer; /*---------------------------------------------------------------------------*/ static RF_Object rf_netstack; + +#if RF_BLE_BEACON_ENABLE static RF_Object rf_ble; +#endif static RF_CmdHandle cmd_rx_handle; @@ -476,12 +479,18 @@ netstack_stop_rx(void) RF_Handle ble_open(RF_Params *params) { +#if RF_BLE_BEACON_ENABLE return RF_open(&rf_ble, &ble_mode, (RF_RadioSetup*)&ble_cmd_radio_setup, params); + +#else + return (RF_Handle)NULL; +#endif } /*---------------------------------------------------------------------------*/ rf_result_t ble_sched_beacon(RF_Callback cb, RF_EventMask bm_event) { +#if RF_BLE_BEACON_ENABLE RF_ScheduleCmdParams sched_params; RF_ScheduleCmdParams_init(&sched_params); @@ -518,6 +527,10 @@ ble_sched_beacon(RF_Callback cb, RF_EventMask bm_event) cmd_rx_restore(rx_key); return RF_RESULT_OK; + +#else + return RF_RESULT_ERROR; +#endif } /*---------------------------------------------------------------------------*/ PROCESS(rf_sched_process, "RF Scheduler Process"); diff --git a/arch/cpu/cc13xx-cc26xx/rf/settings.h b/arch/cpu/cc13xx-cc26xx/rf/settings.h index 4f6eab1c2..4d8df6d23 100644 --- a/arch/cpu/cc13xx-cc26xx/rf/settings.h +++ b/arch/cpu/cc13xx-cc26xx/rf/settings.h @@ -48,6 +48,8 @@ /*---------------------------------------------------------------------------*/ #include /*---------------------------------------------------------------------------*/ +/* Netstack RF command configuration */ + #if SUPPORTS_PROP_MODE #include "prop-settings.h" #endif @@ -56,12 +58,6 @@ #include "ieee-settings.h" #endif -#if SUPPORTS_BLE_BEACON -#include "ble-settings.h" -#endif -/*---------------------------------------------------------------------------*/ -/* Netstack RF command configuration */ - /* Prop-mode RF settings */ #if (RF_MODE == RF_MODE_SUB_1_GHZ) @@ -83,6 +79,9 @@ #endif /* RF_MODE */ /*---------------------------------------------------------------------------*/ /* BLE Beacon RF command configuration */ +#if SUPPORTS_BLE_BEACON + +#include "ble-settings.h" /* CC13x0/CC26x0 devices */ #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0) @@ -101,6 +100,8 @@ #define ble_cmd_beacon rf_cmd_ble5_adv_aux #endif /* DeviceFamily_PARENT */ + +#endif /* SUPPORTS_BLE_BEACON */ /*---------------------------------------------------------------------------*/ #endif /* NETSTACK_SETTINGS_H_ */ /*---------------------------------------------------------------------------*/ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/CC1350_LAUNCHXL_433.c b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/CC1350_LAUNCHXL_433.c index fda5b5b9f..b4d34a54b 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/CC1350_LAUNCHXL_433.c +++ b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/CC1350_LAUNCHXL_433.c @@ -687,6 +687,29 @@ const uint_least8_t SPI_count = CC1350_LAUNCHXL_433_SPICOUNT; #endif /* TI_SPI_CONF_ENABLE */ + +/* + * =============================== TRNG =============================== + */ +#include +#include + +TRNGCC26X0_Object trngCC26X0Object[CC1350_LAUNCHXL_433_TRNGCOUNT]; + +const TRNGCC26X0_HWAttrs trngCC26X0HWAttrs[CC1350_LAUNCHXL_433_TRNGCOUNT] = { + { + .swiPriority = 0, + .intPriority = ~0, + } +}; + +const TRNG_Config TRNG_config[] = { + { &trngCC26X0Object[0], &trngCC26X0HWAttrs[0] }, +}; + +const uint8_t TRNG_count = CC1350_LAUNCHXL_433_TRNGCOUNT; + + /* * =============================== UART =============================== */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/CC1350_LAUNCHXL_433.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/CC1350_LAUNCHXL_433.h index 80352e30e..479b81a71 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/CC1350_LAUNCHXL_433.h +++ b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1350-4/CC1350_LAUNCHXL_433.h @@ -328,6 +328,16 @@ typedef enum CC1350_LAUNCHXL_433_SPIName { CC1350_LAUNCHXL_433_SPICOUNT } CC1350_LAUNCHXL_433_SPIName; +/*! + * @def CC1350_LAUNCHXL_433_TRNGName + * @brief Enum of TRNGs + */ +typedef enum CC1350_LAUNCHXL_433_TRNGName { + CC1350_LAUNCHXL_433_TRNG0 = 0, + + CC1350_LAUNCHXL_433_TRNGCOUNT +} CC1350_LAUNCHXL_433_TRNGName; + /*! * @def CC1350_LAUNCHXL_433_UARTName * @brief Enum of UARTs diff --git a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/CC1352P_2_LAUNCHXL.h b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/CC1352P_2_LAUNCHXL.h index 40f01ef03..29e089cfb 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/CC1352P_2_LAUNCHXL.h +++ b/arch/platform/simplelink/cc13xx-cc26xx/launchpad/cc1352p-2/CC1352P_2_LAUNCHXL.h @@ -400,14 +400,14 @@ typedef enum CC1352P_2_LAUNCHXL_SPIName { } CC1352P_2_LAUNCHXL_SPIName; /*! - * @def CC1352p_2_LAUNCHXL_TRNGName + * @def CC1352P_2_LAUNCHXL_TRNGName * @brief Enum of TRNGs */ -typedef enum CC1352p_2_LAUNCHXL_TRNGName { - CC1352p_2_LAUNCHXL_TRNG0 = 0, +typedef enum CC1352P_2_LAUNCHXL_TRNGName { + CC1352P_2_LAUNCHXL_TRNG0 = 0, - CC1352p_2_LAUNCHXL_TRNGCOUNT -} CC1352p_2_LAUNCHXL_TRNGName; + CC1352P_2_LAUNCHXL_TRNGCOUNT +} CC1352P_2_LAUNCHXL_TRNGName; /*! * @def CC1352P_2_LAUNCHXL_UARTName diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD.c b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD.c index f9e1f8fe5..2040a7582 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD.c +++ b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc13x0/CC1350DK_7XD.c @@ -394,7 +394,6 @@ const PIN_Config BoardGpioInitTable[] = { CC1350DK_7XD_PIN_KEY_LEFT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ CC1350DK_7XD_PIN_KEY_UP | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ CC1350DK_7XD_SDCARD_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ - CC1350DK_7XD_LCD_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ CC1350DK_7XD_ACC_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ CC1350DK_7XD_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */ CC1350DK_7XD_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */ diff --git a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID.c b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID.c index 1f7ed1ab1..4d0115d38 100644 --- a/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID.c +++ b/arch/platform/simplelink/cc13xx-cc26xx/srf06/cc26x0/CC2650DK_7ID.c @@ -395,7 +395,6 @@ const PIN_Config BoardGpioInitTable[] = { CC2650DK_7ID_PIN_KEY_LEFT | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ CC2650DK_7ID_PIN_KEY_UP | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS, /* Button is active low */ CC2650DK_7ID_SDCARD_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ - CC2650DK_7ID_LCD_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ CC2650DK_7ID_ACC_CS | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL | PIN_DRVSTR_MIN, /* External flash chip select */ CC2650DK_7ID_UART_RX | PIN_INPUT_EN | PIN_PULLDOWN, /* UART RX via debugger back channel */ CC2650DK_7ID_UART_TX | PIN_GPIO_OUTPUT_EN | PIN_GPIO_HIGH | PIN_PUSHPULL, /* UART TX via debugger back channel */