Code style fixes: cc253x

This commit is contained in:
George Oikonomou 2012-12-16 13:10:28 +00:00
parent 874bec26a5
commit 380ee3bae9
12 changed files with 74 additions and 76 deletions

View file

@ -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,8 +483,7 @@ off(void)
return 1;
}
/*---------------------------------------------------------------------------*/
const struct radio_driver cc2530_rf_driver =
{
const struct radio_driver cc2530_rf_driver = {
init,
prepare,
transmit,

View file

@ -121,12 +121,12 @@ 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,12 +147,12 @@ 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;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -29,7 +29,7 @@
*
*/
/*
/*
* \file
* Stub header file for multi-threading. It doesn't do anything, it
* just exists so that mt.c can compile cleanly.
@ -47,4 +47,3 @@ struct mtarch_thread {
};
#endif /* __MTARCH_H__ */

View file

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

View file

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