Code style fixes: cc2430
This commit is contained in:
parent
b4bb51e811
commit
874bec26a5
|
@ -44,7 +44,7 @@
|
|||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
bus_init (void)
|
||||
bus_init(void)
|
||||
{
|
||||
CLKCON = (0x00 | OSC32K); /* 32k internal */
|
||||
while(CLKCON != (0x00 | OSC32K));
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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,7 +570,7 @@ 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) {
|
||||
|
@ -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,8 +686,7 @@ off(void)
|
|||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
const struct radio_driver cc2430_rf_driver =
|
||||
{
|
||||
const struct radio_driver cc2430_rf_driver = {
|
||||
init,
|
||||
prepare,
|
||||
transmit,
|
||||
|
|
|
@ -16,15 +16,14 @@
|
|||
#endif
|
||||
|
||||
/* Constants */
|
||||
typedef enum 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;
|
||||
} 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
|
||||
|
|
|
@ -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);
|
||||
|
@ -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;
|
||||
|
|
|
@ -99,12 +99,12 @@ clock_init(void)
|
|||
|
||||
/* 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 += ((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;
|
||||
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,12 +131,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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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*/
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
/*
|
||||
* \file
|
||||
* Stub header file for cc2430 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__ */
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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__ */
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue