Code style fixes: cc253x
This commit is contained in:
parent
874bec26a5
commit
380ee3bae9
|
@ -240,8 +240,8 @@ prepare(const void *payload, unsigned short payload_len)
|
||||||
/* Send the phy length byte first */
|
/* Send the phy length byte first */
|
||||||
RFD = payload_len + CHECKSUM_LEN; /* Payload plus FCS */
|
RFD = payload_len + CHECKSUM_LEN; /* Payload plus FCS */
|
||||||
for(i = 0; i < payload_len; i++) {
|
for(i = 0; i < payload_len; i++) {
|
||||||
RFD = ((unsigned char*) (payload))[i];
|
RFD = ((unsigned char *)(payload))[i];
|
||||||
PUTHEX(((unsigned char*)(payload))[i]);
|
PUTHEX(((unsigned char *)(payload))[i]);
|
||||||
}
|
}
|
||||||
PUTSTRING("\n");
|
PUTSTRING("\n");
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ transmit(unsigned short transmit_len)
|
||||||
t0 = RTIMER_NOW();
|
t0 = RTIMER_NOW();
|
||||||
on();
|
on();
|
||||||
rf_flags |= WAS_OFF;
|
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) {
|
if(channel_clear() == CC2530_RF_CCA_BUSY) {
|
||||||
|
@ -305,7 +305,7 @@ transmit(unsigned short transmit_len)
|
||||||
ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT);
|
ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT);
|
||||||
ENERGEST_ON(ENERGEST_TYPE_LISTEN);
|
ENERGEST_ON(ENERGEST_TYPE_LISTEN);
|
||||||
|
|
||||||
if(rf_flags & WAS_OFF){
|
if(rf_flags & WAS_OFF) {
|
||||||
off();
|
off();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,11 +379,11 @@ read(void *buf, unsigned short bufsize)
|
||||||
PUTSTRING(" bytes) = ");
|
PUTSTRING(" bytes) = ");
|
||||||
len -= CHECKSUM_LEN;
|
len -= CHECKSUM_LEN;
|
||||||
for(i = 0; i < len; ++i) {
|
for(i = 0; i < len; ++i) {
|
||||||
((unsigned char*)(buf))[i] = RFD;
|
((unsigned char *)(buf))[i] = RFD;
|
||||||
#if CC2530_RF_CONF_HEXDUMP
|
#if CC2530_RF_CONF_HEXDUMP
|
||||||
io_arch_writeb(((unsigned char*)(buf))[i]);
|
io_arch_writeb(((unsigned char *)(buf))[i]);
|
||||||
#endif
|
#endif
|
||||||
PUTHEX(((unsigned char*)(buf))[i]);
|
PUTHEX(((unsigned char *)(buf))[i]);
|
||||||
}
|
}
|
||||||
PUTSTRING("\n");
|
PUTSTRING("\n");
|
||||||
|
|
||||||
|
@ -483,17 +483,16 @@ off(void)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
const struct radio_driver cc2530_rf_driver =
|
const struct radio_driver cc2530_rf_driver = {
|
||||||
{
|
init,
|
||||||
init,
|
prepare,
|
||||||
prepare,
|
transmit,
|
||||||
transmit,
|
send,
|
||||||
send,
|
read,
|
||||||
read,
|
channel_clear,
|
||||||
channel_clear,
|
receiving_packet,
|
||||||
receiving_packet,
|
pending_packet,
|
||||||
pending_packet,
|
on,
|
||||||
on,
|
off,
|
||||||
off,
|
|
||||||
};
|
};
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -121,12 +121,12 @@ clock_init(void)
|
||||||
|
|
||||||
/* Initialize tick value */
|
/* Initialize tick value */
|
||||||
timer_value = ST0;
|
timer_value = ST0;
|
||||||
timer_value += ((unsigned long int) ST1) << 8;
|
timer_value += ((unsigned long int)ST1) << 8;
|
||||||
timer_value += ((unsigned long int) ST2) << 16;
|
timer_value += ((unsigned long int)ST2) << 16;
|
||||||
timer_value += TICK_VAL;
|
timer_value += TICK_VAL;
|
||||||
ST2 = (unsigned char) (timer_value >> 16);
|
ST2 = (unsigned char)(timer_value >> 16);
|
||||||
ST1 = (unsigned char) (timer_value >> 8);
|
ST1 = (unsigned char)(timer_value >> 8);
|
||||||
ST0 = (unsigned char) timer_value;
|
ST0 = (unsigned char)timer_value;
|
||||||
|
|
||||||
STIE = 1; /* IEN0.STIE interrupt enable */
|
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
|
* Next interrupt occurs after the current time + TICK_VAL
|
||||||
*/
|
*/
|
||||||
timer_value = ST0;
|
timer_value = ST0;
|
||||||
timer_value += ((unsigned long int) ST1) << 8;
|
timer_value += ((unsigned long int)ST1) << 8;
|
||||||
timer_value += ((unsigned long int) ST2) << 16;
|
timer_value += ((unsigned long int)ST2) << 16;
|
||||||
timer_value += TICK_VAL;
|
timer_value += TICK_VAL;
|
||||||
ST2 = (unsigned char) (timer_value >> 16);
|
ST2 = (unsigned char)(timer_value >> 16);
|
||||||
ST1 = (unsigned char) (timer_value >> 8);
|
ST1 = (unsigned char)(timer_value >> 8);
|
||||||
ST0 = (unsigned char) timer_value;
|
ST0 = (unsigned char)timer_value;
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#if DMA_ON
|
#if DMA_ON
|
||||||
struct dma_config dma_conf[DMA_CHANNEL_COUNT]; /* DMA Descriptors */
|
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
|
void
|
||||||
dma_init(void)
|
dma_init(void)
|
||||||
|
@ -31,7 +31,7 @@ dma_init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The address of the descriptor for Channel 0 is configured separately */
|
/* 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;
|
DMA0CFGH = tmp_ptr >> 8;
|
||||||
DMA0CFGL = tmp_ptr;
|
DMA0CFGL = tmp_ptr;
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ dma_init(void)
|
||||||
* derived by the SoC
|
* derived by the SoC
|
||||||
*/
|
*/
|
||||||
#if (DMA_CHANNEL_COUNT > 1)
|
#if (DMA_CHANNEL_COUNT > 1)
|
||||||
tmp_ptr = (uint16_t) &(dma_conf[1]);
|
tmp_ptr = (uint16_t)&(dma_conf[1]);
|
||||||
DMA1CFGH = tmp_ptr >> 8;
|
DMA1CFGH = tmp_ptr >> 8;
|
||||||
DMA1CFGL = tmp_ptr;
|
DMA1CFGL = tmp_ptr;
|
||||||
#endif
|
#endif
|
||||||
|
@ -54,7 +54,7 @@ dma_init(void)
|
||||||
* completes, the ISR will poll this process.
|
* completes, the ISR will poll this process.
|
||||||
*/
|
*/
|
||||||
void
|
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)) {
|
if((!c) || (c >= DMA_CHANNEL_COUNT)) {
|
||||||
return;
|
return;
|
||||||
|
@ -80,15 +80,15 @@ dma_reset(uint8_t c)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
DMA_ABORT(c);
|
DMA_ABORT(c);
|
||||||
dma_conf[c].src_h = (uint16_t) &dummy >> 8;
|
dma_conf[c].src_h = (uint16_t)&dummy >> 8;
|
||||||
dma_conf[c].src_l = (uint16_t) &dummy;
|
dma_conf[c].src_l = (uint16_t)&dummy;
|
||||||
dma_conf[c].dst_h = (uint16_t) &dummy >> 8;
|
dma_conf[c].dst_h = (uint16_t)&dummy >> 8;
|
||||||
dma_conf[c].dst_l = (uint16_t) &dummy;
|
dma_conf[c].dst_l = (uint16_t)&dummy;
|
||||||
dma_conf[c].len_h = 0;
|
dma_conf[c].len_h = 0;
|
||||||
dma_conf[c].len_l = 1;
|
dma_conf[c].len_l = 1;
|
||||||
dma_conf[c].wtt = DMA_BLOCK;
|
dma_conf[c].wtt = DMA_BLOCK;
|
||||||
dma_conf[c].inc_prio = DMA_PRIO_GUARANTEED;
|
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);
|
DMA_ARM(c);
|
||||||
while(DMAARM & (1 << c));
|
while(DMAARM & (1 << c));
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,12 +139,12 @@ extern dma_config_t dma_conf[DMA_CHANNEL_COUNT];
|
||||||
|
|
||||||
/* Functions Declarations */
|
/* Functions Declarations */
|
||||||
void dma_init(void);
|
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);
|
void dma_reset(uint8_t c);
|
||||||
|
|
||||||
/* Only link the ISR when DMA_ON is .... on */
|
/* Only link the ISR when DMA_ON is .... on */
|
||||||
#if DMA_ON
|
#if DMA_ON
|
||||||
void dma_isr( void ) __interrupt (DMA_VECTOR);
|
void dma_isr(void) __interrupt(DMA_VECTOR);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /*__DMA_H*/
|
#endif /*__DMA_H*/
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
#include "cc253x.h"
|
#include "cc253x.h"
|
||||||
|
|
||||||
#if DMA_ON
|
#if DMA_ON
|
||||||
extern struct process * dma_callback[DMA_CHANNEL_COUNT];
|
extern struct process *dma_callback[DMA_CHANNEL_COUNT];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -38,17 +38,17 @@ extern void spi_rx_dma_callback(void);
|
||||||
#pragma exclude bits
|
#pragma exclude bits
|
||||||
#endif
|
#endif
|
||||||
void
|
void
|
||||||
dma_isr(void) __interrupt (DMA_VECTOR)
|
dma_isr(void) __interrupt(DMA_VECTOR)
|
||||||
{
|
{
|
||||||
#if DMA_ON
|
#if DMA_ON
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
#endif
|
#endif
|
||||||
EA=0;
|
EA = 0;
|
||||||
DMAIF = 0;
|
DMAIF = 0;
|
||||||
#ifdef HAVE_RF_DMA
|
#ifdef HAVE_RF_DMA
|
||||||
if((DMAIRQ & 1) != 0) {
|
if((DMAIRQ & 1) != 0) {
|
||||||
DMAIRQ = ~1;
|
DMAIRQ = ~1;
|
||||||
DMAARM=0x81;
|
DMAARM = 0x81;
|
||||||
rf_dma_callback_isr();
|
rf_dma_callback_isr();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -38,7 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
struct cc253x_p2_handler {
|
struct cc253x_p2_handler {
|
||||||
struct cc253x_p2_handler *next;
|
struct cc253x_p2_handler *next;
|
||||||
uint8_t (*cb) (void);
|
uint8_t (* cb)(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
void cc253x_p2_register_handler(struct cc253x_p2_handler *h);
|
void cc253x_p2_register_handler(struct cc253x_p2_handler *h);
|
||||||
|
|
|
@ -18,16 +18,16 @@
|
||||||
#include "dev/leds.h"
|
#include "dev/leds.h"
|
||||||
|
|
||||||
#if UART0_ENABLE
|
#if UART0_ENABLE
|
||||||
static int (*uart0_input_handler)(unsigned char c);
|
static int (* uart0_input_handler)(unsigned char c);
|
||||||
#endif
|
#endif
|
||||||
#if UART1_ENABLE
|
#if UART1_ENABLE
|
||||||
static int (*uart1_input_handler)(unsigned char c);
|
static int (* uart1_input_handler)(unsigned char c);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if UART0_ENABLE
|
#if UART0_ENABLE
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
uart0_set_input(int (*input)(unsigned char c))
|
uart0_set_input(int (* input)(unsigned char c))
|
||||||
{
|
{
|
||||||
uart0_input_handler = input;
|
uart0_input_handler = input;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ uart0_set_input(int (*input)(unsigned char c))
|
||||||
#pragma exclude bits
|
#pragma exclude bits
|
||||||
#endif
|
#endif
|
||||||
void
|
void
|
||||||
uart0_rx_isr(void) __interrupt (URX0_VECTOR)
|
uart0_rx_isr(void) __interrupt(URX0_VECTOR)
|
||||||
{
|
{
|
||||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||||
leds_toggle(LEDS_YELLOW);
|
leds_toggle(LEDS_YELLOW);
|
||||||
|
@ -55,7 +55,7 @@ uart0_rx_isr(void) __interrupt (URX0_VECTOR)
|
||||||
#if UART1_ENABLE
|
#if UART1_ENABLE
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
uart1_set_input(int (*input)(unsigned char c))
|
uart1_set_input(int (* input)(unsigned char c))
|
||||||
{
|
{
|
||||||
uart1_input_handler = input;
|
uart1_input_handler = input;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ uart1_set_input(int (*input)(unsigned char c))
|
||||||
#pragma exclude bits
|
#pragma exclude bits
|
||||||
#endif
|
#endif
|
||||||
void
|
void
|
||||||
uart1_rx_isr(void) __interrupt (URX1_VECTOR)
|
uart1_rx_isr(void) __interrupt(URX1_VECTOR)
|
||||||
{
|
{
|
||||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||||
URX1IF = 0;
|
URX1IF = 0;
|
||||||
|
|
|
@ -20,10 +20,10 @@
|
||||||
void uart0_init();
|
void uart0_init();
|
||||||
void uart0_writeb(uint8_t byte);
|
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
|
#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 */
|
/* Macro to turn on / off UART RX Interrupt */
|
||||||
#define UART0_RX_INT(v) do { URX0IE = v; } while(0)
|
#define UART0_RX_INT(v) do { URX0IE = v; } while(0)
|
||||||
#define UART0_RX_EN() do { U0CSR |= UCSR_RE; } while(0)
|
#define UART0_RX_EN() do { U0CSR |= UCSR_RE; } while(0)
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
void uart1_init();
|
void uart1_init();
|
||||||
void uart1_writeb(uint8_t byte);
|
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
|
#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 */
|
/* Macro to turn on / off UART RX Interrupt */
|
||||||
#define UART1_RX_INT(v) do { URX1IE = v; } while(0)
|
#define UART1_RX_INT(v) do { URX1IE = v; } while(0)
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -29,16 +29,16 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* \file
|
* \file
|
||||||
* Stub header file for multi-threading. It doesn't do anything, it
|
* Stub header file for multi-threading. It doesn't do anything, it
|
||||||
* just exists so that mt.c can compile cleanly.
|
* just exists so that mt.c can compile cleanly.
|
||||||
*
|
*
|
||||||
* This is based on the original mtarch.h for z80 by Takahide Matsutsuka
|
* This is based on the original mtarch.h for z80 by Takahide Matsutsuka
|
||||||
*
|
*
|
||||||
* \author
|
* \author
|
||||||
* George Oikonomou - <oikonomou@users.sourceforge.net>
|
* George Oikonomou - <oikonomou@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
#ifndef __MTARCH_H__
|
#ifndef __MTARCH_H__
|
||||||
#define __MTARCH_H__
|
#define __MTARCH_H__
|
||||||
|
|
||||||
|
@ -47,4 +47,3 @@ struct mtarch_thread {
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __MTARCH_H__ */
|
#endif /* __MTARCH_H__ */
|
||||||
|
|
||||||
|
|
|
@ -87,8 +87,8 @@ rtimer_arch_schedule(rtimer_clock_t t)
|
||||||
/* Switch to capture mode before writing T1CC1x and
|
/* Switch to capture mode before writing T1CC1x and
|
||||||
* set the compare mode values so we can get an interrupt after t */
|
* set the compare mode values so we can get an interrupt after t */
|
||||||
RT_MODE_CAPTURE();
|
RT_MODE_CAPTURE();
|
||||||
T1CC1L = (unsigned char) t;
|
T1CC1L = (unsigned char)t;
|
||||||
T1CC1H = (unsigned char) (t >> 8);
|
T1CC1H = (unsigned char)(t >> 8);
|
||||||
RT_MODE_COMPARE();
|
RT_MODE_COMPARE();
|
||||||
|
|
||||||
/* Turn on compare mode interrupt */
|
/* Turn on compare mode interrupt */
|
||||||
|
|
|
@ -60,7 +60,7 @@ poison_loop:
|
||||||
uint8_t
|
uint8_t
|
||||||
stack_get_max(void)
|
stack_get_max(void)
|
||||||
{
|
{
|
||||||
__data uint8_t * sp = (__data uint8_t *) 0xff;
|
__data uint8_t *sp = (__data uint8_t *)0xff;
|
||||||
uint8_t free = 0;
|
uint8_t free = 0;
|
||||||
|
|
||||||
while(*sp-- == STACK_POISON) {
|
while(*sp-- == STACK_POISON) {
|
||||||
|
|
Loading…
Reference in a new issue