Merge branch 'master' of ssh://contiki.git.sourceforge.net/gitroot/contiki/contiki
This commit is contained in:
commit
adff634b88
73 changed files with 412 additions and 527 deletions
|
@ -202,8 +202,8 @@ handle_incoming_data(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
coap_error_code = INTERNAL_SERVER_ERROR_5_00;
|
||||
coap_error_message = "Service callback undefined";
|
||||
coap_error_code = NOT_IMPLEMENTED_5_01;
|
||||
coap_error_message = "NoServiceCallbck"; // no a to fit 16 bytes
|
||||
} /* if (service callback) */
|
||||
|
||||
} else {
|
||||
|
|
|
@ -81,12 +81,14 @@ PT_THREAD(coap_blocking_request(struct request_state_t *state, process_event_t e
|
|||
blocking_response_handler request_callback));
|
||||
|
||||
#define COAP_BLOCKING_REQUEST(server_addr, server_port, request, chunk_handler) \
|
||||
static struct request_state_t request_state; \
|
||||
PT_SPAWN(process_pt, &request_state.pt, \
|
||||
coap_blocking_request(&request_state, ev, \
|
||||
server_addr, server_port, \
|
||||
request, chunk_handler) \
|
||||
);
|
||||
{ \
|
||||
static struct request_state_t request_state; \
|
||||
PT_SPAWN(process_pt, &request_state.pt, \
|
||||
coap_blocking_request(&request_state, ev, \
|
||||
server_addr, server_port, \
|
||||
request, chunk_handler) \
|
||||
); \
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#endif /* COAP_SERVER_H_ */
|
||||
|
|
|
@ -57,28 +57,18 @@
|
|||
int coap_separate_handler(resource_t *resource, void *request, void *response)
|
||||
{
|
||||
coap_packet_t *const coap_req = (coap_packet_t *) request;
|
||||
coap_packet_t *const coap_res = (coap_packet_t *) response;
|
||||
|
||||
PRINTF("Separate response for /%s MID %u\n", resource->url, coap_res->mid);
|
||||
|
||||
/* Only ack CON requests. */
|
||||
if (coap_req->type==COAP_TYPE_CON)
|
||||
{
|
||||
coap_transaction_t *const t = coap_get_transaction_by_mid(coap_res->mid);
|
||||
|
||||
/* send separate ACK. */
|
||||
coap_packet_t ack[1];
|
||||
/* ACK with empty code (0) */
|
||||
coap_init_message(ack, COAP_TYPE_ACK, 0, coap_req->mid);
|
||||
/* Serializing into IPBUF: Only overwrites header parts that are already parsed into the request struct. */
|
||||
coap_send_message(&UIP_IP_BUF->srcipaddr, UIP_UDP_BUF->srcport, (uip_appdata), coap_serialize_message(ack, uip_appdata));
|
||||
|
||||
/* Change response to separate response. */
|
||||
coap_res->type = COAP_TYPE_CON;
|
||||
coap_res->mid = coap_get_mid();
|
||||
|
||||
/* Update MID in transaction for identification. */
|
||||
t->mid = coap_res->mid;
|
||||
}
|
||||
|
||||
/* Pre-handlers could skip the handling by returning 0. */
|
||||
|
@ -86,26 +76,24 @@ int coap_separate_handler(resource_t *resource, void *request, void *response)
|
|||
}
|
||||
|
||||
int
|
||||
coap_separate_response(void *response, coap_separate_t *separate_store)
|
||||
coap_separate_yield(void *request, coap_separate_t *separate_store)
|
||||
{
|
||||
coap_packet_t *const coap_res = (coap_packet_t *) response;
|
||||
coap_transaction_t *const t = coap_get_transaction_by_mid(coap_res->mid);
|
||||
coap_packet_t *const coap_req = (coap_packet_t *) request;
|
||||
coap_transaction_t *const t = coap_get_transaction_by_mid(coap_req->mid);
|
||||
|
||||
if (t)
|
||||
{
|
||||
uip_ipaddr_copy(&separate_store->addr, &t->addr);
|
||||
separate_store->port = t->port;
|
||||
|
||||
separate_store->mid = coap_res->mid;
|
||||
separate_store->type = coap_res->type;
|
||||
separate_store->type = coap_req->type==COAP_TYPE_CON ? COAP_TYPE_CON : COAP_TYPE_NON;
|
||||
separate_store->mid = coap_get_mid(); // if it was NON, we burned one MID in the engine...
|
||||
|
||||
memcpy(separate_store->token, coap_res->token, coap_res->token_len);
|
||||
separate_store->token_len = coap_res->token_len;
|
||||
memcpy(separate_store->token, coap_req->token, coap_req->token_len);
|
||||
separate_store->token_len = coap_req->token_len;
|
||||
|
||||
separate_store->block2_num = coap_res->block2_num;
|
||||
separate_store->block2_more = coap_res->block2_more;
|
||||
separate_store->block2_size = coap_res->block2_size;
|
||||
separate_store->block2_offset = coap_res->block2_offset;
|
||||
separate_store->block2_num = coap_req->block2_num;
|
||||
separate_store->block2_size = coap_req->block2_size;
|
||||
|
||||
/* Signal the engine to skip automatic response and clear transaction by engine. */
|
||||
coap_error_code = MANUAL_RESPONSE;
|
||||
|
@ -117,3 +105,10 @@ coap_separate_response(void *response, coap_separate_t *separate_store)
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
coap_separate_resume(void *response, coap_separate_t *separate_store, uint8_t code)
|
||||
{
|
||||
coap_init_message(response, separate_store->type, code, separate_store->mid);
|
||||
coap_set_header_token(response, separate_store->token, separate_store->token_len);
|
||||
}
|
||||
|
|
|
@ -52,17 +52,14 @@ typedef struct coap_separate {
|
|||
uint8_t token_len;
|
||||
uint8_t token[COAP_TOKEN_LEN];
|
||||
|
||||
/* separate + blockwise is untested! */
|
||||
uint32_t block2_num;
|
||||
uint8_t block2_more;
|
||||
uint16_t block2_size;
|
||||
uint32_t block2_offset;
|
||||
|
||||
/* Add fields for addition information to be saved here, e.g.: */
|
||||
char buffer[17];
|
||||
|
||||
} coap_separate_t;
|
||||
|
||||
int coap_separate_handler(resource_t *resource, void *request, void *response);
|
||||
int coap_separate_response(void *response, coap_separate_t *separate_store);
|
||||
int coap_separate_yield(void *request, coap_separate_t *separate_store);
|
||||
void coap_separate_resume(void *response, coap_separate_t *separate_store, uint8_t code);
|
||||
|
||||
#endif /* COAP_SEPARATE_H_ */
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "lib/random.h"
|
||||
#include "net/rime.h"
|
||||
#include "net/rime/timesynch.h"
|
||||
#include <string.h>
|
||||
|
||||
#if TIMESYNCH_CONF_ENABLED
|
||||
static int authority_level;
|
||||
|
|
|
@ -244,11 +244,7 @@ dio_input(void)
|
|||
PRINTF("RPL: Neighbor already in neighbor cache\n");
|
||||
}
|
||||
|
||||
buffer_length = uip_len - uip_l2_l3_icmp_hdr_len;
|
||||
|
||||
#if RPL_CONF_ADJUST_LLH_LEN
|
||||
buffer_length += UIP_LLH_LEN; /* Add jackdaw, minimal-net ethernet header */
|
||||
#endif
|
||||
buffer_length = uip_len - uip_l3_icmp_hdr_len;
|
||||
|
||||
/* Process the DIO base option. */
|
||||
i = 0;
|
||||
|
@ -579,11 +575,8 @@ dao_input(void)
|
|||
PRINTF("\n");
|
||||
|
||||
buffer = UIP_ICMP_PAYLOAD;
|
||||
buffer_length = uip_len - uip_l2_l3_icmp_hdr_len;
|
||||
buffer_length = uip_len - uip_l3_icmp_hdr_len;
|
||||
|
||||
#if RPL_CONF_ADJUST_LLH_LEN
|
||||
buffer_length += UIP_LLH_LEN; /* Add jackdaw, minimal-net ethernet header */
|
||||
#endif
|
||||
pos = 0;
|
||||
instance_id = buffer[pos++];
|
||||
|
||||
|
@ -801,7 +794,7 @@ dao_ack_input(void)
|
|||
uint8_t status;
|
||||
|
||||
buffer = UIP_ICMP_PAYLOAD;
|
||||
buffer_length = uip_len - uip_l2_l3_icmp_hdr_len;
|
||||
buffer_length = uip_len - uip_l3_icmp_hdr_len;
|
||||
|
||||
instance_id = buffer[0];
|
||||
sequence = buffer[2];
|
||||
|
|
|
@ -224,7 +224,9 @@ uip_ds6_periodic(void)
|
|||
if(locnbr->nscount >= UIP_ND6_MAX_UNICAST_SOLICIT) {
|
||||
PRINTF("PROBE END\n");
|
||||
if((locdefrt = uip_ds6_defrt_lookup(&locnbr->ipaddr)) != NULL) {
|
||||
uip_ds6_defrt_rm(locdefrt);
|
||||
if (!locdefrt->isinfinite) {
|
||||
uip_ds6_defrt_rm(locdefrt);
|
||||
}
|
||||
}
|
||||
uip_ds6_nbr_rm(locnbr);
|
||||
} else if(stimer_expired(&locnbr->sendns) && (uip_len == 0)) {
|
||||
|
|
|
@ -1048,7 +1048,7 @@ uip_process(uint8_t flag)
|
|||
if(flag == UIP_UDP_TIMER) {
|
||||
if(uip_udp_conn->lport != 0) {
|
||||
uip_conn = NULL;
|
||||
uip_sappdata = uip_appdata = &uip_buf[UIP_IPUDPH_LEN];
|
||||
uip_sappdata = uip_appdata = &uip_buf[UIP_IPUDPH_LEN + UIP_LLH_LEN];
|
||||
uip_len = uip_slen = 0;
|
||||
uip_flags = UIP_POLL;
|
||||
UIP_UDP_APPCALL();
|
||||
|
@ -1447,7 +1447,7 @@ uip_process(uint8_t flag)
|
|||
send. */
|
||||
#if UIP_UDP_CHECKSUMS
|
||||
uip_len = uip_len - UIP_IPUDPH_LEN;
|
||||
uip_appdata = &uip_buf[UIP_IPUDPH_LEN];
|
||||
uip_appdata = &uip_buf[UIP_IPUDPH_LEN + UIP_LLH_LEN];
|
||||
if(UIP_UDP_BUF->udpchksum != 0 && uip_udpchksum() != 0xffff) {
|
||||
UIP_STAT(++uip_stat.udp.drop);
|
||||
UIP_STAT(++uip_stat.udp.chkerr);
|
||||
|
@ -1500,7 +1500,7 @@ uip_process(uint8_t flag)
|
|||
|
||||
uip_conn = NULL;
|
||||
uip_flags = UIP_NEWDATA;
|
||||
uip_sappdata = uip_appdata = &uip_buf[UIP_IPUDPH_LEN];
|
||||
uip_sappdata = uip_appdata = &uip_buf[UIP_IPUDPH_LEN + UIP_LLH_LEN];
|
||||
uip_slen = 0;
|
||||
UIP_UDP_APPCALL();
|
||||
|
||||
|
|
|
@ -71,10 +71,19 @@ CUSTOM_RULE_C_TO_O = 1
|
|||
%.o: %.c
|
||||
$(CC) $(CFLAGS) $< -o $@
|
||||
|
||||
define FINALIZE_CYGWIN_DEPENDENCY
|
||||
sed -e 's/ \([A-Z]\):\\/ \/cygdrive\/\L\1\//' -e 's/\\/\//g' \
|
||||
<$(@:.o=.P) >$(@:.o=.d); \
|
||||
rm -f $(@:.o=.P)
|
||||
endef
|
||||
|
||||
CUSTOM_RULE_C_TO_OBJECTDIR_O = 1
|
||||
$(OBJECTDIR)/%.o: %.c
|
||||
$(CC) $(CFLAGS) $< -o $@
|
||||
# @$(FINALIZE_DEPENDENCY)
|
||||
$(CC) $(CFLAGS) $< --dependencies=m $(@:.o=.P) -o $@
|
||||
ifeq ($(HOST_OS),Windows)
|
||||
@$(FINALIZE_CYGWIN_DEPENDENCY)
|
||||
endif
|
||||
|
||||
CUSTOM_RULE_C_TO_CO = 1
|
||||
%.co: %.c
|
||||
$(CC) $(CFLAGS) -DAUTOSTART_ENABLE $< -o $@
|
||||
|
@ -82,6 +91,7 @@ CUSTOM_RULE_C_TO_CO = 1
|
|||
AROPTS = -o
|
||||
|
||||
else
|
||||
|
||||
GCC = 1
|
||||
CC = msp430-gcc
|
||||
LD = msp430-gcc
|
||||
|
@ -98,7 +108,7 @@ CFLAGS += -Os -fno-strict-aliasing
|
|||
LDFLAGS += -mmcu=$(MCU) -Wl,-Map=contiki-$(TARGET).map
|
||||
|
||||
### These flags can reduce the code size and RAM usage with up to 10%
|
||||
ifdef SMALL
|
||||
ifeq ($(SMALL),1)
|
||||
CFLAGS += -ffunction-sections
|
||||
# CFLAGS += -fdata-sections
|
||||
LDFLAGS += -Wl,--gc-sections,--undefined=_reset_vector__,--undefined=InterruptVectors,--undefined=_copy_data_init__,--undefined=_clear_bss_init__,--undefined=_end_of_init__
|
||||
|
@ -129,8 +139,13 @@ PROJECT_OBJECTFILES += ${addprefix $(OBJECTDIR)/,$(CONTIKI_TARGET_MAIN:.c=.o)}
|
|||
%.firmware: %.${TARGET}
|
||||
mv $< $@
|
||||
|
||||
ifdef IAR
|
||||
%.ihex: %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a
|
||||
$(LD) $(LDFLAGSNO) -Fintel-extended -yn $(TARGET_STARTFILES) ${filter-out %.a,$^} ${filter %.a,$^} $(TARGET_LIBFILES) -o $@
|
||||
else
|
||||
%.ihex: %.$(TARGET)
|
||||
$(OBJCOPY) $^ -O ihex $@
|
||||
endif
|
||||
|
||||
%.mspsim: %.${TARGET}
|
||||
java -jar ${CONTIKI}/tools/mspsim/mspsim.jar -platform=${TARGET} $<
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "contiki.h"
|
||||
#include "dev/button.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
#define BUTTON_PORT 2
|
||||
#define BUTTON_PIN 7
|
||||
|
@ -57,8 +58,7 @@ button_init(struct process *proc)
|
|||
P2IE &= ~BV(BUTTON_PIN);
|
||||
}
|
||||
|
||||
interrupt(PORT2_VECTOR)
|
||||
__button_interrupt(void)
|
||||
ISR(PORT2, __button_interrupt)
|
||||
{
|
||||
static struct timer debouncetimer;
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "contiki.h"
|
||||
#include "dev/spi.h"
|
||||
#include "dev/cc2420.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
extern volatile uint8_t cc2420_sfd_counter;
|
||||
extern volatile uint16_t cc2420_sfd_start_time;
|
||||
|
@ -39,13 +40,7 @@ extern volatile uint16_t cc2420_sfd_end_time;
|
|||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* SFD interrupt for timestamping radio packets */
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=TIMERB1_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(TIMERB1_VECTOR)
|
||||
#endif
|
||||
cc24240_timerb1_interrupt(void)
|
||||
ISR(TIMERB1, cc2420_timerb1_interrupt)
|
||||
{
|
||||
int tbiv;
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include "dev/spi.h"
|
||||
#include "dev/cc2420.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
#ifdef CC2420_CONF_SFD_TIMESTAMPS
|
||||
#define CONF_SFD_TIMESTAMPS CC2420_CONF_SFD_TIMESTAMPS
|
||||
|
@ -48,14 +49,7 @@
|
|||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=CC2420_IRQ_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(CC2420_IRQ_VECTOR)
|
||||
#endif
|
||||
|
||||
cc24240_port1_interrupt(void)
|
||||
ISR(CC2420_IRQ, cc2420_port1_interrupt)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
||||
|
@ -65,7 +59,6 @@ cc24240_port1_interrupt(void)
|
|||
|
||||
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
cc2420_arch_init(void)
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "contiki.h"
|
||||
#include "dev/spi.h"
|
||||
#include "dev/cc2520.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
extern volatile uint8_t cc2520_sfd_counter;
|
||||
extern volatile uint16_t cc2520_sfd_start_time;
|
||||
|
@ -37,13 +38,7 @@ extern volatile uint16_t cc2520_sfd_end_time;
|
|||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* SFD interrupt for timestamping radio packets */
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=TIMERB1_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(TIMERB1_VECTOR)
|
||||
#endif
|
||||
cc2520_timerb1_interrupt(void)
|
||||
ISR(TIMERB1, cc2520_timerb1_interrupt)
|
||||
{
|
||||
int tbiv;
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
#include "dev/spi.h"
|
||||
#include "dev/cc2520.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
#ifdef CC2520_CONF_SFD_TIMESTAMPS
|
||||
#define CONF_SFD_TIMESTAMPS CC2520_CONF_SFD_TIMESTAMPS
|
||||
|
@ -46,13 +47,7 @@
|
|||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=CC2520_IRQ_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(CC2520_IRQ_VECTOR)
|
||||
#endif
|
||||
cc2520_port1_interrupt(void)
|
||||
ISR(CC2520_IRQ, cc2520_port1_interrupt)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "sys/etimer.h"
|
||||
#include "rtimer-arch.h"
|
||||
#include "dev/watchdog.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
#define INTERVAL (RTIMER_ARCH_SECOND / CLOCK_SECOND)
|
||||
|
||||
|
@ -46,13 +47,7 @@ static volatile clock_time_t count = 0;
|
|||
/* last_tar is used for calculating clock_fine */
|
||||
static volatile uint16_t last_tar = 0;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=TIMERA1_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(TIMERA1_VECTOR)
|
||||
#endif
|
||||
timera1 (void)
|
||||
ISR(TIMERA1, timera1)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "sys/rtimer.h"
|
||||
#include "sys/process.h"
|
||||
#include "dev/watchdog.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
|
@ -54,13 +55,7 @@
|
|||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=TIMERA0_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(TIMERA0_VECTOR)
|
||||
#endif
|
||||
timera0 (void)
|
||||
ISR(TIMERA0, timera0)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "dev/watchdog.h"
|
||||
#include "sys/ctimer.h"
|
||||
#include "lib/ringbuf.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
static int (*uart1_input_handler)(unsigned char c);
|
||||
static volatile uint8_t rx_in_progress;
|
||||
|
@ -236,13 +237,7 @@ uart1_init(unsigned long ubr)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#if !RX_WITH_DMA
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=UART1RX_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(UART1RX_VECTOR)
|
||||
#endif
|
||||
uart1_rx_interrupt(void)
|
||||
ISR(UART1RX, uart1_rx_interrupt)
|
||||
{
|
||||
uint8_t c;
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
@ -273,13 +268,7 @@ uart1_rx_interrupt(void)
|
|||
#endif /* !RX_WITH_DMA */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#if TX_WITH_INTERRUPT
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=UART1TX_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(UART1TX_VECTOR)
|
||||
#endif
|
||||
uart1_tx_interrupt(void)
|
||||
ISR(UART1TX, uart1_tx_interrupt)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "dev/watchdog.h"
|
||||
#include "lib/ringbuf.h"
|
||||
#include "dev/leds.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
static int (*uart0_input_handler)(unsigned char c);
|
||||
|
||||
|
@ -138,14 +139,7 @@ uart0_init(unsigned long ubr)
|
|||
#endif /* TX_WITH_INTERRUPT */
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=USCIAB0RX_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(USCIAB0RX_VECTOR)
|
||||
#endif
|
||||
uart0_rx_interrupt(void)
|
||||
ISR(USCIAB0RX, uart0_rx_interrupt)
|
||||
{
|
||||
uint8_t c;
|
||||
|
||||
|
@ -165,13 +159,7 @@ uart0_rx_interrupt(void)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#if TX_WITH_INTERRUPT
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=USCIAB0TX_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(USCIAB0TX_VECTOR)
|
||||
#endif
|
||||
uart0_tx_interrupt(void)
|
||||
ISR(USCIAB0TX, uart0_tx_interrupt)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
if((IFG2 & UCA0TXIFG)){
|
||||
|
|
|
@ -37,8 +37,8 @@
|
|||
#include "sys/energest.h"
|
||||
#include "dev/uart1.h"
|
||||
#include "dev/watchdog.h"
|
||||
|
||||
#include "lib/ringbuf.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
static int (*uart1_input_handler)(unsigned char c);
|
||||
|
||||
|
@ -120,8 +120,7 @@ uart1_init(unsigned long ubr)
|
|||
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
interrupt(USCIAB1RX_VECTOR)
|
||||
uart1_rx_interrupt(void)
|
||||
ISR(USCIAB1RX, uart1_rx_interrupt)
|
||||
{
|
||||
uint8_t c;
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
@ -141,8 +140,7 @@ uart1_rx_interrupt(void)
|
|||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#if TX_WITH_INTERRUPT
|
||||
interrupt(USCIAB1TX_VECTOR)
|
||||
uart1_tx_interrupt(void)
|
||||
ISR(USCIAB1TX, uart1_tx_interrupt)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
if(IFG2 & UCA0TXIFG) {
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "sys/etimer.h"
|
||||
#include "rtimer-arch.h"
|
||||
#include "dev/watchdog.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
#define INTERVAL (RTIMER_ARCH_SECOND / CLOCK_SECOND)
|
||||
|
||||
|
@ -46,13 +47,7 @@ static volatile clock_time_t count = 0;
|
|||
/* last_tar is used for calculating clock_fine, last_ccr might be better? */
|
||||
static volatile uint16_t last_tar = 0;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=TIMER1_A1_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(TIMER1_A1_VECTOR)
|
||||
#endif
|
||||
timera1 (void)
|
||||
ISR(TIMER1_A1, timera1)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "sys/rtimer.h"
|
||||
#include "sys/process.h"
|
||||
#include "dev/watchdog.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
|
@ -51,13 +52,7 @@
|
|||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=TIMER1_A0_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(TIMER1_A0_VECTOR)
|
||||
#endif
|
||||
timera0 (void)
|
||||
ISR(TIMER1_A0, timera0)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "sys/energest.h"
|
||||
#include "dev/uart0.h"
|
||||
#include "dev/watchdog.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
static int (*uart0_input_handler)(unsigned char c);
|
||||
|
||||
|
@ -98,18 +99,12 @@ uart0_init(unsigned long ubr)
|
|||
UCA0IE |= UCRXIE; /* Enable UCA0 RX interrupt */
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=USCI_A0_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(USCI_A0_VECTOR)
|
||||
#endif
|
||||
uart0_rx_interrupt(void)
|
||||
ISR(USCI_A0, uart0_rx_interrupt)
|
||||
{
|
||||
uint8_t c;
|
||||
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
if (UCA0IV == 2) {
|
||||
if(UCA0IV == 2) {
|
||||
if(UCA0STAT & UCRXERR) {
|
||||
c = UCA0RXBUF; /* Clear error flags by forcing a dummy read. */
|
||||
} else {
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "sys/energest.h"
|
||||
#include "dev/uart1.h"
|
||||
#include "dev/watchdog.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
static int (*uart1_input_handler)(unsigned char c);
|
||||
|
||||
|
@ -103,13 +104,7 @@ uart1_init(unsigned long ubr)
|
|||
UCA1IE |= UCRXIE; /* Enable UCA1 RX interrupt */
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=USCI_A1_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(USCI_A1_VECTOR)
|
||||
#endif
|
||||
uart1_rx_interrupt(void)
|
||||
ISR(USCI_A1, uart1_rx_interrupt)
|
||||
{
|
||||
uint8_t c;
|
||||
|
||||
|
|
87
cpu/msp430/isr_compat.h
Normal file
87
cpu/msp430/isr_compat.h
Normal file
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright (c) 2005 Steve Underwood
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS `AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ISR_COMPAT_H_
|
||||
#define _ISR_COMPAT_H_
|
||||
|
||||
/* Cross compiler interrupt service routine compatibility definitions */
|
||||
/* This code currently allows for:
|
||||
MSPGCC - the GNU tools for the MSP430
|
||||
Quadravox AQ430
|
||||
IAR Version 1 (old syntax)
|
||||
IAR Versions 2, 3, 4, 5 (new syntax)
|
||||
Rowley Crossworks
|
||||
Code Composer Essentials
|
||||
|
||||
These macros allow us to define interrupt routines for all
|
||||
compilers with a common syntax:
|
||||
|
||||
ISR(<interrupt>, <routine name>)
|
||||
{
|
||||
}
|
||||
|
||||
e.g.
|
||||
|
||||
ISR(ADC12, adc_service_routine)
|
||||
{
|
||||
ADC12CTL0 &= ~ENC;
|
||||
ADC12CTL0 |= ENC;
|
||||
}
|
||||
*/
|
||||
|
||||
/* 2012-03-02: minor update to support IAR version 4 and 5 */
|
||||
|
||||
/* A tricky #define to stringify _Pragma parameters */
|
||||
#define __PRAGMA__(x) _Pragma(#x)
|
||||
|
||||
#if defined(__GNUC__) && defined(__MSP430__)
|
||||
/* This is the MSPGCC compiler */
|
||||
#define ISR(a,b) interrupt(a ## _VECTOR) b(void)
|
||||
#elif defined(__AQCOMPILER__)
|
||||
/* This is the Quadravox compiler */
|
||||
#define ISR(a,b) void _INTERRUPT[a ## _VECTOR] b(void)
|
||||
#elif defined(__IAR_SYSTEMS_ICC__) && (((__TID__ >> 8) & 0x7f) == 43) && (__VER__ < 200)
|
||||
/* This is V1.xx of the IAR compiler. */
|
||||
#define ISR(a,b) interrupt[a ## _VECTOR] void b(void)
|
||||
#elif defined(__IAR_SYSTEMS_ICC__) && (((__TID__ >> 8) & 0x7f) == 43) && (__VER__ < 600)
|
||||
/* This is V2.xx, V3.xx, V4.xx, V5.xx of the IAR compiler. */
|
||||
#define ISR(a,b) \
|
||||
__PRAGMA__(vector=a ##_VECTOR) \
|
||||
__interrupt void b(void)
|
||||
#elif defined(__CROSSWORKS_MSP430)
|
||||
/* This is the Rowley Crossworks compiler */
|
||||
#define ISR(a,b) void b __interrupt[a ## _VECTOR](void)
|
||||
#elif defined(__TI_COMPILER_VERSION__)
|
||||
/* This is the Code Composer Essentials compiler. */
|
||||
#define ISR(a,b) __interrupt void b(void); \
|
||||
a ## _ISR(b) \
|
||||
__interrupt void b(void)
|
||||
#else
|
||||
#error Compiler not recognised.
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "contiki.h"
|
||||
#include "dev/watchdog.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
static int counter = 0;
|
||||
|
||||
|
@ -70,13 +71,7 @@ printstring(char *s)
|
|||
#endif /* CONTIKI_TARGET_SKY */
|
||||
#endif /* PRINT_STACK_ON_REBOOT */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=WDT_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(WDT_VECTOR)
|
||||
#endif
|
||||
watchdog_interrupt(void)
|
||||
ISR(WDT, watchdog_interrupt)
|
||||
{
|
||||
#ifdef CONTIKI_TARGET_SKY
|
||||
#if PRINT_STACK_ON_REBOOT
|
||||
|
|
|
@ -17,10 +17,14 @@ UIP_CONF_IPV6=1
|
|||
# configure CoAP implementation (3|7)
|
||||
WITH_COAP=7
|
||||
|
||||
# must be CFLAGS not variables
|
||||
# minimal-net does not support RPL, avoid redefine warnings
|
||||
# new variable since slip-radio
|
||||
ifneq ($(TARGET), minimal-net)
|
||||
CFLAGS += -DUIP_CONF_IPV6_RPL=1
|
||||
UIP_CONF_RPL=1
|
||||
else
|
||||
# minimal-net does not support RPL under Linux and is mostly used to test CoAP only
|
||||
${info INFO: compiling without RPL}
|
||||
UIP_CONF_RPL=0
|
||||
CFLAGS += -DUIP_CONF_ND6_DEF_MAXDADNS=0
|
||||
endif
|
||||
|
||||
# linker optimizations
|
||||
|
|
|
@ -349,18 +349,28 @@ chunks_handler(void* request, void* response, uint8_t *buffer, uint16_t preferre
|
|||
}
|
||||
#endif
|
||||
|
||||
#if REST_RES_SEPARATE && WITH_COAP > 3
|
||||
#if defined (PLATFORM_HAS_BUTTON) && REST_RES_SEPARATE && WITH_COAP > 3
|
||||
/* Required to manually (=not by the engine) handle the response transaction. */
|
||||
#include "er-coap-07-separate.h"
|
||||
#include "er-coap-07-transactions.h"
|
||||
/*
|
||||
* CoAP-specific example for separate responses.
|
||||
* This resource is .
|
||||
* Note the call "rest_set_pre_handler(&resource_separate, coap_separate_handler);" in the main process.
|
||||
* The pre-handler takes care of the empty ACK and updates the MID and message type for CON requests.
|
||||
* The resource handler must store all information that required to finalize the response later.
|
||||
*/
|
||||
RESOURCE(separate, METHOD_GET, "debug/separate", "title=\"Separate demo\"");
|
||||
|
||||
/* A structure to store the required information */
|
||||
typedef struct application_separate_store {
|
||||
/* Provided by Erbium to store generic request information such as remote address and token. */
|
||||
coap_separate_t request_metadata;
|
||||
/* Add fields for addition information to be stored for finalizing, e.g.: */
|
||||
char buffer[16];
|
||||
} application_separate_store_t;
|
||||
|
||||
static uint8_t separate_active = 0;
|
||||
static coap_separate_t separate_store[1];
|
||||
static application_separate_store_t separate_store[1];
|
||||
|
||||
void
|
||||
separate_handler(void* request, void* response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
|
||||
|
@ -380,7 +390,8 @@ separate_handler(void* request, void* response, uint8_t *buffer, uint16_t prefer
|
|||
separate_active = 1;
|
||||
|
||||
/* Take over and skip response by engine. */
|
||||
coap_separate_response(response, separate_store);
|
||||
coap_separate_yield(request, &separate_store->request_metadata);
|
||||
/* Be aware to respect the Block2 option, which is also stored in the coap_separate_t. */
|
||||
|
||||
/*
|
||||
* At the moment, only the minimal information is stored in the store (client address, port, token, MID, type, and Block2).
|
||||
|
@ -397,13 +408,21 @@ separate_finalize_handler()
|
|||
if (separate_active)
|
||||
{
|
||||
coap_transaction_t *transaction = NULL;
|
||||
if ( (transaction = coap_new_transaction(separate_store->mid, &separate_store->addr, separate_store->port)) )
|
||||
if ( (transaction = coap_new_transaction(separate_store->request_metadata.mid, &separate_store->request_metadata.addr, separate_store->request_metadata.port)) )
|
||||
{
|
||||
coap_packet_t response[1]; /* This way the packet can be treated as pointer as usual. */
|
||||
coap_init_message(response, separate_store->type, CONTENT_2_05, separate_store->mid);
|
||||
|
||||
/* Restore the request information for the response. */
|
||||
coap_separate_resume(response, &separate_store->request_metadata, CONTENT_2_05);
|
||||
|
||||
coap_set_payload(response, separate_store->buffer, strlen(separate_store->buffer));
|
||||
|
||||
/*
|
||||
* Be aware to respect the Block2 option, which is also stored in the coap_separate_t.
|
||||
* As it is a critical option, this example resource pretends to handle it for compliance.
|
||||
*/
|
||||
coap_set_header_block2(response, separate_store->request_metadata.block2_num, 0, separate_store->request_metadata.block2_size);
|
||||
|
||||
/* Warning: No check for serialization error. */
|
||||
transaction->packet_len = coap_serialize_message(response, transaction->packet);
|
||||
coap_send_transaction(transaction);
|
||||
|
@ -682,14 +701,16 @@ PROCESS_THREAD(rest_server_example, ev, data)
|
|||
#if REST_RES_PUSHING
|
||||
rest_activate_periodic_resource(&periodic_resource_pushing);
|
||||
#endif
|
||||
#if REST_RES_SEPARATE && WITH_COAP > 3
|
||||
#if defined (PLATFORM_HAS_BUTTON) && REST_RES_EVENT
|
||||
rest_activate_event_resource(&resource_event);
|
||||
#endif
|
||||
#if defined (PLATFORM_HAS_BUTTON) && REST_RES_SEPARATE && WITH_COAP > 3
|
||||
/* Use this pre-handler for separate response resources. */
|
||||
rest_set_pre_handler(&resource_separate, coap_separate_handler);
|
||||
rest_activate_resource(&resource_separate);
|
||||
#endif
|
||||
|
||||
#if defined (PLATFORM_HAS_BUTTON) && REST_RES_EVENT
|
||||
#if defined (PLATFORM_HAS_BUTTON) && (REST_RES_EVENT || (REST_RES_SEPARATE && WITH_COAP > 3))
|
||||
SENSORS_ACTIVATE(button_sensor);
|
||||
rest_activate_event_resource(&resource_event);
|
||||
#endif
|
||||
#if defined (PLATFORM_HAS_LEDS)
|
||||
#if REST_RES_LEDS
|
||||
|
|
|
@ -157,7 +157,7 @@ exit(1);
|
|||
argv += optind - 1;
|
||||
|
||||
if(argc != 2 && argc != 3) {
|
||||
err(1, "usage: %s [-B baudrate] [-H] [-L] [-s siodev] [-t tundev] [-T] [-v verbosity] [-d delay] ipaddress", prog);
|
||||
err(1, "usage: %s [-B baudrate] [-H] [-L] [-s siodev] [-t tundev] [-T] [-v verbosity] [-d delay] [-a serveraddress] [-p serverport] ipaddress", prog);
|
||||
}
|
||||
slip_config_ipaddr = argv[1];
|
||||
|
||||
|
|
|
@ -72,14 +72,26 @@ AUTOSTART_PROCESSES(&border_router_process);
|
|||
#include "webserver-nogui.h"
|
||||
AUTOSTART_PROCESSES(&border_router_process,&webserver_nogui_process);
|
||||
#else
|
||||
/* Use simple webserver with only one page */
|
||||
/* Use simple webserver with only one page for minimum footprint.
|
||||
* Multiple connections can result in interleaved tcp segments since
|
||||
* a single static buffer is used for all segments.
|
||||
*/
|
||||
#include "httpd-simple.h"
|
||||
|
||||
/* The internal webserver can provide additional information if
|
||||
* enough program flash is available.
|
||||
*/
|
||||
#define WEBSERVER_CONF_LOADTIME 0
|
||||
#define WEBSERVER_CONF_FILESTATS 0
|
||||
#define WEBSERVER_CONF_NEIGHBOR_STATUS 0
|
||||
/* Adding links requires a larger RAM buffer. To avoid static allocation
|
||||
* the stack can be used for formatting; however tcp retransmissions
|
||||
* and multiple connections can result in garbled segments.
|
||||
* TODO:use PSOCk_GENERATOR_SEND and tcp state storage to fix this.
|
||||
*/
|
||||
#define WEBSERVER_CONF_ROUTE_LINKS 0
|
||||
#if WEBSERVER_CONF_ROUTE_LINKS
|
||||
#define BUF_USES_STACK 1
|
||||
#endif
|
||||
|
||||
PROCESS(webserver_nogui_process, "Web server");
|
||||
PROCESS_THREAD(webserver_nogui_process, ev, data)
|
||||
|
|
|
@ -392,7 +392,6 @@ extern void mac_log_802_15_4_rx(const uint8_t* buffer, size_t total_len);
|
|||
#define RF230_MAX_TX_POWER 15
|
||||
#define RF230_MIN_RX_POWER 30
|
||||
*/
|
||||
#define RPL_CONF_ADJUST_LLH_LEN 1
|
||||
#define UIP_CONF_ROUTER 1
|
||||
#define UIP_CONF_ND6_SEND_RA 0
|
||||
#define UIP_CONF_ND6_REACHABLE_TIME 600000
|
||||
|
|
|
@ -17,7 +17,7 @@ endif
|
|||
CONTIKI_TARGET_SOURCEFILES += $(SENSORS) $(ESB) \
|
||||
contiki-esb-default-init-lowlevel.c \
|
||||
contiki-esb-default-init-apps.c \
|
||||
rs232.c rs232-putchar.c fader.c $(CONTIKI_TARGET_MAIN)
|
||||
rs232.c rs232-putchar.c fader.c
|
||||
|
||||
ifdef WITH_CODEPROP
|
||||
CONTIKI_TARGET_DIRS += ../../apps/codeprop
|
||||
|
@ -30,7 +30,7 @@ CFLAGS+=-Os -g
|
|||
endif
|
||||
|
||||
ifdef IAR
|
||||
CFLAGS+=-e --vla -Ohz --multiplier=16s --core=430 --double=32
|
||||
CFLAGS += -D__MSP430F149__=1 -e --vla -Ohz --multiplier=16s --core=430 --double=32
|
||||
CFLAGSNO = --dlib_config "$(IAR_PATH)/LIB/DLIB/dl430fn.h" $(CFLAGSWERROR)
|
||||
endif
|
||||
|
||||
|
@ -53,6 +53,11 @@ include $(CONTIKI)/platform/$(TARGET)/apps/Makefile.apps
|
|||
MCU=msp430x149
|
||||
include $(CONTIKI)/cpu/msp430/Makefile.msp430
|
||||
|
||||
ifdef IAR
|
||||
LDFLAGSNO += -B -xm "$(IAR_PATH)/lib/dlib/dl430fn.r43" -f "$(IAR_PATH)/config/lnk430f149.xcl" -l contiki-$(TARGET).map -s __program_start -D_STACK_SIZE=80 -D_DATA16_HEAP_SIZE=80 -D_DATA20_HEAP_SIZE=80
|
||||
LDFLAGS += $(LDFLAGSNO) -Felf -yn
|
||||
endif # IAR
|
||||
|
||||
contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o}
|
||||
# $(AR) rcf $@ $^
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
#include "dev/button-sensor.h"
|
||||
#include "dev/hwconf.h"
|
||||
#include <signal.h>
|
||||
#include "isr_compat.h"
|
||||
|
||||
const struct sensors_sensor button_sensor;
|
||||
|
||||
|
@ -43,8 +43,7 @@ HWCONF_PIN(BUTTON, 2, 7);
|
|||
HWCONF_IRQ(BUTTON, 2, 7);
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
interrupt(PORT2_VECTOR)
|
||||
irq_p2(void)
|
||||
ISR(PORT2, irq_p2)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
||||
|
|
|
@ -78,6 +78,7 @@ Contributors: Thomas Pietsch, Bjoern Lichtblau
|
|||
|
||||
#include "dev/leds.h"
|
||||
#include "dev/beep.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
PROCESS(ir_process, "IR receiver");
|
||||
process_event_t ir_event_received;
|
||||
|
@ -202,7 +203,7 @@ static void clearDataAvailableBit(void){ recvdata &= 0xEFFF; }
|
|||
|
||||
|
||||
/// Timer B0 interrupt service routine
|
||||
interrupt(TIMERB1_VECTOR) Timer_B1 (void) {
|
||||
ISR(TIMERB1, Timer_B1) {
|
||||
|
||||
/*P2OUT = (P2OUT & 0xf7) | (8 - (P2OUT & 0x08));*/
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "lib/sensors.h"
|
||||
#include "dev/irq.h"
|
||||
#include "dev/lpm.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
#define ADC12MCTL_NO(adcno) ((unsigned char *) ADC12MCTL0_)[adcno]
|
||||
|
||||
|
@ -42,8 +43,7 @@ static int (* port1_irq[8])(void);
|
|||
static unsigned char adcflags;
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
interrupt(PORT1_VECTOR)
|
||||
irq_p1(void)
|
||||
ISR(PORT1, irq_p1)
|
||||
{
|
||||
int i;
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
@ -58,8 +58,7 @@ interrupt(PORT1_VECTOR)
|
|||
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
interrupt (ADC_VECTOR)
|
||||
irq_adc(void)
|
||||
ISR(ADC, irq_adc)
|
||||
{
|
||||
int i;
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
|
|
@ -47,12 +47,12 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "contiki-esb.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
static int (* input_handler)(unsigned char) = NULL;
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
interrupt(UART1RX_VECTOR)
|
||||
rs232_rx_usart1(void)
|
||||
ISR(UART1RX, rs232_rx_usart1)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
/* Check status register for receive errors. - before reading RXBUF since
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include "lib/crc16.h"
|
||||
#include "net/netstack.h"
|
||||
#include "net/rime/rimestats.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -385,8 +386,7 @@ tr1001_init(void)
|
|||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
interrupt (UART0RX_VECTOR)
|
||||
tr1001_rxhandler(void)
|
||||
ISR(UART0RX, tr1001_rxhandler)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
tr1001_default_rxhandler_pt(RXBUF0);
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include "lib/crc16.h"
|
||||
#include "net/netstack.h"
|
||||
#include "net/rime/rimestats.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -376,8 +377,7 @@ tr1001_init(void)
|
|||
return 1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
interrupt (UART0RX_VECTOR)
|
||||
tr1001_rxhandler(void)
|
||||
ISR(UART0RX, tr1001_rxhandler)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
tr1001_default_rxhandler_pt(RXBUF0);
|
||||
|
|
|
@ -1,19 +1,8 @@
|
|||
# $Id: Makefile.z1,v 1.4 2010/11/07 08:40:24 enricmcalvo Exp $
|
||||
# msp430flasher -n msp430x5437 -w "Firmware.txt" -v -z [VCC]
|
||||
|
||||
ifndef IAR
|
||||
GCC=1
|
||||
endif
|
||||
|
||||
ifdef GCC
|
||||
CFLAGS+=-Os -g
|
||||
else
|
||||
IAR=1
|
||||
endif
|
||||
|
||||
ifdef IAR
|
||||
CFLAGS+=-e --vla -Ohz --multiplier=32 --multiplier_location=4C0 --hw_workaround=CPU40 --core=430X --data_model small --double=32 -D__MSP430F5438A__
|
||||
CFLAGS += --diag_suppress=Pa050
|
||||
CFLAGS+=-e --vla -Ohz --multiplier=32 --multiplier_location=4C0 --hw_workaround=CPU40 --core=430X --data_model small --double=32 -D__MSP430F5438A__=1
|
||||
#CFLAGS+=--no_cse --no_unroll --no_inline --no_code_motion --no_tbaa --debug -D__MSP430F5438A__ -e --double=32 --dlib_config 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.0 Evaluation\430\LIB\DLIB\dl430xsfn.h' --core=430X --data_model=small -Ol --multiplier=32 --multiplier_location=4C0 --hw_workaround=CPU40
|
||||
endif
|
||||
|
||||
|
@ -43,7 +32,7 @@ help:
|
|||
@echo make help - shows this help
|
||||
@echo make TARGET=exp5438 savetarget - stores selection of target to avoid using TARGET= on every make invokation
|
||||
@echo make program.upload - compiles and uploads program to connected board
|
||||
@echo make program.upload GCC=1 - uses the mspgcc compiler instead of IAR
|
||||
@echo make program.upload IAR=1 - uses the IAR compiler instead of mspgcc
|
||||
@echo make program.upload NODEID=x - uploads with node_id set to x
|
||||
|
||||
CONTIKI_TARGET_DIRS = . dev apps net
|
||||
|
@ -70,19 +59,12 @@ contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o}
|
|||
|
||||
ifdef IAR
|
||||
STACKSIZE=300
|
||||
LDFLAGS_ELF=-B -xm "$(IAR_PATH)/lib/dlib/dl430xsfn.r43" -f "$(IAR_PATH)/config/lnk430f5437.xcl" -l contiki-$(TARGET).map -Felf -yn -s __program_start -D_STACK_SIZE=$(STACKSIZE) -D_DATA16_HEAP_SIZE=$(STACKSIZE) -D_DATA20_HEAP_SIZE=$(STACKSIZE)
|
||||
LDFLAGSNO += -B -xm "$(IAR_PATH)/lib/dlib/dl430xsfn.r43" -f "$(IAR_PATH)/config/lnk430f5437.xcl" -l contiki-$(TARGET).map -s __program_start -D_STACK_SIZE=$(STACKSIZE) -D_DATA16_HEAP_SIZE=$(STACKSIZE) -D_DATA20_HEAP_SIZE=$(STACKSIZE)
|
||||
LDFLAGS += $(LDFLAGSNO) -Felf -yn
|
||||
endif
|
||||
|
||||
LDFLAGS_HEX=-B -xm "$(IAR_PATH)/lib/dlib/dl430xsfn.r43" -f "$(IAR_PATH)/config/lnk430f5437.xcl" -l contiki-$(TARGET).map -Fintel-extended -s __program_start -D_STACK_SIZE=$(STACKSIZE) -D_DATA16_HEAP_SIZE=$(STACKSIZE) -D_DATA20_HEAP_SIZE=$(STACKSIZE)
|
||||
|
||||
LDFLAGS+=$(LDFLAGS_ELF)
|
||||
|
||||
%.hex: %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a
|
||||
$(LD) $(LDFLAGS_HEX) $(TARGET_STARTFILES) ${filter-out %.a,$^} ${filter %.a,$^} $(TARGET_LIBFILES) -o $@
|
||||
|
||||
else
|
||||
%.hex: %.ihex
|
||||
mv $< $@
|
||||
endif
|
||||
|
||||
%.upload: %.hex
|
||||
msp430flasher -n msp430x5438a -e ERASE_MAIN -w $< -v -z [VCC]
|
||||
|
|
|
@ -31,19 +31,12 @@
|
|||
|
||||
|
||||
#include "contiki.h"
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include "contiki-net.h"
|
||||
|
||||
#include "dev/spi.h"
|
||||
#include "dev/cc2420.h"
|
||||
#include "dev/leds.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
#ifndef CONF_SFD_TIMESTAMPS
|
||||
#define CONF_SFD_TIMESTAMPS 0
|
||||
|
@ -54,13 +47,7 @@
|
|||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=CC2420_IRQ_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(CC2420_IRQ_VECTOR)
|
||||
#endif
|
||||
cc24240_fifop_interrupt(void)
|
||||
ISR(CC2420_IRQ, cc24240_fifop_interrupt)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
||||
|
|
|
@ -32,18 +32,11 @@
|
|||
*/
|
||||
|
||||
#include "contiki-conf.h"
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include "sys/energest.h"
|
||||
#include "sys/clock.h"
|
||||
#include "sys/etimer.h"
|
||||
#include "rtimer-arch.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
#include "dev/leds.h"
|
||||
|
||||
|
@ -57,13 +50,7 @@ static volatile clock_time_t count = 0;
|
|||
/* last_tar is used for calculating clock_fine, last_ccr might be better? */
|
||||
static unsigned short last_tar = 0;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=TIMER1_A1_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(TIMER1_A1_VECTOR)
|
||||
#endif
|
||||
timera1 (void)
|
||||
ISR(TIMER1_A1, timera1)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
||||
|
|
|
@ -30,13 +30,6 @@
|
|||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
|
|
@ -36,13 +36,6 @@
|
|||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "dev/flash.h"
|
||||
|
|
|
@ -35,11 +35,6 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include "contiki-conf.h"
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#include "hal_MSP-EXP430F5438.h"
|
||||
#include "hal_lcd_fonts.h"
|
||||
|
|
|
@ -42,12 +42,6 @@
|
|||
#include "contiki-conf.h"
|
||||
#include "dev/leds.h"
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
/* LED ports */
|
||||
#define LEDS_CONF_RED 0x01
|
||||
#define LEDS_CONF_GREEN 0x02
|
||||
|
|
|
@ -31,12 +31,6 @@
|
|||
* @(#)$Id: msp430.c,v 1.1 2010/08/24 16:26:38 joxe Exp $
|
||||
*/
|
||||
#include "contiki.h"
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
#include "dev/watchdog.h"
|
||||
#include "dev/leds.h"
|
||||
#include "net/uip.h"
|
||||
|
|
|
@ -44,19 +44,6 @@
|
|||
* changeable!
|
||||
*/
|
||||
#define TYNDALL 1
|
||||
/* Test for IAR compiler */
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <intrinsics.h>
|
||||
#include <in430.h>
|
||||
#define dint() __disable_interrupt()
|
||||
#define eint() __enable_interrupt()
|
||||
#define __MSP430F5437__ 1
|
||||
#define __MSP430__ 1
|
||||
#define CC_CONF_INLINE
|
||||
#define BV(x) (1 << x)
|
||||
#else
|
||||
#define CC_CONF_INLINE inline
|
||||
#endif
|
||||
|
||||
/* CPU target speed in Hz */
|
||||
#define F_CPU 8000000uL // 8MHz by default
|
||||
|
|
|
@ -39,17 +39,11 @@
|
|||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include "sys/energest.h"
|
||||
#include "sys/rtimer.h"
|
||||
#include "sys/process.h"
|
||||
#include "dev/watchdog.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
|
@ -60,13 +54,8 @@
|
|||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=TIMER1_A0_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(TIMER1_A0_VECTOR)
|
||||
#endif
|
||||
timera0 (void) {
|
||||
ISR(TIMER1_A0, timera0)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
||||
watchdog_start();
|
||||
|
|
|
@ -30,17 +30,12 @@
|
|||
*/
|
||||
|
||||
#include "contiki-conf.h"
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is SPI initialization code for the MSP430X architecture.
|
||||
*
|
||||
*/
|
||||
unsigned char spi_busy = 0;
|
||||
/* unsigned char spi_busy = 0; */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/*
|
||||
* Initialize SPI bus.
|
||||
|
|
|
@ -36,13 +36,6 @@
|
|||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "sys/energest.h"
|
||||
|
@ -50,6 +43,7 @@
|
|||
#include "dev/watchdog.h"
|
||||
#include "lib/ringbuf.h"
|
||||
#include "dev/leds.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
static int (*uart1_input_handler)(unsigned char c);
|
||||
|
||||
|
@ -114,13 +108,7 @@ uart1_init(unsigned long ubr)
|
|||
UCA1IE |= UCRXIE; /* Enable UCA1 RX interrupt */
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=USCI_A1_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(USCI_A1_VECTOR)
|
||||
#endif
|
||||
uart1_rx_interrupt(void)
|
||||
ISR(USCI_A1, uart1_rx_interrupt)
|
||||
{
|
||||
uint8_t c;
|
||||
|
||||
|
|
|
@ -32,13 +32,8 @@
|
|||
*/
|
||||
|
||||
#include "contiki-conf.h"
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
#include "dev/watchdog.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
static int counter = 0;
|
||||
|
||||
|
@ -76,13 +71,7 @@ printstring(char *s)
|
|||
#endif /* CONTIKI_TARGET_SKY */
|
||||
#endif /* PRINT_STACK_ON_REBOOT */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=WDT_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(WDT_VECTOR)
|
||||
#endif
|
||||
watchdog_interrupt(void)
|
||||
ISR(WDT, watchdog_interrupt)
|
||||
{
|
||||
#ifdef CONTIKI_TARGET_SKY
|
||||
#if PRINT_STACK_ON_REBOOT
|
||||
|
|
|
@ -60,8 +60,6 @@
|
|||
#define CCIF
|
||||
#define CLIF
|
||||
|
||||
#define CC_CONF_INLINE inline
|
||||
|
||||
#define HAVE_STDINT_H
|
||||
#include "msp430def.h"
|
||||
|
||||
|
|
|
@ -97,7 +97,6 @@ typedef unsigned short uip_stats_t;
|
|||
* They should all attach to a minimal-net rpl border that uses the same primary interface.
|
||||
* For multihop testing, configure intermediate notes as routers.
|
||||
*/
|
||||
#define RPL_CONF_ADJUST_LLH_LEN 1
|
||||
#define HARD_CODED_ADDRESS "bbbb::10" //the prefix is ignored for a rpl node
|
||||
#define UIP_CONF_ROUTER 0
|
||||
#define UIP_CONF_ND6_SEND_RA 0
|
||||
|
|
|
@ -38,8 +38,6 @@
|
|||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#include <msp430/adc12.h>
|
||||
|
||||
#include "contiki-msb430.h"
|
||||
|
||||
void
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef CC1020_INTERNAL_H
|
||||
#define CC1020_INTERNAL_H
|
||||
|
||||
#include <signal.h>
|
||||
#include "contiki.h"
|
||||
|
||||
#define CC1020_MAIN 0x00
|
||||
#define CC1020_INTERFACE 0x01
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "contiki.h"
|
||||
#include "contiki-msb430.h"
|
||||
|
@ -52,6 +51,7 @@
|
|||
#include "net/rime/rimestats.h"
|
||||
#include "dev/dma.h"
|
||||
#include "sys/energest.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
|
@ -458,7 +458,7 @@ PROCESS_THREAD(cc1020_receiver_process, ev, data)
|
|||
PROCESS_END();
|
||||
}
|
||||
|
||||
interrupt(UART0RX_VECTOR) cc1020_rxhandler(void)
|
||||
ISR(UART0RX, cc1020_rxhandler)
|
||||
{
|
||||
static signed char syncbs;
|
||||
static union {
|
||||
|
|
|
@ -41,10 +41,11 @@
|
|||
#include "contiki-msb430.h"
|
||||
#include "dev/cc1020.h"
|
||||
#include "dev/dma.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
static void (*callbacks[DMA_LINES])(void);
|
||||
|
||||
interrupt(DACDMA_VECTOR) irq_dacdma(void)
|
||||
ISR(DACDMA, irq_dacdma)
|
||||
{
|
||||
if(DMA0CTL & DMAIFG) {
|
||||
DMA0CTL &= ~(DMAIFG | DMAIE);
|
||||
|
|
|
@ -51,10 +51,8 @@ Berlin, 2007
|
|||
* across both blocks are not allowed.
|
||||
*/
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include "contiki-conf.h"
|
||||
#include <msp430/flash.h>
|
||||
#include "infomem.h"
|
||||
|
||||
void
|
||||
|
|
|
@ -55,6 +55,7 @@ Berlin, 2007
|
|||
#include <string.h>
|
||||
#include "dev/msb430-uart1.h"
|
||||
#include "dev/lpm.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
#ifndef U1ME
|
||||
#define U1ME ME2
|
||||
|
@ -204,8 +205,7 @@ uart_get_mode(void)
|
|||
return uart_mode;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
interrupt(UART1RX_VECTOR)
|
||||
uart_rx(void)
|
||||
ISR(UART1RX, uart_rx)
|
||||
{
|
||||
uart_handler_t handler = uart_handler[uart_mode];
|
||||
int c;
|
||||
|
|
|
@ -59,8 +59,6 @@
|
|||
#define CCIF
|
||||
#define CLIF
|
||||
|
||||
#define CC_CONF_INLINE inline
|
||||
|
||||
#define HAVE_STDINT_H
|
||||
#include "msp430def.h"
|
||||
|
||||
|
|
|
@ -17,12 +17,9 @@ endif
|
|||
ifdef IAR
|
||||
CFLAGS += -D__MSP430F1611__=1 -e --vla -Ohz --multiplier=16s --core=430 --double=32
|
||||
CFLAGSNO = --dlib_config "$(IAR_PATH)/LIB/DLIB/dl430fn.h" $(CFLAGSWERROR)
|
||||
|
||||
endif
|
||||
|
||||
|
||||
CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS) #$(CONTIKI_TARGET_MAIN)
|
||||
CONTIKI_TARGET_SOURCEFILES += contiki-sky-platform.c
|
||||
CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS)
|
||||
|
||||
MCU=msp430x1611
|
||||
include $(CONTIKI)/cpu/msp430/Makefile.msp430
|
||||
|
@ -32,12 +29,9 @@ contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o}
|
|||
|
||||
|
||||
ifdef IAR
|
||||
ifdef ELF
|
||||
LDFLAGS += -B -xm "$(IAR_PATH)/lib/dlib/dl430fn.r43" -f "$(IAR_PATH)/config/lnk430f1611.xcl" -l contiki-$(TARGET).map -Felf -yn -s __program_start -D_STACK_SIZE=80 -D_DATA16_HEAP_SIZE=80 -D_DATA20_HEAP_SIZE=80
|
||||
else
|
||||
LDFLAGS += -B -xm "$(IAR_PATH)/lib/dlib/dl430fn.r43" -f "$(IAR_PATH)/config/lnk430f1611.xcl" -l contiki-$(TARGET).map -Fintel-extended -s __program_start -D_STACK_SIZE=80 -D_DATA16_HEAP_SIZE=80 -D_DATA20_HEAP_SIZE=80
|
||||
endif
|
||||
endif
|
||||
LDFLAGSNO += -B -xm "$(IAR_PATH)/lib/dlib/dl430fn.r43" -f "$(IAR_PATH)/config/lnk430f1611.xcl" -l contiki-$(TARGET).map -s __program_start -D_STACK_SIZE=80 -D_DATA16_HEAP_SIZE=80 -D_DATA20_HEAP_SIZE=80
|
||||
LDFLAGS += $(LDFLAGSNO) -Felf -yn
|
||||
endif # IAR
|
||||
|
||||
NUMPAR=20
|
||||
IHEXFILE=tmpimage.ihex
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "lib/sensors.h"
|
||||
#include "dev/hwconf.h"
|
||||
#include "dev/button-sensor.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
const struct sensors_sensor button_sensor;
|
||||
|
||||
|
@ -44,13 +45,7 @@ HWCONF_PIN(BUTTON, 2, 7);
|
|||
HWCONF_IRQ(BUTTON, 2, 7);
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=PORT2_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(PORT2_VECTOR)
|
||||
#endif
|
||||
irq_p2(void)
|
||||
ISR(PORT2, irq_p2)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
||||
|
|
|
@ -34,19 +34,15 @@ MCU=msp430x5437
|
|||
include $(CONTIKI)/cpu/msp430/Makefile.msp430
|
||||
|
||||
ifdef IAR
|
||||
LDFLAGS += -B -xm "$(IAR_PATH)/lib/dlib/dl430xsfn.r43" -f "$(IAR_PATH)/config/lnk430f5437.xcl" -l contiki-$(TARGET).map -Fintel-extended -s __program_start -D_STACK_SIZE=80 -D_DATA16_HEAP_SIZE=80 -D_DATA20_HEAP_SIZE=80
|
||||
LDFLAGSNO += -B -xm "$(IAR_PATH)/lib/dlib/dl430xsfn.r43" -f "$(IAR_PATH)/config/lnk430f5437.xcl" -l contiki-$(TARGET).map -s __program_start -D_STACK_SIZE=80 -D_DATA16_HEAP_SIZE=80 -D_DATA20_HEAP_SIZE=80
|
||||
LDFLAGS += $(LDFLAGSNO) -Felf -yn
|
||||
endif
|
||||
|
||||
contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o}
|
||||
# $(AR) rcf $@ $^
|
||||
|
||||
ifdef IAR
|
||||
%.hex: %.$(TARGET)
|
||||
mv $< $@
|
||||
else
|
||||
%.hex: %.ihex
|
||||
mv $< $@
|
||||
endif
|
||||
|
||||
%.upload: %.hex
|
||||
msp430flasher -n msp430x5437 -e ERASE_MAIN -w $< -v -z [VCC]
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include "lib/sensors.h"
|
||||
#include "dev/hwconf.h"
|
||||
#include "dev/button-sensor.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
const struct sensors_sensor button_sensor;
|
||||
|
||||
|
@ -41,13 +42,7 @@ HWCONF_PIN(BUTTON, 2, 7);
|
|||
HWCONF_IRQ(BUTTON, 2, 7);
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=PORT2_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(PORT2_VECTOR)
|
||||
#endif
|
||||
irq_p2(void)
|
||||
ISR(PORT2, irq_p2)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
# $Id: Makefile.z1,v 1.5 2011/02/26 enricmcalvo Exp $
|
||||
|
||||
PROJECT_SOURCEFILES += i2cmaster.c adxl345.c
|
||||
|
||||
ifdef GCC
|
||||
CFLAGS+=-Os -g
|
||||
endif
|
||||
|
@ -13,9 +11,6 @@ LDFLAGS += -Wl,--defsym -Wl,__P1SEL2=0x0041 -Wl,--defsym -Wl,__P5SEL2=0x0045
|
|||
endif
|
||||
|
||||
CLEAN += symbols.c symbols.h
|
||||
#CFLAGS += -ffunction-sections
|
||||
#LDFLAGS += -Wl,--gc-sections,--undefined=_reset_vector__,--undefined=InterruptVectors,--undefined=_copy_data_init__,--undefined=_clear_bss_init__,--undefined=_end_of_init__
|
||||
|
||||
|
||||
ARCH=msp430.c leds.c watchdog.c xmem.c \
|
||||
spi.c cc2420.c cc2420-aes.c cc2420-arch.c cc2420-arch-sfd.c\
|
||||
|
@ -39,14 +34,15 @@ CFLAGS += -DMACID=$(nodemac)
|
|||
endif
|
||||
|
||||
CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS)
|
||||
CONTIKI_TARGET_SOURCEFILES += contiki-z1-platform.c
|
||||
CONTIKI_TARGET_SOURCEFILES += i2cmaster.c adxl345.c
|
||||
|
||||
MCU=msp430x2617
|
||||
include $(CONTIKI)/cpu/msp430/Makefile.msp430
|
||||
|
||||
# Add LDFLAGS after IAR_PATH is set
|
||||
ifdef IAR
|
||||
LDFLAGS += -B -xm "$(IAR_PATH)/lib/dlib/dl430xsfn.r43" -f "$(IAR_PATH)/config/lnk430f2617.xcl" -l contiki-$(TARGET).map -Fintel-extended -s __program_start -D_STACK_SIZE=80 -D_DATA16_HEAP_SIZE=80 -D_DATA20_HEAP_SIZE=80
|
||||
LDFLAGSNO += -B -xm "$(IAR_PATH)/lib/dlib/dl430xsfn.r43" -f "$(IAR_PATH)/config/lnk430f2617.xcl" -l contiki-$(TARGET).map -s __program_start -D_STACK_SIZE=80 -D_DATA16_HEAP_SIZE=80 -D_DATA20_HEAP_SIZE=80
|
||||
LDFLAGS += $(LDFLAGSNO) -Felf -yn
|
||||
endif
|
||||
|
||||
contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o}
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "adxl345.h"
|
||||
#include "cc2420.h"
|
||||
#include "i2cmaster.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
/* Callback pointers when interrupt occurs */
|
||||
void (*accm_int1_cb)(uint8_t reg);
|
||||
|
@ -375,13 +376,8 @@ PROCESS_THREAD(accmeter_process, ev, data) {
|
|||
#if 1
|
||||
static struct timer suppressTimer1, suppressTimer2;
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=PORT1_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt (PORT1_VECTOR)
|
||||
#endif
|
||||
port1_isr (void) {
|
||||
ISR(PORT1, port1_isr)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
/* ADXL345_IFG.x goes high when interrupt occurs, use to check what interrupted */
|
||||
if ((ADXL345_IFG & ADXL345_INT1_PIN) && !(ADXL345_IFG & BV(CC2420_FIFOP_PIN))){
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "lib/sensors.h"
|
||||
#include "dev/hwconf.h"
|
||||
#include "dev/button-sensor.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
const struct sensors_sensor button_sensor;
|
||||
|
||||
|
@ -45,14 +46,7 @@ HWCONF_PIN(BUTTON, 2, 5);
|
|||
HWCONF_IRQ(BUTTON, 2, 5);
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=PORT2_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(PORT2_VECTOR)
|
||||
#endif
|
||||
irq_p2(void)
|
||||
ISR(PORT2, irq_p2)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "contiki-net.h"
|
||||
#include "dev/spi.h"
|
||||
#include "dev/cc2420.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
#ifndef CONF_SFD_TIMESTAMPS
|
||||
#define CONF_SFD_TIMESTAMPS 0
|
||||
|
@ -45,8 +46,7 @@
|
|||
/*---------------------------------------------------------------------------*/
|
||||
#if 0
|
||||
// this is now handled in the ADXL345 accelerometer code as it uses irq on port1 too.
|
||||
interrupt(CC2420_IRQ_VECTOR)
|
||||
cc24240_port1_interrupt(void)
|
||||
ISR(CC2420_IRQ, cc24240_port1_interrupt)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
if(cc2420_interrupt()) {
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
*/
|
||||
|
||||
#include "i2cmaster.h"
|
||||
#include "isr_compat.h"
|
||||
|
||||
signed char tx_byte_ctr, rx_byte_ctr;
|
||||
unsigned char rx_buf[2];
|
||||
|
@ -201,13 +202,8 @@ i2c_transmit_n(uint8_t byte_ctr, uint8_t *tx_buf) {
|
|||
}
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=USCIAB1TX_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt (USCIAB1TX_VECTOR)
|
||||
#endif
|
||||
i2c_tx_interrupt (void) {
|
||||
ISR(USCIAB1TX, i2c_tx_interrupt)
|
||||
{
|
||||
// TX Part
|
||||
if (UC1IFG & UCB1TXIFG) { // TX int. condition
|
||||
if (tx_byte_ctr == 0) {
|
||||
|
@ -237,18 +233,11 @@ i2c_tx_interrupt (void) {
|
|||
#endif
|
||||
}
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=USCIAB1RX_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt (USCIAB1RX_VECTOR)
|
||||
#endif
|
||||
i2c_rx_interrupt(void) {
|
||||
if (UCB1STAT & UCNACKIFG){
|
||||
ISR(USCIAB1RX, i2c_rx_interrupt)
|
||||
{
|
||||
if(UCB1STAT & UCNACKIFG) {
|
||||
PRINTFDEBUG("!!! NACK received in RX\n");
|
||||
UCB1CTL1 |= UCTXSTP;
|
||||
UCB1STAT &= ~UCNACKIFG;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -387,7 +387,9 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc
|
|||
|
||||
public boolean setConfigXML(Simulation simulation, Collection<Element> configXML, boolean visAvailable) {
|
||||
setSimulation(simulation);
|
||||
myMoteInterfaceHandler = createMoteInterfaceHandler();
|
||||
if (myMoteInterfaceHandler == null) {
|
||||
myMoteInterfaceHandler = createMoteInterfaceHandler();
|
||||
}
|
||||
|
||||
/* Create watchpoint container */
|
||||
try {
|
||||
|
@ -497,18 +499,23 @@ public abstract class MspMote extends AbstractEmulatedMote implements Mote, Watc
|
|||
}
|
||||
if (di == null) {
|
||||
/* Return PC value */
|
||||
MapEntry mapEntry = ((SimpleProfiler)myCpu.getProfiler()).getCallMapEntry(0);
|
||||
if (mapEntry != null) {
|
||||
String file = mapEntry.getFile();
|
||||
if (file != null) {
|
||||
if (file.indexOf('/') >= 0) {
|
||||
file = file.substring(file.lastIndexOf('/')+1);
|
||||
SimpleProfiler sp = (SimpleProfiler)myCpu.getProfiler();
|
||||
try {
|
||||
MapEntry mapEntry = sp.getCallMapEntry(0);
|
||||
if (mapEntry != null) {
|
||||
String file = mapEntry.getFile();
|
||||
if (file != null) {
|
||||
if (file.indexOf('/') >= 0) {
|
||||
file = file.substring(file.lastIndexOf('/')+1);
|
||||
}
|
||||
}
|
||||
String name = mapEntry.getName();
|
||||
return file + ":?:" + name;
|
||||
}
|
||||
String name = mapEntry.getName();
|
||||
return file + ":?:" + name;
|
||||
return String.format("*%02x", myCpu.reg[MSP430Constants.PC]);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
return String.format("*%02x", myCpu.reg[MSP430Constants.PC]);
|
||||
}
|
||||
|
||||
int lineNo = di.getLine();
|
||||
|
|
|
@ -30,9 +30,6 @@
|
|||
*/
|
||||
|
||||
package se.sics.cooja.mspmote.interfaces;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Observable;
|
||||
import java.util.Observer;
|
||||
|
||||
|
@ -40,7 +37,6 @@ import javax.swing.JLabel;
|
|||
import javax.swing.JPanel;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jdom.Element;
|
||||
|
||||
import se.sics.cooja.Mote;
|
||||
import se.sics.cooja.MoteTimeEvent;
|
||||
|
@ -76,41 +72,6 @@ public class MspMoteID extends MoteID {
|
|||
public MspMoteID(Mote m) {
|
||||
this.mote = (MspMote) m;
|
||||
this.moteMem = (MspMoteMemory) mote.getMemory();
|
||||
|
||||
final MoteTimeEvent writeIDEvent = new MoteTimeEvent(mote, 0) {
|
||||
public void execute(long t) {
|
||||
setMoteID(moteID);
|
||||
}
|
||||
};
|
||||
|
||||
cpuMonitor = new CPUMonitor() {
|
||||
public void cpuAction(int type, int adr, int data) {
|
||||
if (type != MEMORY_WRITE) {
|
||||
return;
|
||||
}
|
||||
if (data == moteID) {
|
||||
return;
|
||||
}
|
||||
Simulation s = mote.getSimulation();
|
||||
if (writeIDEvent.isScheduled()) {
|
||||
return;
|
||||
}
|
||||
s.scheduleEvent(writeIDEvent, s.getSimulationTime());
|
||||
}
|
||||
};
|
||||
|
||||
if (moteMem.variableExists("node_id")) {
|
||||
this.mote.getCPU().addWatchPoint(moteMem.getVariableAddress("node_id"), cpuMonitor);
|
||||
}
|
||||
if (moteMem.variableExists("TOS_NODE_ID")) {
|
||||
this.mote.getCPU().addWatchPoint(moteMem.getVariableAddress("TOS_NODE_ID"), cpuMonitor);
|
||||
}
|
||||
if (moteMem.variableExists("ActiveMessageAddressC__addr")) {
|
||||
this.mote.getCPU().addWatchPoint(moteMem.getVariableAddress("ActiveMessageAddressC__addr"), cpuMonitor);
|
||||
}
|
||||
if (moteMem.variableExists("ActiveMessageAddressC$addr")) {
|
||||
this.mote.getCPU().addWatchPoint(moteMem.getVariableAddress("ActiveMessageAddressC$addr"), cpuMonitor);
|
||||
}
|
||||
}
|
||||
|
||||
public int getMoteID() {
|
||||
|
@ -149,6 +110,42 @@ public class MspMoteID extends MoteID {
|
|||
if (moteMem.variableExists("ActiveMessageAddressC$addr")) {
|
||||
moteMem.setIntValueOf("ActiveMessageAddressC$addr", newID);
|
||||
}
|
||||
if (cpuMonitor == null) {
|
||||
final MoteTimeEvent writeIDEvent = new MoteTimeEvent(mote, 0) {
|
||||
public void execute(long t) {
|
||||
setMoteID(moteID);
|
||||
}
|
||||
};
|
||||
|
||||
cpuMonitor = new CPUMonitor() {
|
||||
public void cpuAction(int type, int address, int data) {
|
||||
if (type != MEMORY_WRITE) {
|
||||
return;
|
||||
}
|
||||
if (data == moteID) {
|
||||
return;
|
||||
}
|
||||
if (writeIDEvent.isScheduled()) {
|
||||
return;
|
||||
}
|
||||
Simulation s = mote.getSimulation();
|
||||
s.scheduleEvent(writeIDEvent, s.getSimulationTime());
|
||||
}
|
||||
};
|
||||
|
||||
if (moteMem.variableExists("node_id")) {
|
||||
this.mote.getCPU().addWatchPoint(moteMem.getVariableAddress("node_id"), cpuMonitor);
|
||||
}
|
||||
if (moteMem.variableExists("TOS_NODE_ID")) {
|
||||
this.mote.getCPU().addWatchPoint(moteMem.getVariableAddress("TOS_NODE_ID"), cpuMonitor);
|
||||
}
|
||||
if (moteMem.variableExists("ActiveMessageAddressC__addr")) {
|
||||
this.mote.getCPU().addWatchPoint(moteMem.getVariableAddress("ActiveMessageAddressC__addr"), cpuMonitor);
|
||||
}
|
||||
if (moteMem.variableExists("ActiveMessageAddressC$addr")) {
|
||||
this.mote.getCPU().addWatchPoint(moteMem.getVariableAddress("ActiveMessageAddressC$addr"), cpuMonitor);
|
||||
}
|
||||
}
|
||||
|
||||
notifyObservers();
|
||||
}
|
||||
|
@ -183,35 +180,22 @@ public class MspMoteID extends MoteID {
|
|||
this.deleteObserver(observer);
|
||||
}
|
||||
|
||||
public Collection<Element> getConfigXML() {
|
||||
ArrayList<Element> config = new ArrayList<Element>();
|
||||
Element element = new Element("id");
|
||||
element.setText(Integer.toString(getMoteID()));
|
||||
config.add(element);
|
||||
return config;
|
||||
}
|
||||
|
||||
public void setConfigXML(Collection<Element> configXML, boolean visAvailable) {
|
||||
for (Element element : configXML) {
|
||||
if (element.getName().equals("id")) {
|
||||
setMoteID(Integer.parseInt(element.getText()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removed() {
|
||||
super.removed();
|
||||
if (moteMem.variableExists("node_id")) {
|
||||
this.mote.getCPU().removeWatchPoint(moteMem.getVariableAddress("node_id"), cpuMonitor);
|
||||
}
|
||||
if (moteMem.variableExists("TOS_NODE_ID")) {
|
||||
this.mote.getCPU().removeWatchPoint(moteMem.getVariableAddress("TOS_NODE_ID"), cpuMonitor);
|
||||
}
|
||||
if (moteMem.variableExists("ActiveMessageAddressC__addr")) {
|
||||
this.mote.getCPU().removeWatchPoint(moteMem.getVariableAddress("ActiveMessageAddressC__addr"), cpuMonitor);
|
||||
}
|
||||
if (moteMem.variableExists("ActiveMessageAddressC$addr")) {
|
||||
this.mote.getCPU().removeWatchPoint(moteMem.getVariableAddress("ActiveMessageAddressC$addr"), cpuMonitor);
|
||||
if (cpuMonitor != null) {
|
||||
if (moteMem.variableExists("node_id")) {
|
||||
this.mote.getCPU().removeWatchPoint(moteMem.getVariableAddress("node_id"), cpuMonitor);
|
||||
}
|
||||
if (moteMem.variableExists("TOS_NODE_ID")) {
|
||||
this.mote.getCPU().removeWatchPoint(moteMem.getVariableAddress("TOS_NODE_ID"), cpuMonitor);
|
||||
}
|
||||
if (moteMem.variableExists("ActiveMessageAddressC__addr")) {
|
||||
this.mote.getCPU().removeWatchPoint(moteMem.getVariableAddress("ActiveMessageAddressC__addr"), cpuMonitor);
|
||||
}
|
||||
if (moteMem.variableExists("ActiveMessageAddressC$addr")) {
|
||||
this.mote.getCPU().removeWatchPoint(moteMem.getVariableAddress("ActiveMessageAddressC$addr"), cpuMonitor);
|
||||
}
|
||||
cpuMonitor = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ import java.awt.event.ActionListener;
|
|||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.io.PrintStream;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JOptionPane;
|
||||
|
@ -44,7 +45,6 @@ import javax.swing.JPopupMenu;
|
|||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.SwingUtilities;
|
||||
|
||||
import se.sics.cooja.ClassDescription;
|
||||
import se.sics.cooja.GUI;
|
||||
|
@ -53,6 +53,7 @@ import se.sics.cooja.MotePlugin;
|
|||
import se.sics.cooja.PluginType;
|
||||
import se.sics.cooja.Simulation;
|
||||
import se.sics.cooja.VisPlugin;
|
||||
import se.sics.cooja.dialogs.UpdateAggregator;
|
||||
import se.sics.cooja.mspmote.MspMote;
|
||||
import se.sics.mspsim.cli.CommandContext;
|
||||
import se.sics.mspsim.cli.LineListener;
|
||||
|
@ -77,8 +78,8 @@ public class MspCLI extends VisPlugin implements MotePlugin {
|
|||
|
||||
final Container panel = getContentPane();
|
||||
|
||||
logArea = new JTextArea(4, 30);
|
||||
logArea.setTabSize(4);
|
||||
logArea = new JTextArea(4, 20);
|
||||
logArea.setTabSize(8);
|
||||
logArea.setEditable(false);
|
||||
panel.add(new JScrollPane(logArea), BorderLayout.CENTER);
|
||||
|
||||
|
@ -176,27 +177,41 @@ public class MspCLI extends VisPlugin implements MotePlugin {
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
cliResponseAggregator.start();
|
||||
|
||||
panel.add(commandField, BorderLayout.SOUTH);
|
||||
setSize(500,500);
|
||||
}
|
||||
|
||||
public void closePlugin() {
|
||||
cliResponseAggregator.stop();
|
||||
}
|
||||
|
||||
public void addCLIData(final String text) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
String current = logArea.getText();
|
||||
int len = current.length();
|
||||
if (len > 4096) {
|
||||
current = current.substring(len - 4096);
|
||||
}
|
||||
current = len > 0 ? (current + '\n' + text) : text;
|
||||
logArea.setText(current);
|
||||
logArea.setCaretPosition(current.length());
|
||||
}
|
||||
});
|
||||
cliResponseAggregator.add(text);
|
||||
}
|
||||
|
||||
private static final int UPDATE_INTERVAL = 250;
|
||||
private UpdateAggregator<String> cliResponseAggregator = new UpdateAggregator<String>(UPDATE_INTERVAL) {
|
||||
protected void handle(List<String> ls) {
|
||||
String current = logArea.getText();
|
||||
int len = current.length();
|
||||
if (len > 4096) {
|
||||
current = current.substring(len - 4096);
|
||||
}
|
||||
|
||||
/* Add */
|
||||
StringBuilder sb = new StringBuilder(current);
|
||||
for (String l: ls) {
|
||||
sb.append(l);
|
||||
sb.append('\n');
|
||||
}
|
||||
logArea.setText(sb.toString());
|
||||
logArea.setCaretPosition(sb.length());
|
||||
}
|
||||
};
|
||||
|
||||
private String trim(String text) {
|
||||
return (text != null) && ((text = text.trim()).length() > 0) ? text : null;
|
||||
}
|
||||
|
|
|
@ -549,8 +549,9 @@ public class RadioLogger extends VisPlugin {
|
|||
|
||||
private boolean analyzePacket(PacketAnalyzer.Packet packet, StringBuffer brief, StringBuffer verbose) {
|
||||
if (analyzers == null) return false;
|
||||
boolean analyze = true;
|
||||
while (analyze) {
|
||||
try {
|
||||
boolean analyze = true;
|
||||
while (analyze) {
|
||||
analyze = false;
|
||||
for (int i = 0; i < analyzers.size(); i++) {
|
||||
PacketAnalyzer analyzer = analyzers.get(i);
|
||||
|
@ -570,6 +571,10 @@ public class RadioLogger extends VisPlugin {
|
|||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.debug("Error when analyzing packet: " + e.getMessage(), e);
|
||||
return false;
|
||||
}
|
||||
return brief.length() > 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -262,6 +262,7 @@ public class TimeLine extends VisPlugin {
|
|||
|
||||
getContentPane().add(splitPane);
|
||||
|
||||
recalculateMoteHeight();
|
||||
pack();
|
||||
setSize(gui.getDesktopPane().getWidth(), 150);
|
||||
setLocation(0, gui.getDesktopPane().getHeight() - 150);
|
||||
|
@ -1192,9 +1193,11 @@ public class TimeLine extends VisPlugin {
|
|||
if (showWatchpoints) {
|
||||
h += EVENT_PIXEL_HEIGHT;
|
||||
}
|
||||
paintedMoteHeight = h;
|
||||
timelineMoteRuler.repaint();
|
||||
timeline.repaint();
|
||||
if (h != paintedMoteHeight) {
|
||||
paintedMoteHeight = h;
|
||||
timelineMoteRuler.repaint();
|
||||
timeline.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
public void closePlugin() {
|
||||
|
@ -1346,6 +1349,7 @@ public class TimeLine extends VisPlugin {
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
private int mousePixelPositionX = -1;
|
||||
private int mousePixelPositionY = -1;
|
||||
private int mouseDownPixelPositionX = -1;
|
||||
|
|
Loading…
Reference in a new issue