Merge pull request #90 from OlegHahm/milestone_1_0_fixes

Milestone 1 0 fixes
This commit is contained in:
LudwigOrtmann 2013-08-08 06:29:22 -07:00
commit 07c7e8ccd3
36 changed files with 67 additions and 59 deletions

View File

@ -14,8 +14,8 @@ ifneq (,$(findstring uart0,$(USEMODULE)))
endif
ifneq (,$(findstring cc110x,$(USEMODULE)))
ifeq (,$(findstring protocol-multiplex,$(USEMODULE)))
USEMODULE += protocol-multiplex
ifeq (,$(findstring protocol_multiplex,$(USEMODULE)))
USEMODULE += protocol_multiplex
endif
endif

View File

@ -57,10 +57,8 @@ int mutex_lock(struct mutex_t *mutex);
* @brief Unlocks the mutex.
*
* @param mutex Mutex-Object to unlock.
*
* @param yield If yield==MUTEX_YIELD, force context-switch after waking up other waiter.
*/
void mutex_unlock(struct mutex_t *mutex, int yield);
void mutex_unlock(struct mutex_t *mutex);
#define MUTEX_YIELD 1
#define MUTEX_INISR 2

View File

@ -10,7 +10,9 @@
* @ingroup kernel_msg
* @{
* @file
* @author Freie Universität Berlin, Computer Systems & Telematics, FeuerWhere project
* @author Kaspar Schleiser <kaspar.schleiser@fu-berlin.de>
* @author Oliver Hahm <oliver.hahm@inria.fr>
* @}
*/
@ -80,6 +82,7 @@ int msg_send(msg_t *m, unsigned int target_pid, bool block)
queue_node_t n;
n.priority = active_thread->priority;
n.data = (unsigned int) active_thread;
n.next = NULL;
DEBUG("%s: Adding node to msg_waiters:\n", active_thread->name);
queue_priority_add(&(target->msg_waiters), &n);

View File

@ -92,7 +92,7 @@ void mutex_wait(struct mutex_t *mutex)
/* we were woken up by scheduler. waker removed us from queue. we have the mutex now. */
}
void mutex_unlock(struct mutex_t *mutex, int yield)
void mutex_unlock(struct mutex_t *mutex)
{
DEBUG("%s: unlocking mutex. val: %u pid: %u\n", active_thread->name, mutex->val, thread_pid);
int irqstate = disableIRQ();

View File

@ -66,6 +66,7 @@ unsigned long hwtimer_arch_now()
void hwtimer_arch_init(void (*handler)(int), uint32_t fcpu)
{
(void) fcpu;
timerA_init();
int_handler = handler;
TA0_enable_interrupt(0);

View File

@ -244,6 +244,7 @@ void hwtimer_arch_init(void (*handler)(int), uint32_t fcpu)
{
DEBUG("hwtimer_arch_init()\n");
(void) fcpu;
hwtimer_arch_disable_interrupt();
int_handler = handler;

View File

@ -294,6 +294,7 @@ void native_irq_handler()
*/
void native_isr_entry(int sig, siginfo_t *info, void *context)
{
(void) info; /* unused at the moment */
DEBUG("\n\n\t\tnative_isr_entry\n\n");
if (native_interrupts_enabled == 0) {

View File

@ -219,7 +219,7 @@ void cc1100_phy_mutex_lock(void)
void cc1100_phy_mutex_unlock(void)
{
cc1100_mutex_pid = -1;
mutex_unlock(&cc1100_mutex, 0);
mutex_unlock(&cc1100_mutex);
}
/*---------------------------------------------------------------------------*/

View File

@ -347,7 +347,7 @@ uint8_t sht11_read_sensor(sht11_val_t *value, sht11_mode_t mode)
/* break on error */
if (error != 0) {
connection_reset();
mutex_unlock(&sht11_mutex, 0);
mutex_unlock(&sht11_mutex);
return 0;
}
@ -363,7 +363,7 @@ uint8_t sht11_read_sensor(sht11_val_t *value, sht11_mode_t mode)
}
}
mutex_unlock(&sht11_mutex, 0);
mutex_unlock(&sht11_mutex);
return 1;
}

View File

@ -70,14 +70,14 @@ endif
ifneq (,$(findstring net_help,$(USEMODULE)))
DIRS += net/net_help
endif
ifneq (,$(findstring protocol-multiplex,$(USEMODULE)))
ifneq (,$(findstring protocol_multiplex,$(USEMODULE)))
DIRS += net/protocol-multiplex
endif
ifneq (,$(findstring sixlowpan,$(USEMODULE)))
DIRS += net/sixlowpan
endif
ifneq (,$(findstring rpl,$(USEMODULE)))
DIRS += net/sixlowpan/rpl
DIRS += net/rpl
endif
ifneq (,$(findstring ieee802154,$(USEMODULE)))
DIRS += net/ieee802154

View File

@ -117,7 +117,7 @@ static void logd_process(void)
free(node);
}
mutex_unlock(&log_mutex, 0);
mutex_unlock(&log_mutex);
}
while (m.type != MSG_EXIT && !exit_flag);
@ -184,7 +184,7 @@ bool logd_log(char *str, int str_len)
lq->str[str_len] = '\0'; /* add string termination char at end of buffer */
mutex_lock(&log_mutex);
list_append(&log_msg_queue, (list_node_t *) lq);
mutex_unlock(&log_mutex, 0);
mutex_unlock(&log_mutex);
m.type = MSG_POLL;
m.content.ptr = NULL;
msg_send(&m, log_pid, false);

View File

@ -529,14 +529,14 @@ int connect(int socket, sockaddr6_t *addr, uint32_t addrlen)
current_tcp_socket->tcp_control.rcv_irs = 0;
mutex_lock(&global_sequence_clunter_mutex);
current_tcp_socket->tcp_control.send_iss = global_sequence_counter;
mutex_unlock(&global_sequence_clunter_mutex, 0);
mutex_unlock(&global_sequence_clunter_mutex);
current_tcp_socket->tcp_control.state = SYN_SENT;
#ifdef TCP_HC
/* Choosing random number Context ID */
mutex_lock(&global_context_counter_mutex);
current_tcp_socket->tcp_control.tcp_context.context_id = global_context_counter;
mutex_unlock(&global_context_counter_mutex, 0);
mutex_unlock(&global_context_counter_mutex);
current_tcp_socket->tcp_control.tcp_context.hc_type = FULL_HEADER;
@ -871,7 +871,7 @@ uint8_t read_from_socket(socket_internal_t *current_int_tcp_socket,
current_int_tcp_socket->tcp_input_buffer_end);
current_int_tcp_socket->tcp_input_buffer_end = 0;
current_int_tcp_socket->socket_values.tcp_control.rcv_wnd += read_bytes;
mutex_unlock(&current_int_tcp_socket->tcp_buffer_mutex, 0);
mutex_unlock(&current_int_tcp_socket->tcp_buffer_mutex);
return read_bytes;
}
else {
@ -883,7 +883,7 @@ uint8_t read_from_socket(socket_internal_t *current_int_tcp_socket,
current_int_tcp_socket->tcp_input_buffer_end =
current_int_tcp_socket->tcp_input_buffer_end - len;
current_int_tcp_socket->socket_values.tcp_control.rcv_wnd += len;
mutex_unlock(&current_int_tcp_socket->tcp_buffer_mutex, 0);
mutex_unlock(&current_int_tcp_socket->tcp_buffer_mutex);
return len;
}
}
@ -1326,7 +1326,7 @@ socket_internal_t *new_tcp_queued_socket(ipv6_hdr_t *ipv6_header,
mutex_lock(&global_sequence_clunter_mutex);
current_queued_socket->socket_values.tcp_control.send_iss =
global_sequence_counter;
mutex_unlock(&global_sequence_clunter_mutex, 0);
mutex_unlock(&global_sequence_clunter_mutex);
current_queued_socket->socket_values.tcp_control.state = SYN_RCVD;
set_tcp_cb(&current_queued_socket->socket_values.tcp_control,
tcp_header->seq_nr + 1, STATIC_WINDOW,

View File

@ -85,7 +85,7 @@ uint8_t handle_payload(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header,
tcp_socket->socket_values.tcp_control.rcv_wnd = 0;
tcp_socket->tcp_input_buffer_end = tcp_socket->tcp_input_buffer_end +
tcp_socket->socket_values.tcp_control.rcv_wnd;
mutex_unlock(&tcp_socket->tcp_buffer_mutex, 0);
mutex_unlock(&tcp_socket->tcp_buffer_mutex);
}
else {
mutex_lock(&tcp_socket->tcp_buffer_mutex);
@ -95,7 +95,7 @@ uint8_t handle_payload(ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header,
acknowledged_bytes = tcp_payload_len;
tcp_socket->tcp_input_buffer_end = tcp_socket->tcp_input_buffer_end +
tcp_payload_len;
mutex_unlock(&tcp_socket->tcp_buffer_mutex, 0);
mutex_unlock(&tcp_socket->tcp_buffer_mutex);
}
if (thread_getstatus(tcp_socket->recv_pid) == STATUS_RECEIVE_BLOCKED) {

View File

@ -134,11 +134,11 @@ void inc_global_variables(void)
{
mutex_lock(&global_sequence_clunter_mutex);
global_sequence_counter += rand();
mutex_unlock(&global_sequence_clunter_mutex, 0);
mutex_unlock(&global_sequence_clunter_mutex);
#ifdef TCP_HC
mutex_lock(&global_context_counter_mutex);
global_context_counter += rand();
mutex_unlock(&global_context_counter_mutex, 0);
mutex_unlock(&global_context_counter_mutex);
#endif
}

View File

@ -1,4 +1,4 @@
MODULE:=$(shell basename $(CURDIR))
MODULE:=protocol_multiplex
INCLUDES = -I$(RIOTBASE) -I$(RIOTBASE)/sys/include -I$(RIOTBASE)/core/include
include $(RIOTBASE)/Makefile.base

View File

@ -187,7 +187,7 @@ void etx_beacon(void) {
}
cur_round = 0;
}
mutex_unlock(&etx_mutex,0);
mutex_unlock(&etx_mutex);
}
}
@ -378,7 +378,7 @@ void etx_radio(void) {
//handle the beacon
mutex_lock(&etx_mutex);
etx_handle_beacon(&candidate_addr);
mutex_unlock(&etx_mutex,1);
mutex_unlock(&etx_mutex);
}
p->processing--;

View File

@ -32,4 +32,4 @@
*/
#define ETX_RANK_MULTIPLIER (0x80)
rpl_of_t *rpl_get_of_mrhof();
rpl_of_t *rpl_get_of_mrhof(void);

View File

@ -280,7 +280,7 @@ void send_DIO(ipv6_addr_t *destination)
if (mydodag == NULL) {
DEBUG("Error - trying to send DIO without being part of a dodag.\n");
mutex_unlock(&rpl_send_mutex, 0);
mutex_unlock(&rpl_send_mutex);
return;
}
@ -321,7 +321,7 @@ void send_DIO(ipv6_addr_t *destination)
uint16_t plen = ICMPV6_HDR_LEN + DIO_BASE_LEN + opt_hdr_len;
rpl_send(destination, (uint8_t *)icmp_send_buf, plen, PROTO_NUM_ICMPV6, NULL);
mutex_unlock(&rpl_send_mutex, 0);
mutex_unlock(&rpl_send_mutex);
}
void send_DIS(ipv6_addr_t *destination)
@ -337,7 +337,7 @@ void send_DIS(ipv6_addr_t *destination)
uint16_t plen = ICMPV6_HDR_LEN + DIS_BASE_LEN;
rpl_send(destination, (uint8_t *)icmp_send_buf, plen, PROTO_NUM_ICMPV6, NULL);
mutex_unlock(&rpl_send_mutex, 0);
mutex_unlock(&rpl_send_mutex);
}
@ -366,7 +366,7 @@ void send_DAO(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifetime,
icmp_send_buf->checksum = ~icmpv6_csum(PROTO_NUM_ICMPV6);
if (my_dodag == NULL) {
mutex_unlock(&rpl_send_mutex, 0);
mutex_unlock(&rpl_send_mutex);
return;
}
@ -428,7 +428,7 @@ void send_DAO(ipv6_addr_t *destination, uint8_t lifetime, bool default_lifetime,
uint16_t plen = ICMPV6_HDR_LEN + DAO_BASE_LEN + opt_len;
rpl_send(destination, (uint8_t *)icmp_send_buf, plen, PROTO_NUM_ICMPV6, NULL);
mutex_unlock(&rpl_send_mutex, 0);
mutex_unlock(&rpl_send_mutex);
if (continue_index > 1) {
send_DAO(destination, lifetime, default_lifetime, continue_index);
@ -460,7 +460,7 @@ void send_DAO_ACK(ipv6_addr_t *destination)
uint16_t plen = ICMPV6_HDR_LEN + DIS_BASE_LEN;
rpl_send(destination, (uint8_t *)icmp_send_buf, plen, PROTO_NUM_ICMPV6, NULL);
mutex_unlock(&rpl_send_mutex, 0);
mutex_unlock(&rpl_send_mutex);
}
void rpl_process(void)
@ -480,30 +480,30 @@ void rpl_process(void)
switch(*code) {
case (ICMP_CODE_DIS): {
recv_rpl_dis();
mutex_unlock(&rpl_recv_mutex, 0);
mutex_unlock(&rpl_recv_mutex);
break;
}
case (ICMP_CODE_DIO): {
recv_rpl_dio();
mutex_unlock(&rpl_recv_mutex, 0);
mutex_unlock(&rpl_recv_mutex);
break;
}
case (ICMP_CODE_DAO): {
recv_rpl_dao();
mutex_unlock(&rpl_recv_mutex, 0);
mutex_unlock(&rpl_recv_mutex);
break;
}
case (ICMP_CODE_DAO_ACK): {
recv_rpl_dao_ack();
mutex_unlock(&rpl_recv_mutex, 0);
mutex_unlock(&rpl_recv_mutex);
break;
}
default:
mutex_unlock(&rpl_recv_mutex, 0);
mutex_unlock(&rpl_recv_mutex);
break;
}
}

View File

@ -270,7 +270,7 @@ typedef struct rpl_of_t {
void (*reset)(rpl_dodag_t *);
void (*parent_state_callback)(rpl_parent_t *, int, int);
void (*init) (void); //OF specific init function
void (*process_dio) (); //DIO processing callback (acc. to OF0 spec, chpt 5)
void (*process_dio) (void); //DIO processing callback (acc. to OF0 spec, chpt 5)
} rpl_of_t;
typedef struct {

View File

@ -22,7 +22,7 @@
#include <math.h>
#include "inttypes.h"
#include "trickle.h"
#include "sixlowpan/rpl/rpl.h"
#include "rpl/rpl.h"
//TODO in pointer umwandeln, speicher mit malloc holen
char * timer_over_buf;

View File

@ -76,7 +76,7 @@ void demultiplex(border_packet_t *packet, int len)
context->context.comp,
context->context.lifetime
);
mutex_unlock(&lowpan_context_mutex, 0);
mutex_unlock(&lowpan_context_mutex);
abr_add_context(context->context.version, &abr_addr, context->context.cid);
/* Send router advertisement */
break;

View File

@ -47,7 +47,7 @@ int sem_signal(sem_t *sem)
{
if (++(sem->value) > 0 && sem->locked) {
sem->locked = !(sem->locked);
mutex_unlock(&(sem->mutex), 0);
mutex_unlock(&(sem->mutex));
}
return 0;

View File

@ -208,7 +208,7 @@ void send_ieee802154_frame(ieee_802154_long_t *addr, uint8_t *payload,
memcpy(&buf[hdrlen], frame.payload, frame.payload_len);
/* mutex unlock */
mutex_unlock(&buf_mutex, 0);
mutex_unlock(&buf_mutex);
p.length = hdrlen + frame.payload_len;

View File

@ -182,7 +182,7 @@ void init_rtr_sol(uint8_t sllao)
ipv6_get_saddr(&(ipv6_buf->srcaddr), &(ipv6_buf->destaddr));
opt_hdr_len = RTR_SOL_LEN;
ipv6_buf->length = ICMPV6_HDR_LEN + RTR_SOL_LEN + OPT_STLLAO_MAX_LEN;
ipv6_buf->length = HTONS(ICMPV6_HDR_LEN + RTR_SOL_LEN + OPT_STLLAO_MAX_LEN);
if (sllao == OPT_SLLAO) {
opt_stllao_buf = get_opt_stllao_buf(ipv6_ext_hdr_len, opt_hdr_len);
@ -423,7 +423,7 @@ void init_rtr_adv(ipv6_addr_t *addr, uint8_t sllao, uint8_t mtu, uint8_t pi,
free(contexts);
}
mutex_unlock(&lowpan_context_mutex, 0);
mutex_unlock(&lowpan_context_mutex);
}
if (pi == OPT_PI) {
@ -445,7 +445,7 @@ void init_rtr_adv(ipv6_addr_t *addr, uint8_t sllao, uint8_t mtu, uint8_t pi,
}
}
ipv6_buf->length = packet_length - IPV6_HDR_LEN;
ipv6_buf->length = HTONS(packet_length - IPV6_HDR_LEN);
/* calculate checksum */
icmp_buf->checksum = 0;
@ -617,7 +617,7 @@ void recv_rtr_adv(void)
}
}
mutex_unlock(&lowpan_context_mutex, 0);
mutex_unlock(&lowpan_context_mutex);
if (trigger_ns >= 0) {
/* send ns - draft-ietf-6lowpan-nd-15#section-5.5.1
@ -698,7 +698,7 @@ void init_nbr_sol(ipv6_addr_t *src, ipv6_addr_t *dest, ipv6_addr_t *targ,
packet_length += OPT_ARO_HDR_LEN;
}
ipv6_buf->length = packet_length - IPV6_HDR_LEN;
ipv6_buf->length = HTONS(packet_length - IPV6_HDR_LEN);
icmp_buf->checksum = 0;
icmp_buf->checksum = ~icmpv6_csum(PROTO_NUM_ICMPV6);
@ -941,7 +941,7 @@ void init_nbr_adv(ipv6_addr_t *src, ipv6_addr_t *dst, ipv6_addr_t *tgt,
packet_length += OPT_ARO_HDR_LEN;
}
ipv6_buf->length = packet_length - IPV6_HDR_LEN;
ipv6_buf->length = HTONS(packet_length - IPV6_HDR_LEN);
icmp_buf->checksum = 0;
icmp_buf->checksum = ~icmpv6_csum(PROTO_NUM_ICMPV6);
@ -1069,7 +1069,7 @@ uint16_t icmpv6_csum(uint8_t proto)
{
ipv6_buf = get_ipv6_buf();
uint16_t sum;
uint16_t len = ipv6_buf->length;
uint16_t len = NTOHS(ipv6_buf->length);
sum = len + proto;
sum = csum(sum, (uint8_t *)&ipv6_buf->srcaddr, 2 * sizeof(ipv6_addr_t));
@ -1109,7 +1109,7 @@ void init_para_prob(ipv6_addr_t *src, ipv6_addr_t *dest, uint8_t code, uint32_t
packet_length += min(MTU - packet_length, packet_len);
ipv6_buf->length = packet_length - IPV6_HDR_LEN;
ipv6_buf->length = HTONS(packet_length - IPV6_HDR_LEN);
icmp_buf->checksum = 0;
icmp_buf->checksum = ~icmpv6_csum(PROTO_NUM_ICMPV6);

View File

@ -234,7 +234,7 @@ void lowpan_transfer(void)
current_buf = packet_fifo;
if (current_buf != NULL) {
mutex_unlock(&fifo_mutex, 0);
mutex_unlock(&fifo_mutex);
if ((current_buf->packet)[0] == LOWPAN_IPV6_DISPATCH) {
ipv6_buf = get_ipv6_buf();
@ -263,7 +263,7 @@ void lowpan_transfer(void)
if (gotosleep == 1) {
mutex_unlock(&fifo_mutex, 0);
mutex_unlock(&fifo_mutex);
thread_sleep();
}
}
@ -450,7 +450,7 @@ lowpan_reas_buf_t *collect_garbage_fifo(lowpan_reas_buf_t *current_buf)
return_buf = my_buf->next;
}
mutex_unlock(&fifo_mutex, 0);
mutex_unlock(&fifo_mutex);
current_list = current_buf->interval_list_head;
temp_list = current_list;
@ -610,7 +610,7 @@ void add_fifo_packet(lowpan_reas_buf_t *current_packet)
my_buf->next = current_packet;
}
mutex_unlock(&fifo_mutex, 0);
mutex_unlock(&fifo_mutex);
current_packet->next = NULL;
}
@ -973,7 +973,7 @@ void lowpan_iphc_encoding(ieee_802154_long_t *dest, ipv6_hdr_t *ipv6_buf_extra,
}
}
mutex_unlock(&lowpan_context_mutex, 0);
mutex_unlock(&lowpan_context_mutex);
comp_buf[0] = lowpan_iphc[0];
comp_buf[1] = lowpan_iphc[1];
@ -1160,7 +1160,7 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length,
}
}
mutex_unlock(&lowpan_context_mutex, 0);
mutex_unlock(&lowpan_context_mutex);
}
else {
switch(((lowpan_iphc[1] & LOWPAN_IPHC_SAM) >> 4) & 0x03) {
@ -1223,7 +1223,7 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length,
}
// TODO:
mutex_unlock(&lowpan_context_mutex, 0);
mutex_unlock(&lowpan_context_mutex);
}
else {
/* If M=1 and DAC=0: */
@ -1326,7 +1326,7 @@ void lowpan_iphc_decoding(uint8_t *data, uint8_t length,
break;
}
mutex_unlock(&lowpan_context_mutex, 0);
mutex_unlock(&lowpan_context_mutex);
}
else {
switch((lowpan_iphc[1] & LOWPAN_IPHC_DAM) & 0x03) {
@ -1487,7 +1487,7 @@ void lowpan_context_auto_remove(void)
lowpan_context_remove(to_remove[i]);
}
mutex_unlock(&lowpan_context_mutex, 0);
mutex_unlock(&lowpan_context_mutex);
}
}

View File

@ -1,5 +1,7 @@
MODULE =transceiver
INCLUDES += -I$(RIOTBASE)/drivers/cc110x_ng/include
include $(MAKEBASE)/Makefile.base

View File

@ -79,6 +79,7 @@ static int update_shortterm(void)
void vtimer_tick(void *ptr)
{
(void) ptr;
DEBUG("vtimer_tick().");
seconds += SECONDS_PER_TICK;
@ -111,6 +112,7 @@ static int set_shortterm(vtimer_t *timer)
void vtimer_callback(void *ptr)
{
(void) ptr;
vtimer_t *timer;
in_callback = true;
hwtimer_id = -1;