Code style fixes: cc2430
This commit is contained in:
parent
b4bb51e811
commit
874bec26a5
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
bus_init (void)
|
bus_init(void)
|
||||||
{
|
{
|
||||||
CLKCON = (0x00 | OSC32K); /* 32k internal */
|
CLKCON = (0x00 | OSC32K); /* 32k internal */
|
||||||
while(CLKCON != (0x00 | OSC32K));
|
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) {
|
if(ieee_addr != NULL) {
|
||||||
ptr = &IEEE_ADDR7;
|
ptr = &IEEE_ADDR7;
|
||||||
/* LSB first, MSB last for 802.15.4 addresses in CC2420 */
|
/* 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];
|
*ptr-- = ieee_addr[f];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,10 +396,10 @@ prepare(const void *payload, unsigned short payload_len)
|
||||||
PRINTF("cc2430_rf: data = ");
|
PRINTF("cc2430_rf: data = ");
|
||||||
/* 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 */
|
||||||
PRINTF("(%d)", payload_len+CHECKSUM_LEN);
|
PRINTF("(%d)", payload_len + CHECKSUM_LEN);
|
||||||
for(i = 0; i < payload_len; i++) {
|
for(i = 0; i < payload_len; i++) {
|
||||||
RFD = ((unsigned char*) (payload))[i];
|
RFD = ((unsigned char *)(payload))[i];
|
||||||
PRINTF("%02X", ((unsigned char*)(payload))[i]);
|
PRINTF("%02X", ((unsigned char *)(payload))[i]);
|
||||||
}
|
}
|
||||||
PRINTF("\n");
|
PRINTF("\n");
|
||||||
|
|
||||||
|
@ -460,7 +460,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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,7 +510,7 @@ read(void *buf, unsigned short bufsize)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(len <= CC2430_MIN_PACKET_LEN) {
|
if(len <= CC2430_MIN_PACKET_LEN) {
|
||||||
PRINTF("error: too short\n");
|
PRINTF("error: too short\n");
|
||||||
|
|
||||||
RIMESTATS_ADD(tooshort);
|
RIMESTATS_ADD(tooshort);
|
||||||
flush_rx();
|
flush_rx();
|
||||||
|
@ -518,7 +518,7 @@ read(void *buf, unsigned short bufsize)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(len - CHECKSUM_LEN > bufsize) {
|
if(len - CHECKSUM_LEN > bufsize) {
|
||||||
PRINTF("error: too long\n");
|
PRINTF("error: too long\n");
|
||||||
|
|
||||||
RIMESTATS_ADD(toolong);
|
RIMESTATS_ADD(toolong);
|
||||||
flush_rx();
|
flush_rx();
|
||||||
|
@ -538,11 +538,11 @@ read(void *buf, unsigned short bufsize)
|
||||||
PRINTF("(%d)", len);
|
PRINTF("(%d)", len);
|
||||||
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 CC2430_RF_CONF_HEXDUMP
|
#if CC2430_RF_CONF_HEXDUMP
|
||||||
uart1_writeb(((unsigned char*)(buf))[i]);
|
uart1_writeb(((unsigned char *)(buf))[i]);
|
||||||
#endif
|
#endif
|
||||||
PRINTF("%02X", ((unsigned char*)(buf))[i]);
|
PRINTF("%02X", ((unsigned char *)(buf))[i]);
|
||||||
}
|
}
|
||||||
PRINTF("\n");
|
PRINTF("\n");
|
||||||
|
|
||||||
|
@ -570,17 +570,17 @@ read(void *buf, unsigned short bufsize)
|
||||||
RIMESTATS_ADD(badcrc);
|
RIMESTATS_ADD(badcrc);
|
||||||
flush_rx();
|
flush_rx();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If FIFOP==1 and FIFO==0 then we had a FIFO overflow at some point. */
|
/* If FIFOP==1 and FIFO==0 then we had a FIFO overflow at some point. */
|
||||||
if((RFSTATUS & (FIFO | FIFOP)) == FIFOP) {
|
if((RFSTATUS & (FIFO | FIFOP)) == FIFOP) {
|
||||||
/*
|
/*
|
||||||
* If we reach here means that there might be more intact packets in the
|
* 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.
|
* 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
|
* 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.
|
* pick up one more packet or flush due to an error.
|
||||||
*/
|
*/
|
||||||
if(!RXFIFOCNT) {
|
if(!RXFIFOCNT) {
|
||||||
flush_rx();
|
flush_rx();
|
||||||
}
|
}
|
||||||
|
@ -646,14 +646,14 @@ on(void)
|
||||||
RSSIH = 0xd2; /* -84dbm = 0xd2 default, 0xe0 -70 dbm */
|
RSSIH = 0xd2; /* -84dbm = 0xd2 default, 0xe0 -70 dbm */
|
||||||
|
|
||||||
RFPWR &= ~RREG_RADIO_PD; /* make sure it's powered */
|
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 */
|
/* Make sure the RREG On Interrupt Flag is 0 next time we get called */
|
||||||
RFIF &= ~IRQ_RREG_ON;
|
RFIF &= ~IRQ_RREG_ON;
|
||||||
|
|
||||||
cc2430_rf_command(ISRXON);
|
cc2430_rf_command(ISRXON);
|
||||||
cc2430_rf_command(ISFLUSHRX);
|
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");
|
PRINTF("cc2430_rf_rx_enable done\n");
|
||||||
|
@ -686,18 +686,17 @@ off(void)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
const struct radio_driver cc2430_rf_driver =
|
const struct radio_driver cc2430_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,
|
|
||||||
};
|
};
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#if !NETSTACK_CONF_SHORTCUTS
|
#if !NETSTACK_CONF_SHORTCUTS
|
||||||
|
|
|
@ -16,15 +16,14 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Constants */
|
/* Constants */
|
||||||
typedef enum rf_address_mode_t
|
typedef enum rf_address_mode_t {
|
||||||
{
|
RF_DECODER_NONE = 0,
|
||||||
RF_DECODER_NONE = 0,
|
RF_DECODER_COORDINATOR,
|
||||||
RF_DECODER_COORDINATOR,
|
RF_SOFTACK_MONITOR,
|
||||||
RF_SOFTACK_MONITOR,
|
RF_MONITOR,
|
||||||
RF_MONITOR,
|
RF_SOFTACK_CLIENT,
|
||||||
RF_SOFTACK_CLIENT,
|
RF_DECODER_ON
|
||||||
RF_DECODER_ON
|
} rf_address_mode_t;
|
||||||
}rf_address_mode_t;
|
|
||||||
|
|
||||||
/*CSP command set*/
|
/*CSP command set*/
|
||||||
#define SSTOP 0xDF
|
#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);
|
void cc2430_rf_set_addr(unsigned pan, unsigned addr, const uint8_t *ieee_addr);
|
||||||
|
|
||||||
#if !NETSTACK_CONF_SHORTCUTS
|
#if !NETSTACK_CONF_SHORTCUTS
|
||||||
extern void cc2430_rf_ISR( void ) __interrupt (RF_VECTOR);
|
extern void cc2430_rf_ISR(void) __interrupt(RF_VECTOR);
|
||||||
#endif
|
#endif
|
||||||
#if CC2430_RFERR_INTERRUPT
|
#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
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_RF_DMA
|
#ifdef HAVE_RF_DMA
|
||||||
|
|
|
@ -61,7 +61,7 @@ PROCESS_NAME(cc2430_rf_process);
|
||||||
#pragma exclude bits
|
#pragma exclude bits
|
||||||
#endif
|
#endif
|
||||||
void
|
void
|
||||||
cc2430_rf_ISR( void ) __interrupt (RF_VECTOR)
|
cc2430_rf_ISR(void) __interrupt(RF_VECTOR)
|
||||||
{
|
{
|
||||||
EA = 0;
|
EA = 0;
|
||||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||||
|
@ -70,9 +70,9 @@ cc2430_rf_ISR( void ) __interrupt (RF_VECTOR)
|
||||||
* Just double check the flag.
|
* Just double check the flag.
|
||||||
*/
|
*/
|
||||||
if(RFIF & IRQ_FIFOP) {
|
if(RFIF & IRQ_FIFOP) {
|
||||||
RF_RX_LED_ON();
|
RF_RX_LED_ON();
|
||||||
/* Poll the RF process which calls cc2430_rf_read() */
|
/* Poll the RF process which calls cc2430_rf_read() */
|
||||||
process_poll(&cc2430_rf_process);
|
process_poll(&cc2430_rf_process);
|
||||||
}
|
}
|
||||||
S1CON &= ~(RFIF_0 | RFIF_1);
|
S1CON &= ~(RFIF_0 | RFIF_1);
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ cc2430_rf_ISR( void ) __interrupt (RF_VECTOR)
|
||||||
#pragma exclude bits
|
#pragma exclude bits
|
||||||
#endif
|
#endif
|
||||||
void
|
void
|
||||||
cc2430_rf_error_ISR( void ) __interrupt (RFERR_VECTOR)
|
cc2430_rf_error_ISR(void) __interrupt(RFERR_VECTOR)
|
||||||
{
|
{
|
||||||
EA = 0;
|
EA = 0;
|
||||||
TCON_RFERRIF = 0;
|
TCON_RFERRIF = 0;
|
||||||
|
|
|
@ -98,14 +98,14 @@ clock_init(void)
|
||||||
CLKCON = OSC32K | TICKSPD2 | TICKSPD1; /* tickspeed 500 kHz for timers[1-4] */
|
CLKCON = OSC32K | TICKSPD2 | TICKSPD1; /* tickspeed 500 kHz for timers[1-4] */
|
||||||
|
|
||||||
/* Initialize tick value */
|
/* Initialize tick value */
|
||||||
timer_value = ST0; /* ST low bits [7:0] */
|
timer_value = ST0; /* ST low bits [7:0] */
|
||||||
timer_value += ((unsigned long int) ST1) << 8; /* middle bits [15:8] */
|
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)ST2) << 16; /* high bits [23:16] */
|
||||||
timer_value += TICK_VAL; /* Init value 256 */
|
timer_value += TICK_VAL; /* Init value 256 */
|
||||||
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;
|
||||||
|
|
||||||
IEN0_STIE = 1; /* IEN0.STIE acknowledge Sleep Timer Interrupt */
|
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
|
* 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;
|
||||||
|
|
||||||
/* Make sure the CLOCK_CONF_SECOND is a power of two, to ensure
|
/* Make sure the CLOCK_CONF_SECOND is a power of two, to ensure
|
||||||
that the modulo operation below becomes a logical and and not
|
that the modulo operation below becomes a logical and and not
|
||||||
an expensive divide. Algorithm from Wikipedia:
|
an expensive divide. Algorithm from Wikipedia:
|
||||||
|
@ -160,7 +160,7 @@ clock_ISR(void) __interrupt(ST_VECTOR)
|
||||||
etimer_request_poll();
|
etimer_request_poll();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IRCON_STIF = 0;
|
IRCON_STIF = 0;
|
||||||
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
||||||
ENABLE_INTERRUPTS();
|
ENABLE_INTERRUPTS();
|
||||||
|
|
|
@ -16,7 +16,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)
|
||||||
|
@ -30,7 +30,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;
|
||||||
|
|
||||||
|
@ -40,7 +40,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
|
||||||
|
@ -53,7 +53,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;
|
||||||
|
|
|
@ -138,11 +138,11 @@ 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);
|
||||||
|
|
||||||
/* 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 "cc2430_sfr.h"
|
#include "cc2430_sfr.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
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -37,17 +37,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;
|
||||||
IRCON_DMAIF = 0;
|
IRCON_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
|
||||||
|
|
|
@ -20,12 +20,12 @@
|
||||||
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));
|
||||||
|
|
||||||
void uart0_rx_ISR( void ) __interrupt (URX0_VECTOR);
|
void uart0_rx_ISR(void) __interrupt(URX0_VECTOR);
|
||||||
void uart0_tx_ISR( void ) __interrupt (UTX0_VECTOR);
|
void uart0_tx_ISR(void) __interrupt(UTX0_VECTOR);
|
||||||
/* Macro to turn on / off UART RX Interrupt */
|
/* 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
|
||||||
|
|
||||||
#endif /* UART_0_H */
|
#endif /* UART_0_H */
|
||||||
|
|
|
@ -22,10 +22,10 @@ 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 UART_ONE_CONF_WITH_INPUT
|
#if UART_ONE_CONF_WITH_INPUT
|
||||||
void uart1_rx_ISR( void ) __interrupt (URX1_VECTOR);
|
void uart1_rx_ISR(void) __interrupt(URX1_VECTOR);
|
||||||
void uart1_tx_ISR( void ) __interrupt (UTX1_VECTOR);
|
void uart1_tx_ISR(void) __interrupt(UTX1_VECTOR);
|
||||||
/* Macro to turn on / off UART RX Interrupt */
|
/* 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
|
#else
|
||||||
#define UART1_RX_INT(v)
|
#define UART1_RX_INT(v)
|
||||||
#endif /* UART_ONE_CONF_WITH_INPUT */
|
#endif /* UART_ONE_CONF_WITH_INPUT */
|
||||||
|
|
|
@ -21,16 +21,16 @@
|
||||||
#include "sys/energest.h"
|
#include "sys/energest.h"
|
||||||
|
|
||||||
#if UART_ZERO_ENABLE
|
#if UART_ZERO_ENABLE
|
||||||
static int (*uart0_input_handler)(unsigned char c);
|
static int (* uart0_input_handler)(unsigned char c);
|
||||||
#endif
|
#endif
|
||||||
#if UART_ONE_ENABLE
|
#if UART_ONE_ENABLE
|
||||||
static int (*uart1_input_handler)(unsigned char c);
|
static int (* uart1_input_handler)(unsigned char c);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if UART_ZERO_ENABLE
|
#if UART_ZERO_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;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,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);
|
||||||
TCON_URX0IF = 0;
|
TCON_URX0IF = 0;
|
||||||
|
@ -52,7 +52,7 @@ uart0_rx_ISR(void) __interrupt (URX0_VECTOR)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
uart0_tx_ISR( void ) __interrupt (UTX0_VECTOR)
|
uart0_tx_ISR(void) __interrupt(UTX0_VECTOR)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#pragma restore
|
#pragma restore
|
||||||
|
@ -60,7 +60,7 @@ uart0_tx_ISR( void ) __interrupt (UTX0_VECTOR)
|
||||||
#if UART_ONE_ENABLE
|
#if UART_ONE_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;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,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);
|
||||||
TCON_URX1IF = 0;
|
TCON_URX1IF = 0;
|
||||||
|
@ -82,7 +82,7 @@ uart1_rx_ISR(void) __interrupt (URX1_VECTOR)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
uart1_tx_ISR( void ) __interrupt (UTX1_VECTOR)
|
uart1_tx_ISR(void) __interrupt(UTX1_VECTOR)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#pragma restore
|
#pragma restore
|
||||||
|
|
|
@ -52,7 +52,7 @@
|
||||||
#pragma exclude bits
|
#pragma exclude bits
|
||||||
#endif
|
#endif
|
||||||
void
|
void
|
||||||
cc4230_watchdog_ISR(void) __interrupt (WDT_VECTOR)
|
cc4230_watchdog_ISR(void) __interrupt(WDT_VECTOR)
|
||||||
{
|
{
|
||||||
EA = 0;
|
EA = 0;
|
||||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||||
|
|
|
@ -29,16 +29,16 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* \file
|
* \file
|
||||||
* Stub header file for cc2430 multi-threading. It doesn't do anything, it
|
* Stub header file for cc2430 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__ */
|
||||||
|
|
||||||
|
|
|
@ -95,8 +95,8 @@ rtimer_arch_schedule(rtimer_clock_t t)
|
||||||
PRINTF("rtimer_arch_schedule(%u)\n", t);
|
PRINTF("rtimer_arch_schedule(%u)\n", t);
|
||||||
|
|
||||||
/* 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 */
|
||||||
T1CC1L = (unsigned char) t;
|
T1CC1L = (unsigned char)t;
|
||||||
T1CC1H = (unsigned char) (t >> 8);
|
T1CC1H = (unsigned char)(t >> 8);
|
||||||
PRINTF("T1CC1=%u, t=%u\n", (T1CC1L + (T1CC1H << 8)), t);
|
PRINTF("T1CC1=%u, t=%u\n", (T1CC1L + (T1CC1H << 8)), t);
|
||||||
|
|
||||||
/* Turn on compare mode interrupt */
|
/* Turn on compare mode interrupt */
|
||||||
|
@ -109,7 +109,7 @@ rtimer_arch_schedule(rtimer_clock_t t)
|
||||||
#pragma exclude bits
|
#pragma exclude bits
|
||||||
#endif
|
#endif
|
||||||
void
|
void
|
||||||
cc2430_timer_1_ISR(void) __interrupt (T1_VECTOR)
|
cc2430_timer_1_ISR(void) __interrupt(T1_VECTOR)
|
||||||
{
|
{
|
||||||
IEN1_T1IE = 0; /* Ignore Timer 1 Interrupts */
|
IEN1_T1IE = 0; /* Ignore Timer 1 Interrupts */
|
||||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||||
|
|
|
@ -57,6 +57,6 @@
|
||||||
|
|
||||||
#define rtimer_arch_now() ((rtimer_clock_t)(T1CNTL + (T1CNTH << 8)))
|
#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__ */
|
#endif /* __RTIMER_ARCH_H__ */
|
||||||
|
|
|
@ -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