Fixed compiler errors

This commit is contained in:
Edvard Pettersen 2018-07-25 16:59:28 +02:00
parent 210db77835
commit 08bda8bed7
10 changed files with 78 additions and 33 deletions

View File

@ -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

View File

@ -62,11 +62,10 @@
#include <stdio.h>
#include <string.h>
/*---------------------------------------------------------------------------*/
#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
/*---------------------------------------------------------------------------*/

View File

@ -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;
}

View File

@ -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");

View File

@ -48,6 +48,8 @@
/*---------------------------------------------------------------------------*/
#include <ti/devices/DeviceFamily.h>
/*---------------------------------------------------------------------------*/
/* 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_ */
/*---------------------------------------------------------------------------*/

View File

@ -687,6 +687,29 @@ const uint_least8_t SPI_count = CC1350_LAUNCHXL_433_SPICOUNT;
#endif /* TI_SPI_CONF_ENABLE */
/*
* =============================== TRNG ===============================
*/
#include <ti/drivers/TRNG.h>
#include <ti/drivers/trng/TRNGCC26X0.h>
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 ===============================
*/

View File

@ -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

View File

@ -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

View File

@ -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 */

View File

@ -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 */