"Exterminate } else {"
This commit is contained in:
parent
6dea183eac
commit
2349d0806e
@ -837,7 +837,8 @@ static void download_main(int event)
|
|||||||
// if (chip->bootprog) {
|
// if (chip->bootprog) {
|
||||||
// state = BOOT_SOFT;
|
// state = BOOT_SOFT;
|
||||||
// break;
|
// break;
|
||||||
// } else {
|
// }
|
||||||
|
// else {
|
||||||
printf("Booting (hardware reset)...\r\n\r\n");
|
printf("Booting (hardware reset)...\r\n\r\n");
|
||||||
hard_reset_to_user_code();
|
hard_reset_to_user_code();
|
||||||
done_program(0);
|
done_program(0);
|
||||||
|
|||||||
@ -35,7 +35,8 @@ static uint8_t calc_umctl(uint16_t br) {
|
|||||||
if( a & 0x80 ) { // Overflow to integer?
|
if( a & 0x80 ) { // Overflow to integer?
|
||||||
a = a - 128 + CMOD; // Yes, subtract 1.000000
|
a = a - 128 + CMOD; // Yes, subtract 1.000000
|
||||||
c |= 0x80;
|
c |= 0x80;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
a += CMOD; // No, add fraction
|
a += CMOD; // No, add fraction
|
||||||
}
|
}
|
||||||
if( i == 7 ) {
|
if( i == 7 ) {
|
||||||
|
|||||||
@ -198,7 +198,8 @@ interrupt (PORT1_VECTOR) __attribute__ ((naked)) cc110x_isr(void){
|
|||||||
cc110x_gdo0_irq();
|
cc110x_gdo0_irq();
|
||||||
P1IE &= ~0x08; // Disable interrupt for GDO0
|
P1IE &= ~0x08; // Disable interrupt for GDO0
|
||||||
P1IFG &= ~0x08; // Clear IFG for GDO0
|
P1IFG &= ~0x08; // Clear IFG for GDO0
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
puts("cc110x_isr(): unexpected IFG!");
|
puts("cc110x_isr(): unexpected IFG!");
|
||||||
/* Should not occur - only GDO1 and GDO2 interrupts are enabled */
|
/* Should not occur - only GDO1 and GDO2 interrupts are enabled */
|
||||||
}
|
}
|
||||||
|
|||||||
@ -199,7 +199,8 @@ interrupt (PORT1_VECTOR) __attribute__ ((naked)) cc2420_isr(void){
|
|||||||
puts("[CC2420] rxfifo overflow");
|
puts("[CC2420] rxfifo overflow");
|
||||||
//P1IE &= ~CC2420_GDO0_PIN; // Disable interrupt for GDO0
|
//P1IE &= ~CC2420_GDO0_PIN; // Disable interrupt for GDO0
|
||||||
P1IFG &= ~CC2420_GDO0_PIN; // Clear IFG for GDO0
|
P1IFG &= ~CC2420_GDO0_PIN; // Clear IFG for GDO0
|
||||||
} else if ((P1IFG & CC2420_SFD_PIN) != 0) {
|
}
|
||||||
|
else if ((P1IFG & CC2420_SFD_PIN) != 0) {
|
||||||
puts("sfd interrupt");
|
puts("sfd interrupt");
|
||||||
P1IFG &= ~CC2420_SFD_PIN;
|
P1IFG &= ~CC2420_SFD_PIN;
|
||||||
cc2420_switch_to_rx();
|
cc2420_switch_to_rx();
|
||||||
|
|||||||
@ -819,7 +819,8 @@ const uint32_t AIMVAL[19] = {
|
|||||||
// uint32_t val = *(uint32_t*)(MRRF_BASE);
|
// uint32_t val = *(uint32_t*)(MRRF_BASE);
|
||||||
// if ( demod == MACA_DEMOD_NCD ) {
|
// if ( demod == MACA_DEMOD_NCD ) {
|
||||||
// val = (val & ~1);
|
// val = (val & ~1);
|
||||||
// } else {
|
// }
|
||||||
|
// else {
|
||||||
// val = (val | 1);
|
// val = (val | 1);
|
||||||
// }
|
// }
|
||||||
// *(uint32_t*)(MRRF_BASE) = val;
|
// *(uint32_t*)(MRRF_BASE) = val;
|
||||||
|
|||||||
@ -57,7 +57,6 @@ interrupt(TIMERA0_VECTOR) __attribute__((naked)) timer_isr_ccr0(void)
|
|||||||
__enter_isr();
|
__enter_isr();
|
||||||
timer_round += 1;
|
timer_round += 1;
|
||||||
__exit_isr();
|
__exit_isr();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interrupt(TIMERA1_VECTOR) __attribute__((naked)) timer_isr(void)
|
interrupt(TIMERA1_VECTOR) __attribute__((naked)) timer_isr(void)
|
||||||
@ -65,16 +64,13 @@ interrupt(TIMERA1_VECTOR) __attribute__((naked)) timer_isr(void)
|
|||||||
__enter_isr();
|
__enter_isr();
|
||||||
|
|
||||||
short taiv = TAIV;
|
short taiv = TAIV;
|
||||||
|
if (!(taiv & TAIV_TAIFG)) {
|
||||||
if (taiv & TAIV_TAIFG) {
|
short timer = taiv / 2;
|
||||||
} else {
|
if (overflow_interrupt[timer] == timer_round) {
|
||||||
|
|
||||||
short timer = (taiv/2);
|
|
||||||
if(overflow_interrupt[timer] == timer_round)
|
|
||||||
{
|
|
||||||
timer_unset(timer);
|
timer_unset(timer);
|
||||||
int_handler(timer);
|
int_handler(timer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
__exit_isr();
|
__exit_isr();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -176,7 +176,8 @@ char *make_message(const char *format, va_list argp)
|
|||||||
if ((temp = realloc(message, size)) == NULL) {
|
if ((temp = realloc(message, size)) == NULL) {
|
||||||
free(message);
|
free(message);
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
message = temp;
|
message = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,21 +50,22 @@ void cc2420_rx_handler(void)
|
|||||||
cc2420_rx_buffer[rx_buffer_next].length-2);
|
cc2420_rx_buffer[rx_buffer_next].length-2);
|
||||||
if(cc2420_rx_buffer[rx_buffer_next].frame.fcf.frame_type != 2) {
|
if(cc2420_rx_buffer[rx_buffer_next].frame.fcf.frame_type != 2) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
ieee802154_frame_print_fcf_frame(&cc2420_rx_buffer[rx_buffer_next].frame);
|
|
||||||
#endif
|
|
||||||
/* notify transceiver thread if any */
|
|
||||||
if (transceiver_pid) {
|
|
||||||
msg_t m;
|
|
||||||
m.type = (uint16_t) RCV_PKT_CC2420;
|
|
||||||
m.content.value = rx_buffer_next;
|
|
||||||
msg_send_int(&m, transceiver_pid);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
#ifdef DEBUG
|
|
||||||
DEBUG("GOT ACK for SEQ %u\n", cc2420_rx_buffer[rx_buffer_next].frame.seq_nr);
|
|
||||||
ieee802154_frame_print_fcf_frame(&cc2420_rx_buffer[rx_buffer_next].frame);
|
ieee802154_frame_print_fcf_frame(&cc2420_rx_buffer[rx_buffer_next].frame);
|
||||||
#endif
|
#endif
|
||||||
|
/* notify transceiver thread if any */
|
||||||
|
if (transceiver_pid) {
|
||||||
|
msg_t m;
|
||||||
|
m.type = (uint16_t) RCV_PKT_CC2420;
|
||||||
|
m.content.value = rx_buffer_next;
|
||||||
|
msg_send_int(&m, transceiver_pid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
#ifdef DEBUG
|
||||||
|
else {
|
||||||
|
DEBUG("GOT ACK for SEQ %u\n", cc2420_rx_buffer[rx_buffer_next].frame.seq_nr);
|
||||||
|
ieee802154_frame_print_fcf_frame(&cc2420_rx_buffer[rx_buffer_next].frame);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* shift to next buffer element */
|
/* shift to next buffer element */
|
||||||
if (++rx_buffer_next == CC2420_RX_BUF_SIZE) {
|
if (++rx_buffer_next == CC2420_RX_BUF_SIZE) {
|
||||||
|
|||||||
@ -31,14 +31,16 @@ int16_t cc2420_send(cc2420_packet_t *packet)
|
|||||||
packet->frame.fcf.frame_ver = 0;
|
packet->frame.fcf.frame_ver = 0;
|
||||||
if(packet->frame.src_pan_id == packet->frame.dest_pan_id) {
|
if(packet->frame.src_pan_id == packet->frame.dest_pan_id) {
|
||||||
packet->frame.fcf.panid_comp = 1;
|
packet->frame.fcf.panid_comp = 1;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
packet->frame.fcf.panid_comp = 0;
|
packet->frame.fcf.panid_comp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(packet->frame.fcf.src_addr_m == 2) {
|
if(packet->frame.fcf.src_addr_m == 2) {
|
||||||
packet->frame.src_addr[1] = (uint8_t)(cc2420_get_address() >> 8);
|
packet->frame.src_addr[1] = (uint8_t)(cc2420_get_address() >> 8);
|
||||||
packet->frame.src_addr[0] = (uint8_t)(cc2420_get_address() & 0xFF);
|
packet->frame.src_addr[0] = (uint8_t)(cc2420_get_address() & 0xFF);
|
||||||
} else if (packet->frame.fcf.src_addr_m == 3) {
|
}
|
||||||
|
else if (packet->frame.fcf.src_addr_m == 3) {
|
||||||
packet->frame.src_addr[7] = (uint8_t)(cc2420_get_address_long() >> 56);
|
packet->frame.src_addr[7] = (uint8_t)(cc2420_get_address_long() >> 56);
|
||||||
packet->frame.src_addr[6] = (uint8_t)(cc2420_get_address_long() >> 48);
|
packet->frame.src_addr[6] = (uint8_t)(cc2420_get_address_long() >> 48);
|
||||||
packet->frame.src_addr[5] = (uint8_t)(cc2420_get_address_long() >> 40);
|
packet->frame.src_addr[5] = (uint8_t)(cc2420_get_address_long() >> 40);
|
||||||
|
|||||||
@ -333,7 +333,8 @@ int ccnl_io_loop(struct ccnl_relay_s *ccnl)
|
|||||||
hwtimer_id = hwtimer_set(HWTIMER_TICKS(us), ccnl_timeout_callback, ccnl);
|
hwtimer_id = hwtimer_set(HWTIMER_TICKS(us), ccnl_timeout_callback, ccnl);
|
||||||
if (hwtimer_id == -1) {
|
if (hwtimer_id == -1) {
|
||||||
puts("NO MORE TIMERS!");
|
puts("NO MORE TIMERS!");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
//DEBUGMSG(1, "hwtimer_id is %d\n", hwtimer_id);
|
//DEBUGMSG(1, "hwtimer_id is %d\n", hwtimer_id);
|
||||||
}
|
}
|
||||||
msg_receive(&in);
|
msg_receive(&in);
|
||||||
|
|||||||
@ -947,7 +947,8 @@ ccnl_content_add2cache(struct ccnl_relay_s *ccnl, struct ccnl_content_s *c)
|
|||||||
if (oldest) {
|
if (oldest) {
|
||||||
DEBUGMSG(1, " replaced: '%s'\n", ccnl_prefix_to_path(oldest->name));
|
DEBUGMSG(1, " replaced: '%s'\n", ccnl_prefix_to_path(oldest->name));
|
||||||
ccnl_content_remove(ccnl, oldest);
|
ccnl_content_remove(ccnl, oldest);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
DEBUGMSG(1, " no dynamic content to remove...\n");
|
DEBUGMSG(1, " no dynamic content to remove...\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1062,7 +1063,8 @@ void ccnl_content_learn_name_route(struct ccnl_relay_s *ccnl, struct ccnl_prefix
|
|||||||
fwd = ccnl_forward_new(p, f, threshold_prefix, flags);
|
fwd = ccnl_forward_new(p, f, threshold_prefix, flags);
|
||||||
DBL_LINKED_LIST_ADD(ccnl->fib, fwd);
|
DBL_LINKED_LIST_ADD(ccnl->fib, fwd);
|
||||||
DEBUGMSG(999, "ccnl_content_learn_name_route: new route '%s' on face %d learned\n", ccnl_prefix_to_path(fwd->prefix), f->faceid);
|
DEBUGMSG(999, "ccnl_content_learn_name_route: new route '%s' on face %d learned\n", ccnl_prefix_to_path(fwd->prefix), f->faceid);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* there was a prefix match with the user defined creteria. */
|
/* there was a prefix match with the user defined creteria. */
|
||||||
|
|
||||||
/* if the new entry has shorter prefix */
|
/* if the new entry has shorter prefix */
|
||||||
@ -1074,7 +1076,8 @@ void ccnl_content_learn_name_route(struct ccnl_relay_s *ccnl, struct ccnl_prefix
|
|||||||
fwd = ccnl_forward_new(p, f, (p->compcnt - match_len), flags);
|
fwd = ccnl_forward_new(p, f, (p->compcnt - match_len), flags);
|
||||||
DBL_LINKED_LIST_ADD(ccnl->fib, fwd);
|
DBL_LINKED_LIST_ADD(ccnl->fib, fwd);
|
||||||
DEBUGMSG(999, "ccnl_content_learn_name_route: route '%s' on face %d replaced\n", ccnl_prefix_to_path(fwd->prefix), f->faceid);
|
DEBUGMSG(999, "ccnl_content_learn_name_route: route '%s' on face %d replaced\n", ccnl_prefix_to_path(fwd->prefix), f->faceid);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* we don't need to do an update, because we know a shorter prefix already */
|
/* we don't need to do an update, because we know a shorter prefix already */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1161,7 +1164,8 @@ void ccnl_do_ageing(void *ptr, void *dummy)
|
|||||||
riot_send_nack(i->from->faceid);
|
riot_send_nack(i->from->faceid);
|
||||||
}
|
}
|
||||||
i = ccnl_interest_remove(relay, i);
|
i = ccnl_interest_remove(relay, i);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
i = i->next;
|
i = i->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1191,7 +1195,8 @@ void ccnl_do_ageing(void *ptr, void *dummy)
|
|||||||
if (!(fwd->flags & CCNL_FORWARD_FLAGS_STATIC)
|
if (!(fwd->flags & CCNL_FORWARD_FLAGS_STATIC)
|
||||||
&& ccnl_is_timeouted(&now, &fwd->last_used, CCNL_FWD_TIMEOUT_SEC, CCNL_FWD_TIMEOUT_USEC)) {
|
&& ccnl_is_timeouted(&now, &fwd->last_used, CCNL_FWD_TIMEOUT_SEC, CCNL_FWD_TIMEOUT_USEC)) {
|
||||||
fwd = ccnl_forward_remove(relay, fwd);
|
fwd = ccnl_forward_remove(relay, fwd);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
fwd = fwd->next;
|
fwd = fwd->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1340,12 +1345,13 @@ int ccnl_core_RX_i_or_c(struct ccnl_relay_s *relay, struct ccnl_face_s *from,
|
|||||||
DEBUGMSG(7, " removed because no matching interest\n");
|
DEBUGMSG(7, " removed because no matching interest\n");
|
||||||
free_content(c);
|
free_content(c);
|
||||||
goto Skip;
|
goto Skip;
|
||||||
} else {
|
}
|
||||||
#if CCNL_DYNAMIC_FIB
|
#if CCNL_DYNAMIC_FIB
|
||||||
|
else {
|
||||||
/* content has matched an interest, we consider this name as available on this face */
|
/* content has matched an interest, we consider this name as available on this face */
|
||||||
ccnl_content_learn_name_route(relay, c->name, from, relay->fib_threshold_prefix, 0);
|
ccnl_content_learn_name_route(relay, c->name, from, relay->fib_threshold_prefix, 0);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (relay->max_cache_entries != 0) { // it's set to -1 or a limit
|
if (relay->max_cache_entries != 0) { // it's set to -1 or a limit
|
||||||
DEBUGMSG(7, " adding content to cache\n");
|
DEBUGMSG(7, " adding content to cache\n");
|
||||||
|
|||||||
@ -551,10 +551,12 @@ static int ccnl_mgmt_handle(struct ccnl_relay_s *ccnl, struct ccnl_buf_s *orig,
|
|||||||
if (!strcmp(cmd, "newface")) {
|
if (!strcmp(cmd, "newface")) {
|
||||||
DEBUGMSG(1, "ccnl_mgmt_newface msg\n");
|
DEBUGMSG(1, "ccnl_mgmt_newface msg\n");
|
||||||
ccnl_mgmt_newface(ccnl, orig, prefix, from);
|
ccnl_mgmt_newface(ccnl, orig, prefix, from);
|
||||||
} else if (!strcmp(cmd, "prefixreg")) {
|
}
|
||||||
|
else if (!strcmp(cmd, "prefixreg")) {
|
||||||
DEBUGMSG(1, "ccnl_mgmt_prefixreg msg\n");
|
DEBUGMSG(1, "ccnl_mgmt_prefixreg msg\n");
|
||||||
ccnl_mgmt_prefixreg(ccnl, orig, prefix, from);
|
ccnl_mgmt_prefixreg(ccnl, orig, prefix, from);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
DEBUGMSG(99, "unknown mgmt command %s\n", cmd);
|
DEBUGMSG(99, "unknown mgmt command %s\n", cmd);
|
||||||
|
|
||||||
ccnl_mgmt_return_msg(ccnl, orig, from, "unknown mgmt command");
|
ccnl_mgmt_return_msg(ccnl, orig, from, "unknown mgmt command");
|
||||||
@ -571,14 +573,16 @@ int ccnl_mgmt(struct ccnl_relay_s *ccnl, struct ccnl_buf_s *orig,
|
|||||||
if (prefix->complen[2] < (int) sizeof(cmd)) {
|
if (prefix->complen[2] < (int) sizeof(cmd)) {
|
||||||
memcpy(cmd, prefix->comp[2], prefix->complen[2]);
|
memcpy(cmd, prefix->comp[2], prefix->complen[2]);
|
||||||
cmd[prefix->complen[2]] = '\0';
|
cmd[prefix->complen[2]] = '\0';
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
strcpy(cmd, "cmd-is-too-long-to-display");
|
strcpy(cmd, "cmd-is-too-long-to-display");
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUGMSG(99, "ccnl_mgmt request \"%s\"\n", cmd);
|
DEBUGMSG(99, "ccnl_mgmt request \"%s\"\n", cmd);
|
||||||
|
|
||||||
if (ccnl_is_local_addr(from))
|
if (ccnl_is_local_addr(from)) {
|
||||||
goto MGMT;
|
goto MGMT;
|
||||||
|
}
|
||||||
|
|
||||||
DEBUGMSG(99, " rejecting because src is not a local addr\n");
|
DEBUGMSG(99, " rejecting because src is not a local addr\n");
|
||||||
ccnl_mgmt_return_msg(ccnl, orig, from,
|
ccnl_mgmt_return_msg(ccnl, orig, from,
|
||||||
|
|||||||
@ -100,7 +100,8 @@ int sem_wait(sem_t *sem)
|
|||||||
if (value == 0) {
|
if (value == 0) {
|
||||||
sem_thread_blocked(sem);
|
sem_thread_blocked(sem);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
sem->value = value - 1;
|
sem->value = value - 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -124,7 +125,8 @@ int sem_trywait(sem_t *sem)
|
|||||||
unsigned value = sem->value;
|
unsigned value = sem->value;
|
||||||
if (value == 0) {
|
if (value == 0) {
|
||||||
result = -1;
|
result = -1;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
result = 0;
|
result = 0;
|
||||||
sem->value = value - 1;
|
sem->value = value - 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,8 @@ void _mersenne_init(char *str)
|
|||||||
if (!toc_str) {
|
if (!toc_str) {
|
||||||
initval = hwtimer_now();
|
initval = hwtimer_now();
|
||||||
printf("PRNG inizialized to current time: %d\n", initval);
|
printf("PRNG inizialized to current time: %d\n", initval);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
initval = atoi(toc_str);
|
initval = atoi(toc_str);
|
||||||
printf("PRNG inizialized given value: %d\n", initval);
|
printf("PRNG inizialized given value: %d\n", initval);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -370,7 +370,8 @@ int vtimer_msg_receive_timeout(msg_t *m, timex_t timeout) {
|
|||||||
if (m->type == MSG_TIMER && m->content.ptr == (char *) &timeout_message) {
|
if (m->type == MSG_TIMER && m->content.ptr == (char *) &timeout_message) {
|
||||||
/* we hit the timeout */
|
/* we hit the timeout */
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
vtimer_remove(&t);
|
vtimer_remove(&t);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user