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

This commit is contained in:
Nicolas Tsiftes 2011-06-23 13:47:50 +02:00
commit 17da1fb933
6 changed files with 42 additions and 21 deletions

View file

@ -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",

View file

@ -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

View file

@ -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)) {

View file

@ -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);

View file

@ -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
*

View file

@ -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);
}