Merge pull request #718 from Kijewski/issue-693

"Exterminate `} else {`"
dev/timer
Christian Mehlis 10 years ago
commit 6578669e46

@ -837,7 +837,8 @@ static void download_main(int event)
// if (chip->bootprog) {
// state = BOOT_SOFT;
// break;
// } else {
// }
// else {
printf("Booting (hardware reset)...\r\n\r\n");
hard_reset_to_user_code();
done_program(0);

@ -35,7 +35,8 @@ static uint8_t calc_umctl(uint16_t br) {
if( a & 0x80 ) { // Overflow to integer?
a = a - 128 + CMOD; // Yes, subtract 1.000000
c |= 0x80;
} else {
}
else {
a += CMOD; // No, add fraction
}
if( i == 7 ) {

@ -198,7 +198,8 @@ interrupt (PORT1_VECTOR) __attribute__ ((naked)) cc110x_isr(void){
cc110x_gdo0_irq();
P1IE &= ~0x08; // Disable interrupt for GDO0
P1IFG &= ~0x08; // Clear IFG for GDO0
} else {
}
else {
puts("cc110x_isr(): unexpected IFG!");
/* 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");
//P1IE &= ~CC2420_GDO0_PIN; // Disable interrupt 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");
P1IFG &= ~CC2420_SFD_PIN;
cc2420_switch_to_rx();

@ -819,7 +819,8 @@ const uint32_t AIMVAL[19] = {
// uint32_t val = *(uint32_t*)(MRRF_BASE);
// if ( demod == MACA_DEMOD_NCD ) {
// val = (val & ~1);
// } else {
// }
// else {
// val = (val | 1);
// }
// *(uint32_t*)(MRRF_BASE) = val;

@ -57,7 +57,6 @@ interrupt(TIMERA0_VECTOR) __attribute__((naked)) timer_isr_ccr0(void)
__enter_isr();
timer_round += 1;
__exit_isr();
}
interrupt(TIMERA1_VECTOR) __attribute__((naked)) timer_isr(void)
@ -65,16 +64,13 @@ interrupt(TIMERA1_VECTOR) __attribute__((naked)) timer_isr(void)
__enter_isr();
short taiv = TAIV;
if (taiv & TAIV_TAIFG) {
} else {
short timer = (taiv/2);
if(overflow_interrupt[timer] == timer_round)
{
if (!(taiv & TAIV_TAIFG)) {
short timer = taiv / 2;
if (overflow_interrupt[timer] == timer_round) {
timer_unset(timer);
int_handler(timer);
}
}
__exit_isr();
}

@ -176,7 +176,8 @@ char *make_message(const char *format, va_list argp)
if ((temp = realloc(message, size)) == NULL) {
free(message);
return NULL;
} else {
}
else {
message = temp;
}
}

@ -50,21 +50,22 @@ void cc2420_rx_handler(void)
cc2420_rx_buffer[rx_buffer_next].length-2);
if(cc2420_rx_buffer[rx_buffer_next].frame.fcf.frame_type != 2) {
#ifdef DEBUG
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
/* 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);
/* 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
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
}
#endif
/* shift to next buffer element */
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;
if(packet->frame.src_pan_id == packet->frame.dest_pan_id) {
packet->frame.fcf.panid_comp = 1;
} else {
}
else {
packet->frame.fcf.panid_comp = 0;
}
if(packet->frame.fcf.src_addr_m == 2) {
packet->frame.src_addr[1] = (uint8_t)(cc2420_get_address() >> 8);
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[6] = (uint8_t)(cc2420_get_address_long() >> 48);
packet->frame.src_addr[5] = (uint8_t)(cc2420_get_address_long() >> 40);

@ -337,7 +337,8 @@ int ccnl_io_loop(struct ccnl_relay_s *ccnl)
hwtimer_id = hwtimer_set(HWTIMER_TICKS(us), ccnl_timeout_callback, ccnl);
if (hwtimer_id == -1) {
puts("NO MORE TIMERS!");
} else {
}
else {
//DEBUGMSG(1, "hwtimer_id is %d\n", hwtimer_id);
}
msg_receive(&in);

@ -947,7 +947,8 @@ ccnl_content_add2cache(struct ccnl_relay_s *ccnl, struct ccnl_content_s *c)
if (oldest) {
DEBUGMSG(1, " replaced: '%s'\n", ccnl_prefix_to_path(oldest->name));
ccnl_content_remove(ccnl, oldest);
} else {
}
else {
DEBUGMSG(1, " no dynamic content to remove...\n");
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);
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);
} else {
}
else {
/* there was a prefix match with the user defined creteria. */
/* 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);
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);
} else {
}
else {
/* 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);
}
i = ccnl_interest_remove(relay, i);
} else {
}
else {
i = i->next;
}
}
@ -1191,7 +1195,8 @@ void ccnl_do_ageing(void *ptr, void *dummy)
if (!(fwd->flags & CCNL_FORWARD_FLAGS_STATIC)
&& ccnl_is_timeouted(&now, &fwd->last_used, CCNL_FWD_TIMEOUT_SEC, CCNL_FWD_TIMEOUT_USEC)) {
fwd = ccnl_forward_remove(relay, fwd);
} else {
}
else {
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");
free_content(c);
goto Skip;
} else {
}
#if CCNL_DYNAMIC_FIB
else {
/* 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);
#endif
}
#endif
if (relay->max_cache_entries != 0) { // it's set to -1 or a limit
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")) {
DEBUGMSG(1, "ccnl_mgmt_newface msg\n");
ccnl_mgmt_newface(ccnl, orig, prefix, from);
} else if (!strcmp(cmd, "prefixreg")) {
}
else if (!strcmp(cmd, "prefixreg")) {
DEBUGMSG(1, "ccnl_mgmt_prefixreg msg\n");
ccnl_mgmt_prefixreg(ccnl, orig, prefix, from);
} else {
}
else {
DEBUGMSG(99, "unknown mgmt command %s\n", cmd);
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)) {
memcpy(cmd, prefix->comp[2], prefix->complen[2]);
cmd[prefix->complen[2]] = '\0';
} else {
}
else {
strcpy(cmd, "cmd-is-too-long-to-display");
}
DEBUGMSG(99, "ccnl_mgmt request \"%s\"\n", cmd);
if (ccnl_is_local_addr(from))
if (ccnl_is_local_addr(from)) {
goto MGMT;
}
DEBUGMSG(99, " rejecting because src is not a local addr\n");
ccnl_mgmt_return_msg(ccnl, orig, from,

@ -100,7 +100,8 @@ int sem_wait(sem_t *sem)
if (value == 0) {
sem_thread_blocked(sem);
continue;
} else {
}
else {
sem->value = value - 1;
break;
}
@ -124,7 +125,8 @@ int sem_trywait(sem_t *sem)
unsigned value = sem->value;
if (value == 0) {
result = -1;
} else {
}
else {
result = 0;
sem->value = value - 1;
}

@ -32,7 +32,8 @@ void _mersenne_init(char *str)
if (!toc_str) {
initval = hwtimer_now();
printf("PRNG inizialized to current time: %d\n", initval);
} else {
}
else {
initval = atoi(toc_str);
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) {
/* we hit the timeout */
return -1;
} else {
}
else {
vtimer_remove(&t);
return 1;
}

Loading…
Cancel
Save