Merge branch 'master' into wsn430
This commit is contained in:
commit
fdd1d21e8d
@ -11,15 +11,15 @@ include $(RIOTCPU)/Makefile.base
|
||||
include $(RIOTBOARD)/Makefile.base
|
||||
|
||||
$(BINDIR)$(MODULE).a: $(OBJ) $(ASMOBJ)
|
||||
$(AR) -rc $(BINDIR)$(MODULE).a $(OBJ) $(ASMOBJ)
|
||||
@$(AR) -rc $(BINDIR)$(MODULE).a $(OBJ) $(ASMOBJ)
|
||||
|
||||
# pull in dependency info for *existing* .o files
|
||||
-include $(OBJ:.o=.d)
|
||||
|
||||
# compile and generate dependency info
|
||||
$(BINDIR)%.o: %.c
|
||||
$(CC) $(CFLAGS) $(PROJECTINCLUDE) $(BOARDINCLUDE) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
|
||||
$(CC) $(CFLAGS) $(PROJECTINCLUDE) $(BOARDINCLUDE) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
|
||||
@$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
|
||||
@$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
|
||||
@printf "$(BINDIR)"|cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
|
||||
|
||||
$(BINDIR)%.o: %.s
|
||||
@ -30,5 +30,5 @@ $(BINDIR)%.o: %.S
|
||||
|
||||
# remove compilation products
|
||||
clean::
|
||||
rm -f $(BINDIR)$(MODULE).a $(OBJ) $(DEP) $(ASMOBJ)
|
||||
@rm -f $(BINDIR)$(MODULE).a $(OBJ) $(DEP) $(ASMOBJ)
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ ${PROJBINDIR}/$(PROJECT).a: $(OBJ)
|
||||
|
||||
${PROJBINDIR}/%.o: %.c
|
||||
@echo; echo "Compiling.... $*.c"; echo
|
||||
$(CC) $(CFLAGS) $(BOARDINCLUDE) $(INCLUDES) -c $*.c -o bin/$*.o
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o bin/$*.o
|
||||
|
||||
clean:
|
||||
$(MAKE) -C $(RIOTBOARD) clean
|
||||
|
||||
@ -16,6 +16,9 @@
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifndef DEBUG_H_
|
||||
#define DEBUG_H_
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef ENABLE_DEBUG
|
||||
@ -23,3 +26,5 @@
|
||||
#else
|
||||
#define DEBUG(...)
|
||||
#endif
|
||||
|
||||
#endif /* DEGUG_H_ */
|
||||
|
||||
@ -37,7 +37,7 @@ volatile tcb_t *sched_threads[MAXTHREADS];
|
||||
volatile tcb_t *active_thread;
|
||||
volatile int lpm_prevent_sleep = 0;
|
||||
|
||||
extern void main(void);
|
||||
extern int main(void);
|
||||
|
||||
static void idle_thread(void) {
|
||||
while(1) {
|
||||
@ -61,7 +61,7 @@ static char idle_stack[KERNEL_CONF_STACKSIZE_IDLE];
|
||||
#ifdef MODULE_AUTO_INIT
|
||||
#define MAIN_FUNC auto_init
|
||||
#else
|
||||
#define MAIN_FUNC main
|
||||
#define MAIN_FUNC ((void (*) (void)) main)
|
||||
#endif
|
||||
|
||||
void kernel_init(void)
|
||||
|
||||
@ -96,7 +96,10 @@ void sched_run() {
|
||||
|
||||
if (num_tasks == 0) {
|
||||
DEBUG("scheduler: no tasks left.\n");
|
||||
while(! num_tasks);
|
||||
while(! num_tasks) {
|
||||
/* loop until a new task arrives */
|
||||
;
|
||||
}
|
||||
DEBUG("scheduler: new task created.\n");
|
||||
}
|
||||
|
||||
|
||||
@ -19,8 +19,8 @@ endif
|
||||
|
||||
# compile and generate dependency info
|
||||
../bin/%.o: %.c
|
||||
$(CC) $(CFLAGS) $(INCLUDES) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -c $*.c -o ../bin/$*.o
|
||||
$(CC) $(CFLAGS) $(INCLUDES) $(BOARDINCLUDE) $(PROJECTINCLUDE) $(CPUINCLUDE) -MM $*.c > ../bin/$*.d
|
||||
$(CC) $(CFLAGS) $(INCLUDES) $(CPUINCLUDE) -c $*.c -o ../bin/$*.o
|
||||
$(CC) $(CFLAGS) $(INCLUDES) $(CPUINCLUDE) -MM $*.c > ../bin/$*.d
|
||||
@printf "../bin/"|cat - ../bin/$*.d > /tmp/fw_out && mv /tmp/fw_out ../bin/$*.d
|
||||
|
||||
# remove compilation products
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
#include <sys/select.h>
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#include <err.h>
|
||||
|
||||
#include "lpm.h"
|
||||
#include "debug.h"
|
||||
@ -46,13 +47,15 @@ void _native_lpm_sleep()
|
||||
retval = select(1, &_native_uart_rfds, NULL, NULL, NULL);
|
||||
DEBUG("_native_lpm_sleep: retval: %i\n", retval);
|
||||
if (retval != -1) {
|
||||
DEBUG("\n\n\t\treturn from syscall, calling _native_handle_uart0_input\n\n");
|
||||
makecontext(_native_isr_ctx, _native_handle_uart0_input, 0);
|
||||
swapcontext(_native_cur_ctx, _native_isr_ctx);
|
||||
/* uart ready, handle input */
|
||||
/* TODO: switch to ISR context */
|
||||
_native_handle_uart0_input();
|
||||
}
|
||||
else if (errno != EINTR) {
|
||||
/* select failed for reason other than signal */
|
||||
err(1, "lpm_set(): select()");
|
||||
}
|
||||
/* otherwise select was interrupted because of a signal, continue below */
|
||||
#else
|
||||
pause();
|
||||
#endif
|
||||
|
||||
@ -102,22 +102,26 @@ int cc1100_send_csmaca(radio_address_t address, protocol_t protocol, int priorit
|
||||
|
||||
// Calculate collisions per second
|
||||
if (collision_state == COLLISION_STATE_INITIAL) {
|
||||
timex_t now = vtimer_now();
|
||||
timex_t now;
|
||||
vtimer_now(&now);
|
||||
collision_measurement_start = now.microseconds;
|
||||
collision_count = 0;
|
||||
collisions_per_sec = 0;
|
||||
collision_state = COLLISION_STATE_MEASURE;
|
||||
} else if (collision_state == COLLISION_STATE_MEASURE) {
|
||||
timex_t now = vtimer_now();
|
||||
timex_t now;
|
||||
vtimer_now(&now);
|
||||
uint64_t timespan = now.microseconds - collision_measurement_start;
|
||||
if (timespan > 1000000) {
|
||||
collisions_per_sec = (collision_count * 1000000) / (double) timespan;
|
||||
if (collisions_per_sec > 0.5 && collisions_per_sec <= 2.2) {
|
||||
timex_t now = vtimer_now();
|
||||
timex_t now;
|
||||
vtimer_now(&now);
|
||||
collision_measurement_start = now.microseconds;
|
||||
collision_state = COLLISION_STATE_KEEP;
|
||||
} else if (collisions_per_sec > 2.2) {
|
||||
timex_t now = vtimer_now();
|
||||
timex_t now;
|
||||
vtimer_now(&now);
|
||||
collision_measurement_start = now.microseconds;
|
||||
collision_state = COLLISION_STATE_KEEP;
|
||||
} else {
|
||||
@ -125,7 +129,8 @@ int cc1100_send_csmaca(radio_address_t address, protocol_t protocol, int priorit
|
||||
}
|
||||
}
|
||||
} else if (collision_state == COLLISION_STATE_KEEP) {
|
||||
timex_t now = vtimer_now();
|
||||
timex_t now;
|
||||
vtimer_now(&now);
|
||||
uint64_t timespan = now.microseconds - collision_measurement_start;
|
||||
if (timespan > 5000000) {
|
||||
collision_state = COLLISION_STATE_INITIAL;
|
||||
|
||||
@ -375,7 +375,8 @@ static bool contains_seq_entry(uint8_t src, uint8_t id)
|
||||
{
|
||||
int i;
|
||||
uint32_t cmp;
|
||||
timex_t now_timex = vtimer_now();
|
||||
timex_t now_timex;
|
||||
vtimer_now(&now_timex);
|
||||
uint64_t now = now_timex.microseconds;
|
||||
|
||||
for (i = 0; i < MAX_SEQ_BUFFER_SIZE; i++)
|
||||
@ -414,7 +415,8 @@ static void add_seq_entry(uint8_t src, uint8_t id)
|
||||
// Add new entry
|
||||
seq_buffer[seq_buffer_pos].source = src;
|
||||
seq_buffer[seq_buffer_pos].identification = id;
|
||||
timex_t now = vtimer_now();
|
||||
timex_t now;
|
||||
vtimer_now(&now);
|
||||
seq_buffer[seq_buffer_pos].m_ticks = now.microseconds;
|
||||
|
||||
// Store 16 bit sequence number of layer 0 for speedup
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
#define ENABLE_DEBUG
|
||||
#include <debug.h>
|
||||
|
||||
extern void main(void);
|
||||
extern int main(void);
|
||||
|
||||
void auto_init(void) {
|
||||
#ifdef MODULE_BOARD_DISPLAY
|
||||
|
||||
@ -24,6 +24,19 @@
|
||||
* of two */
|
||||
#define TRANSCEIVER_MSG_BUFFER_SIZE (32)
|
||||
|
||||
/**
|
||||
* @brief All supported transceivers
|
||||
*/
|
||||
#define TRANSCEIVER_NONE (0x0) ///< Invalid
|
||||
#define TRANSCEIVER_CC1100 (0x01) ///< CC110X transceivers
|
||||
#define TRANSCEIVER_CC1020 (0x02) ///< CC1020 transceivers
|
||||
#define TRANSCEIVER_CC2420 (0x04) ///< CC2420 transceivers
|
||||
|
||||
/**
|
||||
* @brief Data type for transceiver specification
|
||||
*/
|
||||
typedef uint16_t transceiver_type_t;
|
||||
|
||||
/**
|
||||
* @brief Message types for transceiver interface
|
||||
*/
|
||||
@ -54,16 +67,6 @@ enum transceiver_msg_type_t {
|
||||
ENOBUFFER, ///< No buffer left
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief All supported transceivers
|
||||
*/
|
||||
typedef enum {
|
||||
TRANSCEIVER_NONE, ///< Invalid
|
||||
TRANSCEIVER_CC1100, ///< CC110X transceivers
|
||||
TRANSCEIVER_CC1020, ///< CC1020 transceivers
|
||||
TRANSCEIVER_CC2420 ///< CC2420 transceivers
|
||||
} transceiver_type_t;
|
||||
|
||||
/**
|
||||
* @brief Manage registered threads per transceiver
|
||||
*/
|
||||
|
||||
@ -43,7 +43,7 @@ typedef struct vtimer_t {
|
||||
* @brief Current system time
|
||||
* @return Time as timex_t since system boot
|
||||
*/
|
||||
timex_t vtimer_now(void);
|
||||
void vtimer_now(timex_t* out);
|
||||
|
||||
/**
|
||||
* @brief Initializes the vtimer subsystem. To be called once at system initialization. Will be initialized by auto_init.
|
||||
|
||||
@ -27,7 +27,9 @@ void init_transport_layer(void)
|
||||
set_udp_packet_handler_pid(udp_thread_pid);
|
||||
|
||||
// TCP
|
||||
srand(vtimer_now().microseconds);
|
||||
timex_t now;
|
||||
vtimer_now(&now);
|
||||
srand(now.microseconds);
|
||||
#ifdef TCP_HC
|
||||
printf("TCP_HC enabled!\n");
|
||||
global_context_counter = rand();
|
||||
|
||||
@ -74,9 +74,11 @@ void print_tcp_flags (tcp_hdr_t *tcp_header)
|
||||
|
||||
void print_tcp_cb(tcp_cb_t *cb)
|
||||
{
|
||||
timex_t now;
|
||||
vtimer_now(&now);
|
||||
printf("Send_ISS: %lu\nSend_UNA: %lu\nSend_NXT: %lu\nSend_WND: %u\n", cb->send_iss, cb->send_una, cb->send_nxt, cb->send_wnd);
|
||||
printf("Rcv_IRS: %lu\nRcv_NXT: %lu\nRcv_WND: %u\n", cb->rcv_irs, cb->rcv_nxt, cb->rcv_wnd);
|
||||
printf("Time difference: %lu, No_of_retries: %u, State: %u\n\n", timex_sub(vtimer_now(), cb->last_packet_time).microseconds, cb->no_of_retries, cb->state);
|
||||
printf("Time difference: %lu, No_of_retries: %u, State: %u\n\n", timex_sub(now, cb->last_packet_time).microseconds, cb->no_of_retries, cb->state);
|
||||
}
|
||||
|
||||
void print_tcp_status(int in_or_out, ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, socket_t *tcp_socket)
|
||||
@ -497,7 +499,9 @@ int connect(int socket, sockaddr6_t *addr, uint32_t addrlen)
|
||||
set_tcp_cb(¤t_tcp_socket->tcp_control, 0, STATIC_WINDOW, current_tcp_socket->tcp_control.send_iss, current_tcp_socket->tcp_control.send_iss, 0);
|
||||
|
||||
// Remember current time
|
||||
current_tcp_socket->tcp_control.last_packet_time = vtimer_now();
|
||||
timex_t now;
|
||||
vtimer_now(&now);
|
||||
current_tcp_socket->tcp_control.last_packet_time = now;
|
||||
current_tcp_socket->tcp_control.no_of_retries = 0;
|
||||
|
||||
msg_from_server.type = TCP_RETRY;
|
||||
@ -554,7 +558,9 @@ int connect(int socket, sockaddr6_t *addr, uint32_t addrlen)
|
||||
msg_from_server.type = UNDEFINED;
|
||||
|
||||
// Remember current time
|
||||
current_tcp_socket->tcp_control.last_packet_time = vtimer_now();
|
||||
timex_t now;
|
||||
vtimer_now(&now)
|
||||
current_tcp_socket->tcp_control.last_packet_time = now;
|
||||
current_tcp_socket->tcp_control.no_of_retries = 0;
|
||||
|
||||
#ifdef TCP_HC
|
||||
@ -1113,7 +1119,9 @@ int handle_new_tcp_connection(socket_internal_t *current_queued_int_socket, sock
|
||||
&server_socket->socket_values.tcp_control.tcp_context.context_id, sizeof(server_socket->socket_values.tcp_control.tcp_context.context_id));
|
||||
#endif
|
||||
// Remember current time
|
||||
current_queued_int_socket->socket_values.tcp_control.last_packet_time = vtimer_now();
|
||||
timex_t now;
|
||||
vtimer_now(&now);
|
||||
current_queued_int_socket->socket_values.tcp_control.last_packet_time = now;
|
||||
|
||||
current_queued_int_socket->socket_values.tcp_control.no_of_retries = 0;
|
||||
|
||||
|
||||
@ -23,8 +23,10 @@ void handle_synchro_timeout(socket_internal_t *current_socket)
|
||||
msg_t send;
|
||||
if (thread_getstatus(current_socket->recv_pid) == STATUS_RECEIVE_BLOCKED)
|
||||
{
|
||||
timex_t now;
|
||||
vtimer_now(&now);
|
||||
if ((current_socket->socket_values.tcp_control.no_of_retries == 0) &&
|
||||
(timex_sub(vtimer_now(), current_socket->socket_values.tcp_control.last_packet_time).microseconds >
|
||||
(timex_sub(now, current_socket->socket_values.tcp_control.last_packet_time).microseconds >
|
||||
TCP_SYN_INITIAL_TIMEOUT))
|
||||
{
|
||||
current_socket->socket_values.tcp_control.no_of_retries++;
|
||||
@ -32,7 +34,7 @@ void handle_synchro_timeout(socket_internal_t *current_socket)
|
||||
// printf("FIRST RETRY!\n");
|
||||
}
|
||||
else if ((current_socket->socket_values.tcp_control.no_of_retries > 0) &&
|
||||
(timex_sub(vtimer_now(), current_socket->socket_values.tcp_control.last_packet_time).microseconds >
|
||||
(timex_sub(now, current_socket->socket_values.tcp_control.last_packet_time).microseconds >
|
||||
(current_socket->socket_values.tcp_control.no_of_retries * TCP_SYN_TIMEOUT + TCP_SYN_INITIAL_TIMEOUT)))
|
||||
{
|
||||
current_socket->socket_values.tcp_control.no_of_retries++;
|
||||
@ -66,20 +68,22 @@ void handle_established(socket_internal_t *current_socket)
|
||||
{
|
||||
current_timeout *= 2;
|
||||
}
|
||||
timex_t now;
|
||||
vtimer_now(&now);
|
||||
if (current_timeout > TCP_ACK_MAX_TIMEOUT)
|
||||
{
|
||||
net_msg_send(&send, current_socket->send_pid, 0, TCP_TIMEOUT);
|
||||
// printf("GOT NO ACK: TIMEOUT!\n");
|
||||
}
|
||||
else if (timex_sub(vtimer_now(), current_socket->socket_values.tcp_control.last_packet_time).microseconds >
|
||||
else if (timex_sub(now, current_socket->socket_values.tcp_control.last_packet_time).microseconds >
|
||||
current_timeout)
|
||||
{
|
||||
// printReasBuffers();
|
||||
current_socket->socket_values.tcp_control.no_of_retries++;
|
||||
net_msg_send(&send, current_socket->send_pid, 0, TCP_RETRY);
|
||||
// printf("GOT NO ACK YET, %i. RETRY! Now: %lu Before: %lu, Diff: %lu, Cur Timeout: %f\n", current_socket->socket_values.tcp_control.no_of_retries,
|
||||
// vtimer_now().microseconds, current_socket->socket_values.tcp_control.last_packet_time.microseconds,
|
||||
// vtimer_now().microseconds - current_socket->socket_values.tcp_control.last_packet_time.microseconds,
|
||||
// now.microseconds, current_socket->socket_values.tcp_control.last_packet_time.microseconds,
|
||||
// now.microseconds - current_socket->socket_values.tcp_control.last_packet_time.microseconds,
|
||||
// current_timeout);
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ flowcontrol_stat_t slwin_stat;
|
||||
sem_t connection_established;
|
||||
int16_t synack_seqnum = -1;
|
||||
|
||||
ipv6_addr_t init_threeway_handshake() {
|
||||
ipv6_addr_t init_threeway_handshake(void) {
|
||||
border_syn_packet_t *syn;
|
||||
msg_t m;
|
||||
m.content.ptr = NULL;
|
||||
@ -48,7 +48,7 @@ ipv6_addr_t init_threeway_handshake() {
|
||||
return addr;
|
||||
}
|
||||
|
||||
ipv6_addr_t flowcontrol_init() {
|
||||
ipv6_addr_t flowcontrol_init(void) {
|
||||
int i;
|
||||
|
||||
sem_init(&slwin_stat.send_win_not_full,BORDER_SWS);
|
||||
|
||||
@ -51,7 +51,7 @@ typedef struct __attribute__ ((packed)) border_syn_packet_t {
|
||||
ipv6_addr_t addr;
|
||||
} border_syn_packet_t;
|
||||
|
||||
ipv6_addr_t flowcontrol_init();
|
||||
ipv6_addr_t flowcontrol_init(void);
|
||||
void flowcontrol_send_over_uart(border_packet_t *packet, int len);
|
||||
void flowcontrol_deliver_from_uart(border_packet_t *packet, int len);
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#include "objective_functions.h"
|
||||
|
||||
void of0(){
|
||||
void of0(void){
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void of0();
|
||||
void of0(void);
|
||||
|
||||
@ -10,7 +10,7 @@ rpl_of_t rpl_of0 = {
|
||||
NULL
|
||||
};
|
||||
|
||||
rpl_of_t *rpl_get_of0(){
|
||||
rpl_of_t *rpl_get_of0(void){
|
||||
return &rpl_of0;
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
#include "rpl_structs.h"
|
||||
|
||||
rpl_of_t *rpl_get_of0();
|
||||
rpl_of_t *rpl_get_of0(void);
|
||||
uint16_t calc_rank(rpl_parent_t *, uint16_t);
|
||||
rpl_parent_t *which_parent(rpl_parent_t *, rpl_parent_t *);
|
||||
rpl_dodag_t *which_dodag(rpl_dodag_t *, rpl_dodag_t *);
|
||||
|
||||
@ -65,18 +65,18 @@ static struct icmpv6_hdr_t * get_rpl_send_icmpv6_buf(uint8_t ext_len){
|
||||
//return ((struct icmpv6_hdr_t*)&(rpl_send_buffer[LLHDR_IPV6HDR_LEN + ext_len]));
|
||||
return ((struct icmpv6_hdr_t*)&(rpl_send_buffer[IPV6_HDR_LEN + ext_len]));
|
||||
}
|
||||
static struct rpl_dio_t* get_rpl_send_dio_buf(){
|
||||
static struct rpl_dio_t* get_rpl_send_dio_buf(void){
|
||||
//return ((struct rpl_dio_t*)&(rpl_send_buffer[LLHDR_ICMPV6HDR_LEN]));
|
||||
return ((struct rpl_dio_t*)&(rpl_send_buffer[IPV6HDR_ICMPV6HDR_LEN]));
|
||||
}
|
||||
static struct rpl_dao_t* get_rpl_send_dao_buf(){
|
||||
static struct rpl_dao_t* get_rpl_send_dao_buf(void){
|
||||
//return ((struct rpl_dao_t*)&(rpl_send_buffer[LLHDR_ICMPV6HDR_LEN]));
|
||||
return ((struct rpl_dao_t*)&(rpl_send_buffer[IPV6HDR_ICMPV6HDR_LEN]));
|
||||
}
|
||||
static struct rpl_dao_ack_t* get_rpl_send_dao_ack_buf(){
|
||||
static struct rpl_dao_ack_t* get_rpl_send_dao_ack_buf(void){
|
||||
return ((struct rpl_dao_ack_t*)&(rpl_send_buffer[IPV6HDR_ICMPV6HDR_LEN]));
|
||||
}
|
||||
static struct rpl_dis_t* get_rpl_send_dis_buf(){
|
||||
static struct rpl_dis_t* get_rpl_send_dis_buf(void){
|
||||
//return ((struct rpl_dis_t*)&(rpl_send_buffer[LLHDR_ICMPV6HDR_LEN]));
|
||||
return ((struct rpl_dis_t*)&(rpl_send_buffer[IPV6HDR_ICMPV6HDR_LEN]));
|
||||
}
|
||||
@ -98,17 +98,17 @@ static struct rpl_opt_transit_t* get_rpl_send_opt_transit_buf(uint8_t rpl_msg_le
|
||||
static struct ipv6_hdr_t * get_rpl_ipv6_buf(void){
|
||||
return ((struct ipv6_hdr_t*)&(rpl_buffer[0]));
|
||||
}
|
||||
static struct rpl_dio_t* get_rpl_dio_buf(){
|
||||
static struct rpl_dio_t* get_rpl_dio_buf(void){
|
||||
return ((struct rpl_dio_t*)&(rpl_buffer[IPV6HDR_ICMPV6HDR_LEN]));
|
||||
}
|
||||
|
||||
static struct rpl_dao_t* get_rpl_dao_buf(){
|
||||
static struct rpl_dao_t* get_rpl_dao_buf(void){
|
||||
return ((struct rpl_dao_t*)&(rpl_buffer[IPV6HDR_ICMPV6HDR_LEN]));
|
||||
}
|
||||
static struct rpl_dao_ack_t* get_rpl_dao_ack_buf(){
|
||||
static struct rpl_dao_ack_t* get_rpl_dao_ack_buf(void){
|
||||
return ((struct rpl_dao_ack_t*)&(buffer[LLHDR_ICMPV6HDR_LEN]));
|
||||
}
|
||||
static struct rpl_dis_t* get_rpl_dis_buf(){
|
||||
static struct rpl_dis_t* get_rpl_dis_buf(void){
|
||||
return ((struct rpl_dis_t*)&(rpl_buffer[IPV6HDR_ICMPV6HDR_LEN]));
|
||||
}
|
||||
static struct rpl_opt_t* get_rpl_opt_buf(uint8_t rpl_msg_len){
|
||||
@ -188,7 +188,7 @@ uint8_t rpl_init(transceiver_type_t trans, uint16_t rpl_address){
|
||||
|
||||
}
|
||||
|
||||
void rpl_init_root(){
|
||||
void rpl_init_root(void){
|
||||
rpl_instance_t *inst;
|
||||
rpl_dodag_t *dodag;
|
||||
|
||||
@ -293,7 +293,7 @@ void send_DIS(ipv6_addr_t *destination){
|
||||
icmp_send_buf = get_rpl_send_icmpv6_buf(ipv6_ext_hdr_len);
|
||||
|
||||
icmp_send_buf->type = ICMP_RPL_CONTROL;
|
||||
icmp_send_buf->code = ICMP_CODE_DIO;
|
||||
icmp_send_buf->code = ICMP_CODE_DIS;
|
||||
icmp_send_buf->checksum = ~icmpv6_csum(PROTO_NUM_ICMPV6);
|
||||
|
||||
rpl_send_dis_buf = get_rpl_send_dis_buf();
|
||||
@ -892,7 +892,7 @@ rpl_routing_entry_t *rpl_find_routing_entry(ipv6_addr_t *addr){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void rpl_clear_routing_table(){
|
||||
void rpl_clear_routing_table(void){
|
||||
for(uint8_t i=0; i<RPL_MAX_ROUTING_ENTRIES; i++){
|
||||
memset(&routing_table[i], 0, sizeof(routing_table[i]));
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
#define RPL_PROCESS_STACKSIZE 4096
|
||||
|
||||
uint8_t rpl_init(transceiver_type_t trans, uint16_t rpl_address);
|
||||
void rpl_init_root();
|
||||
void rpl_init_root(void);
|
||||
rpl_of_t *rpl_get_of_for_ocp(uint16_t ocp);
|
||||
|
||||
void send_DIO(ipv6_addr_t *destination);
|
||||
@ -26,5 +26,5 @@ ipv6_addr_t *rpl_get_next_hop(ipv6_addr_t * addr);
|
||||
void rpl_add_routing_entry(ipv6_addr_t *addr, ipv6_addr_t *next_hop, uint16_t lifetime);
|
||||
void rpl_del_routing_entry(ipv6_addr_t *addr);
|
||||
rpl_routing_entry_t * rpl_find_routing_entry(ipv6_addr_t *addr);
|
||||
void rpl_clear_routing_table();
|
||||
void rpl_clear_routing_table(void);
|
||||
rpl_routing_entry_t *rpl_get_routing_table(void);
|
||||
|
||||
@ -3,17 +3,17 @@
|
||||
|
||||
rpl_instance_t *rpl_new_instance(uint8_t instanceid);
|
||||
rpl_instance_t *rpl_get_instance(uint8_t instanceid);
|
||||
rpl_instance_t *rpl_get_my_instance();
|
||||
rpl_instance_t *rpl_get_my_instance(void);
|
||||
rpl_dodag_t *rpl_new_dodag(uint8_t instanceid, ipv6_addr_t *id);
|
||||
rpl_dodag_t *rpl_get_dodag(ipv6_addr_t *id);
|
||||
rpl_dodag_t *rpl_get_my_dodag();
|
||||
rpl_dodag_t *rpl_get_my_dodag(void);
|
||||
void rpl_join_dodag(rpl_dodag_t *dodag, ipv6_addr_t *parent, uint16_t parent_rank);
|
||||
void rpl_del_dodag(rpl_dodag_t *dodag);
|
||||
rpl_parent_t *rpl_new_parent(rpl_dodag_t *dodag, ipv6_addr_t *address, uint16_t rank);
|
||||
rpl_parent_t *rpl_find_parent(ipv6_addr_t *address);
|
||||
void rpl_leave_dodag(rpl_dodag_t * dodag);
|
||||
bool rpl_equal_id(ipv6_addr_t *id1, ipv6_addr_t *id2);
|
||||
ipv6_addr_t *rpl_get_my_preferred_parent();
|
||||
ipv6_addr_t *rpl_get_my_preferred_parent(void);
|
||||
void rpl_delete_parent(rpl_parent_t *parent);
|
||||
void rpl_delete_worst_parent(void);
|
||||
void rpl_delete_all_parents(void);
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
extern ipv6_addr_t abr_addr;
|
||||
|
||||
uint16_t border_get_serial_reader();
|
||||
uint16_t border_get_serial_reader(void);
|
||||
|
||||
uint8_t *get_serial_out_buffer(int offset);
|
||||
uint8_t *get_serial_in_buffer(int offset);
|
||||
|
||||
@ -211,7 +211,8 @@ void ipv6_iface_add_addr(ipv6_addr_t *addr, uint8_t state, uint32_t val_ltime, u
|
||||
iface.addr_list[iface_addr_list_count].state = state;
|
||||
timex_t valtime = {val_ltime, 0};
|
||||
timex_t preftime = {pref_ltime, 0};
|
||||
timex_t now = vtimer_now();
|
||||
timex_t now;
|
||||
vtimer_now(&now);
|
||||
iface.addr_list[iface_addr_list_count].val_ltime = timex_add(now, valtime);
|
||||
iface.addr_list[iface_addr_list_count].pref_ltime = timex_add(now, preftime);
|
||||
iface.addr_list[iface_addr_list_count].type = type;
|
||||
@ -451,7 +452,8 @@ uint8_t ipv6_next_hdr_unknown(uint8_t next_hdr) {
|
||||
|
||||
|
||||
uint32_t get_remaining_time(timex_t *t){
|
||||
timex_t now = vtimer_now();
|
||||
timex_t now;
|
||||
vtimer_now(&now);
|
||||
|
||||
return (timex_sub(*t, now).seconds);
|
||||
}
|
||||
@ -459,7 +461,9 @@ uint32_t get_remaining_time(timex_t *t){
|
||||
void set_remaining_time(timex_t *t, uint32_t time){
|
||||
timex_t tmp = {time, 0};
|
||||
|
||||
*t = timex_add(vtimer_now(), tmp);
|
||||
timex_t now;
|
||||
vtimer_now(&now)
|
||||
*t = timex_add(now, tmp);
|
||||
}
|
||||
|
||||
void ipv6_init_iface_as_router(void) {
|
||||
|
||||
@ -64,8 +64,8 @@ uint8_t recvd_cids_len = 0;
|
||||
plist_t *recvd_prefixes[OPT_PI_LIST_LEN];
|
||||
uint8_t recvd_pref_len = 0;
|
||||
|
||||
static abr_cache_t* abr_get_most_current();
|
||||
static abr_cache_t* abr_get_oldest();
|
||||
static abr_cache_t* abr_get_most_current(void);
|
||||
static abr_cache_t* abr_get_oldest(void);
|
||||
|
||||
int min(int a, int b) {
|
||||
if (a < b) {
|
||||
@ -1057,7 +1057,7 @@ void nbr_cache_rem(ipv6_addr_t *addr){
|
||||
* @return The most current authoritive border router information, NULL
|
||||
* if no such information is given.
|
||||
*/
|
||||
static abr_cache_t *abr_get_most_current(){
|
||||
static abr_cache_t *abr_get_most_current(void){
|
||||
abr_cache_t *abr = NULL;
|
||||
int i;
|
||||
int version = abr_cache[0].version;
|
||||
@ -1071,7 +1071,7 @@ static abr_cache_t *abr_get_most_current(){
|
||||
return abr;
|
||||
}
|
||||
|
||||
static abr_cache_t *abr_get_oldest(){
|
||||
static abr_cache_t *abr_get_oldest(void){
|
||||
abr_cache_t *abr = NULL;
|
||||
int i;
|
||||
int version = abr_cache[0].version;
|
||||
@ -1154,7 +1154,8 @@ void def_rtr_lst_add(ipv6_addr_t *ipaddr, uint32_t rtr_ltime){
|
||||
} else {
|
||||
memcpy(&(def_rtr_lst[def_rtr_count].addr), ipaddr, 16);
|
||||
timex_t rltime = {rtr_ltime, 0};
|
||||
timex_t now = vtimer_now();
|
||||
timex_t now;
|
||||
vtimer_now(&now);
|
||||
|
||||
def_rtr_lst[def_rtr_count].inval_time = timex_add(now, rltime);
|
||||
|
||||
|
||||
@ -212,14 +212,12 @@ void lowpan_transfer(void)
|
||||
msg_t m_recv, m_send;
|
||||
ipv6_hdr_t *ipv6_buf;
|
||||
lowpan_reas_buf_t *current_buf;
|
||||
long temp_time;
|
||||
uint8_t gotosleep;
|
||||
|
||||
while (1)
|
||||
{
|
||||
temp_time = LONG_MAX;
|
||||
gotosleep = 1;
|
||||
|
||||
gotosleep = 1;
|
||||
mutex_lock(&fifo_mutex);
|
||||
current_buf = packet_fifo;
|
||||
if (current_buf != NULL)
|
||||
@ -300,7 +298,10 @@ lowpan_reas_buf_t *new_packet_buffer(uint16_t datagram_size, uint16_t datagram_t
|
||||
|
||||
new_buf->ident_no = datagram_tag;
|
||||
new_buf->packet_size = datagram_size;
|
||||
new_buf->timestamp = vtimer_now().microseconds;
|
||||
|
||||
timex_t now;
|
||||
vtimer_now(&now)
|
||||
new_buf->timestamp = now.microseconds;
|
||||
|
||||
if ((current_buf == NULL) && (temp_buf == NULL))
|
||||
{
|
||||
@ -336,7 +337,9 @@ lowpan_reas_buf_t *get_packet_frag_buf(uint16_t datagram_size, uint16_t datagram
|
||||
current_buf->interval_list_head != NULL)
|
||||
{
|
||||
/* Found buffer for current packet fragment */
|
||||
current_buf->timestamp = vtimer_now().microseconds;
|
||||
timex_t now;
|
||||
vtimer_now(&now);
|
||||
current_buf->timestamp = now.microseconds;
|
||||
return current_buf;
|
||||
}
|
||||
temp_buf = current_buf;
|
||||
@ -528,7 +531,9 @@ void check_timeout(void)
|
||||
long cur_time;
|
||||
int count = 0;
|
||||
|
||||
cur_time = vtimer_now().microseconds;
|
||||
timex_t now;
|
||||
vtimer_now(&now)
|
||||
cur_time = now.microseconds;
|
||||
temp_buf = head;
|
||||
|
||||
while (temp_buf != NULL)
|
||||
|
||||
@ -72,13 +72,13 @@ void lowpan_iphc_encoding(ieee_802154_long_t *dest, ipv6_hdr_t *ipv6_buf_extra,
|
||||
void lowpan_iphc_decoding(uint8_t *data, uint8_t length,
|
||||
ieee_802154_long_t *s_laddr,
|
||||
ieee_802154_long_t *d_laddr);
|
||||
uint8_t lowpan_context_len();
|
||||
uint8_t lowpan_context_len(void);
|
||||
void add_fifo_packet(lowpan_reas_buf_t *current_packet);
|
||||
lowpan_context_t * lowpan_context_update(
|
||||
uint8_t num, const ipv6_addr_t *prefix,
|
||||
uint8_t length, uint8_t comp,
|
||||
uint16_t lifetime);
|
||||
lowpan_context_t * lowpan_context_get();
|
||||
lowpan_context_t * lowpan_context_get(void);
|
||||
lowpan_context_t * lowpan_context_lookup(ipv6_addr_t *addr);
|
||||
lowpan_context_t * lowpan_context_num_lookup(uint8_t num);
|
||||
lowpan_reas_buf_t *collect_garbage_fifo(lowpan_reas_buf_t *current_buf);
|
||||
|
||||
@ -49,7 +49,7 @@ void ping(radio_address_t addr, uint8_t channr){
|
||||
cc1100_set_channel(channr);
|
||||
cc1100_set_address(r_address);
|
||||
while(1){
|
||||
start = vtimer_now();
|
||||
vtimer_now(&start);
|
||||
int trans_ok = cc1100_send_csmaca(addr,
|
||||
protocol_id,2,pipa->payload,sizeof(pipa->payload));
|
||||
if(trans_ok < 0)
|
||||
@ -59,7 +59,8 @@ void ping(radio_address_t addr, uint8_t channr){
|
||||
}
|
||||
|
||||
void calc_rtt(void){
|
||||
timex_t end = vtimer_now();
|
||||
timex_t end;
|
||||
vtimer_now(&end);
|
||||
timex_t result = vtimer_sub(end, start);
|
||||
|
||||
rtt = result.seconds+(float)result.microseconds/100000;
|
||||
|
||||
@ -13,8 +13,8 @@ $(BINDIR)$(MODULE).a: $(OBJ)
|
||||
|
||||
# compile and generate dependency info
|
||||
$(BINDIR)%.o: %.c
|
||||
$(CC) $(CFLAGS) $(PROJECTINCLUDE) $(BOARDINCLUDE) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
|
||||
$(CC) $(CFLAGS) $(PROJECTINCLUDE) $(BOARDINCLUDE) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
|
||||
@printf "$(BINDIR)"|cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
|
||||
|
||||
# remove compilation products
|
||||
|
||||
@ -42,8 +42,8 @@ $(BINDIR)$(MODULE).a: $(OBJ)
|
||||
|
||||
# compile and generate dependency info
|
||||
$(BINDIR)%.o: %.c
|
||||
$(CC) $(CFLAGS) $(PROJECTINCLUDE) $(BOARDINCLUDE) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
|
||||
$(CC) $(CFLAGS) $(PROJECTINCLUDE) $(BOARDINCLUDE) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -c $*.c -o $(BINDIR)$*.o
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -MM $*.c > $(BINDIR)$*.d
|
||||
@printf "$(BINDIR)"|cat - $(BINDIR)$*.d > /tmp/riot_out && mv /tmp/riot_out $(BINDIR)$*.d
|
||||
|
||||
# remove compilation products
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <irq.h>
|
||||
#include <queue.h>
|
||||
#include <timex.h>
|
||||
@ -146,7 +147,9 @@ void normalize_to_tick(timex_t *time) {
|
||||
static int vtimer_set(vtimer_t *timer) {
|
||||
DEBUG("vtimer_set(): New timer. Offset: %lu %lu\n", timer->absolute.seconds, timer->absolute.microseconds);
|
||||
|
||||
timer->absolute = timex_add(vtimer_now(), timer->absolute);
|
||||
timex_t now;
|
||||
vtimer_now(&now);
|
||||
timer->absolute = timex_add(now, timer->absolute);
|
||||
normalize_to_tick(&(timer->absolute));
|
||||
|
||||
DEBUG("vtimer_set(): Absolute: %lu %lu\n", timer->absolute.seconds, timer->absolute.microseconds);
|
||||
@ -185,10 +188,9 @@ static int vtimer_set(vtimer_t *timer) {
|
||||
return result;
|
||||
}
|
||||
|
||||
/* TODO: Do NOT return a struct! */
|
||||
timex_t vtimer_now() {
|
||||
timex_t t = timex_set(seconds, HWTIMER_TICKS_TO_US(hwtimer_now())-longterm_tick_start);
|
||||
return t;
|
||||
void vtimer_now(timex_t* out) {
|
||||
timex_t t = timex_set(seconds, hwtimer_now()-longterm_tick_start);
|
||||
memcpy(out, &t, sizeof(timex_t));
|
||||
}
|
||||
|
||||
int vtimer_init() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user