diff --git a/cpu/cc253x/dev/cc2530-rf.c b/cpu/cc253x/dev/cc2530-rf.c index a07125f0b..25b16ea84 100644 --- a/cpu/cc253x/dev/cc2530-rf.c +++ b/cpu/cc253x/dev/cc2530-rf.c @@ -67,9 +67,9 @@ #define RF_TX_LED_OFF() leds_off(LEDS_GREEN); #else #define RF_RX_LED_ON() -#define RF_RX_LED_OFF() +#define RF_RX_LED_OFF() #define RF_TX_LED_ON() -#define RF_TX_LED_OFF() +#define RF_TX_LED_OFF() #endif /*---------------------------------------------------------------------------*/ #define DEBUG 0 @@ -240,8 +240,8 @@ prepare(const void *payload, unsigned short payload_len) /* Send the phy length byte first */ RFD = payload_len + CHECKSUM_LEN; /* Payload plus FCS */ for(i = 0; i < payload_len; i++) { - RFD = ((unsigned char*) (payload))[i]; - PUTHEX(((unsigned char*)(payload))[i]); + RFD = ((unsigned char *)(payload))[i]; + PUTHEX(((unsigned char *)(payload))[i]); } PUTSTRING("\n"); @@ -264,7 +264,7 @@ transmit(unsigned short transmit_len) t0 = RTIMER_NOW(); on(); rf_flags |= WAS_OFF; - while (RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + ONOFF_TIME)); + while(RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + ONOFF_TIME)); } if(channel_clear() == CC2530_RF_CCA_BUSY) { @@ -305,7 +305,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(); } @@ -379,11 +379,11 @@ read(void *buf, unsigned short bufsize) PUTSTRING(" bytes) = "); len -= CHECKSUM_LEN; for(i = 0; i < len; ++i) { - ((unsigned char*)(buf))[i] = RFD; + ((unsigned char *)(buf))[i] = RFD; #if CC2530_RF_CONF_HEXDUMP - io_arch_writeb(((unsigned char*)(buf))[i]); + io_arch_writeb(((unsigned char *)(buf))[i]); #endif - PUTHEX(((unsigned char*)(buf))[i]); + PUTHEX(((unsigned char *)(buf))[i]); } PUTSTRING("\n"); @@ -483,17 +483,16 @@ off(void) return 1; } /*---------------------------------------------------------------------------*/ -const struct radio_driver cc2530_rf_driver = -{ - init, - prepare, - transmit, - send, - read, - channel_clear, - receiving_packet, - pending_packet, - on, - off, +const struct radio_driver cc2530_rf_driver = { + init, + prepare, + transmit, + send, + read, + channel_clear, + receiving_packet, + pending_packet, + on, + off, }; /*---------------------------------------------------------------------------*/ diff --git a/cpu/cc253x/dev/clock.c b/cpu/cc253x/dev/clock.c index e82def45c..ff1c4cf4a 100644 --- a/cpu/cc253x/dev/clock.c +++ b/cpu/cc253x/dev/clock.c @@ -121,13 +121,13 @@ clock_init(void) /* Initialize tick value */ 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; + STIE = 1; /* IEN0.STIE interrupt enable */ } /*---------------------------------------------------------------------------*/ @@ -147,15 +147,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: @@ -167,7 +167,7 @@ clock_isr(void) __interrupt(ST_VECTOR) if(count % CLOCK_CONF_SECOND == 0) { ++seconds; } - + #if CLOCK_CONF_STACK_FRIENDLY sleep_flag = 1; #else @@ -176,7 +176,7 @@ clock_isr(void) __interrupt(ST_VECTOR) etimer_request_poll(); } #endif - + STIF = 0; /* IRCON.STIF */ ENERGEST_OFF(ENERGEST_TYPE_IRQ); ENABLE_INTERRUPTS(); diff --git a/cpu/cc253x/dev/dma.c b/cpu/cc253x/dev/dma.c index 9a4c5db01..93e01cf1d 100644 --- a/cpu/cc253x/dev/dma.c +++ b/cpu/cc253x/dev/dma.c @@ -17,7 +17,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) @@ -31,7 +31,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; @@ -41,7 +41,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 @@ -54,7 +54,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; @@ -80,15 +80,15 @@ dma_reset(uint8_t c) return; } DMA_ABORT(c); - dma_conf[c].src_h = (uint16_t) &dummy >> 8; - dma_conf[c].src_l = (uint16_t) &dummy; - dma_conf[c].dst_h = (uint16_t) &dummy >> 8; - dma_conf[c].dst_l = (uint16_t) &dummy; + dma_conf[c].src_h = (uint16_t)&dummy >> 8; + dma_conf[c].src_l = (uint16_t)&dummy; + dma_conf[c].dst_h = (uint16_t)&dummy >> 8; + dma_conf[c].dst_l = (uint16_t)&dummy; dma_conf[c].len_h = 0; dma_conf[c].len_l = 1; dma_conf[c].wtt = DMA_BLOCK; dma_conf[c].inc_prio = DMA_PRIO_GUARANTEED; - DMA_TRIGGER(c); // The operation order is important + DMA_TRIGGER(c); /** The operation order is important */ DMA_ARM(c); while(DMAARM & (1 << c)); } diff --git a/cpu/cc253x/dev/dma.h b/cpu/cc253x/dev/dma.h index 7f767bc68..606be2ae6 100644 --- a/cpu/cc253x/dev/dma.h +++ b/cpu/cc253x/dev/dma.h @@ -139,12 +139,12 @@ 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); void dma_reset(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/cc253x/dev/dma_intr.c b/cpu/cc253x/dev/dma_intr.c index 633fb3cda..863691e9e 100644 --- a/cpu/cc253x/dev/dma_intr.c +++ b/cpu/cc253x/dev/dma_intr.c @@ -16,7 +16,7 @@ #include "cc253x.h" #if DMA_ON -extern struct process * dma_callback[DMA_CHANNEL_COUNT]; +extern struct process *dma_callback[DMA_CHANNEL_COUNT]; #endif /*---------------------------------------------------------------------------*/ @@ -38,17 +38,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; 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/cc253x/dev/port2.h b/cpu/cc253x/dev/port2.h index f70d5d036..10f9774ec 100644 --- a/cpu/cc253x/dev/port2.h +++ b/cpu/cc253x/dev/port2.h @@ -38,7 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. struct cc253x_p2_handler { struct cc253x_p2_handler *next; - uint8_t (*cb) (void); + uint8_t (* cb)(void); }; void cc253x_p2_register_handler(struct cc253x_p2_handler *h); diff --git a/cpu/cc253x/dev/uart-intr.c b/cpu/cc253x/dev/uart-intr.c index ebe1814c1..89b7c8fb1 100644 --- a/cpu/cc253x/dev/uart-intr.c +++ b/cpu/cc253x/dev/uart-intr.c @@ -18,16 +18,16 @@ #include "dev/leds.h" #if UART0_ENABLE -static int (*uart0_input_handler)(unsigned char c); +static int (* uart0_input_handler)(unsigned char c); #endif #if UART1_ENABLE -static int (*uart1_input_handler)(unsigned char c); +static int (* uart1_input_handler)(unsigned char c); #endif #if UART0_ENABLE /*---------------------------------------------------------------------------*/ void -uart0_set_input(int (*input)(unsigned char c)) +uart0_set_input(int (* input)(unsigned char c)) { uart0_input_handler = input; } @@ -39,7 +39,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); leds_toggle(LEDS_YELLOW); @@ -55,7 +55,7 @@ uart0_rx_isr(void) __interrupt (URX0_VECTOR) #if UART1_ENABLE /*---------------------------------------------------------------------------*/ void -uart1_set_input(int (*input)(unsigned char c)) +uart1_set_input(int (* input)(unsigned char c)) { uart1_input_handler = input; } @@ -67,7 +67,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); URX1IF = 0; diff --git a/cpu/cc253x/dev/uart0.h b/cpu/cc253x/dev/uart0.h index 45839e120..3245964bf 100644 --- a/cpu/cc253x/dev/uart0.h +++ b/cpu/cc253x/dev/uart0.h @@ -20,10 +20,10 @@ 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)); #if UART0_CONF_WITH_INPUT -void uart0_rx_isr( void ) __interrupt (URX0_VECTOR); +void uart0_rx_isr(void) __interrupt(URX0_VECTOR); /* Macro to turn on / off UART RX Interrupt */ #define UART0_RX_INT(v) do { URX0IE = v; } while(0) #define UART0_RX_EN() do { U0CSR |= UCSR_RE; } while(0) diff --git a/cpu/cc253x/dev/uart1.h b/cpu/cc253x/dev/uart1.h index aea8bec48..203cfaa02 100644 --- a/cpu/cc253x/dev/uart1.h +++ b/cpu/cc253x/dev/uart1.h @@ -20,9 +20,9 @@ void uart1_init(); void uart1_writeb(uint8_t byte); -void uart1_set_input(int (*input)(unsigned char c)); +void uart1_set_input(int (* input)(unsigned char c)); #if UART1_CONF_WITH_INPUT -void uart1_rx_isr( void ) __interrupt (URX1_VECTOR); +void uart1_rx_isr(void) __interrupt(URX1_VECTOR); /* Macro to turn on / off UART RX Interrupt */ #define UART1_RX_INT(v) do { URX1IE = v; } while(0) #else diff --git a/cpu/cc253x/mtarch.h b/cpu/cc253x/mtarch.h index 89d7766e2..2272d7a5b 100644 --- a/cpu/cc253x/mtarch.h +++ b/cpu/cc253x/mtarch.h @@ -29,16 +29,16 @@ * */ - /* - * \file - * Stub header file for 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 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/cc253x/rtimer-arch.c b/cpu/cc253x/rtimer-arch.c index 6bf4405ca..71262910c 100644 --- a/cpu/cc253x/rtimer-arch.c +++ b/cpu/cc253x/rtimer-arch.c @@ -87,8 +87,8 @@ rtimer_arch_schedule(rtimer_clock_t t) /* Switch to capture mode before writing T1CC1x and * set the compare mode values so we can get an interrupt after t */ RT_MODE_CAPTURE(); - T1CC1L = (unsigned char) t; - T1CC1H = (unsigned char) (t >> 8); + T1CC1L = (unsigned char)t; + T1CC1H = (unsigned char)(t >> 8); RT_MODE_COMPARE(); /* Turn on compare mode interrupt */ diff --git a/cpu/cc253x/stack.c b/cpu/cc253x/stack.c index d6daf25a6..d116b02f2 100644 --- a/cpu/cc253x/stack.c +++ b/cpu/cc253x/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) {