Example code for using the shell netperf command

This commit is contained in:
adamdunkels 2009-11-03 22:56:27 +00:00
parent 4928e43880
commit 51ecb15435
3 changed files with 258 additions and 0 deletions

View file

@ -0,0 +1,6 @@
CONTIKI_PROJECT = netperf-shell
all: $(CONTIKI_PROJECT)
APPS=serial-shell
CONTIKI = ../..
include $(CONTIKI)/Makefile.include

View file

@ -0,0 +1,73 @@
/*
* Copyright (c) 2008, 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: netperf-shell.c,v 1.1 2009/11/03 22:56:27 adamdunkels Exp $
*/
/**
* \file
* netperf shell
* \author
* Adam Dunkels <adam@sics.se>
*/
#include "contiki.h"
#include "shell.h"
#include "serial-shell.h"
/*---------------------------------------------------------------------------*/
PROCESS(netperf_shell_process, "netperf shell");
AUTOSTART_PROCESSES(&netperf_shell_process);
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(netperf_shell_process, ev, data)
{
PROCESS_BEGIN();
serial_shell_init();
shell_blink_init();
/* shell_file_init();
shell_coffee_init();*/
/* shell_download_init();
shell_rime_sendcmd_init();*/
shell_ps_init();
shell_reboot_init();
shell_rime_init();
shell_rime_netcmd_init();
shell_rime_ping_init();
shell_rime_debug_init();
shell_rime_sniff_init();
shell_text_init();
shell_time_init();
shell_sendtest_init();
shell_netperf_init();
PROCESS_END();
}
/*---------------------------------------------------------------------------*/

View file

@ -0,0 +1,179 @@
<?xml version="1.0" encoding="UTF-8"?>
<simconf>
<project>[CONTIKI_DIR]/tools/cooja/apps/mrm</project>
<project>[CONTIKI_DIR]/tools/cooja/apps/mspsim</project>
<project>[CONTIKI_DIR]/tools/cooja/apps/avrora</project>
<project>[CONTIKI_DIR]/tools/cooja/apps/native_gateway</project>
<simulation>
<title>My simulation</title>
<delaytime>0</delaytime>
<randomseed>123456</randomseed>
<motedelay_us>1000000</motedelay_us>
<radiomedium>
se.sics.cooja.radiomediums.UDGM
<transmitting_range>50.0</transmitting_range>
<interference_range>100.0</interference_range>
<success_ratio_tx>1.0</success_ratio_tx>
<success_ratio_rx>1.0</success_ratio_rx>
</radiomedium>
<events>
<logoutput>40000</logoutput>
</events>
<motetype>
se.sics.cooja.mspmote.SkyMoteType
<identifier>sky1</identifier>
<description>netperf shell</description>
<source>[CONTIKI_DIR]/examples/netperf/netperf-shell.c</source>
<commands>make netperf-shell.sky TARGET=sky</commands>
<firmware>[CONTIKI_DIR]/examples/netperf/netperf-shell.sky</firmware>
<moteinterface>se.sics.cooja.interfaces.Position</moteinterface>
<moteinterface>se.sics.cooja.interfaces.RimeAddress</moteinterface>
<moteinterface>se.sics.cooja.interfaces.IPAddress</moteinterface>
<moteinterface>se.sics.cooja.interfaces.Mote2MoteRelations</moteinterface>
<moteinterface>se.sics.cooja.mspmote.interfaces.MspClock</moteinterface>
<moteinterface>se.sics.cooja.mspmote.interfaces.MspMoteID</moteinterface>
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyButton</moteinterface>
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyFlash</moteinterface>
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyCoffeeFilesystem</moteinterface>
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyByteRadio</moteinterface>
<moteinterface>se.sics.cooja.mspmote.interfaces.SkySerial</moteinterface>
<moteinterface>se.sics.cooja.mspmote.interfaces.SkyLED</moteinterface>
</motetype>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
<x>49.48292285385544</x>
<y>97.67000744426045</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>1</id>
</interface_config>
</mote>
<mote>
se.sics.cooja.mspmote.SkyMote
<motetype_identifier>sky1</motetype_identifier>
<breakpoints />
<interface_config>
se.sics.cooja.interfaces.Position
<x>80.21380569499377</x>
<y>98.51039574575084</y>
<z>0.0</z>
</interface_config>
<interface_config>
se.sics.cooja.mspmote.interfaces.MspMoteID
<id>2</id>
</interface_config>
</mote>
</simulation>
<plugin>
se.sics.cooja.plugins.SimControl
<width>290</width>
<z>5</z>
<height>172</height>
<location_x>0</location_x>
<location_y>0</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.Visualizer
<plugin_config>
<skin>se.sics.cooja.plugins.skins.IDVisualizerSkin</skin>
<skin>se.sics.cooja.plugins.skins.GridVisualizerSkin</skin>
<skin>se.sics.cooja.plugins.skins.UDGMVisualizerSkin</skin>
<viewport>2.920727775710812 0.0 0.0 2.920727775710812 -28.526147202610904 -183.26750359633323</viewport>
</plugin_config>
<width>300</width>
<z>6</z>
<height>300</height>
<location_x>724</location_x>
<location_y>0</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.LogListener
<plugin_config>
<filter />
</plugin_config>
<width>1024</width>
<z>2</z>
<height>150</height>
<location_x>0</location_x>
<location_y>398</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.TimeLine
<plugin_config>
<mote>0</mote>
<mote>1</mote>
<showRadioRXTX />
<showRadioHW />
<showLEDs />
<split>118</split>
<zoom>9</zoom>
</plugin_config>
<width>1024</width>
<z>0</z>
<height>150</height>
<location_x>0</location_x>
<location_y>548</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.MoteInterfaceViewer
<mote_arg>0</mote_arg>
<plugin_config>
<interface>Serial port</interface>
<scrollpos>0,0</scrollpos>
</plugin_config>
<width>432</width>
<z>1</z>
<height>505</height>
<location_x>290</location_x>
<location_y>-1</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.MoteInterfaceViewer
<mote_arg>1</mote_arg>
<plugin_config>
<interface>Serial port</interface>
<scrollpos>0,0</scrollpos>
</plugin_config>
<width>350</width>
<z>3</z>
<height>300</height>
<location_x>379</location_x>
<location_y>112</location_y>
<minimized>false</minimized>
</plugin>
<plugin>
se.sics.cooja.plugins.ScriptRunner
<plugin_config>
<script>started = 0;
while(true) {
YIELD(); /* wait for another mote output */
log.log(time + " " + id + " " + msg + "\n");
if(id == 1 &amp;&amp; msg.startsWith("1.0: Contiki") &amp;&amp; started == 0) {
write(mote, "netperf 2.0 20\n"); /* Write to mote serial port */
started = 1;
}
}
//log.testOK(); /* Report test success and quit */
//log.testFailed(); /* Report test failure and quit */</script>
<active>true</active>
</plugin_config>
<width>600</width>
<z>4</z>
<height>476</height>
<location_x>399</location_x>
<location_y>154</location_y>
<minimized>false</minimized>
</plugin>
</simconf>