diff --git a/cpu/cc2430/dev/bus.c b/cpu/cc2430/dev/bus.c index 4d8584466..0108cde58 100644 --- a/cpu/cc2430/dev/bus.c +++ b/cpu/cc2430/dev/bus.c @@ -44,7 +44,7 @@ /*---------------------------------------------------------------------------*/ void -bus_init (void) +bus_init(void) { CLKCON = (0x00 | OSC32K); /* 32k internal */ while(CLKCON != (0x00 | OSC32K)); diff --git a/cpu/cc2430/dev/cc2430_rf.c b/cpu/cc2430/dev/cc2430_rf.c index 7d6d5ecbd..ac897c28c 100644 --- a/cpu/cc2430/dev/cc2430_rf.c +++ b/cpu/cc2430/dev/cc2430_rf.c @@ -263,7 +263,7 @@ cc2430_rf_set_addr(unsigned pan, unsigned addr, const uint8_t *ieee_addr) if(ieee_addr != NULL) { ptr = &IEEE_ADDR7; /* LSB first, MSB last for 802.15.4 addresses in CC2420 */ - for (f = 0; f < 8; f++) { + for(f = 0; f < 8; f++) { *ptr-- = ieee_addr[f]; } } @@ -396,10 +396,10 @@ prepare(const void *payload, unsigned short payload_len) PRINTF("cc2430_rf: data = "); /* Send the phy length byte first */ RFD = payload_len + CHECKSUM_LEN; /* Payload plus FCS */ - PRINTF("(%d)", payload_len+CHECKSUM_LEN); + PRINTF("(%d)", payload_len + CHECKSUM_LEN); for(i = 0; i < payload_len; i++) { - RFD = ((unsigned char*) (payload))[i]; - PRINTF("%02X", ((unsigned char*)(payload))[i]); + RFD = ((unsigned char *)(payload))[i]; + PRINTF("%02X", ((unsigned char *)(payload))[i]); } PRINTF("\n"); @@ -460,7 +460,7 @@ transmit(unsigned short transmit_len) ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT); ENERGEST_ON(ENERGEST_TYPE_LISTEN); - if(rf_flags & WAS_OFF){ + if(rf_flags & WAS_OFF) { off(); } @@ -510,7 +510,7 @@ read(void *buf, unsigned short bufsize) } if(len <= CC2430_MIN_PACKET_LEN) { - PRINTF("error: too short\n"); + PRINTF("error: too short\n"); RIMESTATS_ADD(tooshort); flush_rx(); @@ -518,7 +518,7 @@ read(void *buf, unsigned short bufsize) } if(len - CHECKSUM_LEN > bufsize) { - PRINTF("error: too long\n"); + PRINTF("error: too long\n"); RIMESTATS_ADD(toolong); flush_rx(); @@ -538,11 +538,11 @@ read(void *buf, unsigned short bufsize) PRINTF("(%d)", len); len -= CHECKSUM_LEN; for(i = 0; i < len; ++i) { - ((unsigned char*)(buf))[i] = RFD; + ((unsigned char *)(buf))[i] = RFD; #if CC2430_RF_CONF_HEXDUMP - uart1_writeb(((unsigned char*)(buf))[i]); + uart1_writeb(((unsigned char *)(buf))[i]); #endif - PRINTF("%02X", ((unsigned char*)(buf))[i]); + PRINTF("%02X", ((unsigned char *)(buf))[i]); } PRINTF("\n"); @@ -570,17 +570,17 @@ read(void *buf, unsigned short bufsize) RIMESTATS_ADD(badcrc); flush_rx(); return 0; -} + } /* If FIFOP==1 and FIFO==0 then we had a FIFO overflow at some point. */ if((RFSTATUS & (FIFO | FIFOP)) == FIFOP) { /* * If we reach here means that there might be more intact packets in the * FIFO despite the overflow. This can happen with bursts of small packets. - * + * * Only flush if the FIFO is actually empty. If not, then next pass we will * pick up one more packet or flush due to an error. - */ + */ if(!RXFIFOCNT) { flush_rx(); } @@ -646,14 +646,14 @@ on(void) RSSIH = 0xd2; /* -84dbm = 0xd2 default, 0xe0 -70 dbm */ RFPWR &= ~RREG_RADIO_PD; /* make sure it's powered */ - while ((RFIF & IRQ_RREG_ON) == 0); /* wait for power up */ + while((RFIF & IRQ_RREG_ON) == 0); /* wait for power up */ /* Make sure the RREG On Interrupt Flag is 0 next time we get called */ RFIF &= ~IRQ_RREG_ON; cc2430_rf_command(ISRXON); cc2430_rf_command(ISFLUSHRX); - while (RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + ONOFF_TIME)); + while(RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + ONOFF_TIME)); } PRINTF("cc2430_rf_rx_enable done\n"); @@ -686,18 +686,17 @@ off(void) return 1; } /*---------------------------------------------------------------------------*/ -const struct radio_driver cc2430_rf_driver = -{ - init, - prepare, - transmit, - send, - read, - channel_clear, - receiving_packet, - pending_packet, - on, - off, +const struct radio_driver cc2430_rf_driver = { + init, + prepare, + transmit, + send, + read, + channel_clear, + receiving_packet, + pending_packet, + on, + off, }; /*---------------------------------------------------------------------------*/ #if !NETSTACK_CONF_SHORTCUTS diff --git a/cpu/cc2430/dev/cc2430_rf.h b/cpu/cc2430/dev/cc2430_rf.h index 9ef949726..f9ec32566 100644 --- a/cpu/cc2430/dev/cc2430_rf.h +++ b/cpu/cc2430/dev/cc2430_rf.h @@ -16,15 +16,14 @@ #endif /* Constants */ -typedef enum rf_address_mode_t -{ - RF_DECODER_NONE = 0, - RF_DECODER_COORDINATOR, - RF_SOFTACK_MONITOR, - RF_MONITOR, - RF_SOFTACK_CLIENT, - RF_DECODER_ON -}rf_address_mode_t; +typedef enum rf_address_mode_t { + RF_DECODER_NONE = 0, + RF_DECODER_COORDINATOR, + RF_SOFTACK_MONITOR, + RF_MONITOR, + RF_SOFTACK_CLIENT, + RF_DECODER_ON +} rf_address_mode_t; /*CSP command set*/ #define SSTOP 0xDF @@ -79,10 +78,10 @@ uint8_t cc2430_rf_power_set(uint8_t new_power); void cc2430_rf_set_addr(unsigned pan, unsigned addr, const uint8_t *ieee_addr); #if !NETSTACK_CONF_SHORTCUTS -extern void cc2430_rf_ISR( void ) __interrupt (RF_VECTOR); +extern void cc2430_rf_ISR(void) __interrupt(RF_VECTOR); #endif #if CC2430_RFERR_INTERRUPT -extern void cc2430_rf_error_ISR( void ) __interrupt (RFERR_VECTOR); +extern void cc2430_rf_error_ISR(void) __interrupt(RFERR_VECTOR); #endif #ifdef HAVE_RF_DMA diff --git a/cpu/cc2430/dev/cc2430_rf_intr.c b/cpu/cc2430/dev/cc2430_rf_intr.c index b19a1156b..85b9879c9 100644 --- a/cpu/cc2430/dev/cc2430_rf_intr.c +++ b/cpu/cc2430/dev/cc2430_rf_intr.c @@ -61,7 +61,7 @@ PROCESS_NAME(cc2430_rf_process); #pragma exclude bits #endif void -cc2430_rf_ISR( void ) __interrupt (RF_VECTOR) +cc2430_rf_ISR(void) __interrupt(RF_VECTOR) { EA = 0; ENERGEST_ON(ENERGEST_TYPE_IRQ); @@ -70,9 +70,9 @@ cc2430_rf_ISR( void ) __interrupt (RF_VECTOR) * Just double check the flag. */ if(RFIF & IRQ_FIFOP) { - RF_RX_LED_ON(); - /* Poll the RF process which calls cc2430_rf_read() */ - process_poll(&cc2430_rf_process); + RF_RX_LED_ON(); + /* Poll the RF process which calls cc2430_rf_read() */ + process_poll(&cc2430_rf_process); } S1CON &= ~(RFIF_0 | RFIF_1); @@ -92,7 +92,7 @@ cc2430_rf_ISR( void ) __interrupt (RF_VECTOR) #pragma exclude bits #endif void -cc2430_rf_error_ISR( void ) __interrupt (RFERR_VECTOR) +cc2430_rf_error_ISR(void) __interrupt(RFERR_VECTOR) { EA = 0; TCON_RFERRIF = 0; diff --git a/cpu/cc2430/dev/clock.c b/cpu/cc2430/dev/clock.c index e36a11297..c0b8f2c9d 100644 --- a/cpu/cc2430/dev/clock.c +++ b/cpu/cc2430/dev/clock.c @@ -98,14 +98,14 @@ clock_init(void) CLKCON = OSC32K | TICKSPD2 | TICKSPD1; /* tickspeed 500 kHz for timers[1-4] */ /* Initialize tick value */ - timer_value = ST0; /* ST low bits [7:0] */ - timer_value += ((unsigned long int) ST1) << 8; /* middle bits [15:8] */ - timer_value += ((unsigned long int) ST2) << 16; /* high bits [23:16] */ - timer_value += TICK_VAL; /* Init value 256 */ - ST2 = (unsigned char) (timer_value >> 16); - ST1 = (unsigned char) (timer_value >> 8); - ST0 = (unsigned char) timer_value; - + timer_value = ST0; /* ST low bits [7:0] */ + timer_value += ((unsigned long int)ST1) << 8; /* middle bits [15:8] */ + timer_value += ((unsigned long int)ST2) << 16; /* high bits [23:16] */ + timer_value += TICK_VAL; /* Init value 256 */ + ST2 = (unsigned char)(timer_value >> 16); + ST1 = (unsigned char)(timer_value >> 8); + ST0 = (unsigned char)timer_value; + IEN0_STIE = 1; /* IEN0.STIE acknowledge Sleep Timer Interrupt */ } /*---------------------------------------------------------------------------*/ @@ -131,15 +131,15 @@ clock_ISR(void) __interrupt(ST_VECTOR) * Next interrupt occurs after the current time + TICK_VAL */ timer_value = ST0; - timer_value += ((unsigned long int) ST1) << 8; - timer_value += ((unsigned long int) ST2) << 16; + timer_value += ((unsigned long int)ST1) << 8; + timer_value += ((unsigned long int)ST2) << 16; timer_value += TICK_VAL; - ST2 = (unsigned char) (timer_value >> 16); - ST1 = (unsigned char) (timer_value >> 8); - ST0 = (unsigned char) timer_value; - + ST2 = (unsigned char)(timer_value >> 16); + ST1 = (unsigned char)(timer_value >> 8); + ST0 = (unsigned char)timer_value; + ++count; - + /* Make sure the CLOCK_CONF_SECOND is a power of two, to ensure that the modulo operation below becomes a logical and and not an expensive divide. Algorithm from Wikipedia: @@ -160,7 +160,7 @@ clock_ISR(void) __interrupt(ST_VECTOR) etimer_request_poll(); } #endif - + IRCON_STIF = 0; ENERGEST_OFF(ENERGEST_TYPE_IRQ); ENABLE_INTERRUPTS(); diff --git a/cpu/cc2430/dev/dma.c b/cpu/cc2430/dev/dma.c index d549850c5..2c198acc3 100644 --- a/cpu/cc2430/dev/dma.c +++ b/cpu/cc2430/dev/dma.c @@ -16,7 +16,7 @@ #if DMA_ON struct dma_config dma_conf[DMA_CHANNEL_COUNT]; /* DMA Descriptors */ -struct process * dma_callback[DMA_CHANNEL_COUNT]; +struct process *dma_callback[DMA_CHANNEL_COUNT]; /*---------------------------------------------------------------------------*/ void dma_init(void) @@ -30,7 +30,7 @@ dma_init(void) } /* The address of the descriptor for Channel 0 is configured separately */ - tmp_ptr = (uint16_t) &(dma_conf[0]); + tmp_ptr = (uint16_t)&(dma_conf[0]); DMA0CFGH = tmp_ptr >> 8; DMA0CFGL = tmp_ptr; @@ -40,7 +40,7 @@ dma_init(void) * derived by the SoC */ #if (DMA_CHANNEL_COUNT > 1) - tmp_ptr = (uint16_t) &(dma_conf[1]); + tmp_ptr = (uint16_t)&(dma_conf[1]); DMA1CFGH = tmp_ptr >> 8; DMA1CFGL = tmp_ptr; #endif @@ -53,7 +53,7 @@ dma_init(void) * completes, the ISR will poll this process. */ void -dma_associate_process(struct process * p, uint8_t c) +dma_associate_process(struct process *p, uint8_t c) { if((!c) || (c >= DMA_CHANNEL_COUNT)) { return; diff --git a/cpu/cc2430/dev/dma.h b/cpu/cc2430/dev/dma.h index d88167734..30060b40f 100644 --- a/cpu/cc2430/dev/dma.h +++ b/cpu/cc2430/dev/dma.h @@ -138,11 +138,11 @@ extern dma_config_t dma_conf[DMA_CHANNEL_COUNT]; /* Functions Declarations */ void dma_init(void); -void dma_associate_process (struct process * p, uint8_t c); +void dma_associate_process(struct process *p, uint8_t c); /* Only link the ISR when DMA_ON is .... on */ #if DMA_ON -void dma_ISR( void ) __interrupt (DMA_VECTOR); +void dma_ISR(void) __interrupt(DMA_VECTOR); #endif #endif /*__DMA_H*/ diff --git a/cpu/cc2430/dev/dma_intr.c b/cpu/cc2430/dev/dma_intr.c index 1e8dbe2aa..01e96c8ac 100644 --- a/cpu/cc2430/dev/dma_intr.c +++ b/cpu/cc2430/dev/dma_intr.c @@ -16,7 +16,7 @@ #include "cc2430_sfr.h" #if DMA_ON -extern struct process * dma_callback[DMA_CHANNEL_COUNT]; +extern struct process *dma_callback[DMA_CHANNEL_COUNT]; #endif /*---------------------------------------------------------------------------*/ @@ -37,17 +37,17 @@ extern void spi_rx_dma_callback(void); #pragma exclude bits #endif void -dma_ISR(void) __interrupt (DMA_VECTOR) +dma_ISR(void) __interrupt(DMA_VECTOR) { #if DMA_ON uint8_t i; #endif - EA=0; + EA = 0; IRCON_DMAIF = 0; #ifdef HAVE_RF_DMA if((DMAIRQ & 1) != 0) { DMAIRQ &= ~1; - DMAARM=0x81; + DMAARM = 0x81; rf_dma_callback_isr(); } #endif diff --git a/cpu/cc2430/dev/uart0.h b/cpu/cc2430/dev/uart0.h index 7ac56e9f6..8a1357639 100644 --- a/cpu/cc2430/dev/uart0.h +++ b/cpu/cc2430/dev/uart0.h @@ -20,12 +20,12 @@ void uart0_init(); void uart0_writeb(uint8_t byte); -void uart0_set_input(int (*input)(unsigned char c)); +void uart0_set_input(int (* input)(unsigned char c)); -void uart0_rx_ISR( void ) __interrupt (URX0_VECTOR); -void uart0_tx_ISR( void ) __interrupt (UTX0_VECTOR); +void uart0_rx_ISR(void) __interrupt(URX0_VECTOR); +void uart0_tx_ISR(void) __interrupt(UTX0_VECTOR); /* Macro to turn on / off UART RX Interrupt */ -#define UART0_RX_INT(v) IEN0_URX0IE = v +#define UART0_RX_INT(v) do { IEN0_URX0IE = v; } while(0) #endif #endif /* UART_0_H */ diff --git a/cpu/cc2430/dev/uart1.h b/cpu/cc2430/dev/uart1.h index 53022a902..1a4b7e9fa 100644 --- a/cpu/cc2430/dev/uart1.h +++ b/cpu/cc2430/dev/uart1.h @@ -22,10 +22,10 @@ void uart1_writeb(uint8_t byte); void uart1_set_input(int (*input)(unsigned char c)); #if UART_ONE_CONF_WITH_INPUT -void uart1_rx_ISR( void ) __interrupt (URX1_VECTOR); -void uart1_tx_ISR( void ) __interrupt (UTX1_VECTOR); +void uart1_rx_ISR(void) __interrupt(URX1_VECTOR); +void uart1_tx_ISR(void) __interrupt(UTX1_VECTOR); /* Macro to turn on / off UART RX Interrupt */ -#define UART1_RX_INT(v) IEN0_URX1IE = v +#define UART1_RX_INT(v) do { IEN0_URX1IE = v; } while(0) #else #define UART1_RX_INT(v) #endif /* UART_ONE_CONF_WITH_INPUT */ diff --git a/cpu/cc2430/dev/uart_intr.c b/cpu/cc2430/dev/uart_intr.c index 8e087791f..17a5427aa 100644 --- a/cpu/cc2430/dev/uart_intr.c +++ b/cpu/cc2430/dev/uart_intr.c @@ -21,16 +21,16 @@ #include "sys/energest.h" #if UART_ZERO_ENABLE -static int (*uart0_input_handler)(unsigned char c); +static int (* uart0_input_handler)(unsigned char c); #endif #if UART_ONE_ENABLE -static int (*uart1_input_handler)(unsigned char c); +static int (* uart1_input_handler)(unsigned char c); #endif #if UART_ZERO_ENABLE /*---------------------------------------------------------------------------*/ void -uart0_set_input(int (*input)(unsigned char c)) +uart0_set_input(int (* input)(unsigned char c)) { uart0_input_handler = input; } @@ -41,7 +41,7 @@ uart0_set_input(int (*input)(unsigned char c)) #pragma exclude bits #endif void -uart0_rx_ISR(void) __interrupt (URX0_VECTOR) +uart0_rx_ISR(void) __interrupt(URX0_VECTOR) { ENERGEST_ON(ENERGEST_TYPE_IRQ); TCON_URX0IF = 0; @@ -52,7 +52,7 @@ uart0_rx_ISR(void) __interrupt (URX0_VECTOR) } /*---------------------------------------------------------------------------*/ void -uart0_tx_ISR( void ) __interrupt (UTX0_VECTOR) +uart0_tx_ISR(void) __interrupt(UTX0_VECTOR) { } #pragma restore @@ -60,7 +60,7 @@ uart0_tx_ISR( void ) __interrupt (UTX0_VECTOR) #if UART_ONE_ENABLE /*---------------------------------------------------------------------------*/ void -uart1_set_input(int (*input)(unsigned char c)) +uart1_set_input(int (* input)(unsigned char c)) { uart1_input_handler = input; } @@ -71,7 +71,7 @@ uart1_set_input(int (*input)(unsigned char c)) #pragma exclude bits #endif void -uart1_rx_ISR(void) __interrupt (URX1_VECTOR) +uart1_rx_ISR(void) __interrupt(URX1_VECTOR) { ENERGEST_ON(ENERGEST_TYPE_IRQ); TCON_URX1IF = 0; @@ -82,7 +82,7 @@ uart1_rx_ISR(void) __interrupt (URX1_VECTOR) } /*---------------------------------------------------------------------------*/ void -uart1_tx_ISR( void ) __interrupt (UTX1_VECTOR) +uart1_tx_ISR(void) __interrupt(UTX1_VECTOR) { } #pragma restore diff --git a/cpu/cc2430/dev/watchdog-cc2430.c b/cpu/cc2430/dev/watchdog-cc2430.c index 47df7a1c8..f8c4646a5 100644 --- a/cpu/cc2430/dev/watchdog-cc2430.c +++ b/cpu/cc2430/dev/watchdog-cc2430.c @@ -52,7 +52,7 @@ #pragma exclude bits #endif void -cc4230_watchdog_ISR(void) __interrupt (WDT_VECTOR) +cc4230_watchdog_ISR(void) __interrupt(WDT_VECTOR) { EA = 0; ENERGEST_ON(ENERGEST_TYPE_IRQ); diff --git a/cpu/cc2430/mtarch.h b/cpu/cc2430/mtarch.h index b228150ab..381737888 100644 --- a/cpu/cc2430/mtarch.h +++ b/cpu/cc2430/mtarch.h @@ -29,16 +29,16 @@ * */ - /* - * \file - * Stub header file for cc2430 multi-threading. It doesn't do anything, it - * just exists so that mt.c can compile cleanly. - * - * This is based on the original mtarch.h for z80 by Takahide Matsutsuka - * - * \author - * George Oikonomou - - */ +/* + * \file + * Stub header file for cc2430 multi-threading. It doesn't do anything, it + * just exists so that mt.c can compile cleanly. + * + * This is based on the original mtarch.h for z80 by Takahide Matsutsuka + * + * \author + * George Oikonomou - + */ #ifndef __MTARCH_H__ #define __MTARCH_H__ @@ -47,4 +47,3 @@ struct mtarch_thread { }; #endif /* __MTARCH_H__ */ - diff --git a/cpu/cc2430/rtimer-arch.c b/cpu/cc2430/rtimer-arch.c index d2ec784c9..1abff5c08 100644 --- a/cpu/cc2430/rtimer-arch.c +++ b/cpu/cc2430/rtimer-arch.c @@ -95,8 +95,8 @@ rtimer_arch_schedule(rtimer_clock_t t) PRINTF("rtimer_arch_schedule(%u)\n", t); /* set the compare mode values so we can get an interrupt after t */ - T1CC1L = (unsigned char) t; - T1CC1H = (unsigned char) (t >> 8); + T1CC1L = (unsigned char)t; + T1CC1H = (unsigned char)(t >> 8); PRINTF("T1CC1=%u, t=%u\n", (T1CC1L + (T1CC1H << 8)), t); /* Turn on compare mode interrupt */ @@ -109,7 +109,7 @@ rtimer_arch_schedule(rtimer_clock_t t) #pragma exclude bits #endif void -cc2430_timer_1_ISR(void) __interrupt (T1_VECTOR) +cc2430_timer_1_ISR(void) __interrupt(T1_VECTOR) { IEN1_T1IE = 0; /* Ignore Timer 1 Interrupts */ ENERGEST_ON(ENERGEST_TYPE_IRQ); diff --git a/cpu/cc2430/rtimer-arch.h b/cpu/cc2430/rtimer-arch.h index c44046c62..a29f1bae5 100644 --- a/cpu/cc2430/rtimer-arch.h +++ b/cpu/cc2430/rtimer-arch.h @@ -57,6 +57,6 @@ #define rtimer_arch_now() ((rtimer_clock_t)(T1CNTL + (T1CNTH << 8))) -void cc2430_timer_1_ISR(void) __interrupt (T1_VECTOR); +void cc2430_timer_1_ISR(void) __interrupt(T1_VECTOR); #endif /* __RTIMER_ARCH_H__ */ diff --git a/cpu/cc2430/stack.c b/cpu/cc2430/stack.c index 0a26330fa..7043b2edf 100644 --- a/cpu/cc2430/stack.c +++ b/cpu/cc2430/stack.c @@ -60,7 +60,7 @@ poison_loop: uint8_t stack_get_max(void) { - __data uint8_t * sp = (__data uint8_t *) 0xff; + __data uint8_t *sp = (__data uint8_t *)0xff; uint8_t free = 0; while(*sp-- == STACK_POISON) {