Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
d955b179eb
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -36,6 +36,7 @@ symbols.*
|
||||||
Makefile.target
|
Makefile.target
|
||||||
doc/html
|
doc/html
|
||||||
patches-*
|
patches-*
|
||||||
|
tools/tunslip
|
||||||
tools/tunslip6
|
tools/tunslip6
|
||||||
build
|
build
|
||||||
tools/coffee-manager/build/
|
tools/coffee-manager/build/
|
||||||
|
|
|
@ -17,9 +17,8 @@ before_script:
|
||||||
| tar xjf - -C /tmp/ && sudo cp -f -r /tmp/arm-2008q3/* /usr/ && rm -rf /tmp/arm-2008q3 && arm-none-eabi-gcc --version || true"
|
| tar xjf - -C /tmp/ && sudo cp -f -r /tmp/arm-2008q3/* /usr/ && rm -rf /tmp/arm-2008q3 && arm-none-eabi-gcc --version || true"
|
||||||
|
|
||||||
## Install RL78 GCC chain (following the instructions in platform/eval-adf7xxxmb4z/README.md)
|
## Install RL78 GCC chain (following the instructions in platform/eval-adf7xxxmb4z/README.md)
|
||||||
- "sudo apt-get install git make gcc libc-dev multiarch-support libncurses5:i386 zlib1g:i386"
|
- "sudo apt-get install libncurses5:i386 zlib1g:i386 || true"
|
||||||
- "wget https://dl.dropboxusercontent.com/u/60522916/gnurl78-v13.02-elf_1-2_i386.deb"
|
- "wget http://adamdunkels.github.io/contiki-fork/gnurl78-v13.02-elf_1-2_i386.deb && sudo dpkg -i gnurl78*.deb || true"
|
||||||
- "sudo dpkg -i gnurl78*.deb"
|
|
||||||
|
|
||||||
## Install SDCC from a purpose-built bundle
|
## Install SDCC from a purpose-built bundle
|
||||||
- "[ ${BUILD_ARCH:-0} = 8051 ] && curl -s \
|
- "[ ${BUILD_ARCH:-0} = 8051 ] && curl -s \
|
||||||
|
|
|
@ -183,7 +183,7 @@ clean:
|
||||||
-rm -rf $(OBJECTDIR)
|
-rm -rf $(OBJECTDIR)
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
-rm -rf $(CONTIKI_PROJECT).$(TARGET)
|
-rm -f ${addsuffix .$(TARGET),$(CONTIKI_PROJECT)}
|
||||||
|
|
||||||
-include $(CONTIKI)/platform/$(TARGET)/Makefile.customrules-$(TARGET)
|
-include $(CONTIKI)/platform/$(TARGET)/Makefile.customrules-$(TARGET)
|
||||||
|
|
||||||
|
|
|
@ -651,7 +651,7 @@ reserve(const char *name, coffee_page_t pages,
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&hdr, 0, sizeof(hdr));
|
memset(&hdr, 0, sizeof(hdr));
|
||||||
memcpy(hdr.name, name, sizeof(hdr.name) - 1);
|
strncpy(hdr.name, name, sizeof(hdr.name) - 1);
|
||||||
hdr.max_pages = pages;
|
hdr.max_pages = pages;
|
||||||
hdr.flags = HDR_FLAG_ALLOCATED | flags;
|
hdr.flags = HDR_FLAG_ALLOCATED | flags;
|
||||||
write_header(&hdr, page);
|
write_header(&hdr, page);
|
||||||
|
|
|
@ -34,54 +34,58 @@
|
||||||
#include "sys/clock.h"
|
#include "sys/clock.h"
|
||||||
#include "sys/energest.h"
|
#include "sys/energest.h"
|
||||||
|
|
||||||
static unsigned char leds, invert;
|
static unsigned char leds;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
show_leds(unsigned char changed)
|
show_leds(unsigned char new_leds)
|
||||||
{
|
{
|
||||||
|
unsigned char changed;
|
||||||
|
changed = leds ^ new_leds;
|
||||||
|
leds = new_leds;
|
||||||
|
|
||||||
if(changed & LEDS_GREEN) {
|
if(changed & LEDS_GREEN) {
|
||||||
/* Green did change */
|
/* Green did change */
|
||||||
if((invert ^ leds) & LEDS_GREEN) {
|
if(leds & LEDS_GREEN) {
|
||||||
ENERGEST_ON(ENERGEST_TYPE_LED_GREEN);
|
ENERGEST_ON(ENERGEST_TYPE_LED_GREEN);
|
||||||
} else {
|
} else {
|
||||||
ENERGEST_OFF(ENERGEST_TYPE_LED_GREEN);
|
ENERGEST_OFF(ENERGEST_TYPE_LED_GREEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(changed & LEDS_YELLOW) {
|
if(changed & LEDS_YELLOW) {
|
||||||
if((invert ^ leds) & LEDS_YELLOW) {
|
if(leds & LEDS_YELLOW) {
|
||||||
ENERGEST_ON(ENERGEST_TYPE_LED_YELLOW);
|
ENERGEST_ON(ENERGEST_TYPE_LED_YELLOW);
|
||||||
} else {
|
} else {
|
||||||
ENERGEST_OFF(ENERGEST_TYPE_LED_YELLOW);
|
ENERGEST_OFF(ENERGEST_TYPE_LED_YELLOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(changed & LEDS_RED) {
|
if(changed & LEDS_RED) {
|
||||||
if((invert ^ leds) & LEDS_RED) {
|
if(leds & LEDS_RED) {
|
||||||
ENERGEST_ON(ENERGEST_TYPE_LED_RED);
|
ENERGEST_ON(ENERGEST_TYPE_LED_RED);
|
||||||
} else {
|
} else {
|
||||||
ENERGEST_OFF(ENERGEST_TYPE_LED_RED);
|
ENERGEST_OFF(ENERGEST_TYPE_LED_RED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
leds_arch_set(leds ^ invert);
|
leds_arch_set(leds);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
leds_init(void)
|
leds_init(void)
|
||||||
{
|
{
|
||||||
leds_arch_init();
|
leds_arch_init();
|
||||||
leds = invert = 0;
|
leds = 0;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
leds_blink(void)
|
leds_blink(void)
|
||||||
{
|
{
|
||||||
/* Blink all leds. */
|
/* Blink all leds that were initially off. */
|
||||||
unsigned char inv;
|
unsigned char blink;
|
||||||
inv = ~(leds ^ invert);
|
blink = ~leds;
|
||||||
leds_invert(inv);
|
leds_toggle(blink);
|
||||||
|
|
||||||
clock_delay(400);
|
clock_delay(400);
|
||||||
|
|
||||||
leds_invert(inv);
|
leds_toggle(blink);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
unsigned char
|
unsigned char
|
||||||
|
@ -90,33 +94,26 @@ leds_get(void) {
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
|
leds_set(unsigned char ledv)
|
||||||
|
{
|
||||||
|
show_leds(ledv);
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
leds_on(unsigned char ledv)
|
leds_on(unsigned char ledv)
|
||||||
{
|
{
|
||||||
unsigned char changed;
|
show_leds(leds | ledv);
|
||||||
changed = (~leds) & ledv;
|
|
||||||
leds |= ledv;
|
|
||||||
show_leds(changed);
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
leds_off(unsigned char ledv)
|
leds_off(unsigned char ledv)
|
||||||
{
|
{
|
||||||
unsigned char changed;
|
show_leds(leds & ~ledv);
|
||||||
changed = leds & ledv;
|
|
||||||
leds &= ~ledv;
|
|
||||||
show_leds(changed);
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
leds_toggle(unsigned char ledv)
|
leds_toggle(unsigned char ledv)
|
||||||
{
|
{
|
||||||
leds_invert(ledv);
|
show_leds(leds ^ ledv);
|
||||||
}
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
/* invert the invert register using the leds parameter */
|
|
||||||
void
|
|
||||||
leds_invert(unsigned char ledv) {
|
|
||||||
invert = invert ^ ledv;
|
|
||||||
show_leds(ledv);
|
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -77,13 +77,13 @@ void leds_blink(void);
|
||||||
#endif /* LEDS_CONF_ALL */
|
#endif /* LEDS_CONF_ALL */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current status of all leds (respects invert)
|
* Returns the current status of all leds
|
||||||
*/
|
*/
|
||||||
unsigned char leds_get(void);
|
unsigned char leds_get(void);
|
||||||
|
void leds_set(unsigned char leds);
|
||||||
void leds_on(unsigned char leds);
|
void leds_on(unsigned char leds);
|
||||||
void leds_off(unsigned char leds);
|
void leds_off(unsigned char leds);
|
||||||
void leds_toggle(unsigned char leds);
|
void leds_toggle(unsigned char leds);
|
||||||
void leds_invert(unsigned char leds);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Leds implementation
|
* Leds implementation
|
||||||
|
|
|
@ -28,9 +28,10 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef ASSERT_H
|
#ifndef ASSERT_H_
|
||||||
#define ASSERT_H
|
#define ASSERT_H_
|
||||||
|
|
||||||
|
#undef assert
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
#define assert(e) ((void)0)
|
#define assert(e) ((void)0)
|
||||||
#else
|
#else
|
||||||
|
@ -44,4 +45,4 @@ void _xassert(const char *, int);
|
||||||
#define __CTASSERT(x, y) typedef char __assert ## y[(x) ? 1 : -1]
|
#define __CTASSERT(x, y) typedef char __assert ## y[(x) ? 1 : -1]
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* ASSERT_H */
|
#endif /* ASSERT_H_ */
|
||||||
|
|
|
@ -1434,19 +1434,12 @@ output(const uip_lladdr_t *localdest)
|
||||||
* needs to be fragmented or not. */
|
* needs to be fragmented or not. */
|
||||||
#define USE_FRAMER_HDRLEN 1
|
#define USE_FRAMER_HDRLEN 1
|
||||||
#if USE_FRAMER_HDRLEN
|
#if USE_FRAMER_HDRLEN
|
||||||
packetbuf_clear();
|
|
||||||
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &dest);
|
packetbuf_set_addr(PACKETBUF_ADDR_RECEIVER, &dest);
|
||||||
framer_hdrlen = NETSTACK_FRAMER.create();
|
framer_hdrlen = NETSTACK_FRAMER.length();
|
||||||
if(framer_hdrlen < 0) {
|
if(framer_hdrlen < 0) {
|
||||||
/* Framing failed, we assume the maximum header length */
|
/* Framing failed, we assume the maximum header length */
|
||||||
framer_hdrlen = 21;
|
framer_hdrlen = 21;
|
||||||
}
|
}
|
||||||
packetbuf_clear();
|
|
||||||
|
|
||||||
/* We must set the max transmissions attribute again after clearing
|
|
||||||
the buffer. */
|
|
||||||
packetbuf_set_attr(PACKETBUF_ATTR_MAX_MAC_TRANSMISSIONS,
|
|
||||||
SICSLOWPAN_MAX_MAC_TRANSMISSIONS);
|
|
||||||
#else /* USE_FRAMER_HDRLEN */
|
#else /* USE_FRAMER_HDRLEN */
|
||||||
framer_hdrlen = 21;
|
framer_hdrlen = 21;
|
||||||
#endif /* USE_FRAMER_HDRLEN */
|
#endif /* USE_FRAMER_HDRLEN */
|
||||||
|
|
|
@ -87,7 +87,7 @@ is_broadcast_addr(uint8_t mode, uint8_t *addr)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int
|
static int
|
||||||
create(void)
|
create_frame(int type, int do_create)
|
||||||
{
|
{
|
||||||
frame802154_t params;
|
frame802154_t params;
|
||||||
int len;
|
int len;
|
||||||
|
@ -115,20 +115,24 @@ create(void)
|
||||||
params.fcf.frame_version = FRAME802154_IEEE802154_2003;
|
params.fcf.frame_version = FRAME802154_IEEE802154_2003;
|
||||||
|
|
||||||
/* Increment and set the data sequence number. */
|
/* Increment and set the data sequence number. */
|
||||||
if(packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO)) {
|
if(!do_create) {
|
||||||
|
/* Only length calculation - no sequence number is needed and
|
||||||
|
should not be consumed. */
|
||||||
|
|
||||||
|
} else if(packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO)) {
|
||||||
params.seq = packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO);
|
params.seq = packetbuf_attr(PACKETBUF_ATTR_MAC_SEQNO);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
params.seq = mac_dsn++;
|
params.seq = mac_dsn++;
|
||||||
packetbuf_set_attr(PACKETBUF_ATTR_MAC_SEQNO, params.seq);
|
packetbuf_set_attr(PACKETBUF_ATTR_MAC_SEQNO, params.seq);
|
||||||
}
|
}
|
||||||
/* params.seq = packetbuf_attr(PACKETBUF_ATTR_PACKET_ID); */
|
|
||||||
|
|
||||||
/* Complete the addressing fields. */
|
/* Complete the addressing fields. */
|
||||||
/**
|
/**
|
||||||
\todo For phase 1 the addresses are all long. We'll need a mechanism
|
\todo For phase 1 the addresses are all long. We'll need a mechanism
|
||||||
in the rime attributes to tell the mac to use long or short for phase 2.
|
in the rime attributes to tell the mac to use long or short for phase 2.
|
||||||
*/
|
*/
|
||||||
if(sizeof(linkaddr_t) == 2) {
|
if(LINKADDR_SIZE == 2) {
|
||||||
/* Use short address mode if linkaddr size is short. */
|
/* Use short address mode if linkaddr size is short. */
|
||||||
params.fcf.src_addr_mode = FRAME802154_SHORTADDRMODE;
|
params.fcf.src_addr_mode = FRAME802154_SHORTADDRMODE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -150,7 +154,7 @@ create(void)
|
||||||
linkaddr_copy((linkaddr_t *)¶ms.dest_addr,
|
linkaddr_copy((linkaddr_t *)¶ms.dest_addr,
|
||||||
packetbuf_addr(PACKETBUF_ADDR_RECEIVER));
|
packetbuf_addr(PACKETBUF_ADDR_RECEIVER));
|
||||||
/* Use short address mode if linkaddr size is small */
|
/* Use short address mode if linkaddr size is small */
|
||||||
if(sizeof(linkaddr_t) == 2) {
|
if(LINKADDR_SIZE == 2) {
|
||||||
params.fcf.dest_addr_mode = FRAME802154_SHORTADDRMODE;
|
params.fcf.dest_addr_mode = FRAME802154_SHORTADDRMODE;
|
||||||
} else {
|
} else {
|
||||||
params.fcf.dest_addr_mode = FRAME802154_LONGADDRMODE;
|
params.fcf.dest_addr_mode = FRAME802154_LONGADDRMODE;
|
||||||
|
@ -169,7 +173,11 @@ create(void)
|
||||||
params.payload = packetbuf_dataptr();
|
params.payload = packetbuf_dataptr();
|
||||||
params.payload_len = packetbuf_datalen();
|
params.payload_len = packetbuf_datalen();
|
||||||
len = frame802154_hdrlen(¶ms);
|
len = frame802154_hdrlen(¶ms);
|
||||||
if(packetbuf_hdralloc(len)) {
|
if(!do_create) {
|
||||||
|
/* Only calculate header length */
|
||||||
|
return len;
|
||||||
|
|
||||||
|
} else if(packetbuf_hdralloc(len)) {
|
||||||
frame802154_create(¶ms, packetbuf_hdrptr(), len);
|
frame802154_create(¶ms, packetbuf_hdrptr(), len);
|
||||||
|
|
||||||
PRINTF("15.4-OUT: %2X", params.fcf.frame_type);
|
PRINTF("15.4-OUT: %2X", params.fcf.frame_type);
|
||||||
|
@ -184,6 +192,18 @@ create(void)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int
|
static int
|
||||||
|
hdr_length(void)
|
||||||
|
{
|
||||||
|
return create_frame(FRAME802154_DATAFRAME, 0);
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static int
|
||||||
|
create(void)
|
||||||
|
{
|
||||||
|
return create_frame(FRAME802154_DATAFRAME, 1);
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static int
|
||||||
parse(void)
|
parse(void)
|
||||||
{
|
{
|
||||||
frame802154_t frame;
|
frame802154_t frame;
|
||||||
|
@ -218,5 +238,5 @@ parse(void)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
const struct framer framer_802154 = {
|
const struct framer framer_802154 = {
|
||||||
create, parse
|
hdr_length, create, parse
|
||||||
};
|
};
|
||||||
|
|
|
@ -55,6 +55,12 @@ struct nullmac_hdr {
|
||||||
linkaddr_t sender;
|
linkaddr_t sender;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static int
|
||||||
|
hdr_length(void)
|
||||||
|
{
|
||||||
|
return sizeof(struct nullmac_hdr);
|
||||||
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int
|
static int
|
||||||
create(void)
|
create(void)
|
||||||
|
@ -91,5 +97,5 @@ parse(void)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
const struct framer framer_nullmac = {
|
const struct framer framer_nullmac = {
|
||||||
create, parse
|
hdr_length, create, parse
|
||||||
};
|
};
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
|
|
||||||
struct framer {
|
struct framer {
|
||||||
|
|
||||||
|
int (* length)(void);
|
||||||
int (* create)(void);
|
int (* create)(void);
|
||||||
int (* parse)(void);
|
int (* parse)(void);
|
||||||
|
|
||||||
|
|
|
@ -434,7 +434,7 @@ void packetbuf_attr_copyfrom(struct packetbuf_attr *attrs,
|
||||||
|
|
||||||
#define PACKETBUF_ATTR_BIT 1
|
#define PACKETBUF_ATTR_BIT 1
|
||||||
#define PACKETBUF_ATTR_BYTE 8
|
#define PACKETBUF_ATTR_BYTE 8
|
||||||
#define PACKETBUF_ADDRSIZE (sizeof(linkaddr_t) * PACKETBUF_ATTR_BYTE)
|
#define PACKETBUF_ADDRSIZE (LINKADDR_SIZE * PACKETBUF_ATTR_BYTE)
|
||||||
|
|
||||||
struct packetbuf_attrlist {
|
struct packetbuf_attrlist {
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
|
|
|
@ -162,7 +162,7 @@
|
||||||
* Initial metric attributed to a link when the ETX is unknown
|
* Initial metric attributed to a link when the ETX is unknown
|
||||||
*/
|
*/
|
||||||
#ifndef RPL_CONF_INIT_LINK_METRIC
|
#ifndef RPL_CONF_INIT_LINK_METRIC
|
||||||
#define RPL_INIT_LINK_METRIC 5
|
#define RPL_INIT_LINK_METRIC 2
|
||||||
#else
|
#else
|
||||||
#define RPL_INIT_LINK_METRIC RPL_CONF_INIT_LINK_METRIC
|
#define RPL_INIT_LINK_METRIC RPL_CONF_INIT_LINK_METRIC
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -58,8 +58,4 @@ leds_off(unsigned char leds)
|
||||||
void
|
void
|
||||||
leds_toggle(unsigned char leds)
|
leds_toggle(unsigned char leds)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Synonym: void leds_invert(unsigned char leds);
|
|
||||||
*/
|
|
||||||
asm(".global leds_invert\nleds_invert:\n");
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,10 +49,36 @@ ieee_addr_cpy_to(uint8_t *dst, uint8_t len)
|
||||||
|
|
||||||
memcpy(dst, &ieee_addr_hc[8 - len], len);
|
memcpy(dst, &ieee_addr_hc[8 - len], len);
|
||||||
} else {
|
} else {
|
||||||
/* Reading from Info Page, we need to invert byte order */
|
/*
|
||||||
|
* By default, we assume that the IEEE address is stored on flash using
|
||||||
|
* little-endian byte order.
|
||||||
|
*
|
||||||
|
* However, some SoCs ship with a different byte order, whereby the first
|
||||||
|
* four bytes are flipped with the four last ones.
|
||||||
|
*
|
||||||
|
* Using this address as an example: 00 12 4B 00 01 02 03 04
|
||||||
|
* We expect it stored as: 04 03 02 01 00 4B 12 00
|
||||||
|
* But it is also possible to encounter: 00 4B 12 00 04 03 02 01
|
||||||
|
*
|
||||||
|
* Thus: read locations [3, 2, 1] and if we encounter the TI OUI, flip the
|
||||||
|
* order of the two 4-byte sequences. Each of the 4-byte sequences is still
|
||||||
|
* little-endian.
|
||||||
|
*/
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < len; i++) {
|
uint8_t oui_ti[3] = IEEE_ADDR_OUI_TI;
|
||||||
dst[i] = ((uint8_t *)IEEE_ADDR_LOCATION)[len - 1 - i];
|
if(((uint8_t *)IEEE_ADDR_LOCATION)[3] == oui_ti[0]
|
||||||
|
&& ((uint8_t *)IEEE_ADDR_LOCATION)[2] == oui_ti[1]
|
||||||
|
&& ((uint8_t *)IEEE_ADDR_LOCATION)[1] == oui_ti[2]) {
|
||||||
|
for(i = 0; i < len / 2; i++) {
|
||||||
|
dst[i] = ((uint8_t *)IEEE_ADDR_LOCATION)[len / 2 - 1 - i];
|
||||||
|
}
|
||||||
|
for(i = 0; i < len / 2; i++) {
|
||||||
|
dst[i + len / 2] = ((uint8_t *)IEEE_ADDR_LOCATION)[len - 1 - i];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for(i = 0; i < len; i++) {
|
||||||
|
dst[i] = ((uint8_t *)IEEE_ADDR_LOCATION)[len - 1 - i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,11 +49,27 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
* \name IEEE address locations
|
* \name TI OUI
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
#define IEEE_ADDR_LOCATION_PRIMARY 0x00280028 /**< IEEE address location */
|
#define IEEE_ADDR_OUI_TI { 0x00, 0x12, 0x4B } /**< TI OUI */
|
||||||
#define IEEE_ADDR_LOCATION_SECONDARY 0x0027FFCC /**< IEEE address location */
|
/** @} */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/**
|
||||||
|
* \name IEEE address locations
|
||||||
|
*
|
||||||
|
* The address of the secondary location can be configured by the platform
|
||||||
|
* or example
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
#define IEEE_ADDR_LOCATION_PRIMARY 0x00280028 /**< Primary IEEE address location */
|
||||||
|
|
||||||
|
#ifdef IEEE_ADDR_CONF_LOCATION_SECONDARY
|
||||||
|
#define IEEE_ADDR_LOCATION_SECONDARY IEEE_ADDR_CONF_LOCATION_SECONDARY
|
||||||
|
#else
|
||||||
|
#define IEEE_ADDR_LOCATION_SECONDARY 0x0027FFCC /**< Secondary IEEE address location */
|
||||||
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -59,7 +59,7 @@ void
|
||||||
cc2420_arch_sfd_init(void)
|
cc2420_arch_sfd_init(void)
|
||||||
{
|
{
|
||||||
/* Need to select the special function! */
|
/* Need to select the special function! */
|
||||||
P4SEL = BV(CC2420_SFD_PIN);
|
CC2420_SFD_PORT(SEL) = BV(CC2420_SFD_PIN);
|
||||||
|
|
||||||
/* start timer B - 32768 ticks per second */
|
/* start timer B - 32768 ticks per second */
|
||||||
TBCTL = TBSSEL_1 | TBCLR;
|
TBCTL = TBSSEL_1 | TBCLR;
|
||||||
|
|
|
@ -58,7 +58,7 @@ void
|
||||||
cc2520_arch_sfd_init(void)
|
cc2520_arch_sfd_init(void)
|
||||||
{
|
{
|
||||||
/* Need to select the special function! */
|
/* Need to select the special function! */
|
||||||
P4SEL = BV(CC2520_SFD_PIN);
|
CC2520_SFD_PORT(SEL) = BV(CC2520_SFD_PIN);
|
||||||
|
|
||||||
/* start timer B - 32768 ticks per second */
|
/* start timer B - 32768 ticks per second */
|
||||||
TBCTL = TBSSEL_1 | TBCLR;
|
TBCTL = TBSSEL_1 | TBCLR;
|
||||||
|
|
|
@ -74,10 +74,5 @@ leds_off(unsigned char leds)
|
||||||
void
|
void
|
||||||
leds_toggle(unsigned char leds)
|
leds_toggle(unsigned char leds)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Synonym: void leds_invert(unsigned char leds);
|
|
||||||
*/
|
|
||||||
asm(".global leds_invert\nleds_invert:\n");
|
|
||||||
|
|
||||||
LEDS_PxOUT ^= l2p[leds & LEDS_ALL];
|
LEDS_PxOUT ^= l2p[leds & LEDS_ALL];
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,6 @@ RESOURCE(res_toggle,
|
||||||
static void
|
static void
|
||||||
res_post_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
|
res_post_handler(void *request, void *response, uint8_t *buffer, uint16_t preferred_size, int32_t *offset)
|
||||||
{
|
{
|
||||||
leds_invert(LEDS_RED);
|
leds_toggle(LEDS_RED);
|
||||||
}
|
}
|
||||||
#endif /* PLATFORM_HAS_LEDS */
|
#endif /* PLATFORM_HAS_LEDS */
|
||||||
|
|
|
@ -76,6 +76,13 @@ is_broadcast_addr(uint8_t mode, uint8_t *addr)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int
|
static int
|
||||||
|
hdr_length(void)
|
||||||
|
{
|
||||||
|
/* never adds any header */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static int
|
||||||
create(void)
|
create(void)
|
||||||
{
|
{
|
||||||
/* nothing extra... */
|
/* nothing extra... */
|
||||||
|
@ -116,5 +123,5 @@ parse(void)
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
const struct framer no_framer = {
|
const struct framer no_framer = {
|
||||||
create, parse
|
hdr_length, create, parse
|
||||||
};
|
};
|
||||||
|
|
|
@ -85,7 +85,7 @@ typedef unsigned long clock_time_t;
|
||||||
|
|
||||||
typedef unsigned long rtimer_clock_t;
|
typedef unsigned long rtimer_clock_t;
|
||||||
|
|
||||||
#define RTIMER_CLOCK_LT(a,b) ((signed short)((a)-(b)) < 0)
|
#define RTIMER_CLOCK_LT(a,b) ((signed long)((a)-(b)) < 0)
|
||||||
|
|
||||||
#define LEDS_CONF_RED_PIN boardDescription->io->leds[1].gpioPin
|
#define LEDS_CONF_RED_PIN boardDescription->io->leds[1].gpioPin
|
||||||
#define LEDS_CONF_GREEN_PIN boardDescription->io->leds[0].gpioPin
|
#define LEDS_CONF_GREEN_PIN boardDescription->io->leds[0].gpioPin
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
#include "net/wpcap-drv.h"
|
#include "net/wpcap-drv.h"
|
||||||
|
@ -190,6 +191,7 @@ main(int argc, char **argv)
|
||||||
process_init();
|
process_init();
|
||||||
process_start(&etimer_process, NULL);
|
process_start(&etimer_process, NULL);
|
||||||
ctimer_init();
|
ctimer_init();
|
||||||
|
rtimer_init();
|
||||||
|
|
||||||
#if WITH_GUI
|
#if WITH_GUI
|
||||||
process_start(&ctk_process, NULL);
|
process_start(&ctk_process, NULL);
|
||||||
|
@ -197,12 +199,12 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
set_rime_addr();
|
set_rime_addr();
|
||||||
|
|
||||||
queuebuf_init();
|
|
||||||
|
|
||||||
netstack_init();
|
netstack_init();
|
||||||
printf("MAC %s RDC %s NETWORK %s\n", NETSTACK_MAC.name, NETSTACK_RDC.name, NETSTACK_NETWORK.name);
|
printf("MAC %s RDC %s NETWORK %s\n", NETSTACK_MAC.name, NETSTACK_RDC.name, NETSTACK_NETWORK.name);
|
||||||
|
|
||||||
#if WITH_UIP6
|
#if WITH_UIP6
|
||||||
|
queuebuf_init();
|
||||||
|
|
||||||
memcpy(&uip_lladdr.addr, serial_id, sizeof(uip_lladdr.addr));
|
memcpy(&uip_lladdr.addr, serial_id, sizeof(uip_lladdr.addr));
|
||||||
|
|
||||||
process_start(&tcpip_process, NULL);
|
process_start(&tcpip_process, NULL);
|
||||||
|
@ -259,7 +261,9 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
retval = select(maxfd + 1, &fdr, &fdw, NULL, &tv);
|
retval = select(maxfd + 1, &fdr, &fdw, NULL, &tv);
|
||||||
if(retval < 0) {
|
if(retval < 0) {
|
||||||
perror("select");
|
if(errno != EINTR) {
|
||||||
|
perror("select");
|
||||||
|
}
|
||||||
} else if(retval > 0) {
|
} else if(retval > 0) {
|
||||||
/* timeout => retval == 0 */
|
/* timeout => retval == 0 */
|
||||||
for(i = 0; i <= maxfd; i++) {
|
for(i = 0; i <= maxfd; i++) {
|
||||||
|
|
|
@ -338,7 +338,7 @@ main(int argc, char **argv)
|
||||||
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
NETSTACK_MAC.name, NETSTACK_RDC.name,
|
||||||
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0? 1:
|
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0? 1:
|
||||||
NETSTACK_RDC.channel_check_interval()),
|
NETSTACK_RDC.channel_check_interval()),
|
||||||
CC2420_CONF_CCA_THRESH);
|
CC2420_CONF_CHANNEL);
|
||||||
#endif /* WITH_UIP6 */
|
#endif /* WITH_UIP6 */
|
||||||
|
|
||||||
#if !WITH_UIP && !WITH_UIP6
|
#if !WITH_UIP && !WITH_UIP6
|
||||||
|
|
|
@ -64,7 +64,7 @@ tcpip_output(const uip_lladdr_t *a)
|
||||||
/* printf("pppp o %u tx %u rx %u\n", UIP_IP_BUF->proto,
|
/* printf("pppp o %u tx %u rx %u\n", UIP_IP_BUF->proto,
|
||||||
packetbuf_attr(PACKETBUF_ATTR_TRANSMIT_TIME),
|
packetbuf_attr(PACKETBUF_ATTR_TRANSMIT_TIME),
|
||||||
packetbuf_attr(PACKETBUF_ATTR_LISTEN_TIME));*/
|
packetbuf_attr(PACKETBUF_ATTR_LISTEN_TIME));*/
|
||||||
leds_invert(LEDS_GREEN);
|
leds_toggle(LEDS_GREEN);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ tcpip_input(void)
|
||||||
packetbuf_attr(PACKETBUF_ATTR_TRANSMIT_TIME),
|
packetbuf_attr(PACKETBUF_ATTR_TRANSMIT_TIME),
|
||||||
packetbuf_attr(PACKETBUF_ATTR_LISTEN_TIME));*/
|
packetbuf_attr(PACKETBUF_ATTR_LISTEN_TIME));*/
|
||||||
slip_write(uip_buf, uip_len);
|
slip_write(uip_buf, uip_len);
|
||||||
leds_invert(LEDS_RED);
|
leds_toggle(LEDS_RED);
|
||||||
uip_len = 0;
|
uip_len = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ slip_tcpip_input(void)
|
||||||
static void
|
static void
|
||||||
slip_activity(void)
|
slip_activity(void)
|
||||||
{
|
{
|
||||||
leds_invert(LEDS_BLUE);
|
leds_toggle(LEDS_BLUE);
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
PROCESS_THREAD(uip6_bridge, ev, data)
|
PROCESS_THREAD(uip6_bridge, ev, data)
|
||||||
|
|
|
@ -968,7 +968,7 @@ void mac_802154raw(const struct radio_driver *radio)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
slip_write(uip_buf, len);
|
slip_write(uip_buf, len);
|
||||||
leds_invert(LEDS_RED);
|
leds_toggle(LEDS_RED);
|
||||||
|
|
||||||
//rndis_send(raw_buf, sendlen, 1);
|
//rndis_send(raw_buf, sendlen, 1);
|
||||||
//rndis_stat.rxok++;
|
//rndis_stat.rxok++;
|
||||||
|
|
Loading…
Reference in a new issue