Merge branch 'master' of ssh://contiki.git.sourceforge.net/gitroot/contiki/contiki

This commit is contained in:
nvt 2012-03-15 21:47:12 +01:00
commit 82ed40651a
7 changed files with 34 additions and 28 deletions

View File

@ -256,6 +256,13 @@ typedef struct periodic_resource_s periodic_resource_t;
void name##_handler(void *, void *, uint8_t *, uint16_t, int32_t *); \
resource_t resource_##name = {NULL, flags, url, attributes, name##_handler, NULL, NULL, NULL}
/*
* Macro to define a sub-resource
* Make sure to define its parent resource beforehand and set 'parent' to that name.
*/
#define SUB_RESOURCE(name, flags, url, attributes, parent) \
resource_t resource_##name = {NULL, flags, url, attributes, parent##_handler, NULL, NULL, NULL}
/*
* Macro to define an event resource
* Like periodic resources, event resources have a post_handler that manages a subscriber list.

View File

@ -358,11 +358,14 @@ powercycle_turn_radio_on(void)
static char
powercycle(struct rtimer *t, void *ptr)
{
#if SYNC_CYCLE_STARTS
static volatile rtimer_clock_t sync_cycle_start;
static volatile uint8_t sync_cycle_phase;
#endif
PT_BEGIN(&pt);
#if SYNC_CYCLE_STARTS
static volatile rtimer_clock_t sync_cycle_start;
static volatile uint8_t sync_cycle_phase;
sync_cycle_start = RTIMER_NOW();
#else
cycle_start = RTIMER_NOW();

View File

@ -179,9 +179,6 @@ void uip_log(char *msg);
/** \name General variables
* @{
*/
/** A pointer to the mac driver */
const struct mac_driver *sicslowpan_mac;
#ifdef SICSLOWPAN_NH_COMPRESSOR
/** A pointer to the additional compressor */
extern struct sicslowpan_nh_compressor SICSLOWPAN_NH_COMPRESSOR;
@ -1766,9 +1763,6 @@ input(void)
void
sicslowpan_init(void)
{
/* remember the mac driver */
sicslowpan_mac = &NETSTACK_MAC;
/*
* Set out output function as the function to be called from uIP to
* send a packet.

View File

@ -321,6 +321,5 @@ struct sicslowpan_nh_compressor {
extern const struct network_driver sicslowpan_driver;
extern const struct mac_driver *sicslowpan_mac;
#endif /* __SICSLOWPAN_H__ */
/** @} */

View File

@ -145,6 +145,7 @@ create_llao(uint8_t *llao, uint8_t type) {
void
uip_nd6_ns_input(void)
{
uint8_t flags;
PRINTF("Received NS from ");
PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
PRINTF(" to ");
@ -154,8 +155,6 @@ uip_nd6_ns_input(void)
PRINTF("\n");
UIP_STAT(++uip_stat.nd6.recv);
uint8_t flags;
#if UIP_CONF_IPV6_CHECKS
if((UIP_IP_BUF->ttl != UIP_ND6_HOP_LIMIT) ||
(uip_is_addr_mcast(&UIP_ND6_NS_BUF->tgtipaddr)) ||
@ -390,6 +389,11 @@ uip_nd6_ns_output(uip_ipaddr_t * src, uip_ipaddr_t * dest, uip_ipaddr_t * tgt)
void
uip_nd6_na_input(void)
{
uint8_t is_llchange;
uint8_t is_router;
uint8_t is_solicited;
uint8_t is_override;
PRINTF("Received NA from");
PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
PRINTF("to");
@ -403,11 +407,11 @@ uip_nd6_na_input(void)
* booleans. the three last one are not 0 or 1 but 0 or 0x80, 0x40, 0x20
* but it works. Be careful though, do not use tests such as is_router == 1
*/
uint8_t is_llchange = 0;
uint8_t is_router = ((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_ROUTER));
uint8_t is_solicited =
is_llchange = 0;
is_router = ((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_ROUTER));
is_solicited =
((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_SOLICITED));
uint8_t is_override =
is_override =
((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_OVERRIDE));
#if UIP_CONF_IPV6_CHECKS

View File

@ -147,7 +147,9 @@ PROCESS_THREAD(udp_client_process, ev, data)
{
static struct etimer periodic;
static struct ctimer backoff_timer;
#if WITH_COMPOWER
static int print = 0;
#endif
PROCESS_BEGIN();

View File

@ -45,9 +45,11 @@
#include "dev/cooja-radio.h"
#define COOJA_RADIO_BUFSIZE PACKETBUF_SIZE
#define CCA_SS_THRESHOLD -95
#define WITH_TURNAROUND 1
#define WITH_SEND_CCA 1
const struct simInterface radio_interface;
/* COOJA */
@ -109,16 +111,16 @@ radio_off(void)
static void
doInterfaceActionsBeforeTick(void)
{
if (!simRadioHWOn) {
if(!simRadioHWOn) {
simInSize = 0;
return;
}
if (simReceiving) {
if(simReceiving) {
simLastSignalStrength = simSignalStrength;
return;
}
if (simInSize > 0) {
if(simInSize > 0) {
process_poll(&cooja_radio_process);
}
}
@ -133,7 +135,7 @@ radio_read(void *buf, unsigned short bufsize)
{
int tmp = simInSize;
if (simInSize == 0) {
if(simInSize == 0) {
return 0;
}
if(bufsize < simInSize) {
@ -161,13 +163,10 @@ radio_send(const void *payload, unsigned short payload_len)
{
int radiostate = simRadioHWOn;
/* XXX Simulate turnaround time of 1ms? */
#define WITH_TURNAROUND 1
/* Simulate turnaround time of 1ms */
#if WITH_TURNAROUND
printf("WITH_TURNAROUND\n");
simProcessRunValue = 1;
cooja_mt_yield();
printf("WITH_TURNAROUND post\n");
#endif /* WITH_TURNAROUND */
if(!simRadioHWOn) {
@ -184,11 +183,9 @@ radio_send(const void *payload, unsigned short payload_len)
return RADIO_TX_ERR;
}
/* XXX Transmit only on CCA? */
#define WITH_SEND_CCA 1
/* Transmit on CCA */
#if WITH_SEND_CCA
if (!channel_clear()) {
printf("WITH_SEND_CCA return\n");
if(!channel_clear()) {
return RADIO_TX_COLLISION;
}
#endif /* WITH_SEND_CCA */