mirror of
https://github.com/oliverschmidt/contiki.git
synced 2025-02-22 06:29:01 +00:00
Merge branch 'master' of ssh://contiki.git.sourceforge.net/gitroot/contiki/contiki
This commit is contained in:
commit
82ed40651a
@ -256,6 +256,13 @@ typedef struct periodic_resource_s periodic_resource_t;
|
|||||||
void name##_handler(void *, void *, uint8_t *, uint16_t, int32_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}
|
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
|
* Macro to define an event resource
|
||||||
* Like periodic resources, event resources have a post_handler that manages a subscriber list.
|
* Like periodic resources, event resources have a post_handler that manages a subscriber list.
|
||||||
|
@ -358,11 +358,14 @@ powercycle_turn_radio_on(void)
|
|||||||
static char
|
static char
|
||||||
powercycle(struct rtimer *t, void *ptr)
|
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);
|
PT_BEGIN(&pt);
|
||||||
|
|
||||||
#if SYNC_CYCLE_STARTS
|
#if SYNC_CYCLE_STARTS
|
||||||
static volatile rtimer_clock_t sync_cycle_start;
|
|
||||||
static volatile uint8_t sync_cycle_phase;
|
|
||||||
sync_cycle_start = RTIMER_NOW();
|
sync_cycle_start = RTIMER_NOW();
|
||||||
#else
|
#else
|
||||||
cycle_start = RTIMER_NOW();
|
cycle_start = RTIMER_NOW();
|
||||||
|
@ -179,9 +179,6 @@ void uip_log(char *msg);
|
|||||||
/** \name General variables
|
/** \name General variables
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
/** A pointer to the mac driver */
|
|
||||||
const struct mac_driver *sicslowpan_mac;
|
|
||||||
|
|
||||||
#ifdef SICSLOWPAN_NH_COMPRESSOR
|
#ifdef SICSLOWPAN_NH_COMPRESSOR
|
||||||
/** A pointer to the additional compressor */
|
/** A pointer to the additional compressor */
|
||||||
extern struct sicslowpan_nh_compressor SICSLOWPAN_NH_COMPRESSOR;
|
extern struct sicslowpan_nh_compressor SICSLOWPAN_NH_COMPRESSOR;
|
||||||
@ -1766,9 +1763,6 @@ input(void)
|
|||||||
void
|
void
|
||||||
sicslowpan_init(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
|
* Set out output function as the function to be called from uIP to
|
||||||
* send a packet.
|
* send a packet.
|
||||||
|
@ -321,6 +321,5 @@ struct sicslowpan_nh_compressor {
|
|||||||
|
|
||||||
extern const struct network_driver sicslowpan_driver;
|
extern const struct network_driver sicslowpan_driver;
|
||||||
|
|
||||||
extern const struct mac_driver *sicslowpan_mac;
|
|
||||||
#endif /* __SICSLOWPAN_H__ */
|
#endif /* __SICSLOWPAN_H__ */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
@ -145,6 +145,7 @@ create_llao(uint8_t *llao, uint8_t type) {
|
|||||||
void
|
void
|
||||||
uip_nd6_ns_input(void)
|
uip_nd6_ns_input(void)
|
||||||
{
|
{
|
||||||
|
uint8_t flags;
|
||||||
PRINTF("Received NS from ");
|
PRINTF("Received NS from ");
|
||||||
PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
|
PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
|
||||||
PRINTF(" to ");
|
PRINTF(" to ");
|
||||||
@ -154,8 +155,6 @@ uip_nd6_ns_input(void)
|
|||||||
PRINTF("\n");
|
PRINTF("\n");
|
||||||
UIP_STAT(++uip_stat.nd6.recv);
|
UIP_STAT(++uip_stat.nd6.recv);
|
||||||
|
|
||||||
uint8_t flags;
|
|
||||||
|
|
||||||
#if UIP_CONF_IPV6_CHECKS
|
#if UIP_CONF_IPV6_CHECKS
|
||||||
if((UIP_IP_BUF->ttl != UIP_ND6_HOP_LIMIT) ||
|
if((UIP_IP_BUF->ttl != UIP_ND6_HOP_LIMIT) ||
|
||||||
(uip_is_addr_mcast(&UIP_ND6_NS_BUF->tgtipaddr)) ||
|
(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
|
void
|
||||||
uip_nd6_na_input(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");
|
PRINTF("Received NA from");
|
||||||
PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
|
PRINT6ADDR(&UIP_IP_BUF->srcipaddr);
|
||||||
PRINTF("to");
|
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
|
* 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
|
* but it works. Be careful though, do not use tests such as is_router == 1
|
||||||
*/
|
*/
|
||||||
uint8_t is_llchange = 0;
|
is_llchange = 0;
|
||||||
uint8_t is_router = ((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_ROUTER));
|
is_router = ((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_ROUTER));
|
||||||
uint8_t is_solicited =
|
is_solicited =
|
||||||
((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_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));
|
((UIP_ND6_NA_BUF->flagsreserved & UIP_ND6_NA_FLAG_OVERRIDE));
|
||||||
|
|
||||||
#if UIP_CONF_IPV6_CHECKS
|
#if UIP_CONF_IPV6_CHECKS
|
||||||
|
@ -147,7 +147,9 @@ PROCESS_THREAD(udp_client_process, ev, data)
|
|||||||
{
|
{
|
||||||
static struct etimer periodic;
|
static struct etimer periodic;
|
||||||
static struct ctimer backoff_timer;
|
static struct ctimer backoff_timer;
|
||||||
|
#if WITH_COMPOWER
|
||||||
static int print = 0;
|
static int print = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
|
@ -45,9 +45,11 @@
|
|||||||
#include "dev/cooja-radio.h"
|
#include "dev/cooja-radio.h"
|
||||||
|
|
||||||
#define COOJA_RADIO_BUFSIZE PACKETBUF_SIZE
|
#define COOJA_RADIO_BUFSIZE PACKETBUF_SIZE
|
||||||
|
|
||||||
#define CCA_SS_THRESHOLD -95
|
#define CCA_SS_THRESHOLD -95
|
||||||
|
|
||||||
|
#define WITH_TURNAROUND 1
|
||||||
|
#define WITH_SEND_CCA 1
|
||||||
|
|
||||||
const struct simInterface radio_interface;
|
const struct simInterface radio_interface;
|
||||||
|
|
||||||
/* COOJA */
|
/* COOJA */
|
||||||
@ -109,16 +111,16 @@ radio_off(void)
|
|||||||
static void
|
static void
|
||||||
doInterfaceActionsBeforeTick(void)
|
doInterfaceActionsBeforeTick(void)
|
||||||
{
|
{
|
||||||
if (!simRadioHWOn) {
|
if(!simRadioHWOn) {
|
||||||
simInSize = 0;
|
simInSize = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (simReceiving) {
|
if(simReceiving) {
|
||||||
simLastSignalStrength = simSignalStrength;
|
simLastSignalStrength = simSignalStrength;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (simInSize > 0) {
|
if(simInSize > 0) {
|
||||||
process_poll(&cooja_radio_process);
|
process_poll(&cooja_radio_process);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -133,7 +135,7 @@ radio_read(void *buf, unsigned short bufsize)
|
|||||||
{
|
{
|
||||||
int tmp = simInSize;
|
int tmp = simInSize;
|
||||||
|
|
||||||
if (simInSize == 0) {
|
if(simInSize == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(bufsize < simInSize) {
|
if(bufsize < simInSize) {
|
||||||
@ -161,13 +163,10 @@ radio_send(const void *payload, unsigned short payload_len)
|
|||||||
{
|
{
|
||||||
int radiostate = simRadioHWOn;
|
int radiostate = simRadioHWOn;
|
||||||
|
|
||||||
/* XXX Simulate turnaround time of 1ms? */
|
/* Simulate turnaround time of 1ms */
|
||||||
#define WITH_TURNAROUND 1
|
|
||||||
#if WITH_TURNAROUND
|
#if WITH_TURNAROUND
|
||||||
printf("WITH_TURNAROUND\n");
|
|
||||||
simProcessRunValue = 1;
|
simProcessRunValue = 1;
|
||||||
cooja_mt_yield();
|
cooja_mt_yield();
|
||||||
printf("WITH_TURNAROUND post\n");
|
|
||||||
#endif /* WITH_TURNAROUND */
|
#endif /* WITH_TURNAROUND */
|
||||||
|
|
||||||
if(!simRadioHWOn) {
|
if(!simRadioHWOn) {
|
||||||
@ -184,11 +183,9 @@ radio_send(const void *payload, unsigned short payload_len)
|
|||||||
return RADIO_TX_ERR;
|
return RADIO_TX_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX Transmit only on CCA? */
|
/* Transmit on CCA */
|
||||||
#define WITH_SEND_CCA 1
|
|
||||||
#if WITH_SEND_CCA
|
#if WITH_SEND_CCA
|
||||||
if (!channel_clear()) {
|
if(!channel_clear()) {
|
||||||
printf("WITH_SEND_CCA return\n");
|
|
||||||
return RADIO_TX_COLLISION;
|
return RADIO_TX_COLLISION;
|
||||||
}
|
}
|
||||||
#endif /* WITH_SEND_CCA */
|
#endif /* WITH_SEND_CCA */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user