Uncrustify code style
This commit is contained in:
parent
b605e9b43f
commit
ca2e82a459
@ -74,7 +74,7 @@
|
|||||||
#ifndef WATCHDOG_CONF_TIMER_TOP
|
#ifndef WATCHDOG_CONF_TIMER_TOP
|
||||||
#define WATCHDOG_CONF_TIMER_TOP 0xFFFFF
|
#define WATCHDOG_CONF_TIMER_TOP 0xFFFFF
|
||||||
#endif
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* \name RF configuration.
|
* \name RF configuration.
|
||||||
@ -88,9 +88,9 @@
|
|||||||
* or larger guard time.
|
* or larger guard time.
|
||||||
*/
|
*/
|
||||||
#ifndef RF_CONF_FAST_RADIO_STARTUP
|
#ifndef RF_CONF_FAST_RADIO_STARTUP
|
||||||
# define RF_FAST_RADIO_STARTUP (MAC_CONF_WITH_TSCH)
|
#define RF_FAST_RADIO_STARTUP (MAC_CONF_WITH_TSCH)
|
||||||
#else
|
#else
|
||||||
# define RF_FAST_RADIO_STARTUP RF_CONF_FAST_RADIO_STARTUP
|
#define RF_FAST_RADIO_STARTUP RF_CONF_FAST_RADIO_STARTUP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -102,7 +102,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (RF_CONF_TXPOWER_HIGH_PA) && !(SUPPORTS_HIGH_PA)
|
#if (RF_CONF_TXPOWER_HIGH_PA) && !(SUPPORTS_HIGH_PA)
|
||||||
# error "Device does not support High PA"
|
#error "Device does not support High PA"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -120,36 +120,36 @@
|
|||||||
*/
|
*/
|
||||||
#ifdef RF_CONF_MODE
|
#ifdef RF_CONF_MODE
|
||||||
/* Sanity check a valid configuration is provided. */
|
/* Sanity check a valid configuration is provided. */
|
||||||
# if !(RF_CONF_MODE & RF_MODE_BM)
|
#if !(RF_CONF_MODE & RF_MODE_BM)
|
||||||
# error "Invalid RF_CONF_MODE provided"
|
#error "Invalid RF_CONF_MODE provided"
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
# define RF_MODE RF_CONF_MODE
|
#define RF_MODE RF_CONF_MODE
|
||||||
#endif /* RF_CONF_MODE */
|
#endif /* RF_CONF_MODE */
|
||||||
|
|
||||||
/* Number of RX buffers. */
|
/* Number of RX buffers. */
|
||||||
#ifdef RF_CONF_RX_BUF_CNT
|
#ifdef RF_CONF_RX_BUF_CNT
|
||||||
# define RF_RX_BUF_CNT RF_CONF_RX_BUF_CNT
|
#define RF_RX_BUF_CNT RF_CONF_RX_BUF_CNT
|
||||||
#else
|
#else
|
||||||
# define RF_RX_BUF_CNT 4
|
#define RF_RX_BUF_CNT 4
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Size of each RX buffer in bytes. */
|
/* Size of each RX buffer in bytes. */
|
||||||
#ifdef RF_CONF_RX_BUF_SIZE
|
#ifdef RF_CONF_RX_BUF_SIZE
|
||||||
# define RF_RX_BUF_SIZE RF_CONF_RX_BUF_SIZE
|
#define RF_RX_BUF_SIZE RF_CONF_RX_BUF_SIZE
|
||||||
#else
|
#else
|
||||||
# define RF_RX_BUF_SIZE 144
|
#define RF_RX_BUF_SIZE 144
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Enable/disable BLE beacon. */
|
/* Enable/disable BLE beacon. */
|
||||||
#ifdef RF_CONF_BLE_BEACON_ENABLE
|
#ifdef RF_CONF_BLE_BEACON_ENABLE
|
||||||
# define RF_BLE_BEACON_ENABLE RF_CONF_BLE_BEACON_ENABLE
|
#define RF_BLE_BEACON_ENABLE RF_CONF_BLE_BEACON_ENABLE
|
||||||
#else
|
#else
|
||||||
# define RF_BLE_BEACON_ENABLE 0
|
#define RF_BLE_BEACON_ENABLE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (RF_BLE_BEACON_ENABLE) && !(SUPPORTS_BLE_BEACON)
|
#if (RF_BLE_BEACON_ENABLE) && !(SUPPORTS_BLE_BEACON)
|
||||||
# error "Device does not support BLE for BLE beacon"
|
#error "Device does not support BLE for BLE beacon"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*----- CC13xx Device Line --------------------------------------------------*/
|
/*----- CC13xx Device Line --------------------------------------------------*/
|
||||||
@ -157,65 +157,65 @@
|
|||||||
#if defined(DEVICE_LINE_CC13XX)
|
#if defined(DEVICE_LINE_CC13XX)
|
||||||
|
|
||||||
/* Default to Prop-mode for CC13xx devices if not configured. */
|
/* Default to Prop-mode for CC13xx devices if not configured. */
|
||||||
# ifndef RF_MODE
|
#ifndef RF_MODE
|
||||||
# define RF_MODE RF_MODE_SUB_1_GHZ
|
#define RF_MODE RF_MODE_SUB_1_GHZ
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
/*----- CC13xx Prop-mode ----------------------------------------------------*/
|
/*----- CC13xx Prop-mode ----------------------------------------------------*/
|
||||||
# if (RF_MODE == RF_MODE_SUB_1_GHZ) && (SUPPORTS_PROP_MODE)
|
#if (RF_MODE == RF_MODE_SUB_1_GHZ) && (SUPPORTS_PROP_MODE)
|
||||||
|
|
||||||
/* Netstack configuration. */
|
/* Netstack configuration. */
|
||||||
# define NETSTACK_CONF_RADIO prop_mode_driver
|
#define NETSTACK_CONF_RADIO prop_mode_driver
|
||||||
|
|
||||||
/* CSMA configuration. */
|
/* CSMA configuration. */
|
||||||
# define CSMA_CONF_ACK_WAIT_TIME (RTIMER_SECOND / 300)
|
#define CSMA_CONF_ACK_WAIT_TIME (RTIMER_SECOND / 300)
|
||||||
# define CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME (RTIMER_SECOND / 1000)
|
#define CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME (RTIMER_SECOND / 1000)
|
||||||
# define CSMA_CONF_SEND_SOFT_ACK 1
|
#define CSMA_CONF_SEND_SOFT_ACK 1
|
||||||
|
|
||||||
/*----- CC13xx IEEE-mode ----------------------------------------------------*/
|
/*----- CC13xx IEEE-mode ----------------------------------------------------*/
|
||||||
# elif (RF_MODE == RF_MODE_2_4_GHZ) && (SUPPORTS_IEEE_MODE)
|
#elif (RF_MODE == RF_MODE_2_4_GHZ) && (SUPPORTS_IEEE_MODE)
|
||||||
|
|
||||||
/* Netstack configuration. */
|
/* Netstack configuration. */
|
||||||
# define NETSTACK_CONF_RADIO ieee_mode_driver
|
#define NETSTACK_CONF_RADIO ieee_mode_driver
|
||||||
|
|
||||||
/* CSMA configuration. */
|
/* CSMA configuration. */
|
||||||
# define CSMA_CONF_SEND_SOFT_ACK 0
|
#define CSMA_CONF_SEND_SOFT_ACK 0
|
||||||
|
|
||||||
# else
|
#else
|
||||||
/*----- CC13xx Unsupported Mode ---------------------------------------------*/
|
/*----- CC13xx Unsupported Mode ---------------------------------------------*/
|
||||||
# error "Invalid RF mode configuration of CC13xx device"
|
#error "Invalid RF mode configuration of CC13xx device"
|
||||||
# endif /* CC13xx RF Mode configuration */
|
#endif /* CC13xx RF Mode configuration */
|
||||||
|
|
||||||
/*----- CC26xx Device Line --------------------------------------------------*/
|
/*----- CC26xx Device Line --------------------------------------------------*/
|
||||||
/* CC26xx only supports IEEE mode */
|
/* CC26xx only supports IEEE mode */
|
||||||
#elif defined(DEVICE_LINE_CC26XX)
|
#elif defined(DEVICE_LINE_CC26XX)
|
||||||
|
|
||||||
/* Default to IEEE-mode for CC26xx devices if not configured */
|
/* Default to IEEE-mode for CC26xx devices if not configured */
|
||||||
# ifndef RF_MODE
|
#ifndef RF_MODE
|
||||||
# define RF_MODE RF_MODE_2_4_GHZ
|
#define RF_MODE RF_MODE_2_4_GHZ
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
/*----- CC26xx IEEE-mode ----------------------------------------------------*/
|
/*----- CC26xx IEEE-mode ----------------------------------------------------*/
|
||||||
# if (RF_MODE == RF_MODE_2_4_GHZ) && (SUPPORTS_IEEE_MODE)
|
#if (RF_MODE == RF_MODE_2_4_GHZ) && (SUPPORTS_IEEE_MODE)
|
||||||
|
|
||||||
/* Netstack configuration */
|
/* Netstack configuration */
|
||||||
# define NETSTACK_CONF_RADIO ieee_mode_driver
|
#define NETSTACK_CONF_RADIO ieee_mode_driver
|
||||||
|
|
||||||
/* CSMA configuration */
|
/* CSMA configuration */
|
||||||
# define CSMA_CONF_SEND_SOFT_ACK 0
|
#define CSMA_CONF_SEND_SOFT_ACK 0
|
||||||
|
|
||||||
/* Frequncy band configuration */
|
/* Frequncy band configuration */
|
||||||
# undef DOT_15_4G_FREQ_BAND_ID
|
#undef DOT_15_4G_FREQ_BAND_ID
|
||||||
# define DOT_15_4G_CONF_FREQ_BAND_ID DOT_15_4G_FREQ_BAND_2450
|
#define DOT_15_4G_CONF_FREQ_BAND_ID DOT_15_4G_FREQ_BAND_2450
|
||||||
|
|
||||||
# else
|
#else
|
||||||
/*----- CC26xx Unsupported Mode ---------------------------------------------*/
|
/*----- CC26xx Unsupported Mode ---------------------------------------------*/
|
||||||
# error "IEEE-mode only supported by CC26xx devices"
|
#error "IEEE-mode only supported by CC26xx devices"
|
||||||
# endif /* CC26xx RF Mode configuration */
|
#endif /* CC26xx RF Mode configuration */
|
||||||
|
|
||||||
/*----- Unsupported device line ---------------------------------------------*/
|
/*----- Unsupported device line ---------------------------------------------*/
|
||||||
#else
|
#else
|
||||||
# error "Unsupported Device Line defined"
|
#error "Unsupported Device Line defined"
|
||||||
#endif /* Unsupported device line */
|
#endif /* Unsupported device line */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
@ -43,9 +43,9 @@
|
|||||||
#include <ti/devices/DeviceFamily.h>
|
#include <ti/devices/DeviceFamily.h>
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0)
|
#if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0)
|
||||||
# include <cm3/cm3-def.h>
|
#include <cm3/cm3-def.h>
|
||||||
#elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2)
|
#elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2)
|
||||||
# include <cm4/cm4-def.h>
|
#include <cm4/cm4-def.h>
|
||||||
#endif
|
#endif
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
@ -71,7 +71,7 @@
|
|||||||
#define USEC_TO_RAT(X) ((X) * 4)
|
#define USEC_TO_RAT(X) ((X) * 4)
|
||||||
|
|
||||||
#if (RTIMER_SECOND % 256) || (RAT_SECOND % 256)
|
#if (RTIMER_SECOND % 256) || (RAT_SECOND % 256)
|
||||||
# error RAT_TO_RTIMER macro must be fixed!
|
#error RAT_TO_RTIMER macro must be fixed!
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The PHY header (preamble + SFD, 4+1 bytes) duration is equivalent to 10 symbols */
|
/* The PHY header (preamble + SFD, 4+1 bytes) duration is equivalent to 10 symbols */
|
||||||
@ -116,9 +116,9 @@
|
|||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Path to CMSIS header */
|
/* Path to CMSIS header */
|
||||||
#if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0)
|
#if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0)
|
||||||
# define CMSIS_CONF_HEADER_PATH "cc13x0-cc26x0-cm3.h"
|
#define CMSIS_CONF_HEADER_PATH "cc13x0-cc26x0-cm3.h"
|
||||||
#elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2)
|
#elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2)
|
||||||
# define CMSIS_CONF_HEADER_PATH "cc13x2-cc26x2-cm4.h"
|
#define CMSIS_CONF_HEADER_PATH "cc13x2-cc26x2-cm4.h"
|
||||||
#endif
|
#endif
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Path to headers with implementation of mutexes and memory barriers */
|
/* Path to headers with implementation of mutexes and memory barriers */
|
||||||
|
@ -51,13 +51,13 @@
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#if CCFG_CONF_JTAG_INTERFACE_DISABLE
|
#if CCFG_CONF_JTAG_INTERFACE_DISABLE
|
||||||
# define SET_CCFG_CCFG_TI_OPTIONS_TI_FA_ENABLE 0x00
|
#define SET_CCFG_CCFG_TI_OPTIONS_TI_FA_ENABLE 0x00
|
||||||
# define SET_CCFG_CCFG_TAP_DAP_0_CPU_DAP_ENABLE 0x00
|
#define SET_CCFG_CCFG_TAP_DAP_0_CPU_DAP_ENABLE 0x00
|
||||||
# define SET_CCFG_CCFG_TAP_DAP_0_PRCM_TAP_ENABLE 0x00
|
#define SET_CCFG_CCFG_TAP_DAP_0_PRCM_TAP_ENABLE 0x00
|
||||||
# define SET_CCFG_CCFG_TAP_DAP_0_TEST_TAP_ENABLE 0x00
|
#define SET_CCFG_CCFG_TAP_DAP_0_TEST_TAP_ENABLE 0x00
|
||||||
# define SET_CCFG_CCFG_TAP_DAP_1_PBIST2_TAP_ENABLE 0x00
|
#define SET_CCFG_CCFG_TAP_DAP_1_PBIST2_TAP_ENABLE 0x00
|
||||||
# define SET_CCFG_CCFG_TAP_DAP_1_PBIST1_TAP_ENABLE 0x00
|
#define SET_CCFG_CCFG_TAP_DAP_1_PBIST1_TAP_ENABLE 0x00
|
||||||
# define SET_CCFG_CCFG_TAP_DAP_1_WUC_TAP_ENABLE 0x00
|
#define SET_CCFG_CCFG_TAP_DAP_1_WUC_TAP_ENABLE 0x00
|
||||||
#endif
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
@ -69,7 +69,7 @@
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#if defined(DEVICE_LINE_CC13XX) && (RF_CONF_TXPOWER_BOOST_MODE)
|
#if defined(DEVICE_LINE_CC13XX) && (RF_CONF_TXPOWER_BOOST_MODE)
|
||||||
# define CCFG_FORCE_VDDR_HH 1
|
#define CCFG_FORCE_VDDR_HH 1
|
||||||
#endif
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
@ -86,12 +86,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CCFG_CONF_ROM_BOOTLOADER_ENABLE
|
#if CCFG_CONF_ROM_BOOTLOADER_ENABLE
|
||||||
# define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0xC5
|
#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0xC5
|
||||||
# define SET_CCFG_BL_CONFIG_BL_LEVEL 0x00
|
#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x00
|
||||||
# if defined(CCFG_CONF_BL_PIN_NUMBER)
|
#if defined(CCFG_CONF_BL_PIN_NUMBER)
|
||||||
# define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER CCFG_CONF_BL_PIN_NUMBER
|
#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER CCFG_CONF_BL_PIN_NUMBER
|
||||||
# endif
|
#endif
|
||||||
# define SET_CCFG_BL_CONFIG_BL_ENABLE 0xC5
|
#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xC5
|
||||||
#endif
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -87,7 +87,7 @@ clock_init(void)
|
|||||||
{
|
{
|
||||||
/* ClockP_getSystemTickPeriod() returns ticks per us. */
|
/* ClockP_getSystemTickPeriod() returns ticks per us. */
|
||||||
const uint32_t clockp_ticks_second =
|
const uint32_t clockp_ticks_second =
|
||||||
(uint32_t)(1000 * 1000) / (CLOCK_SECOND) / ClockP_getSystemTickPeriod();
|
(uint32_t)(1000 * 1000) / (CLOCK_SECOND) / ClockP_getSystemTickPeriod();
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|
||||||
|
@ -57,8 +57,8 @@ dbg_putchar(int c)
|
|||||||
|
|
||||||
num_bytes = (int)uart0_write(&ch, 1);
|
num_bytes = (int)uart0_write(&ch, 1);
|
||||||
return (num_bytes > 0)
|
return (num_bytes > 0)
|
||||||
? num_bytes
|
? num_bytes
|
||||||
: 0;
|
: 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
unsigned int
|
unsigned int
|
||||||
@ -77,8 +77,8 @@ dbg_send_bytes(const unsigned char *seq, unsigned int len)
|
|||||||
|
|
||||||
num_bytes = (int)uart0_write(seq, max_len);
|
num_bytes = (int)uart0_write(seq, max_len);
|
||||||
return (num_bytes > 0)
|
return (num_bytes > 0)
|
||||||
? num_bytes
|
? num_bytes
|
||||||
: 0;
|
: 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/** @} */
|
/** @} */
|
||||||
|
@ -175,7 +175,6 @@ gpio_int_cb(PIN_Handle handle, PIN_Id pin_id)
|
|||||||
/* Notify the GPIO HAL driver */
|
/* Notify the GPIO HAL driver */
|
||||||
gpio_hal_event_handler(gpio_hal_pin_to_mask(pin_id));
|
gpio_hal_event_handler(gpio_hal_pin_to_mask(pin_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
gpio_hal_arch_init(void)
|
gpio_hal_arch_init(void)
|
||||||
@ -244,15 +243,15 @@ gpio_hal_arch_read_pins(gpio_hal_pin_mask_t pins)
|
|||||||
pins &= ~oe_pins;
|
pins &= ~oe_pins;
|
||||||
|
|
||||||
return (HWREG(GPIO_BASE + GPIO_O_DOUT31_0) & oe_pins) |
|
return (HWREG(GPIO_BASE + GPIO_O_DOUT31_0) & oe_pins) |
|
||||||
GPIO_readMultiDio(pins);
|
GPIO_readMultiDio(pins);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
uint8_t
|
uint8_t
|
||||||
gpio_hal_arch_read_pin(gpio_hal_pin_t pin)
|
gpio_hal_arch_read_pin(gpio_hal_pin_t pin)
|
||||||
{
|
{
|
||||||
return (GPIO_getOutputEnableDio(pin))
|
return (GPIO_getOutputEnableDio(pin))
|
||||||
? PINCC26XX_getOutputValue(pin)
|
? PINCC26XX_getOutputValue(pin)
|
||||||
: PINCC26XX_getInputValue(pin);
|
: PINCC26XX_getInputValue(pin);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/** @} */
|
/** @} */
|
||||||
|
@ -73,8 +73,7 @@ static void rtimer_clock_stub(uintptr_t unused) { (void)unused; /* do nothing */
|
|||||||
static void
|
static void
|
||||||
rtimer_isr_hook(void)
|
rtimer_isr_hook(void)
|
||||||
{
|
{
|
||||||
if(AONRTCEventGet(RTIMER_RTC_CH))
|
if(AONRTCEventGet(RTIMER_RTC_CH)) {
|
||||||
{
|
|
||||||
AONRTCEventClear(RTIMER_RTC_CH);
|
AONRTCEventClear(RTIMER_RTC_CH);
|
||||||
AONRTCChannelDisable(RTIMER_RTC_CH);
|
AONRTCChannelDisable(RTIMER_RTC_CH);
|
||||||
|
|
||||||
@ -84,12 +83,9 @@ rtimer_isr_hook(void)
|
|||||||
* HWI Dispatch clears the interrupt. If HWI wasn't triggered, clear
|
* HWI Dispatch clears the interrupt. If HWI wasn't triggered, clear
|
||||||
* the interrupt manually.
|
* the interrupt manually.
|
||||||
*/
|
*/
|
||||||
if(AONRTCEventGet(HWIP_RTC_CH))
|
if(AONRTCEventGet(HWIP_RTC_CH)) {
|
||||||
{
|
|
||||||
hwi_dispatch_fxn();
|
hwi_dispatch_fxn();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
IntPendClear(INT_AON_RTC_COMB);
|
IntPendClear(INT_AON_RTC_COMB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,9 +117,8 @@ rtimer_arch_init(void)
|
|||||||
ClockP_destruct(&clk_object);
|
ClockP_destruct(&clk_object);
|
||||||
|
|
||||||
/* Try to access the RAM vector table. */
|
/* Try to access the RAM vector table. */
|
||||||
ramvec_table = (isr_fxn_t*)HWREG(NVIC_VTABLE);
|
ramvec_table = (isr_fxn_t *)HWREG(NVIC_VTABLE);
|
||||||
if(!ramvec_table)
|
if(!ramvec_table) {
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* Unable to find the RAM vector table is a serious fault.
|
* Unable to find the RAM vector table is a serious fault.
|
||||||
* Spin-lock forever.
|
* Spin-lock forever.
|
||||||
@ -136,8 +131,7 @@ rtimer_arch_init(void)
|
|||||||
* in the RAM vector table. Fetch and store it.
|
* in the RAM vector table. Fetch and store it.
|
||||||
*/
|
*/
|
||||||
hwi_dispatch_fxn = (hwi_dispatch_fxn_t)ramvec_table[INT_AON_RTC_COMB];
|
hwi_dispatch_fxn = (hwi_dispatch_fxn_t)ramvec_table[INT_AON_RTC_COMB];
|
||||||
if(!hwi_dispatch_fxn)
|
if(!hwi_dispatch_fxn) {
|
||||||
{
|
|
||||||
/*
|
/*
|
||||||
* Unable to find the HWI dispatch ISR in the RAM vector table is
|
* Unable to find the HWI dispatch ISR in the RAM vector table is
|
||||||
* a serious fault. Spin-lock forever.
|
* a serious fault. Spin-lock forever.
|
||||||
|
@ -87,25 +87,25 @@ extern unsigned long _stack_end;
|
|||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
__attribute__ ((section(".resetVecs"))) __attribute__ ((used))
|
__attribute__ ((section(".resetVecs"))) __attribute__ ((used))
|
||||||
static void (* const resetVectors[16])(void) =
|
static void(*const resetVectors[16]) (void) =
|
||||||
{
|
{
|
||||||
(void (*)(void))((uint32_t)&_stack_end),
|
(void (*)(void))((uint32_t)&_stack_end),
|
||||||
// The initial stack pointer
|
/* The initial stack pointer */
|
||||||
resetISR, // The reset handler
|
resetISR, /* The reset handler */
|
||||||
nmiISR, // The NMI handler
|
nmiISR, /* The NMI handler */
|
||||||
faultISR, // The hard fault handler
|
faultISR, /* The hard fault handler */
|
||||||
defaultHandler, // The MPU fault handler
|
defaultHandler, /* The MPU fault handler */
|
||||||
busFaultHandler, // The bus fault handler
|
busFaultHandler, /* The bus fault handler */
|
||||||
defaultHandler, // The usage fault handler
|
defaultHandler, /* The usage fault handler */
|
||||||
0, // Reserved
|
0, /* Reserved */
|
||||||
0, // Reserved
|
0, /* Reserved */
|
||||||
0, // Reserved
|
0, /* Reserved */
|
||||||
0, // Reserved
|
0, /* Reserved */
|
||||||
defaultHandler, // SVCall handler
|
defaultHandler, /* SVCall handler */
|
||||||
defaultHandler, // Debug monitor handler
|
defaultHandler, /* Debug monitor handler */
|
||||||
0, // Reserved
|
0, /* Reserved */
|
||||||
defaultHandler, // The PendSV handler
|
defaultHandler, /* The PendSV handler */
|
||||||
defaultHandler // The SysTick handler
|
defaultHandler /* The SysTick handler */
|
||||||
};
|
};
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
@ -155,7 +155,7 @@ void localProgramStart(void)
|
|||||||
uint32_t count;
|
uint32_t count;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
#if defined (__ARM_ARCH_7EM__) && defined(__VFP_FP__) && !defined(__SOFTFP__)
|
#if defined(__ARM_ARCH_7EM__) && defined(__VFP_FP__) && !defined(__SOFTFP__)
|
||||||
volatile uint32_t *pui32Cpacr = (uint32_t *)0xE000ED88;
|
volatile uint32_t *pui32Cpacr = (uint32_t *)0xE000ED88;
|
||||||
|
|
||||||
/* Enable Coprocessor Access Control (CPAC) */
|
/* Enable Coprocessor Access Control (CPAC) */
|
||||||
@ -193,11 +193,11 @@ void localProgramStart(void)
|
|||||||
__init_array_start[i]();
|
__init_array_start[i]();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call the application's entry point. */
|
/* Call the application's entry point. */
|
||||||
main();
|
main();
|
||||||
|
|
||||||
/* If we ever return signal Error */
|
/* If we ever return signal Error */
|
||||||
faultISR();
|
faultISR();
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
@ -233,8 +233,7 @@ static void
|
|||||||
nmiISR(void)
|
nmiISR(void)
|
||||||
{
|
{
|
||||||
/* Enter an infinite loop. */
|
/* Enter an infinite loop. */
|
||||||
while(1)
|
while(1) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,8 +295,7 @@ busFaultHandler(void)
|
|||||||
{
|
{
|
||||||
x__ = 0;
|
x__ = 0;
|
||||||
/* Enter an infinite loop. */
|
/* Enter an infinite loop. */
|
||||||
while(1)
|
while(1) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -312,8 +310,7 @@ static void
|
|||||||
defaultHandler(void)
|
defaultHandler(void)
|
||||||
{
|
{
|
||||||
/* Enter an infinite loop. */
|
/* Enter an infinite loop. */
|
||||||
while(1)
|
while(1) {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,5 +323,5 @@ defaultHandler(void)
|
|||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
void _fini(void)
|
void _fini(void)
|
||||||
{
|
{
|
||||||
/* Function body left empty intentionally */
|
/* Function body left empty intentionally */
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,7 @@
|
|||||||
#error "startup_cc13xx_cc26xx_iar.c: Unsupported compiler!"
|
#error "startup_cc13xx_cc26xx_iar.c: Unsupported compiler!"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* We need intrinsic functions for IAR (if used in source code) */
|
||||||
// We need intrinsic functions for IAR (if used in source code)
|
|
||||||
#include <intrinsics.h>
|
#include <intrinsics.h>
|
||||||
#include <ti/devices/DeviceFamily.h>
|
#include <ti/devices/DeviceFamily.h>
|
||||||
#include DeviceFamily_constructPath(inc/hw_types.h)
|
#include DeviceFamily_constructPath(inc/hw_types.h)
|
||||||
@ -58,48 +57,48 @@ static void faultISR( void );
|
|||||||
static void intDefaultHandler( void );
|
static void intDefaultHandler( void );
|
||||||
extern int main( void );
|
extern int main( void );
|
||||||
|
|
||||||
extern void MPUFaultIntHandler( void );
|
extern void MPUFaultIntHandler(void);
|
||||||
extern void BusFaultIntHandler( void );
|
extern void BusFaultIntHandler(void);
|
||||||
extern void UsageFaultIntHandler( void );
|
extern void UsageFaultIntHandler(void);
|
||||||
extern void SVCallIntHandler( void );
|
extern void SVCallIntHandler(void);
|
||||||
extern void DebugMonIntHandler( void );
|
extern void DebugMonIntHandler(void);
|
||||||
extern void PendSVIntHandler( void );
|
extern void PendSVIntHandler(void);
|
||||||
extern void SysTickIntHandler( void );
|
extern void SysTickIntHandler(void);
|
||||||
extern void GPIOIntHandler( void );
|
extern void GPIOIntHandler(void);
|
||||||
extern void I2CIntHandler( void );
|
extern void I2CIntHandler(void);
|
||||||
extern void RFCCPE1IntHandler( void );
|
extern void RFCCPE1IntHandler(void);
|
||||||
extern void AONRTCIntHandler( void );
|
extern void AONRTCIntHandler(void);
|
||||||
extern void UART0IntHandler( void );
|
extern void UART0IntHandler(void);
|
||||||
extern void AUXSWEvent0IntHandler( void );
|
extern void AUXSWEvent0IntHandler(void);
|
||||||
extern void SSI0IntHandler( void );
|
extern void SSI0IntHandler(void);
|
||||||
extern void SSI1IntHandler( void );
|
extern void SSI1IntHandler(void);
|
||||||
extern void RFCCPE0IntHandler( void );
|
extern void RFCCPE0IntHandler(void);
|
||||||
extern void RFCHardwareIntHandler( void );
|
extern void RFCHardwareIntHandler(void);
|
||||||
extern void RFCCmdAckIntHandler( void );
|
extern void RFCCmdAckIntHandler(void);
|
||||||
extern void I2SIntHandler( void );
|
extern void I2SIntHandler(void);
|
||||||
extern void AUXSWEvent1IntHandler( void );
|
extern void AUXSWEvent1IntHandler(void);
|
||||||
extern void WatchdogIntHandler( void );
|
extern void WatchdogIntHandler(void);
|
||||||
extern void Timer0AIntHandler( void );
|
extern void Timer0AIntHandler(void);
|
||||||
extern void Timer0BIntHandler( void );
|
extern void Timer0BIntHandler(void);
|
||||||
extern void Timer1AIntHandler( void );
|
extern void Timer1AIntHandler(void);
|
||||||
extern void Timer1BIntHandler( void );
|
extern void Timer1BIntHandler(void);
|
||||||
extern void Timer2AIntHandler( void );
|
extern void Timer2AIntHandler(void);
|
||||||
extern void Timer2BIntHandler( void );
|
extern void Timer2BIntHandler(void);
|
||||||
extern void Timer3AIntHandler( void );
|
extern void Timer3AIntHandler(void);
|
||||||
extern void Timer3BIntHandler( void );
|
extern void Timer3BIntHandler(void);
|
||||||
extern void CryptoIntHandler( void );
|
extern void CryptoIntHandler(void);
|
||||||
extern void uDMAIntHandler( void );
|
extern void uDMAIntHandler(void);
|
||||||
extern void uDMAErrIntHandler( void );
|
extern void uDMAErrIntHandler(void);
|
||||||
extern void FlashIntHandler( void );
|
extern void FlashIntHandler(void);
|
||||||
extern void SWEvent0IntHandler( void );
|
extern void SWEvent0IntHandler(void);
|
||||||
extern void AUXCombEventIntHandler( void );
|
extern void AUXCombEventIntHandler(void);
|
||||||
extern void AONProgIntHandler( void );
|
extern void AONProgIntHandler(void);
|
||||||
extern void DynProgIntHandler( void );
|
extern void DynProgIntHandler(void);
|
||||||
extern void AUXCompAIntHandler( void );
|
extern void AUXCompAIntHandler(void);
|
||||||
extern void AUXADCIntHandler( void );
|
extern void AUXADCIntHandler(void);
|
||||||
extern void TRNGIntHandler( void );
|
extern void TRNGIntHandler(void);
|
||||||
|
|
||||||
// Default interrupt handlers
|
/* Default interrupt handlers */
|
||||||
#pragma weak MPUFaultIntHandler = intDefaultHandler
|
#pragma weak MPUFaultIntHandler = intDefaultHandler
|
||||||
#pragma weak BusFaultIntHandler = intDefaultHandler
|
#pragma weak BusFaultIntHandler = intDefaultHandler
|
||||||
#pragma weak UsageFaultIntHandler = intDefaultHandler
|
#pragma weak UsageFaultIntHandler = intDefaultHandler
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
*/
|
*/
|
||||||
#include <ti/devices/DeviceFamily.h>
|
#include <ti/devices/DeviceFamily.h>
|
||||||
#if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0)
|
#if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0)
|
||||||
# include <ti/drivers/cryptoutils/cryptokey/CryptoKeyPlaintextCC26xx.c>
|
#include <ti/drivers/cryptoutils/cryptokey/CryptoKeyPlaintextCC26xx.c>
|
||||||
#endif
|
#endif
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
@ -82,7 +82,7 @@ trng_rand(uint8_t *entropy_buf, size_t entropy_len, uint32_t timeout_us)
|
|||||||
|
|
||||||
TRNG_close(trng_handle);
|
TRNG_close(trng_handle);
|
||||||
|
|
||||||
return (result == TRNG_STATUS_SUCCESS);
|
return result == TRNG_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/** @} */
|
/** @} */
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
#define netstack_cmd_rx rf_cmd_ieee_rx
|
#define netstack_cmd_rx rf_cmd_ieee_rx
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#else
|
#else
|
||||||
# error "Unsupported RF_MODE"
|
#error "Unsupported RF_MODE"
|
||||||
#endif
|
#endif
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* BLE RF settings */
|
/* BLE RF settings */
|
||||||
@ -84,7 +84,7 @@
|
|||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#else
|
#else
|
||||||
# error "Unsupported DeviceFamily_PARENT for BLE settings"
|
#error "Unsupported DeviceFamily_PARENT for BLE settings"
|
||||||
#endif
|
#endif
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#endif /* NETSTACK_SETTINGS_H_ */
|
#endif /* NETSTACK_SETTINGS_H_ */
|
||||||
|
@ -112,26 +112,26 @@ typedef struct {
|
|||||||
bool is_active;
|
bool is_active;
|
||||||
|
|
||||||
/* Periodic timer for sending out BLE advertisements */
|
/* Periodic timer for sending out BLE advertisements */
|
||||||
clock_time_t ble_adv_interval;
|
clock_time_t ble_adv_interval;
|
||||||
struct etimer ble_adv_et;
|
struct etimer ble_adv_et;
|
||||||
|
|
||||||
/* RF driver */
|
/* RF driver */
|
||||||
RF_Handle rf_handle;
|
RF_Handle rf_handle;
|
||||||
} ble_beacond_t;
|
} ble_beacond_t;
|
||||||
|
|
||||||
static ble_beacond_t ble_beacond;
|
static ble_beacond_t ble_beacond;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Configuration for TX power table */
|
/* Configuration for TX power table */
|
||||||
#ifdef BLE_MODE_CONF_TX_POWER_TABLE
|
#ifdef BLE_MODE_CONF_TX_POWER_TABLE
|
||||||
# define TX_POWER_TABLE BLE_MODE_CONF_TX_POWER_TABLE
|
#define TX_POWER_TABLE BLE_MODE_CONF_TX_POWER_TABLE
|
||||||
#else
|
#else
|
||||||
# define TX_POWER_TABLE rf_ble_tx_power_table
|
#define TX_POWER_TABLE rf_ble_tx_power_table
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef BLE_MODE_CONF_TX_POWER_TABLE_SIZE
|
#ifdef BLE_MODE_CONF_TX_POWER_TABLE_SIZE
|
||||||
# define TX_POWER_TABLE_SIZE BLE_MODE_CONF_TX_POWER_TABLE_SIZE
|
#define TX_POWER_TABLE_SIZE BLE_MODE_CONF_TX_POWER_TABLE_SIZE
|
||||||
#else
|
#else
|
||||||
# define TX_POWER_TABLE_SIZE RF_BLE_TX_POWER_TABLE_SIZE
|
#define TX_POWER_TABLE_SIZE RF_BLE_TX_POWER_TABLE_SIZE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* TX power table convenience macros */
|
/* TX power table convenience macros */
|
||||||
@ -150,7 +150,7 @@ rf_ble_beacond_init(void)
|
|||||||
RF_Params rf_params;
|
RF_Params rf_params;
|
||||||
RF_Params_init(&rf_params);
|
RF_Params_init(&rf_params);
|
||||||
|
|
||||||
/* Should immediately turn off radio if possible */
|
/* Should immediately turn off radio if possible */
|
||||||
rf_params.nInactivityTimeout = 0;
|
rf_params.nInactivityTimeout = 0;
|
||||||
|
|
||||||
ble_beacond.handle = ble_open(&rf_params);
|
ble_beacond.handle = ble_open(&rf_params);
|
||||||
@ -178,7 +178,7 @@ rf_ble_beacond_start(clock_time_t interval, const char *name)
|
|||||||
const size_t name_len = strlen(name);
|
const size_t name_len = strlen(name);
|
||||||
|
|
||||||
if((name_len == 0) ||
|
if((name_len == 0) ||
|
||||||
(name_len >= BLE_ADV_NAME_BUF_LEN)) {
|
(name_len >= BLE_ADV_NAME_BUF_LEN)) {
|
||||||
return RF_BLE_BEACOND_ERROR;
|
return RF_BLE_BEACOND_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,8 +220,8 @@ rf_ble_set_tx_power(int8_t dBm)
|
|||||||
res = rf_set_tx_power(ble_beacond.rf_handle, TX_POWER_TABLE, dbm);
|
res = rf_set_tx_power(ble_beacond.rf_handle, TX_POWER_TABLE, dbm);
|
||||||
|
|
||||||
return (res == RF_RESULT_OK)
|
return (res == RF_RESULT_OK)
|
||||||
? RF_BLE_BEACOND_OK
|
? RF_BLE_BEACOND_OK
|
||||||
: RF_BLE_BEACOND_ERROR;
|
: RF_BLE_BEACOND_ERROR;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
int8_t
|
int8_t
|
||||||
|
@ -49,9 +49,9 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
RF_BLE_BEACOND_OK,
|
RF_BLE_BEACOND_OK,
|
||||||
RF_BLE_BEACOND_ERROR,
|
RF_BLE_BEACOND_ERROR,
|
||||||
RF_BLE_BEACOND_DISABLED,
|
RF_BLE_BEACOND_DISABLED,
|
||||||
} rf_ble_beacond_result_t;
|
} rf_ble_beacond_result_t;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
|
@ -140,7 +140,7 @@ data_queue_reset(void)
|
|||||||
data_entry_t*
|
data_entry_t*
|
||||||
data_queue_current_entry(void)
|
data_queue_current_entry(void)
|
||||||
{
|
{
|
||||||
return rx_data_queue.curr_entry;
|
return rx_data_queue.curr_entry;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
|
@ -71,9 +71,9 @@
|
|||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Default band selection to band 4 - 863MHz */
|
/* Default band selection to band 4 - 863MHz */
|
||||||
#ifdef DOT_15_4G_CONF_FREQ_BAND_ID
|
#ifdef DOT_15_4G_CONF_FREQ_BAND_ID
|
||||||
# define DOT_15_4G_FREQ_BAND_ID DOT_15_4G_CONF_FREQ_BAND_ID
|
#define DOT_15_4G_FREQ_BAND_ID DOT_15_4G_CONF_FREQ_BAND_ID
|
||||||
#else
|
#else
|
||||||
# define DOT_15_4G_FREQ_BAND_ID DOT_15_4G_FREQ_BAND_863
|
#define DOT_15_4G_FREQ_BAND_ID DOT_15_4G_FREQ_BAND_863
|
||||||
#endif
|
#endif
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/*
|
/*
|
||||||
@ -84,76 +84,76 @@
|
|||||||
* DOT_15_4G_CHAN0_FREQ is specified here in KHz
|
* DOT_15_4G_CHAN0_FREQ is specified here in KHz
|
||||||
*/
|
*/
|
||||||
#if (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_470)
|
#if (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_470)
|
||||||
# define DOT_15_4G_CHAN_MIN 0
|
#define DOT_15_4G_CHAN_MIN 0
|
||||||
# define DOT_15_4G_CHAN_MAX 198
|
#define DOT_15_4G_CHAN_MAX 198
|
||||||
# define DOT_15_4G_FREQ_SPACING 200
|
#define DOT_15_4G_FREQ_SPACING 200
|
||||||
# define DOT_15_4G_CHAN0_FREQ 470200
|
#define DOT_15_4G_CHAN0_FREQ 470200
|
||||||
|
|
||||||
# define PROP_MODE_CONF_CENTER_FREQ 0x01EA
|
#define PROP_MODE_CONF_CENTER_FREQ 0x01EA
|
||||||
# define PROP_MODE_CONF_LO_DIVIDER 0x0A
|
#define PROP_MODE_CONF_LO_DIVIDER 0x0A
|
||||||
|
|
||||||
#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_780)
|
#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_780)
|
||||||
# define DOT_15_4G_CHAN_MIN 0
|
#define DOT_15_4G_CHAN_MIN 0
|
||||||
# define DOT_15_4G_CHAN_MAX 38
|
#define DOT_15_4G_CHAN_MAX 38
|
||||||
# define DOT_15_4G_FREQ_SPACING 200
|
#define DOT_15_4G_FREQ_SPACING 200
|
||||||
# define DOT_15_4G_CHAN0_FREQ 779200
|
#define DOT_15_4G_CHAN0_FREQ 779200
|
||||||
|
|
||||||
# define PROP_MODE_CONF_CENTER_FREQ 0x030F
|
#define PROP_MODE_CONF_CENTER_FREQ 0x030F
|
||||||
# define PROP_MODE_CONF_LO_DIVIDER 0x06
|
#define PROP_MODE_CONF_LO_DIVIDER 0x06
|
||||||
|
|
||||||
#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_863)
|
#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_863)
|
||||||
# define DOT_15_4G_CHAN_MIN 0
|
#define DOT_15_4G_CHAN_MIN 0
|
||||||
# define DOT_15_4G_CHAN_MAX 33
|
#define DOT_15_4G_CHAN_MAX 33
|
||||||
# define DOT_15_4G_FREQ_SPACING 200
|
#define DOT_15_4G_FREQ_SPACING 200
|
||||||
# define DOT_15_4G_CHAN0_FREQ 863125
|
#define DOT_15_4G_CHAN0_FREQ 863125
|
||||||
|
|
||||||
# define PROP_MODE_CONF_CENTER_FREQ 0x0362
|
#define PROP_MODE_CONF_CENTER_FREQ 0x0362
|
||||||
# define PROP_MODE_CONF_LO_DIVIDER 0x05
|
#define PROP_MODE_CONF_LO_DIVIDER 0x05
|
||||||
|
|
||||||
#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_915)
|
#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_915)
|
||||||
# define DOT_15_4G_CHAN_MIN 0
|
#define DOT_15_4G_CHAN_MIN 0
|
||||||
# define DOT_15_4G_CHAN_MAX 128
|
#define DOT_15_4G_CHAN_MAX 128
|
||||||
# define DOT_15_4G_FREQ_SPACING 200
|
#define DOT_15_4G_FREQ_SPACING 200
|
||||||
# define DOT_15_4G_CHAN0_FREQ 902200
|
#define DOT_15_4G_CHAN0_FREQ 902200
|
||||||
|
|
||||||
# define PROP_MODE_CONF_CENTER_FREQ 0x0393
|
#define PROP_MODE_CONF_CENTER_FREQ 0x0393
|
||||||
# define PROP_MODE_CONF_LO_DIVIDER 0x05
|
#define PROP_MODE_CONF_LO_DIVIDER 0x05
|
||||||
|
|
||||||
#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_920)
|
#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_920)
|
||||||
# define DOT_15_4G_CHAN_MIN 0
|
#define DOT_15_4G_CHAN_MIN 0
|
||||||
# define DOT_15_4G_CHAN_MAX 37
|
#define DOT_15_4G_CHAN_MAX 37
|
||||||
# define DOT_15_4G_FREQ_SPACING 200
|
#define DOT_15_4G_FREQ_SPACING 200
|
||||||
# define DOT_15_4G_CHAN0_FREQ 920600
|
#define DOT_15_4G_CHAN0_FREQ 920600
|
||||||
|
|
||||||
# define PROP_MODE_CONF_CENTER_FREQ 0x039C
|
#define PROP_MODE_CONF_CENTER_FREQ 0x039C
|
||||||
# define PROP_MODE_CONF_LO_DIVIDER 0x05
|
#define PROP_MODE_CONF_LO_DIVIDER 0x05
|
||||||
|
|
||||||
#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_950)
|
#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_950)
|
||||||
# define DOT_15_4G_CHAN_MIN 0
|
#define DOT_15_4G_CHAN_MIN 0
|
||||||
# define DOT_15_4G_CHAN_MAX 32
|
#define DOT_15_4G_CHAN_MAX 32
|
||||||
# define DOT_15_4G_FREQ_SPACING 200
|
#define DOT_15_4G_FREQ_SPACING 200
|
||||||
# define DOT_15_4G_CHAN0_FREQ 951000
|
#define DOT_15_4G_CHAN0_FREQ 951000
|
||||||
|
|
||||||
# define PROP_MODE_CONF_CENTER_FREQ 0x03BA
|
#define PROP_MODE_CONF_CENTER_FREQ 0x03BA
|
||||||
# define PROP_MODE_CONF_LO_DIVIDER 0x05
|
#define PROP_MODE_CONF_LO_DIVIDER 0x05
|
||||||
|
|
||||||
#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_2450)
|
#elif (DOT_15_4G_FREQ_BAND_ID == DOT_15_4G_FREQ_BAND_2450)
|
||||||
# define DOT_15_4G_CHAN_MIN 11
|
#define DOT_15_4G_CHAN_MIN 11
|
||||||
# define DOT_15_4G_CHAN_MAX 26
|
#define DOT_15_4G_CHAN_MAX 26
|
||||||
# define DOT_15_4G_FREQ_SPACING 5000
|
#define DOT_15_4G_FREQ_SPACING 5000
|
||||||
# define DOT_15_4G_CHAN0_FREQ 2405000
|
#define DOT_15_4G_CHAN0_FREQ 2405000
|
||||||
|
|
||||||
#else
|
#else
|
||||||
# error "The selected IEEE 802.15.4g frequency band is not supported"
|
#error "The selected IEEE 802.15.4g frequency band is not supported"
|
||||||
#endif
|
#endif
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static inline uint32_t
|
static inline uint32_t
|
||||||
dot_15_4g_freq(const uint16_t chan)
|
dot_15_4g_freq(const uint16_t chan)
|
||||||
{
|
{
|
||||||
const uint32_t chan0 = DOT_15_4G_CHAN0_FREQ;
|
const uint32_t chan0 = DOT_15_4G_CHAN0_FREQ;
|
||||||
const uint32_t spacing = DOT_15_4G_FREQ_SPACING;
|
const uint32_t spacing = DOT_15_4G_FREQ_SPACING;
|
||||||
const uint32_t chan_min = DOT_15_4G_CHAN_MIN;
|
const uint32_t chan_min = DOT_15_4G_CHAN_MIN;
|
||||||
return (chan0 + spacing * ((uint32_t)chan - chan_min));
|
return chan0 + spacing * ((uint32_t)chan - chan_min);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static inline bool
|
static inline bool
|
||||||
@ -161,8 +161,8 @@ dot_15_4g_chan_in_range(const uint16_t chan)
|
|||||||
{
|
{
|
||||||
const uint16_t chan_min = DOT_15_4G_CHAN_MIN;
|
const uint16_t chan_min = DOT_15_4G_CHAN_MIN;
|
||||||
const uint16_t chan_max = DOT_15_4G_CHAN_MAX;
|
const uint16_t chan_max = DOT_15_4G_CHAN_MAX;
|
||||||
return ((chan >= chan_min) &&
|
return (chan >= chan_min) &&
|
||||||
(chan <= chan_max));
|
(chan <= chan_max);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#define DOT_15_4G_DEFAULT_CHAN IEEE802154_DEFAULT_CHANNEL
|
#define DOT_15_4G_DEFAULT_CHAN IEEE802154_DEFAULT_CHANNEL
|
||||||
|
@ -80,7 +80,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#if 1
|
#if 1
|
||||||
# define PRINTF(...) printf(__VA_ARGS__)
|
#define PRINTF(...) printf(__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
# define PRINTF(...)
|
# define PRINTF(...)
|
||||||
#endif
|
#endif
|
||||||
@ -89,23 +89,23 @@
|
|||||||
|
|
||||||
/* Configuration to enable/disable auto ACKs in IEEE mode */
|
/* Configuration to enable/disable auto ACKs in IEEE mode */
|
||||||
#ifdef IEEE_MODE_CONF_AUTOACK
|
#ifdef IEEE_MODE_CONF_AUTOACK
|
||||||
# define IEEE_MODE_AUTOACK IEEE_MODE_CONF_AUTOACK
|
#define IEEE_MODE_AUTOACK IEEE_MODE_CONF_AUTOACK
|
||||||
#else
|
#else
|
||||||
# define IEEE_MODE_AUTOACK 1
|
#define IEEE_MODE_AUTOACK 1
|
||||||
#endif /* IEEE_MODE_CONF_AUTOACK */
|
#endif /* IEEE_MODE_CONF_AUTOACK */
|
||||||
|
|
||||||
/* Configuration to enable/disable frame filtering in IEEE mode */
|
/* Configuration to enable/disable frame filtering in IEEE mode */
|
||||||
#ifdef IEEE_MODE_CONF_PROMISCOUS
|
#ifdef IEEE_MODE_CONF_PROMISCOUS
|
||||||
# define IEEE_MODE_PROMISCOUS IEEE_MODE_CONF_PROMISCOUS
|
#define IEEE_MODE_PROMISCOUS IEEE_MODE_CONF_PROMISCOUS
|
||||||
#else
|
#else
|
||||||
# define IEEE_MODE_PROMISCOUS 0
|
#define IEEE_MODE_PROMISCOUS 0
|
||||||
#endif /* IEEE_MODE_CONF_PROMISCOUS */
|
#endif /* IEEE_MODE_CONF_PROMISCOUS */
|
||||||
|
|
||||||
/* Configuration to set the RSSI threshold */
|
/* Configuration to set the RSSI threshold */
|
||||||
#ifdef IEEE_MODE_CONF_RSSI_THRESHOLD
|
#ifdef IEEE_MODE_CONF_RSSI_THRESHOLD
|
||||||
# define IEEE_MODE_RSSI_THRESHOLD IEEE_MODE_CONF_RSSI_THRESHOLD
|
#define IEEE_MODE_RSSI_THRESHOLD IEEE_MODE_CONF_RSSI_THRESHOLD
|
||||||
#else
|
#else
|
||||||
# define IEEE_MODE_RSSI_THRESHOLD 0xA6
|
#define IEEE_MODE_RSSI_THRESHOLD 0xA6
|
||||||
#endif /* IEEE_MODE_CONF_RSSI_THRESHOLD */
|
#endif /* IEEE_MODE_CONF_RSSI_THRESHOLD */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* TX power table convenience macros */
|
/* TX power table convenience macros */
|
||||||
@ -206,7 +206,11 @@ static cmd_mod_filt_t cmd_mod_filt;
|
|||||||
#define cmd_rx (*(volatile rfc_CMD_IEEE_RX_t*) &rf_cmd_ieee_rx)
|
#define cmd_rx (*(volatile rfc_CMD_IEEE_RX_t*) &rf_cmd_ieee_rx)
|
||||||
#define cmd_rx_ack (*(volatile rfc_CMD_IEEE_RX_ACK_t*)&rf_cmd_ieee_rx_ack)
|
#define cmd_rx_ack (*(volatile rfc_CMD_IEEE_RX_ACK_t*)&rf_cmd_ieee_rx_ack)
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static inline bool rx_is_active(void) { return cmd_rx.status == ACTIVE; }
|
static inline bool
|
||||||
|
rx_is_active(void)
|
||||||
|
{
|
||||||
|
return cmd_rx.status == ACTIVE;
|
||||||
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Forward declarations of local functions */
|
/* Forward declarations of local functions */
|
||||||
static void check_rat_overflow(void);
|
static void check_rat_overflow(void);
|
||||||
@ -515,7 +519,7 @@ read(void *buf, unsigned short buf_len)
|
|||||||
const rtimer_clock_t t0 = RTIMER_NOW();
|
const rtimer_clock_t t0 = RTIMER_NOW();
|
||||||
/* Only wait if the Radio timer is accessing the entry */
|
/* Only wait if the Radio timer is accessing the entry */
|
||||||
while((data_entry->status == DATA_ENTRY_BUSY) &&
|
while((data_entry->status == DATA_ENTRY_BUSY) &&
|
||||||
RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + TIMEOUT_DATA_ENTRY_BUSY));
|
RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + TIMEOUT_DATA_ENTRY_BUSY)) ;
|
||||||
|
|
||||||
if(data_entry->status != DATA_ENTRY_FINISHED) {
|
if(data_entry->status != DATA_ENTRY_FINISHED) {
|
||||||
/* No available data */
|
/* No available data */
|
||||||
@ -602,7 +606,7 @@ cca_request(cmd_cca_req_t *cmd_cca_req)
|
|||||||
|
|
||||||
const rtimer_clock_t t0 = RTIMER_NOW();
|
const rtimer_clock_t t0 = RTIMER_NOW();
|
||||||
while((cmd_rx.status != ACTIVE) &&
|
while((cmd_rx.status != ACTIVE) &&
|
||||||
RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + TIMEOUT_ENTER_RX_WAIT));
|
RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + TIMEOUT_ENTER_RX_WAIT)) ;
|
||||||
|
|
||||||
RF_Stat stat = RF_StatRadioInactiveError;
|
RF_Stat stat = RF_StatRadioInactiveError;
|
||||||
if(rx_is_active()) {
|
if(rx_is_active()) {
|
||||||
@ -614,8 +618,8 @@ cca_request(cmd_cca_req_t *cmd_cca_req)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (stat == RF_StatCmdDoneSuccess)
|
return (stat == RF_StatCmdDoneSuccess)
|
||||||
? RF_RESULT_OK
|
? RF_RESULT_OK
|
||||||
: RF_RESULT_ERROR;
|
: RF_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int
|
static int
|
||||||
@ -630,7 +634,7 @@ channel_clear(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Channel is clear if CCA state is IDLE */
|
/* Channel is clear if CCA state is IDLE */
|
||||||
return (cmd_cca_req.ccaInfo.ccaState == CCA_STATE_IDLE);
|
return cmd_cca_req.ccaInfo.ccaState == CCA_STATE_IDLE;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int
|
static int
|
||||||
@ -646,14 +650,14 @@ receiving_packet(void)
|
|||||||
|
|
||||||
/* If we are transmitting (can only be an ACK here), we are not receiving */
|
/* If we are transmitting (can only be an ACK here), we are not receiving */
|
||||||
if((cmd_cca_req.ccaInfo.ccaEnergy == CCA_STATE_BUSY) &&
|
if((cmd_cca_req.ccaInfo.ccaEnergy == CCA_STATE_BUSY) &&
|
||||||
(cmd_cca_req.ccaInfo.ccaCorr == CCA_STATE_BUSY) &&
|
(cmd_cca_req.ccaInfo.ccaCorr == CCA_STATE_BUSY) &&
|
||||||
(cmd_cca_req.ccaInfo.ccaSync == CCA_STATE_BUSY)) {
|
(cmd_cca_req.ccaInfo.ccaSync == CCA_STATE_BUSY)) {
|
||||||
PRINTF("receiving_packet: we were TXing ACK\n");
|
PRINTF("receiving_packet: we were TXing ACK\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We are receiving a packet if a CCA sync has been seen, i.e. ccaSync is busy (1) */
|
/* We are receiving a packet if a CCA sync has been seen, i.e. ccaSync is busy (1) */
|
||||||
return (cmd_cca_req.ccaInfo.ccaSync == CCA_STATE_BUSY);
|
return cmd_cca_req.ccaInfo.ccaSync == CCA_STATE_BUSY;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int
|
static int
|
||||||
@ -668,7 +672,7 @@ pending_packet(void)
|
|||||||
do {
|
do {
|
||||||
const uint8_t status = curr_entry->status;
|
const uint8_t status = curr_entry->status;
|
||||||
if((status == DATA_ENTRY_FINISHED) ||
|
if((status == DATA_ENTRY_FINISHED) ||
|
||||||
(status == DATA_ENTRY_BUSY)) {
|
(status == DATA_ENTRY_BUSY)) {
|
||||||
num_pending += 1;
|
num_pending += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -777,8 +781,8 @@ get_value(radio_param_t param, radio_value_t *value)
|
|||||||
res = rf_get_tx_power(ieee_radio.rf_handle, TX_POWER_TABLE, (int8_t*)&value);
|
res = rf_get_tx_power(ieee_radio.rf_handle, TX_POWER_TABLE, (int8_t*)&value);
|
||||||
return ((res == RF_RESULT_OK) &&
|
return ((res == RF_RESULT_OK) &&
|
||||||
(*value != RF_TxPowerTable_INVALID_DBM))
|
(*value != RF_TxPowerTable_INVALID_DBM))
|
||||||
? RADIO_RESULT_OK
|
? RADIO_RESULT_OK
|
||||||
: RADIO_RESULT_ERROR;
|
: RADIO_RESULT_ERROR;
|
||||||
|
|
||||||
/* CCA threshold */
|
/* CCA threshold */
|
||||||
case RADIO_PARAM_CCA_THRESHOLD:
|
case RADIO_PARAM_CCA_THRESHOLD:
|
||||||
@ -789,8 +793,8 @@ get_value(radio_param_t param, radio_value_t *value)
|
|||||||
case RADIO_PARAM_RSSI:
|
case RADIO_PARAM_RSSI:
|
||||||
*value = RF_getRssi(ieee_radio.rf_handle);
|
*value = RF_getRssi(ieee_radio.rf_handle);
|
||||||
return (*value == RF_GET_RSSI_ERROR_VAL)
|
return (*value == RF_GET_RSSI_ERROR_VAL)
|
||||||
? RADIO_RESULT_ERROR
|
? RADIO_RESULT_ERROR
|
||||||
: RADIO_RESULT_OK;
|
: RADIO_RESULT_OK;
|
||||||
|
|
||||||
/* Channel min */
|
/* Channel min */
|
||||||
case RADIO_CONST_CHANNEL_MIN:
|
case RADIO_CONST_CHANNEL_MIN:
|
||||||
@ -838,9 +842,8 @@ set_value(radio_param_t param, radio_value_t value)
|
|||||||
|
|
||||||
if(value == RADIO_POWER_MODE_ON) {
|
if(value == RADIO_POWER_MODE_ON) {
|
||||||
return (on() == RF_RESULT_OK)
|
return (on() == RF_RESULT_OK)
|
||||||
? RADIO_RESULT_OK
|
? RADIO_RESULT_OK
|
||||||
: RADIO_RESULT_ERROR;
|
: RADIO_RESULT_ERROR;
|
||||||
|
|
||||||
} else if(value == RADIO_POWER_MODE_OFF) {
|
} else if(value == RADIO_POWER_MODE_OFF) {
|
||||||
off();
|
off();
|
||||||
return RADIO_RESULT_OK;
|
return RADIO_RESULT_OK;
|
||||||
@ -866,8 +869,8 @@ set_value(radio_param_t param, radio_value_t value)
|
|||||||
netstack_stop_rx();
|
netstack_stop_rx();
|
||||||
res = netstack_sched_rx(false);
|
res = netstack_sched_rx(false);
|
||||||
return (res == RF_RESULT_OK)
|
return (res == RF_RESULT_OK)
|
||||||
? RADIO_RESULT_OK
|
? RADIO_RESULT_OK
|
||||||
: RADIO_RESULT_ERROR;
|
: RADIO_RESULT_ERROR;
|
||||||
|
|
||||||
/* 16bit address */
|
/* 16bit address */
|
||||||
case RADIO_PARAM_16BIT_ADDR:
|
case RADIO_PARAM_16BIT_ADDR:
|
||||||
@ -879,8 +882,8 @@ set_value(radio_param_t param, radio_value_t value)
|
|||||||
netstack_stop_rx();
|
netstack_stop_rx();
|
||||||
res = netstack_sched_rx(false);
|
res = netstack_sched_rx(false);
|
||||||
return (res == RF_RESULT_OK)
|
return (res == RF_RESULT_OK)
|
||||||
? RADIO_RESULT_OK
|
? RADIO_RESULT_OK
|
||||||
: RADIO_RESULT_ERROR;
|
: RADIO_RESULT_ERROR;
|
||||||
|
|
||||||
/* RX Mode */
|
/* RX Mode */
|
||||||
case RADIO_PARAM_RX_MODE: {
|
case RADIO_PARAM_RX_MODE: {
|
||||||
@ -918,8 +921,8 @@ set_value(radio_param_t param, radio_value_t value)
|
|||||||
netstack_stop_rx();
|
netstack_stop_rx();
|
||||||
res = netstack_sched_rx(false);
|
res = netstack_sched_rx(false);
|
||||||
return (res == RF_RESULT_OK)
|
return (res == RF_RESULT_OK)
|
||||||
? RADIO_RESULT_OK
|
? RADIO_RESULT_OK
|
||||||
: RADIO_RESULT_ERROR;
|
: RADIO_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TX Mode */
|
/* TX Mode */
|
||||||
@ -937,8 +940,8 @@ set_value(radio_param_t param, radio_value_t value)
|
|||||||
}
|
}
|
||||||
res = rf_set_tx_power(ieee_radio.rf_handle, TX_POWER_TABLE, (int8_t)value);
|
res = rf_set_tx_power(ieee_radio.rf_handle, TX_POWER_TABLE, (int8_t)value);
|
||||||
return (res == RF_RESULT_OK)
|
return (res == RF_RESULT_OK)
|
||||||
? RADIO_RESULT_OK
|
? RADIO_RESULT_OK
|
||||||
: RADIO_RESULT_ERROR;
|
: RADIO_RESULT_ERROR;
|
||||||
|
|
||||||
/* CCA Threshold */
|
/* CCA Threshold */
|
||||||
case RADIO_PARAM_CCA_THRESHOLD:
|
case RADIO_PARAM_CCA_THRESHOLD:
|
||||||
@ -950,8 +953,8 @@ set_value(radio_param_t param, radio_value_t value)
|
|||||||
netstack_stop_rx();
|
netstack_stop_rx();
|
||||||
res = netstack_sched_rx(false);
|
res = netstack_sched_rx(false);
|
||||||
return (res == RF_RESULT_OK)
|
return (res == RF_RESULT_OK)
|
||||||
? RADIO_RESULT_OK
|
? RADIO_RESULT_OK
|
||||||
: RADIO_RESULT_ERROR;
|
: RADIO_RESULT_ERROR;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return RADIO_RESULT_NOT_SUPPORTED;
|
return RADIO_RESULT_NOT_SUPPORTED;
|
||||||
@ -1026,8 +1029,8 @@ set_object(radio_param_t param, const void *src, size_t size)
|
|||||||
netstack_stop_rx();
|
netstack_stop_rx();
|
||||||
res = netstack_sched_rx(false);
|
res = netstack_sched_rx(false);
|
||||||
return (res == RF_RESULT_OK)
|
return (res == RF_RESULT_OK)
|
||||||
? RADIO_RESULT_OK
|
? RADIO_RESULT_OK
|
||||||
: RADIO_RESULT_ERROR;
|
: RADIO_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return RADIO_RESULT_NOT_SUPPORTED;
|
return RADIO_RESULT_NOT_SUPPORTED;
|
||||||
|
@ -85,15 +85,15 @@
|
|||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Data whitener. 1: Whitener, 0: No whitener */
|
/* Data whitener. 1: Whitener, 0: No whitener */
|
||||||
#ifdef PROP_MODE_CONF_DW
|
#ifdef PROP_MODE_CONF_DW
|
||||||
# define PROP_MODE_DW PROP_MODE_CONF_DW
|
#define PROP_MODE_DW PROP_MODE_CONF_DW
|
||||||
#else
|
#else
|
||||||
# define PROP_MODE_DW 0
|
#define PROP_MODE_DW 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PROP_MODE_CONF_USE_CRC16
|
#ifdef PROP_MODE_CONF_USE_CRC16
|
||||||
# define PROP_MODE_USE_CRC16 PROP_MODE_CONF_USE_CRC16
|
#define PROP_MODE_USE_CRC16 PROP_MODE_CONF_USE_CRC16
|
||||||
#else
|
#else
|
||||||
# define PROP_MODE_USE_CRC16 0
|
#define PROP_MODE_USE_CRC16 0
|
||||||
#endif
|
#endif
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Used for checking result of CCA_REQ command */
|
/* Used for checking result of CCA_REQ command */
|
||||||
@ -105,9 +105,9 @@
|
|||||||
#define RF_GET_CCA_INFO_ERROR 0xFF
|
#define RF_GET_CCA_INFO_ERROR 0xFF
|
||||||
|
|
||||||
#ifdef PROP_MODE_CONF_RSSI_THRESHOLD
|
#ifdef PROP_MODE_CONF_RSSI_THRESHOLD
|
||||||
# define PROP_MODE_RSSI_THRESHOLD PROP_MODE_CONF_RSSI_THRESHOLD
|
#define PROP_MODE_RSSI_THRESHOLD PROP_MODE_CONF_RSSI_THRESHOLD
|
||||||
#else
|
#else
|
||||||
# define PROP_MODE_RSSI_THRESHOLD 0xA6
|
#define PROP_MODE_RSSI_THRESHOLD 0xA6
|
||||||
#endif
|
#endif
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Defines and variables related to the .15.4g PHY HDR */
|
/* Defines and variables related to the .15.4g PHY HDR */
|
||||||
@ -120,18 +120,18 @@
|
|||||||
|
|
||||||
#if PROP_MODE_USE_CRC16
|
#if PROP_MODE_USE_CRC16
|
||||||
/* CRC16 */
|
/* CRC16 */
|
||||||
# define DOT_4G_PHR_CRC_BIT DOT_4G_PHR_CRC16
|
#define DOT_4G_PHR_CRC_BIT DOT_4G_PHR_CRC16
|
||||||
# define CRC_LEN 2
|
#define CRC_LEN 2
|
||||||
#else
|
#else
|
||||||
/* CRC32 */
|
/* CRC32 */
|
||||||
# define DOT_4G_PHR_CRC_BIT 0
|
#define DOT_4G_PHR_CRC_BIT 0
|
||||||
# define CRC_LEN 4
|
#define CRC_LEN 4
|
||||||
#endif /* PROP_MODE_USE_CRC16 */
|
#endif /* PROP_MODE_USE_CRC16 */
|
||||||
|
|
||||||
#if PROP_MODE_DW
|
#if PROP_MODE_DW
|
||||||
# define DOT_4G_PHR_DW_BIT DOT_4G_PHR_DW
|
#define DOT_4G_PHR_DW_BIT DOT_4G_PHR_DW
|
||||||
#else
|
#else
|
||||||
#define DOT_4G_PHR_DW_BIT 0
|
#define DOT_4G_PHR_DW_BIT 0
|
||||||
#endif
|
#endif
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* How long to wait for the RF to enter RX in rf_cmd_ieee_rx */
|
/* How long to wait for the RF to enter RX in rf_cmd_ieee_rx */
|
||||||
@ -197,8 +197,16 @@ static prop_radio_t prop_radio;
|
|||||||
#define cmd_tx (*(volatile rfc_CMD_PROP_TX_ADV_t *) &rf_cmd_prop_tx_adv)
|
#define cmd_tx (*(volatile rfc_CMD_PROP_TX_ADV_t *) &rf_cmd_prop_tx_adv)
|
||||||
#define cmd_rx (*(volatile rfc_CMD_PROP_RX_ADV_t *) &rf_cmd_prop_rx_adv)
|
#define cmd_rx (*(volatile rfc_CMD_PROP_RX_ADV_t *) &rf_cmd_prop_rx_adv)
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static inline bool tx_is_active(void) { return cmd_tx.status == ACTIVE; }
|
static inline bool
|
||||||
static inline bool rx_is_active(void) { return cmd_rx.status == ACTIVE; }
|
tx_is_active(void)
|
||||||
|
{
|
||||||
|
return cmd_tx.status == ACTIVE;
|
||||||
|
}
|
||||||
|
static inline bool
|
||||||
|
rx_is_active(void)
|
||||||
|
{
|
||||||
|
return cmd_rx.status == ACTIVE;
|
||||||
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int on(void);
|
static int on(void);
|
||||||
static int off(void);
|
static int off(void);
|
||||||
@ -232,7 +240,7 @@ get_rssi(void)
|
|||||||
|
|
||||||
const rtimer_clock_t t0 = RTIMER_NOW();
|
const rtimer_clock_t t0 = RTIMER_NOW();
|
||||||
while((cmd_rx.status != ACTIVE) &&
|
while((cmd_rx.status != ACTIVE) &&
|
||||||
RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + TIMEOUT_ENTER_RX_WAIT));
|
RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + TIMEOUT_ENTER_RX_WAIT)) ;
|
||||||
|
|
||||||
int8_t rssi = RF_GET_RSSI_ERROR_VAL;
|
int8_t rssi = RF_GET_RSSI_ERROR_VAL;
|
||||||
if(rx_is_active()) {
|
if(rx_is_active()) {
|
||||||
@ -358,8 +366,8 @@ transmit(unsigned short transmit_len)
|
|||||||
res = netstack_sched_prop_tx();
|
res = netstack_sched_prop_tx();
|
||||||
|
|
||||||
return (res == RF_RESULT_OK)
|
return (res == RF_RESULT_OK)
|
||||||
? RADIO_TX_OK
|
? RADIO_TX_OK
|
||||||
: RADIO_TX_ERR;
|
: RADIO_TX_ERR;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int
|
static int
|
||||||
@ -377,7 +385,7 @@ read(void *buf, unsigned short buf_len)
|
|||||||
const rtimer_clock_t t0 = RTIMER_NOW();
|
const rtimer_clock_t t0 = RTIMER_NOW();
|
||||||
/* Only wait if the Radio is accessing the entry */
|
/* Only wait if the Radio is accessing the entry */
|
||||||
while((data_entry->status == DATA_ENTRY_BUSY) &&
|
while((data_entry->status == DATA_ENTRY_BUSY) &&
|
||||||
RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + TIMEOUT_DATA_ENTRY_BUSY));
|
RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + TIMEOUT_DATA_ENTRY_BUSY)) ;
|
||||||
|
|
||||||
if(data_entry->status != DATA_ENTRY_FINISHED) {
|
if(data_entry->status != DATA_ENTRY_FINISHED) {
|
||||||
/* No available data */
|
/* No available data */
|
||||||
@ -451,8 +459,8 @@ cca_request(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (rssi < prop_radio.rssi_threshold)
|
return (rssi < prop_radio.rssi_threshold)
|
||||||
? CCA_STATE_IDLE
|
? CCA_STATE_IDLE
|
||||||
: CCA_STATE_BUSY;
|
: CCA_STATE_BUSY;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int
|
static int
|
||||||
@ -466,7 +474,7 @@ channel_clear(void)
|
|||||||
const uint8_t cca_state = cca_request();
|
const uint8_t cca_state = cca_request();
|
||||||
|
|
||||||
/* Channel is clear if CCA state is IDLE */
|
/* Channel is clear if CCA state is IDLE */
|
||||||
return (cca_state == CCA_STATE_IDLE);
|
return cca_state == CCA_STATE_IDLE;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int
|
static int
|
||||||
@ -478,7 +486,7 @@ receiving_packet(void)
|
|||||||
|
|
||||||
const uint8_t cca_state = cca_request();
|
const uint8_t cca_state = cca_request();
|
||||||
|
|
||||||
return (cca_state == CCA_STATE_BUSY);
|
return cca_state == CCA_STATE_BUSY;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int
|
static int
|
||||||
@ -493,7 +501,7 @@ pending_packet(void)
|
|||||||
do {
|
do {
|
||||||
const uint8_t status = curr_entry->status;
|
const uint8_t status = curr_entry->status;
|
||||||
if((status == DATA_ENTRY_FINISHED) ||
|
if((status == DATA_ENTRY_FINISHED) ||
|
||||||
(status == DATA_ENTRY_BUSY)) {
|
(status == DATA_ENTRY_BUSY)) {
|
||||||
num_pending += 1;
|
num_pending += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -558,8 +566,8 @@ get_value(radio_param_t param, radio_value_t *value)
|
|||||||
case RADIO_PARAM_POWER_MODE:
|
case RADIO_PARAM_POWER_MODE:
|
||||||
/* On / off */
|
/* On / off */
|
||||||
*value = (prop_radio.rf_is_on)
|
*value = (prop_radio.rf_is_on)
|
||||||
? RADIO_POWER_MODE_ON
|
? RADIO_POWER_MODE_ON
|
||||||
: RADIO_POWER_MODE_OFF;
|
: RADIO_POWER_MODE_OFF;
|
||||||
|
|
||||||
return RADIO_RESULT_OK;
|
return RADIO_RESULT_OK;
|
||||||
|
|
||||||
@ -571,8 +579,8 @@ get_value(radio_param_t param, radio_value_t *value)
|
|||||||
res = rf_get_tx_power(prop_radio.rf_handle, TX_POWER_TABLE, (int8_t*)&value);
|
res = rf_get_tx_power(prop_radio.rf_handle, TX_POWER_TABLE, (int8_t*)&value);
|
||||||
return ((res == RF_RESULT_OK) &&
|
return ((res == RF_RESULT_OK) &&
|
||||||
(*value != RF_TxPowerTable_INVALID_DBM))
|
(*value != RF_TxPowerTable_INVALID_DBM))
|
||||||
? RADIO_RESULT_OK
|
? RADIO_RESULT_OK
|
||||||
: RADIO_RESULT_ERROR;
|
: RADIO_RESULT_ERROR;
|
||||||
|
|
||||||
case RADIO_PARAM_CCA_THRESHOLD:
|
case RADIO_PARAM_CCA_THRESHOLD:
|
||||||
*value = prop_radio.rssi_threshold;
|
*value = prop_radio.rssi_threshold;
|
||||||
@ -581,8 +589,8 @@ get_value(radio_param_t param, radio_value_t *value)
|
|||||||
case RADIO_PARAM_RSSI:
|
case RADIO_PARAM_RSSI:
|
||||||
*value = get_rssi();
|
*value = get_rssi();
|
||||||
return (*value == RF_GET_RSSI_ERROR_VAL)
|
return (*value == RF_GET_RSSI_ERROR_VAL)
|
||||||
? RADIO_RESULT_ERROR
|
? RADIO_RESULT_ERROR
|
||||||
: RADIO_RESULT_OK;
|
: RADIO_RESULT_OK;
|
||||||
|
|
||||||
case RADIO_CONST_CHANNEL_MIN:
|
case RADIO_CONST_CHANNEL_MIN:
|
||||||
*value = DOT_15_4G_CHAN_MIN;
|
*value = DOT_15_4G_CHAN_MIN;
|
||||||
@ -615,9 +623,8 @@ set_value(radio_param_t param, radio_value_t value)
|
|||||||
|
|
||||||
if(value == RADIO_POWER_MODE_ON) {
|
if(value == RADIO_POWER_MODE_ON) {
|
||||||
return (on() == RF_RESULT_OK)
|
return (on() == RF_RESULT_OK)
|
||||||
? RADIO_RESULT_OK
|
? RADIO_RESULT_OK
|
||||||
: RADIO_RESULT_ERROR;
|
: RADIO_RESULT_ERROR;
|
||||||
|
|
||||||
} else if(value == RADIO_POWER_MODE_OFF) {
|
} else if(value == RADIO_POWER_MODE_OFF) {
|
||||||
off();
|
off();
|
||||||
return RADIO_RESULT_OK;
|
return RADIO_RESULT_OK;
|
||||||
@ -628,8 +635,8 @@ set_value(radio_param_t param, radio_value_t value)
|
|||||||
case RADIO_PARAM_CHANNEL:
|
case RADIO_PARAM_CHANNEL:
|
||||||
res = set_channel((uint16_t)value);
|
res = set_channel((uint16_t)value);
|
||||||
return (res == RF_RESULT_OK)
|
return (res == RF_RESULT_OK)
|
||||||
? RADIO_RESULT_OK
|
? RADIO_RESULT_OK
|
||||||
: RADIO_RESULT_ERROR;
|
: RADIO_RESULT_ERROR;
|
||||||
|
|
||||||
case RADIO_PARAM_TXPOWER:
|
case RADIO_PARAM_TXPOWER:
|
||||||
if(!TX_POWER_IN_RANGE((int8_t)value)) {
|
if(!TX_POWER_IN_RANGE((int8_t)value)) {
|
||||||
@ -637,8 +644,8 @@ set_value(radio_param_t param, radio_value_t value)
|
|||||||
}
|
}
|
||||||
res = rf_set_tx_power(prop_radio.rf_handle, TX_POWER_TABLE, (int8_t)value);
|
res = rf_set_tx_power(prop_radio.rf_handle, TX_POWER_TABLE, (int8_t)value);
|
||||||
return (res == RF_RESULT_OK)
|
return (res == RF_RESULT_OK)
|
||||||
? RADIO_RESULT_OK
|
? RADIO_RESULT_OK
|
||||||
: RADIO_RESULT_ERROR;
|
: RADIO_RESULT_ERROR;
|
||||||
|
|
||||||
case RADIO_PARAM_RX_MODE:
|
case RADIO_PARAM_RX_MODE:
|
||||||
return RADIO_RESULT_OK;
|
return RADIO_RESULT_OK;
|
||||||
|
@ -64,9 +64,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#if 1
|
#if 1
|
||||||
# define PRINTF(...) printf(__VA_ARGS__)
|
#define PRINTF(...) printf(__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
# define PRINTF(...)
|
#define PRINTF(...)
|
||||||
#endif
|
#endif
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#define CMD_FS_RETRIES 3
|
#define CMD_FS_RETRIES 3
|
||||||
@ -88,12 +88,12 @@
|
|||||||
|
|
||||||
static struct etimer synth_recal_timer;
|
static struct etimer synth_recal_timer;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static RF_Object rf_netstack;
|
static RF_Object rf_netstack;
|
||||||
static RF_Object rf_ble;
|
static RF_Object rf_ble;
|
||||||
|
|
||||||
static RF_CmdHandle cmd_rx_handle;
|
static RF_CmdHandle cmd_rx_handle;
|
||||||
|
|
||||||
static bool rf_is_on;
|
static bool rf_is_on;
|
||||||
static volatile bool rx_buf_full;
|
static volatile bool rx_buf_full;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
@ -214,8 +214,8 @@ rf_set_tx_power(RF_Handle handle, RF_TxPowerTable_Entry *table, int8_t dbm)
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (stat == RF_StatSuccess)
|
return (stat == RF_StatSuccess)
|
||||||
? RF_RESULT_OK
|
? RF_RESULT_OK
|
||||||
: RF_RESULT_ERROR;
|
: RF_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
rf_result_t
|
rf_result_t
|
||||||
@ -226,8 +226,8 @@ rf_get_tx_power(RF_Handle handle, RF_TxPowerTable_Entry *table, int8_t *dbm)
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (*dbm != RF_TxPowerTable_INVALID_DBM)
|
return (*dbm != RF_TxPowerTable_INVALID_DBM)
|
||||||
? RF_RESULT_OK
|
? RF_RESULT_OK
|
||||||
: RF_RESULT_ERROR;
|
: RF_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
RF_Handle
|
RF_Handle
|
||||||
@ -275,15 +275,14 @@ netstack_sched_fs(void)
|
|||||||
);
|
);
|
||||||
|
|
||||||
synth_error = (EVENTS_CMD_DONE(events))
|
synth_error = (EVENTS_CMD_DONE(events))
|
||||||
&& (CMD_STATUS(netstack_cmd_fs) == ERROR_SYNTH_PROG);
|
&& (CMD_STATUS(netstack_cmd_fs) == ERROR_SYNTH_PROG);
|
||||||
|
|
||||||
} while(synth_error && (num_tries++ < CMD_FS_RETRIES));
|
} while(synth_error && (num_tries++ < CMD_FS_RETRIES));
|
||||||
|
|
||||||
cmd_rx_restore(rx_key);
|
cmd_rx_restore(rx_key);
|
||||||
|
|
||||||
return (CMD_STATUS(netstack_cmd_fs) == DONE_OK)
|
return (CMD_STATUS(netstack_cmd_fs) == DONE_OK)
|
||||||
? RF_RESULT_OK
|
? RF_RESULT_OK
|
||||||
: RF_RESULT_ERROR;
|
: RF_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
rf_result_t
|
rf_result_t
|
||||||
@ -469,8 +468,8 @@ netstack_stop_rx(void)
|
|||||||
ENERGEST_OFF(ENERGEST_TYPE_LISTEN);
|
ENERGEST_OFF(ENERGEST_TYPE_LISTEN);
|
||||||
|
|
||||||
return (stat == RF_StatSuccess)
|
return (stat == RF_StatSuccess)
|
||||||
? RF_RESULT_OK
|
? RF_RESULT_OK
|
||||||
: RF_RESULT_ERROR;
|
: RF_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
RF_Handle
|
RF_Handle
|
||||||
@ -563,13 +562,13 @@ PROCESS_THREAD(rf_sched_process, ev, data)
|
|||||||
|
|
||||||
NETSTACK_MAC.input();
|
NETSTACK_MAC.input();
|
||||||
}
|
}
|
||||||
/* Only break when we receive -1 => No available data */
|
/* Only break when we receive -1 => No available data */
|
||||||
} while(len >= 0);
|
} while(len >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Scheduling CMD_FS will re-calibrate the synth. */
|
/* Scheduling CMD_FS will re-calibrate the synth. */
|
||||||
if((ev == PROCESS_EVENT_TIMER) &&
|
if((ev == PROCESS_EVENT_TIMER) &&
|
||||||
etimer_expired(&synth_recal_timer)) {
|
etimer_expired(&synth_recal_timer)) {
|
||||||
PRINTF("rf_core: Re-calibrate synth\n");
|
PRINTF("rf_core: Re-calibrate synth\n");
|
||||||
netstack_sched_fs();
|
netstack_sched_fs();
|
||||||
|
|
||||||
|
@ -54,8 +54,8 @@
|
|||||||
PROCESS_NAME(rf_sched_process);
|
PROCESS_NAME(rf_sched_process);
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
RF_RESULT_OK = 0,
|
RF_RESULT_OK = 0,
|
||||||
RF_RESULT_ERROR,
|
RF_RESULT_ERROR,
|
||||||
} rf_result_t;
|
} rf_result_t;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user