Merge remote-tracking branch 'origin/master'

This commit is contained in:
Oliver Schmidt 2011-05-21 11:50:56 +02:00
commit 3d9771403e
54 changed files with 181 additions and 204 deletions

View file

@ -90,8 +90,8 @@ powertrace_print(char *str)
all_lpm = energest_type_time(ENERGEST_TYPE_LPM);
all_transmit = energest_type_time(ENERGEST_TYPE_TRANSMIT);
all_listen = energest_type_time(ENERGEST_TYPE_LISTEN);
all_idle_transmit = compower_idle_activity.transmit - last_idle_transmit;
all_idle_listen = compower_idle_activity.listen - last_idle_listen;
all_idle_transmit = compower_idle_activity.transmit;
all_idle_listen = compower_idle_activity.listen;
cpu = all_cpu - last_cpu;
lpm = all_lpm - last_lpm;
@ -267,7 +267,7 @@ input_sniffer(void)
}
/*---------------------------------------------------------------------------*/
static void
output_sniffer(void)
output_sniffer(int mac_status)
{
add_packet_stats(OUTPUT);
}
@ -293,7 +293,7 @@ input_printsniffer(void)
}
/*---------------------------------------------------------------------------*/
static void
output_printsniffer(void)
output_printsniffer(int mac_status)
{
static int seqno = 0;
sniffprint("O", seqno++);

View file

@ -114,7 +114,7 @@ input_sniffer(void)
}
/*---------------------------------------------------------------------------*/
static void
output_sniffer(void)
output_sniffer(int mac_status)
{
if(sniff_for_attributes) {
sniff_attributes_output(SNIFFER_ATTRIBUTES_OUTPUT);

View file

@ -329,7 +329,10 @@ schedule_powercycle_fixed(struct rtimer *t, rtimer_clock_t fixed_time)
static void
powercycle_turn_radio_off(void)
{
#if CONTIKIMAC_CONF_COMPOWER
uint8_t was_on = radio_is_on;
#endif /* CONTIKIMAC_CONF_COMPOWER */
if(we_are_sending == 0) {
off();
#if CONTIKIMAC_CONF_COMPOWER
@ -633,35 +636,35 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr)
}
packetbuf_set_attr(PACKETBUF_ATTR_MAC_ACK, 1);
if(WITH_CONTIKIMAC_HEADER) {
hdrlen = packetbuf_totlen();
if(packetbuf_hdralloc(sizeof(struct hdr)) == 0) {
/* Failed to allocate space for contikimac header */
PRINTF("contikimac: send failed, too large header\n");
return MAC_TX_ERR_FATAL;
}
chdr = packetbuf_hdrptr();
chdr->id = CONTIKIMAC_ID;
chdr->len = hdrlen;
/* Create the MAC header for the data packet. */
hdrlen = NETSTACK_FRAMER.create();
if(hdrlen == 0) {
/* Failed to send */
PRINTF("contikimac: send failed, too large header\n");
packetbuf_hdr_remove(sizeof(struct hdr));
return MAC_TX_ERR_FATAL;
}
hdrlen += sizeof(struct hdr);
} else {
/* Create the MAC header for the data packet. */
hdrlen = NETSTACK_FRAMER.create();
if(hdrlen == 0) {
/* Failed to send */
PRINTF("contikimac: send failed, too large header\n");
return MAC_TX_ERR_FATAL;
}
#if WITH_CONTIKIMAC_HEADER
hdrlen = packetbuf_totlen();
if(packetbuf_hdralloc(sizeof(struct hdr)) == 0) {
/* Failed to allocate space for contikimac header */
PRINTF("contikimac: send failed, too large header\n");
return MAC_TX_ERR_FATAL;
}
chdr = packetbuf_hdrptr();
chdr->id = CONTIKIMAC_ID;
chdr->len = hdrlen;
/* Create the MAC header for the data packet. */
hdrlen = NETSTACK_FRAMER.create();
if(hdrlen == 0) {
/* Failed to send */
PRINTF("contikimac: send failed, too large header\n");
packetbuf_hdr_remove(sizeof(struct hdr));
return MAC_TX_ERR_FATAL;
}
hdrlen += sizeof(struct hdr);
#else
/* Create the MAC header for the data packet. */
hdrlen = NETSTACK_FRAMER.create();
if(hdrlen == 0) {
/* Failed to send */
PRINTF("contikimac: send failed, too large header\n");
return MAC_TX_ERR_FATAL;
}
#endif
/* Make sure that the packet is longer or equal to the shortest

View file

@ -765,7 +765,7 @@ uncompress_hdr_hc06(uint16_t ip_len)
SICSLOWPAN_IP_BUF->vtc = 0x60 | ((*hc06_ptr >> 2) & 0x0f);
SICSLOWPAN_IP_BUF->tcflow = ((*hc06_ptr << 6) & 0xC0) | ((*hc06_ptr >> 2) & 0x30);
SICSLOWPAN_IP_BUF->flow = 0;
hc06_ptr += 3;
hc06_ptr += 1;
} else {
/* Traffic class is compressed */
SICSLOWPAN_IP_BUF->vtc = 0x60;

View file

@ -474,6 +474,11 @@ uip_connect(uip_ipaddr_t *ripaddr, u16_t rport)
conn->snd_nxt[2] = iss[2];
conn->snd_nxt[3] = iss[3];
conn->rcv_nxt[0] = 0;
conn->rcv_nxt[1] = 0;
conn->rcv_nxt[2] = 0;
conn->rcv_nxt[3] = 0;
conn->initialmss = conn->mss = UIP_TCP_MSS;
conn->len = 1; /* TCP length of the SYN is one. */

View file

@ -63,6 +63,8 @@ compower_accumulate(struct compower_activity *e)
static uint32_t last_listen, last_transmit;
uint32_t listen, transmit;
energest_flush();
listen = energest_type_time(ENERGEST_TYPE_LISTEN);
e->listen += listen - last_listen;
last_listen = listen;

View file

@ -36,6 +36,10 @@
#ifndef BOARD_FREESCALE_NCB_H
#define BOARD_FREESCALE_NCB_H
#define GPIO_LED_RED GPIO_23
#define GPIO_LED_GREEN GPIO_24
#define GPIO_LED_BLUE GPIO_25
#define LED_RED 23
#define LED_GREEN 24
#define LED_BLUE 25

View file

@ -55,6 +55,10 @@
#define BUTTON2_OUT (0x1ULL << 22)
#define BUTTON2_IN (0x1ULL << 26)
#define GPIO_LED_RED GPIO_12
#define GPIO_LED_GREEN GPIO_21
#define GPIO_LED_BLUE GPIO_35
#define LED_RED 12
#define LED_GREEN 21
#define LED_BLUE 35

View file

@ -36,6 +36,10 @@
#ifndef BOARD_REDBEE_DEV_H
#define BOARD_REDBEE_DEV_H
#define GPIO_LED_RED GPIO_23
#define GPIO_LED_GREEN GPIO_24
#define GPIO_LED_BLUE GPIO_25
#define LED_RED 23
#define LED_GREEN 24
#define LED_BLUE 25

View file

@ -36,6 +36,10 @@
#ifndef BOARD_REDBEE_R1_H
#define BOARD_REDBEE_R1_H
#define GPIO_LED_RED GPIO_08
#define GPIO_LED_GREEN GPIO_09
#define GPIO_LED_BLUE GPIO_10
#define LED_RED 8
#define LED_GREEN 9
#define LED_BLUE 10

View file

@ -36,6 +36,10 @@
#ifndef BOARD_REDBEE_USB_H
#define BOARD_REDBEE_USB_H
#define GPIO_LED_RED GPIO_23
#define GPIO_LED_GREEN GPIO_24
#define GPIO_LED_BLUE GPIO_25
#define LED_RED 23
#define LED_GREEN 24
#define LED_BLUE 25

View file

@ -72,6 +72,10 @@
#define CPL_TIMEOUT (2*128*CLK_PER_BYTE)
#endif
#ifndef MACA_INSERT_ACK
#define MACA_INSERT_ACK 1
#endif
#define reg(x) (*(volatile uint32_t *)(x))
int count_packets(void);
@ -534,6 +538,32 @@ void add_to_rx(volatile packet_t *p) {
return;
}
void insert_at_rx_head(volatile packet_t *p) {
safe_irq_disable(MACA);
BOUND_CHECK(p);
if(!p) { PRINTF("insert_at_rx_head passed packet 0\n\r"); return; }
p->offset = 1; /* first byte is the length */
if(rx_head == 0) {
/* start a new queue if empty */
rx_end = p;
rx_end->left = 0; rx_end->right = 0;
rx_head = rx_end;
} else {
rx_head->right = p;
p->left = rx_head;
rx_head = p; rx_head->left = 0;
}
// print_packets("insert at rx head");
irq_restore();
if(bit_is_set(*NIPEND, INT_NUM_MACA)) { *INTFRC = (1 << INT_NUM_MACA); }
return;
}
void decode_status(void) {
volatile uint32_t code;
@ -620,7 +650,7 @@ void maca_isr(void) {
dma_rx->rx_time = *MACA_TIMESTAMP;
/* check if received packet needs an ack */
if(dma_rx->data[1] & 0x20) {
if(prm_mode == AUTOACK && (dma_rx->data[1] & 0x20)) {
/* this wait is necessary to auto-ack */
volatile uint32_t wait_clk;
wait_clk = *MACA_CLK + 200;
@ -652,6 +682,21 @@ void maca_isr(void) {
/* PRINTF("maca action complete %d\n\r", get_field(*MACA_CONTROL,SEQUENCE)); */
if(last_post == TX_POST) {
tx_head->status = get_field(*MACA_STATUS,CODE);
#if MACA_INSERT_ACK
if(tx_head->status == SUCCESS) {
static volatile packet_t *ack_p;
if(ack_p = get_free_packet()) {
ack_p->length = 3;
ack_p->offset = 1;
ack_p->data[0] = 3;
ack_p->data[1] = 0x02;
ack_p->data[2] = 0;
ack_p->data[3] = *MACA_TXSEQNR;
insert_at_rx_head(ack_p);
}
}
#endif
if(maca_tx_callback != 0) { maca_tx_callback(tx_head); }
dma_tx = 0;
free_tx_head();

View file

@ -78,11 +78,14 @@ void uart1_init(uint16_t inc, uint16_t mod, uint8_t samp) {
if(samp == UCON_SAMP_16X)
set_bit(*UART1_UCON,UCON_SAMP);
*GPIO_FUNC_SEL0 = ( (0x01 << (14*2)) | (0x01 << (15*2)) ); /* set GPIO15-14 to UART (UART1 TX and RX)*/
/* set GPIO15-14 to UART (UART1 TX and RX)*/
GPIO->FUNC_SEL.GPIO_14 = 1;
GPIO->FUNC_SEL.GPIO_15 = 1;
/* interrupt when there are this number or more bytes free in the TX buffer*/
*UART1_UTXCON = 16;
u1_tx_head = 0; u1_tx_tail = 0;
u1_tx_head = 0; u1_tx_tail = 0;
/* enable UART1 interrupts in the interrupt controller */
enable_irq(UART1);

View file

@ -127,8 +127,8 @@ while(1) {
my $i = 1;
while(read(FILE, $c, 1)) {
$i++;
usleep($first_delay) if ( $s == 0 );
usleep($second_delay) if ( $s == 1 );
usleep($first_delay) if ( $s == 0 ) && ($first_delay != 0);
usleep($second_delay) if ( $s == 1 ) && ($second_delay != 0);
$ob->write($c);
}
}

View file

@ -33,10 +33,14 @@
* Machine dependent MSP430 SLIP routines for UART0.
*/
#include "contiki-conf.h"
#ifdef __IAR_SYSTEMS_ICC__
#include <io430.h>
#else
#include <io.h>
#include <signal.h>
#include "contiki.h"
#endif
#include "dev/slip.h"
#include "dev/uart0.h"

View file

@ -163,13 +163,12 @@ endif
FLASHER = $(CONTIKI)/tools/stm32w/stm32w_flasher/linux/stm32w_flasher
FLASHER = $(CONTIKI)/tools/stm32w/stm32w_flasher/stm32w_flasher
# Check if we are running under Windows
ifdef OS
ifneq (,$(findstring Windows,$(OS)))
FLASHER = $(CONTIKI)/tools/stm32w/stm32w_flasher/win/stm32w_flasher
FLASHER = $(CONTIKI)/tools/stm32w/stm32w_flasher/stm32w_flasher.exe
endif
endif

View file

@ -1,122 +0,0 @@
/*
* Copyright (c) 2007, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*
* $Id: example-meshconn.c,v 1.3 2010/01/14 14:32:22 joxe Exp $
*/
/**
* \file
* A brief description of what this file is.
* \author
* Adam Dunkels <adam@sics.se>
*/
#include "contiki.h"
#include "net/rime.h"
#include "net/rime/meshconn.h"
#include "dev/button-sensor.h"
#include "dev/leds.h"
#include <stdio.h>
static struct meshconn_conn meshconn;
/*---------------------------------------------------------------------------*/
PROCESS(test_meshconn_process, "Meshconnconn test");
AUTOSTART_PROCESSES(&test_meshconn_process);
/*---------------------------------------------------------------------------*/
static void
connected(struct meshconn_conn *c)
{
printf("connected\n");
}
static void
closed(struct meshconn_conn *c)
{
printf("closed\n");
}
static void
reset(struct meshconn_conn *c)
{
printf("reset\n");
}
static void
timedout(struct meshconn_conn *c)
{
printf("timedout\n");
}
static void
recv(struct meshconn_conn *c)
{
printf("Data received from %.*s (%d)\n",
packetbuf_datalen(), (char *)packetbuf_dataptr(), packetbuf_datalen());
/* meshconn_send(&meshconn, from);*/
}
const static struct meshconn_callbacks callbacks = { connected,
recv,
closed,
timedout,
reset };
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(test_meshconn_process, ev, data)
{
PROCESS_EXITHANDLER(meshconn_close(&meshconn);)
PROCESS_BEGIN();
meshconn_open(&meshconn, 128, &callbacks);
while(1) {
rimeaddr_t addr;
static struct etimer et;
etimer_set(&et, CLOCK_SECOND * 4);
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et) ||
(ev == sensors_event && data == &button_sensor));
printf("Button\n");
/*
* Send a message containing "Hej" (3 characters) to node number
* 6.
*/
addr.u8[0] = 53;
addr.u8[1] = 0;
meshconn_connect(&meshconn, addr);
packetbuf_copyfrom("Hej", 3);
meshconn_send(&meshconn, &addr);
}
PROCESS_END();
}
/*---------------------------------------------------------------------------*/

View file

@ -473,7 +473,7 @@ if ((rtime%STAMPS)==0) {
#endif
rtime+=1;
#if PINGS
#if PINGS && UIP_CONF_IPV6
extern void raven_ping6(void);
if ((rtime%PINGS)==1) {
PRINTA("**Ping\n");
@ -481,7 +481,7 @@ if ((rtime%PINGS)==1) {
}
#endif
#if ROUTES
#if ROUTES && UIP_CONF_IPV6
if ((rtime%ROUTES)==2) {
extern uip_ds6_nbr_t uip_ds6_nbr_cache[];

View file

@ -33,8 +33,9 @@
#include "contiki.h"
#include "net/rime.h"
#include "dev/sd/sd.h"
#include "dev/sd.h"
#include <io.h>
#include <stdio.h>
/*---------------------------------------------------------------------------*/

View file

@ -40,6 +40,7 @@
#include "contiki.h"
#include "msb430-uart1.h"
#include "sd-arch.h"
#include <io.h>
#define SPI_IDLE 0xff

View file

@ -41,6 +41,7 @@
#include "sd.h"
#include "sd-arch.h"
#include <io.h>
#include <string.h>
#define DEBUG 0

View file

@ -85,6 +85,7 @@
#define USE_32KHZ_XTAL 0
#define BLOCKING_TX 1
#define MACA_AUTOACK 1
#define NULLRDC_CONF_802154_AUTOACK_HW 1
#define USE_WDT 0

View file

@ -436,7 +436,7 @@ main(void)
PRINTF("setting short mac 0x%04x\n\r", *MACA_MAC16ADDR);
PRINTF("setting long mac 0x%08x_%08x\n\r", *MACA_MAC64HI, *MACA_MAC64LO);
#if NULLRDC_CONF_802154_AUTOACK_HW
#if MACA_AUTOACK
set_prm_mode(AUTOACK);
#endif

View file

@ -47,6 +47,9 @@
/* Platform TMOTE_SKY */
#define TMOTE_SKY 1
#define PLATFORM_HAS_LEDS 1
#define PLATFORM_HAS_BUTTON 1
/* CPU target speed in Hz */
#define F_CPU 3900000uL /*2457600uL*/

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,26 @@
STM32W Flasher 2.0.0b2 for Linux
A programmer for development boards based on STM32W108 microcontroller.
It works with the following boards (with FT232R or STM32F103 as USB-serial converter):
MB850, MB851, MB950, MB951, MB954
- Installation
Installation is not required.
Hal package has to be present in your system.
- Usage
Run the program with -h option for usage info.
- Notes
This program may require root privileges when programming boards with
FT232R chip.
In Ubuntu, if you want to flash using Make, type 'sudo -s' before that.
This version of STM32W Flasher does not support jlink yet.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,22 +0,0 @@
STM32W Flasher 1.1.0b1 for Linux
A programmer for MB851 development boards based on STM32W108 microcontroller.
- Installation
Installation is not required.
Hal package has to be present in your system.
- Usage
Run the program with -h option for usage info.
- Notes
This program may require root privileges.
In Ubuntu, if you want to flash using Make, type 'sudo -s' before that.
This version of STM32W Flasher does not support jlink yet.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -938,7 +938,7 @@ bool validIPAddr(const char * ip_addr, int prefix_len)
char tmp_addr[INET6_ADDRSTRLEN], tmp2_addr[INET6_ADDRSTRLEN];
char * substr;
strncpy(tmp_addr, br_prefix, INET6_ADDRSTRLEN);
strncpy(tmp_addr, ip_addr, INET6_ADDRSTRLEN);
strtok(tmp_addr,"/");
@ -985,7 +985,7 @@ main(int argc, char **argv)
osVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osVersionInfo);
while((c = getopt(argc, argv, "B:D:hs:c:ra:p:v:tb:")) != -1) {
while((c = getopt(argc, argv, "B:D:hs:c:ra:p:vtb:")) != -1) {
switch (c) {
case 'B':
baudrate = atoi(optarg);

View file

@ -33,6 +33,9 @@
*
*/
/* Below define allows importing saved output into Wireshark as "Raw IP" packet type */
#define WIRESHARK_IMPORT_FORMAT 1
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
@ -250,15 +253,17 @@ serial_to_tun(FILE *inslip, int outfd)
if (timestamp) stamptime();
printf("Packet from SLIP of length %d - write TUN\n", inbufptr);
if (verbose>4) {
#if WIRESHARK_IMPORT_FORMAT
printf("0000");
for(i = 0; i < inbufptr; i++) printf(" %02x",uip.inbuf[i]);
#else
printf(" ");
for(i = 0; i < inbufptr; i++) {
printf("%02x", uip.inbuf[i]);
if((i & 3) == 3) {
printf(" ");
}
if((i & 15) == 15)
printf("\n ");
if((i & 3) == 3) printf(" ");
if((i & 15) == 15) printf("\n ");
}
#endif
printf("\n");
}
}
@ -383,15 +388,17 @@ write_to_serial(int outfd, void *inbuf, int len)
if (timestamp) stamptime();
printf("Packet from TUN of length %d - write SLIP\n", len);
if (verbose>4) {
#if WIRESHARK_IMPORT_FORMAT
printf("0000");
for(i = 0; i < len; i++) printf(" %02x", p[i]);
#else
printf(" ");
for(i = 0; i < len; i++) {
printf("%02x", p[i]);
if((i & 3) == 3) {
printf(" ");
}
if((i & 15) == 15)
printf("\n ");
if((i & 3) == 3) printf(" ");
if((i & 15) == 15) printf("\n ");
}
#endif
printf("\n");
}
}