diff --git a/core/net/mac/csma.c b/core/net/mac/csma.c index e2776e35d..b8fa3c9a2 100644 --- a/core/net/mac/csma.c +++ b/core/net/mac/csma.c @@ -244,9 +244,7 @@ packet_sent(void *ptr, int status, int num_transmissions) /* This is needed to correctly attribute energy that we spent transmitting this packet. */ - q = list_head(queued_packet_list); - queuebuf_free(q->buf); - q->buf = queuebuf_new_from_packetbuf(); + queuebuf_update_attr_from_packetbuf(q->buf); } else { PRINTF("csma: drop with status %d after %d transmissions, %d collisions\n", diff --git a/core/net/mac/nullrdc.c b/core/net/mac/nullrdc.c index 6b8cbe2e3..b57dcb729 100644 --- a/core/net/mac/nullrdc.c +++ b/core/net/mac/nullrdc.c @@ -52,6 +52,12 @@ #define PRINTF(...) #endif +#ifdef NULLRDC_CONF_ADDRESS_FILTER +#define NULLRDC_ADDRESS_FILTER NULLRDC_CONF_ADDRESS_FILTER +#else +#define NULLRDC_ADDRESS_FILTER 1 +#endif /* NULLRDC_CONF_ADDRESS_FILTER */ + #ifndef NULLRDC_802154_AUTOACK #ifdef NULLRDC_CONF_802154_AUTOACK #define NULLRDC_802154_AUTOACK NULLRDC_CONF_802154_AUTOACK @@ -206,6 +212,13 @@ packet_input(void) #endif /* NULLRDC_802154_AUTOACK */ if(NETSTACK_FRAMER.parse() == 0) { PRINTF("nullrdc: failed to parse %u\n", packetbuf_datalen()); +#if NULLRDC_ADDRESS_FILTER + } else if(!rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), + &rimeaddr_node_addr) && + !rimeaddr_cmp(packetbuf_addr(PACKETBUF_ADDR_RECEIVER), + &rimeaddr_null)) { + PRINTF("nullrdc: not for us\n"); +#endif /* NULLRDC_ADDRESS_FILTER */ } else { #if NULLRDC_802154_AUTOACK || NULLRDC_802154_AUTOACK_HW /* Check for duplicate packet by comparing the sequence number diff --git a/core/net/queuebuf.c b/core/net/queuebuf.c index ca5988f7d..3a6bdbf10 100644 --- a/core/net/queuebuf.c +++ b/core/net/queuebuf.c @@ -163,6 +163,12 @@ queuebuf_new_from_packetbuf(void) } /*---------------------------------------------------------------------------*/ void +queuebuf_update_attr_from_packetbuf(struct queuebuf *buf) +{ + packetbuf_attr_copyto(buf->attrs, buf->addrs); +} +/*---------------------------------------------------------------------------*/ +void queuebuf_free(struct queuebuf *buf) { if(memb_inmemb(&bufmem, buf)) { diff --git a/core/net/queuebuf.h b/core/net/queuebuf.h index 92c4b9148..f9d434100 100644 --- a/core/net/queuebuf.h +++ b/core/net/queuebuf.h @@ -78,6 +78,7 @@ struct queuebuf *queuebuf_new_from_packetbuf_debug(const char *file, int line); #else /* QUEUEBUF_DEBUG */ struct queuebuf *queuebuf_new_from_packetbuf(void); #endif /* QUEUEBUF_DEBUG */ +void queuebuf_update_attr_from_packetbuf(struct queuebuf *b); void queuebuf_to_packetbuf(struct queuebuf *b); void queuebuf_free(struct queuebuf *b); diff --git a/cpu/avr/radio/rf230bb/halbb.c b/cpu/avr/radio/rf230bb/halbb.c index 178e338ef..c377db10e 100644 --- a/cpu/avr/radio/rf230bb/halbb.c +++ b/cpu/avr/radio/rf230bb/halbb.c @@ -735,26 +735,29 @@ hal_frame_write(uint8_t *write_buffer, uint8_t length) * \param length Length of the read burst * \param data Pointer to buffer where data is stored. */ -//void -//hal_sram_read(uint8_t address, uint8_t length, uint8_t *data) -//{ -// HAL_SPI_TRANSFER_OPEN(); +#if 0 //Uses 80 bytes (on Raven) omit unless needed +void +hal_sram_read(uint8_t address, uint8_t length, uint8_t *data) +{ + HAL_SPI_TRANSFER_OPEN(); - /*Send SRAM read command.*/ -// HAL_SPI_TRANSFER(0x00); + /*Send SRAM read command and address to start*/ + HAL_SPI_TRANSFER(0x00); + HAL_SPI_TRANSFER(address); - /*Send address where to start reading.*/ -// HAL_SPI_TRANSFER(address); + HAL_SPI_TRANSFER_WRITE(0); + HAL_SPI_TRANSFER_WAIT(); /*Upload the chosen memory area.*/ -// do{ -// *data++ = HAL_SPI_TRANSFER(0); -// } while (--length > 0); - -// HAL_SPI_TRANSFER_CLOSE(); - -//} + do{ + *data++ = HAL_SPI_TRANSFER_READ(); + HAL_SPI_TRANSFER_WRITE(0); + HAL_SPI_TRANSFER_WAIT(); + } while (--length > 0); + HAL_SPI_TRANSFER_CLOSE(); +} +#endif /*----------------------------------------------------------------------------*/ /** \brief Write SRAM * diff --git a/tools/collect-view/src/se/sics/contiki/collect/UDPConnection.java b/tools/collect-view/src/se/sics/contiki/collect/UDPConnection.java index 61b1fe2c5..7dd602bef 100644 --- a/tools/collect-view/src/se/sics/contiki/collect/UDPConnection.java +++ b/tools/collect-view/src/se/sics/contiki/collect/UDPConnection.java @@ -94,11 +94,11 @@ private DatagramSocket serverSocket; byte[] address = addr.getAddress(); /* Ignore latency for now */ out.printf(" %d %d %d %d", - (address[14] + (address[15] << 8))&0xffff, - seqno, hops, 0); + ((address[14] & 0xff) + + ((address[15] & 0xff) << 8))&0xffff, seqno, hops, 0); int d = 0; for(int i = 0; i < payloadLen ; i += 2) { - d = payload[i + 2] + (payload[i + 3] << 8); + d = (payload[i + 2] & 0xff) + ((payload[i + 3] & 0xff) << 8); out.printf(" %d", d & 0xffff); }