diff --git a/arch/cpu/cc13xx-cc26xx/cc13xx-cc26xx-conf.h b/arch/cpu/cc13xx-cc26xx/cc13xx-cc26xx-conf.h index 2a3b7cbde..08e5a4916 100644 --- a/arch/cpu/cc13xx-cc26xx/cc13xx-cc26xx-conf.h +++ b/arch/cpu/cc13xx-cc26xx/cc13xx-cc26xx-conf.h @@ -74,7 +74,7 @@ #ifndef WATCHDOG_CONF_TIMER_TOP #define WATCHDOG_CONF_TIMER_TOP 0xFFFFF #endif - /** @} */ +/** @} */ /*---------------------------------------------------------------------------*/ /** * \name RF configuration. @@ -88,9 +88,9 @@ * or larger guard time. */ #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 -# define RF_FAST_RADIO_STARTUP RF_CONF_FAST_RADIO_STARTUP +#define RF_FAST_RADIO_STARTUP RF_CONF_FAST_RADIO_STARTUP #endif /* @@ -102,7 +102,7 @@ #endif #if (RF_CONF_TXPOWER_HIGH_PA) && !(SUPPORTS_HIGH_PA) -# error "Device does not support High PA" +#error "Device does not support High PA" #endif /* @@ -120,36 +120,36 @@ */ #ifdef RF_CONF_MODE /* Sanity check a valid configuration is provided. */ -# if !(RF_CONF_MODE & RF_MODE_BM) -# error "Invalid RF_CONF_MODE provided" -# endif +#if !(RF_CONF_MODE & RF_MODE_BM) +#error "Invalid RF_CONF_MODE provided" +#endif -# define RF_MODE RF_CONF_MODE +#define RF_MODE RF_CONF_MODE #endif /* RF_CONF_MODE */ /* Number of RX buffers. */ #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 -# define RF_RX_BUF_CNT 4 +#define RF_RX_BUF_CNT 4 #endif /* Size of each RX buffer in bytes. */ #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 -# define RF_RX_BUF_SIZE 144 +#define RF_RX_BUF_SIZE 144 #endif /* Enable/disable BLE beacon. */ #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 -# define RF_BLE_BEACON_ENABLE 0 +#define RF_BLE_BEACON_ENABLE 0 #endif #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 /*----- CC13xx Device Line --------------------------------------------------*/ @@ -157,65 +157,65 @@ #if defined(DEVICE_LINE_CC13XX) /* Default to Prop-mode for CC13xx devices if not configured. */ -# ifndef RF_MODE -# define RF_MODE RF_MODE_SUB_1_GHZ -# endif +#ifndef RF_MODE +#define RF_MODE RF_MODE_SUB_1_GHZ +#endif /*----- 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. */ -# define NETSTACK_CONF_RADIO prop_mode_driver +#define NETSTACK_CONF_RADIO prop_mode_driver /* CSMA configuration. */ -# define CSMA_CONF_ACK_WAIT_TIME (RTIMER_SECOND / 300) -# define CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME (RTIMER_SECOND / 1000) -# define CSMA_CONF_SEND_SOFT_ACK 1 +#define CSMA_CONF_ACK_WAIT_TIME (RTIMER_SECOND / 300) +#define CSMA_CONF_AFTER_ACK_DETECTED_WAIT_TIME (RTIMER_SECOND / 1000) +#define CSMA_CONF_SEND_SOFT_ACK 1 /*----- 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. */ -# define NETSTACK_CONF_RADIO ieee_mode_driver +#define NETSTACK_CONF_RADIO ieee_mode_driver /* CSMA configuration. */ -# define CSMA_CONF_SEND_SOFT_ACK 0 +#define CSMA_CONF_SEND_SOFT_ACK 0 -# else +#else /*----- CC13xx Unsupported Mode ---------------------------------------------*/ -# error "Invalid RF mode configuration of CC13xx device" -# endif /* CC13xx RF Mode configuration */ +#error "Invalid RF mode configuration of CC13xx device" +#endif /* CC13xx RF Mode configuration */ /*----- CC26xx Device Line --------------------------------------------------*/ /* CC26xx only supports IEEE mode */ #elif defined(DEVICE_LINE_CC26XX) /* Default to IEEE-mode for CC26xx devices if not configured */ -# ifndef RF_MODE -# define RF_MODE RF_MODE_2_4_GHZ -# endif +#ifndef RF_MODE +#define RF_MODE RF_MODE_2_4_GHZ +#endif /*----- 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 */ -# define NETSTACK_CONF_RADIO ieee_mode_driver +#define NETSTACK_CONF_RADIO ieee_mode_driver /* CSMA configuration */ -# define CSMA_CONF_SEND_SOFT_ACK 0 +#define CSMA_CONF_SEND_SOFT_ACK 0 /* Frequncy band configuration */ -# undef DOT_15_4G_FREQ_BAND_ID -# define DOT_15_4G_CONF_FREQ_BAND_ID DOT_15_4G_FREQ_BAND_2450 +#undef DOT_15_4G_FREQ_BAND_ID +#define DOT_15_4G_CONF_FREQ_BAND_ID DOT_15_4G_FREQ_BAND_2450 -# else +#else /*----- CC26xx Unsupported Mode ---------------------------------------------*/ -# error "IEEE-mode only supported by CC26xx devices" -# endif /* CC26xx RF Mode configuration */ +#error "IEEE-mode only supported by CC26xx devices" +#endif /* CC26xx RF Mode configuration */ /*----- Unsupported device line ---------------------------------------------*/ #else -# error "Unsupported Device Line defined" +#error "Unsupported Device Line defined" #endif /* Unsupported device line */ /** @} */ diff --git a/arch/cpu/cc13xx-cc26xx/cc13xx-cc26xx-def.h b/arch/cpu/cc13xx-cc26xx/cc13xx-cc26xx-def.h index fc133948c..f51ee3c2b 100644 --- a/arch/cpu/cc13xx-cc26xx/cc13xx-cc26xx-def.h +++ b/arch/cpu/cc13xx-cc26xx/cc13xx-cc26xx-def.h @@ -43,9 +43,9 @@ #include /*---------------------------------------------------------------------------*/ #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0) -# include +#include #elif (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X2_CC26X2) -# include +#include #endif /*---------------------------------------------------------------------------*/ #include @@ -71,7 +71,7 @@ #define USEC_TO_RAT(X) ((X) * 4) #if (RTIMER_SECOND % 256) || (RAT_SECOND % 256) -# error RAT_TO_RTIMER macro must be fixed! +#error RAT_TO_RTIMER macro must be fixed! #endif /* The PHY header (preamble + SFD, 4+1 bytes) duration is equivalent to 10 symbols */ @@ -116,9 +116,9 @@ /*---------------------------------------------------------------------------*/ /* Path to CMSIS header */ #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) -# define CMSIS_CONF_HEADER_PATH "cc13x2-cc26x2-cm4.h" +#define CMSIS_CONF_HEADER_PATH "cc13x2-cc26x2-cm4.h" #endif /*---------------------------------------------------------------------------*/ /* Path to headers with implementation of mutexes and memory barriers */ diff --git a/arch/cpu/cc13xx-cc26xx/ccfg-conf.h b/arch/cpu/cc13xx-cc26xx/ccfg-conf.h index ce7eff3d4..23bc5dc9a 100644 --- a/arch/cpu/cc13xx-cc26xx/ccfg-conf.h +++ b/arch/cpu/cc13xx-cc26xx/ccfg-conf.h @@ -51,13 +51,13 @@ * @{ */ #if CCFG_CONF_JTAG_INTERFACE_DISABLE -# 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_PRCM_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_PBIST1_TAP_ENABLE 0x00 -# define SET_CCFG_CCFG_TAP_DAP_1_WUC_TAP_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_PRCM_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_PBIST1_TAP_ENABLE 0x00 +#define SET_CCFG_CCFG_TAP_DAP_1_WUC_TAP_ENABLE 0x00 #endif /** @} */ /*---------------------------------------------------------------------------*/ @@ -69,7 +69,7 @@ * @{ */ #if defined(DEVICE_LINE_CC13XX) && (RF_CONF_TXPOWER_BOOST_MODE) -# define CCFG_FORCE_VDDR_HH 1 +#define CCFG_FORCE_VDDR_HH 1 #endif /** @} */ /*---------------------------------------------------------------------------*/ @@ -86,12 +86,12 @@ #endif #if CCFG_CONF_ROM_BOOTLOADER_ENABLE -# define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0xC5 -# define SET_CCFG_BL_CONFIG_BL_LEVEL 0x00 -# if defined(CCFG_CONF_BL_PIN_NUMBER) -# define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER CCFG_CONF_BL_PIN_NUMBER -# endif -# define SET_CCFG_BL_CONFIG_BL_ENABLE 0xC5 +#define SET_CCFG_BL_CONFIG_BOOTLOADER_ENABLE 0xC5 +#define SET_CCFG_BL_CONFIG_BL_LEVEL 0x00 +#if defined(CCFG_CONF_BL_PIN_NUMBER) +#define SET_CCFG_BL_CONFIG_BL_PIN_NUMBER CCFG_CONF_BL_PIN_NUMBER +#endif +#define SET_CCFG_BL_CONFIG_BL_ENABLE 0xC5 #endif /** @} */ /*---------------------------------------------------------------------------*/ diff --git a/arch/cpu/cc13xx-cc26xx/dev/clock-arch.c b/arch/cpu/cc13xx-cc26xx/dev/clock-arch.c index d65750dc8..516d51cdb 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/clock-arch.c +++ b/arch/cpu/cc13xx-cc26xx/dev/clock-arch.c @@ -87,7 +87,7 @@ clock_init(void) { /* ClockP_getSystemTickPeriod() returns ticks per us. */ const uint32_t clockp_ticks_second = - (uint32_t)(1000 * 1000) / (CLOCK_SECOND) / ClockP_getSystemTickPeriod(); + (uint32_t)(1000 * 1000) / (CLOCK_SECOND) / ClockP_getSystemTickPeriod(); count = 0; diff --git a/arch/cpu/cc13xx-cc26xx/dev/dbg-arch.c b/arch/cpu/cc13xx-cc26xx/dev/dbg-arch.c index f61d0e6af..823239f21 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/dbg-arch.c +++ b/arch/cpu/cc13xx-cc26xx/dev/dbg-arch.c @@ -57,8 +57,8 @@ dbg_putchar(int c) num_bytes = (int)uart0_write(&ch, 1); return (num_bytes > 0) - ? num_bytes - : 0; + ? num_bytes + : 0; } /*---------------------------------------------------------------------------*/ unsigned int @@ -77,8 +77,8 @@ dbg_send_bytes(const unsigned char *seq, unsigned int len) num_bytes = (int)uart0_write(seq, max_len); return (num_bytes > 0) - ? num_bytes - : 0; + ? num_bytes + : 0; } /*---------------------------------------------------------------------------*/ /** @} */ diff --git a/arch/cpu/cc13xx-cc26xx/dev/gpio-hal-arch.c b/arch/cpu/cc13xx-cc26xx/dev/gpio-hal-arch.c index 03fdc870f..9da458899 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/gpio-hal-arch.c +++ b/arch/cpu/cc13xx-cc26xx/dev/gpio-hal-arch.c @@ -175,7 +175,6 @@ gpio_int_cb(PIN_Handle handle, PIN_Id pin_id) /* Notify the GPIO HAL driver */ gpio_hal_event_handler(gpio_hal_pin_to_mask(pin_id)); } - /*---------------------------------------------------------------------------*/ void gpio_hal_arch_init(void) @@ -244,15 +243,15 @@ gpio_hal_arch_read_pins(gpio_hal_pin_mask_t pins) pins &= ~oe_pins; return (HWREG(GPIO_BASE + GPIO_O_DOUT31_0) & oe_pins) | - GPIO_readMultiDio(pins); + GPIO_readMultiDio(pins); } /*---------------------------------------------------------------------------*/ uint8_t gpio_hal_arch_read_pin(gpio_hal_pin_t pin) { return (GPIO_getOutputEnableDio(pin)) - ? PINCC26XX_getOutputValue(pin) - : PINCC26XX_getInputValue(pin); + ? PINCC26XX_getOutputValue(pin) + : PINCC26XX_getInputValue(pin); } /*---------------------------------------------------------------------------*/ /** @} */ diff --git a/arch/cpu/cc13xx-cc26xx/dev/rtimer-arch.c b/arch/cpu/cc13xx-cc26xx/dev/rtimer-arch.c index 90fe9c6e5..d63adc36c 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/rtimer-arch.c +++ b/arch/cpu/cc13xx-cc26xx/dev/rtimer-arch.c @@ -73,8 +73,7 @@ static void rtimer_clock_stub(uintptr_t unused) { (void)unused; /* do nothing */ static void rtimer_isr_hook(void) { - if(AONRTCEventGet(RTIMER_RTC_CH)) - { + if(AONRTCEventGet(RTIMER_RTC_CH)) { AONRTCEventClear(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 * the interrupt manually. */ - if(AONRTCEventGet(HWIP_RTC_CH)) - { + if(AONRTCEventGet(HWIP_RTC_CH)) { hwi_dispatch_fxn(); - } - else - { + } else { IntPendClear(INT_AON_RTC_COMB); } } @@ -121,9 +117,8 @@ rtimer_arch_init(void) ClockP_destruct(&clk_object); /* Try to access the RAM vector table. */ - ramvec_table = (isr_fxn_t*)HWREG(NVIC_VTABLE); - if(!ramvec_table) - { + ramvec_table = (isr_fxn_t *)HWREG(NVIC_VTABLE); + if(!ramvec_table) { /* * Unable to find the RAM vector table is a serious fault. * Spin-lock forever. @@ -136,8 +131,7 @@ rtimer_arch_init(void) * in the RAM vector table. Fetch and store it. */ 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 * a serious fault. Spin-lock forever. diff --git a/arch/cpu/cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_gcc.c b/arch/cpu/cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_gcc.c index 1618f6d71..dbcbe3048 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_gcc.c +++ b/arch/cpu/cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_gcc.c @@ -87,25 +87,25 @@ extern unsigned long _stack_end; // //***************************************************************************** __attribute__ ((section(".resetVecs"))) __attribute__ ((used)) -static void (* const resetVectors[16])(void) = +static void(*const resetVectors[16]) (void) = { (void (*)(void))((uint32_t)&_stack_end), - // The initial stack pointer - resetISR, // The reset handler - nmiISR, // The NMI handler - faultISR, // The hard fault handler - defaultHandler, // The MPU fault handler - busFaultHandler, // The bus fault handler - defaultHandler, // The usage fault handler - 0, // Reserved - 0, // Reserved - 0, // Reserved - 0, // Reserved - defaultHandler, // SVCall handler - defaultHandler, // Debug monitor handler - 0, // Reserved - defaultHandler, // The PendSV handler - defaultHandler // The SysTick handler + /* The initial stack pointer */ + resetISR, /* The reset handler */ + nmiISR, /* The NMI handler */ + faultISR, /* The hard fault handler */ + defaultHandler, /* The MPU fault handler */ + busFaultHandler, /* The bus fault handler */ + defaultHandler, /* The usage fault handler */ + 0, /* Reserved */ + 0, /* Reserved */ + 0, /* Reserved */ + 0, /* Reserved */ + defaultHandler, /* SVCall handler */ + defaultHandler, /* Debug monitor handler */ + 0, /* Reserved */ + defaultHandler, /* The PendSV handler */ + defaultHandler /* The SysTick handler */ }; //***************************************************************************** // @@ -155,7 +155,7 @@ void localProgramStart(void) uint32_t count; 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; /* Enable Coprocessor Access Control (CPAC) */ @@ -193,11 +193,11 @@ void localProgramStart(void) __init_array_start[i](); } - /* Call the application's entry point. */ - main(); + /* Call the application's entry point. */ + main(); - /* If we ever return signal Error */ - faultISR(); + /* If we ever return signal Error */ + faultISR(); } //***************************************************************************** @@ -233,8 +233,7 @@ static void nmiISR(void) { /* Enter an infinite loop. */ - while(1) - { + while(1) { } } @@ -296,8 +295,7 @@ busFaultHandler(void) { x__ = 0; /* Enter an infinite loop. */ - while(1) - { + while(1) { } } @@ -312,8 +310,7 @@ static void defaultHandler(void) { /* Enter an infinite loop. */ - while(1) - { + while(1) { } } @@ -326,5 +323,5 @@ defaultHandler(void) //***************************************************************************** void _fini(void) { - /* Function body left empty intentionally */ + /* Function body left empty intentionally */ } diff --git a/arch/cpu/cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_iar.c b/arch/cpu/cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_iar.c index 9279ea523..70981ef77 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_iar.c +++ b/arch/cpu/cc13xx-cc26xx/dev/startup_cc13xx_cc26xx_iar.c @@ -39,8 +39,7 @@ #error "startup_cc13xx_cc26xx_iar.c: Unsupported compiler!" #endif - -// We need intrinsic functions for IAR (if used in source code) +/* We need intrinsic functions for IAR (if used in source code) */ #include #include #include DeviceFamily_constructPath(inc/hw_types.h) @@ -58,48 +57,48 @@ static void faultISR( void ); static void intDefaultHandler( void ); extern int main( void ); -extern void MPUFaultIntHandler( void ); -extern void BusFaultIntHandler( void ); -extern void UsageFaultIntHandler( void ); -extern void SVCallIntHandler( void ); -extern void DebugMonIntHandler( void ); -extern void PendSVIntHandler( void ); -extern void SysTickIntHandler( void ); -extern void GPIOIntHandler( void ); -extern void I2CIntHandler( void ); -extern void RFCCPE1IntHandler( void ); -extern void AONRTCIntHandler( void ); -extern void UART0IntHandler( void ); -extern void AUXSWEvent0IntHandler( void ); -extern void SSI0IntHandler( void ); -extern void SSI1IntHandler( void ); -extern void RFCCPE0IntHandler( void ); -extern void RFCHardwareIntHandler( void ); -extern void RFCCmdAckIntHandler( void ); -extern void I2SIntHandler( void ); -extern void AUXSWEvent1IntHandler( void ); -extern void WatchdogIntHandler( void ); -extern void Timer0AIntHandler( void ); -extern void Timer0BIntHandler( void ); -extern void Timer1AIntHandler( void ); -extern void Timer1BIntHandler( void ); -extern void Timer2AIntHandler( void ); -extern void Timer2BIntHandler( void ); -extern void Timer3AIntHandler( void ); -extern void Timer3BIntHandler( void ); -extern void CryptoIntHandler( void ); -extern void uDMAIntHandler( void ); -extern void uDMAErrIntHandler( void ); -extern void FlashIntHandler( void ); -extern void SWEvent0IntHandler( void ); -extern void AUXCombEventIntHandler( void ); -extern void AONProgIntHandler( void ); -extern void DynProgIntHandler( void ); -extern void AUXCompAIntHandler( void ); -extern void AUXADCIntHandler( void ); -extern void TRNGIntHandler( void ); +extern void MPUFaultIntHandler(void); +extern void BusFaultIntHandler(void); +extern void UsageFaultIntHandler(void); +extern void SVCallIntHandler(void); +extern void DebugMonIntHandler(void); +extern void PendSVIntHandler(void); +extern void SysTickIntHandler(void); +extern void GPIOIntHandler(void); +extern void I2CIntHandler(void); +extern void RFCCPE1IntHandler(void); +extern void AONRTCIntHandler(void); +extern void UART0IntHandler(void); +extern void AUXSWEvent0IntHandler(void); +extern void SSI0IntHandler(void); +extern void SSI1IntHandler(void); +extern void RFCCPE0IntHandler(void); +extern void RFCHardwareIntHandler(void); +extern void RFCCmdAckIntHandler(void); +extern void I2SIntHandler(void); +extern void AUXSWEvent1IntHandler(void); +extern void WatchdogIntHandler(void); +extern void Timer0AIntHandler(void); +extern void Timer0BIntHandler(void); +extern void Timer1AIntHandler(void); +extern void Timer1BIntHandler(void); +extern void Timer2AIntHandler(void); +extern void Timer2BIntHandler(void); +extern void Timer3AIntHandler(void); +extern void Timer3BIntHandler(void); +extern void CryptoIntHandler(void); +extern void uDMAIntHandler(void); +extern void uDMAErrIntHandler(void); +extern void FlashIntHandler(void); +extern void SWEvent0IntHandler(void); +extern void AUXCombEventIntHandler(void); +extern void AONProgIntHandler(void); +extern void DynProgIntHandler(void); +extern void AUXCompAIntHandler(void); +extern void AUXADCIntHandler(void); +extern void TRNGIntHandler(void); -// Default interrupt handlers +/* Default interrupt handlers */ #pragma weak MPUFaultIntHandler = intDefaultHandler #pragma weak BusFaultIntHandler = intDefaultHandler #pragma weak UsageFaultIntHandler = intDefaultHandler diff --git a/arch/cpu/cc13xx-cc26xx/dev/trng-arch.c b/arch/cpu/cc13xx-cc26xx/dev/trng-arch.c index cdba878af..8f7cb2627 100644 --- a/arch/cpu/cc13xx-cc26xx/dev/trng-arch.c +++ b/arch/cpu/cc13xx-cc26xx/dev/trng-arch.c @@ -51,7 +51,7 @@ */ #include #if (DeviceFamily_PARENT == DeviceFamily_PARENT_CC13X0_CC26X0) -# include +#include #endif /*---------------------------------------------------------------------------*/ #include @@ -82,7 +82,7 @@ trng_rand(uint8_t *entropy_buf, size_t entropy_len, uint32_t timeout_us) TRNG_close(trng_handle); - return (result == TRNG_STATUS_SUCCESS); + return result == TRNG_STATUS_SUCCESS; } /*---------------------------------------------------------------------------*/ /** @} */ diff --git a/arch/cpu/cc13xx-cc26xx/rf-settings/rf-settings.h b/arch/cpu/cc13xx-cc26xx/rf-settings/rf-settings.h index 198482b1f..744a6948a 100644 --- a/arch/cpu/cc13xx-cc26xx/rf-settings/rf-settings.h +++ b/arch/cpu/cc13xx-cc26xx/rf-settings/rf-settings.h @@ -58,7 +58,7 @@ #define netstack_cmd_rx rf_cmd_ieee_rx /*---------------------------------------------------------------------------*/ #else -# error "Unsupported RF_MODE" +#error "Unsupported RF_MODE" #endif /*---------------------------------------------------------------------------*/ /* BLE RF settings */ @@ -84,7 +84,7 @@ /*---------------------------------------------------------------------------*/ #else -# error "Unsupported DeviceFamily_PARENT for BLE settings" +#error "Unsupported DeviceFamily_PARENT for BLE settings" #endif /*---------------------------------------------------------------------------*/ #endif /* NETSTACK_SETTINGS_H_ */ diff --git a/arch/cpu/cc13xx-cc26xx/rf/ble-beacond.c b/arch/cpu/cc13xx-cc26xx/rf/ble-beacond.c index 7924693a8..87fd7b43e 100644 --- a/arch/cpu/cc13xx-cc26xx/rf/ble-beacond.c +++ b/arch/cpu/cc13xx-cc26xx/rf/ble-beacond.c @@ -112,26 +112,26 @@ typedef struct { bool is_active; /* Periodic timer for sending out BLE advertisements */ - clock_time_t ble_adv_interval; + clock_time_t ble_adv_interval; struct etimer ble_adv_et; /* RF driver */ - RF_Handle rf_handle; + RF_Handle rf_handle; } ble_beacond_t; static ble_beacond_t ble_beacond; /*---------------------------------------------------------------------------*/ /* Configuration for 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 -# define TX_POWER_TABLE rf_ble_tx_power_table +#define TX_POWER_TABLE rf_ble_tx_power_table #endif #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 -# define TX_POWER_TABLE_SIZE RF_BLE_TX_POWER_TABLE_SIZE +#define TX_POWER_TABLE_SIZE RF_BLE_TX_POWER_TABLE_SIZE #endif /* TX power table convenience macros */ @@ -150,7 +150,7 @@ rf_ble_beacond_init(void) RF_Params 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; 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); if((name_len == 0) || - (name_len >= BLE_ADV_NAME_BUF_LEN)) { + (name_len >= BLE_ADV_NAME_BUF_LEN)) { 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); return (res == RF_RESULT_OK) - ? RF_BLE_BEACOND_OK - : RF_BLE_BEACOND_ERROR; + ? RF_BLE_BEACOND_OK + : RF_BLE_BEACOND_ERROR; } /*---------------------------------------------------------------------------*/ int8_t diff --git a/arch/cpu/cc13xx-cc26xx/rf/ble-beacond.h b/arch/cpu/cc13xx-cc26xx/rf/ble-beacond.h index f97927ff5..87e2ccc74 100644 --- a/arch/cpu/cc13xx-cc26xx/rf/ble-beacond.h +++ b/arch/cpu/cc13xx-cc26xx/rf/ble-beacond.h @@ -49,9 +49,9 @@ #include /*---------------------------------------------------------------------------*/ typedef enum { - RF_BLE_BEACOND_OK, - RF_BLE_BEACOND_ERROR, - RF_BLE_BEACOND_DISABLED, + RF_BLE_BEACOND_OK, + RF_BLE_BEACOND_ERROR, + RF_BLE_BEACOND_DISABLED, } rf_ble_beacond_result_t; /*---------------------------------------------------------------------------*/ /** diff --git a/arch/cpu/cc13xx-cc26xx/rf/data-queue.c b/arch/cpu/cc13xx-cc26xx/rf/data-queue.c index 06d57bd71..31da05302 100644 --- a/arch/cpu/cc13xx-cc26xx/rf/data-queue.c +++ b/arch/cpu/cc13xx-cc26xx/rf/data-queue.c @@ -140,7 +140,7 @@ data_queue_reset(void) data_entry_t* data_queue_current_entry(void) { - return rx_data_queue.curr_entry; + return rx_data_queue.curr_entry; } /*---------------------------------------------------------------------------*/ void diff --git a/arch/cpu/cc13xx-cc26xx/rf/dot-15-4g.h b/arch/cpu/cc13xx-cc26xx/rf/dot-15-4g.h index d0bf42722..5366651e7 100644 --- a/arch/cpu/cc13xx-cc26xx/rf/dot-15-4g.h +++ b/arch/cpu/cc13xx-cc26xx/rf/dot-15-4g.h @@ -71,9 +71,9 @@ /*---------------------------------------------------------------------------*/ /* Default band selection to band 4 - 863MHz */ #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 -# 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 /*---------------------------------------------------------------------------*/ /* @@ -84,76 +84,76 @@ * DOT_15_4G_CHAN0_FREQ is specified here in KHz */ #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_MAX 198 -# define DOT_15_4G_FREQ_SPACING 200 -# define DOT_15_4G_CHAN0_FREQ 470200 +#define DOT_15_4G_CHAN_MIN 0 +#define DOT_15_4G_CHAN_MAX 198 +#define DOT_15_4G_FREQ_SPACING 200 +#define DOT_15_4G_CHAN0_FREQ 470200 -# define PROP_MODE_CONF_CENTER_FREQ 0x01EA -# define PROP_MODE_CONF_LO_DIVIDER 0x0A +#define PROP_MODE_CONF_CENTER_FREQ 0x01EA +#define PROP_MODE_CONF_LO_DIVIDER 0x0A #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_MAX 38 -# define DOT_15_4G_FREQ_SPACING 200 -# define DOT_15_4G_CHAN0_FREQ 779200 +#define DOT_15_4G_CHAN_MIN 0 +#define DOT_15_4G_CHAN_MAX 38 +#define DOT_15_4G_FREQ_SPACING 200 +#define DOT_15_4G_CHAN0_FREQ 779200 -# define PROP_MODE_CONF_CENTER_FREQ 0x030F -# define PROP_MODE_CONF_LO_DIVIDER 0x06 +#define PROP_MODE_CONF_CENTER_FREQ 0x030F +#define PROP_MODE_CONF_LO_DIVIDER 0x06 #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_MAX 33 -# define DOT_15_4G_FREQ_SPACING 200 -# define DOT_15_4G_CHAN0_FREQ 863125 +#define DOT_15_4G_CHAN_MIN 0 +#define DOT_15_4G_CHAN_MAX 33 +#define DOT_15_4G_FREQ_SPACING 200 +#define DOT_15_4G_CHAN0_FREQ 863125 -# define PROP_MODE_CONF_CENTER_FREQ 0x0362 -# define PROP_MODE_CONF_LO_DIVIDER 0x05 +#define PROP_MODE_CONF_CENTER_FREQ 0x0362 +#define PROP_MODE_CONF_LO_DIVIDER 0x05 #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_MAX 128 -# define DOT_15_4G_FREQ_SPACING 200 -# define DOT_15_4G_CHAN0_FREQ 902200 +#define DOT_15_4G_CHAN_MIN 0 +#define DOT_15_4G_CHAN_MAX 128 +#define DOT_15_4G_FREQ_SPACING 200 +#define DOT_15_4G_CHAN0_FREQ 902200 -# define PROP_MODE_CONF_CENTER_FREQ 0x0393 -# define PROP_MODE_CONF_LO_DIVIDER 0x05 +#define PROP_MODE_CONF_CENTER_FREQ 0x0393 +#define PROP_MODE_CONF_LO_DIVIDER 0x05 #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_MAX 37 -# define DOT_15_4G_FREQ_SPACING 200 -# define DOT_15_4G_CHAN0_FREQ 920600 +#define DOT_15_4G_CHAN_MIN 0 +#define DOT_15_4G_CHAN_MAX 37 +#define DOT_15_4G_FREQ_SPACING 200 +#define DOT_15_4G_CHAN0_FREQ 920600 -# define PROP_MODE_CONF_CENTER_FREQ 0x039C -# define PROP_MODE_CONF_LO_DIVIDER 0x05 +#define PROP_MODE_CONF_CENTER_FREQ 0x039C +#define PROP_MODE_CONF_LO_DIVIDER 0x05 #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_MAX 32 -# define DOT_15_4G_FREQ_SPACING 200 -# define DOT_15_4G_CHAN0_FREQ 951000 +#define DOT_15_4G_CHAN_MIN 0 +#define DOT_15_4G_CHAN_MAX 32 +#define DOT_15_4G_FREQ_SPACING 200 +#define DOT_15_4G_CHAN0_FREQ 951000 -# define PROP_MODE_CONF_CENTER_FREQ 0x03BA -# define PROP_MODE_CONF_LO_DIVIDER 0x05 +#define PROP_MODE_CONF_CENTER_FREQ 0x03BA +#define PROP_MODE_CONF_LO_DIVIDER 0x05 #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_MAX 26 -# define DOT_15_4G_FREQ_SPACING 5000 -# define DOT_15_4G_CHAN0_FREQ 2405000 +#define DOT_15_4G_CHAN_MIN 11 +#define DOT_15_4G_CHAN_MAX 26 +#define DOT_15_4G_FREQ_SPACING 5000 +#define DOT_15_4G_CHAN0_FREQ 2405000 #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 /*---------------------------------------------------------------------------*/ static inline uint32_t dot_15_4g_freq(const uint16_t chan) { - const uint32_t chan0 = DOT_15_4G_CHAN0_FREQ; - const uint32_t spacing = DOT_15_4G_FREQ_SPACING; + const uint32_t chan0 = DOT_15_4G_CHAN0_FREQ; + const uint32_t spacing = DOT_15_4G_FREQ_SPACING; 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 @@ -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_max = DOT_15_4G_CHAN_MAX; - return ((chan >= chan_min) && - (chan <= chan_max)); + return (chan >= chan_min) && + (chan <= chan_max); } /*---------------------------------------------------------------------------*/ #define DOT_15_4G_DEFAULT_CHAN IEEE802154_DEFAULT_CHANNEL diff --git a/arch/cpu/cc13xx-cc26xx/rf/ieee-mode.c b/arch/cpu/cc13xx-cc26xx/rf/ieee-mode.c index 8eb4a442c..9a36497fc 100644 --- a/arch/cpu/cc13xx-cc26xx/rf/ieee-mode.c +++ b/arch/cpu/cc13xx-cc26xx/rf/ieee-mode.c @@ -80,7 +80,7 @@ #include /*---------------------------------------------------------------------------*/ #if 1 -# define PRINTF(...) printf(__VA_ARGS__) +#define PRINTF(...) printf(__VA_ARGS__) #else # define PRINTF(...) #endif @@ -89,23 +89,23 @@ /* Configuration to enable/disable auto ACKs in IEEE mode */ #ifdef IEEE_MODE_CONF_AUTOACK -# define IEEE_MODE_AUTOACK IEEE_MODE_CONF_AUTOACK +#define IEEE_MODE_AUTOACK IEEE_MODE_CONF_AUTOACK #else -# define IEEE_MODE_AUTOACK 1 +#define IEEE_MODE_AUTOACK 1 #endif /* IEEE_MODE_CONF_AUTOACK */ /* Configuration to enable/disable frame filtering in IEEE mode */ #ifdef IEEE_MODE_CONF_PROMISCOUS -# define IEEE_MODE_PROMISCOUS IEEE_MODE_CONF_PROMISCOUS +#define IEEE_MODE_PROMISCOUS IEEE_MODE_CONF_PROMISCOUS #else -# define IEEE_MODE_PROMISCOUS 0 +#define IEEE_MODE_PROMISCOUS 0 #endif /* IEEE_MODE_CONF_PROMISCOUS */ /* Configuration to set the 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 -# define IEEE_MODE_RSSI_THRESHOLD 0xA6 +#define IEEE_MODE_RSSI_THRESHOLD 0xA6 #endif /* IEEE_MODE_CONF_RSSI_THRESHOLD */ /*---------------------------------------------------------------------------*/ /* 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_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 */ static void check_rat_overflow(void); @@ -515,7 +519,7 @@ read(void *buf, unsigned short buf_len) const rtimer_clock_t t0 = RTIMER_NOW(); /* Only wait if the Radio timer is accessing the entry */ 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) { /* No available data */ @@ -602,7 +606,7 @@ cca_request(cmd_cca_req_t *cmd_cca_req) const rtimer_clock_t t0 = RTIMER_NOW(); 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; if(rx_is_active()) { @@ -614,8 +618,8 @@ cca_request(cmd_cca_req_t *cmd_cca_req) } return (stat == RF_StatCmdDoneSuccess) - ? RF_RESULT_OK - : RF_RESULT_ERROR; + ? RF_RESULT_OK + : RF_RESULT_ERROR; } /*---------------------------------------------------------------------------*/ static int @@ -630,7 +634,7 @@ channel_clear(void) } /* 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 @@ -646,14 +650,14 @@ receiving_packet(void) /* If we are transmitting (can only be an ACK here), we are not receiving */ if((cmd_cca_req.ccaInfo.ccaEnergy == CCA_STATE_BUSY) && - (cmd_cca_req.ccaInfo.ccaCorr == CCA_STATE_BUSY) && - (cmd_cca_req.ccaInfo.ccaSync == CCA_STATE_BUSY)) { + (cmd_cca_req.ccaInfo.ccaCorr == CCA_STATE_BUSY) && + (cmd_cca_req.ccaInfo.ccaSync == CCA_STATE_BUSY)) { PRINTF("receiving_packet: we were TXing ACK\n"); return 0; } /* 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 @@ -668,7 +672,7 @@ pending_packet(void) do { const uint8_t status = curr_entry->status; if((status == DATA_ENTRY_FINISHED) || - (status == DATA_ENTRY_BUSY)) { + (status == DATA_ENTRY_BUSY)) { 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); return ((res == RF_RESULT_OK) && (*value != RF_TxPowerTable_INVALID_DBM)) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; + ? RADIO_RESULT_OK + : RADIO_RESULT_ERROR; /* 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: *value = RF_getRssi(ieee_radio.rf_handle); return (*value == RF_GET_RSSI_ERROR_VAL) - ? RADIO_RESULT_ERROR - : RADIO_RESULT_OK; + ? RADIO_RESULT_ERROR + : RADIO_RESULT_OK; /* 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) { return (on() == RF_RESULT_OK) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; - + ? RADIO_RESULT_OK + : RADIO_RESULT_ERROR; } else if(value == RADIO_POWER_MODE_OFF) { off(); return RADIO_RESULT_OK; @@ -866,8 +869,8 @@ set_value(radio_param_t param, radio_value_t value) netstack_stop_rx(); res = netstack_sched_rx(false); return (res == RF_RESULT_OK) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; + ? RADIO_RESULT_OK + : RADIO_RESULT_ERROR; /* 16bit address */ case RADIO_PARAM_16BIT_ADDR: @@ -879,8 +882,8 @@ set_value(radio_param_t param, radio_value_t value) netstack_stop_rx(); res = netstack_sched_rx(false); return (res == RF_RESULT_OK) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; + ? RADIO_RESULT_OK + : RADIO_RESULT_ERROR; /* RX Mode */ case RADIO_PARAM_RX_MODE: { @@ -918,8 +921,8 @@ set_value(radio_param_t param, radio_value_t value) netstack_stop_rx(); res = netstack_sched_rx(false); return (res == RF_RESULT_OK) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; + ? RADIO_RESULT_OK + : RADIO_RESULT_ERROR; } /* 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); return (res == RF_RESULT_OK) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; + ? RADIO_RESULT_OK + : RADIO_RESULT_ERROR; /* CCA Threshold */ case RADIO_PARAM_CCA_THRESHOLD: @@ -950,8 +953,8 @@ set_value(radio_param_t param, radio_value_t value) netstack_stop_rx(); res = netstack_sched_rx(false); return (res == RF_RESULT_OK) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; + ? RADIO_RESULT_OK + : RADIO_RESULT_ERROR; default: return RADIO_RESULT_NOT_SUPPORTED; @@ -1026,8 +1029,8 @@ set_object(radio_param_t param, const void *src, size_t size) netstack_stop_rx(); res = netstack_sched_rx(false); return (res == RF_RESULT_OK) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; + ? RADIO_RESULT_OK + : RADIO_RESULT_ERROR; } default: return RADIO_RESULT_NOT_SUPPORTED; diff --git a/arch/cpu/cc13xx-cc26xx/rf/prop-mode.c b/arch/cpu/cc13xx-cc26xx/rf/prop-mode.c index 42447a082..c3042fa6e 100644 --- a/arch/cpu/cc13xx-cc26xx/rf/prop-mode.c +++ b/arch/cpu/cc13xx-cc26xx/rf/prop-mode.c @@ -85,15 +85,15 @@ /*---------------------------------------------------------------------------*/ /* Data whitener. 1: Whitener, 0: No whitener */ #ifdef PROP_MODE_CONF_DW -# define PROP_MODE_DW PROP_MODE_CONF_DW +#define PROP_MODE_DW PROP_MODE_CONF_DW #else -# define PROP_MODE_DW 0 +#define PROP_MODE_DW 0 #endif #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 -# define PROP_MODE_USE_CRC16 0 +#define PROP_MODE_USE_CRC16 0 #endif /*---------------------------------------------------------------------------*/ /* Used for checking result of CCA_REQ command */ @@ -105,9 +105,9 @@ #define RF_GET_CCA_INFO_ERROR 0xFF #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 -# define PROP_MODE_RSSI_THRESHOLD 0xA6 +#define PROP_MODE_RSSI_THRESHOLD 0xA6 #endif /*---------------------------------------------------------------------------*/ /* Defines and variables related to the .15.4g PHY HDR */ @@ -120,18 +120,18 @@ #if PROP_MODE_USE_CRC16 /* CRC16 */ -# define DOT_4G_PHR_CRC_BIT DOT_4G_PHR_CRC16 -# define CRC_LEN 2 +#define DOT_4G_PHR_CRC_BIT DOT_4G_PHR_CRC16 +#define CRC_LEN 2 #else /* CRC32 */ -# define DOT_4G_PHR_CRC_BIT 0 -# define CRC_LEN 4 +#define DOT_4G_PHR_CRC_BIT 0 +#define CRC_LEN 4 #endif /* PROP_MODE_USE_CRC16 */ #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 - #define DOT_4G_PHR_DW_BIT 0 +#define DOT_4G_PHR_DW_BIT 0 #endif /*---------------------------------------------------------------------------*/ /* 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_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 rx_is_active(void) { return cmd_rx.status == ACTIVE; } +static inline bool +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 off(void); @@ -232,7 +240,7 @@ get_rssi(void) const rtimer_clock_t t0 = RTIMER_NOW(); 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; if(rx_is_active()) { @@ -358,8 +366,8 @@ transmit(unsigned short transmit_len) res = netstack_sched_prop_tx(); return (res == RF_RESULT_OK) - ? RADIO_TX_OK - : RADIO_TX_ERR; + ? RADIO_TX_OK + : RADIO_TX_ERR; } /*---------------------------------------------------------------------------*/ static int @@ -377,7 +385,7 @@ read(void *buf, unsigned short buf_len) const rtimer_clock_t t0 = RTIMER_NOW(); /* Only wait if the Radio is accessing the entry */ 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) { /* No available data */ @@ -451,8 +459,8 @@ cca_request(void) } return (rssi < prop_radio.rssi_threshold) - ? CCA_STATE_IDLE - : CCA_STATE_BUSY; + ? CCA_STATE_IDLE + : CCA_STATE_BUSY; } /*---------------------------------------------------------------------------*/ static int @@ -466,7 +474,7 @@ channel_clear(void) const uint8_t cca_state = cca_request(); /* Channel is clear if CCA state is IDLE */ - return (cca_state == CCA_STATE_IDLE); + return cca_state == CCA_STATE_IDLE; } /*---------------------------------------------------------------------------*/ static int @@ -478,7 +486,7 @@ receiving_packet(void) const uint8_t cca_state = cca_request(); - return (cca_state == CCA_STATE_BUSY); + return cca_state == CCA_STATE_BUSY; } /*---------------------------------------------------------------------------*/ static int @@ -493,7 +501,7 @@ pending_packet(void) do { const uint8_t status = curr_entry->status; if((status == DATA_ENTRY_FINISHED) || - (status == DATA_ENTRY_BUSY)) { + (status == DATA_ENTRY_BUSY)) { num_pending += 1; } @@ -558,8 +566,8 @@ get_value(radio_param_t param, radio_value_t *value) case RADIO_PARAM_POWER_MODE: /* On / off */ *value = (prop_radio.rf_is_on) - ? RADIO_POWER_MODE_ON - : RADIO_POWER_MODE_OFF; + ? RADIO_POWER_MODE_ON + : RADIO_POWER_MODE_OFF; 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); return ((res == RF_RESULT_OK) && (*value != RF_TxPowerTable_INVALID_DBM)) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; + ? RADIO_RESULT_OK + : RADIO_RESULT_ERROR; case RADIO_PARAM_CCA_THRESHOLD: *value = prop_radio.rssi_threshold; @@ -581,8 +589,8 @@ get_value(radio_param_t param, radio_value_t *value) case RADIO_PARAM_RSSI: *value = get_rssi(); return (*value == RF_GET_RSSI_ERROR_VAL) - ? RADIO_RESULT_ERROR - : RADIO_RESULT_OK; + ? RADIO_RESULT_ERROR + : RADIO_RESULT_OK; case RADIO_CONST_CHANNEL_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) { return (on() == RF_RESULT_OK) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; - + ? RADIO_RESULT_OK + : RADIO_RESULT_ERROR; } else if(value == RADIO_POWER_MODE_OFF) { off(); return RADIO_RESULT_OK; @@ -628,8 +635,8 @@ set_value(radio_param_t param, radio_value_t value) case RADIO_PARAM_CHANNEL: res = set_channel((uint16_t)value); return (res == RF_RESULT_OK) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; + ? RADIO_RESULT_OK + : RADIO_RESULT_ERROR; case RADIO_PARAM_TXPOWER: 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); return (res == RF_RESULT_OK) - ? RADIO_RESULT_OK - : RADIO_RESULT_ERROR; + ? RADIO_RESULT_OK + : RADIO_RESULT_ERROR; case RADIO_PARAM_RX_MODE: return RADIO_RESULT_OK; diff --git a/arch/cpu/cc13xx-cc26xx/rf/sched.c b/arch/cpu/cc13xx-cc26xx/rf/sched.c index 784cfff3f..d1e8bbef5 100644 --- a/arch/cpu/cc13xx-cc26xx/rf/sched.c +++ b/arch/cpu/cc13xx-cc26xx/rf/sched.c @@ -64,9 +64,9 @@ #include /*---------------------------------------------------------------------------*/ #if 1 -# define PRINTF(...) printf(__VA_ARGS__) +#define PRINTF(...) printf(__VA_ARGS__) #else -# define PRINTF(...) +#define PRINTF(...) #endif /*---------------------------------------------------------------------------*/ #define CMD_FS_RETRIES 3 @@ -88,12 +88,12 @@ static struct etimer synth_recal_timer; /*---------------------------------------------------------------------------*/ -static RF_Object rf_netstack; -static RF_Object rf_ble; +static RF_Object rf_netstack; +static RF_Object rf_ble; static RF_CmdHandle cmd_rx_handle; -static bool rf_is_on; +static bool rf_is_on; static volatile bool rx_buf_full; /*---------------------------------------------------------------------------*/ static void @@ -214,8 +214,8 @@ rf_set_tx_power(RF_Handle handle, RF_TxPowerTable_Entry *table, int8_t dbm) ); return (stat == RF_StatSuccess) - ? RF_RESULT_OK - : RF_RESULT_ERROR; + ? RF_RESULT_OK + : RF_RESULT_ERROR; } /*---------------------------------------------------------------------------*/ 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) - ? RF_RESULT_OK - : RF_RESULT_ERROR; + ? RF_RESULT_OK + : RF_RESULT_ERROR; } /*---------------------------------------------------------------------------*/ RF_Handle @@ -275,15 +275,14 @@ netstack_sched_fs(void) ); 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)); cmd_rx_restore(rx_key); return (CMD_STATUS(netstack_cmd_fs) == DONE_OK) - ? RF_RESULT_OK - : RF_RESULT_ERROR; + ? RF_RESULT_OK + : RF_RESULT_ERROR; } /*---------------------------------------------------------------------------*/ rf_result_t @@ -469,8 +468,8 @@ netstack_stop_rx(void) ENERGEST_OFF(ENERGEST_TYPE_LISTEN); return (stat == RF_StatSuccess) - ? RF_RESULT_OK - : RF_RESULT_ERROR; + ? RF_RESULT_OK + : RF_RESULT_ERROR; } /*---------------------------------------------------------------------------*/ RF_Handle @@ -563,13 +562,13 @@ PROCESS_THREAD(rf_sched_process, ev, data) NETSTACK_MAC.input(); } - /* Only break when we receive -1 => No available data */ + /* Only break when we receive -1 => No available data */ } while(len >= 0); } /* Scheduling CMD_FS will re-calibrate the synth. */ if((ev == PROCESS_EVENT_TIMER) && - etimer_expired(&synth_recal_timer)) { + etimer_expired(&synth_recal_timer)) { PRINTF("rf_core: Re-calibrate synth\n"); netstack_sched_fs(); diff --git a/arch/cpu/cc13xx-cc26xx/rf/sched.h b/arch/cpu/cc13xx-cc26xx/rf/sched.h index bd966f36b..de32dbbd4 100644 --- a/arch/cpu/cc13xx-cc26xx/rf/sched.h +++ b/arch/cpu/cc13xx-cc26xx/rf/sched.h @@ -54,8 +54,8 @@ PROCESS_NAME(rf_sched_process); /*---------------------------------------------------------------------------*/ typedef enum { - RF_RESULT_OK = 0, - RF_RESULT_ERROR, + RF_RESULT_OK = 0, + RF_RESULT_ERROR, } rf_result_t; /*---------------------------------------------------------------------------*/ /**