Merge pull request #177 from adamdunkels/feature-config-improvements

Configurability updates
This commit is contained in:
Nicolas Tsiftes 2013-06-20 01:08:00 -07:00
commit 62292e17e7
5 changed files with 68 additions and 13 deletions

View file

@ -89,10 +89,11 @@ PROJECT_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(PROJECT_SOURCEFI
### Include application makefiles
ifdef APPS
APPDIRS += ${wildcard ${addprefix $(CONTIKI)/apps/, $(APPS)} \
${addprefix $(CONTIKI)/platform/$(TARGET)/apps/, $(APPS)} \
$(APPS)}
APPINCLUDES = ${foreach APP, $(APPS), ${wildcard ${foreach DIR, $(APPDIRS), $(DIR)/Makefile.$(APP)}}}
APPDS = ${wildcard ${foreach DIR, $(APPDIRS), ${addprefix $(DIR)/, $(APPS)}}} \
${wildcard ${addprefix $(CONTIKI)/apps/, $(APPS)} \
${addprefix $(CONTIKI)/platform/$(TARGET)/apps/, $(APPS)} \
$(APPS)}
APPINCLUDES = ${foreach APP, $(APPS), ${wildcard ${foreach DIR, $(APPDS), $(DIR)/Makefile.$(APP)}}}
-include $(APPINCLUDES)
APP_SOURCES = ${foreach APP, $(APPS), $($(APP)_src)}
DSC_SOURCES = ${foreach APP, $(APPS), $($(APP)_dsc)}
@ -116,6 +117,20 @@ else
include $(target_makefile)
endif
ifdef PLATFORMAPPS
PLATFORMAPPDS = ${wildcard ${foreach DIR, $(APPDIRS), ${addprefix $(DIR)/, $(PLATFORMAPPS)}}} \
${wildcard ${addprefix $(CONTIKI)/apps/, $(PLATFORMAPPS)} \
${addprefix $(CONTIKI)/platform/$(TARGET)/apps/, $(PLATFORMAPPS)} \
$(PLATFORMAPPS)}
PLATFORMAPPINCLUDES = ${foreach APP, $(PLATFORMAPPS), \
${wildcard ${foreach DIR, $(PLATFORMAPPDS), $(DIR)/Makefile.$(APP)}}}
-include $(PLATFORMAPPINCLUDES)
PLATFORMAPP_SOURCES = ${foreach APP, $(PLATFORMAPPS), $($(APP)_src)}
CONTIKI_SOURCEFILES += $(PLATFORMAPP_SOURCES)
APPDS += $(PLATFORMAPPDS)
endif
### Forward comma-separated list of arbitrary defines to the compiler
COMMA := ,
@ -129,7 +144,7 @@ CONTIKI_CPU_DIRS_CONCAT = ${addprefix $(CONTIKI_CPU)/, \
$(CONTIKI_CPU_DIRS)}
SOURCEDIRS = . $(PROJECTDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \
$(CONTIKI_CPU_DIRS_CONCAT) $(CONTIKIDIRS) $(APPDIRS) ${dir $(target_makefile)}
$(CONTIKI_CPU_DIRS_CONCAT) $(CONTIKIDIRS) $(APPDS) ${dir $(target_makefile)}
vpath %.c $(SOURCEDIRS)
vpath %.S $(SOURCEDIRS)

View file

@ -72,8 +72,8 @@ struct telnetd_state {
#define STATE_WONT 3
#define STATE_DO 4
#define STATE_DONT 5
#define STATE_CLOSE 6
struct timer silence_timer;
};
static struct telnetd_state s;
@ -101,6 +101,8 @@ static struct telnetd_buf buf;
static uint8_t connected;
#define MAX_SILENCE_TIME (CLOCK_SECOND * 30)
#define MIN(a, b) ((a) < (b)? (a): (b))
/*---------------------------------------------------------------------------*/
static void
@ -357,6 +359,7 @@ telnetd_appcall(void *ts)
s.state = STATE_NORMAL;
connected = 1;
shell_start();
timer_set(&s.silence_timer, MAX_SILENCE_TIME);
ts = (char *)0;
} else {
uip_send(telnetd_reject_text, strlen(telnetd_reject_text));
@ -378,9 +381,11 @@ telnetd_appcall(void *ts)
connected = 0;
}
if(uip_acked()) {
timer_set(&s.silence_timer, MAX_SILENCE_TIME);
acked();
}
if(uip_newdata()) {
timer_set(&s.silence_timer, MAX_SILENCE_TIME);
newdata();
}
if(uip_rexmit() ||
@ -389,15 +394,22 @@ telnetd_appcall(void *ts)
uip_connected() ||
uip_poll()) {
senddata();
if(s.numsent > 0) {
timer_set(&s.silence_timer, MAX_SILENCE_TIME);
}
}
} else {
if(uip_poll()) {
if(ts == (char *)10) {
if(timer_expired(&s.silence_timer)) {
uip_close();
} else {
tcp_markconn(uip_conn, (char *)ts + 1);
tcp_markconn(uip_conn, NULL);
}
}
}
}
/*---------------------------------------------------------------------------*/
void
telnetd_init(void)
{
process_start(&telnetd_process, NULL);
}
/*---------------------------------------------------------------------------*/

View file

@ -38,6 +38,8 @@
PROCESS_NAME(telnetd_process);
void telnetd_init(void);
void telnetd_gui_eventhandler(process_event_t ev, process_data_t data);
void telnetd_appcall(void *data);
void telnetd_gui_init(void);

View file

@ -55,9 +55,11 @@
#include <string.h>
/* TX/RX cycles are synchronized with neighbor wake periods */
#ifndef WITH_PHASE_OPTIMIZATION
#ifdef CONTIKIMAC_CONF_WITH_PHASE_OPTIMIZATION
#define WITH_PHASE_OPTIMIZATION CONTIKIMAC_CONF_WITH_PHASE_OPTIMIZATION
#else /* CONTIKIMAC_CONF_WITH_PHASE_OPTIMIZATION */
#define WITH_PHASE_OPTIMIZATION 1
#endif
#endif /* CONTIKIMAC_CONF_WITH_PHASE_OPTIMIZATION */
/* Two byte header added to allow recovery of padded short packets */
/* Wireshark will not understand such packets at present */
#ifdef CONTIKIMAC_CONF_WITH_CONTIKIMAC_HEADER
@ -117,7 +119,7 @@ struct hdr {
/* Are we currently receiving a burst? */
static int we_are_receiving_burst = 0;
/* BURST_RECV_TIME is the maximum time a receiver waits for the
/* INTER_PACKET_DEADLINE is the maximum time a receiver waits for the
next packet of a burst when FRAME_PENDING is set. */
#define INTER_PACKET_DEADLINE CLOCK_SECOND / 32
@ -125,15 +127,27 @@ static int we_are_receiving_burst = 0;
consists of two or more CCA checks. CCA_COUNT_MAX is the number of
CCAs to be done for each periodic channel check. The default is
two.*/
#ifdef CONTIKIMAC_CONF_CCA_COUNT_MAX
#define CCA_COUNT_MAX (CONTIKIMAC_CONF_CCA_COUNT_MAX)
#else
#define CCA_COUNT_MAX 2
#endif
/* Before starting a transmission, Contikimac checks the availability
of the channel with CCA_COUNT_MAX_TX consecutive CCAs */
#ifdef CONTIKIMAC_CONF_CCA_COUNT_MAX_TX
#define CCA_COUNT_MAX_TX (CONTIKIMAC_CONF_CCA_COUNT_MAX_TX)
#else
#define CCA_COUNT_MAX_TX 6
#endif
/* CCA_CHECK_TIME is the time it takes to perform a CCA check. */
/* Note this may be zero. AVRs have 7612 ticks/sec, but block until cca is done */
#ifdef CONTIKIMAC_CONF_CCA_CHECK_TIME
#define CCA_CHECK_TIME (CONTIKIMAC_CONF_CCA_CHECK_TIME)
#else
#define CCA_CHECK_TIME RTIMER_ARCH_SECOND / 8192
#endif
/* CCA_SLEEP_TIME is the time between two successive CCA checks. */
/* Add 1 when rtimer ticks are coarse */
@ -177,12 +191,20 @@ static int we_are_receiving_burst = 0;
#define GUARD_TIME 10 * CHECK_TIME + CHECK_TIME_TX
/* INTER_PACKET_INTERVAL is the interval between two successive packet transmissions */
#ifdef CONTIKIMAC_CONF_INTER_PACKET_INTERVAL
#define INTER_PACKET_INTERVAL CONTIKIMAC_CONF_INTER_PACKET_INTERVAL
#else
#define INTER_PACKET_INTERVAL RTIMER_ARCH_SECOND / 5000
#endif
/* AFTER_ACK_DETECTECT_WAIT_TIME is the time to wait after a potential
ACK packet has been detected until we can read it out from the
radio. */
#ifdef CONTIKIMAC_CONF_AFTER_ACK_DETECTECT_WAIT_TIME
#define AFTER_ACK_DETECTECT_WAIT_TIME CONTIKIMAC_CONF_AFTER_ACK_DETECTECT_WAIT_TIME
#else
#define AFTER_ACK_DETECTECT_WAIT_TIME RTIMER_ARCH_SECOND / 1500
#endif
/* MAX_PHASE_STROBE_TIME is the time that we transmit repeated packets
to a neighbor for which we have a phase lock. */

View file

@ -157,7 +157,11 @@ MEMB(send_queue_memb, struct packetqueue_item, MAX_SENDING_QUEUE);
queue, the system periodically sends a dummy packet to potential
parents, i.e., neighbors with a lower rtmetric than we have but for
which we do not yet have a link quality estimate. */
#ifdef COLLECT_CONF_PROACTIVE_PROBING_INTERVAL
#define PROACTIVE_PROBING_INTERVAL (random_rand() % (2 * COLLECT_CONF_PROACTIVE_PROBING_INTERVAL))
#else /* COLLECT_CONF_PROACTIVE_PROBING_INTERVAL */
#define PROACTIVE_PROBING_INTERVAL (random_rand() % CLOCK_SECOND * 60)
#endif /* COLLECT_CONF_PROACTIVE_PROBING_INTERVAL */
#define PROACTIVE_PROBING_REXMITS 15
/* The ANNOUNCEMENT_SCAN_TIME defines for how long the Collect