From 44370be06f107e912ca114344c224bdbfb30a761 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Mon, 18 Nov 2013 23:54:01 +0100 Subject: [PATCH] Removed old, unused msp430-based platforms --- platform/esb/Makefile.esb | 87 -- platform/esb/apps/Makefile.apps | 4 - platform/esb/apps/beeper.c | 85 -- platform/esb/apps/burn-nodeid.c | 70 -- platform/esb/apps/fader.c | 136 --- platform/esb/apps/fader.h | 44 - platform/esb/apps/helloworld.c | 66 -- platform/esb/apps/pinger.c | 198 ----- platform/esb/apps/pinger.h | 39 - platform/esb/apps/radio-sniffer.c | 85 -- platform/esb/apps/radio-sniffer.h | 46 - platform/esb/apps/radio-test.c | 154 ---- platform/esb/apps/sensor-output.c | 65 -- platform/esb/apps/sensor-output.h | 39 - platform/esb/apps/test-receiver.c | 65 -- platform/esb/apps/test-sender.c | 67 -- platform/esb/buildscripts/Makefile.freebsd | 18 - platform/esb/buildscripts/Makefile.unix | 2 - platform/esb/buildscripts/Makefile.win | 11 - .../esb/buildscripts/jtag/pyjtag/_parjtag.so | Bin 30388 -> 0 bytes platform/esb/buildscripts/jtag/pyjtag/elf.py | 318 ------- .../esb/buildscripts/jtag/pyjtag/gen-ihex.py | 49 -- .../jtag/pyjtag/install-pyjtag.nsi | 108 --- platform/esb/buildscripts/jtag/pyjtag/jtag.py | 604 ------------- .../esb/buildscripts/jtag/pyjtag/license.txt | 62 -- .../esb/buildscripts/jtag/pyjtag/makefile | 33 - .../esb/buildscripts/jtag/pyjtag/readme.txt | 182 ---- .../esb/buildscripts/jtag/pyjtag/setup.py | 9 - platform/esb/cfs-coffee-arch.c | 58 -- platform/esb/cfs-coffee-arch.h | 77 -- platform/esb/contiki-conf.h | 124 --- platform/esb/contiki-esb-default-init-apps.c | 35 - .../esb/contiki-esb-default-init-lowlevel.c | 43 - platform/esb/contiki-esb-main.c | 319 ------- platform/esb/contiki-esb.h | 72 -- platform/esb/core.c | 44 - platform/esb/dev/battery-sensor.c | 91 -- platform/esb/dev/battery-sensor.h | 47 - platform/esb/dev/beep.c | 167 ---- platform/esb/dev/beep.h | 162 ---- platform/esb/dev/button-sensor.c | 101 --- platform/esb/dev/ctsrts-sensor.c | 145 ---- platform/esb/dev/ctsrts-sensor.h | 61 -- platform/esb/dev/ds1629.c | 228 ----- platform/esb/dev/ds1629.h | 71 -- platform/esb/dev/eeprom.c | 323 ------- platform/esb/dev/esb-sensors.c | 72 -- platform/esb/dev/esb-sensors.h | 47 - platform/esb/dev/ir.c | 315 ------- platform/esb/dev/ir.h | 70 -- platform/esb/dev/irq.c | 216 ----- platform/esb/dev/irq.h | 46 - platform/esb/dev/pir-sensor.c | 96 --- platform/esb/dev/pir-sensor.h | 41 - platform/esb/dev/radio-sensor.c | 96 --- platform/esb/dev/rs232-putchar.c | 40 - platform/esb/dev/rs232.c | 153 ---- platform/esb/dev/rs232.h | 118 --- platform/esb/dev/sound-sensor.c | 167 ---- platform/esb/dev/sound-sensor.h | 44 - platform/esb/dev/temperature-sensor.c | 90 -- platform/esb/dev/temperature-sensor.h | 47 - platform/esb/dev/tr1001-gcr.c | 787 ----------------- platform/esb/dev/tr1001.c | 773 ----------------- platform/esb/dev/tr1001.h | 137 --- platform/esb/dev/vib-sensor.c | 96 --- platform/esb/dev/vib-sensor.h | 41 - platform/esb/doc/doc.txt | 7 - platform/esb/doc/esb.txt | 171 ---- platform/esb/doc/getting-started.txt | 18 - platform/esb/doc/quickref.txt | 78 -- platform/esb/doc/slipintro.txt | 127 --- platform/esb/loader/loader-arch.h | 73 -- platform/esb/net/uip-driver.c | 86 -- platform/esb/net/uip-driver.h | 48 -- platform/esb/node-id.c | 71 -- platform/jcreate/Makefile.jcreate | 17 - platform/jcreate/contiki-jcreate-platform.c | 43 - platform/jcreate/dev/acc-sensor.c | 97 --- platform/jcreate/dev/acc-sensor.h | 61 -- platform/jcreate/dev/ext-sensor.c | 92 -- platform/jcreate/dev/ext-sensor.h | 52 -- platform/jcreate/leds-arch.c | 62 -- platform/jcreate/platform-jcreate-conf.h | 209 ----- platform/msb430/Makefile | 14 - platform/msb430/Makefile.msb430 | 74 -- platform/msb430/apps/Makefile.apps | 2 - platform/msb430/apps/acc-test.c | 70 -- platform/msb430/apps/sd-test.c | 94 -- platform/msb430/apps/test-abc.c | 102 --- platform/msb430/apps/test-sht11.c | 65 -- platform/msb430/buildscripts/Makefile.freebsd | 18 - platform/msb430/buildscripts/Makefile.unix | 18 - platform/msb430/buildscripts/Makefile.win | 15 - .../buildscripts/jtag/pyjtag/_parjtag.so | Bin 26576 -> 0 bytes .../msb430/buildscripts/jtag/pyjtag/elf.py | 318 ------- .../msb430/buildscripts/jtag/pyjtag/elf.pyc | Bin 9708 -> 0 bytes .../buildscripts/jtag/pyjtag/gen-ihex.py | 49 -- .../jtag/pyjtag/install-pyjtag.nsi | 108 --- .../msb430/buildscripts/jtag/pyjtag/jtag.py | 604 ------------- .../buildscripts/jtag/pyjtag/license.txt | 62 -- .../msb430/buildscripts/jtag/pyjtag/makefile | 33 - .../buildscripts/jtag/pyjtag/readme.txt | 182 ---- .../msb430/buildscripts/jtag/pyjtag/setup.py | 9 - platform/msb430/cfs-coffee-arch.c | 64 -- platform/msb430/cfs-coffee-arch.h | 75 -- platform/msb430/contiki-conf.h | 94 -- platform/msb430/contiki-msb430-main.c | 214 ----- platform/msb430/contiki-msb430.h | 58 -- platform/msb430/dev/adc.c | 94 -- platform/msb430/dev/adc.h | 40 - platform/msb430/dev/cc1020-internal.h | 263 ------ platform/msb430/dev/cc1020-uip.c | 67 -- platform/msb430/dev/cc1020-uip.h | 38 - platform/msb430/dev/cc1020.c | 803 ------------------ platform/msb430/dev/cc1020.h | 77 -- platform/msb430/dev/dma.c | 121 --- platform/msb430/dev/dma.h | 44 - platform/msb430/dev/infomem.c | 122 --- platform/msb430/dev/infomem.h | 82 -- platform/msb430/dev/msb430-uart1.c | 231 ----- platform/msb430/dev/msb430-uart1.h | 111 --- platform/msb430/dev/rs232.c | 123 --- platform/msb430/dev/rs232.h | 122 --- platform/msb430/dev/sd-arch.c | 94 -- platform/msb430/dev/sd-arch.h | 80 -- platform/msb430/dev/sd.c | 513 ----------- platform/msb430/dev/sd.h | 79 -- platform/msb430/dev/sht11-arch.h | 52 -- platform/msb430/doc/msb430.txt | 51 -- platform/msb430/init-net-uip.c | 79 -- platform/msb430/loader/loader-arch.h | 73 -- platform/msb430/msb430-slip-arch.c | 56 -- platform/msb430/node-id.c | 54 -- platform/msb430/symbols.c | 3 - platform/msb430/symbols.h | 2 - platform/sentilla-usb/Makefile.sentilla-usb | 16 - .../contiki-sentilla-usb-platform.c | 49 -- platform/sentilla-usb/leds-arch.c | 69 -- .../sentilla-usb/platform-sentilla-usb-conf.h | 208 ----- 140 files changed, 15776 deletions(-) delete mode 100644 platform/esb/Makefile.esb delete mode 100644 platform/esb/apps/Makefile.apps delete mode 100644 platform/esb/apps/beeper.c delete mode 100644 platform/esb/apps/burn-nodeid.c delete mode 100644 platform/esb/apps/fader.c delete mode 100644 platform/esb/apps/fader.h delete mode 100644 platform/esb/apps/helloworld.c delete mode 100644 platform/esb/apps/pinger.c delete mode 100644 platform/esb/apps/pinger.h delete mode 100644 platform/esb/apps/radio-sniffer.c delete mode 100644 platform/esb/apps/radio-sniffer.h delete mode 100644 platform/esb/apps/radio-test.c delete mode 100644 platform/esb/apps/sensor-output.c delete mode 100644 platform/esb/apps/sensor-output.h delete mode 100644 platform/esb/apps/test-receiver.c delete mode 100644 platform/esb/apps/test-sender.c delete mode 100644 platform/esb/buildscripts/Makefile.freebsd delete mode 100644 platform/esb/buildscripts/Makefile.unix delete mode 100644 platform/esb/buildscripts/Makefile.win delete mode 100755 platform/esb/buildscripts/jtag/pyjtag/_parjtag.so delete mode 100644 platform/esb/buildscripts/jtag/pyjtag/elf.py delete mode 100644 platform/esb/buildscripts/jtag/pyjtag/gen-ihex.py delete mode 100644 platform/esb/buildscripts/jtag/pyjtag/install-pyjtag.nsi delete mode 100644 platform/esb/buildscripts/jtag/pyjtag/jtag.py delete mode 100644 platform/esb/buildscripts/jtag/pyjtag/license.txt delete mode 100644 platform/esb/buildscripts/jtag/pyjtag/makefile delete mode 100644 platform/esb/buildscripts/jtag/pyjtag/readme.txt delete mode 100644 platform/esb/buildscripts/jtag/pyjtag/setup.py delete mode 100644 platform/esb/cfs-coffee-arch.c delete mode 100644 platform/esb/cfs-coffee-arch.h delete mode 100644 platform/esb/contiki-conf.h delete mode 100644 platform/esb/contiki-esb-default-init-apps.c delete mode 100644 platform/esb/contiki-esb-default-init-lowlevel.c delete mode 100644 platform/esb/contiki-esb-main.c delete mode 100644 platform/esb/contiki-esb.h delete mode 100644 platform/esb/core.c delete mode 100644 platform/esb/dev/battery-sensor.c delete mode 100644 platform/esb/dev/battery-sensor.h delete mode 100644 platform/esb/dev/beep.c delete mode 100644 platform/esb/dev/beep.h delete mode 100644 platform/esb/dev/button-sensor.c delete mode 100644 platform/esb/dev/ctsrts-sensor.c delete mode 100644 platform/esb/dev/ctsrts-sensor.h delete mode 100644 platform/esb/dev/ds1629.c delete mode 100644 platform/esb/dev/ds1629.h delete mode 100644 platform/esb/dev/eeprom.c delete mode 100644 platform/esb/dev/esb-sensors.c delete mode 100644 platform/esb/dev/esb-sensors.h delete mode 100644 platform/esb/dev/ir.c delete mode 100644 platform/esb/dev/ir.h delete mode 100644 platform/esb/dev/irq.c delete mode 100644 platform/esb/dev/irq.h delete mode 100644 platform/esb/dev/pir-sensor.c delete mode 100644 platform/esb/dev/pir-sensor.h delete mode 100644 platform/esb/dev/radio-sensor.c delete mode 100644 platform/esb/dev/rs232-putchar.c delete mode 100644 platform/esb/dev/rs232.c delete mode 100644 platform/esb/dev/rs232.h delete mode 100644 platform/esb/dev/sound-sensor.c delete mode 100644 platform/esb/dev/sound-sensor.h delete mode 100644 platform/esb/dev/temperature-sensor.c delete mode 100644 platform/esb/dev/temperature-sensor.h delete mode 100644 platform/esb/dev/tr1001-gcr.c delete mode 100644 platform/esb/dev/tr1001.c delete mode 100644 platform/esb/dev/tr1001.h delete mode 100644 platform/esb/dev/vib-sensor.c delete mode 100644 platform/esb/dev/vib-sensor.h delete mode 100644 platform/esb/doc/doc.txt delete mode 100644 platform/esb/doc/esb.txt delete mode 100644 platform/esb/doc/getting-started.txt delete mode 100644 platform/esb/doc/quickref.txt delete mode 100644 platform/esb/doc/slipintro.txt delete mode 100644 platform/esb/loader/loader-arch.h delete mode 100644 platform/esb/net/uip-driver.c delete mode 100644 platform/esb/net/uip-driver.h delete mode 100644 platform/esb/node-id.c delete mode 100644 platform/jcreate/Makefile.jcreate delete mode 100644 platform/jcreate/contiki-jcreate-platform.c delete mode 100644 platform/jcreate/dev/acc-sensor.c delete mode 100644 platform/jcreate/dev/acc-sensor.h delete mode 100644 platform/jcreate/dev/ext-sensor.c delete mode 100644 platform/jcreate/dev/ext-sensor.h delete mode 100644 platform/jcreate/leds-arch.c delete mode 100644 platform/jcreate/platform-jcreate-conf.h delete mode 100644 platform/msb430/Makefile delete mode 100644 platform/msb430/Makefile.msb430 delete mode 100644 platform/msb430/apps/Makefile.apps delete mode 100644 platform/msb430/apps/acc-test.c delete mode 100644 platform/msb430/apps/sd-test.c delete mode 100644 platform/msb430/apps/test-abc.c delete mode 100644 platform/msb430/apps/test-sht11.c delete mode 100644 platform/msb430/buildscripts/Makefile.freebsd delete mode 100644 platform/msb430/buildscripts/Makefile.unix delete mode 100644 platform/msb430/buildscripts/Makefile.win delete mode 100755 platform/msb430/buildscripts/jtag/pyjtag/_parjtag.so delete mode 100644 platform/msb430/buildscripts/jtag/pyjtag/elf.py delete mode 100644 platform/msb430/buildscripts/jtag/pyjtag/elf.pyc delete mode 100644 platform/msb430/buildscripts/jtag/pyjtag/gen-ihex.py delete mode 100644 platform/msb430/buildscripts/jtag/pyjtag/install-pyjtag.nsi delete mode 100755 platform/msb430/buildscripts/jtag/pyjtag/jtag.py delete mode 100644 platform/msb430/buildscripts/jtag/pyjtag/license.txt delete mode 100644 platform/msb430/buildscripts/jtag/pyjtag/makefile delete mode 100644 platform/msb430/buildscripts/jtag/pyjtag/readme.txt delete mode 100644 platform/msb430/buildscripts/jtag/pyjtag/setup.py delete mode 100644 platform/msb430/cfs-coffee-arch.c delete mode 100644 platform/msb430/cfs-coffee-arch.h delete mode 100644 platform/msb430/contiki-conf.h delete mode 100644 platform/msb430/contiki-msb430-main.c delete mode 100644 platform/msb430/contiki-msb430.h delete mode 100644 platform/msb430/dev/adc.c delete mode 100644 platform/msb430/dev/adc.h delete mode 100644 platform/msb430/dev/cc1020-internal.h delete mode 100644 platform/msb430/dev/cc1020-uip.c delete mode 100644 platform/msb430/dev/cc1020-uip.h delete mode 100644 platform/msb430/dev/cc1020.c delete mode 100644 platform/msb430/dev/cc1020.h delete mode 100644 platform/msb430/dev/dma.c delete mode 100644 platform/msb430/dev/dma.h delete mode 100644 platform/msb430/dev/infomem.c delete mode 100644 platform/msb430/dev/infomem.h delete mode 100644 platform/msb430/dev/msb430-uart1.c delete mode 100644 platform/msb430/dev/msb430-uart1.h delete mode 100644 platform/msb430/dev/rs232.c delete mode 100644 platform/msb430/dev/rs232.h delete mode 100644 platform/msb430/dev/sd-arch.c delete mode 100644 platform/msb430/dev/sd-arch.h delete mode 100644 platform/msb430/dev/sd.c delete mode 100644 platform/msb430/dev/sd.h delete mode 100644 platform/msb430/dev/sht11-arch.h delete mode 100644 platform/msb430/doc/msb430.txt delete mode 100644 platform/msb430/init-net-uip.c delete mode 100644 platform/msb430/loader/loader-arch.h delete mode 100644 platform/msb430/msb430-slip-arch.c delete mode 100644 platform/msb430/node-id.c delete mode 100644 platform/msb430/symbols.c delete mode 100644 platform/msb430/symbols.h delete mode 100644 platform/sentilla-usb/Makefile.sentilla-usb delete mode 100644 platform/sentilla-usb/contiki-sentilla-usb-platform.c delete mode 100644 platform/sentilla-usb/leds-arch.c delete mode 100644 platform/sentilla-usb/platform-sentilla-usb-conf.h diff --git a/platform/esb/Makefile.esb b/platform/esb/Makefile.esb deleted file mode 100644 index 7ec4d4444..000000000 --- a/platform/esb/Makefile.esb +++ /dev/null @@ -1,87 +0,0 @@ -# $Id: Makefile.esb,v 1.15 2010/03/02 22:40:39 nifi Exp $ - -SENSORS = sensors.c irq.c button-sensor.c pir-sensor.c vib-sensor.c \ - sound-sensor.c radio-sensor.c ctsrts-sensor.c battery-sensor.c \ - temperature-sensor.c -ESB = ir.c beep.c ds1629.c tr1001-gcr.c gcr.c \ - esb-sensors.c node-id.c eeprom.c \ - uip-driver.c uip-ipchksum.c -CFS_EEPROM = cfs-eeprom.c -CFS_COFFEE = cfs-coffee.c cfs-coffee-arch.c - -CONTIKI_TARGET_DIRS = . dev apps net loader -ifndef CONTIKI_TARGET_MAIN - CONTIKI_TARGET_MAIN = contiki-esb-main.c -endif - -CONTIKI_TARGET_SOURCEFILES += $(SENSORS) $(ESB) \ - contiki-esb-default-init-lowlevel.c \ - contiki-esb-default-init-apps.c \ - rs232.c rs232-putchar.c fader.c - -ifdef WITH_CODEPROP - CONTIKI_TARGET_DIRS += ../../apps/codeprop - CONTIKI_TARGET_SOURCEFILES += codeprop-tmp.c - WITH_UIP=1 -endif - -ifdef GCC -CFLAGS+=-Os -g -endif - -ifdef IAR -CFLAGS += -D__MSP430F149__=1 -e --vla -Ohz --multiplier=16s --core=430 --double=32 -CFLAGSNO = --dlib_config "$(IAR_PATH)/LIB/DLIB/dl430fn.h" $(CFLAGSWERROR) -endif - - -ifdef WITH_UIP - ifndef WITH_SLIP - WITH_SLIP=1 - endif - CFLAGS += -DWITH_UIP=1 -DWITH_SLIP=${WITH_SLIP} -endif - -ifeq ($(CFS),coffee) - CONTIKI_TARGET_SOURCEFILES += $(CFS_COFFEE) -else - CONTIKI_TARGET_SOURCEFILES += $(CFS_EEPROM) -endif - -include $(CONTIKI)/platform/$(TARGET)/apps/Makefile.apps - -MCU=msp430f149 -include $(CONTIKI)/cpu/msp430/Makefile.msp430 - -ifdef IAR -LDFLAGSNO += -xm "$(IAR_PATH)/lib/dlib/dl430fn.r43" -f "$(IAR_PATH)/config/lnk430f149.xcl" -LDFLAGS += $(LDFLAGSNO) -Felf -yn -endif # IAR - -contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o} -# $(AR) rcf $@ $^ - -ifndef BASE_IP -BASE_IP := 172.16.1.1 -endif - -send: $(CONTIKI)/tools/codeprop.c - cc -Wall $^ -o send - -%.send: %.cm send - send $(BASE_IP) $< - -### System dependent Makefile - -ifeq ($(HOST_OS),FreeBSD) - # settings for FreeBSD - -include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.freebsd -else - ifeq ($(HOST_OS),Windows) - # settings for Windows - -include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.win - else - # settings for an arbitary unix-like platform - -include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.unix - endif -endif diff --git a/platform/esb/apps/Makefile.apps b/platform/esb/apps/Makefile.apps deleted file mode 100644 index 83e02193a..000000000 --- a/platform/esb/apps/Makefile.apps +++ /dev/null @@ -1,4 +0,0 @@ -burn-nodeid: burn-nodeid.c -helloworld: helloworld.c -radio-test: radio-test.c -radio-sniffer: radio-sniffer.c diff --git a/platform/esb/apps/beeper.c b/platform/esb/apps/beeper.c deleted file mode 100644 index c0e7b9927..000000000 --- a/platform/esb/apps/beeper.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ -#include "contiki-esb.h" - -PROCESS(beeper_process, "Beeper"); - -AUTOSTART_PROCESSES(&beeper_process); - -static struct etimer etimer; - -static struct pt beeper_pt; - -static -PT_THREAD(beeper_thread(struct pt *pt)) -{ - PT_BEGIN(pt); - - while(1) { - PT_WAIT_UNTIL(pt, etimer_expired(&etimer)); - etimer_reset(&etimer); - leds_invert(LEDS_RED); - beep(); - - PT_WAIT_UNTIL(pt, etimer_expired(&etimer)); - etimer_reset(&etimer); - leds_invert(LEDS_RED); - } - - PT_END(pt); -} - -PROCESS_THREAD(beeper_process, ev, data) -{ - PROCESS_BEGIN(); - - etimer_set(&etimer, CLOCK_SECOND / 2); - PT_INIT(&beeper_pt); - - button_sensor.configure(SENSORS_ACTIVE, 1); - - while(1) { - - beeper_thread(&beeper_pt); - - PROCESS_WAIT_EVENT(); - - if(ev == PROCESS_EVENT_EXIT) { - break; - } else if(ev == sensors_event && - data == &button_sensor) { - leds_invert(LEDS_YELLOW); - } - - } - PROCESS_END(); -} diff --git a/platform/esb/apps/burn-nodeid.c b/platform/esb/apps/burn-nodeid.c deleted file mode 100644 index a157baebd..000000000 --- a/platform/esb/apps/burn-nodeid.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2006, 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. - * - */ - -/** - * \file - * A brief description of what this file is. - * \author - * Adam Dunkels - */ - -#include "sys/node-id.h" -#include "contiki.h" -#include "dev/esb-sensors.h" -#include "dev/rs232.h" - -#include - -PROCESS(burn_process, "Burn node id"); -AUTOSTART_PROCESSES(&burn_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(burn_process, ev, data) -{ - PROCESS_BEGIN(); -#if NODEID - printf("Burning node id %d\n", NODEID); - node_id_burn(NODEID); - node_id_restore(); - printf("Restored node id %d\n", node_id); -#else -#error "burn-nodeid must be compiled with nodeid=" - node_id_restore(); - printf("Restored node id %d\n", node_id); -#endif - while(1) { - PROCESS_WAIT_EVENT(); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void init_net(void) {} -void init_lowlevel(void) {esb_sensors_init(); esb_sensors_on(); rs232_init();} diff --git a/platform/esb/apps/fader.c b/platform/esb/apps/fader.c deleted file mode 100644 index 78e471e9b..000000000 --- a/platform/esb/apps/fader.c +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - * Author: Adam Dunkels - * - */ - -#include "contiki-esb.h" - -PROCESS(fader_process, "LED fader"); -AUTOSTART_PROCESSES(&fader_process); - -#define ON 1 -#define OFF 0 - -static unsigned char onoroff; -static struct etimer etimer; -static struct pt fade_pt, fade_in_pt, fade_out_pt; -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(fade_in(struct pt *pt)) -{ - static int delay; - - PT_BEGIN(pt); - - for(delay = 3980; delay > 20; delay -= 20) { - leds_on(LEDS_ALL); - clock_delay(4000 - delay); - leds_off(LEDS_ALL); - clock_delay(delay); - PT_YIELD(pt); - } - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(fade_out(struct pt *pt)) -{ - static int delay; - - PT_BEGIN(pt); - - for(delay = 20; delay < 3980; delay += 20) { - leds_on(LEDS_ALL); - clock_delay(4000 - delay); - leds_off(LEDS_ALL); - clock_delay(delay); - PT_YIELD(pt); - } - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(fade(struct pt *pt)) -{ - PT_BEGIN(pt); - - PT_SPAWN(pt, &fade_in_pt, fade_in(&fade_in_pt)); - PT_SPAWN(pt, &fade_out_pt, fade_out(&fade_out_pt)); - - etimer_set(&etimer, CLOCK_SECOND * 10); - PT_WAIT_UNTIL(pt, etimer_expired(&etimer)); - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(fader_process, ev, data) -{ - PROCESS_BEGIN(); - - PT_INIT(&fade_pt); - PT_INIT(&fade_in_pt); - PT_INIT(&fade_out_pt); - onoroff = ON; - etimer_set(&etimer, CLOCK_SECOND * 32); - - while(1) { - PROCESS_WAIT_EVENT(); - - if(ev == PROCESS_EVENT_TIMER) { - etimer_reset(&etimer); - PT_INIT(&fade_pt); - process_poll(&fader_process); - } - - if(onoroff == ON && - PT_SCHEDULE(fade(&fade_pt))) { - process_poll(&fader_process); - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -fader_on(void) -{ - onoroff = ON; - process_poll(&fader_process); -} -/*---------------------------------------------------------------------------*/ -void -fader_off(void) -{ - onoroff = OFF; -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/esb/apps/fader.h b/platform/esb/apps/fader.h deleted file mode 100644 index 95c82dde2..000000000 --- a/platform/esb/apps/fader.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - * Author: Adam Dunkels - * - */ -#ifndef __FADER_H__ -#define __FADER_H__ - -#include "contiki.h" - -PROCESS_NAME(fader_process); - -void fader_on(void); -void fader_off(void); - -#endif /* __FADER_H__ */ diff --git a/platform/esb/apps/helloworld.c b/platform/esb/apps/helloworld.c deleted file mode 100644 index ffc18a87f..000000000 --- a/platform/esb/apps/helloworld.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2006, 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 Configurable Sensor Network Application - * Architecture for sensor nodes running the Contiki operating system. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2006-03-07 - * Updated : $Date: 2006/06/18 07:48:48 $ - * $Revision: 1.1 $ - */ - -#include "contiki-esb.h" -#include - -PROCESS(helloworld_process, "Helloworld"); - -AUTOSTART_PROCESSES(&helloworld_process); - -static struct etimer timer; - -/*---------------------------------------------------------------------*/ -PROCESS_THREAD(helloworld_process, ev, data) -{ - PROCESS_BEGIN(); - - etimer_set(&timer, CLOCK_SECOND * 2); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_TIMER); - - etimer_reset(&timer); - leds_invert(LEDS_YELLOW); - printf("Hello world!\n"); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------*/ diff --git a/platform/esb/apps/pinger.c b/platform/esb/apps/pinger.c deleted file mode 100644 index 4e6a807d1..000000000 --- a/platform/esb/apps/pinger.c +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ - -#include "contiki-esb.h" - -#include - -PROCESS(pinger, "Pinger"); - -static struct uip_udp_conn *conn; - -struct data { - uint8_t dummy_data[20]; - uint16_t id; - uint16_t seqno; - uint8_t pingpong; -#define PING 0 -#define PONG 1 -}; - -static unsigned char pingeron; -static struct etimer etimer; - -static unsigned short sent_seqno, last_seqno; - -#define PORT 9145 - -static int place_id = 0, packet_count = 0; - - -/*---------------------------------------------------------------------------*/ -static void -quit(void) -{ - process_exit(&pinger); - LOADER_UNLOAD(); -} -/*---------------------------------------------------------------------------*/ -static void -udp_appcall(void *arg) -{ - struct data *d; - /* char buf[50];*/ - d = (struct data *)uip_appdata; - - if(uip_newdata()) { - leds_toggle(LEDS_YELLOW); - /* beep();*/ - - /* if(uip_htons(d->seqno) != last_seqno + 1) { - leds_toggle(LEDS_RED); - beep_quick(2); - }*/ - /* last_seqno = uip_htons(d->seqno);*/ - /* uip_udp_send(sizeof(struct data));*/ - /* snprintf(buf, sizeof(buf), "Packet received id %d signal %u\n", - d->id, tr1001_sstrength()); - - rs232_print(buf);*/ - /* if(d->pingpong == PING) { - d->pingpong = PONG; - } else { - d->pingpong = PING; - d->seqno = uip_htons(uip_htons(d->seqno) + 1); - }*/ - /* uip_udp_send(sizeof(struct data)); - timer_restart(&timer);*/ - } else if(uip_poll()) { - if(pingeron && etimer_expired(&etimer) && packet_count > 0) { - --packet_count; - d->id = place_id; - d->pingpong = PING; - d->seqno = uip_htons(sent_seqno); - ++sent_seqno; - uip_udp_send(sizeof(struct data)); - etimer_reset(&etimer); - leds_toggle(LEDS_GREEN); - } - - if(packet_count == 0) { - pingeron = 0; - } - } -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(config_thread(struct pt *pt, process_event_t ev, process_data_t data)) -{ - static struct etimer pushtimer; - static int counter; - - PT_BEGIN(pt); - - - while(1) { - - PT_WAIT_UNTIL(pt, ev == sensors_event && data == &button_sensor); - - beep(); - - leds_on(LEDS_YELLOW); - - etimer_set(&pushtimer, CLOCK_SECOND); - for(counter = 0; !etimer_expired(&pushtimer); ++counter) { - etimer_restart(&pushtimer); - PT_YIELD_UNTIL(pt, (ev == sensors_event && data == &button_sensor) || - etimer_expired(&pushtimer)); - } - - place_id = counter; - - beep_quick(place_id); - - pingeron = 1; - - packet_count = 20; - - etimer_set(&etimer, CLOCK_SECOND / 2); - - leds_off(LEDS_YELLOW); - - leds_on(LEDS_RED); - PT_WAIT_UNTIL(pt, packet_count == 0); - - pingeron = 0; - leds_off(LEDS_RED); - } - - PT_END(pt); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(pinger, ev, data) -{ - static struct pt config_pt; - - PROCESS_BEGIN(); - - pingeron = 0; - - conn = udp_broadcast_new(UIP_HTONS(PORT), NULL); - - PT_INIT(&config_pt); - - button_sensor.configure(SENSORS_ACTIVE, 1); - - - while(1) { - - config_thread(&config_pt, ev, data); - - PROCESS_WAIT_EVENT(); - - printf("Event %d\n", ev); - - beep(); - - if(ev == tcpip_event) { - udp_appcall(data); - } - - if(ev == PROCESS_EVENT_TIMER && etimer_expired(&etimer)) { - tcpip_poll_udp(conn); - } - - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/esb/apps/pinger.h b/platform/esb/apps/pinger.h deleted file mode 100644 index 7af1b7440..000000000 --- a/platform/esb/apps/pinger.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ -#ifndef __PINGER_H__ -#define __PINGER_H__ - -#include "contiki.h" - -PROCESS_NAME(pinger); - -#endif /* __PINGER_H__ */ diff --git a/platform/esb/apps/radio-sniffer.c b/platform/esb/apps/radio-sniffer.c deleted file mode 100644 index 8bd4b93d1..000000000 --- a/platform/esb/apps/radio-sniffer.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2006, 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. - * - */ - -/** - * \file - * A brief description of what this file is. - * \author - * Adam Dunkels - */ - -#include "radio-sniffer.h" -#include "contiki-net.h" -#include "contiki-esb.h" -#include "net/hc.h" -#include "net/tcpdump.h" - -#include -/*---------------------------------------------------------------------------*/ -PROCESS(radio_sniffer_process, "Radio sniffer"); -AUTOSTART_PROCESSES(&radio_sniffer_process); -/*---------------------------------------------------------------------------*/ -static void -sniffer_callback(const struct radio_driver *driver) -{ - static char buf[40]; - static uint8_t packet[UIP_BUFSIZE]; - static int len; - len = driver->read(packet, sizeof(packet)); - if(len > 0) { - leds_blink(); - len = hc_inflate(packet, len); - tcpdump_format(packet, len, buf, sizeof(buf)); - printf("radio-sniffer %d: packet length %d, %s\n", node_id, len, buf); - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(radio_sniffer_process, ev, data) -{ - PROCESS_BEGIN(); - - tr1001_init(); - tr1001_driver.set_receive_function(sniffer_callback); - - printf("Radio sniffer started.\n"); - - while(1) { - PROCESS_WAIT_EVENT(); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -init_net(void) -{ -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/esb/apps/radio-sniffer.h b/platform/esb/apps/radio-sniffer.h deleted file mode 100644 index 93d9adc66..000000000 --- a/platform/esb/apps/radio-sniffer.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2006, 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. - * - */ - -/** - * \file - * A brief description of what this file is. - * \author - * Adam Dunkels - */ - -#ifndef __RADIO_SNIFFER_H__ -#define __RADIO_SNIFFER_H__ - -#include "contiki.h" -PROCESS_NAME(radio_sniffer_process); - -#endif /* __RADIO_SNIFFER_H__ */ diff --git a/platform/esb/apps/radio-test.c b/platform/esb/apps/radio-test.c deleted file mode 100644 index ae03e1bdc..000000000 --- a/platform/esb/apps/radio-test.c +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright (c) 2006, 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2006-03-07 - * Updated : $Date: 2010/10/19 18:29:05 $ - * $Revision: 1.3 $ - * - * Simple application to indicate connectivity between two nodes: - * - * - Red led indicates a packet sent via radio (one packet sent each second) - * - Yellow led indicates that this node can hear the other node but not - * necessary vice versa (unidirectional communication). - * - Green led indicates that both nodes can communicate with each - * other (bidirectional communication) - */ - -#include "contiki-esb.h" -#include - -PROCESS(radio_test_process, "Radio test"); -AUTOSTART_PROCESSES(&radio_test_process); - -#define ON 1 -#define OFF 0 - -#define HEADER "RTST" -#define PACKET_SIZE 20 -#define PORT 2345 - -struct indicator { - int onoff; - int led; - clock_time_t interval; - struct etimer timer; -}; - -/*---------------------------------------------------------------------*/ -static void -set(struct indicator *indicator, int onoff) { - if(indicator->onoff ^ onoff) { - indicator->onoff = onoff; - if(onoff) { - leds_on(indicator->led); - } else { - leds_off(indicator->led); - } - } - if(onoff) { - etimer_set(&indicator->timer, indicator->interval); - } -} -/*---------------------------------------------------------------------*/ -PROCESS_THREAD(radio_test_process, ev, data) -{ - static struct etimer send_timer; - static struct uip_udp_conn *conn; - static struct indicator recv, other, flash; - - PROCESS_BEGIN(); - - /* Initialize the indicators */ - recv.onoff = other.onoff = flash.onoff = OFF; - recv.interval = other.interval = CLOCK_SECOND; - flash.interval = 1; - recv.led = LEDS_YELLOW; - other.led = LEDS_GREEN; - flash.led = LEDS_RED; - - conn = udp_broadcast_new(UIP_HTONS(PORT), NULL); - etimer_set(&send_timer, CLOCK_SECOND); - - while(1) { - PROCESS_WAIT_EVENT(); - - if(ev == PROCESS_EVENT_TIMER) { - if(data == &send_timer) { - etimer_reset(&send_timer); - tcpip_poll_udp(conn); - - } else if(data == &other.timer) { - set(&other, OFF); - - } else if(data == &recv.timer) { - set(&recv, OFF); - - } else if(data == &flash.timer) { - set(&flash, OFF); - } - - } else if(ev == tcpip_event) { - - if(uip_poll()) { - /* send packet */ - memcpy(uip_appdata, HEADER, sizeof(HEADER)); - ((char *)uip_appdata)[sizeof(HEADER)] = recv.onoff; - /* send arbitrary data to fill the packet size */ - uip_send(uip_appdata, PACKET_SIZE); - - set(&flash, ON); - } - - if(uip_newdata()) { - /* packet received */ - if(uip_datalen() < PACKET_SIZE - || strncmp((char *)uip_appdata, HEADER, sizeof(HEADER))) { - /* invalid message */ - leds_blink(); - - } else { - set(&recv, ON); - set(&other, ((char *)uip_appdata)[sizeof(HEADER)] ? ON : OFF); - - /* synchronize the sending to keep the nodes from sending - simultaneously */ - etimer_set(&send_timer, CLOCK_SECOND); - etimer_adjust(&send_timer, - (int) (CLOCK_SECOND >> 1)); - - beep(); - } - } - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------*/ diff --git a/platform/esb/apps/sensor-output.c b/platform/esb/apps/sensor-output.c deleted file mode 100644 index 632b604b3..000000000 --- a/platform/esb/apps/sensor-output.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ -#include "contiki-esb.h" - -#include - -PROCESS(sensor_output_process, "Sensor output"); - -AUTOSTART_PROCESSES(&sensor_output_process); - -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(sensor_output_process, ev, data) -{ - struct sensors_sensor *s; - - PROCESS_BEGIN(); - - /* Activate some sensors to get sensor events */ - button_sensor.configure(SENSORS_ACTIVE, 1); - pir_sensor.configure(SENSORS_ACTIVE, 1); - vib_sensor.configure(SENSORS_ACTIVE, 1); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == sensors_event); - - s = (struct sensors_sensor *)data; - printf("%s %d\n", s->type, s->value(0)); - - if (data == &button_sensor) leds_invert(LEDS_YELLOW); - if (data == &pir_sensor) leds_invert(LEDS_GREEN); - if (data == &vib_sensor) leds_invert(LEDS_RED); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/esb/apps/sensor-output.h b/platform/esb/apps/sensor-output.h deleted file mode 100644 index 5c31d2d62..000000000 --- a/platform/esb/apps/sensor-output.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ -#ifndef __SENSOR_OUTPUT_H__ -#define __SENSOR_OUTPUT_H__ - -#include "contiki.h" - -PROCESS_NAME(sensor_output_process); - -#endif /* __SENSOR_OUTPUT_H__ */ diff --git a/platform/esb/apps/test-receiver.c b/platform/esb/apps/test-receiver.c deleted file mode 100644 index 5f315a715..000000000 --- a/platform/esb/apps/test-receiver.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2006, 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2006-03-07 - * Updated : $Date: 2010/10/19 18:29:05 $ - * $Revision: 1.2 $ - */ - -#include "contiki-esb.h" -#include - -PROCESS(test_receiver_process, "Test - Receiver"); -AUTOSTART_PROCESSES(&test_receiver_process); - -#define PORT 1234 - -PROCESS_THREAD(test_receiver_process, ev, data) -{ - static struct uip_udp_conn *conn; - - PROCESS_BEGIN(); - - conn = udp_broadcast_new(UIP_HTONS(PORT), NULL); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event && uip_newdata()); - leds_invert(LEDS_YELLOW); - - /* Make sure the message is null terminated */ - ((char *) uip_appdata)[uip_datalen()] = 0; - printf("RECV: %s\n", (char *) uip_appdata); - - } - PROCESS_END(); -} -/*---------------------------------------------------------------------*/ diff --git a/platform/esb/apps/test-sender.c b/platform/esb/apps/test-sender.c deleted file mode 100644 index 7881c2704..000000000 --- a/platform/esb/apps/test-sender.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2006, 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2006-03-07 - * Updated : $Date: 2010/10/19 18:29:05 $ - * $Revision: 1.2 $ - */ - -#include "contiki-esb.h" - -PROCESS(test_sender_process, "Test - Sender"); -AUTOSTART_PROCESSES(&test_sender_process); - -#define PORT 1234 - -PROCESS_THREAD(test_sender_process, ev, data) -{ - static struct etimer timer; - static struct uip_udp_conn *conn; - - PROCESS_BEGIN(); - - conn = udp_broadcast_new(UIP_HTONS(PORT), NULL); - etimer_set(&timer, CLOCK_SECOND * 2); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_TIMER); - etimer_reset(&timer); - - /* Send packet */ - tcpip_poll_udp(conn); - PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event && uip_poll()); - leds_invert(LEDS_YELLOW); - uip_send("Hello world", sizeof("Hello world")); - } - PROCESS_END(); -} -/*---------------------------------------------------------------------*/ diff --git a/platform/esb/buildscripts/Makefile.freebsd b/platform/esb/buildscripts/Makefile.freebsd deleted file mode 100644 index 489b4205b..000000000 --- a/platform/esb/buildscripts/Makefile.freebsd +++ /dev/null @@ -1,18 +0,0 @@ -ifndef JTAG - JTAG := $(CONTIKI)/platform/$(TARGET)/buildscripts/jtag/pyjtag/jtag.py -endif - -ifndef JTAG_PORT - JTAG_PORT = /dev/ppi0 -endif - -%.u: %.$(TARGET) - $(JTAG) -l $(JTAG_PORT) -e - $(JTAG) -l $(JTAG_PORT) -D -D -S -R 2048 -p $^ - $(JTAG) -l $(JTAG_PORT) -D -r - -r: - $(JTAG) -l $(JTAG_PORT) -r - -erase: - $(JTAG) -l $(JTAG_PORT) -e diff --git a/platform/esb/buildscripts/Makefile.unix b/platform/esb/buildscripts/Makefile.unix deleted file mode 100644 index 782b49500..000000000 --- a/platform/esb/buildscripts/Makefile.unix +++ /dev/null @@ -1,2 +0,0 @@ -%.u: %.ihex - msp430-jtag -eI $^ diff --git a/platform/esb/buildscripts/Makefile.win b/platform/esb/buildscripts/Makefile.win deleted file mode 100644 index 655a3d81e..000000000 --- a/platform/esb/buildscripts/Makefile.win +++ /dev/null @@ -1,11 +0,0 @@ -%.u: %.ihex -ifdef JTAG_PORT - msp430-jtag -l $(JTAG_PORT) -eI $^ -else - msp430-jtag -eI $^ -endif - -#CW=cw23 - -#%.u: %.ihex -# $(CW) -d f430p $^ diff --git a/platform/esb/buildscripts/jtag/pyjtag/_parjtag.so b/platform/esb/buildscripts/jtag/pyjtag/_parjtag.so deleted file mode 100755 index 76fe1ecba77c467c46d17e980b1dd6a1b06b2070..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 30388 zcmd^odwf*Ywf~tUV2t2|hk|J3l!qjWF(6t)iw2V6QC>q{SW&|ynPC$1a^?(>3K|?} z9V2b5-qvb+FV@=9{`#=$E!<0M16a^LvD!+j*Ydl)_6Ec4rB^;7O3d8vckgxPoEZ}E z_V>r{_xb#e?tIVMd+oK?UVH7e_cxd;q&g&CcO%szH6nc)$-b_$ zZ-5J2_qWLXor0~vO|Ej@(r(LGeBz?FF;?oFg?TzR~$LE4BU!)#d0#5G&P|IrO~7)b=}6ZjeH>{O60Zsk z>Sq;x&PTdg@|Fq`%8(W!T}lGiRHW5N)kvR0vagTYH^3E0Hy~9?UZEf%B=?sC*T_AA z^XwByn2N?-NQ;q%yB?KH9T_miIZ1J48=T38apWQeptIG@1Bd~nlm1LDU&1HxIodzQgp7OPo!uarWl)eWgB@4H*=!n$~Lqjohf>Z%4Zznm2Hew z_!Yz*UfIUQ3K@rZWgA|FOFI>S)*bPu=y9sx))YNn(Y+~pf}-so*~UcsR$;briSY@T zEC++hc|0Eaf6K+e*8YO>V{m|HrF@Fmnrtke1QWNzX`YwzLJ#5$9F+b;dF3dd0mr&d z=!+olfqQja9f$sZ4du6Epg$+&-=sc%@CbbxcygX$yaYbVgLoCE0meAvugU*J#!(1o z%wqYM!FRICQ2ikNI2q-lzAY#}g7(o2>W?)JfX*#7jQc^8|78?h0Vli#a!GFjoewAO zl=3?>`hP3xS1mV;?*hsH4C)m?pJ#-BkPXSj_RWm?(^38lmpw+YgL09duJRfdk#ZpA z{|N1T2MfRfq2B`97x{N()Smr;C~dxI3)DvA^3SL8l1^&@3-tvsg6segP`q;_L&cP zZz2#*0J8i(pnb7?woL#{q#Gz7^8+SP{7+C{5FeHLj8ij;^%_WdkDz?TGDFEFJvl@E z11N7s5dN;ndn==SC-faaP`pIsFJt@gXL~%lGx!&xyc_;$ms_Cii~adJXgeO{W4`2p z-iyiEj56x?Gqm?msWV^q*p-2-p9TJMj32tJ#_xOJza9R^HH7uop!@{%W#l7WjsD#X zet_cN3jSX}KgJc7UrT=Y6C*3>=fLrgue;p6Hy;kRQ*4p{_Q@) z_(!3ep|6E_uwLj(P~W~dUd50NTDNpYzJTNE@}~pIWtW<+3uPcFBs>ix#e^UA=g5rLU^CYT=?4zFMQU zv9-}MYC`~{wzeS{32tbNTER$dC=zH1qBPWo{NZx_9Sb8HYW;yoG*}gDZw?wOEB*7X zFRon%fsKLY#!shmR<{RR?b5Qg)==YySR`oF`a5b@wY3H-tw^liGW;FB&Gog*R{J86 zwg{<6q;_#zq$Oabsy4SpQ!*=p(V%6t1e%-M>ZR_=U`tzs^-y1Q(OD?3T@-671+RTb1+u6HN={O^NfaIU2H>bb8us@ z*$C1~t70v6!H5yu9ITI7LEUq^8!Os27)zI}aE~U*GBpNpjVQ-A)EtP0Yg4+4Rcgx0 zR8V474=sxG-!Vgm9n|}W=*USwrdHt)VFsS?UA+((0DPGr5Fs30fQ4nV>QNl zd{Q~EPpudzElrTFY9aR%CI|st=R$!<2z$i{=vZxNgNBVg=pjkoM48c3St? z&I!_ybygcEWMf;s)oipYPcZ7$xYF`9eyukqYAf7L>n@{FRlZEqzRD`a7>hOsgY7D> z(h5YZs>T*L)P|sC;ifIr5a>{4)KC|(g-WZfT~oEehJY1-7uQ9jwNVN%YJ;r}3|n&% z6LWzjz^r+AP9a`u80&zZo3URKd=N;!hglB3$B7@qx+~?+3jP*IzBgG8z9HrpVI4#) z_pHNODL4s8zGCHm>fRwX}`Ov3M@O~*zNcrQE|1Hu5hVh)x2L#^& zvc0!i4teho1BP*0%Ex1`mxXv=1SH=Lq`|ic$aZT;WAR>3#6CDe#Qx`A;#BP8f#iD} z$ok(9+{f}e4dbUoEatxv`gJ0nr~ZQoIqwl6CmVY<${7!&oGS%C24ug=iI7tz^qoS7 zh>+JoguER@$oo8y^8Ox3dEXZN0n5?9JyL#1@UK!nAmx+5!}?KR7WOZ@h}hTd75e8= z{s+McH|Tbz04cwkxDfUc^xmlHa=}}H)T@>>_`gRC8AhMr8u(b&WW$IPk^f^NZ1oxu zo7h32C&4D9Zy}<5ozNSJ^@i~v@gD4{f$YyW1P=k({x4aM_Wy;5ecxZDoIXMRX+ZK7 z0?9X@h|P>o%4-Dg1(I(E%fa^#MA++qhoZ5S^T@o@1f5u4&;MD+0;p-&6#fvzmSn27Sp zLeCU>J`r-33sy^cozNXb_}>FW>|Y-j{5o+u^by=A_;VuoUl;l>M2vF|VgT)N5s>zn z1@z3s{3MNsxa)~m;@t@m^{a_!uTE$S$ogHR;eQVUS^o*aZwmfEa1W6DF96xzQ6l91 zS@Qow@<+ipXqRzB#Dgn=tT&T1;=)ZrmkTauKIAnLq369s*x^AUnZE`U$4-b5nkD+P;)kUw9_mkWKH&<_yN&KD&ANy-17(EEk{6%lgZ6#BT( z?+O~X=ytqB=y4Mfau-Sd8p*#?XiMmAM9A$H`l~{JQ}B7g7l`P`FNu)9M3Vk~fd<{g{sa5i~O8$dH$bUlU-9kSr_!Gfj5F!5!BILa-bipEB ze=hNM^q+|NyG-aB!S#~gBJ?J~?Sh{Ze1eGjPYeC5;Ex1fmhxAHJ|_4M5&g(2LxP?c z6QSovh{#_~ybAMF=vpH9;zaO0BJ`6&|3K)U2>lDH`f`)6+o`53xKR&P8#)Z7rI{PyMUe> z@vei2dIy+4+c5qe$a;Svjd~X^1!BFL31t3k(#W4foQ3&AgpY3kazA*F;Fpcb zfo%Ux(rEvL(C-R8>XTZImx#QN64Bl@l0RSamr4E_BI3h($#0YVEkx+^8Oi@U$=?lR z`_BvRV?OkFlZf{Eh-hzsi29?kHj$n{1pN`gYl+}5k@8Oyp+`56^1nnHa=%A}-|i!V z|7S$Vdz}b*|6B6kmHZEczH)`;DdAH>MGilU& znTU3OM})j%lK)?lKPdF2h`}tMMg;#&MATm*^hO}t+e#YkeTInk9+v#aB!92aKN0$6 zBILY5gxt4@Xy=sBLqcDKy%+N*0NKtI(rBkt=p{n0Awu4rMDTx8%Kwox^m#$(pOQxX z*MxpU=wn3K`h?`aEBOT_h(`S>?HZ`kw&{?{JP#Hf~Me1AnV;o zL@FgVBQ6lJ&aEZFUJb-Mv91y!e+!U$Y$FZ%j|%-w($M?+MD%B`C;__1H)nGP;PU_n4G_P4G8F^kWQkXZfW>v_D<& zTFIX;G~Q^a@->3%1lI%E-s7av-uH=+_aiAkB-l?xdskL!{#k-^1wRI)-4_VGSa6MC zjg;33eV5=y!F#0q0V4e4?2t=|PemX8(sQo*T$R|{ST zB;O4}-z>OHaFvwT2wf}KB-ke9pAq^Cf=>v3L-2nA+0Fr>ei%O!t}&|$%dU|jHF!Pf+T4`jOoMEHHyT8&;J z{P!}UuM*@pW$N?1;9kKV!50Nz5Zf7}%jcm5ZOel247n&oFO~A4}qTDxWlqj~`L=MAFPW-lOQr zr1|6cGm5@~v`KoGqInxGAlw2G)0FulRi0wjHgzR?j(Io(QGRG0O=!& zt|Hw{x<}D$I{X;vXB2%q>0P9EDSAEW-K4t}-9Y*o(w&N?YT>=4+d)?+-j1J`SlJ8O zShwxq5lD~ktNI|BG-73a6BGUMxF1ALmx8X+!Q>Hr8^6hj{VBe0GwWI2_=~4@#>>$g ze{Uaz9*$Fj2Sr_X^uByBqm5>?vF_!AiT;fID%JKwO5&yQ7YBC6*=xTocrL^%aorj9 zt{6dH4)VKvV|G4L@OmPMA{iTKx}bOWpkxo% z*W9D-zJ37K^uAuPwkG9mb+#6&c~QpEqL`v8dM~rJh~>@cIsPCOrCm>T`3B=XS^nPl z&R}>CQ_p1V3T21uwGNy_uy=>jp|7gD$%Elsi$3&z5mi*jVv}^o*6xh2WToDRDC|(* zWlD}etuJ#ZryteO_S)X(KqXG@3?5x~XYI=eGkx*_Y#o$+PtmaHX69tEE$ur6Yq#ir zQhxkJ6Ao6=WI$6Wnv9+5edm2!*R#g^?lk=#hU)3IcINc}qR9VLpC^@(pigY{oSwe= zM1Q|;&|_VxEVEm;yhU4hl4`lHRE>+)8$VC=PEDyk5w)5;JL500UhgdA_l>8|HW_x_ z1mq1rCq9wV9m@!PbttJ!O6n|I{!H8QZPl`}Wy*7@(X}a!@=}vWkM*z9Z0Q5vNVfbA zwtT4p)NaFx8nH!N70OVTC_^204Apl%?1NxIFQgNWvn#|hb;fwAaZSV2Zc0cvp*r;3BuII*GD8=--nR8?7pka+d*h*rJy%kZ-urBR- zgg42&*ceFbT9i}KRXQ1KtZy(8XMydc&N@2A6+fpz!>;OFEOH{xyS-CQioux>Zuq@> z4j{ZdOnrKv>t|p?f0~S%YYhm#j0=)`X}VqC?$7U$F`4Rko2sfOr_x=k@9!Y2H-PGW6VR`uS8Kl{XRWHcGuW$wV#Ydc`PF<4pUTFkbo{q7emk^)f}{RK z1?wP_n!r__v(QRYcJHr|l^zqi?tq;J!ks~sdwLNtm7Bj|jXsSJLmFJ2Eiv+s@=)jJGvobUn)Iy9$;~ znPYgn=GtvKzN&26>&Q+GSdTS93(v7D_2n}jz&Y{XXvHV{M*6!pYS&h*yaQo#L#n@Y z(l=uHj-JQ)tDW8b2R+t0B_jkcSYwak(jEN_5vQ6iN$HWaW=g3wUP~DRg^rg%in7~w zJju~t*zPT8_c&%1`$GiOzrH-rZ@ZO8?bfu>Pn|ITvn)2)th18|`!|Kv^!&x@iMB8U6 zQQBNk#&FH83qdNsvqOO17ujRDbqx1Ua9N5;Oc7Y{i?g(Jtyt`ym!xG zMAm~kAA7}7FEEqT$`{gT}N_Pnw0cZOx_Q-M3iv zC~@$bJ942w$>FV8i8FKhLnUuTKZQzNzFf~qt#*@+fr$g&J%_qhj(K1rW@3J5F*qZ? z>$?_=yFC`Bw5lRKZOYdkvcESM8^s5*_G!P*M?;DC3il^o+R@|vTtAG4SpODhJse-2OT(*J>pe&OiGji+DPuZHiVf93LPc$^MHHs{ zGwJzr>2;jHw~oH-EcYfCaR1=_JfB{$oE`R^z>R@U#%?)%n1gOzhe)%t)}z;i#367n z8#=CqhW;9*!l9gxB@=%alsOz61|%j9aPdI~RK>VF?CujV?M= zezPZeXmoN(-zQ*a<+mlG!JJ_=5D|$#qRV*3r+8FPuEYc|l?4y`Yv6CW((*xNrW1yB zA*5-o5ou&CxB!alRdlSZtH?mOvmg4>_YS3QZ^I^d$nX8(8`?e$yHmV-s)t~kge+HD zRNr_NV@ageY-jzPh?P(6chY5h_qDGI2ZQ>{* zpy%K#XH+YD`n6G%kJ&+8^*goK;Y{mElhI@(PEyFBSBAV0KtXCC93iQ9LR}wW*VSZg zOifm&Gl`?h7_d=>tsUn0nXwy3?ZbY>=*syj-}I^)?sbP9?TRt-hdZ5mHEUn#qh@d_ z?F)AAgUy2)nI30kFy&+v zZTrI4Lbg+=Ce#l&zITTgLeJ`qqq|8jx6%{-fcB369Hg@4K=>pgvAqO7 zg=_;++`H!z-i7wRlj}JWQn@OG*!%OQl*eLB`<8XTfOqgBuPNW&WWX3$Q4adU@3Mz_ zYYX=N!&$Mjt;A@aq8q zL*?)grjyI!Df4IOY>&#RrbQ07<3fo8Sm;6t1Wm^~;0|;GkE@5d@UOGR#qld!k&$Ik zzU^TmKY2^40~tEI!`+3p7BXr&LZ-e+V6)(a<#RUgM7<12YP`6HgyI83v1{FyP-Yl8 z-uB^r%qhL66Wb~~>L*8M&2gToc1DMWcU@N}Qw+AbsKmJ^Wc=WeUbZtlJHxCgSI97h z;|=V4xl&-x8;}($IpdAI{y_^&*DIf;JUY|Y2IaQb(Bc?g?$ zBn(|YZxKc4G2)%=7%IXz+4h~vws}V6wiz;njF3Ho>=Cj@5R%FcmC*?I52`OYrH|28PQ2b0j-_vpAbKx3&TwQQK z*>Mv(S~%{678GX$vG9(JQh7X1Q&(wWZ>Q4qb-l)Qf1*% zWo3$>N9Dsf(Hqf@>JOa8yC-Lf9eEwUQMGIl`5c0GBfoSUONq0UmUWJMT(wm`OT9F^ z4yEkMxMJJ&GDqQI?J6%2wB_7(9YN(0y+bLNIEu|gzLoX7;ofCSKa`LBAJ{%KTxQt5 zMA_a^J8jOn)W+M0gQ3L4B^)wk{-2Fte%ogdhw(-bk85M_!o}XFtNuCuPo889emWde zYQM6NPgiWs-V4(6zx{2;r504?|!f}Bz!{*aQHSYUtmLref>&L`z5d*Ti;1&fz4kL zB0w^E{2sOE#jX<1nBiS_rFNkZ!gBB)=RbMxrfxh`Lmm{mww~mhG-L3err_thPluic zC%!a z@&L3(Qvn{T#X;qHnfns=GV9DOnG{ak%J6mDozvG9^qbEi9b|UL+SDdZJ<%XS^-aQ) zig){I=tEw6*~?$GqyJv~YJj5$7cTv{V>F{1?#CVLM>OS?%pPTrAm5~`=N~&RJ9;2o zbB?A|aoUylunubmpQ)ttwMY#sEtJN{m0jk{c$PVjvUXh1&8D^(`FIq{$7Y<_;WKZ~NT4tq-x)8h+$Uj>h<`CVT1h?`10Pb0>}oiTSYoK}11p zN&5|tcZVPMwxPT`7J*VDcgIj=cs=`;+SlRDop(=Gyk|)Hn7yvTAnDz6ZM;=ks(#9| zXhV#FYau_?Br6HN3YaBtZN1vN=Z+y2JDc+HA`mi5l(eK2*kA{P@-(!@A15XX_CAW}6Qd6KBNBaC~$!7ncled5at)_1+eBIbS#;mghua z%FxGi?)L5|gGm;b{BFxT?9CtDW=QptgB1R2T2VM>3|wV8zSW|6hE<+ZLN@*mU}`Qq z-aru;=eeb+x#o07m!+nc6G~9vOh)nZ(b;)EX;{r(fcH+YM5wIPVC~|N1QV2#>Lx)rs5Yf@5MfG zAiNgM^j)II-kz?5HQ^o_%M}UK?}UZR9i7xHv-bq8%-4g<7s>iVxxL?+Ov`22U$CEg z^gh}-KR%GOYV5B>`gbqFmV6ljVs0#V4xH3c z!qInFbw$L$0pz#mQ@!h|&}?jD*vc(0V!omYnN zVCaddK01?S7z=wi{d>n?N4UMm%8viqgYDPTDr&{>B#9oXHOSrT{N9VfjXhqvpQ}A` z>RpT43;%8Q%Cx`;_R27f`lMop@R=us?@Y^-Hm@GTjztHI3suy&QG8Cx)?KT_+nV3Z+dsDhT^q}l0uCc`F!8{qM3KU~=t;eI&Vx~8vDbWt)! z?oUqNRk~w2Bk8QWG@_WkspqNh($(%K)ya~6^8SO7+8&{<$5j_g`0%!N)jgk$MwFqu z=CN(WPo~5Bh8p$}#n?6)vA&}#zeDC?!sKZW80^dK)_#%AwnvKm;O8vTe&za(M;FuI z=kV;rpoHHWI5w*A$j+Sm_aDpFJ2j_mFbstAx54!d{7}I+Eq0`ebM4};vEqt)I1fvNnJg)e&!jeGq`RtBqY0MFuG9~lEGarE@@ z#4CxH_799s{9*t5Qwxt|`vwYAzwnFo&(U%6As>FFk4tmXAHK-%DRr$45Bicb%$Z39 zV258t;`2r?o58hY$hwR7QoRt!U)Y~oi0$ZeC$XT%_wi@a8r$798jrMx2IDv5H(uA> zDRm~Ms+=g0-@oro{yLdFh;tenf*Y^H0Z#305v$nP5~XPORn``3ZZKQhER#n)>2tPB zD;zYN8|xy0NQYU#n)A(>(L$pv&^pU9dDst_ai&)&P#<*58t&eaUvHn(09r+PN>MdW5GWnK<+Z#|4=Mt!*Y6R(djNVA~;;g7Nhx%#x#aaJdrDdV?-qvsTRzZSkyAZfsH{k&}!nutX8u* z*t)?A8;u4!+30Fs9jm0QpwCv~iAK75UC?X`>B{P~ET`*ococfv5Oj&E4+mN|1kIN8 zT-Cpbeae_4M0YDyuzEhsSsO|}kqeH5Q`|80DUEno7mp(|3K|;=4IH@^Y^TNHAf|ne z*L=S980k8@kpdntMHz*8Rq(@EHaW{|j4GMI26I!R6*dd%+hVQOY}0D90?mbHAZlXl zV=ci}E1I_{+}MmULVeW(R%QRJU~5sHadw*{X=fO)hcZk7Zdzk4vrU|y77G^UX=^D0 z3YfOp@=_Hv9|l*4zgF4rsgL?73N-Csv@b6=ubt(PTI<3`fVAvsh;q zd&f*YvGM|~4W{jGjaHFa6^3c;Au=}w8m*{_QE6;el_&w?+S;Qgd?H{@Yr>?PF)a`C zFJP)Oy<%2To?o5Q29sbe+Rdq9SL!vi)vG}bD8Euu7wS-Hjx?tP)XS5Ws5lHDy@oY0 zgVl^Guy91)0$;_#N?+~56)R?&frbV|jOc>m%^}2q*)ks&%q`4Qr?)Bf)eJ1k%fqpL zjSXrZ(Z_=G^GsY?R^^hFRptV-*p;<%;j&f8n&Zksizc$><|&tM2!;Z&X3JIqA)!H< zr=Q~JM0hPM)DnoIIh3_vbWGKYqP(g$eFytR(N{QmG`N92@79Nv5ND)|YPP7M4On^L zhDE@xA`(JMv^`kg7-|eQa4Zq_RanA2Yc)|=A8x}Li3nDVsu&vtlsp`e-#gP%+qR<<%6>CE(lcq!qIK>dI#}2a`Cpnri_RPeAeCR}=xg**b zElQ1J<^;j`!sl_sVuAE_HiLX&-Yoo_g@_xaL!l=ym-cEqgzAnK<>}M^Oe~W)3(#I5 z0vj4}Y@YIgXso@x8RjunARa+AtwN@5q@jk6A0JM=+4gLt1vu?gtLTCfQk1t0>vYs? zZ;M775p>x%9f)x3USoS025gSbHY*mcWHj6qY;Gos7b{2&yNpF$5QYybA#AbH(xDYv zD~5tXWqH-caJ^IgQ}Hd;JuXd!c@k;DYkjggAj>cef0~f4wV(HX!oI+*Rjos+C>F66KrVaoEf-Fa%A189Ut(Ei%j7xKG3(l*n(4=A~ALK!`gB z?T6S!MpQ&c1V^Z|XR!`K5VZ-8ixp2rCbj6aw_(qz`hw6DYi*AN8yf2a7JH9qqeK;% z)o4?XSRp38a&2}6ZkI<@QVSJLudHdLx}E21bxg?sDkaK#YEvnTonFqc_93RZM5bnz z*iM?)0VB}bVYb0Y5j|42MP_p$r0sN>osHpX#MD(omFlXcwBv{s*-9I!lUdL98#`xN zEA}W@ywtIrCU!79p;g5^T94zY5A1aIfst6N__J#(siHx8kklN_2Z35{TrU2T+e4`30cK;nCBFqb?L2POSFAM zef@k>PM+l{zWPzGs0h2Ib6vyMSEu&ss>7GtyVHW=%`-R8Huu)zUp#fuWg@7)Y0)t9rDZIS%&z*lauo@ zSarj-IFwi!B3%zDT#ZNN^H_M;dTL=AMl4P{uC4Ilv~9EPEPZgo@rY$m(p8o=+{3o- zf)q@#pCs&M{Jlc-!{XRIRSRme0}W6EJLjwphn+C2+^YzNLtXyv$ z5H&_9Ijf*-RaM0byg(|Rw|SU}>`1A^G2Z6t<=E7y7(Aa*L)FP(2?g+IkC@#2AI-2Rb;p^+&0-hPqT^S;V zug~NEqhVUsDOZ*iXRx(#N@euj6;zfzt`6ra^{&!XN1D6Y8|-%*Fqt~dURl|xr=QU> zGO|q&B`v*}F5~22i*Ofq#b>vOeK{YKhbi!vxdmV+ zmchgKE0`m0CY5C??=;RQ7R8y-pG;Dp+KzMbI-Qd0di?zeyh!#SYgZl44ni6fx-@_@ z6_KzNQsq7Cai$Pbuh7S8ab_6Oi&yJ%1NVQr6Y{Uo^m^PcMarM8=}sJRvk_^RO|Qe> z8$+6Xtu8OceF4%}gf?*hSNw~U$wj)n2ltO6Js`A+`;o2?-d30LjWyB{ylUHpWFf6Z zDnT-lE<`$p{{I+hH`3oBbt0u*S!1%o_*D^J&z5%HW_sox7+-oa`D|Il^K9wDr?19O zsycGEae%`mXikptA=aO)mBMqp78~=SKyga`iJB{m*E7;(oavD5+6!y2JCC`GfUrwEw0S^Rli&J4n-z<{~XZsz9nkiXh#O z^aZ4^Aw7$90O>bK|BCcqNIZviJkm6zxk!tUDv;`sB1j+VT2fXv-z-?Ns=CmuH|G|W z+)y;noLgKxxA^+G#pb%j_!}XMD$DP{!JPkp@o~&~(UFVi6cx__{@=1;mrI zQG_>xVWX&_qcz&mqS1;NMR+SvWCb@{`i>9V`ffv;WVJWrhEHNfk@^!iMUghm6%6aY zaHC`eS{mz(qI#<>5(TXRf06=OZ7qEHY82tAl7Z;MU7T~AkDP0qn@n3U0VO1;Im>y= z`A1&nbIvmLT%hMF=N)-CcX14%n!n`Z9B1O(wl5uYaP}uME<_?9=Q7hXn9!sd4_Jj` zc@2`y$G^qLvN*4vGF{~gfTmPn6V#6}mFGV4Z=0TChFrEhEPW|H{*A$}v}wIF`GUxxK9t8e$-jlV zTWCPaeyzB-+g;j;v1oVZrp-r;A=!NXPW+>|5%_Q{VTzAy!>!=!MxK4KA52@2=r`1_ zw-X6`#kjXGyT99z;WC5b= section.sh_addr + section.sh_size) \ - and (not (section.sh_flags & ELFSection.SHF_ALLOC and section.sh_type != ELFSection.SHT_NOBITS) \ - or (p.p_offset <= section.sh_offset \ - and (p.p_offset + p.p_filesz >= section.sh_offset + section.sh_size)))): - return section.sh_addr + p.p_paddr - p.p_vaddr - return section.sh_addr - - def getSections(self): - """get sections relevant for the application""" - res = [] - for section in self.sections: - if section.sh_flags & ELFSection.SHF_ALLOC and section.sh_type != ELFSection.SHT_NOBITS: - res.append(section) - return res - - def __str__(self): - """pretty print for debug...""" - return "%s(self.e_type=%r, self.e_machine=%r, self.e_version=%r, sections=%r)" % ( - self.__class__.__name__, - self.e_type, self.e_machine, self.e_version, - [section.name for section in self.sections]) - - -if __name__ == '__main__': - print "This is only a module test!" - elf = ELFObject() - elf.fromFile(open("test.elf")) - if elf.e_type != ELFObject.ET_EXEC: - raise Exception("No executable") - print elf - - #~ print repr(elf.getSection('.text').data) - #~ print [(s.name, hex(s.sh_addr)) for s in elf.getSections()] - print "-"*20 - for p in elf.sections: print p - print "-"*20 - for p in elf.getSections(): print p - print "-"*20 - for p in elf.getProgrammableSections(): print p diff --git a/platform/esb/buildscripts/jtag/pyjtag/gen-ihex.py b/platform/esb/buildscripts/jtag/pyjtag/gen-ihex.py deleted file mode 100644 index c917ec975..000000000 --- a/platform/esb/buildscripts/jtag/pyjtag/gen-ihex.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python -"""Test File generator. -This tool generates a hex file, of given size, ending on address -0xffff. - -USAGE: hen-ihex.py size_in_kilobyte - -The resulting Intel-hex file is output to stdout, use redirection -to save the data to a file. -""" - -#return a string with data in intel hex format -def makeihex(address, data): - out = [] - start = 0 - while start len(data): end = len(data) - out.append(_ihexline(address, [ord(x) for x in data[start:end]])) - start += 16 - address += 16 - out.append(_ihexline(address, [], end=1)) #append no data but an end line - return ''.join(out) - -def _ihexline(address, buffer, end=0): - out = [] - if end: - type = 1 - else: - type = 0 - out.append( ':%02X%04X%02X' % (len(buffer),address&0xffff,type) ) - sum = len(buffer) + ((address>>8)&255) + (address&255) - for b in buffer: - if b == None: b = 0 #substitute nonexistent values with zero - out.append('%02X' % (b&255) ) - sum += b&255 - out.append('%02X\n' %( (-sum)&255)) - return ''.join(out) - -if __name__ == '__main__': - import struct, sys - if len(sys.argv) != 2: - print __doc__ - sys.exit(1) - - size = int(sys.argv[1]) #in kilo - startadr = 0x10000 - 1024*size - data = ''.join([struct.pack(">H", x) for x in range(startadr, startadr+ 1024*size, 2)]) - print makeihex(startadr, data) diff --git a/platform/esb/buildscripts/jtag/pyjtag/install-pyjtag.nsi b/platform/esb/buildscripts/jtag/pyjtag/install-pyjtag.nsi deleted file mode 100644 index a2cb801b8..000000000 --- a/platform/esb/buildscripts/jtag/pyjtag/install-pyjtag.nsi +++ /dev/null @@ -1,108 +0,0 @@ -Name "install-pyjtag" -OutFile "install-pyjtag.exe" - -!define SF_SELECTED 1 -!define SF_SUBSEC 2 -!define SF_SUBSECEND 4 -!define SF_BOLD 8 -!define SF_RO 16 -!define SF_EXPAND 32 - -!define SECTION_OFF 0xFFFFFFFE - -LicenseText License -LicenseData license.txt - -SetOverwrite on -SetDateSave on - -; The default installation directory -InstallDir $PROGRAMFILES\mspgcc -; Registry key to check for directory (so if you install again, it will -; overwrite the old one automatically) -InstallDirRegKey HKLM SOFTWARE\mspgcc "rootdir" - -; The text to prompt the user to enter a directory -DirText "This will install the pyjtag executables. You can choose the same \ - directory as for the other mspgcc tools." - -; The text to prompt the user to enter a directory -ComponentText "Select which optional things you want installed." - -Section "msp430-jtag (required)" - SectionIn RO - SetOutPath $INSTDIR - - File /r bin - File /oname=license-pyjtag.txt license.txt - File /oname=readme-pyjtag.txt readme.txt - File /oname=bin\jtag.py jtag.py - - ; Write the installation path into the registry - WriteRegStr HKLM SOFTWARE\mspgcc "rootdir" "$INSTDIR" - ; Write the uninstall keys for Windows - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mspgcc-pyjtag" "DisplayName" "mspgcc pyjtag (remove only)" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mspgcc-pyjtag" "UninstallString" '"$INSTDIR\uninstall-pyjtag.exe"' - WriteUninstaller "uninstall-pyjtag.exe" -SectionEnd - -Section "giveio (needed on Win NT/2k/XP, but NOT on 9x/ME)" - SetOutPath $INSTDIR\bin - File ..\jtag\hardware_access\giveio\giveio.sys - File ..\jtag\hardware_access\giveio\loaddrv.exe - SetOutPath $INSTDIR - nsExec::ExecToLog '$INSTDIR\bin\loaddrv.exe install giveio $INSTDIR\bin\giveio.sys' - Pop $0 ;return value/error/timeout - IntCmp $0 2 ext_here ;assume its alredy installed - IntCmp $0 0 0 ext_err ext_err ;if not 0 -> error - nsExec::ExecToLog '$INSTDIR\bin\loaddrv.exe start giveio' - Pop $0 ;return value/error/timeout - IntCmp $0 0 0 ext_err ext_err ;if not 0 -> error - nsExec::ExecToLog '$INSTDIR\bin\loaddrv.exe starttype giveio auto' - Pop $0 ;return value/error/timeout - IntCmp $0 0 0 ext_err ext_err ;if not 0 -> error - WriteRegStr HKLM SOFTWARE\mspgcc "giveio" "started" - Goto ext_ok -ext_err: - DetailPrint "Error while installing and starting giveio" - MessageBox MB_OK|MB_ICONSTOP "Error while installing and starting giveio" - Goto ext_ok -ext_here: - DetailPrint "Installing giveio gave an error, assuming its already installed" -ext_ok: -SectionEnd - -; special uninstall section. -Section "Uninstall" - ; remove registry keys - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mspgcc-pyjtag" - DeleteRegKey HKLM SOFTWARE\NSIS_Example2 - ; remove files - Delete $INSTDIR\bin\msp430-jtag.exe - Delete $INSTDIR\bin\_parjtag.pyd - Delete $INSTDIR\bin\jtag.py - Delete $INSTDIR\bin\HIL.dll - Delete $INSTDIR\bin\MSP430mspgcc.dll - ;XXX python22.dll is left installed as it is used by pybsl and other tools - Delete $INSTDIR\license-pyjtag.txt - Delete $INSTDIR\readme-pyjtag.txt - ; giveio - ; if it was started by us, stop it - ReadRegStr $0 HKLM SOFTWARE\mspgcc "giveio" - StrCmp $0 '' no_giveio - nsExec::ExecToLog '$INSTDIR\bin\loaddrv.exe stop giveio' - Pop $0 ;return value/error/timeout - IntCmp $0 0 0 giveio_err giveio_err ;if not 0 -> error - nsExec::ExecToLog '$INSTDIR\bin\loaddrv.exe remove giveio' - Pop $0 ;return value/error/timeout - IntCmp $0 0 0 giveio_err giveio_err ;if not 0 -> error - Goto no_giveio -giveio_err: - DetailPrint "Error while uninstalling giveio service" - MessageBox MB_OK|MB_ICONSTOP "Error while uninstalling giveio service" -no_giveio: - Delete loaddrv.exe - Delete giveio.sys - ; MUST REMOVE UNINSTALLER, too - Delete $INSTDIR\uninstall-pyjtag.exe -SectionEnd diff --git a/platform/esb/buildscripts/jtag/pyjtag/jtag.py b/platform/esb/buildscripts/jtag/pyjtag/jtag.py deleted file mode 100644 index 0cb556a91..000000000 --- a/platform/esb/buildscripts/jtag/pyjtag/jtag.py +++ /dev/null @@ -1,604 +0,0 @@ -#!/usr/bin/env python -#Parallel JTAG programmer for the MSP430 embedded proccessor. -# -#(C) 2002 Chris Liechti -#this is distributed under a free software license, see license.txt -# -#Requires Python 2+ and the binary extension _parjtag. - -import sys -import _parjtag - -VERSION = "1.3" - -DEBUG = 0 #disable debug messages by default - - -#frame specific consts -ERASE_MASS = 2 -ERASE_MAIN = 1 -ERASE_SGMT = 0 - -#states -FREERUNNING = 0 -STOPPED = 1 - -#Configurations of the MSP430 driver -VERIFICATION_MODE = 0 #Verify data downloaded to FLASH memories. -RAMSIZE_OPTION = 1 #Change RAM used to download and program flash blocks -DEBUG_OPTION = 2 #Set debug level. Enables debug outputs. - -#enumeration of output formats for uploads -HEX = 0 -INTELHEX = 1 -BINARY = 2 - -#exceptions -class JTAGException(Exception): pass - -#for the use with memread -def hexdump( (adr, memstr) ): - """Print a hex dump of data collected with memread - arg1: tuple with adress, memory - return None""" - count = 0 - ascii = '' - for value in map(ord, memstr): - if not count: print "%04x: " % adr, - print "%02x" % value, - ascii += (32 <= value < 128) and chr(value) or '.' - count += 1 - adr += 1 - if count == 16: - count = 0 - print " ", ascii - ascii = '' - if count < 16: print " "*(16-count), " ", ascii - -def makeihex( (address, data) ): - """work though the data and output lines in inzel hex format. - and end tag is appended""" - start = 0 - while start len(data): end = len(data) - _ihexline(address, [ord(x) for x in data[start:end]]) - start += 16 - address += 16 - _ihexline(address, [], type=1) #append no data but an end line - -def _ihexline(address, buffer, type=0): - """encode one line, output with checksum""" - sys.stdout.write( ':%02X%04X%02X' % (len(buffer), address & 0xffff, type) ) - sum = len(buffer) + ((address >> 8) & 255) + (address & 255) - for b in buffer: - if b == None: b = 0 #substitute nonexistent values with zero - sys.stdout.write('%02X' % (b & 255)) - sum += b&255 - sys.stdout.write('%02X\n' %( (-sum) & 255)) - - -class Segment: - """store a string with memory contents along with its startaddress""" - def __init__(self, startaddress = 0, data=None): - if data is None: - self.data = '' - else: - self.data = data - self.startaddress = startaddress - - def __getitem__(self, index): - return self.data[index] - - def __len__(self): - return len(self.data) - - def __repr__(self): - return "Segment(startaddress = 0x%04x, data=%r)" % (self.startaddress, self.data) - -class Memory: - """represent memory contents. with functions to load files""" - def __init__(self, filename=None): - self.segments = [] - if filename: - self.filename = filename - self.loadFile(filename) - - def append(self, seg): - self.segments.append(seg) - - def __getitem__(self, index): - return self.segments[index] - - def __len__(self): - return len(self.segments) - - def loadIHex(self, file): - """load data from a (opened) file in Intel-HEX format""" - segmentdata = [] - currentAddr = 0 - startAddr = 0 - lines = file.readlines() - for l in lines: - if not l.strip(): continue #skip empty lines - if l[0] != ':': raise Exception("File Format Error\n") - l = l.strip() #fix CR-LF issues... - length = int(l[1:3],16) - address = int(l[3:7],16) - type = int(l[7:9],16) - check = int(l[-2:],16) - if type == 0x00: - if currentAddr != address: - if segmentdata: - self.segments.append( Segment(startAddr, ''.join(segmentdata)) ) - startAddr = currentAddr = address - segmentdata = [] - for i in range(length): - segmentdata.append( chr(int(l[9+2*i:11+2*i],16)) ) - currentAddr = length + currentAddr - elif type == 0x01: - pass - else: - sys.stderr.write("Ignored unknown field (type 0x%02x) in ihex file.\n" % type) - if segmentdata: - self.segments.append( Segment(startAddr, ''.join(segmentdata)) ) - - def loadTIText(self, file): - """load data from a (opened) file in TI-Text format""" - next = 1 - currentAddr = 0 - startAddr = 0 - segmentdata = [] - #Convert data for MSP430, TXT-File is parsed line by line - while next >= 1: - #Read one line - l = file.readline() - if not l: break #EOF - l = l.strip() - if l[0] == 'q': break - elif l[0] == '@': #if @ => new address => send frame and set new addr. - #create a new segment - if segmentdata: - self.segments.append( Segment(startAddr, ''.join(segmentdata)) ) - startAddr = currentAddr = int(l[1:],16) - segmentdata = [] - else: - for i in l.split(): - segmentdata.append(chr(int(i,16))) - if segmentdata: - self.segments.append( Segment(startAddr, ''.join(segmentdata)) ) - - def loadELF(self, file): - """load data from a (opened) file in ELF object format. - File must be seekable""" - import elf - obj = elf.ELFObject() - obj.fromFile(file) - if obj.e_type != elf.ELFObject.ET_EXEC: - raise Exception("No executable") - for section in obj.getSections(): - if DEBUG: - sys.stderr.write("ELF section %s at 0x%04x %d bytes\n" % (section.name, section.lma, len(section.data))) - if len(section.data): - self.segments.append( Segment(section.lma, section.data) ) - - def loadFile(self, filename): - """fill memory with the contents of a file. file type is determined from extension""" - #TODO: do a contents based detection - if filename[-4:].lower() == '.txt': - self.loadTIText(open(filename, "rb")) - elif filename[-4:].lower() in ('.a43', '.hex'): - self.loadIHex(open(filename, "rb")) - else: - self.loadELF(open(filename, "rb")) - - def getMemrange(self, fromadr, toadr): - """get a range of bytes from the memory. unavailable values are filled with 0xff.""" - res = '' - toadr = toadr + 1 #python indxes are excluding end, so include it - while fromadr < toadr: - for seg in self.segments: - segend = seg.startaddress + len(seg.data) - if seg.startaddress <= fromadr and fromadr < segend: - if toadr > segend: #not all data in segment - catchlength = segend-fromadr - else: - catchlength = toadr-fromadr - res = res + seg.data[fromadr-seg.startaddress : fromadr-seg.startaddress+catchlength] - fromadr = fromadr + catchlength #adjust start - if len(res) >= toadr-fromadr: - break #return res - else: #undefined memory is filled with 0xff - res = res + chr(255) - fromadr = fromadr + 1 #adjust start - return res - -class JTAG: - """wrap the _parjtag extension""" - - def __init__(self): - self.showprogess = 0 - - def connect(self, lpt=None): - """connect to specified or default port""" - if lpt is None: - _parjtag.connect() - else: - _parjtag.connect(lpt) - - def close(self): - """release JTAG""" - _parjtag.release() - - def uploadData(self, startaddress, size): - """upload a datablock""" - if DEBUG > 1: sys.stderr.write("* uploadData()\n") - return _parjtag.memread(startaddress, size) - - def actionMassErase(self): - """Erase the flash memory completely (with mass erase command)""" - sys.stderr.write("Mass Erase...\n") - _parjtag.memerase(ERASE_MASS) - - def actionMainErase(self): - """Erase the MAIN flash memory, leave the INFO mem""" - sys.stderr.write("Erase Main Flash...\n") - _parjtag.memerase(ERASE_MAIN, 0xfffe) - - def makeActionSegmentErase(self, address): - """Selective segment erase""" - class SegmentEraser: - def __init__(self, segaddr): - self.address = segaddr - def __call__(self): - sys.stderr.write("Erase Segment @ 0x%04x...\n" % self.address) - _parjtag.memerase(ERASE_SGMT, self.address) - return SegmentEraser(address) - - def actionEraseCheck(self): - """check the erasure of required flash cells.""" - sys.stderr.write("Erase Check by file ...\n") - if self.data is not None: - for seg in self.data: - data = _parjtag.memread(seg.startaddress, len(seg.data)) - if data != '\xff'*len(seg.data): raise JTAGException("Erase check failed") - else: - raise JTAGException("cannot do erase check against data with not knowing the actual data") - - def progess_update(self, count, total): - sys.stderr.write("\r%d%%" % (100*count/total)) - - def actionProgram(self): - """program data into flash memory.""" - if self.data is not None: - sys.stderr.write("Program ...\n") - if self.showprogess: - _parjtag.set_flash_callback(self.progess_update) - bytes = 0 - for seg in self.data: - _parjtag.memwrite(seg.startaddress, seg.data) - bytes += len(seg.data) - if self.showprogess: - sys.stderr.write("\r") - sys.stderr.write("%i bytes programmed.\n" % bytes) - else: - raise JTAGException("programming without data not possible") - - def actionVerify(self): - """Verify programmed data""" - if self.data is not None: - sys.stderr.write("Verify ...\n") - for seg in self.data: - data = _parjtag.memread(seg.startaddress, len(seg.data)) - if data != seg.data: raise JTAGException("Verify failed") - else: - raise JTAGException("verify without data not possible") - - def actionReset(self): - """perform a reset""" - sys.stderr.write("Reset device ...\n") - _parjtag.reset(0, 0) - - def actionRun(self, address): - """start program at specified address""" - raise NotImplementedError - #sys.stderr.write("Load PC with 0x%04x ...\n" % address) - - def funclet(self): - """download and start funclet""" - sys.stderr.write("Download and execute of funclet...\n") - if len(self.data) > 1: - raise JTAGException("don't know how to handle multiple segments in funclets") - _parjtag.funclet(self.data[0].data) - sys.stderr.write("Funclet OK.\n") - -def usage(): - """print some help message""" - sys.stderr.write(""" -USAGE: %s [options] [file] -Version: %s - -If "-" is specified as file the data is read from the stdinput. -A file ending with ".txt" is considered to be in TIText format all -other filenames are considered IntelHex. - -General options: - -h, --help Show this help screen. - -l, --lpt=name Specify an other parallel port. - (defaults to LPT1 (/dev/parport0 on unix) - -D, --debug Increase level of debug messages. This won't be - very useful for the average user... - -I, --intelhex Force fileformat to IntelHex - -T, --titext Force fileformat to be TIText - -f, --funclet The given file is a funclet (a small program to - be run in RAM) - -R, --ramsize Specify the amont of RAM to be used to program - flash (default 256). - -Program Flow Specifiers: - - -e, --masserase Mass Erase (clear all flash memory) - -m, --mainerase Erase main flash memory only - --eraseinfo Erase info flash memory only (0x1000-0x10ff) - --erase=address Selectively erase segment at the specified address - -E, --erasecheck Erase Check by file - -p, --program Program file - -v, --verify Verify by file - -The order of the above options matters! The table is ordered by normal -execution order. For the options "Epv" a file must be specified. -Program flow specifiers default to "p" if a file is given. -Don't forget to specify "e" or "eE" when programming flash! -"p" already verifies the programmed data, "v" adds an additional -verification though uploading the written data for a 1:1 compare. -No default action is taken if "p" and/or "v" is given, say specifying -only "v" does a check by file of a programmed device. - -Data retreiving: - -u, --upload=addr Upload a datablock (see also: -s). - -s, --size=num Size of the data block do upload. (Default is 2) - -x, --hex Show a hexadecimal display of the uploaded data. - (Default) - -b, --bin Get binary uploaded data. This can be used - to redirect the output into a file. - -i, --ihex Uploaded data is output in Intel HEX format. - This can be used to clone a device. - -Do before exit: - -g, --go=address Start programm execution at specified address. - This implies option "w" (wait) - -r, --reset Reset connected MSP430. Starts application. - This is a normal device reset and will start - the programm that is specified in the reset - interrupt vector. (see also -g) - -w, --wait Wait for before closing parallel port. -""" % (sys.argv[0], VERSION)) - -def main(): - global DEBUG - import getopt - filetype = None - filename = None - reset = 0 - wait = 0 - goaddr = None - jtag = JTAG() - toinit = [] - todo = [] - startaddr = None - size = 2 - outputformat= HEX - lpt = None - funclet = None - ramsize = None - - sys.stderr.write("MSP430 parallel JTAG programmer Version: %s\n" % VERSION) - try: - opts, args = getopt.getopt(sys.argv[1:], - "hl:weEmpvrg:Du:d:s:xbiITfR:S", - ["help", "lpt=", "wait" - "masserase", "erasecheck", "mainerase", "program", - "erase=", "eraseinfo", - "verify", "reset", "go=", "debug", - "upload=", "download=", "size=", "hex", "bin", "ihex", - "intelhex", "titext", "funclet", "ramsize=", "progress"] - ) - except getopt.GetoptError: - # print help information and exit: - usage() - sys.exit(2) - - for o, a in opts: - if o in ("-h", "--help"): - usage() - sys.exit() - elif o in ("-l", "--lpt"): - lpt = a - elif o in ("-w", "--wait"): - wait = 1 - elif o in ("-e", "--masserase"): - toinit.append(jtag.actionMassErase) #Erase Flash - elif o in ("-E", "--erasecheck"): - toinit.append(jtag.actionEraseCheck) #Erase Check (by file) - elif o in ("-m", "--mainerase"): - toinit.append(jtag.actionMainErase) #Erase main Flash - elif o == "--erase": - try: - seg = int(a, 0) - toinit.append(jtag.makeActionSegmentErase(seg)) - except ValueError: - sys.stderr.write("segment address must be a valid number in dec, hex or octal\n") - sys.exit(2) - elif o == "--eraseinfo": - toinit.append(jtag.makeActionSegmentErase(0x1000)) - toinit.append(jtag.makeActionSegmentErase(0x1080)) - elif o in ("-p", "--program"): - todo.append(jtag.actionProgram) #Program file - elif o in ("-v", "--verify"): - todo.append(jtag.actionVerify) #Verify file - elif o in ("-r", "--reset"): - reset = 1 - elif o in ("-g", "--go"): - try: - goaddr = int(a, 0) #try to convert decimal - except ValueError: - sys.stderr.write("upload address must be a valid number in dec, hex or octal\n") - sys.exit(2) - elif o in ("-D", "--debug"): - DEBUG = DEBUG + 1 - elif o in ("-u", "--upload"): - try: - startaddr = int(a, 0) #try to convert number of any base - except ValueError: - sys.stderr.write("upload address must be a valid number in dec, hex or octal\n") - sys.exit(2) - elif o in ("-s", "--size"): - try: - size = int(a, 0) - except ValueError: - sys.stderr.write("upload address must be a valid number in dec, hex or octal\n") - sys.exit(2) - #outut formats - elif o in ("-x", "--hex"): - outputformat = HEX - elif o in ("-b", "--bin"): - outputformat = BINARY - elif o in ("-i", "--ihex"): - outputformat = INTELHEX - #input formats - elif o in ("-I", "--intelhex"): - filetype = 0 - elif o in ("-T", "--titext"): - filetype = 1 - #others - elif o in ("-f", "--funclet"): - funclet = 1 - elif o in ("-R", "--ramsize"): - try: - ramsize = int(a, 0) - except ValueError: - sys.stderr.write("ramsize must be a valid number in dec, hex or octal\n") - sys.exit(2) - elif o in ("-S", "--progress"): - jtag.showprogess = 1 - - if len(args) == 0: - sys.stderr.write("Use -h for help\n") - elif len(args) == 1: #a filename is given - if not funclet: - if not todo: #if there are no actions yet - todo.extend([ #add some useful actions... - jtag.actionProgram, - ]) - filename = args[0] - else: #number of args is wrong - usage() - sys.exit(2) - - if DEBUG: #debug infos - sys.stderr.write("debug level set to %d\n" % DEBUG) - _parjtag.configure(DEBUG_OPTION, DEBUG) - sys.stderr.write("python version: %s\n" % sys.version) - - - #sanity check of options - if goaddr and reset: - sys.stderr.write("Warning: option --reset ignored as --go is specified!\n") - reset = 0 - - if startaddr and reset: - sys.stderr.write("Warning: option --reset ignored as --upload is specified!\n") - reset = 0 - - #prepare data to download - jtag.data = Memory() #prepare downloaded data - if filetype is not None: #if the filetype is given... - if filename is None: - raise ValueError("no filename but filetype specified") - if filename == '-': #get data from stdin - file = sys.stdin - else: - file = open(filename,"rb") #or from a file - if filetype == 0: #select load function - jtag.data.loadIHex(file) #intel hex - elif filetype == 1: - jtag.data.loadTIText(file) #TI's format - else: - raise ValueError("illegal filetype specified") - else: #no filetype given... - if filename == '-': #for stdin: - jtag.data.loadIHex(sys.stdin) #assume intel hex - elif filename: - jtag.data.loadFile(filename) #autodetect otherwise - - if DEBUG > 5: sys.stderr.write("File: %r\n" % filename) - - try: - jtag.connect(lpt) #try to open port - except IOError: - raise #do not handle here - else: #continue if open was successful - if ramsize is not None: - _parjtag.configure(RAMSIZE_OPTION, ramsize) - #initialization list - if toinit: #erase and erase check - if DEBUG: sys.stderr.write("Preparing device ...\n") - for f in toinit: f() - - #work list - if todo: - if DEBUG > 0: #debug - #show a nice list of sheduled actions - sys.stderr.write("TODO list:\n") - for f in todo: - try: - sys.stderr.write(" %s\n" % f.func_name) - except AttributeError: - sys.stderr.write(" %r\n" % f) - for f in todo: f() #work through todo list - - if reset: #reset device first if desired - jtag.actionReset() - - if funclet is not None: #download and start funclet - jtag.funclet() - - if goaddr is not None: #start user programm at specified address - jtag.actionRun(goaddr) #load PC and execute - - #upload datablock and output - if startaddr is not None: - if goaddr: #if a program was started... - raise NotImplementedError - #TODO: - #sys.stderr.write("Waiting to device for reconnect for upload: ") - data = jtag.uploadData(startaddr, size) #upload data - if outputformat == HEX: #depending on output format - hexdump( (startaddr, data) ) #print a hex display - elif outputformat == INTELHEX: - makeihex( (startaddr, data) ) #ouput a intel-hex file - else: - sys.stdout.write(data) #binary output w/o newline! - wait = 0 #wait makes no sense as after the upload the device is still stopped - - if wait: #wait at the end if desired - sys.stderr.write("Press ...\n") #display a prompt - raw_input() #wait for newline - - _parjtag.reset(1, 1) #reset and release target - #~ jtag.actionReset() - jtag.close() #Release communication port - -if __name__ == '__main__': - try: - main() - except SystemExit: - raise #let pass exit() calls - except KeyboardInterrupt: - if DEBUG: raise #show full trace in debug mode - sys.stderr.write("user abort.\n") #short messy in user mode - sys.exit(1) #set errorlevel for script usage - except Exception, msg: #every Exception is caught and displayed - if DEBUG: raise #show full trace in debug mode - sys.stderr.write("\nAn error occoured:\n%s\n" % msg) #short messy in user mode - sys.exit(1) #set errorlevel for script usage diff --git a/platform/esb/buildscripts/jtag/pyjtag/license.txt b/platform/esb/buildscripts/jtag/pyjtag/license.txt deleted file mode 100644 index 810a2d24c..000000000 --- a/platform/esb/buildscripts/jtag/pyjtag/license.txt +++ /dev/null @@ -1,62 +0,0 @@ -Copyright (c) 2001-2002 Chris Liechti - -All Rights Reserved. - -This is the Python license. In short, you can use this product in -commercial and non-commercial applications, modify it, redistribute it. -A notification to the author when you use and/or modify it is welcome. - -TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING THIS SOFTWARE -============================================ - -LICENSE AGREEMENT ------------------ - -1. This LICENSE AGREEMENT is between the copyright holder of this -product, and the Individual or Organization ("Licensee") accessing -and otherwise using this product in source or binary form and its -associated documentation. - -2. Subject to the terms and conditions of this License Agreement, -the copyright holder hereby grants Licensee a nonexclusive, -royalty-free, world-wide license to reproduce, analyze, test, -perform and/or display publicly, prepare derivative works, distribute, -and otherwise use this product alone or in any derivative version, -provided, however, that copyright holders License Agreement and -copyright holders notice of copyright are retained in this product -alone or in any derivative version prepared by Licensee. - -3. In the event Licensee prepares a derivative work that is based on -or incorporates this product or any part thereof, and wants to make -the derivative work available to others as provided herein, then -Licensee hereby agrees to include in any such work a brief summary of -the changes made to this product. - -4. The copyright holder is making this product available to Licensee -on an "AS IS" basis. THE COPYRIGHT HOLDER MAKES NO REPRESENTATIONS -OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT -LIMITATION, THE COPYRIGHT HOLDER MAKES NO AND DISCLAIMS ANY -REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR -ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS PRODUCT WILL -NOT INFRINGE ANY THIRD PARTY RIGHTS. - -5. THE COPYRIGHT HOLDER SHALL NOT BE LIABLE TO LICENSEE OR ANY -OTHER USERS OF THIS PRODUCT FOR ANY INCIDENTAL, SPECIAL, OR -CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, -DISTRIBUTING, OR OTHERWISE USING THIS PRODUCT, OR ANY -DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY -THEREOF. - -6. This License Agreement will automatically terminate upon a -material breach of its terms and conditions. - -7. Nothing in this License Agreement shall be deemed to create any -relationship of agency, partnership, or joint venture between the -copyright holder and Licensee. This License Agreement does not grant -permission to use trademarks or trade names from the copyright holder -in a trademark sense to endorse or promote products or services of -Licensee, or any third party. - -8. By copying, installing or otherwise using this product, Licensee -agrees to be bound by the terms and conditions of this License -Agreement. diff --git a/platform/esb/buildscripts/jtag/pyjtag/makefile b/platform/esb/buildscripts/jtag/pyjtag/makefile deleted file mode 100644 index 5482fa2f1..000000000 --- a/platform/esb/buildscripts/jtag/pyjtag/makefile +++ /dev/null @@ -1,33 +0,0 @@ - -.PHONY: all FORCE clean windist - -all: windist - -#wrap py to exe and build windows installer -windist: - python setup.py py2exe - rm -r bin - mv dist/jtag/jtag.exe dist/msp430-jtag.exe - mv dist/jtag/* dist/ - rmdir dist/jtag - mv dist bin - rm -r build - - -#generate test files -fill60k.a43: - python gen-ihex.py 60 >$@ -fill48k.a43: - python gen-ihex.py 48 >$@ -fill32k.a43: - python gen-ihex.py 32 >$@ -fill16k.a43: - python gen-ihex.py 16 >$@ -fill8k.a43: - python gen-ihex.py 8 >$@ -fill4k.a43: - python gen-ihex.py 4 >$@ - -#clean up the mess... -clean: - rm -r dist build bin \ No newline at end of file diff --git a/platform/esb/buildscripts/jtag/pyjtag/readme.txt b/platform/esb/buildscripts/jtag/pyjtag/readme.txt deleted file mode 100644 index bdd3da6c2..000000000 --- a/platform/esb/buildscripts/jtag/pyjtag/readme.txt +++ /dev/null @@ -1,182 +0,0 @@ -pyJTAG ------- - -Software to talk to the parallel port JTAG PCB as seen with the FET kits. -It is released under a free software license, -see license.txt for more details. - -(C) 2002-2003 Chris Liechti - -Features --------- - -- understands TI-Text and Intel-hex -- download to Flash and/or RAM, erase, verify -- reset device -- load addres into R0/PC and run -- upload a memory block MSP->PC (output as binary data or hex dump) -- written in Python, runs on Win32, Linux, BSD -- use per command line, or in a Python script - -Requirements ------------- -- Linux, BSD, Un*x or Windows PC -- Python 2.0 or newer, 2.2 recomeded -- Parallel JTAG hardware with an MSP430 device connected - -Installation ------------- -Python installations are available from www.python.org. On Windows simply -use the installer. The win32all package has an installer too. These -installations should run fine with the deafults. - -On Linux just Python is needed. On some distributions is Python 1.5.2 -installed per default. You may meed to change the first line in the script -from "python" to "python2". Maybe Python 2.x is in a separate package that -has to be installed. There are rpm and deb binary packages and a source -tarball available through the Python homepage. - -The pyjtag archive can simply be unpacked to a directory, Windows users -can use WinZip or WinRar among others to extract the gzipped tar file. -If you want to run it from everywhere the directory where the file jtag.py -is, should be added to the PATH. -Look at "~/.profile", "/etc/profile" on Linux, "autoexec.bat" on Win9x/ME, -System Properties/Environment in Win2000/NT/XP. - -_parjtag.so/dll from the jtag archive must be copied to the same directory as -jtag.py. On Windows also MSP430mspgcc.dll and HIL.dll must be located in the -same dir or somewhere in the PATH. - -Short introduction ------------------- -This software uses the JTAG hardware that comes with the FET kits. It is -connected to the parallel port. - -The program can be started by typing "python jtag.py" in a console. Often -it works also with just "jtag.py" or "./jtag.py". - -USAGE: jtag.py [options] [file] -If "-" is specified as file the data is read from the stdinput. -A file ending with ".txt" is considered to be in TIText format all -other filenames are considered IntelHex. - -General options: - -h, --help Show this help screen. - -l, --lpt=name Specify an other parallel port. - (defaults to LPT1 (/dev/parport0 on unix) - -D, --debug Increase level of debug messages. This won't be - very useful for the average user... - -I, --intelhex Force fileformat to IntelHex - -T, --titext Force fileformat to be TIText - -f, --funclet The given file is a funclet (a small program to - be run in RAM) - -R, --ramsize Specify the amont of RAM to be used to program - flash (default 256). - -Program Flow Specifiers: - - -e, --masserase Mass Erase (clear all flash memory) - -m, --mainerase Erase main flash memory only - --eraseinfo Erase info flash memory only (0x1000-0x10ff) - --erase=address Selectively erase segment at the specified address - -E, --erasecheck Erase Check by file - -p, --program Program file - -v, --verify Verify by file - -The order of the above options matters! The table is ordered by normal -execution order. For the options "Epv" a file must be specified. -Program flow specifiers default to "p" if a file is given. -Don't forget to specify "e" or "eE" when programming flash! -"p" already verifies the programmed data, "v" adds an additional -verification though uploading the written data for a 1:1 compare. -No default action is taken if "p" and/or "v" is given, say specifying -only "v" does a check by file of a programmed device. - -Data retreiving: - -u, --upload=addr Upload a datablock (see also: -s). - -s, --size=num Size of the data block do upload. (Default is 2) - -x, --hex Show a hexadecimal display of the uploaded data. - (Default) - -b, --bin Get binary uploaded data. This can be used - to redirect the output into a file. - -i, --ihex Uploaded data is output in Intel HEX format. - This can be used to clone a device. - -Do before exit: - -g, --go=address Start programm execution at specified address. - This implies option "w" (wait) - -r, --reset Reset connected MSP430. Starts application. - This is a normal device reset and will start - the programm that is specified in the reset - interrupt vector. (see also -g) - -w, --wait Wait for before closing parallel port. - - -Examples --------- -These examples assume that you have added the installation directory to -the PATH. Type the full path to jtag.py otherwise and maybe use -"python jtag.py". Depending on installation it may also appear under the -name "msp430-jtag". - -jtag.py -e - Only erase flash. - -jtag.py -eErw 6port.a43 - Erase flash, erase check, download an executable, run it (reset) - and wait. - -jtag.py -mS -R 2048 6port.a43 - Use ramsize option on a device with 2k RAM to speed up - download. Of course any value from 128B up to the maximum - a device has is allowed. - The progress and mainerase options are also activated. - Only erasing the main memory is useful to keep calibration - data in the information memory. - -jtag.py 6port.a43 - Download of an executable to en empty (new or erased) device. - (Note that in new devices some of the first bytes in the - information memory are random data. If data should be - downloaded there, specify -eE.) - -jtag.py --go=0x220 ramtest.a43 - Download a program into RAM and run it, may not work - with all devices. - -jtag.py -f blinking.a43 - Download a program into RAM and run it. It must be - a special format with "startadr", "entrypoint", - "exitpoint" as the first three words in the data - and it must end on "jmp $". See MSP430debug sources - for more info. - -jtag.py -u 0x0c00 -s 1024 - Get a memory dump in HEX, from the bootstrap loader. - or save the binary in a file: - "python jtag.py -u 0x0c00 -s 1024 -b >dump.bin" - or as an intel-hex file: - "python jtag.py -u 0x0c00 -s 1024 -i >dump.a43" - -jtag.py -r - Just start the user program (with a reset). - -cat 6port.a43|jtag.py -e - - Pipe the data from "cat" to jtag.py to erase and program the - flash. (un*x example, don't forget the dash at the end of the - line) - -History -------- -1.0 public release -1.1 fix of verify error -1.2 use the verification during programming -1.3 meinerase, progress options, ihex output - -References ----------- -- Python: http://www.python.org - -- Texas Instruments MSP430 Homepage, links to Datasheets and Application - Notes: http://www.ti.com/sc/msp430 - diff --git a/platform/esb/buildscripts/jtag/pyjtag/setup.py b/platform/esb/buildscripts/jtag/pyjtag/setup.py deleted file mode 100644 index 982b58340..000000000 --- a/platform/esb/buildscripts/jtag/pyjtag/setup.py +++ /dev/null @@ -1,9 +0,0 @@ -# setup.py -from distutils.core import setup -import glob -import py2exe - -setup( - name="msp430-jtag", - scripts=["jtag.py"], - ) \ No newline at end of file diff --git a/platform/esb/cfs-coffee-arch.c b/platform/esb/cfs-coffee-arch.c deleted file mode 100644 index 558f079db..000000000 --- a/platform/esb/cfs-coffee-arch.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - * - */ - -/** - * \file - * Coffee architecture-dependent functionality for the ESB platform. - * \author - * Nicolas Tsiftes - * Niclas Finne - */ - -#include "cfs-coffee-arch.h" - -static const unsigned char nullb[COFFEE_SECTOR_SIZE < 32 ? COFFEE_SECTOR_SIZE : 32] = {0}; - -void -cfs_coffee_arch_erase(uint16_t sector) -{ - unsigned int i; - for(i = 0; i <= COFFEE_SECTOR_SIZE - sizeof(nullb); i += sizeof(nullb)) { - eeprom_write(COFFEE_START + sector * COFFEE_SECTOR_SIZE + i, - (unsigned char *)nullb, sizeof(nullb)); - } - if(i < COFFEE_SECTOR_SIZE) { - eeprom_write(COFFEE_START + sector * COFFEE_SECTOR_SIZE + i, - (unsigned char *)nullb, COFFEE_SECTOR_SIZE - i); - - } -} diff --git a/platform/esb/cfs-coffee-arch.h b/platform/esb/cfs-coffee-arch.h deleted file mode 100644 index 7fd0ec604..000000000 --- a/platform/esb/cfs-coffee-arch.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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. - * - */ - -/** - * \file - * Coffee architecture-dependent header for the ESB platform. - * \author - * Nicolas Tsiftes - * Niclas Finne - */ - -#ifndef CFS_COFFEE_ARCH_H -#define CFS_COFFEE_ARCH_H - -#include "contiki-conf.h" -#include "dev/eeprom.h" - -#define COFFEE_SECTOR_SIZE 1024UL -#define COFFEE_PAGE_SIZE 64UL -#define COFFEE_START COFFEE_SECTOR_SIZE -#define COFFEE_SIZE (32 * 1024U - COFFEE_START) -#define COFFEE_NAME_LENGTH 16 -#define COFFEE_MAX_OPEN_FILES 2 -#define COFFEE_FD_SET_SIZE 2 -#define COFFEE_LOG_TABLE_LIMIT 16 -#define COFFEE_DYN_SIZE 1024 -#define COFFEE_LOG_SIZE 256 - -#define COFFEE_MICRO_LOGS 0 - -#if COFFEE_START < CFS_EEPROM_CONF_OFFSET -#error COFFEE_START must be at least as large as CFS_EEPROM_CONF_OFFSET -#error Change in cfs-coffee-arch.h -#endif /* COFFEE_START < CFS_EEPROM_CONF_OFFSET */ - -#define COFFEE_WRITE(buf, size, offset) \ - eeprom_write(COFFEE_START + (offset), (unsigned char *)(buf), (size)) - -#define COFFEE_READ(buf, size, offset) \ - eeprom_read(COFFEE_START + (offset), (unsigned char *)(buf), (size)) - -#define COFFEE_ERASE(sector) cfs_coffee_arch_erase(sector) - -void cfs_coffee_arch_erase(uint16_t sector); - -typedef int16_t coffee_page_t; - -#endif /* !COFFEE_ARCH_H */ diff --git a/platform/esb/contiki-conf.h b/platform/esb/contiki-conf.h deleted file mode 100644 index ad11e2142..000000000 --- a/platform/esb/contiki-conf.h +++ /dev/null @@ -1,124 +0,0 @@ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ - -#define PLATFORM_HAS_LEDS 1 -#define PLATFORM_HAS_BUTTON 1 -#define PLATFORM_HAS_BATTERY 1 - -/* DCO speed resynchronization for more robust UART, etc. */ -#define DCOSYNCH_CONF_ENABLED 1 -#define DCOSYNCH_CONF_PERIOD 30 - -#define SERIAL_LINE_CONF_BUFSIZE 64 - -#define TIMESYNCH_CONF_ENABLED 0 -#define PROFILE_CONF_ON 0 -#define ENERGEST_CONF_ON 1 - -#define HAVE_STDINT_H -#include "msp430def.h" - - -#define PROCESS_CONF_NUMEVENTS 8 -#define PROCESS_CONF_STATS 0 - -/* CPU target speed in Hz */ -#define F_CPU 2457600uL - -/* Our clock resolution, this is the same as Unix HZ. Must be a power - of two (see clock.c for details). */ -#define CLOCK_CONF_SECOND 64UL - -#define NODE_ID_EEPROM_OFFSET 0x0010 /* - 0x0014 */ -#define CFS_EEPROM_CONF_OFFSET 0x0040 - -#define CC_CONF_REGISTER_ARGS 1 -#define CC_CONF_FUNCTION_POINTER_ARGS 1 - -#define CC_CONF_VA_ARGS 1 - -#define CCIF -#define CLIF - -typedef unsigned long clock_time_t; - -#define LOG_CONF_ENABLED 0 - -#define PACKETBUF_CONF_ATTRS_INLINE 1 -#define NETSTACK_CONF_RADIO tr1001_driver - -#if WITH_UIP -/* Network setup for IPv4 */ - -#define NETSTACK_CONF_NETWORK uip_driver -#define NETSTACK_CONF_MAC nullmac_driver -#define NETSTACK_CONF_RDC nullrdc_driver -#define NETSTACK_CONF_FRAMER framer_nullmac - -#define QUEUEBUF_CONF_NUM 0 -#define QUEUEBUF_CONF_REF_NUM 0 -#define ROUTE_CONF_ENTRIES 0 - -#else /* WITH_UIP */ - -/* Network setup for non-IPv4 (rime). */ - -#define NETSTACK_CONF_NETWORK rime_driver -#define NETSTACK_CONF_MAC nullmac_driver -#define NETSTACK_CONF_RDC nullrdc_driver -#define NETSTACK_CONF_FRAMER framer_nullmac - -#define QUEUEBUF_CONF_NUM 1 -#define QUEUEBUF_CONF_REF_NUM 1 -#define ROUTE_CONF_ENTRIES 4 - -#endif /* WITH_UIP */ - -/** - * The statistics data type. - * - * This datatype determines how high the statistics counters are able - * to count. - */ -typedef unsigned short uip_stats_t; - -#define UIP_CONF_ICMP_DEST_UNREACH 1 - -#define UIP_CONF_IP_FORWARD 1 -#define UIP_CONF_DHCP_LIGHT -#define UIP_CONF_LLH_LEN 0 -#define UIP_CONF_BUFFER_SIZE 110 -#define UIP_CONF_RECEIVE_WINDOW (UIP_CONF_BUFFER_SIZE - 40) -#define UIP_CONF_MAX_CONNECTIONS 4 -#define UIP_CONF_MAX_LISTENPORTS 4 -#define UIP_CONF_UDP_CONNS 3 -#define UIP_CONF_FWCACHE_SIZE 1 -#define UIP_CONF_BROADCAST 1 -#define UIP_ARCH_IPCHKSUM 1 -#define UIP_CONF_UDP_CHECKSUMS 1 -#define UIP_CONF_PINGADDRCONF 0 -#define UIP_CONF_LOGGING 0 -#define UIP_CONF_RESOLV_ENTRIES 1 - -#define UIP_CONF_TCP_SPLIT 0 - -#define LOADER_CONF_ARCH "loader/loader-arch.h" - -#define ELFLOADER_CONF_TEXT_IN_ROM 1 -#define ELFLOADER_CONF_DATAMEMORY_SIZE 100 -#define ELFLOADER_CONF_TEXTMEMORY_SIZE 0x1000 - -#define WEBSERVER_CONF_CGI_CONNS 1 - -/* LEDs ports. */ -#define LEDS_PxDIR P2DIR -#define LEDS_PxOUT P2OUT -#define LEDS_CONF_RED 0x01 -#define LEDS_CONF_GREEN 0x02 -#define LEDS_CONF_YELLOW 0x04 - -#ifdef PROJECT_CONF_H -#include PROJECT_CONF_H -#endif /* PROJECT_CONF_H */ - -#endif /* __CONTIKI_CONF_H__ */ diff --git a/platform/esb/contiki-esb-default-init-apps.c b/platform/esb/contiki-esb-default-init-apps.c deleted file mode 100644 index 94ac86ad4..000000000 --- a/platform/esb/contiki-esb-default-init-apps.c +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ -void -init_apps(void) -{ -} diff --git a/platform/esb/contiki-esb-default-init-lowlevel.c b/platform/esb/contiki-esb-default-init-lowlevel.c deleted file mode 100644 index 4a34e5439..000000000 --- a/platform/esb/contiki-esb-default-init-lowlevel.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ -#include "contiki-esb.h" -#include "dev/esb-sensors.h" - - -void -init_lowlevel(void) -{ - esb_sensors_init(); - esb_sensors_on(); - leds_init(); - rs232_init(); -} diff --git a/platform/esb/contiki-esb-main.c b/platform/esb/contiki-esb-main.c deleted file mode 100644 index 718b99c2a..000000000 --- a/platform/esb/contiki-esb-main.c +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ - -#include -#include - -#include "contiki.h" -#include "contiki-esb.h" - -#include "dev/watchdog.h" -#include "sys/autostart.h" -#include "net/uip-driver.h" -#include "net/netstack.h" - -#if WITH_UIP - -static struct uip_fw_netif tr1001if = - {UIP_FW_NETIF(0,0,0,0, 0,0,0,0, uip_driver_send)}; - -#if WITH_SLIP -static struct uip_fw_netif slipif = - {UIP_FW_NETIF(172,16,0,0, 255,255,255,0, slip_send)}; -#endif /* WITH_SLIP */ - -#endif /* WITH_UIP */ - -#ifdef DCOSYNCH_CONF_PERIOD -#define DCOSYNCH_PERIOD DCOSYNCH_CONF_PERIOD -#else -#define DCOSYNCH_PERIOD 30 -#endif /* DCOSYNCH_CONF_PERIOD */ - -#ifdef DCOSYNCH_CONF_ENABLED -#define DCOSYNCH_ENABLED DCOSYNCH_CONF_ENABLED -#else -#define DCOSYNCH_ENABLED 0 -#endif /* DCOSYNCH_CONF_ENABLED */ - -#if DCOSYNCH_ENABLED -static struct timer dco_timer; -#endif /* DCOSYNCH_ENABLED */ - -SENSORS(&button_sensor, &sound_sensor, &vib_sensor, - &pir_sensor, &radio_sensor, &battery_sensor, &ctsrts_sensor, - &temperature_sensor); - -/*---------------------------------------------------------------------------*/ -static void -set_rime_addr(void) -{ - int i; - rimeaddr_t rimeaddr; - - rimeaddr.u8[0] = node_id & 0xff; - rimeaddr.u8[1] = node_id >> 8; - rimeaddr_set_node_addr(&rimeaddr); - - printf("Rime started with address "); - for(i = 0; i < sizeof(rimeaddr.u8) - 1; i++) { - printf("%u.", rimeaddr.u8[i]); - } - printf("%u\n", rimeaddr.u8[i]); -} -/*---------------------------------------------------------------------------*/ -#if WITH_UIP -static void -init_uip_net(void) -{ - uip_ipaddr_t hostaddr; - - uip_init(); - uip_fw_init(); - - process_start(&tcpip_process, NULL); -#if WITH_SLIP - process_start(&slip_process, NULL); - rs232_set_input(slip_input_byte); -#endif /* WITH_SLIP */ - process_start(&uip_fw_process, NULL); - - if (node_id > 0) { - /* node id is set, construct an ip address based on the node id */ - uip_ipaddr(&hostaddr, 172, 16, 1, node_id & 0xff); - uip_sethostaddr(&hostaddr); - } - -#if WITH_SLIP - uip_fw_register(&slipif); -#endif /* WITH_SLIP */ - - uip_fw_default(&tr1001if); -} -#endif /* WITH_UIP */ -/*---------------------------------------------------------------------------*/ -static void -print_processes(struct process * const processes[]) -{ - printf("Starting"); - while(*processes != NULL) { - printf(" '%s'", (*processes)->name); - processes++; - } - /* Needed to force link with putchar */ - putchar('\n'); -} -/*---------------------------------------------------------------------------*/ -static void init_ports_toberemoved() { - ////////// Port 1 //// - P1SEL = 0x00; - P1DIR = 0x81; // Outputs: P10=IRSend, P17=RS232RTS - // Inputs: P11=Light, P12=IRRec, P13=PIR, P14=Vibration, - // P15=Clockalarm, P16=RS232CTS - P1OUT = 0x00; - - ////////// Port 2 //// - P2SEL = 0x00; // No Sels - P2DIR = 0x7F; // Outpus: P20..P23=Leds+Beeper, P24..P26=Poti - // Inputs: P27=Taster - P2OUT = 0x77; - - ////////// Port 3 //// - P3SEL = 0xE0; // Sels for P34..P37 to activate UART, - P3DIR = 0x5F; // Inputs: P30..P33=CON4, P35/P37=RXD Transceiver/RS232 - // OutPuts: P36/P38=TXD Transceiver/RS232 - P3OUT = 0xE0; // Output a Zero on P34(TXD Transceiver) and turn SELECT off when receiving!!! - - ////////// Port 4 //// - P4SEL = 0x00; // CON5 Stecker - P4DIR = 0xFF; - P4OUT = 0x00; - - ////////// Port 5 //// - P5SEL = 0x00; // P50/P51= Clock SDA/SCL, P52/P53/P54=EEPROM SDA/SCL/WP - P5DIR = 0xDA; // P56/P57=Transceiver CNTRL0/1 - P5OUT = 0x0F; - - ////////// Port 6 //// - P6SEL = 0x00; // P60=Microphone, P61=PIR digital (same as P13), P62=PIR analog - P6DIR = 0x00; // P63=extern voltage, P64=battery voltage, P65=Receive power - P6OUT = 0x00; -} -/*---------------------------------------------------------------------------*/ -int -main(void) -{ - msp430_cpu_init(); - - init_ports_toberemoved(); - - init_lowlevel(); - - clock_init(); - - rtimer_init(); - - process_init(); - - random_init(0); - - node_id_restore(); - - process_start(&etimer_process, NULL); - process_start(&sensors_process, NULL); - - ctimer_init(); - - set_rime_addr(); - - printf(CONTIKI_VERSION_STRING " started. "); - if(node_id > 0) { - printf("Node id is set to %u.\n", node_id); - } else { - printf("Node id is not set.\n"); - } - - netstack_init(); - - printf("%s %s, channel check rate %lu Hz\n", - NETSTACK_MAC.name, NETSTACK_RDC.name, - CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1: - NETSTACK_RDC.channel_check_interval())); - - beep_spinup(); - leds_on(LEDS_RED); - clock_delay(100); - leds_off(LEDS_RED); - -#if !WITH_SLIP - rs232_set_input(serial_line_input_byte); - serial_line_init(); -#endif - -#if WITH_UIP - init_uip_net(); -#endif /* WITH_UIP */ - -#if PROFILE_CONF_ON - profile_init(); -#endif /* PROFILE_CONF_ON */ - -#if ENERGEST_CONF_ON - energest_init(); - ENERGEST_ON(ENERGEST_TYPE_CPU); -#endif /* ENERGEST_CONF_ON */ - - init_apps(); - print_processes(autostart_processes); - autostart_start(autostart_processes); - -#if DCOSYNCH_ENABLED - timer_set(&dco_timer, DCOSYNCH_PERIOD * CLOCK_SECOND); -#endif /* DCOSYNCH_ENABLED */ - - /* - * This is the scheduler loop. - */ - watchdog_start(); - while(1) { - int r; -#if PROFILE_CONF_ON - profile_episode_start(); -#endif /* PROFILE_CONF_ON */ - do { - /* Reset watchdog. */ - watchdog_periodic(); - r = process_run(); - } while(r > 0); -#if PROFILE_CONF_ON - profile_episode_end(); -#endif /* PROFILE_CONF_ON */ - - /* - * Idle processing. - */ - dint(); - if(process_nevents() != 0) { - eint(); - } else { -#if ENERGEST_CONF_ON - static unsigned long irq_energest = 0; -#endif /* ENERGEST_CONF_ON */ - -#if DCOSYNCH_CONF_ENABLED - /* before going down to sleep possibly do some management */ - if(timer_expired(&dco_timer)) { - timer_reset(&dco_timer); - msp430_sync_dco(); - } -#endif /* DCOSYNCH_CONF_ENABLED */ - -#if ENERGEST_CONF_ON - /* Re-enable interrupts and go to sleep atomically. */ - ENERGEST_OFF(ENERGEST_TYPE_CPU); - ENERGEST_ON(ENERGEST_TYPE_LPM); - - /* We only want to measure the processing done in IRQs when we - are asleep, so we discard the processing time done when we - were awake. */ - energest_type_set(ENERGEST_TYPE_IRQ, irq_energest); -#endif /* ENERGEST_CONF_ON */ - - watchdog_stop(); - _BIS_SR(GIE | SCG0 | CPUOFF); /* LPM1 sleep. */ - -#if ENERGEST_CONF_ON - /* We get the current processing time for interrupts that was - done during the LPM and store it for next time around. */ - dint(); - irq_energest = energest_type_time(ENERGEST_TYPE_IRQ); - eint(); - ENERGEST_OFF(ENERGEST_TYPE_LPM); - ENERGEST_ON(ENERGEST_TYPE_CPU); -#endif /* ENERGEST_CONF_ON */ - - watchdog_start(); - } - } -} -/*---------------------------------------------------------------------------*/ -/* char *arg_alloc(char size) {return NULL;} */ -/* void arg_init(void) {} */ -/* void arg_free(char *arg) {} */ -/*---------------------------------------------------------------------------*/ -#if UIP_LOGGING -void -uip_log(char *m) -{ - printf("uIP log: '%s'\n", m); -} -#endif /* UIP_LOGGING */ diff --git a/platform/esb/contiki-esb.h b/platform/esb/contiki-esb.h deleted file mode 100644 index 7f385867c..000000000 --- a/platform/esb/contiki-esb.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ -#ifndef __CONTIKI_ESB_H__ -#define __CONTIKI_ESB_H__ - -#include "contiki.h" -#include "contiki-net.h" -#include "contiki-lib.h" - -#include "lib/sensors.h" -#include "dev/hwconf.h" - -#include "dev/lpm.h" - -#include "dev/rs232.h" - -#include "dev/serial-line.h" -#include "dev/slip.h" - -#include "sys/node-id.h" - -#include "dev/vib-sensor.h" -#include "dev/pir-sensor.h" -#include "dev/button-sensor.h" -#include "dev/radio-sensor.h" -#include "dev/sound-sensor.h" -#include "dev/battery-sensor.h" -#include "dev/temperature-sensor.h" -#include "dev/ctsrts-sensor.h" - -#include "dev/beep.h" - -#include "dev/ir.h" - -#include "dev/leds.h" - -#include "sys/node-id.h" - -void msp430_cpu_init(void); -void init_lowlevel(void); -void init_apps(void); - -#endif /* __CONTIKI_ESB_H__ */ diff --git a/platform/esb/core.c b/platform/esb/core.c deleted file mode 100644 index 069edad02..000000000 --- a/platform/esb/core.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ -#include "contiki-esb.h" -#include "codeprop-tmp.h" -#include -#include - -AUTOSTART_PROCESSES(&codeprop_process); - -int core_dummy_4711(int len) { - char t[1]; - int l = snprintf(t, sizeof(t), "%d", len % 9); - printf("%d\n", l / 2); - return len / 4; -} diff --git a/platform/esb/dev/battery-sensor.c b/platform/esb/dev/battery-sensor.c deleted file mode 100644 index 3a807b98c..000000000 --- a/platform/esb/dev/battery-sensor.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2006, 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2005-11-01 - * Updated : $Date: 2010/02/08 00:00:45 $ - * $Revision: 1.6 $ - */ - -#include "contiki.h" -#include "dev/battery-sensor.h" -#include "dev/irq.h" - -const struct sensors_sensor battery_sensor; -static unsigned int battery_value; - -/*---------------------------------------------------------------------------*/ -static int -irq(void) -{ - battery_value = ADC12MEM6; - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return ADC12MEM6/*battery_value*/; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - switch(type) { - case SENSORS_HW_INIT: - battery_value = 0; - return 1; - case SENSORS_ACTIVE: - if(value) { - if(!irq_adc12_active(6)) { - irq_adc12_activate(6, (INCH_4 + SREF_0), irq); - } - } else { - irq_adc12_deactivate(6); - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return irq_adc12_active(6); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(battery_sensor, BATTERY_SENSOR, - value, configure, status); diff --git a/platform/esb/dev/battery-sensor.h b/platform/esb/dev/battery-sensor.h deleted file mode 100644 index 12c8fdc84..000000000 --- a/platform/esb/dev/battery-sensor.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2006, 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2005-11-01 - * Updated : $Date: 2006/06/18 08:07:30 $ - * $Revision: 1.3 $ - */ - -#ifndef __BATTERY_SENSOR_H__ -#define __BATTERY_SENSOR_H__ - -#include "lib/sensors.h" - -extern const struct sensors_sensor battery_sensor; - -#define BATTERY_SENSOR "Battery" - -#endif /* __BATTERY_SENSOR_H__ */ diff --git a/platform/esb/dev/beep.c b/platform/esb/dev/beep.c deleted file mode 100644 index 80256cc9e..000000000 --- a/platform/esb/dev/beep.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ - -#include "contiki.h" -#include "contiki-esb.h" -#include "sys/clock.h" - -#define ON 1 -#define OFF 0 - -/* - * Flag to indicate if any of these functions should generate a sound - * or not. The function beep_off() is used to change this flag so none - * of the functions will generate sounds and beep_on() to turn sound - * back on. - */ -static char onoroff = ON; - -/* - * BEEPER_BIT is the bit in the io-register that is connected to the actual - * beeper, setting the bit high vill generate a high pitch tone. - */ -#define BEEPER_BIT 0x08 - -/*-----------------------------------------------------------------------------------*/ -void -beep_alarm(int alarmmode, int len) -{ - len = len / 200; - - while(len > 0) { - /* - * Check here if we should beep or not since if we do it outside the - * while loop the call to this function would take muck less time, i.e. - * beep_on()/beep_off() would have side effects that might not be - * predictable. - */ - if(onoroff == ON) { - if((alarmmode == BEEP_ALARM1) && ((len & 7) > 4)) { - P2OUT |= BEEPER_BIT; - } else if((alarmmode == BEEP_ALARM2) && ((len & 15) > 12)) { - P2OUT |= BEEPER_BIT; - } else { - P2OUT &= ~BEEPER_BIT; - } - } - clock_delay(200); - len--; - } - P2OUT &= ~BEEPER_BIT; -} -/*-----------------------------------------------------------------------------------*/ -void -beep_beep(int i) -{ - if(onoroff == ON) { - /* Beep. */ - P2OUT |= BEEPER_BIT; - clock_delay(i); - P2OUT &= ~BEEPER_BIT; - } -} -/*-----------------------------------------------------------------------------------*/ -void -beep(void) -{ - beep_beep(20); -} -/*-----------------------------------------------------------------------------------*/ -void -beep_down(int d) -{ - int i; - for(i = 8; i < d; i += i / 8) { - beep_beep(10); - clock_delay(i); - } -} -/*-----------------------------------------------------------------------------------*/ -void -beep_on(void) -{ - onoroff = ON; -} -/*-----------------------------------------------------------------------------------*/ -void -beep_off(void) -{ - onoroff = OFF; -} -/*-----------------------------------------------------------------------------------*/ -void -beep_spinup(void) -{ - unsigned int i; - - for(i = 10000; i > 80; i -= i / 20) { - beep_beep(2); - clock_delay(i); - } - - for(i = 4980; i > 2000; i -= 20) { - leds_on(LEDS_ALL); - clock_delay(5000 - i); - leds_off(LEDS_ALL); - clock_delay(i); - } - -} -/*-----------------------------------------------------------------------------------*/ -void -beep_quick(int n) -{ - int i; - for(i = 0; i < n; ++i) { - beep_beep(2000); - clock_delay(20000); - } -} -/*-----------------------------------------------------------------------------------*/ -void beep_long(clock_time_t len) { - /* - * Check if the beeper is turned on or off, i.e. if a call should generate - * a noise or not. - */ - if(onoroff == ON) { - /* Turn on the beeper. */ - P2OUT |= BEEPER_BIT; - } - - clock_wait(len); - - if(onoroff == ON) { - /* Turn the beeper off. */ - P2OUT &= ~BEEPER_BIT; - } -} -/*-----------------------------------------------------------------------------------*/ diff --git a/platform/esb/dev/beep.h b/platform/esb/dev/beep.h deleted file mode 100644 index 8f17a7f6c..000000000 --- a/platform/esb/dev/beep.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ -/** - * \addtogroup esb - * @{ - */ - -/** - * \defgroup beeper Beeper interface - * @{ - */ - -/** - * \file - * Interface to the beeper. - * \author Adam Dunkels - * - */ - -#ifndef __BEEP_H__ -#define __BEEP_H__ - -#define BEEP_ALARM1 1 -#define BEEP_ALARM2 2 - -#include "sys/clock.h" - -/** - * Beep for a specified time. - * - * This function causes the beeper to beep for the specified time. The - * time is measured in the same units as for the clock_delay() - * function. - * - * \note This function will hang the CPU during the beep. - * - * \note This function will stop any beep that was on previously when this - * function ends. - * - * \note If the beeper is turned off with beep_off() this call will still - * take the same time, though it will be silent. - * - * \param len The length of the beep. - * - */ -void beep_beep(int len); - -/** - * Beep an alarm for a specified time. - * - * This function causes the beeper to beep for the specified time. The - * time is measured in the same units as for the clock_delay() - * function. - * - * \note This function will hang the CPU during the beep. - * - * \note This function will stop any beep that was on previously when this - * function ends. - * - * \note If the beeper is turned off with beep_off() this call will still - * take the same time, though it will be silent. - * - * \param alarmmode The alarm mode (BEEP_ALARM1,BEEP_ALARM2) - * \param len The length of the beep. - * - */ -void beep_alarm(int alarmmode, int len); - -/** - * Produces a quick click-like beep. - * - * This function produces a short beep that sounds like a click. - * - */ -void beep(void); - -/** - * A beep with a pitch-bend down. - * - * This function produces a pitch-bend sound with deecreasing - * frequency. - * - * \param len The length of the pitch-bend. - * - */ -void beep_down(int len); - -/** - * Turn the beeper on. - * - * This function turns on the beeper. The beeper is turned off with - * the beep_off() function. - */ -void beep_on(void); - -/** - * Turn the beeper off. - * - * This function turns the beeper off after it has been turned on with - * beep_on(). - */ -void beep_off(void); - -/** - * Produce a sound similar to a hard-drive spinup. - * - * This function produces a sound that is intended to be similar to - * the sound a hard-drive makes when it starts. - * - */ -void beep_spinup(void); - -/** - * Beep for a long time (seconds) - * - * This function produces a beep with the specified length and will - * not return until the beep is complete. The length of the beep is - * specified using CLOCK_SECOND: a two second beep is CLOCK_SECOND * - * 2, and a quarter second beep is CLOCK_SECOND / 4. - * - * \note If the beeper is turned off with beep_off() this call will still - * take the same time, though it will be silent. - * - * \param len The length of the beep, measured in units of CLOCK_SECOND - */ -void beep_long(clock_time_t len); - -void beep_quick(int num); - -/** @} */ -/** @} */ - -#endif /* __BEEP_H__ */ diff --git a/platform/esb/dev/button-sensor.c b/platform/esb/dev/button-sensor.c deleted file mode 100644 index ccd62c21f..000000000 --- a/platform/esb/dev/button-sensor.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ - -#include "dev/button-sensor.h" -#include "dev/hwconf.h" -#include "isr_compat.h" - -const struct sensors_sensor button_sensor; - -static struct timer debouncetimer; - -HWCONF_PIN(BUTTON, 2, 7); -HWCONF_IRQ(BUTTON, 2, 7); - -/*---------------------------------------------------------------------------*/ -ISR(PORT2, irq_p2) -{ - ENERGEST_ON(ENERGEST_TYPE_IRQ); - - if(BUTTON_CHECK_IRQ()) { - if(timer_expired(&debouncetimer)) { - timer_set(&debouncetimer, CLOCK_SECOND / 4); - sensors_changed(&button_sensor); - LPM4_EXIT; - } - } - P2IFG = 0x00; - ENERGEST_OFF(ENERGEST_TYPE_IRQ); -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return BUTTON_READ() || !timer_expired(&debouncetimer); -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - switch(type) { - case SENSORS_HW_INIT: - BUTTON_IRQ_EDGE_SELECTD(); - BUTTON_SELECT(); - BUTTON_MAKE_INPUT(); - return 1; - case SENSORS_ACTIVE: - if(value) { - if(!BUTTON_IRQ_ENABLED()) { - timer_set(&debouncetimer, 0); - BUTTON_ENABLE_IRQ(); - } - } else { - BUTTON_DISABLE_IRQ(); - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return BUTTON_IRQ_ENABLED(); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(button_sensor, BUTTON_SENSOR, - value, configure, status); diff --git a/platform/esb/dev/ctsrts-sensor.c b/platform/esb/dev/ctsrts-sensor.c deleted file mode 100644 index e01afe6e7..000000000 --- a/platform/esb/dev/ctsrts-sensor.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ - -/** - * RTS/CTS (Request to Send/Clear to Send) are the signals used for hardware - * flow control. By setting the RTS line to "ON" the host tells the connected - * device that it is ready to receive data. Hardware flow control is not - * implemented yet. This implementation is just so some application can use - * the pins, it would also be possible for rs232.c to use it for hardware - * handshake but as said, that is not implemented yet. - */ - -#include "dev/ctsrts-sensor.h" -#include "dev/irq.h" -#include "dev/hwconf.h" - -const struct sensors_sensor ctsrts_sensor; - -HWCONF_PIN(RS232RTS, 1, 7); - -#define RS232CTS_IRQ() 6 -HWCONF_PIN(RS232CTS, 1, RS232CTS_IRQ()); -HWCONF_IRQ(RS232CTS, 1, RS232CTS_IRQ()); - -/*---------------------------------------------------------------------------*/ -static int -irq(void) -{ - /* Change the flank triggering for the irq so we will detect next shift. */ - if(RS232CTS_READ()) { - RS232CTS_IRQ_EDGE_SELECTD(); - } else { - RS232CTS_IRQ_EDGE_SELECTU(); - } - sensors_changed(&ctsrts_sensor); - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - /* - * Invert the bit and return. - * This is strange, accordingly to the MSP430 manual section 9.2.1, Input - * Register PxIN the bit should be low when input is low. In RealTerm on - * the PC I set RTS which is coupled to the CTS on the esb and I read a 0. - * Maybe RTS is defined active LOW on the PC? //Kalle - */ - return RS232CTS_READ() ? 0 : 1; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - switch(type) { - case SENSORS_HW_INIT: - RS232RTS_SELECT(); - RS232RTS_MAKE_OUTPUT(); - RS232RTS_CLEAR(); - RS232CTS_SELECT(); - RS232CTS_MAKE_INPUT(); - return 1; - case SENSORS_ACTIVE: - if(value) { - if(!RS232CTS_IRQ_ENABLED()) { - - /* - * Check current status on the CTS pin and set IRQ flank so we - * will detect a shift. - */ - if(RS232CTS_READ()) { - RS232CTS_IRQ_EDGE_SELECTD(); - } else { - RS232CTS_IRQ_EDGE_SELECTU(); - } - - irq_port1_activate(RS232CTS_IRQ(), irq); - RS232CTS_ENABLE_IRQ(); - } - } else { - RS232CTS_DISABLE_IRQ(); - irq_port1_deactivate(RS232CTS_IRQ()); - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return RS232CTS_IRQ_ENABLED(); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -/** - * Indicate to host/client we are NOT ready to receive data. Sets the RTS pin - * to low. - */ -void ctsrts_rts_clear(void) { - RS232RTS_CLEAR(); -} -/*---------------------------------------------------------------------------*/ -/** - * Request host/client to send data. Sets the RTS pin to high. - */ -void ctsrts_rts_set(void) { - RS232RTS_SET(); -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(ctsrts_sensor, CTSRTS_SENSOR, - value, configure, status); diff --git a/platform/esb/dev/ctsrts-sensor.h b/platform/esb/dev/ctsrts-sensor.h deleted file mode 100644 index 798d1a69f..000000000 --- a/platform/esb/dev/ctsrts-sensor.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ - -/** - * RTS/CTS (Request to Send/Clear to Send) are the signals used for hardware - * flow control. By setting the RTS line to "ON" the host tells the connected - * device that it is ready to receive data. Hardware flow control is not - * implemented yet. This implementation is just so some application can use - * the pins, it would also be possible for rs232.c to use it for hardware - * handshake but that is not implemented yet. - */ -#ifndef __CTSRTS_SENSOR_H__ -#define __CTSRTS_SENSOR_H__ - -#include "lib/sensors.h" - -extern const struct sensors_sensor ctsrts_sensor; - -#define CTSRTS_SENSOR "CTSRTS" - -/** - * Indicate to host/client we are NOT ready to receive data. Sets the RTS pin - * to low. - */ -void ctsrts_rts_clear(void); - -/** - * Request host/client to send data. Sets the RTS pin to high. - */ -void ctsrts_rts_set(void); - -#endif /* __CTSRTS_SENSOR_H__ */ diff --git a/platform/esb/dev/ds1629.c b/platform/esb/dev/ds1629.c deleted file mode 100644 index ce922ecc4..000000000 --- a/platform/esb/dev/ds1629.c +++ /dev/null @@ -1,228 +0,0 @@ -/* -Copyright 2005, Freie Universitaet Berlin. All rights reserved. - -These sources were developed at the Freie Universität Berlin, Computer -Systems and Telematics group. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -- Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -- 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. - -- Neither the name of Freie Universitaet Berlin (FUB) 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 FUB and the contributors on an "as is" -basis, without any representations or warranties of any kind, express -or implied including, but not limited to, representations or -warranties of non-infringement, merchantability or fitness for a -particular purpose. In no event shall FUB 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 implementation was developed by the CST group at the FUB. - -For documentation and questions please use the web site -http://scatterweb.mi.fu-berlin.de and the mailinglist -scatterweb@lists.spline.inf.fu-berlin.de (subscription via the Website). -Berlin, 2005 -*/ - -/** - * Part of the source code from ScatterWeb 2.2 (ScatterWeb.{Data,System}.c) - * released by Freie Universitaet Berlin has been reworked and - * reformatted to fit the Contiki ESB port. - */ - -#include "contiki.h" -#include "dev/ds1629.h" - -#define SDA_HIGH (P5OUT |= 0x01) /* RTC data line high */ -#define SDA_LOW (P5OUT &= 0xFE) /* RTC data line low */ -#define SCL_HIGH (P5OUT |= 0x02) /* RTC clock line high */ -#define SCL_LOW (P5OUT &= 0xFD) /* RTC clock line low */ -#define BUS_READ 0x9F -#define BUS_WRITE 0x9E -#define ACC_CSR 0xAC /* Access Configuration/Control Register */ -#define ACC_CLOCK 0xC0 /* Access Clock Register */ -#define ACC_CLOCK_ALARM 0xC7 /* Access Clock Alarm Register */ -#define ACC_TH 0xA1 /* Access Thermostat Setpoint High */ -#define ACC_TL 0xA2 /* Access Thermostat Setpoint Low */ -#define ACC_CSRAM 0x17 /* Access Clock 32 byte SRAM */ -#define ACC_RT 0xAA /* Access Read Temperatur Register */ -#define CSR_OS1 (0x80) -#define CSR_OS0 (0x40) -#define CSR_A1 (0x20) -#define CSR_A0 (0x10) -#define CSR_CNV (0x04) -#define CSR_POL (0x02) -#define CSR_1SH (0x01) -#define CSR_DEFAULT (CSR_OS1 + CSR_OS0 + CSR_A1 + CSR_CNV + CSR_1SH + CSR_POL) - -/** - * Temperature type (built on a signed int). It's a signed (twos complement) - * fixed point value with 8 bits before comma and 7 bits after. So Bit 15 is - * sign, Bit14-7 is before comma and Bit 6-0 after comma. - * - * @since 2.0 - */ -typedef union { unsigned int u; signed int s; } temp_t; - -/*--------------------------------------------------------------------------*/ -/* Puts the start condition on bus. */ -static void -cl_start(void) -{ - P5DIR |= 0x03; /* ensure: P50(SDA), P51(SCL) output */ - SCL_LOW; _NOP(); _NOP(); - SDA_HIGH; _NOP(); _NOP(); - SCL_HIGH; _NOP(); _NOP(); - SDA_LOW; _NOP(); _NOP(); - SCL_LOW; _NOP(); _NOP(); -} -/*--------------------------------------------------------------------------*/ -/* Puts the stop condition on bus. */ -static void -cl_stop() -{ - SCL_LOW; _NOP(); _NOP(); - SDA_LOW; _NOP(); _NOP(); - SCL_HIGH; _NOP(); _NOP(); - SDA_HIGH; _NOP(); _NOP(); - SCL_LOW; _NOP(); _NOP(); - P5DIR &= ~0x03; -} -/*--------------------------------------------------------------------------*/ -/* Writes a byte on the bus, returns the acknowledge bit. */ -static uint16_t -cl_writeOnBus(uint8_t byte) -{ - uint16_t i, ack; - for(i=0;i<8;i++) { - if(byte & 0x80) SDA_HIGH; else SDA_LOW; - SCL_HIGH; - byte = byte << 1; _NOP(); - SCL_LOW; _NOP(); - } - /* check ack */ - P5DIR &= 0xFE; /* P50(SDA) input */ - SCL_HIGH; - if(P5IN & 0x01) ack = 0; else ack = 1; /* test if ack=0, else error */ - _NOP(); - SCL_LOW; - P5DIR |= 0x01; /* P50(SDA) output */ - return ack; -} -/*--------------------------------------------------------------------------*/ -static uint8_t -cl_readFromBus(uint16_t ack) -{ - uint16_t i; - uint8_t byte = 0; - P5DIR &= 0xFE; /* P50(SDA) input */ - for(i=0;i<8;i++) { - byte = byte << 1; - SCL_HIGH; - if(P5IN & 0x01) byte |= 0x01; else byte &= 0xFE; - SCL_LOW; - } - P5DIR |= 0x01; /* P50(SDA) output */ - if(ack) SDA_LOW; else SDA_HIGH; - SCL_HIGH; - SCL_LOW; - return byte; -} -/*--------------------------------------------------------------------------*/ -static uint16_t -getReg16bit(uint8_t acc, uint16_t bitmask) -{ - uint16_t config = 0; - do cl_start(); - while(!cl_writeOnBus(BUS_WRITE)); - cl_writeOnBus(acc); - cl_start(); - cl_writeOnBus(BUS_READ); - config = cl_readFromBus(1); - config = config << 8; - config += cl_readFromBus(0); - cl_stop(); - config &= bitmask; - _NOP(); - _NOP(); - return config; -} -/*--------------------------------------------------------------------------*/ -/* Only first 8 bit of Configuration Status Register can be set */ -static void -setCSReg(uint8_t setting) -{ - do cl_start(); - while(!cl_writeOnBus(BUS_WRITE)); - cl_writeOnBus(ACC_CSR); - cl_writeOnBus(setting); - cl_stop(); - _NOP(); - _NOP(); - _NOP(); - _NOP(); -} -/*--------------------------------------------------------------------------*/ -static void -System_startConversion(void) -{ - do cl_start(); /* do start until BUS_WRITE is acked */ - while(!cl_writeOnBus(BUS_WRITE)); /* control byte */ - cl_writeOnBus(0xEE); /* start conversion */ - cl_stop(); -} -/*--------------------------------------------------------------------------*/ -/* RTC initialization. Initializes RTC with ::CSR_DEFAULT. */ -static void -initClock(void) -{ - uint8_t csr = getReg16bit(ACC_CSR,0xFF00) >> 8; - if(csr!=CSR_DEFAULT) setCSReg(CSR_DEFAULT); /* if desired config isnt in clock => set it */ - /* IMPORTANT: Ensure quartz is generating 32768 Hz */ - /* (sometimes CH bit gets set when clock is read while reset) */ - do cl_start(); /* Do start until BUS_WRITE is acked. */ - while(!cl_writeOnBus(BUS_WRITE)); /* Send control byte */ - cl_writeOnBus(ACC_CLOCK); /* Send command byte ::ACC_CLOCK. */ - cl_writeOnBus(0x00); /* Send starting address 0x00. */ - cl_writeOnBus(0x00); /* Set CH to 0, tseconds and seconds will also be reset! */ - cl_stop(); /* Stop condition. */ -} -/*--------------------------------------------------------------------------*/ -void -ds1629_init() -{ - initClock(); -} -/*--------------------------------------------------------------------------*/ -void -ds1629_start() -{ - System_startConversion(); -} -/*--------------------------------------------------------------------------*/ -signed int -ds1629_temperature() -{ - temp_t temperature; - - ds1629_start(); - - temperature.u = getReg16bit(ACC_RT,0xFFFF); - return temperature.s; -} diff --git a/platform/esb/dev/ds1629.h b/platform/esb/dev/ds1629.h deleted file mode 100644 index a0120fb7e..000000000 --- a/platform/esb/dev/ds1629.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2005, 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 Configurable Sensor Network Application - * Architecture for sensor nodes running the Contiki operating system. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2005-11-08 - * Updated : $Date: 2006/06/18 07:49:33 $ - * $Revision: 1.1 $ - */ - -#ifndef __DS1629_H__ -#define __DS1629_H__ - -/** - * DS1629 initialization function. - * - * This function should be called at startup to initialize the DS1629 - * and its clock. - */ -void ds1629_init(void); - -/** - * DS1629 start conversion function. - * - * This function should be called before requesting the temperature - * the first time. - */ -void ds1629_start(void); - -/** - * Get the temperature. - * - * This function will return the current temperature as a signed 9 bit - * value in terms of a 0.5 degree Celsius least significant bit. - * - * MSB Sign 2^6 2^5 2^4 2^3 2^2 2^1 2^0 - * LSB 2^-1 0 0 0 0 0 0 0 - */ -signed int ds1629_temperature(void); - -#endif /* __DS1629_H__ */ diff --git a/platform/esb/dev/eeprom.c b/platform/esb/dev/eeprom.c deleted file mode 100644 index fb63f4a9c..000000000 --- a/platform/esb/dev/eeprom.c +++ /dev/null @@ -1,323 +0,0 @@ -/** - * \file - * EEPROM functions. - * \author Adam Dunkels - */ - -/* Copyright (c) 2004 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. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. - * - * - * Author: Adam Dunkels - * - */ - -/* -Copyright 2003/2004, Freie Universitaet Berlin. All rights reserved. - -These sources were developed at the Freie Universit\x{FFFF}t Berlin, Computer -Systems and Telematics group. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -- Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -- 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. - -- Neither the name of Freie Universitaet Berlin (FUB) 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 FUB and the contributors on an "as is" -basis, without any representations or warranties of any kind, express -or implied including, but not limited to, representations or -warranties of non-infringement, merchantability or fitness for a -particular purpose. In no event shall FUB 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 implementation was developed by the CST group at the FUB. -Contributors: Thomas Pietsch, Bjoern Lichtblau - -For documentation and questions please use the web site -http://www.scatterweb.net and the mailinglist -scatterweb@lists.spline.inf.fu-berlin.de (subscription via the Website). -Berlin, 2003/2004 -*/ - -#include "contiki.h" -/* #include */ - -#include "dev/eeprom.h" - -/* Temporary switch for the eeprom address. */ -#define EEPROMADDRESS (0x00) /* use 8k EEPROM, future versions will have only one 64k eeprom at this address */ -/*#define EEPROMADDRESS (0x02)*/ /* use 64k EEPROM */ - -/* must be set together with EEPROMADDRESS */ -/*#define EEPROMPAGEMASK (0x1F) */ /* 8k EEPROM, 32b page writes possible */ -#define EEPROMPAGEMASK (0x7F) /* 64k EEPROM, 128b page writes possible */ - - - -/* - * Macros for accessing the clock and data lines. Data is on P56 and - * clock on P57. - */ -#define SDA_HIGH (P5OUT |= 0x04) /**< EEPROM data line high */ -#define SDA_LOW (P5OUT &= 0xFB) /**< EEPROM data line low */ -#define SCL_HIGH (P5OUT |= 0x08) /**< EEPROM clock line high */ -#define SCL_LOW (P5OUT &= 0xF7) /**< EEPROM clock line low */ - - -/*-----------------------------------------------------------------------------------*/ -/** - * \internal \name Basic functions for interfacing the i2c-like EEPROM bus. - */ -/** @{ */ - -/** - * \internal - * Put start condition on the bus. - */ -static void -start(void) -{ - P5DIR |= 0x0C; /* ensure: P52(SDA), P53(SCL) output */ - SCL_LOW; _NOP(); _NOP(); - SDA_HIGH; _NOP(); _NOP(); - SCL_HIGH; _NOP(); _NOP(); - SDA_LOW; _NOP(); _NOP(); - SCL_LOW; _NOP(); _NOP(); -} - -/*-----------------------------------------------------------------------------------*/ -/** - * \internal - * Put stop condition on the bus. - */ -static void -stop(void) -{ - //P5DIR |= 0x0C; /* ensure: P52(SDA), P53(SCL) output */ - SCL_LOW; _NOP(); _NOP(); - SDA_LOW; _NOP(); _NOP(); - SCL_HIGH; _NOP(); _NOP(); - SDA_HIGH; _NOP(); _NOP(); - SCL_LOW; _NOP(); _NOP(); - P5DIR &= ~0x0C; -} -/*-----------------------------------------------------------------------------------*/ -/** - * \internal - * Write a byte on the bus, return the acknowledge bit. - */ -static int -write_bus(unsigned char byte) -{ - int i, ack; - - /* Write byte, one bit at a time. Start with the leftmost (most - significant) bit and roll in bits from the right. */ - for(i = 0; i < 8; ++i) { - if(byte & 0x80) { - SDA_HIGH; - } else { - SDA_LOW; - } - _NOP(); - _NOP(); - SCL_HIGH; - _NOP(); - _NOP(); - byte = byte << 1; - SCL_LOW; - _NOP(); - _NOP(); - } - - /* check ack */ - P5DIR &= 0xFB; /* P52(SDA) input */ - SCL_HIGH; - _NOP(); - _NOP(); - if(P5IN & 0x04) { - ack = 0; - } else { - ack = 1; /* test if ack=0, else error */ - } - SCL_LOW; - _NOP(); - _NOP(); - P5DIR |= 0x04; /* P52(SDA) output */ - _NOP(); - _NOP(); - _NOP(); - return ack; -} -/*-----------------------------------------------------------------------------------*/ -/** - * \internal - * Read one byte from the bus. - * - * \param ack If set, the ackbit after the received byte will be set. - */ -static unsigned char -read_bus(unsigned char ack) -{ - int i; - unsigned char byte = 0; - - P5DIR &= 0xFB; /* P52(SDA) input */ - - for(i = 0; i < 8; ++i) { - byte = byte << 1; - SCL_HIGH; - _NOP(); - _NOP(); - if(P5IN & 0x04) { - byte |= 0x01; - } else { - byte &= 0xFE; - } - _NOP(); - SCL_LOW; - _NOP(); - _NOP(); - } - - P5DIR |= 0x04; /* P52(SDA) output */ - if(ack) { - SDA_LOW; - } else { - SDA_HIGH; - } - _NOP(); - SCL_HIGH; - _NOP(); - SCL_LOW; - _NOP(); - return byte; -} -/** @} */ -/*-----------------------------------------------------------------------------------*/ -/** - * Read bytes from the EEPROM using sequential read. - */ -void -eeprom_read(unsigned short addr, unsigned char *buf, int size) -{ - unsigned int i; - - if(size <= 0) { - return; - } - - do { - /* Wait if the writecycle has not finished. */ - start(); - /* 1010 control, 000 address, 0=write --- but only inits address */ - } while(!write_bus(0xa0 | EEPROMADDRESS)); - - - /* Write address to bus, low byte first. */ - write_bus(addr >> 8); - write_bus(addr & 0xff); - start(); - /* 1010 control, 000 address, 1=read */ - write_bus(0xa1 | EEPROMADDRESS); - - for(i = 0; i < (size - 1); ++i){ - buf[i] = read_bus(1); - } - buf[size - 1] = read_bus(0); - stop(); -} -/*-----------------------------------------------------------------------------------*/ -/** - * Write bytes to EEPROM using sequencial write. - */ -void -eeprom_write(unsigned short addr, unsigned char *buf, - int size) -{ - unsigned int i = 0; - unsigned int curaddr; - - if(size <= 0) { - return; - } - - /* Disable write protection. */ - P5OUT &= 0xEF; - - curaddr = addr; - for(i = 0; i < size; ++i) { - /* If we are writing the first byte or are on a 128b page boundary - we have to start a new write. */ - if(i == 0 || (curaddr & EEPROMPAGEMASK) == 0) { - do { - start(); - /* 1010 control, 000 addresse, 0=write */ - } while(!write_bus(0xa0 | EEPROMADDRESS)); - - /* Write the new address to the bus. */ - if(write_bus(curaddr >> 8) == 0) { - return; - } - if(write_bus(curaddr) == 0) { - return; - } - } - - /* Write byte. */ - if(write_bus(buf[i]) == 0) { - return; - } - - /* If we are writing the last byte totally or of a 128b page - generate a stop condition */ - if(i == size - 1 || (curaddr & EEPROMPAGEMASK) == EEPROMPAGEMASK) { - stop(); - } - - ++curaddr; - } - - /* Enable write protection. */ - P5OUT |= 0x10; -} - -/*-----------------------------------------------------------------------------------*/ diff --git a/platform/esb/dev/esb-sensors.c b/platform/esb/dev/esb-sensors.c deleted file mode 100644 index 01901dec1..000000000 --- a/platform/esb/dev/esb-sensors.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ - -/** - * \file - * Functions for turning the ESB sensors on or off - * \author - * Adam Dunkels - * - * This file will eventually be changed into a better API. This is - * sufficient for now. - */ - -#include "dev/hwconf.h" -#include "dev/irq.h" -#include "sys/energest.h" - -HWCONF_PIN(SENSORSWITCH, 5, 5); - -/*---------------------------------------------------------------------------*/ -void -esb_sensors_init(void) -{ - SENSORSWITCH_SELECT(); - SENSORSWITCH_MAKE_OUTPUT(); - - irq_init(); -} -/*---------------------------------------------------------------------------*/ -void -esb_sensors_on(void) -{ - SENSORSWITCH_CLEAR(); - ENERGEST_ON(ENERGEST_TYPE_SENSORS); -} -/*---------------------------------------------------------------------------*/ -void -esb_sensors_off(void) -{ - SENSORSWITCH_SET(); - ENERGEST_OFF(ENERGEST_TYPE_SENSORS); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/esb/dev/esb-sensors.h b/platform/esb/dev/esb-sensors.h deleted file mode 100644 index 599fe65a0..000000000 --- a/platform/esb/dev/esb-sensors.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ - -/** - * \file - * A brief description of what this file is. - * \author - * Adam Dunkels - */ - -#ifndef __ESB_SENSORS_H__ -#define __ESB_SENSORS_H__ - -void esb_sensors_init(void); -void esb_sensors_on(void); -void esb_sensors_off(void); - -#endif /* __ESB_SENSORS_H__ */ diff --git a/platform/esb/dev/ir.c b/platform/esb/dev/ir.c deleted file mode 100644 index 56ac46a27..000000000 --- a/platform/esb/dev/ir.c +++ /dev/null @@ -1,315 +0,0 @@ - - - -/* The software in this file is based on code from FU Berlin. */ - -/* -Copyright 2003/2004, Freie Universitaet Berlin. All rights reserved. - -These sources were developed at the Freie Universität Berlin, Computer -Systems and Telematics group. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -- Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -- 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. - -- Neither the name of Freie Universitaet Berlin (FUB) 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 FUB and the contributors on an "as is" -basis, without any representations or warranties of any kind, express -or implied including, but not limited to, representations or -warranties of non-infringement, merchantability or fitness for a -particular purpose. In no event shall FUB 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 implementation was developed by the CST group at the FUB. -Contributors: Thomas Pietsch, Bjoern Lichtblau - -*/ - -/* \file recir.c - ** \ingroup Firmware - ** \brief Receiving RC5 via IR Receiving Diode. - ** - ** \code - ** RC5: 1780 us bitlength (manchester encoded, so half bitlength of 890 us is important) - ** Transferred packet (2 start + toggle bit + 5 address bits + 6 comand bits)): - ** | S | S | T | A4 | A3 | A2 | A1 | A0 | C5 | C4 | C3 | C2 | C1 | C0 | - ** irdata format: | ? | ? | error | newData | T | A4 | A3 | A2 | A1 | A0 | C5 | C4 | C3 | C2 | C1 | C0 | - ** \endcode - ** - ** - ** See detailed description at http://users.pandora.be/davshomepage/rc5.htm - ** - ** Some common addresses and commands: - ** \code - ** Address: Device: Command: - ** 0 TV1 0...9 Numbers 0...9 (channel select) - ** 1 TV2 12 Standby - ** 5 VCR1 16 Master Volume + - ** 6 VCR2 17 Master Volume - - ** 17 Tuner 18 Brightness + - ** 18 Audio Tape 19 Brightness - - ** 20 CD Player 50 Fast rewind - ** 52 Fast run forward - ** 53 Play - ** 54 Stop - ** 55 Recording - ** \endcode - **/ - -#include "contiki.h" -#include "dev/ir.h" - -#include "dev/leds.h" -#include "dev/beep.h" -#include "isr_compat.h" - -PROCESS(ir_process, "IR receiver"); -process_event_t ir_event_received; -/*---------------------------------------------------------------------------*/ -#define SIR1 (P1OUT |= 0x01) ///< MACRO: Puts IR sending diode high. -#define SIR0 (P1OUT &= 0xFE) ///< MACRO: Puts IR sending diode low. -#define BIT75 3282 ///< 3 quarters of a bit after start, 3282 cyc @ 2,4576Mhz = 1335us. -#define BIT50 2188 ///< Half of bit length, 2188 cyc @ 2,4576Mhz = 890 us. - -/*---------------------------------------------------------------------------*/ -/* Sends a logical one via IR, method is timed for the 2.4576Mhz SMCLK!!! - */ -static volatile void -send1bit(void) -{ - volatile int i; - for(i = 0; i < 34; ++i) { - SIR1; SIR1; SIR1; SIR1; - SIR0; SIR0; SIR0; SIR0; - SIR0; SIR0; SIR0; SIR0; - SIR0; - } -} -/*---------------------------------------------------------------------------*/ -/* Sends a logical 0 via IR, method is timed for the 2.4576Mhz SMCLK!!! - */ -static volatile void -send0bit(void) -{ - volatile int i; - for(i = 0; i < 34; ++i) { - SIR0; SIR0; SIR0; SIR0; - SIR0; SIR0; SIR0; SIR0; - SIR0; SIR0; SIR0; SIR0; - SIR0; - } -} -/*---------------------------------------------------------------------------*/ -/* Sends the lower 12 bits of data via IR, turns interrupt off while - it's sending. - */ -void -ir_send(unsigned short data) -{ - volatile unsigned short mask = 0x2000; - data |= 0xF000; - - dint(); - while(mask != 0){ - if(!(mask & data)){ - send1bit(); - send0bit(); - } else { - send0bit(); - send1bit(); - } - mask /= 2; - } - eint(); -} -/*---------------------------------------------------------------------------*/ -/* Testroutine which repetedly sends two commands. - */ -/*void -ir_test_send(void) -{ - volatile unsigned int i; - send12bits(0xF010); - for(i=0; i<0xFFFF; i++) nop(); - send12bits(0xF011); - for(i=0; i<0xFFFF; i++) nop(); -}*/ -/*---------------------------------------------------------------------------*/ - - -static void setErrorBit(void); -static void clearErrorBit(void); -static void setDataAvailableBit(void); -static void clearDataAvailableBit(void); - - -/// \name Internal variables. -//@{ -static unsigned int ir_pos; ///< current position in frame -static unsigned int recvdata; ///< here a received packet is saved -static unsigned int recvdatabuffer; ///< temporary buffer for receiving -static unsigned char ir_temp; ///< saves the first half of the manchester bit -//@} - -/// \name Public functions. -/// If ::recir_dataAvailable()==1 use the get* functions. -//@{ -unsigned char recir_getCode(void){ return (recvdata & 0x003F); } -unsigned char recir_getAddress(void){ return ((recvdata & 0x07C0) >> 6); } -unsigned char recir_getToggle(void){ return ((recvdata & 0x0800) >> 11); } -unsigned char recir_getError(void){ return ((recvdata & 0x2000) >> 13); } - -uint16_t -ir_data(void) -{ - return recvdata; -} - -uint8_t -ir_poll(void) -{ - if(recvdata & 0x1000) { - clearDataAvailableBit(); - return 1; - } else { - return 0; - } -} - - -///\name Internal functions. -//@{ -static void setErrorBit(void){ recvdata |= 0x2000; } -static void clearErrorBit(void) { recvdata &= 0xDFFF; } -static void setDataAvailableBit(void){ recvdata |= 0x1000; } -static void clearDataAvailableBit(void){ recvdata &= 0xEFFF; } - - -/// Timer B0 interrupt service routine -ISR(TIMERB1, Timer_B1) { - - /*P2OUT = (P2OUT & 0xf7) | (8 - (P2OUT & 0x08));*/ - - if(ir_pos <= 25) { - if(ir_pos % 2) { // odd position - if(ir_temp && !(P1IN & 0x04)) { // 1 - 0 --> write 1 - recvdatabuffer +=1; - recvdatabuffer = recvdatabuffer << 1; - } else if(!ir_temp && (P1IN & 0x04)) { // 0 - 1 --> write 0 - recvdatabuffer = recvdatabuffer << 1; - } else { - setErrorBit(); - if(P1IN & 0x04) { - recvdatabuffer += 1; - } - recvdatabuffer = recvdatabuffer << 1; - } - } else { // even position - ir_temp = P1IN & 0x04; - } - } - - if(ir_pos == 25) { // end reached - recvdatabuffer = recvdatabuffer >> 1; - - if(!recir_getError() && ( (recvdatabuffer & 0x0FFF) != (recvdata & 0x0FFF) ) ){ - recvdata = recvdatabuffer; - setDataAvailableBit(); - } else { - _NOP(); - } - } - - if(ir_pos==27) { - TBCCTL1 &= ~CCIE; - - //GREENOFF; - // temporary debug output - //sendRS232Address(recvdatabuffer); - //if(recir_getError()) sendRS232('E'); - //sendRS232String("\r\n"); - if(!recir_getError()) beep_beep(20); - - // reenable interrupt for falling edge - P1IFG &= ~(0x04); - P1IE |= 0x04; // enable interrupt for recir RC5 - leds_off(LEDS_RED); - } - - ir_pos++; - TBCCR1 += BIT50; // set new interrupt - - TBCCTL1 &= ~CCIFG; -} - - -/** \brief IR Interrupt routine - ** - ** For the falling edge (start of RC5 packet)( mid of first start bit ), IRReceiver is on P12 - ** real interrupt routine, which calls this, is in sensors.c */ -void -ir_irq(void) -{ - if(P1IN & 0x04) return; // high again, just a peak - - ir_pos = 0; - recvdatabuffer = 0; - clearErrorBit(); - - // the first timer interrupt will occur in the mid of the first half of the second start bit - TBCCR1 = TBR + BIT75; // set first TBCCR1 IRQ to 75% of RC5 bitlength - TBCCTL1 &= ~CCIFG; // clear previous compare flag - TBCCTL1 |= CCIE; // CCR0 interrupt enabled, interrupt occurs when timer equals CCR0 - - P1IE &= ~0x04; // disable interrupt for P12 ( ReceiveIR ) - leds_on(LEDS_RED); - //GREENON; -} - -//@} -/*---------------------------------------------------------------------*/ -PROCESS_THREAD(ir_process, ev, data) -{ - PROCESS_BEGIN(); - - // init TIMERB ccr0 to run continouslycreate the 5 ms interval - // ccr1 is used for ir receiving (RC5) - TBCTL = TBSSEL1 + TBCLR; // select SMCLK (2.4576MHz), clear TBR - TBCTL |= MC1; // Start Timer_A in continuous mode - - - P1IES |= 0x04; // Important for IR-RC5 receive to detect the first FALLING edge - - ir_event_received = process_alloc_event(); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_POLL); - - if(ir_poll() == IR_DATA) { - unsigned short irdata; - irdata = ir_data() & 0x7ff; - process_post(PROCESS_BROADCAST, ir_event_received, (process_data_t)irdata); - } - - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------*/ diff --git a/platform/esb/dev/ir.h b/platform/esb/dev/ir.h deleted file mode 100644 index f806c1d55..000000000 --- a/platform/esb/dev/ir.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ -#ifndef __IR_H__ -#define __IR_H__ - -#include "contiki.h" -#include "contiki-net.h" - -/** - * Initialize the IR driver. - * - * This function should be called from the main boot-up procedure in - * order to initialize the IR device driver. - * - */ -void ir_init(void); - -void ir_send(unsigned short low12bits); - -uint8_t ir_poll(void); -#define IR_NODATA 0 -#define IR_DATA 1 - -uint16_t ir_data(void); - -void ir_irq(void); - -#define IR_STANDBY 0x0c -#define IR_VOLUME_UP 0x10 -#define IR_VOLUME_DOWN 0x11 -#define IR_VCR_PLAY 0x35 -#define IR_VCR_STOP 0x36 -#define IR_VCR_RECORD 0x37 -#define IR_VCR_REWIND 0x32 -#define IR_VCR_WIND 0x34 - -extern process_event_t ir_event_received; - -PROCESS_NAME(ir_process); - -#endif /* __IR_H__ */ diff --git a/platform/esb/dev/irq.c b/platform/esb/dev/irq.c deleted file mode 100644 index 20823f27b..000000000 --- a/platform/esb/dev/irq.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (c) 2009, 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. - * - */ -#include "contiki.h" -#include "lib/sensors.h" -#include "dev/irq.h" -#include "dev/lpm.h" -#include "isr_compat.h" - -#define ADC12MCTL_NO(adcno) ((unsigned char *) ADC12MCTL0_)[adcno] - -static int (* adc12_irq[8])(void); -static int (* port1_irq[8])(void); -static unsigned char adcflags; - -/*---------------------------------------------------------------------------*/ -ISR(PORT1, irq_p1) -{ - int i; - ENERGEST_ON(ENERGEST_TYPE_IRQ); - for(i = 0; i < 8; i++) { - if((P1IFG & (1 << i)) && port1_irq[i] != NULL) { - if((port1_irq[i])()) { - LPM4_EXIT; - } - } - } - P1IFG = 0x00; - ENERGEST_OFF(ENERGEST_TYPE_IRQ); -} -/*---------------------------------------------------------------------------*/ -ISR(ADC, irq_adc) -{ - int i; - ENERGEST_ON(ENERGEST_TYPE_IRQ); - for(i = 0; i < 8; i++) { - if(adc12_irq[i] != NULL) { - if((adc12_irq[i])()) { - LPM4_EXIT; - } - } - } - ENERGEST_OFF(ENERGEST_TYPE_IRQ); -} -/*---------------------------------------------------------------------------*/ -void -irq_init(void) -{ - int i; - adcflags = 0; - for(i = 0; i < 8; i++) { - adc12_irq[i] = NULL; - port1_irq[i] = NULL; - } - /* Setup ADC12, ref., sampling time */ - ADC12CTL0 = REF2_5V | SHT0_10 | SHT1_10 | MSC; - - /* Use sampling timer, repeat-sequence-of-channels */ -/* ADC12CTL1 = SHP | CONSEQ_3 | ADC12DIV_3; */ - ADC12CTL1 = SHP | CONSEQ_3 | ADC12DIV_7; -} -/*---------------------------------------------------------------------------*/ -void -irq_port1_activate(unsigned char irqno, int (* irq)(void)) -{ - if(irqno < 8) { - port1_irq[irqno] = irq; - } -} -/*---------------------------------------------------------------------------*/ -void -irq_port1_deactivate(unsigned char irqno) -{ - if(irqno < 8) { - port1_irq[irqno] = NULL; - } -} -/*---------------------------------------------------------------------------*/ -/* Set lowest ADC to be start in sequence and highest to be interrupt - enabled and set end-of-sequence on the highest active ADC */ -static void -sethilo(void) -{ - int c; - - /* Clear start of sequence */ - ADC12CTL1 &= ~(CSTARTADD_15); - - /* Set new start of sequence to lowest active memory holder */ - for(c = 0; c < 8; c++) { - if(adcflags & (1 << c)) { - ADC12CTL1 |= (c * CSTARTADD_1); - break; - } - } - - /* Clear all interrupts and end-of-sequences */ - ADC12IE = 0; - for(c = 0; c < 8; c++) { - ADC12MCTL_NO(c) &= ~EOS; - } - - /* Set highest interrupt and end-of-sequence. This will generate one - interrupt for each sequence of conversions. */ - for(c = 0; c < 8; c++) { - if(adcflags & (128 >> c)) { - ADC12IE |= 128 >> c; - ADC12MCTL_NO(7 - c) |= EOS; - break; - } - } -} -/*---------------------------------------------------------------------------*/ -void -irq_adc12_activate(unsigned char adcno, unsigned char config, - int (* irq)(void)) -{ - if(adcno >= 8) { - return; - } - /* stop converting */ - ADC12CTL0 &= ~ENC; - /* wait for conversion to stop */ - while(ADC12CTL0 & ADC12BUSY); - ADC12CTL0 &= ~(ADC12ON | REFON); - ADC12IE = 0; - - /* clear any pending interrupts */ - ADC12IFG = 0; - - adcflags |= (1 << adcno); - - ADC12MCTL_NO(adcno) = config; - - sethilo(); - - ADC12CTL0 |= ADC12ON | REFON; - - adc12_irq[adcno] = irq; - - /* Delay */ - clock_delay(20000); - - ADC12CTL0 |= ENC | ADC12SC; -} -/*---------------------------------------------------------------------------*/ -void -irq_adc12_deactivate(unsigned char adcno) -{ - if(adcno >= 8) { - return; - } - /* stop converting */ - ADC12CTL0 &= ~ENC; - /* wait for conversion to stop */ - while(ADC12CTL0 & ADC12BUSY); - ADC12CTL0 &= ~(ADC12ON | REFON); - ADC12IE = 0; - - /* clear any pending interrupts */ - ADC12IFG = 0; - - adcflags &= ~(1 << adcno); - - ADC12MCTL_NO(adcno) = 0; - - sethilo(); - - adc12_irq[adcno] = NULL; - - if(adcflags) { - /* Turn on the ADC12 */ - ADC12CTL0 |= (ADC12ON | REFON); - - /* Delay */ - clock_delay(20000); - - /* Still active. Turn on the conversion. */ - ADC12CTL0 |= ENC | ADC12SC; - } -} -/*---------------------------------------------------------------------------*/ -int -irq_adc12_active(unsigned char adcno) -{ - return adcflags & (1 << adcno) ? 1 : 0; -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/esb/dev/irq.h b/platform/esb/dev/irq.h deleted file mode 100644 index 0f1b94132..000000000 --- a/platform/esb/dev/irq.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2009, 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. - * - */ -#ifndef __IRQ_H__ -#define __IRQ_H__ - -void irq_init(void); - -void irq_port1_activate(unsigned char irqno, int (* irq)(void)); -void irq_port1_deactivate(unsigned char irqno); - -void irq_adc12_activate(unsigned char adcno, unsigned char config, - int (* irq)(void)); -void irq_adc12_deactivate(unsigned char adcno); - -int irq_adc12_active(unsigned char adcno); - -#endif /* __IRQ_H__ */ diff --git a/platform/esb/dev/pir-sensor.c b/platform/esb/dev/pir-sensor.c deleted file mode 100644 index 1e9b1e977..000000000 --- a/platform/esb/dev/pir-sensor.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ - -#include "dev/pir-sensor.h" -#include "dev/irq.h" -#include "dev/hwconf.h" - -const struct sensors_sensor pir_sensor; - -static unsigned int pir; - -#define PIR_IRQ() 3 -HWCONF_PIN(PIR, 1, PIR_IRQ()); -HWCONF_IRQ(PIR, 1, PIR_IRQ()); - -/*---------------------------------------------------------------------------*/ -static int -irq(void) -{ - ++pir; - sensors_changed(&pir_sensor); - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return pir; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - switch(type) { - case SENSORS_HW_INIT: - pir = 0; - PIR_SELECT(); - PIR_MAKE_INPUT(); - return 1; - case SENSORS_ACTIVE: - if(value) { - if(!PIR_IRQ_ENABLED()) { - irq_port1_activate(PIR_IRQ(), irq); - PIR_ENABLE_IRQ(); - } - } else { - PIR_DISABLE_IRQ(); - irq_port1_deactivate(PIR_IRQ()); - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return PIR_IRQ_ENABLED(); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(pir_sensor, PIR_SENSOR, - value, configure, status); diff --git a/platform/esb/dev/pir-sensor.h b/platform/esb/dev/pir-sensor.h deleted file mode 100644 index fb32e256d..000000000 --- a/platform/esb/dev/pir-sensor.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ -#ifndef __PIR_SENSOR_H__ -#define __PIR_SENSOR_H__ - -#include "lib/sensors.h" - -extern const struct sensors_sensor pir_sensor; - -#define PIR_SENSOR "PIR" - -#endif /* __PIR_SENSOR_H__ */ diff --git a/platform/esb/dev/radio-sensor.c b/platform/esb/dev/radio-sensor.c deleted file mode 100644 index 185bd4218..000000000 --- a/platform/esb/dev/radio-sensor.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ - -#include "contiki.h" -#include "dev/radio-sensor.h" -#include "dev/irq.h" -#include "dev/tr1001.h" - -const struct sensors_sensor radio_sensor; - -unsigned int radio_sensor_signal; - -/*---------------------------------------------------------------------------*/ -static int -irq(void) -{ - radio_sensor_signal = ADC12MEM5; - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - switch(type) { - case RADIO_SENSOR_LAST_PACKET: - return tr1001_sstrength(); - case RADIO_SENSOR_LAST_VALUE: - default: - return radio_sensor_signal; - } -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - switch(type) { - case SENSORS_HW_INIT: - /* Initialization of ADC12 done by irq */ - radio_sensor_signal = 0; - return 1; - case SENSORS_ACTIVE: - if(value) { - if(!irq_adc12_active(5)) { - irq_adc12_activate(5, (INCH_5 + SREF_0), irq); - } - } else { - irq_adc12_deactivate(5); - radio_sensor_signal = 0; - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return irq_adc12_active(5); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(radio_sensor, RADIO_SENSOR, - value, configure, status); diff --git a/platform/esb/dev/rs232-putchar.c b/platform/esb/dev/rs232-putchar.c deleted file mode 100644 index fae8e9adc..000000000 --- a/platform/esb/dev/rs232-putchar.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2006, 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. - * - */ - -#include "dev/rs232.h" - -int -putchar(int c) -{ - rs232_send(c); - return c; -} diff --git a/platform/esb/dev/rs232.c b/platform/esb/dev/rs232.c deleted file mode 100644 index 8f1ed2ffa..000000000 --- a/platform/esb/dev/rs232.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ - -/** \addtogroup esbrs232 - * @{ */ - -/** - * \file - * RS232 communication device driver for the MSP430. - * \author Adam Dunkels - * - * This file contains an RS232 device driver for the MSP430 microcontroller. - * - */ - -#include "contiki.h" -#include - -#include "contiki-esb.h" -#include "isr_compat.h" - -static int (* input_handler)(unsigned char) = NULL; - -/*---------------------------------------------------------------------------*/ -ISR(UART1RX, rs232_rx_usart1) -{ - ENERGEST_ON(ENERGEST_TYPE_IRQ); - /* Check status register for receive errors. - before reading RXBUF since - it clears the error and interrupt flags */ - if(!(URCTL1 & RXERR) && input_handler != NULL) { - - if(input_handler(RXBUF1)) { - LPM4_EXIT; - } - } else { - /* Else read out the char to clear the I-flags, etc. */ - RXBUF1; - } - ENERGEST_OFF(ENERGEST_TYPE_IRQ); -} -/*---------------------------------------------------------------------------*/ -/** - * Initalize the RS232 port. - * - */ -void -rs232_init(void) -{ - - /* RS232 */ - UCTL1 = CHAR; /* 8-bit character */ - UTCTL1 = SSEL1; /* UCLK = MCLK */ - - rs232_set_speed(RS232_57600); - - input_handler = NULL; - - ME2 |= (UTXE1 | URXE1); /* Enable USART1 TXD/RXD */ - IE2 |= URXIE1; /* Enable USART1 RX interrupt */ -} -/*---------------------------------------------------------------------------*/ -void -rs232_send(char c) -{ - - ENERGEST_ON(ENERGEST_TYPE_SERIAL); - /* Loop until the transmission buffer is available. */ - while((IFG2 & UTXIFG1) == 0) { - } - - /* Transmit the data. */ - TXBUF1 = c; - ENERGEST_OFF(ENERGEST_TYPE_SERIAL); -} -/*---------------------------------------------------------------------------*/ -void -rs232_set_speed(unsigned char speed) -{ - if(speed == RS232_19200) { - /* Set RS232 to 19200 */ - UBR01 = 0x80; /* 2,457MHz/19200 = 128 -> 0x80 */ - UBR11 = 0x00; /* */ - UMCTL1 = 0x00; /* no modulation */ - } else if(speed == RS232_38400) { - /* Set RS232 to 38400 */ - UBR01 = 0x40; /* 2,457MHz/38400 = 64 -> 0x40 */ - UBR11 = 0x00; /* */ - UMCTL1 = 0x00; /* no modulation */ - } else if(speed == RS232_57600) { - UBR01 = 0x2a; /* 2,457MHz/57600 = 42.7 -> 0x2A */ - UBR11 = 0x00; /* */ - UMCTL1 = 0x5b; /* */ - } else if(speed == RS232_115200) { - UBR01 = 0x15; /* 2,457MHz/115200 = 21.4 -> 0x15 */ - UBR11 = 0x00; /* */ - UMCTL1 = 0x4a; /* */ - } else { - rs232_set_speed(RS232_57600); - } - -} -/*---------------------------------------------------------------------------*/ -void -rs232_print(char *cptr) -{ - while(*cptr != 0) { - rs232_send(*cptr); - ++cptr; - } -} -/*---------------------------------------------------------------------------*/ -void -rs232_set_input(int (*f)(unsigned char)) -{ - input_handler = f; -} -/*---------------------------------------------------------------------------*/ -void -slip_arch_writeb(unsigned char c) -{ - rs232_send(c); -} -/*---------------------------------------------------------------------------*/ -/** @} */ diff --git a/platform/esb/dev/rs232.h b/platform/esb/dev/rs232.h deleted file mode 100644 index 6f7c0383a..000000000 --- a/platform/esb/dev/rs232.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ - -/** \addtogroup esb - * @{ */ - -/** - * \defgroup esbrs232 ESB RS232 - * - * @{ - */ - -/** - * \file - * Header file for MSP430 RS232 driver. - * \author Adam Dunkels - * - */ -#ifndef __RS232_H__ -#define __RS232_H__ - - -#define RS232_19200 1 -#define RS232_38400 2 -#define RS232_57600 3 -#define RS232_115200 4 - -/** - * \brief Initialize the RS232 module - * - * This function is called from the boot up code to - * initalize the RS232 module. - */ -void rs232_init(void); - -/** - * \brief Set an input handler for incoming RS232 data - * \param f A pointer to a byte input handler - * - * This function sets the input handler for incoming RS232 - * data. The input handler function is called for every - * incoming data byte. The function is called from the - * RS232 interrupt handler, so care must be taken when - * implementing the input handler to avoid race - * conditions. - * - * The return value of the input handler affects the sleep - * mode of the CPU: if the input handler returns non-zero - * (true), the CPU is awakened to let other processing - * take place. If the input handler returns zero, the CPU - * is kept sleeping. - */ -void rs232_set_input(int (* f)(unsigned char)); - -/** - * \brief Configure the speed of the RS232 hardware - * \param speed The speed - * - * This function configures the speed of the RS232 - * hardware. The allowed parameters are RS232_19200, - * RS232_38400, RS232_57600, and RS232_115200. - */ -void rs232_set_speed(unsigned char speed); - -/** - * \brief Print a text string on RS232 - * \param str A pointer to the string that is to be printed - * - * This function prints a string to RS232. The string must - * be terminated by a null byte. The RS232 module must be - * correctly initalized and configured for this function - * to work. - */ -void rs232_print(char *str); - -/** - * \brief Print a character on RS232 - * \param c The character to be printed - * - * This function prints a character to RS232. The RS232 - * module must be correctly initalized and configured for - * this function to work. - */ -void rs232_send(char c); - -#endif /* __RS232_H__ */ - -/** @} */ -/** @} */ diff --git a/platform/esb/dev/sound-sensor.c b/platform/esb/dev/sound-sensor.c deleted file mode 100644 index 6ac134754..000000000 --- a/platform/esb/dev/sound-sensor.c +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ -#include "contiki.h" -#include "dev/sound-sensor.h" -#include "dev/irq.h" -#include - -#define MIC_MIN_SENS 150 -#define SAMPLE 1 - -const struct sensors_sensor sound_sensor; - -static unsigned int sound, micdiff, micmax, avgmax; -static int8_t mode; -static int8_t sample_div; -static int8_t ctr; -static int16_t *sample_buffer; -static int buffer_size; -static int buf_pos; - -/*---------------------------------------------------------------------------*/ -static int -irq(void) -{ - micdiff = micdiff + abs(ADC12MEM4 - sound) - (micdiff >> 3); - sound = ADC12MEM4; - - if(mode == SAMPLE) { - ctr++; - if(ctr >= sample_div) { - ctr = 0; - sample_buffer[buf_pos++] = sound; - if(buf_pos >= buffer_size) { - mode = 0; - sensors_changed(&sound_sensor); - return 1; - } - } - } - -/* if(micdiff > MIC_MIN_SENS) { */ -/* sensors_changed(&sound_sensor); */ -/* } */ - -/* if(micdiff > (avgmax >> 2)) { */ -/* if(micdiff % 10 == 0) beep_beep(10); */ -/* // Subtract a little... */ -/* micdiff = micdiff - (micdiff >> 4); */ -/* } */ - -/* if(micmax < micdiff) { */ -/* micmax = micdiff; */ -/* } */ - -/* if(micdiff > 2000) { */ -/* leds_on(LEDS_GREEN); */ -/* } */ -/* if(micdiff > 3000) { */ -/* leds_on(LEDS_YELLOW); */ -/* } */ -/* if(micdiff > 4000) { */ -/* leds_on(LEDS_RED); */ -/* } */ - - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - /* try returning the max to see what values we get... */ -/* int mictmp = micmax; */ -/* avgmax = avgmax + micmax - (avgmax >> 3); */ -/* micmax = micdiff; */ -/* return mictmp; */ - return micdiff; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - switch(type) { - case SENSORS_HW_INIT: - /* Initialization of ADC12 done by irq */ - mode = 0; - buffer_size = 0; - return 1; - case SENSORS_ACTIVE: - if(value) { - if(!irq_adc12_active(4)) { - sound = micdiff = micmax = 0; - mode = 0; - ctr = 0; - sample_div = 0; - buf_pos = 0; - avgmax = 5000; - irq_adc12_activate(4, (INCH_0 + SREF_0), irq); - } - } else { - irq_adc12_deactivate(4); - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - return irq_adc12_active(4); - case SENSORS_READY: - return (mode != SAMPLE) && irq_adc12_active(4); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -void -sound_sensor_start_sample(void) -{ - if(buffer_size > 0) { - buf_pos = 0; - ctr = 0; - mode = SAMPLE; - } -} -/*---------------------------------------------------------------------------*/ -void -sound_sensor_set_buffer(int16_t *buffer, int buf_size, int divider) -{ - sample_buffer = buffer; - buffer_size = buf_size; - sample_div = divider; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(sound_sensor, SOUND_SENSOR, - value, configure, status); diff --git a/platform/esb/dev/sound-sensor.h b/platform/esb/dev/sound-sensor.h deleted file mode 100644 index 48d4e27cd..000000000 --- a/platform/esb/dev/sound-sensor.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ -#ifndef __SOUND_SENSOR_H__ -#define __SOUND_SENSOR_H__ - -#include "lib/sensors.h" - -extern const struct sensors_sensor sound_sensor; - -#define SOUND_SENSOR "Sound" - -void sound_sensor_start_sample(); -void sound_sensor_set_buffer(int16_t *buffer, int buf_size, int divider); - -#endif /* __SOUND_SENSOR_H__ */ diff --git a/platform/esb/dev/temperature-sensor.c b/platform/esb/dev/temperature-sensor.c deleted file mode 100644 index 9bb1ff532..000000000 --- a/platform/esb/dev/temperature-sensor.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2005-11-01 - * Updated : $Date: 2010/02/08 00:00:45 $ - * $Revision: 1.3 $ - */ - -#include "dev/temperature-sensor.h" -#include "dev/ds1629.h" - -const struct sensors_sensor temperature_sensor; -static int active; - -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - unsigned int temp; - signed int t; - - t = ds1629_temperature(); - temp = ((t / 128) * 50); - return temp; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - switch(type) { - case SENSORS_HW_INIT: - active = 0; - ds1629_init(); - return 1; - case SENSORS_ACTIVE: - if(value) { - if(!active) { - active = 1; - ds1629_start(); - } - } else { - active = 0; - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return active; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(temperature_sensor, TEMPERATURE_SENSOR, - value, configure, status); diff --git a/platform/esb/dev/temperature-sensor.h b/platform/esb/dev/temperature-sensor.h deleted file mode 100644 index 6aa37c42e..000000000 --- a/platform/esb/dev/temperature-sensor.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2005-11-01 - * Updated : $Date: 2006/06/18 07:49:33 $ - * $Revision: 1.1 $ - */ - -#ifndef __TEMPERATURE_SENSOR_H__ -#define __TEMPERATURE_SENSOR_H__ - -#include "lib/sensors.h" - -extern const struct sensors_sensor temperature_sensor; - -#define TEMPERATURE_SENSOR "Temperature" - -#endif /* __TEMPERATURE_SENSOR_H__ */ diff --git a/platform/esb/dev/tr1001-gcr.c b/platform/esb/dev/tr1001-gcr.c deleted file mode 100644 index d751babf2..000000000 --- a/platform/esb/dev/tr1001-gcr.c +++ /dev/null @@ -1,787 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ -/** - * \addtogroup esb - * @{ - */ - -/** - * \defgroup tr1001 TR1001 radio tranciever device driver - * @{ - */ - -/** - * \file - * Device driver and packet framing for the RFM-TR1001 radio module. - * \author Adam Dunkels - * - * This file implements a device driver for the RFM-TR1001 radio - * tranciever. - * - */ - -#include "contiki.h" -#include "contiki-esb.h" - -#include "dev/tr1001.h" -#include "dev/radio-sensor.h" -#include "lib/gcr.h" -#include "lib/crc16.h" -#include "net/netstack.h" -#include "net/rime/rimestats.h" -#include "isr_compat.h" - -#include - -#ifdef TR1001_CONF_BEEP_ON_BAD_CRC -#define BEEP_ON_BAD_CRC TR1001_CONF_BEEP_ON_BAD_CRC -#else -#define BEEP_ON_BAD_CRC 1 -#endif /* TR1001_CONF_BEEP_ON_BAD_CRC */ - -#if BEEP_ON_BAD_CRC -#include "dev/beep.h" -#define BEEP_BEEP(t) beep_beep(t) -#else -#define BEEP_BEEP(t) -#endif /* BEEP_ON_BAD_CRC */ - -#define RXSTATE_READY 0 -#define RXSTATE_RECEIVING 1 -#define RXSTATE_FULL 2 - -#define SYNCH1 0x3c -#define SYNCH2 0x03 - -#ifdef TR1001_CONF_BUFFER_SIZE -#define RXBUFSIZE TR1001_CONF_BUFFER_SIZE -#else -#define RXBUFSIZE PACKETBUF_SIZE -#endif /* TR1001_CONF_BUFFER_SIZE */ - -/* - * Pending data to send when using prepare/transmit functions. - */ -static const void *pending_data; - -/* - * The buffer which holds incoming data. - */ -unsigned char tr1001_rxbuf[RXBUFSIZE]; - -/* - * The length of the packet that currently is being received. - */ -static unsigned short tr1001_rxlen = 0; - -/* - * The reception state. - */ -volatile unsigned char tr1001_rxstate = RXSTATE_READY; - -static uint16_t rxcrc, rxcrctmp; - -/* - * The structure of the packet header. - */ -struct tr1001_hdr { - uint8_t len[2]; /**< The 16-bit length of the packet in network byte - order. */ -}; - -/* - * The length of the packet header. - */ -#define TR1001_HDRLEN sizeof(struct tr1001_hdr) - -#define OFF 0 -#define ON 1 -static uint8_t onoroff = OFF; - -#define NUM_SYNCHBYTES 4 - -void tr1001_default_rxhandler(unsigned char c); -PT_THREAD(tr1001_default_rxhandler_pt(unsigned char c)); -static struct pt rxhandler_pt; - -/* - * This timer is used to keep track of when the last byte was received - * over the radio. If the inter-byte time is too large, the packet - * currently being received is discarded and a new packet reception is - * initiated. - */ -static struct timer rxtimer; - -static unsigned short tmp_sstrength, sstrength; -static unsigned short tmp_count; - -#define DEBUG 0 -#if DEBUG -#include -#define LOG(...) printf(__VA_ARGS__) -#else -#define LOG(...) -#endif - -#define GCRLOG(...) /* printf(__VA_ARGS__)*/ - -/*---------------------------------------------------------------------------*/ -PROCESS(tr1001_process, "TR1001 driver"); -/*---------------------------------------------------------------------------*/ - -static int prepare_packet(const void *data, unsigned short len); -static int transmit_packet(unsigned short len); -static int receiving_packet(void); -static int pending_packet(void); -static int channel_clear(void); -static int tr1001_on(void); -static int tr1001_off(void); - -const struct radio_driver tr1001_driver = { - tr1001_init, - prepare_packet, - transmit_packet, - tr1001_send, - tr1001_read, - channel_clear, - receiving_packet, - pending_packet, - tr1001_on, - tr1001_off -}; - -/*---------------------------------------------------------------------------*/ -/* - * Turn on data transmission in On-Off-Keyed mode. - */ -static void -txook(void) -{ - P3SEL = 0xf0; - P5OUT |= 0x40; - P5OUT &= 0x7f; -} -/*---------------------------------------------------------------------------*/ -/* - * Turn on data reception for the radio tranceiver. - */ -static void -rxon(void) -{ - P3SEL = 0xe0; - P5OUT |= 0xc0; - - /* Enable the receiver. */ - ME1 |= URXE0; - - /* Turn on receive interrupt. */ - IE1 |= URXIE0; - -} -/*---------------------------------------------------------------------------*/ -/* - * Turn off data reception for the radio tranceiver. - */ -static void -rxoff(void) -{ - P5OUT &= 0x3f; - - /* Disable the receiver. */ - ME1 &= ~URXE0; - - /* Turn off receive interrupt. */ - IE1 &= ~URXIE0; -} -/*---------------------------------------------------------------------------*/ -/* - * Clear the recevie buffer and reset the receiver state. - */ -static void -rxclear(void) -{ - tr1001_rxstate = RXSTATE_READY; -} -/*---------------------------------------------------------------------------*/ -/* - * Turn TR1001 radio transceiver off. - */ -/*---------------------------------------------------------------------------*/ -static int -tr1001_off(void) -{ - if(onoroff == OFF) { - return 1; - } - onoroff = OFF; - rxoff(); - rxclear(); - - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - return 1; -} -/*---------------------------------------------------------------------------*/ -/* - * Turn TR1001 radio transceiver on. - */ -/*---------------------------------------------------------------------------*/ -static int -tr1001_on(void) -{ - if(onoroff == ON) { - return 1; - } - - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - - onoroff = ON; - rxon(); - rxclear(); - return 1; -} -/*---------------------------------------------------------------------------*/ -/* - * Send a byte of data over the radio. - * - * \param b The byte to be sent. - */ -static void -send(unsigned char b) -{ - clock_time_t start; - - start = clock_time(); - - /* Wait until the USART0 TX buffer is ready. */ - while((IFG1 & UTXIFG0) == 0) { - /* Wait no more than one second. */ - if((clock_time_t)(clock_time() - start) > (clock_time_t)CLOCK_SECOND) { - break; - } - } - - /* Send the byte. */ - TXBUF0 = b; -} -/*---------------------------------------------------------------------------*/ -/* - * Send a byte of data and its logical negation (all bits inverted) - * over the radio. - * - * \param b The byte to be sent. - */ -static void -sendx(unsigned char b) -{ - gcr_encode(b); - GCRLOG("(%02x)", b); - - while(gcr_get_encoded(&b)) { - send(b); - GCRLOG("%02x ", b); - } -} - -static uint16_t -sendx_crc16(unsigned char b, uint16_t crcacc) -{ - gcr_encode(b); - GCRLOG("(%02x)", b); - crcacc = crc16_add(b, crcacc); - while(gcr_get_encoded(&b)) { - send(b); - GCRLOG("C%02x ", b); - } - return crcacc; -} -/*---------------------------------------------------------------------------*/ -void -tr1001_set_txpower(unsigned char p) -{ - int i; - - /* Clamp maximum power. */ - if(p > 100) { - p = 100; - } - - /* First, run the potentiometer down to zero so that we know the - start value of the potentiometer. */ - P2OUT &= 0xDF; /* P25 = 0 (down selected) */ - P2OUT &= 0xBF; /* P26 = 0 (chipselect on) */ - for(i = 0; i < 102; ++i) { - P2OUT &= 0xEF; /* P24 = 0 (inc) */ - P2OUT |= 0x10; - } - - /* Now, start to increase the value of the potentiometer until it - reaches the desired value.*/ - - P2OUT |= 0x20; /* P25 = 1 (up selected) */ - for(i = 0; i < p; ++i) { - P2OUT &= 0xEF; /* P24 = 0 (inc) */ - P2OUT |= 0x10; - } - P2OUT |= 0x40; /* P26 = 1 (chipselect off) */ -} -/*---------------------------------------------------------------------------*/ -int -tr1001_init(void) -{ - PT_INIT(&rxhandler_pt); - - onoroff = OFF; - - UCTL0 = CHAR; /* 8-bit character */ - UTCTL0 = SSEL1; /* UCLK = SMCLK */ - - tr1001_set_speed(TR1001_19200); - - ME1 |= UTXE0 + URXE0; /* Enable USART0 TXD/RXD */ - - /* Turn on receive interrupt. */ - IE1 |= URXIE0; - - timer_set(&rxtimer, CLOCK_SECOND / 4); - - - tr1001_on(); - tr1001_set_txpower(100); - - /* Reset reception state. */ - rxclear(); - - process_start(&tr1001_process, NULL); - - return 1; -} -/*---------------------------------------------------------------------------*/ -ISR(UART0RX, tr1001_rxhandler) -{ - ENERGEST_ON(ENERGEST_TYPE_IRQ); - tr1001_default_rxhandler_pt(RXBUF0); - if(tr1001_rxstate == RXSTATE_FULL) { - LPM4_EXIT; - } - ENERGEST_OFF(ENERGEST_TYPE_IRQ); -} -/*---------------------------------------------------------------------------*/ -#if DEBUG -static void -dump_packet(int len) -{ - int i; - for(i = 0; i < len; ++i) { - LOG("%d: 0x%02x\n", i, tr1001_rxbuf[i]); - } -} -#endif /* DEBUG */ -/*---------------------------------------------------------------------------*/ -PT_THREAD(tr1001_default_rxhandler_pt(unsigned char incoming_byte)) -{ - static unsigned char rxtmp, tmppos; - - if(timer_expired(&rxtimer) && tr1001_rxstate != RXSTATE_FULL) { - PT_INIT(&rxhandler_pt); - } - - timer_restart(&rxtimer); - - if(tr1001_rxstate == RXSTATE_RECEIVING) { - unsigned short signal = radio_sensor.value(0); - tmp_sstrength += (signal >> 2); - tmp_count++; - } - - PT_BEGIN(&rxhandler_pt); - - while(1) { - - /* Reset reception state. */ - rxclear(); - - /* Wait until we receive the first syncronization byte. */ - PT_WAIT_UNTIL(&rxhandler_pt, incoming_byte == SYNCH1); - - tr1001_rxstate = RXSTATE_RECEIVING; - - /* Read all incoming syncronization bytes. */ - PT_WAIT_WHILE(&rxhandler_pt, incoming_byte == SYNCH1); - - /* We should receive the second synch byte by now, otherwise we'll - restart the protothread. */ - if(incoming_byte != SYNCH2) { - PT_RESTART(&rxhandler_pt); - } - - /* Start signal strength measurement */ - tmp_sstrength = 0; - tmp_count = 0; - - /* Reset the CRC. */ - rxcrc = 0xffff; - - gcr_init(); - GCRLOG("RECV: "); - - /* Read packet header. */ - for(tmppos = 0; tmppos < TR1001_HDRLEN; ++tmppos) { - - /* Wait for the first byte of the packet to arrive. */ - do { - PT_YIELD(&rxhandler_pt); - GCRLOG("(%02x) ", incoming_byte); - - gcr_decode(incoming_byte); - /* If the incoming byte isn't a valid GCR encoded byte, - we start again from the beginning. */ - if(!gcr_valid()) { - BEEP_BEEP(1000); - LOG("Incorrect GCR in header at byte %d/1 %x\n", tmppos, incoming_byte); - RIMESTATS_ADD(badsynch); - PT_RESTART(&rxhandler_pt); - } - } while(!gcr_get_decoded(&rxtmp)); - GCRLOG("%02x ", rxtmp); - - tr1001_rxbuf[tmppos] = rxtmp; - /* Calculate the CRC. */ - rxcrc = crc16_add(rxtmp, rxcrc); - } - - /* Since we've got the header, we can grab the length from it. */ - tr1001_rxlen = ((((struct tr1001_hdr *)tr1001_rxbuf)->len[0] << 8) + - ((struct tr1001_hdr *)tr1001_rxbuf)->len[1]); - - /* If the length is longer than we can handle, we'll start from - the beginning. */ - if(tmppos + tr1001_rxlen > sizeof(tr1001_rxbuf)) { - RIMESTATS_ADD(toolong); - PT_RESTART(&rxhandler_pt); - } - - /* Read packet data. */ - for(; tmppos < tr1001_rxlen + TR1001_HDRLEN; ++tmppos) { - - /* Wait for the first byte of the packet to arrive. */ - do { - PT_YIELD(&rxhandler_pt); - GCRLOG("(%02x)", incoming_byte); - - gcr_decode(incoming_byte); - /* If the incoming byte isn't a valid Manchester encoded byte, - we start again from the beinning. */ - if(!gcr_valid()) { - BEEP_BEEP(1000); - LOG("Incorrect GCR 0x%02x at byte %d/1\n", incoming_byte, - tmppos - TR1001_HDRLEN); - RIMESTATS_ADD(badsynch); - PT_RESTART(&rxhandler_pt); - } - } while(!gcr_get_decoded(&rxtmp)); - - GCRLOG("%02x ", rxtmp); - - tr1001_rxbuf[tmppos] = rxtmp; - /* Calculate the CRC. */ - rxcrc = crc16_add(rxtmp, rxcrc); - } - - /* Read the frame CRC. */ - for(tmppos = 0; tmppos < 2; ++tmppos) { - do { - PT_YIELD(&rxhandler_pt); - GCRLOG("(%02x)", incoming_byte); - - gcr_decode(incoming_byte); - if(!gcr_valid()) { - BEEP_BEEP(1000); - RIMESTATS_ADD(badsynch); - PT_RESTART(&rxhandler_pt); - } - } while(!gcr_get_decoded(&rxtmp)); - GCRLOG("%02x ", rxtmp); - - rxcrctmp = (rxcrctmp << 8) | rxtmp; - } - GCRLOG("\n"); - - if(rxcrctmp == rxcrc) { - /* A full packet has been received and the CRC checks out. We'll - request the driver to take care of the incoming data. */ - - RIMESTATS_ADD(llrx); - process_poll(&tr1001_process); - - /* We'll set the receive state flag to signal that a full frame - is present in the buffer, and we'll wait until the buffer has - been taken care of. */ - tr1001_rxstate = RXSTATE_FULL; - PT_WAIT_UNTIL(&rxhandler_pt, tr1001_rxstate != RXSTATE_FULL); - - } else { - LOG("Incorrect CRC\n"); - BEEP_BEEP(1000); - RIMESTATS_ADD(badcrc); - } - } - PT_END(&rxhandler_pt); -} -/*---------------------------------------------------------------------------*/ -static int -prepare_packet(const void *data, unsigned short len) -{ - pending_data = data; - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -transmit_packet(unsigned short len) -{ - int ret = RADIO_TX_ERR; - if(pending_data != NULL) { - ret = tr1001_send(pending_data, len); - pending_data = NULL; - } - return ret; -} -/*---------------------------------------------------------------------------*/ -int -tr1001_send(const void *packet, unsigned short len) -{ - int i; - uint16_t crc16; - - LOG("tr1001_send: sending %d bytes\n", len); - - if(onoroff == ON) { - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - } - ENERGEST_ON(ENERGEST_TYPE_TRANSMIT); - - /* Prepare the transmission. */ - - /* Delay the transmission for a short random duration. */ - clock_delay(random_rand() & 0x3ff); - - - /* Check that we don't currently are receiving a packet, and if so - we wait until the reception has been completed. Reception is done - with interrupts so it is OK for us to wait in a while() loop. */ - - while(tr1001_rxstate == RXSTATE_RECEIVING && - !timer_expired(&rxtimer)) { - /* Delay the transmission for a short random duration. */ - clock_delay(random_rand() & 0x7ff); - } - - - /* Turn on OOK mode with transmission. */ - txook(); - - /* According to the datasheet, the transmitter must wait for 12 us - in order to settle. Empirical tests show that is it better to - wait for something like 283 us... */ - clock_delay(200); - - - /* Transmit preamble and synch bytes. */ - for(i = 0; i < 20; ++i) { - send(0xaa); - } - /* send(0xaa); - send(0xaa);*/ - send(0xff); - - for(i = 0; i < NUM_SYNCHBYTES; ++i) { - send(SYNCH1); - } - send(SYNCH2); - - crc16 = 0xffff; - - gcr_init(); - - GCRLOG("SEND: "); - - /* Send packet header. */ - crc16 = sendx_crc16(len >> 8, crc16); - crc16 = sendx_crc16(len & 0xff, crc16); - - /* Send packet data. */ - for(i = 0; i < len; ++i) { - crc16 = sendx_crc16(((uint8_t *)packet)[i], crc16); - } - - /* Send CRC */ - sendx(crc16 >> 8); - sendx(crc16 & 0xff); - - /* if not encoding has sent all bytes - let it send another GCR specific */ - if (!gcr_finished()) { - sendx(0); - } - - GCRLOG("\n"); - - /* Send trailing bytes. */ - send(0x33); - send(0xcc); - send(0x33); - send(0xcc); - - /* Turn on (or off) reception again. */ - if(onoroff == ON) { - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - rxon(); - rxclear(); - } else { - rxoff(); - rxclear(); - } - - ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT); - RIMESTATS_ADD(lltx); - - return RADIO_TX_OK; -} -/*---------------------------------------------------------------------------*/ -int -tr1001_read(void *buf, unsigned short bufsize) -{ - unsigned short tmplen; - - if(tr1001_rxstate == RXSTATE_FULL) { - -#if DEBUG - dump_packet(tr1001_rxlen + 2); -#endif /* DEBUG */ - - tmplen = tr1001_rxlen; - - if(tmplen > bufsize) { - LOG("tr1001_read: too large packet: %d/%d bytes\n", tmplen, bufsize); - rxclear(); - RIMESTATS_ADD(toolong); - return -1; - } - - memcpy(buf, &tr1001_rxbuf[TR1001_HDRLEN], tmplen); - - /* header + content + CRC */ - sstrength = (tmp_count ? ((tmp_sstrength / tmp_count) << 2) : 0); - - rxclear(); - - LOG("tr1001_read: got %d bytes\n", tmplen); - - return tmplen; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -receiving_packet(void) -{ - return tr1001_rxstate == RXSTATE_RECEIVING && - !timer_expired(&rxtimer); -} -/*---------------------------------------------------------------------------*/ -static int -pending_packet(void) -{ - return tr1001_rxstate == RXSTATE_FULL; -} -/*---------------------------------------------------------------------------*/ -static int -channel_clear(void) -{ - /* TODO add CCA functionality */ - return 0; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(tr1001_process, ev, data) -{ - int len; - PROCESS_BEGIN(); - - /* Reset reception state now that the process is ready to receive data. */ - rxclear(); - - while(1) { - PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL); - packetbuf_clear(); - len = tr1001_read(packetbuf_dataptr(), PACKETBUF_SIZE); - if(len > 0) { - packetbuf_set_datalen(len); - NETSTACK_RDC.input(); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -tr1001_set_speed(unsigned char speed) -{ - - if(speed == TR1001_19200) { - /* Set TR1001 to 19200 */ - UBR00 = 0x80; /* 2,457MHz/19200 = 128 -> 0x80 */ - UBR10 = 0x00; /* */ - UMCTL0 = 0x00; /* no modulation */ - } else if(speed == TR1001_38400) { - /* Set TR1001 to 38400 */ - UBR00 = 0x40; /* 2,457MHz/38400 = 64 -> 0x40 */ - UBR10 = 0x00; /* */ - UMCTL0 = 0x00; /* no modulation */ - } else if(speed == TR1001_57600) { - UBR00 = 0x2a; /* 2,457MHz/57600 = 42.7 -> 0x2A */ - UBR10 = 0x00; /* */ - UMCTL0 = 0x5b; /* */ - } else if(speed == TR1001_115200) { - UBR00 = 0x15; /* 2,457MHz/115200 = 21.4 -> 0x15 */ - UBR10 = 0x00; /* */ - UMCTL0 = 0x4a; /* */ - } else { - tr1001_set_speed(TR1001_19200); - } -} -/*---------------------------------------------------------------------------*/ -unsigned short -tr1001_sstrength(void) -{ - return sstrength; -} -/*---------------------------------------------------------------------------*/ -/** @} */ -/** @} */ diff --git a/platform/esb/dev/tr1001.c b/platform/esb/dev/tr1001.c deleted file mode 100644 index 5bee9515f..000000000 --- a/platform/esb/dev/tr1001.c +++ /dev/null @@ -1,773 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ -/** - * \addtogroup esb - * @{ - */ - -/** - * \defgroup tr1001 TR1001 radio tranciever device driver - * @{ - */ - -/** - * \file - * Device driver and packet framing for the RFM-TR1001 radio module. - * \author Adam Dunkels - * - * This file implements a device driver for the RFM-TR1001 radio - * tranciever. - * - */ - -#include "contiki.h" -#include "contiki-esb.h" - -#include "dev/tr1001.h" -#include "dev/radio-sensor.h" -#include "lib/me.h" -#include "lib/crc16.h" -#include "net/netstack.h" -#include "net/rime/rimestats.h" -#include "isr_compat.h" - -#include - -#ifdef TR1001_CONF_BEEP_ON_BAD_CRC -#define BEEP_ON_BAD_CRC TR1001_CONF_BEEP_ON_BAD_CRC -#else -#define BEEP_ON_BAD_CRC 1 -#endif /* TR1001_CONF_BEEP_ON_BAD_CRC */ - -#if BEEP_ON_BAD_CRC -#include "dev/beep.h" -#define BEEP_BEEP(t) beep_beep(t) -#else -#define BEEP_BEEP(t) -#endif /* BEEP_ON_BAD_CRC */ - -#define RXSTATE_READY 0 -#define RXSTATE_RECEIVING 1 -#define RXSTATE_FULL 2 - -#define SYNCH1 0x3c -#define SYNCH2 0x03 - -#ifdef TR1001_CONF_BUFFER_SIZE -#define RXBUFSIZE TR1001_CONF_BUFFER_SIZE -#else -#define RXBUFSIZE PACKETBUF_SIZE -#endif /* TR1001_CONF_BUFFER_SIZE */ - -/* - * Pending data to send when using prepare/transmit functions. - */ -static const void *pending_data; - -/* - * The buffer which holds incoming data. - */ -unsigned char tr1001_rxbuf[RXBUFSIZE]; - -/* - * The length of the packet that currently is being received. - */ -static unsigned short tr1001_rxlen = 0; - -/* - * The reception state. - */ -volatile unsigned char tr1001_rxstate = RXSTATE_READY; - -static uint16_t rxcrc, rxcrctmp; - -/* - * The structure of the packet header. - */ -struct tr1001_hdr { - uint8_t len[2]; /**< The 16-bit length of the packet in network byte - order. */ -}; - -/* - * The length of the packet header. - */ -#define TR1001_HDRLEN sizeof(struct tr1001_hdr) - -#define OFF 0 -#define ON 1 -static uint8_t onoroff = OFF; - -#define NUM_SYNCHBYTES 4 - -void tr1001_default_rxhandler(unsigned char c); -PT_THREAD(tr1001_default_rxhandler_pt(unsigned char c)); -static struct pt rxhandler_pt; - -/* - * This timer is used to keep track of when the last byte was received - * over the radio. If the inter-byte time is too large, the packet - * currently being received is discarded and a new packet reception is - * initiated. - */ -static struct timer rxtimer; - -static unsigned short tmp_sstrength, sstrength; -static unsigned short tmp_count; - -#define DEBUG 0 -#if DEBUG -#include -#define LOG(...) printf(__VA_ARGS__) -#else -#define LOG(...) -#endif - -/*---------------------------------------------------------------------------*/ -PROCESS(tr1001_process, "TR1001 driver"); -/*---------------------------------------------------------------------------*/ - -static int prepare_packet(const void *data, unsigned short len); -static int transmit_packet(unsigned short len); -static int receiving_packet(void); -static int pending_packet(void); -static int channel_clear(void); -static int tr1001_on(void); -static int tr1001_off(void); - -const struct radio_driver tr1001_driver = { - tr1001_init, - prepare_packet, - transmit_packet, - tr1001_send, - tr1001_read, - channel_clear, - receiving_packet, - pending_packet, - tr1001_on, - tr1001_off -}; - -/*---------------------------------------------------------------------------*/ -/* - * Turn on data transmission in On-Off-Keyed mode. - */ -static void -txook(void) -{ - P3SEL = 0xf0; - P5OUT |= 0x40; - P5OUT &= 0x7f; -} -/*---------------------------------------------------------------------------*/ -/* - * Turn on data reception for the radio tranceiver. - */ -static void -rxon(void) -{ - P3SEL = 0xe0; - P5OUT |= 0xc0; - - /* Enable the receiver. */ - ME1 |= URXE0; - - /* Turn on receive interrupt. */ - IE1 |= URXIE0; - -} -/*---------------------------------------------------------------------------*/ -/* - * Turn off data reception for the radio tranceiver. - */ -static void -rxoff(void) -{ - P5OUT &= 0x3f; - - /* Disable the receiver. */ - ME1 &= ~URXE0; - - /* Turn off receive interrupt. */ - IE1 &= ~URXIE0; -} -/*---------------------------------------------------------------------------*/ -/* - * Clear the recevie buffer and reset the receiver state. - */ -static void -rxclear(void) -{ - tr1001_rxstate = RXSTATE_READY; -} -/*---------------------------------------------------------------------------*/ -/* - * Turn TR1001 radio transceiver off. - */ -/*---------------------------------------------------------------------------*/ -static int -tr1001_off(void) -{ - if(onoroff == OFF) { - return 1; - } - onoroff = OFF; - rxoff(); - rxclear(); - - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - return 1; -} -/*---------------------------------------------------------------------------*/ -/* - * Turn TR1001 radio transceiver on. - */ -/*---------------------------------------------------------------------------*/ -static int -tr1001_on(void) -{ - if(onoroff == ON) { - return 1; - } - - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - - onoroff = ON; - rxon(); - rxclear(); - return 1; -} -/*---------------------------------------------------------------------------*/ -/* - * Send a byte of data over the radio. - * - * \param b The byte to be sent. - */ -static void -send(unsigned char b) -{ - clock_time_t start; - - start = clock_time(); - - /* Wait until the USART0 TX buffer is ready. */ - while((IFG1 & UTXIFG0) == 0) { - /* Wait no more than one second. */ - if((clock_time_t)(clock_time() - start) > (clock_time_t)CLOCK_SECOND) { - break; - } - } - - /* Send the byte. */ - TXBUF0 = b; -} -/*---------------------------------------------------------------------------*/ -/* - * Send a byte of data and its logical negation (all bits inverted) - * over the radio. - * - * \param b The byte to be sent. - */ -static void -send2(unsigned char b) -{ - uint16_t m; - m = me_encode(b); - send(m >> 8); - send(m & 0xff); -} -static uint16_t -send2_crc16(unsigned char b, uint16_t crcacc) -{ - uint16_t m; - m = me_encode(b); - send(m >> 8); - send(m & 0xff); - return crc16_add(b, crcacc); -} -/*---------------------------------------------------------------------------*/ -void -tr1001_set_txpower(unsigned char p) -{ - int i; - - /* Clamp maximum power. */ - if(p > 100) { - p = 100; - } - - /* First, run the potentiometer down to zero so that we know the - start value of the potentiometer. */ - P2OUT &= 0xDF; /* P25 = 0 (down selected) */ - P2OUT &= 0xBF; /* P26 = 0 (chipselect on) */ - for(i = 0; i < 102; ++i) { - P2OUT &= 0xEF; /* P24 = 0 (inc) */ - P2OUT |= 0x10; - } - - /* Now, start to increase the value of the potentiometer until it - reaches the desired value.*/ - - P2OUT |= 0x20; /* P25 = 1 (up selected) */ - for(i = 0; i < p; ++i) { - P2OUT &= 0xEF; /* P24 = 0 (inc) */ - P2OUT |= 0x10; - } - P2OUT |= 0x40; /* P26 = 1 (chipselect off) */ -} -/*---------------------------------------------------------------------------*/ -int -tr1001_init(void) -{ - PT_INIT(&rxhandler_pt); - - onoroff = OFF; - - UCTL0 = CHAR; /* 8-bit character */ - UTCTL0 = SSEL1; /* UCLK = SMCLK */ - - tr1001_set_speed(TR1001_19200); - - ME1 |= UTXE0 + URXE0; /* Enable USART0 TXD/RXD */ - - /* Turn on receive interrupt. */ - IE1 |= URXIE0; - - timer_set(&rxtimer, CLOCK_SECOND / 4); - - - tr1001_on(); - tr1001_set_txpower(100); - - /* Reset reception state. */ - rxclear(); - - process_start(&tr1001_process, NULL); - - return 1; -} -/*---------------------------------------------------------------------------*/ -ISR(UART0RX, tr1001_rxhandler) -{ - ENERGEST_ON(ENERGEST_TYPE_IRQ); - tr1001_default_rxhandler_pt(RXBUF0); - if(tr1001_rxstate == RXSTATE_FULL) { - LPM4_EXIT; - } - ENERGEST_OFF(ENERGEST_TYPE_IRQ); -} -/*---------------------------------------------------------------------------*/ -#if DEBUG -static void -dump_packet(int len) -{ - int i; - for(i = 0; i < len; ++i) { - LOG("%d: 0x%02x\n", i, tr1001_rxbuf[i]); - } -} -#endif /* DEBUG */ -/*---------------------------------------------------------------------------*/ -PT_THREAD(tr1001_default_rxhandler_pt(unsigned char incoming_byte)) -{ - static unsigned char rxtmp, tmppos; - - if(timer_expired(&rxtimer) && tr1001_rxstate != RXSTATE_FULL) { - PT_INIT(&rxhandler_pt); - } - - timer_restart(&rxtimer); - - if(tr1001_rxstate == RXSTATE_RECEIVING) { - unsigned short signal = radio_sensor.value(0); - tmp_sstrength += (signal >> 2); - tmp_count++; - } - - PT_BEGIN(&rxhandler_pt); - - while(1) { - - /* Reset reception state. */ - rxclear(); - - /* Wait until we receive the first syncronization byte. */ - PT_WAIT_UNTIL(&rxhandler_pt, incoming_byte == SYNCH1); - - tr1001_rxstate = RXSTATE_RECEIVING; - - /* Read all incoming syncronization bytes. */ - PT_WAIT_WHILE(&rxhandler_pt, incoming_byte == SYNCH1); - - /* We should receive the second synch byte by now, otherwise we'll - restart the protothread. */ - if(incoming_byte != SYNCH2) { - PT_RESTART(&rxhandler_pt); - } - - /* Start signal strength measurement */ - tmp_sstrength = 0; - tmp_count = 0; - - /* Reset the CRC. */ - rxcrc = 0xffff; - - /* Read packet header. */ - for(tmppos = 0; tmppos < TR1001_HDRLEN; ++tmppos) { - - /* Wait for the first byte of the packet to arrive. */ - PT_YIELD(&rxhandler_pt); - - /* If the incoming byte isn't a valid Manchester encoded byte, - we start again from the beginning. */ - if(!me_valid(incoming_byte)) { - BEEP_BEEP(1000); - LOG("Incorrect manchester in header at byte %d/1\n", tmppos); - RIMESTATS_ADD(badsynch); - PT_RESTART(&rxhandler_pt); - } - - rxtmp = me_decode8(incoming_byte); - - /* Wait for the next byte to arrive. */ - PT_YIELD(&rxhandler_pt); - - if(!me_valid(incoming_byte)) { - BEEP_BEEP(1000); - LOG("Incorrect manchester in header at byte %d/2\n", tmppos); - RIMESTATS_ADD(badsynch); - PT_RESTART(&rxhandler_pt); - } - - /* Put together the two bytes into a single Manchester decoded - byte. */ - - tr1001_rxbuf[tmppos] = (rxtmp << 4) | me_decode8(incoming_byte); - - /* Calculate the CRC. */ - rxcrc = crc16_add(tr1001_rxbuf[tmppos], rxcrc); - - - } - - /* Since we've got the header, we can grab the length from it. */ - tr1001_rxlen = ((((struct tr1001_hdr *)tr1001_rxbuf)->len[0] << 8) + - ((struct tr1001_hdr *)tr1001_rxbuf)->len[1]); - - /* If the length is longer than we can handle, we'll start from - the beginning. */ - if(tmppos + tr1001_rxlen > sizeof(tr1001_rxbuf)) { - RIMESTATS_ADD(toolong); - PT_RESTART(&rxhandler_pt); - } - - /* Read packet data. */ - for(; tmppos < tr1001_rxlen + TR1001_HDRLEN; ++tmppos) { - PT_YIELD(&rxhandler_pt); - - if(!me_valid(incoming_byte)) { - LOG("Incorrect manchester 0x%02x at byte %d/1\n", incoming_byte, - tmppos - TR1001_HDRLEN); - BEEP_BEEP(1000); - RIMESTATS_ADD(badsynch); - PT_RESTART(&rxhandler_pt); - } - - rxtmp = me_decode8(incoming_byte); - - PT_YIELD(&rxhandler_pt); - - if(!me_valid(incoming_byte)) { - LOG("Incorrect manchester at byte %d/2\n", tmppos - TR1001_HDRLEN); - BEEP_BEEP(1000); - RIMESTATS_ADD(badsynch); - PT_RESTART(&rxhandler_pt); - } - - tr1001_rxbuf[tmppos] = (rxtmp << 4) | me_decode8(incoming_byte); - rxcrc = crc16_add(tr1001_rxbuf[tmppos], rxcrc); - - } - - /* Read the frame CRC. */ - for(tmppos = 0; tmppos < 4; ++tmppos) { - - PT_YIELD(&rxhandler_pt); - - if(!me_valid(incoming_byte)) { - BEEP_BEEP(1000); - RIMESTATS_ADD(badsynch); - PT_RESTART(&rxhandler_pt); - } - - rxcrctmp = (rxcrctmp << 4) | me_decode8(incoming_byte); - } - - if(rxcrctmp == rxcrc) { - /* A full packet has been received and the CRC checks out. We'll - request the driver to take care of the incoming data. */ - - RIMESTATS_ADD(llrx); - process_poll(&tr1001_process); - - /* We'll set the receive state flag to signal that a full frame - is present in the buffer, and we'll wait until the buffer has - been taken care of. */ - tr1001_rxstate = RXSTATE_FULL; - PT_WAIT_UNTIL(&rxhandler_pt, tr1001_rxstate != RXSTATE_FULL); - - } else { - LOG("Incorrect CRC\n"); - BEEP_BEEP(1000); - RIMESTATS_ADD(badcrc); - } - } - PT_END(&rxhandler_pt); -} -/*---------------------------------------------------------------------------*/ -static int -prepare_packet(const void *data, unsigned short len) -{ - pending_data = data; - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -transmit_packet(unsigned short len) -{ - int ret = RADIO_TX_ERR; - if(pending_data != NULL) { - ret = tr1001_send(pending_data, len); - pending_data = NULL; - } - return ret; -} -/*---------------------------------------------------------------------------*/ -int -tr1001_send(const void *packet, unsigned short len) -{ - int i; - uint16_t crc16; - - LOG("tr1001_send: sending %d bytes\n", len); - - if(onoroff == ON) { - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - } - ENERGEST_ON(ENERGEST_TYPE_TRANSMIT); - - /* Prepare the transmission. */ - - /* Delay the transmission for a short random duration. */ - clock_delay(random_rand() & 0x3ff); - - - /* Check that we don't currently are receiving a packet, and if so - we wait until the reception has been completed. Reception is done - with interrupts so it is OK for us to wait in a while() loop. */ - - while(tr1001_rxstate == RXSTATE_RECEIVING && - !timer_expired(&rxtimer)) { - /* Delay the transmission for a short random duration. */ - clock_delay(random_rand() & 0x7ff); - } - - - /* Turn on OOK mode with transmission. */ - txook(); - - /* According to the datasheet, the transmitter must wait for 12 us - in order to settle. Empirical tests show that is it better to - wait for something like 283 us... */ - clock_delay(200); - - - /* Transmit preamble and synch bytes. */ - for(i = 0; i < 20; ++i) { - send(0xaa); - } - /* send(0xaa); - send(0xaa);*/ - send(0xff); - - for(i = 0; i < NUM_SYNCHBYTES; ++i) { - send(SYNCH1); - } - send(SYNCH2); - - crc16 = 0xffff; - - /* Send packet header. */ - crc16 = send2_crc16(len >> 8, crc16); - crc16 = send2_crc16(len & 0xff, crc16); - - /* Send packet data. */ - for(i = 0; i < len; ++i) { - crc16 = send2_crc16(((uint8_t *)packet)[i], crc16); - } - - /* Send CRC */ - send2(crc16 >> 8); - send2(crc16 & 0xff); - - /* Send trailing bytes. */ - send(0x33); - send(0xcc); - send(0x33); - send(0xcc); - - /* Turn on (or off) reception again. */ - if(onoroff == ON) { - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - rxon(); - rxclear(); - } else { - rxoff(); - rxclear(); - } - - ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT); - RIMESTATS_ADD(lltx); - - return RADIO_TX_OK; -} -/*---------------------------------------------------------------------------*/ -int -tr1001_read(void *buf, unsigned short bufsize) -{ - unsigned short tmplen; - - if(tr1001_rxstate == RXSTATE_FULL) { - -#if DEBUG - dump_packet(tr1001_rxlen + 2); -#endif /* DEBUG */ - - tmplen = tr1001_rxlen; - - if(tmplen > bufsize) { - LOG("tr1001_read: too large packet: %d/%d bytes\n", tmplen, bufsize); - rxclear(); - RIMESTATS_ADD(toolong); - return -1; - } - - memcpy(buf, &tr1001_rxbuf[TR1001_HDRLEN], tmplen); - - /* header + content + CRC */ - sstrength = (tmp_count ? ((tmp_sstrength / tmp_count) << 2) : 0); - - rxclear(); - - LOG("tr1001_read: got %d bytes\n", tmplen); - - return tmplen; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -receiving_packet(void) -{ - return tr1001_rxstate == RXSTATE_RECEIVING && - !timer_expired(&rxtimer); -} -/*---------------------------------------------------------------------------*/ -static int -pending_packet(void) -{ - return tr1001_rxstate == RXSTATE_FULL; -} -/*---------------------------------------------------------------------------*/ -static int -channel_clear(void) -{ - /* TODO add CCA functionality */ - return 0; -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(tr1001_process, ev, data) -{ - int len; - PROCESS_BEGIN(); - - /* Reset reception state now that the process is ready to receive data. */ - rxclear(); - - while(1) { - PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL); - packetbuf_clear(); - len = tr1001_read(packetbuf_dataptr(), PACKETBUF_SIZE); - if(len > 0) { - packetbuf_set_datalen(len); - NETSTACK_RDC.input(); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -void -tr1001_set_speed(unsigned char speed) -{ - - if(speed == TR1001_19200) { - /* Set TR1001 to 19200 */ - UBR00 = 0x80; /* 2,457MHz/19200 = 128 -> 0x80 */ - UBR10 = 0x00; /* */ - UMCTL0 = 0x00; /* no modulation */ - } else if(speed == TR1001_38400) { - /* Set TR1001 to 38400 */ - UBR00 = 0x40; /* 2,457MHz/38400 = 64 -> 0x40 */ - UBR10 = 0x00; /* */ - UMCTL0 = 0x00; /* no modulation */ - } else if(speed == TR1001_57600) { - UBR00 = 0x2a; /* 2,457MHz/57600 = 42.7 -> 0x2A */ - UBR10 = 0x00; /* */ - UMCTL0 = 0x5b; /* */ - } else if(speed == TR1001_115200) { - UBR00 = 0x15; /* 2,457MHz/115200 = 21.4 -> 0x15 */ - UBR10 = 0x00; /* */ - UMCTL0 = 0x4a; /* */ - } else { - tr1001_set_speed(TR1001_19200); - } -} -/*---------------------------------------------------------------------------*/ -unsigned short -tr1001_sstrength(void) -{ - return sstrength; -} -/*---------------------------------------------------------------------------*/ -/** @} */ -/** @} */ diff --git a/platform/esb/dev/tr1001.h b/platform/esb/dev/tr1001.h deleted file mode 100644 index f9421b27e..000000000 --- a/platform/esb/dev/tr1001.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ -#ifndef __TR1001_H__ -#define __TR1001_H__ - -#include "contiki-net.h" -#include "dev/radio.h" - -#include "contiki-conf.h" - -/** - * Radio driver for TR1001 - */ -extern const struct radio_driver tr1001_driver; - -/** - * Initialize the radio transceiver. - * - * Turns on reception of bytes and installs the receive interrupt - * handler. - */ -int tr1001_init(void); - -/** - * Set the speed of the TR1001 radio device. - * - * This function sets the speed of the TR1001 radio transceiver. Both - * the sender and the receiver must have the same speed for - * communication to work. - * - * \param speed The speed of the TR1001 radio: TR1001_19200, - * TR1001_38400, TR1001_57600 or TR1001_115200. - * - */ -void tr1001_set_speed(unsigned char s); -#define TR1001_19200 1 -#define TR1001_38400 2 -#define TR1001_57600 3 -#define TR1001_115200 4 - -/** - * Set the transmission power of the transceiver. - * - * The sensor board is equipped with a DS1804 100 position trimmer - * potentiometer which is used to set the transmission input current - * to the radio transceiver chip, thus setting the transmission power - * of the radio transceiver. - * - * This function sets the trimmer potentiometer to a value between 1 - * and 100. - * - * \param p The power of the transceiver, between 1 (lowest) and 100 - * (highest). - */ -void tr1001_set_txpower(unsigned char p); - -/** - * \brief The highest transmission power - */ -#define TR1001_TXPOWER_HIGHEST 100 - -/** - * \brief The lowest transmission power - */ -#define TR1001_TXPOWER_LOWEST 1 - -/** - * Send a packet. - * - * This function causes a packet to be sent out after a small random - * delay, but without doing any MAC layer collision detection or - * back-offs. The packet is sent with a 4 byte header that contains a - * a "type" identifier, an 8-bit packet ID field and the length of the - * packet in network byte order. - * - * This function should normally not be called from user - * programs. Rather, the uIP TCP/IP or Rime stack should be used. - */ -int tr1001_send(const void *packet, unsigned short len); - -/** - * Check if an incoming packet has been received. - * - * This function checks the receive buffer to see if an entire packet - * has been received. The actual reception is handled by an interrupt - * handler. - * - * This function should normally not be called from user - * programs. Rather, the uIP TCP/IP or Rime stack should be used. - * - * \return The length of the received packet, or 0 if no packet has - * been received. - */ -int tr1001_read(void *buf, unsigned short bufsize); - -extern unsigned char tr1001_rxbuf[]; -extern volatile unsigned char tr1001_rxstate; - -/** - * Calculate the signal strength of a received packet. - * - * This function calculates the received signal strength of the last - * received packet. This function typically is called when a packet - * has been received. - */ -unsigned short tr1001_sstrength(void); - -#endif /* __TR1001_H__ */ diff --git a/platform/esb/dev/vib-sensor.c b/platform/esb/dev/vib-sensor.c deleted file mode 100644 index 95a29da60..000000000 --- a/platform/esb/dev/vib-sensor.c +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ - -#include "dev/vib-sensor.h" -#include "dev/irq.h" -#include "dev/hwconf.h" - -const struct sensors_sensor vib_sensor; - -static unsigned int vib; - -#define VIB_IRQ() 4 -HWCONF_PIN(VIB, 1, VIB_IRQ()); -HWCONF_IRQ(VIB, 1, VIB_IRQ()); - -/*---------------------------------------------------------------------------*/ -static int -irq(void) -{ - ++vib; - sensors_changed(&vib_sensor); - return 1; -} -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return vib; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int value) -{ - switch(type) { - case SENSORS_HW_INIT: - vib = 0; - VIB_SELECT(); - VIB_MAKE_INPUT(); - return 1; - case SENSORS_ACTIVE: - if(value) { - if(!VIB_IRQ_ENABLED()) { - irq_port1_activate(VIB_IRQ(), irq); - VIB_ENABLE_IRQ(); - } - } else { - VIB_DISABLE_IRQ(); - irq_port1_deactivate(VIB_IRQ()); - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - switch(type) { - case SENSORS_ACTIVE: - case SENSORS_READY: - return VIB_IRQ_ENABLED(); - } - return 0; -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(vib_sensor, VIB_SENSOR, - value, configure, status); diff --git a/platform/esb/dev/vib-sensor.h b/platform/esb/dev/vib-sensor.h deleted file mode 100644 index 53cf70b56..000000000 --- a/platform/esb/dev/vib-sensor.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ -#ifndef __VIB_SENSOR_H__ -#define __VIB_SENSOR_H__ - -#include "lib/sensors.h" - -extern const struct sensors_sensor vib_sensor; - -#define VIB_SENSOR "Vibration" - -#endif /* __VIB_SENSOR_H__ */ diff --git a/platform/esb/doc/doc.txt b/platform/esb/doc/doc.txt deleted file mode 100644 index 9c6e3365c..000000000 --- a/platform/esb/doc/doc.txt +++ /dev/null @@ -1,7 +0,0 @@ -/** - -\defgroup doc Documentation -@{ -*/ - -/** @} */ diff --git a/platform/esb/doc/esb.txt b/platform/esb/doc/esb.txt deleted file mode 100644 index e87ea093e..000000000 --- a/platform/esb/doc/esb.txt +++ /dev/null @@ -1,171 +0,0 @@ -/** \addtogroup platform - * @{ **/ - -/** -\defgroup esb The ESB Embedded Sensor Board - -The ESB (Embedded Sensor Board) is a prototype wireless sensor network -device developed at FU Berlin. - - - -The ESB consists of a Texas Instruments MSP430 low-power -microcontroller with 2k RAM and 60k flash ROM, a TR1001 radio -transceiver, a 32k serial EEPROM, an RS232 port, a JTAG port, a -beeper, and a number of sensors (passive IR, active IR -sender/receiver, vibration/tilt, microphone, temperature). - - -The Contiki/ESB port contains drivers for most of the sensors. The -drivers were mostly adapted from sources from FU Berlin. - -\section esb-getting-started Getting started with Contiki for the ESB platform - -The ESB is equipped with an MSP430 microcontroller. The first step to -getting started with Contiki for the ESB is to install the development -tools for compiling Contiki for the MSP430. - -Windows users, see \ref esb-win-setup. FreeBSD users, see \ref esb-freebsd-setup - -\section esb-win-setup Setting up the Windows environment - -The Contiki development environment under Windows uses the Cygwin -environment. Cygwin is a Linux-like environment for Windows. Cygwin -can be found at http://www.cygwin.com. Click on the icon "Install -Cygwin Now" to the right to get the installation started. - -Choose "Install from Internet" and then specify where you want to -install cygwin (recommended installation path: -C:\\cygwin). Continue with the installation until you are -asked to select packages. Most packages can be left as "Default" but -there is one package that are not installed by default. Install the -following package by clicking at "Default" until it changes to -"Install": - -- Devel - contains things for developers (make, etc). - - - -When cygwin is installed there should be a cygwin icon that starts -up a cygwin bash when clicked on. Whenever it is time to compile and -send programs to the ESB nodes it will be done from a cygwin shell. - -\subsection winintro-installing-editor C programming editor - -If you do not already have a nice programming editor it is a good -idea to download and install one. The Crimson editor is a nice -windows based editor that is both easy to get started with and -fairly powerful. - -Crimson Editor can be found at: -http://www.crimsoneditor.com/ - -The editor is useful both when editing C programs and when -modifying scripts and configuration files. - -\subsection winintro-installing-compiler MSP430 Compiler and tools - -A compiler is needed to compile the programs to the MSP430 -microprocessor that is used on the ESB sensor nodes. Download and -install the GCC toolchain for MSP430 (recommended installation path: -C:\\MSP430\\). - -The GCC toolchain for MSP430 can be found at: -http://sourceforge.net/projects/mspgcc/ - -When the above software is installed you also need to set-up the -PATH so that all of the necessary tools can be reached. In cygwin -this is done by the following line (given that you have installed -at recommended locations): - - -export PATH=\$PATH:/cygdrive/c/MSP430/mspgcc/bin - - -This line can also be added to the .profile startup file in your cygwin -home directory -(C:\\cygwin\\home\\\\\.profile). - -If your home directory is located elsewhere you can find it by -starting cygwin and running \c cd followed by \c pwd. - -\subsection winintro-installing-contiki The Contiki operating system, including examples - -When programming the ESB sensor nodes it is very useful to have an -operating system that takes care of some of the low-level tasks and -also gives you as a programmer APIs for things like events, hardware -and networking. We will use the Contiki operating system developed by -Adam Dunkels, SICS, which is very well suited when programming small -embedded systems. - -The Contiki OS can be found at: -http://www.sics.se/contiki/ - -Unzip the Contiki OS at (for example) C:\\ -and you will get the following directories among others: - -- contiki-2.x/core - the contiki operating system -- contiki-2.x/platform/esb - the contiki operating system drivers, etc for the ESB -- contiki-2.x/examples/esb/ - example applications for the ESB - -\subsection winintro-testing Testing the tools - -Now everything necessary to start developing Contiki-based sensor net -applications should be installed. Start cygwin and change to the -directory contiki-2.x/examples/esb/. Then call make -beeper.esb. - -If you get an error about multiple cygwin dlls when compiling, you -need to delete cygwin1.dll from the MSP430 GCC toolchain -(C:\\MSP430\\bin\\cygwin1.dll). - -Connect a node and turn it on. Upload the test application by calling -make beeper.u. - -\subsection winintro-testing-development Development tools - -- make \ will compile and make a executable file ready -for sending to the ESB nodes. Depending on the \c SPEC it might even -startup the application that sends the executable to the -node. Typically you would write things like "make beeper.u" -to get the file beeper.c compiled, linked and sent out to the -ESB node. - -\subsection winintro-testing-shell Some basic shell commands - -- cd \ change to a specified directory (same as in DOS) -- pwd \ shows your current directory -- ls list the directory -- mkdir \ creates a new directory -- cp \ \ copies a file - -\section esb-freebsd-setup Setting up the FreeBSD environment - -Download the msp430-gcc, msp430-binutils, and -msp430-libc packages from -http://www.sics.se/~adam/contiki/freebsd-packages/. Install the -packages (as root) with pkg_add. - -\section esb-test-compilation Compiling your first Contiki system - -\section esb-burn-node-id Burning node IDs to EEPROM - -The Contiki ESB port comes with a small program, burn-nodeid -that semi-permanently stores a (unique) node ID number in the ESB -EEPROM. When the Contiki ESB port boots up, this node ID is restored -from the EEPROM. To compile and run this program, go into your project -directory and run - -make burn-nodeid.u nodeid=X - -where X is the node ID that will be burned into EEPROM. The -burn-nodeid program stores the node ID in EEPROM, reads it -back, and writes the output to the serial port. - -@{ - -*/ - - -/** @} */ -/** @} */ diff --git a/platform/esb/doc/getting-started.txt b/platform/esb/doc/getting-started.txt deleted file mode 100644 index 39ef619d3..000000000 --- a/platform/esb/doc/getting-started.txt +++ /dev/null @@ -1,18 +0,0 @@ -/** -\addtogroup esb -\section esb-getting-started Getting started with Contiki for the ESB platform - -The ESB is equipped with an MSP430 microcontroller. The first step to -getting started with Contiki for the ESB is to install the development -tools for compiling Contiki for the MSP430. - -For Windows users, see \ref esb-win-setup - - -@{ -*/ - - -/** -@} -*/ diff --git a/platform/esb/doc/quickref.txt b/platform/esb/doc/quickref.txt deleted file mode 100644 index e45689953..000000000 --- a/platform/esb/doc/quickref.txt +++ /dev/null @@ -1,78 +0,0 @@ -/** -\defgroup quickref Function quick reference -@{ - -\section sensors Sensor functions - -Each sensor has a set of functions for controlling it and query it for -its state. Some sensors also generate an events when the sensors -change. A sensor must be activated before it generates events or -relevant values. - -- SENSORS_ACTIVATE(sensor) - activate the sensor -- SENSORS_DEACTIVATE(sensor) - deactivate the sensor -- sensor.value(0) - query the sensor for its last value - -- \ref sensors_event - event sent when a sensor has changed (the data - argument will referer to the actual sensor) - -Example for querying the button: - -- \ref SENSORS_ACTIVATE(button_sensor) - activate the button sensor -- \ref button_sensor.value(0) - the button has been pressed or not - -\subsection quickref-sensors Sensor on the ESB platform - -- \ref battery_sensor - query the battery voltage level -- \ref button_sensor - query the on-board button -- \ref pir_sensor - query the passive IR sensor (motion detector) -- \ref radio_sensor - query the radio signal strength -- \ref sound_sensor - query the microphone -- \ref temperature_sensor - query the temperature sensor -- \ref vib_sensor - query the vibration sensor - -\section quickref-leds LED functions - -- leds_on() - turn LEDs on -- leds_off() - turn LEDs off -- leds_invert() - invert LEDs -- leds_blink() - blink all LEDs - -\section quickref-beeper Beeper functions - -- beep() - click the beeper -- beep_beep() - beep -- beep_down() - pitchbend down beep -- beep_quick() - a number of quick beeps -- beep_spinup() - pitchbend up beep - -\section quickref-timers Timer functions - -Contiki provides a set of timer libraries. Event timers generates an -event when the timer expires and callback timers call a function when -the timer expires. The simple timers on the other hand have to be -actively queried to check when they have expired. - -\subsection quickref-etimer Event timers - -- etimer_expired() - check if an event timer has expired -- etimer_set() - set an event timer -- etimer_reset() - set an expired event timer to the next interval -- etimer_restart() - restart an event timer from the current point in time - -\subsection quickref-ctimer Callback timers - -- ctimer_expired() - check if a callback timer has expired -- ctimer_set() - set a callback timer -- ctimer_reset() - set an expired callback timer to the next interval -- ctimer_restart() - restart a callback timer from the current point in time - -\subsection quickref-timer Simple timers - -- timer_expired() - check if a simple timer has expired -- timer_set() - set a simple timer -- timer_reset() - set a simple event timer to the next interval -- timer_restart() - restart a simple timer from the current point in time - - -*//** @{ */ diff --git a/platform/esb/doc/slipintro.txt b/platform/esb/doc/slipintro.txt deleted file mode 100644 index 1610eceaa..000000000 --- a/platform/esb/doc/slipintro.txt +++ /dev/null @@ -1,127 +0,0 @@ -/** \addtogroup esb -@{ */ -/** -\defgroup slipintro Introduction to Over The Air Reprogramming under Windows -\author Joakim Eriksson, Niclas Finne -@{ - -\section slipintro-intro Introduction - -This is a brief introduction how to program ESB sensor nodes over -radio under Windows. It is assumed that you already have the -environment setup for programming ESB sensor nodes using JTAG cable. - -\section slipintro-configuring Configuring SLIP under Windows XP - -This section describes how to setup a SLIP connection under Windows. A -SLIP connection forwards TCP/IP traffic to/from the sensor nodes and -lets you communicate with them using standard network tools such as -\c ping. - - --# Click start button and choose 'My Computer'. Right-click 'My -Network Places' and choose 'Properties'. - --# Click 'Create a new connection'. - --# Select 'Set up an advanced connection'. - --# Select 'Connect directly to another computer'. - --# Select 'Guest'. - --# Select a name for the slip connection (for example 'ESB'). - --# Select the serial port to use when communicating with the sensor -node. - --# Add the connection by clicking 'Finish'. - --# A connection window will open. Choose 'Properties'. - - --# Click on 'Configure...' and deselect all selected -buttons. Choose the speed 57600 bps. - --# Close the modem configuration window, and go to the 'Options' -tab in the ESB properties. Deselect all except 'Display -progress...'. - --# Go to the 'Networking' tab. Change to 'SLIP: Unix Connection' -and deselect all except the first two items in the connection item -list. - --# Select 'Internet Protocol (TCP/IP)' and click -'Properties'. Enter the IP address '172.16.0.1'. - --# Click 'Advanced' and deselect all checkboxes in the 'Advanced -TCP/IP Settings'. Go to the 'WINS' tab and deselect 'Enable LMHOSTS -lookup' if it is selected. Also select 'Disable NetBIOS over -TCP/IP'. - - - - -\section slipintro-setup Setup ESB for over the air programming - -Make sure you have the latest version of Contiki (older versions of -Contiki might not work with SLIP under Windows). - --# Each node needs an IP address for OTA to work. The node id -is used to construct an IP address for the node. If you specify 2 as -node id, the node will have the IP address 172.16.1.2. Each node -should have its own unique node id. To set the node id move to the -directory 'contiki-2.x/examples/esb' and run -\code -make burn-nodeid.u nodeid=X -\endcode -Use the number 1, 2, 3, etc, as the node id (\c X) for the nodes. This -will give the nodes the IP addresses 172.16.1.1, 172.16.1.2, etc. The -node id only needs to be set once for each node and it will remain -even when new applications are uploaded onto the node. --# You need to compile a core and upload it onto the nodes. All nodes -must run the same core. Move to the directory -'contiki-2.x/examples/esb' and run -\code -make WITH_CODEPROP=1 core -make WITH_CODEPROP=1 core.u -\endcode -to upload the core to your nodes. --# Attach the ESB node to the serial port and make sure it is -turned on. Select your ESB SLIP connection in your 'Network -Connections' and choose 'Connect' (or double click on it). If -everything works Windows should say that you have a new connection. --# Set the IP address for the node by pinging it (it will claim the -IP address of the first ping it hears). Note that the slip interface -has IP address 172.16.0.1 but the node will have the IP address -172.16.1.1. -\code -ping 172.16.1.1 -\endcode - -If everything works the node should click and reply to the pings. - -You also need a program to send the application to connected -nodes. Compile it by running - -\code -make send -\endcode - -\section slipintro-send Send programs over the air - -Contiki applications to be installed via radio are compiled somewhat -different compared to normal applications. - -Make sure you have a node with IP address 172.16.1.1 connected to your -serial port and have SLIP activated. Then compile and send a -testprogram by running - -\code -make beeper.ce -./send 172.16.1.1 beeper.ce -\endcode - -*/ -/** @} */ -/** @} */ diff --git a/platform/esb/loader/loader-arch.h b/platform/esb/loader/loader-arch.h deleted file mode 100644 index 260062d5a..000000000 --- a/platform/esb/loader/loader-arch.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ -#ifndef __LOADER_ARCH_H__ -#define __LOADER_ARCH_H__ - -/** - * Load a program from EEPROM. - * - * This function loads a program from EEPROM into the flash ROM (code) and RAM (data). - * - * \param code The address of the first byte of code in the EEPROM. - * - * \param codelen The length of the code. - * - * \param data The address of the first byte of data in the EEPROM. - * - * \param datalen The length of the data. - * - */ -void loader_arch_load(unsigned short startaddr); - -/** - * Unload a program. - * - * This function should not be called directly, but accessed through - * the macro LOADER_UNLOAD(). The function unloads a program from both - * RAM and ROM. - * - * \param codeaddr A pointer to the first byte of program code. - * - * \param dataaddr A pointer to the first byte of program data. - */ -void loader_arch_free(void *codeaddr, void *dataaddr); - -extern void *loader_arch_codeaddr, *loader_arch_dataaddr; - -#ifndef LOADER_UNLOAD -#define LOADER_UNLOAD() loader_arch_free(&loader_arch_codeaddr, &loader_arch_dataaddr) -#endif - -#define LOADER_ARCH_MAGIC 0x373a -#define LOADER_ARCH_VERSION 0x0001 - -#endif /* __LOADER_ARCH_H__ */ diff --git a/platform/esb/net/uip-driver.c b/platform/esb/net/uip-driver.c deleted file mode 100644 index 27dac8703..000000000 --- a/platform/esb/net/uip-driver.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2010, 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. - * - */ - -/** - * \file - * A brief description of what this file is - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#include "net/netstack.h" -#include "net/uip.h" -#include "net/tcpip.h" -#include "net/hc.h" -#include "net/packetbuf.h" -#include "net/uip-driver.h" -#include - -/*--------------------------------------------------------------------*/ -static void -init(void) -{ - /* - * Set out output function as the function to be called from uIP to - * send a packet. - */ - tcpip_set_outputfunc(uip_driver_send); -} -/*--------------------------------------------------------------------*/ -static void -input(void) -{ - if(packetbuf_datalen() > 0 && - packetbuf_datalen() <= UIP_BUFSIZE - UIP_LLH_LEN) { - memcpy(&uip_buf[UIP_LLH_LEN], packetbuf_dataptr(), packetbuf_datalen()); - uip_len = hc_inflate(&uip_buf[UIP_LLH_LEN], packetbuf_datalen()); - tcpip_input(); - } -} -/*--------------------------------------------------------------------*/ -uint8_t -uip_driver_send(void) -{ - uip_len = hc_compress(&uip_buf[UIP_LLH_LEN], uip_len); - packetbuf_copyfrom(&uip_buf[UIP_LLH_LEN], uip_len); - - /* XXX we should provide a callback function that is called when the - packet is sent. For now, we just supply a NULL pointer. */ - NETSTACK_MAC.send(NULL, NULL); - return 1; -} -/*--------------------------------------------------------------------*/ -const struct network_driver uip_driver = { - "uip", - init, - input -}; -/*--------------------------------------------------------------------*/ diff --git a/platform/esb/net/uip-driver.h b/platform/esb/net/uip-driver.h deleted file mode 100644 index c067f647b..000000000 --- a/platform/esb/net/uip-driver.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2010, 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. - * - */ - -/** - * \file - * A brief description of what this file is - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#ifndef __UIP_DRIVER_H__ -#define __UIP_DRIVER_H__ - -#include "net/netstack.h" - -uint8_t uip_driver_send(void); - -extern const struct network_driver uip_driver; - -#endif /* __UIP_DRIVER_H__ */ diff --git a/platform/esb/node-id.c b/platform/esb/node-id.c deleted file mode 100644 index 14dc735d5..000000000 --- a/platform/esb/node-id.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2006, 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. - * - */ - -/** - * \file - * A brief description of what this file is. - * \author - * Adam Dunkels - */ - -#include "sys/node-id.h" -#include "contiki-conf.h" -#include "dev/eeprom.h" - -unsigned short node_id = 0; -/*---------------------------------------------------------------------------*/ -void -node_id_restore(void) -{ - unsigned char buf[2]; - eeprom_read(NODE_ID_EEPROM_OFFSET, buf, 2); - if(buf[0] == 0xad && - buf[1] == 0xde) { - eeprom_read(NODE_ID_EEPROM_OFFSET + 2, buf, 2); - node_id = (buf[0] << 8) | buf[1]; - } else { - node_id = 0; - } -} -/*---------------------------------------------------------------------------*/ -void -node_id_burn(unsigned short id) -{ - unsigned char buf[2]; - buf[0] = 0xad; - buf[1] = 0xde; - eeprom_write(NODE_ID_EEPROM_OFFSET, buf, 2); - buf[0] = id >> 8; - buf[1] = id & 0xff; - eeprom_write(NODE_ID_EEPROM_OFFSET + 2, buf, 2); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/jcreate/Makefile.jcreate b/platform/jcreate/Makefile.jcreate deleted file mode 100644 index b9501e97f..000000000 --- a/platform/jcreate/Makefile.jcreate +++ /dev/null @@ -1,17 +0,0 @@ -# Use custom platform configuration -CFLAGS += -DPLATFORM_CONF_H=\"platform-jcreate-conf.h\" - -# Some drivers such as ds2411.c only compile under platform sky -CFLAGS += -DCONTIKI_TARGET_SKY - -CONTIKI_TARGET_SOURCEFILES += contiki-jcreate-platform.c \ - battery-sensor.c radio-sensor.c \ - temperature-sensor.c acc-sensor.c ext-sensor.c - -include $(CONTIKI)/platform/sky/Makefile.common - -ifneq ($(TMOTE_BSL), 1) - ${warning No $(TMOTE_BSL_FILE) command for jcreate found. Please install this command in $(CONTIKI)/tools/sky} -endif - -CONTIKI_TARGET_DIRS += ${addprefix ../sky/,. dev apps} diff --git a/platform/jcreate/contiki-jcreate-platform.c b/platform/jcreate/contiki-jcreate-platform.c deleted file mode 100644 index 8d81ceef6..000000000 --- a/platform/jcreate/contiki-jcreate-platform.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2010, 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. - * - * Author: Niclas Finne , Joakim Eriksson - * - */ - -#include "dev/battery-sensor.h" - -SENSORS(&battery_sensor); - -void -init_platform(void) -{ - process_start(&sensors_process, NULL); -} diff --git a/platform/jcreate/dev/acc-sensor.c b/platform/jcreate/dev/acc-sensor.c deleted file mode 100644 index bf7de1963..000000000 --- a/platform/jcreate/dev/acc-sensor.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2010, 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2005-11-01 - * Updated : $Date: 2010/08/25 19:34:42 $ - * $Revision: 1.2 $ - */ - -#include "contiki.h" -#include "dev/acc-sensor.h" -#include "dev/sky-sensors.h" - -/* Configure ADC12_2 to sample channel 4, 5, 6 and use */ -/* the Vref+ as reference (SREF_1) since it is a stable reference */ -#define INPUT_CHANNEL ((1 << INCH_4) | (1 << INCH_5) | (1 << INCH_6)) -#define INPUT_REFERENCE SREF_1 -#define ACC_MEM_X ADC12MEM4 /* Xout */ -#define ACC_MEM_Y ADC12MEM5 /* Yout */ -#define ACC_MEM_Z ADC12MEM6 /* Zout */ - -const struct sensors_sensor acc_sensor; - -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - switch(type) { - case ACC_SENSOR_X: - return ACC_MEM_X; - case ACC_SENSOR_Y: - return ACC_MEM_Y; - case ACC_SENSOR_Z: - return ACC_MEM_Z; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - if(type == SENSORS_ACTIVE) { - /* Sleep Mode P2.3 */ - if(c) { - P2OUT |= 0x08; - P2DIR |= 0x08; - } else { - /* Sensor deactivated. Changed to sleep mode. */ - P2OUT &= ~0x08; - } - } else if(type == ACC_SENSOR_SENSITIVITY) { - /* g-Select1 P2.0, g-Select2 P2.1 */ - P2DIR |= 0x03; - P2OUT &= ~0x03; - P2OUT |= c & 0x03; - } - return sky_sensors_configure(INPUT_CHANNEL, INPUT_REFERENCE, type, c); -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - if(type == ACC_SENSOR_SENSITIVITY) { - return (P2OUT & P2DIR) & 0x03; - } - return sky_sensors_status(INPUT_CHANNEL, type); -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(acc_sensor, ACC_SENSOR, value, configure, status); diff --git a/platform/jcreate/dev/acc-sensor.h b/platform/jcreate/dev/acc-sensor.h deleted file mode 100644 index bf31d1955..000000000 --- a/platform/jcreate/dev/acc-sensor.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2006, 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne - * Created : 2005-11-01 - * Updated : $Date: 2010/08/25 19:34:42 $ - * $Revision: 1.2 $ - */ - -#ifndef __ACC_SENSOR_H__ -#define __ACC_SENSOR_H__ - -#include "lib/sensors.h" - -extern const struct sensors_sensor acc_sensor; - -#define ACC_SENSOR "Acc" - -#define ACC_SENSOR_X 0 -#define ACC_SENSOR_Y 1 -#define ACC_SENSOR_Z 2 - -/* - Sensitivity configuration (g-Select1 and g-Select2) - Value g-Range Sensitivity - 0 1.5g 800mV/g - 1 2g 600mV/g - 2 4g 300mV/g - 3 6g 200mV/g -*/ -#define ACC_SENSOR_SENSITIVITY 10 - -#endif /* __ACC_SENSOR_H__ */ diff --git a/platform/jcreate/dev/ext-sensor.c b/platform/jcreate/dev/ext-sensor.c deleted file mode 100644 index a034448cb..000000000 --- a/platform/jcreate/dev/ext-sensor.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2006, 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Adam Dunkels, Joakim Eriksson, Niclas Finne, Marcus Lundén, - * Jesper Karlsson - * Created : 2005-11-01 - * Updated : $Date: 2010/08/25 19:34:42 $ - * $Revision: 1.2 $ - */ - - -#include "contiki.h" -#include "dev/ext-sensor.h" -#include "dev/sky-sensors.h" - -/* SREF_0 is AVCC */ -/* SREF_1 is Vref+ */ -/* ADC0 == P6.0/A0 == port "under" logo */ -/* ADC1 == P6.1/A1 == port "over" logo */ -/* ADC2 == P6.2/A2, bottom expansion port */ -/* ADC3 == P6.1/A3, bottom expansion port, End Of (ADC-)Sequence */ - -#define INPUT_CHANNEL ((1 << INCH_0) | (1 << INCH_1) | \ - (1 << INCH_2) | (1 << INCH_3)) -#define INPUT_REFERENCE SREF_0 -#define EXT_MEM0 ADC12MEM0 -#define EXT_MEM1 ADC12MEM1 -#define EXT_MEM2 ADC12MEM2 -#define EXT_MEM3 ADC12MEM3 - -const struct sensors_sensor ext_sensor; -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - /* ADC0 corresponds to the port under the logo, ADC1 to the port - over the logo, ADC2 and ADC3 corresponds to port on the JCreate - bottom expansion port) */ - switch(type) { - case ADC0: - return EXT_MEM0; - case ADC1: - return EXT_MEM1; - case ADC2: - return EXT_MEM2; - case ADC3: - return EXT_MEM3; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - return sky_sensors_status(INPUT_CHANNEL, type); -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - return sky_sensors_configure(INPUT_CHANNEL, INPUT_REFERENCE, type, c); -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(ext_sensor, "Ext", value, configure, status); diff --git a/platform/jcreate/dev/ext-sensor.h b/platform/jcreate/dev/ext-sensor.h deleted file mode 100644 index c2c9f36e5..000000000 --- a/platform/jcreate/dev/ext-sensor.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2006, 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. - * - * - * ----------------------------------------------------------------- - * - * Author : Marcus Lundén - * Created : 2005-11-01 - * Updated : $Date: 2010/05/03 21:57:35 $ - * $Revision: 1.1 $ - */ - -#ifndef __EXT_SENSOR_H__ -#define __EXT_SENSOR_H__ - -#include "lib/sensors.h" - -#define ADC0 0 -#define ADC1 1 -#define ADC2 2 -#define ADC3 3 - -extern const struct sensors_sensor ext_sensor; - -#define EXT_SENSOR "Ext" - -#endif /* __EXT_SENSOR_H__ */ diff --git a/platform/jcreate/leds-arch.c b/platform/jcreate/leds-arch.c deleted file mode 100644 index 4f4dc748c..000000000 --- a/platform/jcreate/leds-arch.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2010, 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. - * - */ - -/** - * \file - * A leds implementation for the jcreate platform - * \author - * Adam Dunkels - * Niclas Finne - * Joakim Eriksson - */ - -#include "contiki.h" -#include "dev/leds.h" - -/*---------------------------------------------------------------------------*/ -void -leds_arch_init(void) -{ - LEDS_PxDIR = 0xff; - LEDS_PxOUT = 0xff; -} -/*---------------------------------------------------------------------------*/ -unsigned char -leds_arch_get(void) -{ - return ~LEDS_PxOUT; -} -/*---------------------------------------------------------------------------*/ -void -leds_arch_set(unsigned char leds) -{ - LEDS_PxOUT = ~leds; -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/jcreate/platform-jcreate-conf.h b/platform/jcreate/platform-jcreate-conf.h deleted file mode 100644 index 8344f4a1b..000000000 --- a/platform/jcreate/platform-jcreate-conf.h +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Copyright (c) 2011, 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. - */ - -/** - * \file - * Platform configuration for the Sentilla JCreate - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#ifndef __PLATFORM_CONF_H__ -#define __PLATFORM_CONF_H__ - -/* - * Definitions below are dictated by the hardware and not really - * changeable! - */ -/* Platform TMOTE_SKY */ -#define TMOTE_SKY 1 - -#define LEDS_CONF_ALL 255 -#define PLATFORM_HAS_LEDS 1 -#define PLATFORM_HAS_BUTTON 0 - -/* CPU target speed in Hz */ -#define F_CPU 3900000uL /*2457600uL*/ - -/* Our clock resolution, this is the same as Unix HZ. */ -#define CLOCK_CONF_SECOND 128UL - -#define BAUD2UBR(baud) ((F_CPU/baud)) - -#define CCIF -#define CLIF - -#define HAVE_STDINT_H -#include "msp430def.h" - - -/* Types for clocks and uip_stats */ -typedef unsigned short uip_stats_t; -typedef unsigned long clock_time_t; -typedef unsigned long off_t; - -/* the low-level radio driver */ -#define NETSTACK_CONF_RADIO cc2420_driver - -/* LED ports */ -#define LEDS_PxDIR P5DIR -#define LEDS_PxOUT P5OUT -#define LEDS_CONF_RED 0x10 -#define LEDS_CONF_GREEN 0x20 -#define LEDS_CONF_YELLOW 0x40 - -/* DCO speed resynchronization for more robust UART, etc. */ -#ifndef DCOSYNCH_CONF_ENABLED -#define DCOSYNCH_CONF_ENABLED 1 -#endif /* DCOSYNCH_CONF_ENABLED */ -#ifndef DCOSYNCH_CONF_PERIOD -#define DCOSYNCH_CONF_PERIOD 30 -#endif /* DCOSYNCH_CONF_PERIOD */ - -#define ROM_ERASE_UNIT_SIZE 512 -#define XMEM_ERASE_UNIT_SIZE (64*1024L) - - -#define CFS_CONF_OFFSET_TYPE long - - -/* Use the first 64k of external flash for node configuration */ -#define NODE_ID_XMEM_OFFSET (0 * XMEM_ERASE_UNIT_SIZE) - -/* Use the second 64k of external flash for codeprop. */ -#define EEPROMFS_ADDR_CODEPROP (1 * XMEM_ERASE_UNIT_SIZE) - -#define CFS_XMEM_CONF_OFFSET (2 * XMEM_ERASE_UNIT_SIZE) -#define CFS_XMEM_CONF_SIZE (1 * XMEM_ERASE_UNIT_SIZE) - -#define CFS_RAM_CONF_SIZE 4096 - -/* - * SPI bus configuration for the TMote Sky. - */ - -/* SPI input/output registers. */ -#define SPI_TXBUF U0TXBUF -#define SPI_RXBUF U0RXBUF - - /* USART0 Tx ready? */ -#define SPI_WAITFOREOTx() while ((U0TCTL & TXEPT) == 0) - /* USART0 Rx ready? */ -#define SPI_WAITFOREORx() while ((IFG1 & URXIFG0) == 0) - /* USART0 Tx buffer ready? */ -#define SPI_WAITFORTxREADY() while ((IFG1 & UTXIFG0) == 0) - -#define SCK 1 /* P3.1 - Output: SPI Serial Clock (SCLK) */ -#define MOSI 2 /* P3.2 - Output: SPI Master out - slave in (MOSI) */ -#define MISO 3 /* P3.3 - Input: SPI Master in - slave out (MISO) */ - -/* - * SPI bus - M25P80 external flash configuration. - */ - -#define FLASH_PWR 3 /* P4.3 Output */ -#define FLASH_CS 4 /* P4.4 Output */ -#define FLASH_HOLD 7 /* P4.7 Output */ - -/* Enable/disable flash access to the SPI bus (active low). */ - -#define SPI_FLASH_ENABLE() ( P4OUT &= ~BV(FLASH_CS) ) -#define SPI_FLASH_DISABLE() ( P4OUT |= BV(FLASH_CS) ) - -#define SPI_FLASH_HOLD() ( P4OUT &= ~BV(FLASH_HOLD) ) -#define SPI_FLASH_UNHOLD() ( P4OUT |= BV(FLASH_HOLD) ) - -/* - * SPI bus - CC2420 pin configuration. - */ - -#define CC2420_CONF_SYMBOL_LOOP_COUNT 800 - -/* P1.0 - Input: FIFOP from CC2420 */ -#define CC2420_FIFOP_PORT(type) P1##type -#define CC2420_FIFOP_PIN 0 -/* P1.3 - Input: FIFO from CC2420 */ -#define CC2420_FIFO_PORT(type) P1##type -#define CC2420_FIFO_PIN 3 -/* P1.4 - Input: CCA from CC2420 */ -#define CC2420_CCA_PORT(type) P1##type -#define CC2420_CCA_PIN 4 -/* P4.1 - Input: SFD from CC2420 */ -#define CC2420_SFD_PORT(type) P4##type -#define CC2420_SFD_PIN 1 -/* P4.2 - Output: SPI Chip Select (CS_N) */ -#define CC2420_CSN_PORT(type) P4##type -#define CC2420_CSN_PIN 2 -/* P4.5 - Output: VREG_EN to CC2420 */ -#define CC2420_VREG_PORT(type) P4##type -#define CC2420_VREG_PIN 5 -/* P4.6 - Output: RESET_N to CC2420 */ -#define CC2420_RESET_PORT(type) P4##type -#define CC2420_RESET_PIN 6 - -#define CC2420_IRQ_VECTOR PORT1_VECTOR - -/* Pin status. */ -#define CC2420_FIFOP_IS_1 (!!(CC2420_FIFOP_PORT(IN) & BV(CC2420_FIFOP_PIN))) -#define CC2420_FIFO_IS_1 (!!(CC2420_FIFO_PORT(IN) & BV(CC2420_FIFO_PIN))) -#define CC2420_CCA_IS_1 (!!(CC2420_CCA_PORT(IN) & BV(CC2420_CCA_PIN))) -#define CC2420_SFD_IS_1 (!!(CC2420_SFD_PORT(IN) & BV(CC2420_SFD_PIN))) - -/* The CC2420 reset pin. */ -#define SET_RESET_INACTIVE() (CC2420_RESET_PORT(OUT) |= BV(CC2420_RESET_PIN)) -#define SET_RESET_ACTIVE() (CC2420_RESET_PORT(OUT) &= ~BV(CC2420_RESET_PIN)) - -/* CC2420 voltage regulator enable pin. */ -#define SET_VREG_ACTIVE() (CC2420_VREG_PORT(OUT) |= BV(CC2420_VREG_PIN)) -#define SET_VREG_INACTIVE() (CC2420_VREG_PORT(OUT) &= ~BV(CC2420_VREG_PIN)) - -/* CC2420 rising edge trigger for external interrupt 0 (FIFOP). */ -#define CC2420_FIFOP_INT_INIT() do { \ - CC2420_FIFOP_PORT(IES) &= ~BV(CC2420_FIFOP_PIN); \ - CC2420_CLEAR_FIFOP_INT(); \ - } while(0) - -/* FIFOP on external interrupt 0. */ -#define CC2420_ENABLE_FIFOP_INT() do {CC2420_FIFOP_PORT(IE) |= BV(CC2420_FIFOP_PIN);} while(0) -#define CC2420_DISABLE_FIFOP_INT() do {CC2420_FIFOP_PORT(IE) &= ~BV(CC2420_FIFOP_PIN);} while(0) -#define CC2420_CLEAR_FIFOP_INT() do {CC2420_FIFOP_PORT(IFG) &= ~BV(CC2420_FIFOP_PIN);} while(0) - -/* - * Enables/disables CC2420 access to the SPI bus (not the bus). - * (Chip Select) - */ - - /* ENABLE CSn (active low) */ -#define CC2420_SPI_ENABLE() (CC2420_CSN_PORT(OUT) &= ~BV(CC2420_CSN_PIN)) - /* DISABLE CSn (active low) */ -#define CC2420_SPI_DISABLE() (CC2420_CSN_PORT(OUT) |= BV(CC2420_CSN_PIN)) -#define CC2420_SPI_IS_ENABLED() ((CC2420_CSN_PORT(OUT) & BV(CC2420_CSN_PIN)) != BV(CC2420_CSN_PIN)) - -#endif /* __PLATFORM_CONF_H__ */ diff --git a/platform/msb430/Makefile b/platform/msb430/Makefile deleted file mode 100644 index 120434cd0..000000000 --- a/platform/msb430/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $Id: Makefile,v 1.3 2007/08/17 13:10:16 nvt-se Exp $ - -all: test-abc -upload: test-abc test-abc.u - -test-abc: - $(MAKE) test-abc.firmware && \ - $(MAKE) test-abc.firmware && \ - $(MAKE) test-abc.firmware - -CONTIKI=../.. -TARGET=msb430 - -include $(CONTIKI)/Makefile.include diff --git a/platform/msb430/Makefile.msb430 b/platform/msb430/Makefile.msb430 deleted file mode 100644 index 8ac7f68f9..000000000 --- a/platform/msb430/Makefile.msb430 +++ /dev/null @@ -1,74 +0,0 @@ -SENSORS = sensors.c sht11.c -MSB = dma.c infomem.c node-id.c \ - msb430-uart1.c rs232.c \ - cc1020.c cc1020-uip.c adc.c \ - msb430-slip-arch.c sd.c sd-arch.c \ - cfs-coffee.c cfs-coffee-arch.c - -CONTIKI_TARGET_DIRS = . dev apps loader -ifndef CONTIKI_TARGET_MAIN -CONTIKI_TARGET_MAIN = contiki-msb430-main.c -endif - -CONTIKI_TARGET_SOURCEFILES += $(SENSORS) $(MSB) $(CONTIKI_TARGET_MAIN) - -MCU=msp430f1612 -include $(CONTIKI)/cpu/msp430/Makefile.msp430 - -contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o} -# $(AR) rcf $@ $^ - -ifndef BASE_IP -BASE_IP := 172.16.1.1 -endif - -### System dependent Makefile - -ifeq ($(HOST_OS),FreeBSD) - # settings for FreeBSD - -include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.freebsd -else - ifeq ($(HOST_OS),Windows) - # settings for Windows - -include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.win - else - # settings for an arbitary unix-like platform - -include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.unix - endif -endif - -# If we are not running under Windows, we assume Linux -ifndef MOTELIST - USBDEVPREFIX= - SERIALDUMP = $(CONTIKI)/tools/sky/serialdump-linux - MOTELIST = $(CONTIKI)/tools/sky/motelist-linux - MOTES = $(shell $(MOTELIST) 2>&- | grep USB | \ - cut -f 4 -d \ | \ - perl -ne 'print $$1 . " " if(m-(/dev/\w+)-);') - CMOTES=$(MOTES) -endif - -msb-motelist: - $(MOTELIST) -msb-motes: - @echo $(MOTES) - -ifdef MOTE -serialdump: - $(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(word $(MOTE), $(CMOTES)) | $(CONTIKI)/tools/timestamp | tee serialdump-`date +%Y%m%d-%H%M` - -serialview: - $(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(word $(MOTE), $(CMOTES)) | $(CONTIKI)/tools/timestamp - -login: - $(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(word $(MOTE), $(CMOTES)) -else -serialdump: - $(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(firstword $(CMOTES)) | $(CONTIKI)/tools/timestamp | tee serialdump-`date +%Y%m%d-%H%M` - -serialview: - $(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(firstword $(CMOTES)) | $(CONTIKI)/tools/timestamp - -login: - $(SERIALDUMP) -b115200 $(USBDEVPREFIX)$(firstword $(CMOTES)) -endif diff --git a/platform/msb430/apps/Makefile.apps b/platform/msb430/apps/Makefile.apps deleted file mode 100644 index faa02d97d..000000000 --- a/platform/msb430/apps/Makefile.apps +++ /dev/null @@ -1,2 +0,0 @@ -helloworld: helloworld.c -test-abc: test-abc.c diff --git a/platform/msb430/apps/acc-test.c b/platform/msb430/apps/acc-test.c deleted file mode 100644 index 09cf96842..000000000 --- a/platform/msb430/apps/acc-test.c +++ /dev/null @@ -1,70 +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. - * - */ - -#include "contiki.h" -#include "net/rime.h" -#include "dev/sd.h" - -#include -#include - -/*---------------------------------------------------------------------------*/ -PROCESS(test_acc_process, "Accelerometer test"); -AUTOSTART_PROCESSES(&test_acc_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(test_acc_process, ev, data) -{ - static struct etimer et; - static int x, y, z; - static uint32_t xa, ya, za; - - PROCESS_BEGIN(); - - while(1) { - etimer_set(&et, CLOCK_SECOND / 8); - PROCESS_WAIT_EVENT(); - if (etimer_expired(&et)) { - adc_on(); - x = ADC12MEM0; - y = ADC12MEM1; - z = ADC12MEM2; - xa = xa + x - (xa >> 4); - ya = ya + y - (ya >> 4); - za = za + z - (za >> 4); - adc_off(); - printf("x=%ld, y=%ld, z=%ld\n", - (xa >> 4) - x, (ya >> 4) - y, (za >> 4) - z); - } - } - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/msb430/apps/sd-test.c b/platform/msb430/apps/sd-test.c deleted file mode 100644 index 53acd9eb9..000000000 --- a/platform/msb430/apps/sd-test.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2009, 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. - * - */ - -/** - * \file - * Test for an SD driver. - * \author - * Nicolas Tsiftes - */ - - -#include "contiki.h" -#include "dev/sd.h" -#include "lib/random.h" - -#include -#include - -PROCESS(sd_test, "SD test process"); -AUTOSTART_PROCESSES(&sd_test); - -#define BUF_SIZE 64 - -PROCESS_THREAD(sd_test, event, data) -{ - static unsigned long iter; - static unsigned long offset; - char buf[BUF_SIZE]; - static struct etimer et; - int r, buflen; - - PROCESS_BEGIN(); - - etimer_set(&et, CLOCK_SECOND / 16); - - offset = 0; - for(iter = 1;; iter++) { - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et)); - - memset(buf, 0, sizeof(buf)); - buflen = sprintf(buf, "(%ld) Testing the SD card (%ld)", iter, iter); - - if((iter & 7) == 0) { - offset = random_rand() & 0xffff; - } else { - offset += random_rand() & 0xff; - } - - r = sd_write(offset, buf, buflen + 1); - if(r > 0) { - memset(buf, 0, sizeof(buf)); - r = sd_read(offset, buf, buflen + 1); - if(r > 0) { - printf("read %s (offset %lu)\n", buf, offset); - } else { - printf("read error: %d (%s)\n", r, sd_error_string(r)); - } - } else { - printf("write error: %d (%s)\n", r, sd_error_string(r)); - } - etimer_restart(&et); - } - - PROCESS_END(); -} diff --git a/platform/msb430/apps/test-abc.c b/platform/msb430/apps/test-abc.c deleted file mode 100644 index 5f2f7180a..000000000 --- a/platform/msb430/apps/test-abc.c +++ /dev/null @@ -1,102 +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. - * - */ - -/** - * \file - * Testing the abc layer in Rime - * \author - * Adam Dunkels - */ - -#include "contiki.h" -#include "net/rime.h" -#include "sys/node-id.h" - -#include - -#ifndef SENDER_ID -#define SENDER_ID 1 -#endif - -#ifndef SEND_INTERVAL -#define SEND_INTERVAL (CLOCK_SECOND * 3) -#endif - -/*---------------------------------------------------------------------------*/ -PROCESS(test_abc_process, "ABC test"); -AUTOSTART_PROCESSES(&test_abc_process); -/*---------------------------------------------------------------------------*/ -static void -abc_recv(struct abc_conn *c) -{ - char *s; - int i; - - s = packetbuf_dataptr(); - - printf("abc message received '%s'\n", (char *)packetbuf_dataptr()); - printf("message length: %u\n", packetbuf_datalen()); - for (i = 0; i < packetbuf_datalen(); i++) { - printf("0x%x ", s[i]); - } - printf("\n"); -} -const static struct abc_callbacks abc_call = {abc_recv}; -static struct abc_conn abc; -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(test_abc_process, ev, data) -{ - static unsigned i; - static struct etimer et; - static int len; - static char buf[32]; - - PROCESS_EXITHANDLER(abc_close(&abc);) - - PROCESS_BEGIN(); - - abc_open(&abc, 128, &abc_call); - - while(1) { - etimer_set(&et, SEND_INTERVAL); - PROCESS_WAIT_EVENT(); - if (etimer_expired(&et) && node_id == SENDER_ID) { - len = snprintf(buf, sizeof (buf), "%u", ++i); - printf("Sending packet %d\n", i); - packetbuf_copyfrom(buf, len + 1); - abc_send(&abc); - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/msb430/apps/test-sht11.c b/platform/msb430/apps/test-sht11.c deleted file mode 100644 index 7ceb6fe13..000000000 --- a/platform/msb430/apps/test-sht11.c +++ /dev/null @@ -1,65 +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. - * - */ - -/** - * \file - * Testing the SHT11 sensor. - * \author - * Nicolas Tsiftes - */ - -#include "contiki.h" -#include "dev/sht11.h" - -#include - -PROCESS(test_sht11_process, "SHT11 test"); -AUTOSTART_PROCESSES(&test_sht11_process); - -PROCESS_THREAD(test_sht11_process, ev, data) -{ - static struct etimer et; - static unsigned rh; - - PROCESS_BEGIN(); - - for (etimer_set(&et, CLOCK_SECOND);; etimer_reset(&et)) { - PROCESS_YIELD(); - printf("Temperature: %u degrees Celsius\n", - (unsigned) (-39.60 + 0.01 * sht11_temp())); - rh = sht11_humidity(); - printf("Rel. humidity: %u%%\n", - (unsigned) (-4 + 0.0405*rh - 2.8e-6*(rh*rh))); - } - - PROCESS_END(); -} diff --git a/platform/msb430/buildscripts/Makefile.freebsd b/platform/msb430/buildscripts/Makefile.freebsd deleted file mode 100644 index 625d3bb81..000000000 --- a/platform/msb430/buildscripts/Makefile.freebsd +++ /dev/null @@ -1,18 +0,0 @@ -ifndef JTAG - JTAG := $(CONTIKI)/platform/$(TARGET)/buildscripts/jtag/pyjtag/jtag.py -endif - -ifndef JTAG_PORT - JTAG_PORT = /dev/ppi0 -endif - -%.u: %.$(TARGET) - $(JTAG) -l $(JTAG_PORT) -m - $(JTAG) -l $(JTAG_PORT) -D -D -S -R 2048 -p $^ - $(JTAG) -l $(JTAG_PORT) -D -r - -r: - $(JTAG) -l $(JTAG_PORT) -r - -erase: - $(JTAG) -l $(JTAG_PORT) -e diff --git a/platform/msb430/buildscripts/Makefile.unix b/platform/msb430/buildscripts/Makefile.unix deleted file mode 100644 index 58f308b79..000000000 --- a/platform/msb430/buildscripts/Makefile.unix +++ /dev/null @@ -1,18 +0,0 @@ -ifndef JTAG - JTAG := $(CONTIKI)/platform/$(TARGET)/buildscripts/jtag/pyjtag/jtag.py -endif - -ifndef JTAG_PORT - JTAG_PORT = /dev/parport0 -endif - -%.u: %.$(TARGET) - $(JTAG) -l $(JTAG_PORT) -m - $(JTAG) -l $(JTAG_PORT) -D -D -S -R 2048 -p $^ - $(JTAG) -l $(JTAG_PORT) -D -r - -r: - $(JTAG) -l $(JTAG_PORT) -r - -erase: - $(JTAG) -l $(JTAG_PORT) -e diff --git a/platform/msb430/buildscripts/Makefile.win b/platform/msb430/buildscripts/Makefile.win deleted file mode 100644 index 3f7928b87..000000000 --- a/platform/msb430/buildscripts/Makefile.win +++ /dev/null @@ -1,15 +0,0 @@ -ifndef JTAG_PORT - JTAG_PORT = LPT1 -endif - -ifdef DEBUG - DEBUG_ARGS = -D -D -D -D -endif - -%.u: %.ihex - msp430-jtag $(DEBUG_ARGS) -l $(JTAG_PORT) -mI $^ - -#CW=cw23 - -#%.u: %.ihex -# $(CW) -d f430p $^ \ No newline at end of file diff --git a/platform/msb430/buildscripts/jtag/pyjtag/_parjtag.so b/platform/msb430/buildscripts/jtag/pyjtag/_parjtag.so deleted file mode 100755 index 3eeec6b8997a83be7f921507593d5ee3d1551235..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 26576 zcmd^oe|%KcweOh_Fvj2vKNM6fM?gt5MntTF;!Q{$&CYf~R43Iui zaKJhpqqN%A+S==VqP6O4t@;X2tp!3!t+p4qZMAAG{%V7XEf*=pqU3(Rd#`im%#f&k z?|t4s@9^34-9Oe|d+oK>UVEQ2nZvFA`PCke$FQ#<#t?(06%!0&8u0Qa-7?KEjeMin z7-O8S+HHE`*an@3vfwjx`wHYGZ60D6Pa+LN72ERwqtRxkS5anSdp^=N?^!Y`3a-m; z51`H_80l*FBY&2ZrwCpEyhQQ~ftZ$a%|ecIqC!V!FmWS39$lkY*q)VnMDm?2HQ=B|jZFR`S)r#gZQmybft8(lVqvq*A0x zq|1?3BAtT-^JHBMq%_V|dmi$mk-p%nW3~c``o4h$TsLYkt`_`%2_td_J5|c3=hWN9 zB4j4p1>ksBp4l^9XW^XpuN6a*N=p}RLL1BDJcdyWrBP=r&qsSV%3Oymk469c zFkU{&BQW0oMEj3t8OGhx{*a9SB~>=wZxnfMQ|(YS=>HAD z z9o5_ljMq{A4iYd&K!-lH(?YoKNSNofDBtDSbX{d*+*`#Q{LBNh_Z2#xr9byLmbs33{TXQj(ypBO zo`U}6mC&=&N1<9bN3ht#;eDA_#w)i&*dmTfbp;dRk;&oUZ_(259Y|*hVpAr!UEM^XdDFn%N5X( zlsh2rDy&c2UK2ro?<^h5Io<)`*9D|}g;GXVt)Cm2k&E`c+AaW1q+cL~U=N-f$nQLi z-w0t50#w-q+Ly^pL)EnlDr)9d8V$4OFPv2|zhPl@b)CPyp}u0)e1C({(6FjC+SU-a z0x_!r#YkJkG8#evG&QabFdJxzd^u<|T)nzsQE*ixZUtkNErEDE7&mG=Dq^b|Y6G!& zus+e=5;SV+YNuT?rC~0(M07W)S=b(Ivs){pZK24jL<~G@I~o>5+k$mgEYWCzoqug( z!`y}bSS%W2DHdy}j>cL8meaK*8h1un6pRNgqczad5^b~zYJ#oNScegc1%qJFFe?#h zX<8C!Nw7rbx?K+-qAdx=BB2g62#F%kqVUH8nNh0~ZH+A$S9&iB2AXWO*mX-|5i96a z)^=1v#K6jyU_)g%*m#o+Q{T}ZbWgM{Xh98;wpB)JFdh%A3O1tG%7CU{9cXDFmxU{v zgN@eGh!vg}>{t_xHN}m%)f9}yjL;emO5RXfE%;alZQ0Nsh&5Y*RcKIFsfjivT7uJz zrr^rNs)m-}>R^k3?$OwSMC;06%m}UxHYTi~)`>lz`O#IzoVoMeW@WKb86y^Gjnh9u z@QHAPBebpD%1YIBiJMZuOJG+Gs09cc`zW~nh|2Q63a)%6v#8|E(36m|6qtAZ_o zj+(k)qoHN2t*bC-1KLmN-JQ865rO_%gRPD29Y%XBx(dQpQ%(*90~t^{L4;Ly);4l# zpqd8JO;(-QO7vA3Z3-HzL+#Xi$f)u!nOo_HSn$vKidrRiedRojHFbtxE4g;D){UBG zm7ZpO<@|ZZ+<0{&9-P$@UDIa7JK7p6YZp_}xovSPRvok&!z|UJbD+gyn`lpGl`8ba zL)ujvICDL1yCz7F)>SQ$l`v*mJZd1(O`NOP-Y)nx!3P9i7o3hm66vlJ3<+)#yc{NAdzIjwg4=NpW_E%slIO_2C4!6Sl2vvqx+;O;rPd{poiJQQHR!-C_n$+Fxb zxJ7WtJY9dT;1z;(g6jjieWT!mf?EWi5PVYb8NufTw+rqPd|7ah;BN%q5Zo{Lu3(?w zLBYd<9}Dt<0q2!3SS08Z94$Cb&=i~`SSmP0aGKzig5`o$g7XDy1?vTG5L_>~QSc7I zI|Vlj-Ya;Y;CBTd6x<^CsNfTVPYOOGxJ~d2Sbuqw48s!KA()4C$NIAcFB9w#d_!FWm3%(@ymf%pVE7G4Kc#+^Y1fLeXv`W*(1>YAujCIHUO;~5d z?+Jb)I11~H^&blU3hRyKe!(}f-dH{+cplan%j*Rn7c9j3VtuLLEWzspzexL?g6CpD z4{T5`c&Fe4g0o;hw$}-MRq%1a=LL@oP6I9J*9kr**dtgCyRtnl_+!DzurKSc5nL(w zl;9fJo$YrB*1+B@-zXRr{ITFmf(5WU>CO;*L~xtnt(a%tWW)Fq=R4jo{z`<6R>6+M z{er_ezY)+U{D)Y~GH8ETrE#a=_fVgQ2Lt=)zrgne-(o#(4Tb+gT4hCb$;ku)K%u@ZoQ>9yo&ifJO9cr0WEKBluUrPw2-^w>JoO2=b<%e9jW=5^UkRM17~=^MaRhU7|iN z_#?sJ30}f=iuUz_KCV-gFB4oOxLI%%*Dcy-2rd@To{JFc@Jx;Mz=PxiJV1Q|$Ia9D5b3Zs|3N$z z{z1K+jqerM4|pB@0eBVaJAEW(g!Ji4fBKVHr zUj>f|j-tP#-*~|b1S3N~|`rFf1ic)#FNf*%NepM00%S)brZ?2qzgf@je#ScB&a zz9V=8?TY%d7$1NQf?pQAS8$i$0l`wn3DD0I3<};S_?qCyf@2sjKwl?l3I0&%;$WOFBiOp^F_H=uwU?OtOeFzCV0Q#&jqhw96|d+!B)Ws1if4* zXs;36C)g*rmVSixZwtO8_(#Diu1~bzCisHj+k&$gXV89w;GKfw>DQ>Q7K{o0tKbCs zJKE<8-Xi#jUI{ z!HWd15WGk5w}KxFo&wp}?<&C$1%0$9>cMLSENBT{K)a#-7Qr&w z3FVkz4ef+-Q1DBFU4l=-PM$Nce`DPex6*El4dZ#@NSvp+o}t?xQjfr=S%&RqGadq~ zX-CAqQM4OyhhU2KK>20%1AdkB0PdySz<!0r$VuAMhRO2bj-!0DnsTpNajH?ZDw| z2lfcgVLkGH6MT~ONG-E8{*>pj^RRzHuO8&_h)Chpf{O+FRv5;xBE);*Slp))zhD?2 z6EPPf0ECa^6X)X|k9Z^Y4Y^riO%VCy% zstl(z!tE>@s!Z15wJaYzj*5q%Y$Lp$<^8J6p~82tyhoMmS>DX@c2(xk;rm#AQk8FD z`9YQ+ROJ;cKg#lERc>PWNtV~645V%9dYHL>L)YW*!A0rh$B<;xb}O%c&$8=Z?Ap9} zvzz8Cq*?#m%`l^pxH6qQsENlX`-=LXZb48MHW^7R&NPHxXnB{|#veQAYh-==+u z1G|&#?MW~H7~I{wF97e_boyh6w&_LdjPyN6$$X#X1@q1%t84rBfwk@l!ED*yEWnp` zUA7D!sh~4C3RTGEr~O5#{7F6UfzieLFvD4${=>TdDC;le zxZ4xcdbWI`GE2JA2R>_b=hJVDo>EP4Lpu2e=V*9RJCnOcr}kXGyen;wwdb&mm3$R6 zX@iX41;2|SxF+pPo^H$IqS>x!dSAml!J&7*(#tS4uThv6X4ILCAIX}>+4elnf`F8> z=PWJYr~w4*OkOa+s8`FVYP9=Kq81;94=4L3L3!Q&qntK0R0KtJ`wvSA8l7$P(i*)- zv4KWQpa%#8M(kFQ*81&W#dRjf{q01JJ%tVz@9TXHaxGob=|5Q4b8Hxe z*asL8+THu_oyo8*T@pqX@7Rr2%=I~CgVAc5=U`K?ZD3E)r)=P|$iXa&+-7su7V+5g zo(w(k2#m=l?Td>lIU|dq#Tk(IY!O zi7Glyy=@RB>Hd$DK}@bm&ZRT?ebMfp(87hN{fX_gXYZSx$tuUQdK_&p!;GQrJ!%4v zfYpXB9ygo`Fs{MaTHA+@BSxYG_ky;MN*lavi>(^*f5j9ND3&-NjxSn%M#(;i`~SdZ z<_yq-NR?6D+2{Z@U%c=7)Sl&Coyk8qGz@iWvDWp}4WUX`TyCp0OWK^pd4rlJ z)OLHL4DEvdsg>EU0wZ0LIJGD=}~KCN6u#iOE>1-HWN z_p2@#dopYbA?>ky{;tM8lct+Ci48rQP(=qbxyCv1!ah{6i_2t&7UB2GuNJ7`uUEq} zl75;JmfC{kC}BM62UWs^0VKEuVmeOqGK{^Uiw~N)bJ&~H6?Ql6EpO<#dL0kI7A1Qb zG<2$JwPwOLki$&hvmUd;ZhT5QFWKYSv^|w)`DnK!>wBNWcG&xRS{2f@RB`{JvAuun zOxD_CCXtblSBH)4;_bcM{Fg4N>lv?vEmgvfOQ*>%y%>?IXw!>{0>oAoS-o4gLyZOA ztvjju&g4zx3o-wUMGh~=PKl+uTbqR(*!CT6nBD1NTHaySnVb5piRqJc@ub9-^z3{D z@&4Mez28n(=hNOtSonQ9`L2?ce8+$jY!OCs?P=_f9pX~F6 zf8pkuKOiG$b`VA{c7e;1y7cmbbfRcUUAV{1%$GdovBu-$)?pC#)ZTFNSe{juJT}Ct z>b)TaeZhr-A)QI~<$Jg8t__dIEk$OIz12?ZlJJ$;O&8cr1>vUb7MVU(Gw}2~gGaBw zQHfrsR9g_fX{meI4aa-mn%5E&K;A12<6Kiq2`rYdbq zal2D2m6TX7a4jl%T~RvW3vbSv@21xiqqTjV86PNt$&Pe+yc-_}BS;k5CKlp)$P_=zXLs&%1Fu>ex~9!rH)NTqjSbwi#~9oyh3xa=2$EGUkMd%*iDN zXPL=wUbme;AhYsAp0 zZbr53iPCNBK^nqo+_!qfHbyb#N30&Y&45>Xy1ZLo(xXq`ar5?Mf4^0s)(}|k=ovr6 z@7sG6+eR&;iPDvK>rwFS9fy%v=iS<+>(y|*Lx08q2~CSWVW2_Qa;}!Ne&lu}xo))K z-8cub(#h}3(%FV}1-$FNb&i@#sylSSI!Mxeh2M9}kn}p=3urS!(~rmNyj$NyZ|s85 zET_<{V|u!#=#KnTFo$YT#a`>Z;E2D#W1UM>Y^ zd?hnqtK zO4OdJgd4*l?bWYU)ktm5E;6_7pu4k+?LpCLxeA2%y1g}P@>O1Md2w~U7L;1+4F2pD_o!HoSAIu)$B0} z!Z&Bgpta<&;j4!}ha;Ae&VOM2N&p`V%6W84hO|F18Z&_=_x8})?X#(nGW<Lg`JgE3SLaIG1=MNRd7cT?XATt%Cl0o8yD# zeA1ksOQY0Sl~bGAlXWlRYaXpQJx5jKxQ|fE{ z{j`juRA3BEw2SUFr99KbSe9vG1W_gUjnk5ocf2b}X5!+Qfzr?PuEZBkki_PR9F_uHl@I-W=SbD)F4Np}Qp~Kgtz_|x{Cz((VuHv$MXi@z%3$_JbFBF;R)_HNHB%V z_VTMI#t=Py9mMrbtP)J!jpNM1yYbHWaYso5#yDFAIokQu#g^>N`^@#`HnyVy_u7Lt zs%(8ehYZ6>X!pF{KP7+d>CFSI^BIZ!zyGec5VuG;MTRb! z#*?1JL9inedpeG(+)B@(8I1m)t#^<0dHQ}P4Kz_nRowPBe09btR*R)Gkt=tP^r>YZ zn*O0RR4sMaDKX;?i6Y$2Iqu--%H{FCQ1X~B!JPmBw*VTIfqlIrb=_E39V81UF`0~T z?zpunr={D8b&kGN$6QIrLPp#XU|}SC)P0VkQXe_?bIF}0F32kF!84xqVH~#=po8;x zx8~12Q5rXQZGjJCzsfjRuCREhm?*$gPgPH{LG*dt(WetixQ0caXMBb}(EC%LwIR$wJS~Q8xr?DgG6NBSPat0Q^#|RO5~tVF-n5)V~;s5?3=k5 z56i7G99e#^oJEW}hm%Pj{bY?gIbEMQBhiw@pbW<|b=zp2-Z89wCQ}PawM6aROX<9r z;Xma+gxgs>#lW|Dedub0y8U>*=iRDq9kidOcC){F5_H77kv|XZ#e-2S5C5Us@Ee&? zz=1>{K2QcC%Fw+WXGr}(6UWNt<}inFZb9*lQfRvWeQ%N;;obU+RL#3GaA)l|!T$Yp z&ATN#rvGwvUh0>rSG-$aV_oNx<{^IE$>!J9E>gY~>aNE91Rk>-3Z<$GQb$93dypyQ zZ5`w*%1EFMu*<|#iRAX?y*(-a{$@|Jr$4b@OO*2WL3SKb@ia_kcR71&2eSPb=6Nx> zuFpu+aDp*RG;?2|PW5jgZiYPT4k5jtoXH96yM+D(X6Jvuw*NF%VWe~oreE{E_qLPN zvkT|eydWIT2%Yx#xq=ji)sy@DmI2xRL*VB$Q!9lRfl6e z6dz~b3Sou0g@+(UsUk*p--o(x^D-&`e|7fXxP7f!_b0GdcTDGVP%W++ly^+d<7xyQ z{9#Z*mJFYIwEE0*)qp+$NvFT+y?49!C)?*_1sH7jIAY>Sr~iTP zolYoo{0y4*lhYj>HIH+uE<~G-8388sh)o5*7sE;%_tumLhQ{RLmx`pUMU&{OQ3@JD=;M*?ia7Q6-GP_ z&N7n+4t5yPe@}?NNT87TgUI_am(C>rG_$k)<8=AQy#m~qSmrG4GU+$1P!6=R~tZ!fz}{Y=19c19`FSZMsXxk zf}i&{2HUMjl!`U&7b46kG@N%az+1%D#U+LQHug065&$#M)&%jD7noL5R8(fxha+(_ zZbjSUX2dEhR7ILxjbUqr0|lF)A1FU)CgOOL1o(BBQP?o1+1q_e3uzyiR=3&JadSu>8SrQdb#)}G-}AMm1|wx@!H$f>t8dX5zghi6AW$fFyi* z30%kuD_M(I;>|I!juK_nvckC*$=ajwc!WBFcdI1`wMW`vwm=JHT2xVELeFc0@Is)n zOj#kroLZI{;ZajkI2oUl%`gbT3}L|*p_EI=f~Qa%dbtW7pixW)l0+~1&moHT6??_0 zAmyw$GU133OX~pADT3k>8UQ67v_I!0oFLZ{Y+Gf8%L?_|PE73qcAO2Yir}3fYLf9p zdwUC2Ms;KifRLq}WYFl>Zl(iv*>rzvXIddw4 z6W=;*a+mdK^pT(vCVAZp2rXqXe-34i<~jxU`j4X z1OJQjH9C>iL31Ud!A-QL$cBih;ujU$`K2BQh=QMD?1VU1(^w};D!*A#6`Q1dEG>eB+& zDVHrO!8gQ_umz}*7*-Gk)SjtNH^tn{OLg!mDXg>)JxVXF5n$dc)Ya>%Z683{u zOQ9Vr&{D#H2hUP!i5IR3M;Iibln~Dz>`E!19!x27w&5F|^n11xt(?@%Vjl8lnCHez zT(r=x)}EWx)vop_`&3qpvm83`I117KrNo$}4sv>>gahzvEDCi9(~HDdK=0>UyXLk* zQHT)EA*mQrEN;804Q?vYD{D|VZdOclHEO*N*2+Cm+Lkmny1MC!=q6XSUYvt*izOWC zRHTjQEj(vZYKkVDh_A}hp4J*~U)9(+!<3gp;XPMnWw6nJjePml0IhfrRKp@aUdm=h zZ_4etsIGp{HjL$J!|w^5!@J8bWWt#vzMD=T@&_Ps@j?uCOjL|TF4Vk7;GP3d3pTm^ z%w-ojRAE!Z``CB{Z0z8g8BjNK9akPeL!w;u!ZFo6Fb^jZ6i-=u?%Gn5pC!2(t>pax zH)@gHbOXLLHZiHkW~t}4DE4O=1JkcKdgP1YvMp{qliJ{PDLjPZb5i8CJG+y>?KSGYk!R4sZLVpS^5u4#)1W$4@8OGsE+&N8dXh2qISO1qMJ^?`dJo*- za^W?5&YR&rZ9Gk<-xl|2bk%xOS0pqdcaa&|oO7%6{Sm^-AT1{}R4%ArG#@*_lxb_- zZSWN{6u{O3f6uUzSIiC2Qiqq%4N$F|EW{fsdRT^0rhX-E4mgObQSn+h4>yVGCT0d# zrxMRa<6pFB;i4J#T|x&QLD@bb)^4}^c2!gq!Skkpk|lo!s^*{90aUuSxz?i^Wuu>YybnCGeTiigj~r}1#9=Zx|< z`^T2Q(LbZSIqwJe!{;VFRbKvZvF8U@!*)-XdOn#*x?-Uw#W3^yx{|uF$)1U~ffv3C z^2mtUfbscrOkP>zyT+bgUTAzB;}?6*EPt*4*-E_8qx{Pg&P*Q98uN_g2NN+$Sv-t; zZ#+dc%J8TvY?L*1w8cAGHCi#F4ELmE2(@wCXJr){(1wE?>2;>P#WKoxvNy`C;97ig zw?R{s&$o=SV7MW~=h8-5qZN(CF@T2VMlb@CKx?EC14PjgA7zT0?unPW>Ir|2&r?9d z_&^mgRxpi2KoFIw7{WNhctBd#GlnpgBcK3OJ!yPMXCSeTbc{Jnj5YRU8wtx!#S79g zRxtend3#(UQyCKD3-gRIOjD5O802NMo{9X)NTg$|Vq&afnHT98v#OD7I>t68#yrxo z-lkiKJoz(bGNv+(LEgUXap9g0-5aK1Fs-*Ii8j(PajDt-`2RaFm1AAn7j?%Ae}?SP zF@`gpsao`hJ#Ikg`1b^iK}^d=We7>f@gjnpAOD{SCYuMUoIE{-^wg`dLMQ6WzU)3< zMukmRumU<|vWb8;-3H`sIv;45>^3wx`P-4Fjydk=6*|2tWq_h1|GSZFetjzpgQ*yG z_C?-I_afPJqXXcF6t;= section.sh_addr + section.sh_size) \ - and (not (section.sh_flags & ELFSection.SHF_ALLOC and section.sh_type != ELFSection.SHT_NOBITS) \ - or (p.p_offset <= section.sh_offset \ - and (p.p_offset + p.p_filesz >= section.sh_offset + section.sh_size)))): - return section.sh_addr + p.p_paddr - p.p_vaddr - return section.sh_addr - - def getSections(self): - """get sections relevant for the application""" - res = [] - for section in self.sections: - if section.sh_flags & ELFSection.SHF_ALLOC and section.sh_type != ELFSection.SHT_NOBITS: - res.append(section) - return res - - def __str__(self): - """pretty print for debug...""" - return "%s(self.e_type=%r, self.e_machine=%r, self.e_version=%r, sections=%r)" % ( - self.__class__.__name__, - self.e_type, self.e_machine, self.e_version, - [section.name for section in self.sections]) - - -if __name__ == '__main__': - print "This is only a module test!" - elf = ELFObject() - elf.fromFile(open("test.elf")) - if elf.e_type != ELFObject.ET_EXEC: - raise Exception("No executable") - print elf - - #~ print repr(elf.getSection('.text').data) - #~ print [(s.name, hex(s.sh_addr)) for s in elf.getSections()] - print "-"*20 - for p in elf.sections: print p - print "-"*20 - for p in elf.getSections(): print p - print "-"*20 - for p in elf.getProgrammableSections(): print p diff --git a/platform/msb430/buildscripts/jtag/pyjtag/elf.pyc b/platform/msb430/buildscripts/jtag/pyjtag/elf.pyc deleted file mode 100644 index 10662cddbe57243d227d75f3ecac8a6bad2f77ee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9708 zcmcgyOHfV-}j%ZD`Dd%?wAPl^Pk5(=iLAO z|A*gwHQ4u`KR%i(s_@f`zwh9yCoQE)__frQQh6XT>e)Rc!=aILROfe`=|!nR08sG>V0q93@fg-uoI7s9_#wQyL0L?7UWtv5=9{9Ct zL`o1)-5@DRQxC6ZDJPc#u2M08fZeWJEmS<$4f>=}sg-uhXqs8*QiADQz-BgU6>p|` zKbR@js)4`dUnrKnLUpEIE(GhfMrEd=*REcF}6fy0o#{80sF5}8zB8j)ipF4>}w0yMlr$u3k&whn3y&o0>7yq@mI;9CpP$4687 zz?i_ez%GFaf!zXo1ojF9(akha+#n#jK|uF7B$qFz zZGa+Z6o4{S?-Sdr)Pvm?jqKXmJyHvE%-d#DLqG%4L2rt{w(wxL?ui_uf4yAT(5-<& zsniHaE)3Mx*R>b4MzsH_*TTzwb*qK@)%BX_5}x4Gg|fd<72!mOR}JJj9zI*EdI1q? zjv%E%PzcD3a;1G+cEpSV{a8DM zbnFxZL3gV4LUGIJe|i1NWjD83YB;2B6s53tFB0&co@;A9UveNXa*UMs17T2FR5xnu;8LkV8nR6A1&bk zlzyBKh+;wSiHl-E^NA+~3Jak8>=_U^C~!!v52*26igeSH0QCkWe%G#p`hgAWY?r*X zosH?~Y5gTe&*;<{ecpy(Q-Q9BxF}GoK^3@uv3cg=)uv1|O4Qjyg=o#DBDHWTQVWk1 zsnroGk~E<$;d*CJ8S(uVd4Wlh;?7GErL2K7_$YY274voU|i;HszkBOFw z%p8!kP;6Zn!tT1XW17;cV)1y=N?C`kqgLuAw9UIvio^)HZmCwp8`6o0is$B6-0b^{ zi(;18Saz0f-B?)3iO#Sicjxv>`bN9C;;>0|;i!{YOh=9RbZ$PN=5S>8PBwje;bt_L zU0TURt7MmC557XUim*WTn_paLZ--TIfatl!C7kbO)SO?~(_CD7KbLVjMx{xm&dtxc ztIh&W&}yX@7qJlaiDQ`$GdCBqxfLg*!<>6NoqLaqJENH5(BC@80NT71>_wVfhvxkU z`0C35-4=f00*USa6ASxe$z-xS7{OzRa+VvljYgp|FD8;kL_U=18~Ex^0A5(EgGdNI z7qJmy9mGk9b^0YzLAWy@2qKS85DSL&U?MBTkFVFneY?$!n8qjh)PFMIk^QR=!|@hTDCj#28a1Q^DM zQ8*6TB#EwkfsHghtcqW62MQ4b7BH|+pkNsBJb^+xI5>eNjTnVt0o}vi*g)L*80I-g zxIgKhk$7O4@xUbxQ0bg21Xl@OBe+KJJ%aB8w4(rLf=zr6Aa|ju`5C@Xx_+KnL^uuP zY1dD8-SYCppY7z=lXT+}R{d``Uc*Lk<3={cowj5%^3kDucC2_~L%bad zgmQ}hv!W3Wk7XR!H|30YY{q8?#1xwTU*IdzgK@G);bc?d9AtCS(-DvRIxx}8<`KO2jvk_?q?ThOC*CkzVR?Sm5eFu#iR%j&2pu8SZh6ji zBsl=G+Co137TwrI90D4y^veL^pq_SPrYDx{hTGyRz-=u_Mpi^aK9RrrJDM-dUm>HH z9FhJCUJL#T89kg8{1`kHGI!+W$lQ^eVln@#J!*U%_biAs6Q ztsA=`Uf)EX5#qW7H-3|9hxwb5iqmU&ZhbS%D53?bI~56YJy$<5rZ+i8Q_V5N=G9X3 zTk*Po!j{HkBqTW}6(W{?1>*#bjM79T=kOKmkxC1)#79ztWX5jz{p{MyvpC9r^X#xl z%!t540uK|yBf)Dyi>9DMEO36LEYnRmswVkoOh(e3BS*~0xQx8oIWnOpOGtQ4tu%mE zqPiN@N;gbUHz`{WtJ*K|BwqWNwEH;GYJQ=Dm%?$hXYXqDP%0OpBSrlb2S)i&2o)Sx z{t5PsP2fGA=$m>7dLCDglzIq~b}9d)dJvaQ*f^zXW9HzK%C|Yr?YCdC_?3cdc-kq} zO~Nzw%cSQ0))^16J$u*Nd&Uv=w$J#o@?T+3=NVgla>keCj9@S7%LP2Z$ zuhwew6QRr$wk)fMC>EH5bu0h09L&hj1GLYu{Sbu&{B|q%JB0qLD!{%eseX^+-BH{= z%X4BXC!LdeHaY%Xw!_}@YWt1YYBL?}d`)(i({b)$HR+q>FQ`)w5i<6+R|QWdx$?By z{(Wo}#o1hnx~%5_j7=?on7KIvx>W1gg`#TJQ zOwP=xT5NTpUiYfzC0liBNqD6c(NTS)dos1TQ+$*Q>w4KY1|Rg@@wBXmYT)ASv{YJ5 zfrjTx(d?Nz9Ydy&w_=aOO=+Hmg(N)%q#h0!qg_TBSMCUeJR$DzOy(p(p%J9edhv0; z9EQceISAxmu!APgRZq9oj7?a_@H1hJptjQ&8?i>0+#CT< z@oCMdx3e0%wrjJTrpc`7z-tCslPayDEp;?`O!#8TYFijMATrYT;%qs?MnpJaQ?tG zRr`6=g;_mnf^N$=vtBiEFQIA;Oh8|fMFCX3-{HM0I|ig4mubNd5-(X}|7Jeh@ z!onkFVMIO{4;P*^>tHiE-vs|8)X_+tIJFysgV;=E#kZsw*c+x^B__#lo3m1zpjk6z z2{CnYe?f6}E)Y-wozn!gyT+=rkkJ+hhpOk)*@y3oH)9S};1IdaI))0hZWN|y)S9x+ z2s~jut%dYip%%_Xa`0wb4vZGQQ#)&{bUl;0dzH+oVSOR&!O&FPbK9orQ;|}k{!6oVno5OEF>I6zQL0-& zpgs(o@M{orE7YnJf#6-Rdz_Jg2N)4@qYct_tHayp)lcx>5Q%SCEy`d!REu~eIc*ZN z>t`Cc*D>udJL~KUQ?#&4ysk#$tYJXA1~iX_JEEX{oQimK_oGX950D8`{eP8|@5Omk zEDryQ0?-r>N76ggV^aY709Y%$x}Cmtu>-%bI6&8+ochrgvxwOM8 zUkQm?z1OaGMu{@#W6oiY+zK6U=WdufQw5z)m0+8IHo<8S9P||mqy1mutKSAd?J2g; z6-w*U#9XPERtS?l$v04w8b}T$dnF)qQC9G)xMgEyZ)MZhHhyc>@~&O5%|Ei(aLmD! z2nDfeh`Z*kQnuFN-o^c1Kz7?{cEwmo@^E3F&+`wYMzFl(8AfDU|Ewe7yNR{MnUF>z zvJxENybjqVI#ff9Zn6&81m%dT(N`Gek(X@?XO2%J^Md|sM`-w#q3YYzCOr)>@aA}I e^tI7*qhAhM35jV(5#1)b6103OiN3*(zyAe^ldiM? diff --git a/platform/msb430/buildscripts/jtag/pyjtag/gen-ihex.py b/platform/msb430/buildscripts/jtag/pyjtag/gen-ihex.py deleted file mode 100644 index c917ec975..000000000 --- a/platform/msb430/buildscripts/jtag/pyjtag/gen-ihex.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python -"""Test File generator. -This tool generates a hex file, of given size, ending on address -0xffff. - -USAGE: hen-ihex.py size_in_kilobyte - -The resulting Intel-hex file is output to stdout, use redirection -to save the data to a file. -""" - -#return a string with data in intel hex format -def makeihex(address, data): - out = [] - start = 0 - while start len(data): end = len(data) - out.append(_ihexline(address, [ord(x) for x in data[start:end]])) - start += 16 - address += 16 - out.append(_ihexline(address, [], end=1)) #append no data but an end line - return ''.join(out) - -def _ihexline(address, buffer, end=0): - out = [] - if end: - type = 1 - else: - type = 0 - out.append( ':%02X%04X%02X' % (len(buffer),address&0xffff,type) ) - sum = len(buffer) + ((address>>8)&255) + (address&255) - for b in buffer: - if b == None: b = 0 #substitute nonexistent values with zero - out.append('%02X' % (b&255) ) - sum += b&255 - out.append('%02X\n' %( (-sum)&255)) - return ''.join(out) - -if __name__ == '__main__': - import struct, sys - if len(sys.argv) != 2: - print __doc__ - sys.exit(1) - - size = int(sys.argv[1]) #in kilo - startadr = 0x10000 - 1024*size - data = ''.join([struct.pack(">H", x) for x in range(startadr, startadr+ 1024*size, 2)]) - print makeihex(startadr, data) diff --git a/platform/msb430/buildscripts/jtag/pyjtag/install-pyjtag.nsi b/platform/msb430/buildscripts/jtag/pyjtag/install-pyjtag.nsi deleted file mode 100644 index a2cb801b8..000000000 --- a/platform/msb430/buildscripts/jtag/pyjtag/install-pyjtag.nsi +++ /dev/null @@ -1,108 +0,0 @@ -Name "install-pyjtag" -OutFile "install-pyjtag.exe" - -!define SF_SELECTED 1 -!define SF_SUBSEC 2 -!define SF_SUBSECEND 4 -!define SF_BOLD 8 -!define SF_RO 16 -!define SF_EXPAND 32 - -!define SECTION_OFF 0xFFFFFFFE - -LicenseText License -LicenseData license.txt - -SetOverwrite on -SetDateSave on - -; The default installation directory -InstallDir $PROGRAMFILES\mspgcc -; Registry key to check for directory (so if you install again, it will -; overwrite the old one automatically) -InstallDirRegKey HKLM SOFTWARE\mspgcc "rootdir" - -; The text to prompt the user to enter a directory -DirText "This will install the pyjtag executables. You can choose the same \ - directory as for the other mspgcc tools." - -; The text to prompt the user to enter a directory -ComponentText "Select which optional things you want installed." - -Section "msp430-jtag (required)" - SectionIn RO - SetOutPath $INSTDIR - - File /r bin - File /oname=license-pyjtag.txt license.txt - File /oname=readme-pyjtag.txt readme.txt - File /oname=bin\jtag.py jtag.py - - ; Write the installation path into the registry - WriteRegStr HKLM SOFTWARE\mspgcc "rootdir" "$INSTDIR" - ; Write the uninstall keys for Windows - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mspgcc-pyjtag" "DisplayName" "mspgcc pyjtag (remove only)" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mspgcc-pyjtag" "UninstallString" '"$INSTDIR\uninstall-pyjtag.exe"' - WriteUninstaller "uninstall-pyjtag.exe" -SectionEnd - -Section "giveio (needed on Win NT/2k/XP, but NOT on 9x/ME)" - SetOutPath $INSTDIR\bin - File ..\jtag\hardware_access\giveio\giveio.sys - File ..\jtag\hardware_access\giveio\loaddrv.exe - SetOutPath $INSTDIR - nsExec::ExecToLog '$INSTDIR\bin\loaddrv.exe install giveio $INSTDIR\bin\giveio.sys' - Pop $0 ;return value/error/timeout - IntCmp $0 2 ext_here ;assume its alredy installed - IntCmp $0 0 0 ext_err ext_err ;if not 0 -> error - nsExec::ExecToLog '$INSTDIR\bin\loaddrv.exe start giveio' - Pop $0 ;return value/error/timeout - IntCmp $0 0 0 ext_err ext_err ;if not 0 -> error - nsExec::ExecToLog '$INSTDIR\bin\loaddrv.exe starttype giveio auto' - Pop $0 ;return value/error/timeout - IntCmp $0 0 0 ext_err ext_err ;if not 0 -> error - WriteRegStr HKLM SOFTWARE\mspgcc "giveio" "started" - Goto ext_ok -ext_err: - DetailPrint "Error while installing and starting giveio" - MessageBox MB_OK|MB_ICONSTOP "Error while installing and starting giveio" - Goto ext_ok -ext_here: - DetailPrint "Installing giveio gave an error, assuming its already installed" -ext_ok: -SectionEnd - -; special uninstall section. -Section "Uninstall" - ; remove registry keys - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\mspgcc-pyjtag" - DeleteRegKey HKLM SOFTWARE\NSIS_Example2 - ; remove files - Delete $INSTDIR\bin\msp430-jtag.exe - Delete $INSTDIR\bin\_parjtag.pyd - Delete $INSTDIR\bin\jtag.py - Delete $INSTDIR\bin\HIL.dll - Delete $INSTDIR\bin\MSP430mspgcc.dll - ;XXX python22.dll is left installed as it is used by pybsl and other tools - Delete $INSTDIR\license-pyjtag.txt - Delete $INSTDIR\readme-pyjtag.txt - ; giveio - ; if it was started by us, stop it - ReadRegStr $0 HKLM SOFTWARE\mspgcc "giveio" - StrCmp $0 '' no_giveio - nsExec::ExecToLog '$INSTDIR\bin\loaddrv.exe stop giveio' - Pop $0 ;return value/error/timeout - IntCmp $0 0 0 giveio_err giveio_err ;if not 0 -> error - nsExec::ExecToLog '$INSTDIR\bin\loaddrv.exe remove giveio' - Pop $0 ;return value/error/timeout - IntCmp $0 0 0 giveio_err giveio_err ;if not 0 -> error - Goto no_giveio -giveio_err: - DetailPrint "Error while uninstalling giveio service" - MessageBox MB_OK|MB_ICONSTOP "Error while uninstalling giveio service" -no_giveio: - Delete loaddrv.exe - Delete giveio.sys - ; MUST REMOVE UNINSTALLER, too - Delete $INSTDIR\uninstall-pyjtag.exe -SectionEnd diff --git a/platform/msb430/buildscripts/jtag/pyjtag/jtag.py b/platform/msb430/buildscripts/jtag/pyjtag/jtag.py deleted file mode 100755 index 0cb556a91..000000000 --- a/platform/msb430/buildscripts/jtag/pyjtag/jtag.py +++ /dev/null @@ -1,604 +0,0 @@ -#!/usr/bin/env python -#Parallel JTAG programmer for the MSP430 embedded proccessor. -# -#(C) 2002 Chris Liechti -#this is distributed under a free software license, see license.txt -# -#Requires Python 2+ and the binary extension _parjtag. - -import sys -import _parjtag - -VERSION = "1.3" - -DEBUG = 0 #disable debug messages by default - - -#frame specific consts -ERASE_MASS = 2 -ERASE_MAIN = 1 -ERASE_SGMT = 0 - -#states -FREERUNNING = 0 -STOPPED = 1 - -#Configurations of the MSP430 driver -VERIFICATION_MODE = 0 #Verify data downloaded to FLASH memories. -RAMSIZE_OPTION = 1 #Change RAM used to download and program flash blocks -DEBUG_OPTION = 2 #Set debug level. Enables debug outputs. - -#enumeration of output formats for uploads -HEX = 0 -INTELHEX = 1 -BINARY = 2 - -#exceptions -class JTAGException(Exception): pass - -#for the use with memread -def hexdump( (adr, memstr) ): - """Print a hex dump of data collected with memread - arg1: tuple with adress, memory - return None""" - count = 0 - ascii = '' - for value in map(ord, memstr): - if not count: print "%04x: " % adr, - print "%02x" % value, - ascii += (32 <= value < 128) and chr(value) or '.' - count += 1 - adr += 1 - if count == 16: - count = 0 - print " ", ascii - ascii = '' - if count < 16: print " "*(16-count), " ", ascii - -def makeihex( (address, data) ): - """work though the data and output lines in inzel hex format. - and end tag is appended""" - start = 0 - while start len(data): end = len(data) - _ihexline(address, [ord(x) for x in data[start:end]]) - start += 16 - address += 16 - _ihexline(address, [], type=1) #append no data but an end line - -def _ihexline(address, buffer, type=0): - """encode one line, output with checksum""" - sys.stdout.write( ':%02X%04X%02X' % (len(buffer), address & 0xffff, type) ) - sum = len(buffer) + ((address >> 8) & 255) + (address & 255) - for b in buffer: - if b == None: b = 0 #substitute nonexistent values with zero - sys.stdout.write('%02X' % (b & 255)) - sum += b&255 - sys.stdout.write('%02X\n' %( (-sum) & 255)) - - -class Segment: - """store a string with memory contents along with its startaddress""" - def __init__(self, startaddress = 0, data=None): - if data is None: - self.data = '' - else: - self.data = data - self.startaddress = startaddress - - def __getitem__(self, index): - return self.data[index] - - def __len__(self): - return len(self.data) - - def __repr__(self): - return "Segment(startaddress = 0x%04x, data=%r)" % (self.startaddress, self.data) - -class Memory: - """represent memory contents. with functions to load files""" - def __init__(self, filename=None): - self.segments = [] - if filename: - self.filename = filename - self.loadFile(filename) - - def append(self, seg): - self.segments.append(seg) - - def __getitem__(self, index): - return self.segments[index] - - def __len__(self): - return len(self.segments) - - def loadIHex(self, file): - """load data from a (opened) file in Intel-HEX format""" - segmentdata = [] - currentAddr = 0 - startAddr = 0 - lines = file.readlines() - for l in lines: - if not l.strip(): continue #skip empty lines - if l[0] != ':': raise Exception("File Format Error\n") - l = l.strip() #fix CR-LF issues... - length = int(l[1:3],16) - address = int(l[3:7],16) - type = int(l[7:9],16) - check = int(l[-2:],16) - if type == 0x00: - if currentAddr != address: - if segmentdata: - self.segments.append( Segment(startAddr, ''.join(segmentdata)) ) - startAddr = currentAddr = address - segmentdata = [] - for i in range(length): - segmentdata.append( chr(int(l[9+2*i:11+2*i],16)) ) - currentAddr = length + currentAddr - elif type == 0x01: - pass - else: - sys.stderr.write("Ignored unknown field (type 0x%02x) in ihex file.\n" % type) - if segmentdata: - self.segments.append( Segment(startAddr, ''.join(segmentdata)) ) - - def loadTIText(self, file): - """load data from a (opened) file in TI-Text format""" - next = 1 - currentAddr = 0 - startAddr = 0 - segmentdata = [] - #Convert data for MSP430, TXT-File is parsed line by line - while next >= 1: - #Read one line - l = file.readline() - if not l: break #EOF - l = l.strip() - if l[0] == 'q': break - elif l[0] == '@': #if @ => new address => send frame and set new addr. - #create a new segment - if segmentdata: - self.segments.append( Segment(startAddr, ''.join(segmentdata)) ) - startAddr = currentAddr = int(l[1:],16) - segmentdata = [] - else: - for i in l.split(): - segmentdata.append(chr(int(i,16))) - if segmentdata: - self.segments.append( Segment(startAddr, ''.join(segmentdata)) ) - - def loadELF(self, file): - """load data from a (opened) file in ELF object format. - File must be seekable""" - import elf - obj = elf.ELFObject() - obj.fromFile(file) - if obj.e_type != elf.ELFObject.ET_EXEC: - raise Exception("No executable") - for section in obj.getSections(): - if DEBUG: - sys.stderr.write("ELF section %s at 0x%04x %d bytes\n" % (section.name, section.lma, len(section.data))) - if len(section.data): - self.segments.append( Segment(section.lma, section.data) ) - - def loadFile(self, filename): - """fill memory with the contents of a file. file type is determined from extension""" - #TODO: do a contents based detection - if filename[-4:].lower() == '.txt': - self.loadTIText(open(filename, "rb")) - elif filename[-4:].lower() in ('.a43', '.hex'): - self.loadIHex(open(filename, "rb")) - else: - self.loadELF(open(filename, "rb")) - - def getMemrange(self, fromadr, toadr): - """get a range of bytes from the memory. unavailable values are filled with 0xff.""" - res = '' - toadr = toadr + 1 #python indxes are excluding end, so include it - while fromadr < toadr: - for seg in self.segments: - segend = seg.startaddress + len(seg.data) - if seg.startaddress <= fromadr and fromadr < segend: - if toadr > segend: #not all data in segment - catchlength = segend-fromadr - else: - catchlength = toadr-fromadr - res = res + seg.data[fromadr-seg.startaddress : fromadr-seg.startaddress+catchlength] - fromadr = fromadr + catchlength #adjust start - if len(res) >= toadr-fromadr: - break #return res - else: #undefined memory is filled with 0xff - res = res + chr(255) - fromadr = fromadr + 1 #adjust start - return res - -class JTAG: - """wrap the _parjtag extension""" - - def __init__(self): - self.showprogess = 0 - - def connect(self, lpt=None): - """connect to specified or default port""" - if lpt is None: - _parjtag.connect() - else: - _parjtag.connect(lpt) - - def close(self): - """release JTAG""" - _parjtag.release() - - def uploadData(self, startaddress, size): - """upload a datablock""" - if DEBUG > 1: sys.stderr.write("* uploadData()\n") - return _parjtag.memread(startaddress, size) - - def actionMassErase(self): - """Erase the flash memory completely (with mass erase command)""" - sys.stderr.write("Mass Erase...\n") - _parjtag.memerase(ERASE_MASS) - - def actionMainErase(self): - """Erase the MAIN flash memory, leave the INFO mem""" - sys.stderr.write("Erase Main Flash...\n") - _parjtag.memerase(ERASE_MAIN, 0xfffe) - - def makeActionSegmentErase(self, address): - """Selective segment erase""" - class SegmentEraser: - def __init__(self, segaddr): - self.address = segaddr - def __call__(self): - sys.stderr.write("Erase Segment @ 0x%04x...\n" % self.address) - _parjtag.memerase(ERASE_SGMT, self.address) - return SegmentEraser(address) - - def actionEraseCheck(self): - """check the erasure of required flash cells.""" - sys.stderr.write("Erase Check by file ...\n") - if self.data is not None: - for seg in self.data: - data = _parjtag.memread(seg.startaddress, len(seg.data)) - if data != '\xff'*len(seg.data): raise JTAGException("Erase check failed") - else: - raise JTAGException("cannot do erase check against data with not knowing the actual data") - - def progess_update(self, count, total): - sys.stderr.write("\r%d%%" % (100*count/total)) - - def actionProgram(self): - """program data into flash memory.""" - if self.data is not None: - sys.stderr.write("Program ...\n") - if self.showprogess: - _parjtag.set_flash_callback(self.progess_update) - bytes = 0 - for seg in self.data: - _parjtag.memwrite(seg.startaddress, seg.data) - bytes += len(seg.data) - if self.showprogess: - sys.stderr.write("\r") - sys.stderr.write("%i bytes programmed.\n" % bytes) - else: - raise JTAGException("programming without data not possible") - - def actionVerify(self): - """Verify programmed data""" - if self.data is not None: - sys.stderr.write("Verify ...\n") - for seg in self.data: - data = _parjtag.memread(seg.startaddress, len(seg.data)) - if data != seg.data: raise JTAGException("Verify failed") - else: - raise JTAGException("verify without data not possible") - - def actionReset(self): - """perform a reset""" - sys.stderr.write("Reset device ...\n") - _parjtag.reset(0, 0) - - def actionRun(self, address): - """start program at specified address""" - raise NotImplementedError - #sys.stderr.write("Load PC with 0x%04x ...\n" % address) - - def funclet(self): - """download and start funclet""" - sys.stderr.write("Download and execute of funclet...\n") - if len(self.data) > 1: - raise JTAGException("don't know how to handle multiple segments in funclets") - _parjtag.funclet(self.data[0].data) - sys.stderr.write("Funclet OK.\n") - -def usage(): - """print some help message""" - sys.stderr.write(""" -USAGE: %s [options] [file] -Version: %s - -If "-" is specified as file the data is read from the stdinput. -A file ending with ".txt" is considered to be in TIText format all -other filenames are considered IntelHex. - -General options: - -h, --help Show this help screen. - -l, --lpt=name Specify an other parallel port. - (defaults to LPT1 (/dev/parport0 on unix) - -D, --debug Increase level of debug messages. This won't be - very useful for the average user... - -I, --intelhex Force fileformat to IntelHex - -T, --titext Force fileformat to be TIText - -f, --funclet The given file is a funclet (a small program to - be run in RAM) - -R, --ramsize Specify the amont of RAM to be used to program - flash (default 256). - -Program Flow Specifiers: - - -e, --masserase Mass Erase (clear all flash memory) - -m, --mainerase Erase main flash memory only - --eraseinfo Erase info flash memory only (0x1000-0x10ff) - --erase=address Selectively erase segment at the specified address - -E, --erasecheck Erase Check by file - -p, --program Program file - -v, --verify Verify by file - -The order of the above options matters! The table is ordered by normal -execution order. For the options "Epv" a file must be specified. -Program flow specifiers default to "p" if a file is given. -Don't forget to specify "e" or "eE" when programming flash! -"p" already verifies the programmed data, "v" adds an additional -verification though uploading the written data for a 1:1 compare. -No default action is taken if "p" and/or "v" is given, say specifying -only "v" does a check by file of a programmed device. - -Data retreiving: - -u, --upload=addr Upload a datablock (see also: -s). - -s, --size=num Size of the data block do upload. (Default is 2) - -x, --hex Show a hexadecimal display of the uploaded data. - (Default) - -b, --bin Get binary uploaded data. This can be used - to redirect the output into a file. - -i, --ihex Uploaded data is output in Intel HEX format. - This can be used to clone a device. - -Do before exit: - -g, --go=address Start programm execution at specified address. - This implies option "w" (wait) - -r, --reset Reset connected MSP430. Starts application. - This is a normal device reset and will start - the programm that is specified in the reset - interrupt vector. (see also -g) - -w, --wait Wait for before closing parallel port. -""" % (sys.argv[0], VERSION)) - -def main(): - global DEBUG - import getopt - filetype = None - filename = None - reset = 0 - wait = 0 - goaddr = None - jtag = JTAG() - toinit = [] - todo = [] - startaddr = None - size = 2 - outputformat= HEX - lpt = None - funclet = None - ramsize = None - - sys.stderr.write("MSP430 parallel JTAG programmer Version: %s\n" % VERSION) - try: - opts, args = getopt.getopt(sys.argv[1:], - "hl:weEmpvrg:Du:d:s:xbiITfR:S", - ["help", "lpt=", "wait" - "masserase", "erasecheck", "mainerase", "program", - "erase=", "eraseinfo", - "verify", "reset", "go=", "debug", - "upload=", "download=", "size=", "hex", "bin", "ihex", - "intelhex", "titext", "funclet", "ramsize=", "progress"] - ) - except getopt.GetoptError: - # print help information and exit: - usage() - sys.exit(2) - - for o, a in opts: - if o in ("-h", "--help"): - usage() - sys.exit() - elif o in ("-l", "--lpt"): - lpt = a - elif o in ("-w", "--wait"): - wait = 1 - elif o in ("-e", "--masserase"): - toinit.append(jtag.actionMassErase) #Erase Flash - elif o in ("-E", "--erasecheck"): - toinit.append(jtag.actionEraseCheck) #Erase Check (by file) - elif o in ("-m", "--mainerase"): - toinit.append(jtag.actionMainErase) #Erase main Flash - elif o == "--erase": - try: - seg = int(a, 0) - toinit.append(jtag.makeActionSegmentErase(seg)) - except ValueError: - sys.stderr.write("segment address must be a valid number in dec, hex or octal\n") - sys.exit(2) - elif o == "--eraseinfo": - toinit.append(jtag.makeActionSegmentErase(0x1000)) - toinit.append(jtag.makeActionSegmentErase(0x1080)) - elif o in ("-p", "--program"): - todo.append(jtag.actionProgram) #Program file - elif o in ("-v", "--verify"): - todo.append(jtag.actionVerify) #Verify file - elif o in ("-r", "--reset"): - reset = 1 - elif o in ("-g", "--go"): - try: - goaddr = int(a, 0) #try to convert decimal - except ValueError: - sys.stderr.write("upload address must be a valid number in dec, hex or octal\n") - sys.exit(2) - elif o in ("-D", "--debug"): - DEBUG = DEBUG + 1 - elif o in ("-u", "--upload"): - try: - startaddr = int(a, 0) #try to convert number of any base - except ValueError: - sys.stderr.write("upload address must be a valid number in dec, hex or octal\n") - sys.exit(2) - elif o in ("-s", "--size"): - try: - size = int(a, 0) - except ValueError: - sys.stderr.write("upload address must be a valid number in dec, hex or octal\n") - sys.exit(2) - #outut formats - elif o in ("-x", "--hex"): - outputformat = HEX - elif o in ("-b", "--bin"): - outputformat = BINARY - elif o in ("-i", "--ihex"): - outputformat = INTELHEX - #input formats - elif o in ("-I", "--intelhex"): - filetype = 0 - elif o in ("-T", "--titext"): - filetype = 1 - #others - elif o in ("-f", "--funclet"): - funclet = 1 - elif o in ("-R", "--ramsize"): - try: - ramsize = int(a, 0) - except ValueError: - sys.stderr.write("ramsize must be a valid number in dec, hex or octal\n") - sys.exit(2) - elif o in ("-S", "--progress"): - jtag.showprogess = 1 - - if len(args) == 0: - sys.stderr.write("Use -h for help\n") - elif len(args) == 1: #a filename is given - if not funclet: - if not todo: #if there are no actions yet - todo.extend([ #add some useful actions... - jtag.actionProgram, - ]) - filename = args[0] - else: #number of args is wrong - usage() - sys.exit(2) - - if DEBUG: #debug infos - sys.stderr.write("debug level set to %d\n" % DEBUG) - _parjtag.configure(DEBUG_OPTION, DEBUG) - sys.stderr.write("python version: %s\n" % sys.version) - - - #sanity check of options - if goaddr and reset: - sys.stderr.write("Warning: option --reset ignored as --go is specified!\n") - reset = 0 - - if startaddr and reset: - sys.stderr.write("Warning: option --reset ignored as --upload is specified!\n") - reset = 0 - - #prepare data to download - jtag.data = Memory() #prepare downloaded data - if filetype is not None: #if the filetype is given... - if filename is None: - raise ValueError("no filename but filetype specified") - if filename == '-': #get data from stdin - file = sys.stdin - else: - file = open(filename,"rb") #or from a file - if filetype == 0: #select load function - jtag.data.loadIHex(file) #intel hex - elif filetype == 1: - jtag.data.loadTIText(file) #TI's format - else: - raise ValueError("illegal filetype specified") - else: #no filetype given... - if filename == '-': #for stdin: - jtag.data.loadIHex(sys.stdin) #assume intel hex - elif filename: - jtag.data.loadFile(filename) #autodetect otherwise - - if DEBUG > 5: sys.stderr.write("File: %r\n" % filename) - - try: - jtag.connect(lpt) #try to open port - except IOError: - raise #do not handle here - else: #continue if open was successful - if ramsize is not None: - _parjtag.configure(RAMSIZE_OPTION, ramsize) - #initialization list - if toinit: #erase and erase check - if DEBUG: sys.stderr.write("Preparing device ...\n") - for f in toinit: f() - - #work list - if todo: - if DEBUG > 0: #debug - #show a nice list of sheduled actions - sys.stderr.write("TODO list:\n") - for f in todo: - try: - sys.stderr.write(" %s\n" % f.func_name) - except AttributeError: - sys.stderr.write(" %r\n" % f) - for f in todo: f() #work through todo list - - if reset: #reset device first if desired - jtag.actionReset() - - if funclet is not None: #download and start funclet - jtag.funclet() - - if goaddr is not None: #start user programm at specified address - jtag.actionRun(goaddr) #load PC and execute - - #upload datablock and output - if startaddr is not None: - if goaddr: #if a program was started... - raise NotImplementedError - #TODO: - #sys.stderr.write("Waiting to device for reconnect for upload: ") - data = jtag.uploadData(startaddr, size) #upload data - if outputformat == HEX: #depending on output format - hexdump( (startaddr, data) ) #print a hex display - elif outputformat == INTELHEX: - makeihex( (startaddr, data) ) #ouput a intel-hex file - else: - sys.stdout.write(data) #binary output w/o newline! - wait = 0 #wait makes no sense as after the upload the device is still stopped - - if wait: #wait at the end if desired - sys.stderr.write("Press ...\n") #display a prompt - raw_input() #wait for newline - - _parjtag.reset(1, 1) #reset and release target - #~ jtag.actionReset() - jtag.close() #Release communication port - -if __name__ == '__main__': - try: - main() - except SystemExit: - raise #let pass exit() calls - except KeyboardInterrupt: - if DEBUG: raise #show full trace in debug mode - sys.stderr.write("user abort.\n") #short messy in user mode - sys.exit(1) #set errorlevel for script usage - except Exception, msg: #every Exception is caught and displayed - if DEBUG: raise #show full trace in debug mode - sys.stderr.write("\nAn error occoured:\n%s\n" % msg) #short messy in user mode - sys.exit(1) #set errorlevel for script usage diff --git a/platform/msb430/buildscripts/jtag/pyjtag/license.txt b/platform/msb430/buildscripts/jtag/pyjtag/license.txt deleted file mode 100644 index 810a2d24c..000000000 --- a/platform/msb430/buildscripts/jtag/pyjtag/license.txt +++ /dev/null @@ -1,62 +0,0 @@ -Copyright (c) 2001-2002 Chris Liechti - -All Rights Reserved. - -This is the Python license. In short, you can use this product in -commercial and non-commercial applications, modify it, redistribute it. -A notification to the author when you use and/or modify it is welcome. - -TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING THIS SOFTWARE -============================================ - -LICENSE AGREEMENT ------------------ - -1. This LICENSE AGREEMENT is between the copyright holder of this -product, and the Individual or Organization ("Licensee") accessing -and otherwise using this product in source or binary form and its -associated documentation. - -2. Subject to the terms and conditions of this License Agreement, -the copyright holder hereby grants Licensee a nonexclusive, -royalty-free, world-wide license to reproduce, analyze, test, -perform and/or display publicly, prepare derivative works, distribute, -and otherwise use this product alone or in any derivative version, -provided, however, that copyright holders License Agreement and -copyright holders notice of copyright are retained in this product -alone or in any derivative version prepared by Licensee. - -3. In the event Licensee prepares a derivative work that is based on -or incorporates this product or any part thereof, and wants to make -the derivative work available to others as provided herein, then -Licensee hereby agrees to include in any such work a brief summary of -the changes made to this product. - -4. The copyright holder is making this product available to Licensee -on an "AS IS" basis. THE COPYRIGHT HOLDER MAKES NO REPRESENTATIONS -OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT -LIMITATION, THE COPYRIGHT HOLDER MAKES NO AND DISCLAIMS ANY -REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR -ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS PRODUCT WILL -NOT INFRINGE ANY THIRD PARTY RIGHTS. - -5. THE COPYRIGHT HOLDER SHALL NOT BE LIABLE TO LICENSEE OR ANY -OTHER USERS OF THIS PRODUCT FOR ANY INCIDENTAL, SPECIAL, OR -CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, -DISTRIBUTING, OR OTHERWISE USING THIS PRODUCT, OR ANY -DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY -THEREOF. - -6. This License Agreement will automatically terminate upon a -material breach of its terms and conditions. - -7. Nothing in this License Agreement shall be deemed to create any -relationship of agency, partnership, or joint venture between the -copyright holder and Licensee. This License Agreement does not grant -permission to use trademarks or trade names from the copyright holder -in a trademark sense to endorse or promote products or services of -Licensee, or any third party. - -8. By copying, installing or otherwise using this product, Licensee -agrees to be bound by the terms and conditions of this License -Agreement. diff --git a/platform/msb430/buildscripts/jtag/pyjtag/makefile b/platform/msb430/buildscripts/jtag/pyjtag/makefile deleted file mode 100644 index 5482fa2f1..000000000 --- a/platform/msb430/buildscripts/jtag/pyjtag/makefile +++ /dev/null @@ -1,33 +0,0 @@ - -.PHONY: all FORCE clean windist - -all: windist - -#wrap py to exe and build windows installer -windist: - python setup.py py2exe - rm -r bin - mv dist/jtag/jtag.exe dist/msp430-jtag.exe - mv dist/jtag/* dist/ - rmdir dist/jtag - mv dist bin - rm -r build - - -#generate test files -fill60k.a43: - python gen-ihex.py 60 >$@ -fill48k.a43: - python gen-ihex.py 48 >$@ -fill32k.a43: - python gen-ihex.py 32 >$@ -fill16k.a43: - python gen-ihex.py 16 >$@ -fill8k.a43: - python gen-ihex.py 8 >$@ -fill4k.a43: - python gen-ihex.py 4 >$@ - -#clean up the mess... -clean: - rm -r dist build bin \ No newline at end of file diff --git a/platform/msb430/buildscripts/jtag/pyjtag/readme.txt b/platform/msb430/buildscripts/jtag/pyjtag/readme.txt deleted file mode 100644 index bdd3da6c2..000000000 --- a/platform/msb430/buildscripts/jtag/pyjtag/readme.txt +++ /dev/null @@ -1,182 +0,0 @@ -pyJTAG ------- - -Software to talk to the parallel port JTAG PCB as seen with the FET kits. -It is released under a free software license, -see license.txt for more details. - -(C) 2002-2003 Chris Liechti - -Features --------- - -- understands TI-Text and Intel-hex -- download to Flash and/or RAM, erase, verify -- reset device -- load addres into R0/PC and run -- upload a memory block MSP->PC (output as binary data or hex dump) -- written in Python, runs on Win32, Linux, BSD -- use per command line, or in a Python script - -Requirements ------------- -- Linux, BSD, Un*x or Windows PC -- Python 2.0 or newer, 2.2 recomeded -- Parallel JTAG hardware with an MSP430 device connected - -Installation ------------- -Python installations are available from www.python.org. On Windows simply -use the installer. The win32all package has an installer too. These -installations should run fine with the deafults. - -On Linux just Python is needed. On some distributions is Python 1.5.2 -installed per default. You may meed to change the first line in the script -from "python" to "python2". Maybe Python 2.x is in a separate package that -has to be installed. There are rpm and deb binary packages and a source -tarball available through the Python homepage. - -The pyjtag archive can simply be unpacked to a directory, Windows users -can use WinZip or WinRar among others to extract the gzipped tar file. -If you want to run it from everywhere the directory where the file jtag.py -is, should be added to the PATH. -Look at "~/.profile", "/etc/profile" on Linux, "autoexec.bat" on Win9x/ME, -System Properties/Environment in Win2000/NT/XP. - -_parjtag.so/dll from the jtag archive must be copied to the same directory as -jtag.py. On Windows also MSP430mspgcc.dll and HIL.dll must be located in the -same dir or somewhere in the PATH. - -Short introduction ------------------- -This software uses the JTAG hardware that comes with the FET kits. It is -connected to the parallel port. - -The program can be started by typing "python jtag.py" in a console. Often -it works also with just "jtag.py" or "./jtag.py". - -USAGE: jtag.py [options] [file] -If "-" is specified as file the data is read from the stdinput. -A file ending with ".txt" is considered to be in TIText format all -other filenames are considered IntelHex. - -General options: - -h, --help Show this help screen. - -l, --lpt=name Specify an other parallel port. - (defaults to LPT1 (/dev/parport0 on unix) - -D, --debug Increase level of debug messages. This won't be - very useful for the average user... - -I, --intelhex Force fileformat to IntelHex - -T, --titext Force fileformat to be TIText - -f, --funclet The given file is a funclet (a small program to - be run in RAM) - -R, --ramsize Specify the amont of RAM to be used to program - flash (default 256). - -Program Flow Specifiers: - - -e, --masserase Mass Erase (clear all flash memory) - -m, --mainerase Erase main flash memory only - --eraseinfo Erase info flash memory only (0x1000-0x10ff) - --erase=address Selectively erase segment at the specified address - -E, --erasecheck Erase Check by file - -p, --program Program file - -v, --verify Verify by file - -The order of the above options matters! The table is ordered by normal -execution order. For the options "Epv" a file must be specified. -Program flow specifiers default to "p" if a file is given. -Don't forget to specify "e" or "eE" when programming flash! -"p" already verifies the programmed data, "v" adds an additional -verification though uploading the written data for a 1:1 compare. -No default action is taken if "p" and/or "v" is given, say specifying -only "v" does a check by file of a programmed device. - -Data retreiving: - -u, --upload=addr Upload a datablock (see also: -s). - -s, --size=num Size of the data block do upload. (Default is 2) - -x, --hex Show a hexadecimal display of the uploaded data. - (Default) - -b, --bin Get binary uploaded data. This can be used - to redirect the output into a file. - -i, --ihex Uploaded data is output in Intel HEX format. - This can be used to clone a device. - -Do before exit: - -g, --go=address Start programm execution at specified address. - This implies option "w" (wait) - -r, --reset Reset connected MSP430. Starts application. - This is a normal device reset and will start - the programm that is specified in the reset - interrupt vector. (see also -g) - -w, --wait Wait for before closing parallel port. - - -Examples --------- -These examples assume that you have added the installation directory to -the PATH. Type the full path to jtag.py otherwise and maybe use -"python jtag.py". Depending on installation it may also appear under the -name "msp430-jtag". - -jtag.py -e - Only erase flash. - -jtag.py -eErw 6port.a43 - Erase flash, erase check, download an executable, run it (reset) - and wait. - -jtag.py -mS -R 2048 6port.a43 - Use ramsize option on a device with 2k RAM to speed up - download. Of course any value from 128B up to the maximum - a device has is allowed. - The progress and mainerase options are also activated. - Only erasing the main memory is useful to keep calibration - data in the information memory. - -jtag.py 6port.a43 - Download of an executable to en empty (new or erased) device. - (Note that in new devices some of the first bytes in the - information memory are random data. If data should be - downloaded there, specify -eE.) - -jtag.py --go=0x220 ramtest.a43 - Download a program into RAM and run it, may not work - with all devices. - -jtag.py -f blinking.a43 - Download a program into RAM and run it. It must be - a special format with "startadr", "entrypoint", - "exitpoint" as the first three words in the data - and it must end on "jmp $". See MSP430debug sources - for more info. - -jtag.py -u 0x0c00 -s 1024 - Get a memory dump in HEX, from the bootstrap loader. - or save the binary in a file: - "python jtag.py -u 0x0c00 -s 1024 -b >dump.bin" - or as an intel-hex file: - "python jtag.py -u 0x0c00 -s 1024 -i >dump.a43" - -jtag.py -r - Just start the user program (with a reset). - -cat 6port.a43|jtag.py -e - - Pipe the data from "cat" to jtag.py to erase and program the - flash. (un*x example, don't forget the dash at the end of the - line) - -History -------- -1.0 public release -1.1 fix of verify error -1.2 use the verification during programming -1.3 meinerase, progress options, ihex output - -References ----------- -- Python: http://www.python.org - -- Texas Instruments MSP430 Homepage, links to Datasheets and Application - Notes: http://www.ti.com/sc/msp430 - diff --git a/platform/msb430/buildscripts/jtag/pyjtag/setup.py b/platform/msb430/buildscripts/jtag/pyjtag/setup.py deleted file mode 100644 index 982b58340..000000000 --- a/platform/msb430/buildscripts/jtag/pyjtag/setup.py +++ /dev/null @@ -1,9 +0,0 @@ -# setup.py -from distutils.core import setup -import glob -import py2exe - -setup( - name="msp430-jtag", - scripts=["jtag.py"], - ) \ No newline at end of file diff --git a/platform/msb430/cfs-coffee-arch.c b/platform/msb430/cfs-coffee-arch.c deleted file mode 100644 index 605ee79ff..000000000 --- a/platform/msb430/cfs-coffee-arch.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2009, 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. - * - */ - -/** - * \file - * Coffee functions the MSB-430 platform. - * \author - * Nicolas Tsiftes - */ - -#include "cfs-coffee-arch.h" -#include "dev/sd.h" - -#include - -int -cfs_coffee_arch_erase(unsigned sector) -{ - char buf[SD_DEFAULT_BLOCK_SIZE]; - sd_offset_t start_offset; - sd_offset_t end_offset; - sd_offset_t offset; - - memset(buf, 0, sizeof(buf)); - - start_offset = COFFEE_START + sector * COFFEE_SECTOR_SIZE; - end_offset = start_offset + COFFEE_SECTOR_SIZE; - - for(offset = start_offset; offset < end_offset; offset += SD_DEFAULT_BLOCK_SIZE) { - if(sd_write(offset, buf, sizeof(buf)) < 0) { - return -1; - } - } - return 0; -} diff --git a/platform/msb430/cfs-coffee-arch.h b/platform/msb430/cfs-coffee-arch.h deleted file mode 100644 index 6c1b960a0..000000000 --- a/platform/msb430/cfs-coffee-arch.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2009, 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. - * - */ - -/** - * \file - * Coffee header for the Tmote Sky platform. - * \author - * Nicolas Tsiftes - */ - -#ifndef CFS_COFFEE_ARCH_H -#define CFS_COFFEE_ARCH_H - -#include "contiki-conf.h" -#include "dev/sd.h" - -/* Coffee configuration parameters. */ -#define COFFEE_SECTOR_SIZE (10*1024*1024UL) -#define COFFEE_PAGE_SIZE 1024UL -#define COFFEE_START 0 -#define COFFEE_SIZE (COFFEE_SECTOR_SIZE * 2) -#define COFFEE_NAME_LENGTH 16 -#define COFFEE_MAX_OPEN_FILES 6 -#define COFFEE_FD_SET_SIZE 8 -#define COFFEE_LOG_TABLE_LIMIT 256 -#define COFFEE_DYN_SIZE 32*1024UL -#define COFFEE_LOG_SIZE 8*1024UL -#define COFFEE_MICRO_LOGS 0 - -/* Flash operations. */ -#define COFFEE_WRITE(buf, size, offset) \ - sd_write(COFFEE_START + (offset), (char *)(buf), (size)) - -#define COFFEE_READ(buf, size, offset) \ - sd_read(COFFEE_START + (offset), (char *)buf, (size)) - -#define COFFEE_ERASE(sector) \ - cfs_coffee_arch_erase(sector) - -/* Coffee types. */ -typedef int16_t coffee_page_t; -typedef sd_offset_t coffee_offset_t; - -int cfs_coffee_arch_erase(unsigned); - -#endif /* !COFFEE_ARCH_H */ diff --git a/platform/msb430/contiki-conf.h b/platform/msb430/contiki-conf.h deleted file mode 100644 index e6b525d40..000000000 --- a/platform/msb430/contiki-conf.h +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef CONTIKI_CONF_H -#define CONTIKI_CONF_H - -#define HAVE_STDINT_H -#include "msp430def.h" - -#define WITH_SD 0 - -#define NETSTACK_CONF_RADIO cc1020_driver -#define NETSTACK_CONF_RDC lpp_driver -#define NETSTACK_CONF_MAC csma_driver -#define NETSTACK_CONF_NETWORK rime_driver -#define NETSTACK_CONF_FRAMER framer_nullmac - -#define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8 - -#define ENERGEST_CONF_ON 1 - -#define IRQ_PORT1 0x01 -#define IRQ_PORT2 0x02 -#define IRQ_ADC 0x03 - -/* MSP430 information memory */ -#define INFOMEM_START 0x1000 -#define INFOMEM_BLOCK_SIZE 128 -#define INFOMEM_NODE_ID 0x0000 /* - 0x0004 */ - -#define CC_CONF_REGISTER_ARGS 1 -#define CC_CONF_FUNCTION_POINTER_ARGS 1 -#define CC_CONF_INLINE inline -#define CC_CONF_VA_ARGS 1 - -#define LPP_CONF_LISTEN_TIME 2 -#define LPP_CONF_OFF_TIME (CLOCK_SECOND - (LPP_CONF_LISTEN_TIME)) -#define QUEUEBUF_CONF_NUM 4 - - -#define CCIF -#define CLIF - -/* Clear channel assessment timeout for sending with the CC1020 radio. (ms) */ -#define CC1020_CONF_CCA_TIMEOUT 10 - -/* Clock */ -typedef unsigned clock_time_t; -#define CLOCK_CONF_SECOND 64 -#define F_CPU 2457600uL /* CPU target speed in Hz. */ - -#define BAUD2UBR(baud) (F_CPU/(baud)) - -#include "ctk/ctk-vncarch.h" - -#define LOG_CONF_ENABLED 0 - -/** - * The statistics data type. - * - * This datatype determines how high the statistics counters are able - * to count. - */ -typedef uint16_t uip_stats_t; - -typedef int bool; -#define TRUE 1 -#define FALSE 0 - -#define UIP_CONF_ICMP_DEST_UNREACH 1 -#define UIP_CONF_DHCP_LIGHT -#define UIP_CONF_LLH_LEN 0 -#define UIP_CONF_BUFFER_SIZE 116 -#define UIP_CONF_RECEIVE_WINDOW (UIP_CONF_BUFFER_SIZE - 40) -#define UIP_CONF_MAX_CONNECTIONS 4 -#define UIP_CONF_MAX_LISTENPORTS 8 -#define UIP_CONF_UDP_CONNS 8 -#define UIP_CONF_FWCACHE_SIZE 20 -#define UIP_CONF_BROADCAST 1 -#define UIP_ARCH_IPCHKSUM 1 -#define UIP_CONF_UDP_CHECKSUMS 1 -#define UIP_CONF_PINGADDRCONF 0 -#define UIP_CONF_LOGGING 0 - -#define LOADER_CONF_ARCH "loader/loader-arch.h" - -#define ELFLOADER_CONF_DATAMEMORY_SIZE 100 -#define ELFLOADER_CONF_TEXTMEMORY_SIZE 0x1000 - -/* LEDs ports MSB430 */ -#define LEDS_PxDIR P5DIR -#define LEDS_PxOUT P5OUT -#define LEDS_CONF_RED 0x80 -#define LEDS_CONF_GREEN 0x00 -#define LEDS_CONF_YELLOW 0x00 - -#endif /* !CONTIKI_CONF_H */ diff --git a/platform/msb430/contiki-msb430-main.c b/platform/msb430/contiki-msb430-main.c deleted file mode 100644 index 8b6b4f187..000000000 --- a/platform/msb430/contiki-msb430-main.c +++ /dev/null @@ -1,214 +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. - * - */ - -/** - * \file - * Main system file for the MSB-430 port. - * \author - * Michael Baar , Nicolas Tsiftes - */ -#include -#include - -#include "contiki.h" -#include "contiki-msb430.h" -#include "dev/adc.h" -#include "dev/sd.h" -#include "dev/serial-line.h" -#include "dev/sht11.h" -#include "dev/watchdog.h" - -extern volatile bool uart_edge; - -extern void init_net(void); - -SENSORS(NULL); - -static void -msb_ports_init(void) -{ - P1SEL = 0x00; P1OUT = 0x00; P1DIR = 0x00; - P2SEL = 0x00; P2OUT = 0x18; P2DIR = 0x1A; - P3SEL = 0x00; P3OUT = 0x09; P3DIR = 0x21; - P4SEL = 0x00; P4OUT = 0x00; P4DIR = 0x00; - P5SEL = 0x0E; P5OUT = 0xF9; P5DIR = 0xFD; - P6SEL = 0x07; P6OUT = 0x00; P6DIR = 0xC8; -} - -int -main(void) -{ -#if WITH_SD - int r; -#endif /* WITH_SD */ - - msp430_cpu_init(); - watchdog_stop(); - - /* Platform-specific initialization. */ - msb_ports_init(); - adc_init(); - - clock_init(); - rtimer_init(); - - sht11_init(); - leds_init(); - leds_on(LEDS_ALL); - - process_init(); - - /* serial interface */ - rs232_set_input(serial_line_input_byte); - rs232_init(); - serial_line_init(); - - uart_lock(UART_MODE_RS232); - uart_unlock(UART_MODE_RS232); -#if WITH_UIP - slip_arch_init(BAUD2UBR(115200)); -#endif - - -#if WITH_SD - r = sd_initialize(); - if(r < 0) { - printf("Failed to initialize the SD driver: %s\n", sd_error_string(r)); - } else { - sd_offset_t capacity; - printf("The SD driver was successfully initialized\n"); - capacity = sd_get_capacity(); - if(capacity < 0) { - printf("Failed to get the SD card capacity: %s\n", sd_error_string(r)); - } else { - printf("SD card capacity: %u MB\n", - (unsigned)(capacity / (1024UL * 1024))); - } - } -#endif - - node_id_restore(); - - /* System timers */ - process_start(&etimer_process, NULL); - ctimer_init(); - - /* Networking stack. */ - NETSTACK_RADIO.init(); - NETSTACK_RDC.init(); - NETSTACK_MAC.init(); - NETSTACK_NETWORK.init(); - { - rimeaddr_t rimeaddr; - - rimeaddr.u8[0] = node_id & 0xff; - rimeaddr.u8[1] = node_id >> 8; - rimeaddr_set_node_addr(&rimeaddr); - } - - energest_init(); - -#if PROFILE_CONF_ON - profile_init(); -#endif /* PROFILE_CONF_ON */ - - leds_off(LEDS_ALL); - - printf("Node %d.%d: %s %s, channel check rate %u Hz\n", - rimeaddr_node_addr.u8[0], rimeaddr_node_addr.u8[1], - NETSTACK_MAC.name, NETSTACK_RDC.name, - CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? - 1 : (unsigned)NETSTACK_RDC.channel_check_interval())); - - autostart_start(autostart_processes); - - /* - * This is the scheduler loop. - */ - ENERGEST_ON(ENERGEST_TYPE_CPU); - - while (1) { - int r; -#if PROFILE_CONF_ON - profile_episode_start(); -#endif /* PROFILE_CONF_ON */ - do { - /* Reset watchdog. */ - watchdog_periodic(); - r = process_run(); - } while(r > 0); - -#if PROFILE_CONF_ON - profile_episode_end(); -#endif /* PROFILE_CONF_ON */ - - /* - * Idle processing. - */ - int s = splhigh(); /* Disable interrupts. */ - if (process_nevents() != 0) { - splx(s); /* Re-enable interrupts. */ - } else { - static unsigned long irq_energest = 0; - /* Re-enable interrupts and go to sleep atomically. */ - ENERGEST_OFF(ENERGEST_TYPE_CPU); - ENERGEST_ON(ENERGEST_TYPE_LPM); - /* - * We only want to measure the processing done in IRQs when we - * are asleep, so we discard the processing time done when we - * were awake. - */ - energest_type_set(ENERGEST_TYPE_IRQ, irq_energest); - - if (uart_edge) { - _BIC_SR(LPM1_bits + GIE); - } else { - _BIS_SR(LPM1_bits + GIE); - } - - /* - * We get the current processing time for interrupts that was - * done during the LPM and store it for next time around. - */ - dint(); - irq_energest = energest_type_time(ENERGEST_TYPE_IRQ); - eint(); - ENERGEST_OFF(ENERGEST_TYPE_LPM); - ENERGEST_ON(ENERGEST_TYPE_CPU); -#if PROFILE_CONF_ON - profile_clear_timestamps(); -#endif /* PROFILE_CONF_ON */ - } - } - - return 0; -} diff --git a/platform/msb430/contiki-msb430.h b/platform/msb430/contiki-msb430.h deleted file mode 100644 index 80afabd21..000000000 --- a/platform/msb430/contiki-msb430.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ - -#ifndef CONTIKI_MSB430_H -#define CONTIKI_MSB430_H - -#include "contiki.h" -#include "contiki-net.h" -#include "contiki-lib.h" - -#include "dev/cc1020.h" -#include "dev/hwconf.h" -#include "dev/infomem.h" -#include "dev/leds.h" -#include "dev/lpm.h" -#include "dev/msb430-uart1.h" -#include "dev/rs232.h" -#include "dev/serial-line.h" -#include "dev/slip.h" - -#include "lib/sensors.h" -#include "net/rime.h" -#include "sys/node-id.h" - -#if WITH_SD -#include "dev/sd.h" -#endif /* WITH_SD */ - -#endif /* !CONTIKI_MSB430_H */ diff --git a/platform/msb430/dev/adc.c b/platform/msb430/dev/adc.c deleted file mode 100644 index fb14d3723..000000000 --- a/platform/msb430/dev/adc.c +++ /dev/null @@ -1,94 +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. - * - */ - -/** - * \file - * ADC functions. - * \author - * Nicolas Tsiftes - */ - -#include "contiki.h" -#include "contiki-msb430.h" - -void -adc_init(void) -{ - ADC12CTL0 = SHT0_15 | SHT1_15 | MSC; - - /* - * SHP: sampling timer - * CONSEQ3: repeat sequence of channels - * CSTARTADD: conversion start address 0 - */ - ADC12CTL1 = SHP | CONSEQ_3 | CSTARTADD_0; - - /* P60: A0 */ - ADC12MCTL0 = INCH_0 | SREF_0; - ADC12MCTL1 = INCH_1 | SREF_0; - ADC12MCTL2 = INCH_2 | SREF_0; - - /* P61: A1 */ - ADC12MCTL3 = ADC12MCTL4 = ADC12MCTL5 = INCH_1 | SREF_0; - - /* P62: A2 */ - ADC12MCTL6 = ADC12MCTL7 = ADC12MCTL8 = ADC12MCTL9 = INCH_2 | SREF_0; - - /* P63: A3 */ - ADC12MCTL10 = INCH_3 | SREF_0; - - /* P64: A4 */ - ADC12MCTL11 = INCH_4 | SREF_0; - - /* P65: A5 */ - ADC12MCTL12 = INCH_5 | SREF_0; - - /* INCH10: Temperature sensor. */ - ADC12MCTL13 = INCH_10 | SREF_0 | EOS; -} - -void -adc_on(void) -{ - ADC12CTL0 |= ADC12ON; - clock_delay(20000); - ADC12CTL0 |= ENC; - ADC12CTL0 |= ADC12SC; -} - -void -adc_off(void) -{ - ADC12CTL0 &= ~ENC; - clock_delay(20000); - ADC12CTL0 &= ~ADC12ON; -} diff --git a/platform/msb430/dev/adc.h b/platform/msb430/dev/adc.h deleted file mode 100644 index e8d5a2dd9..000000000 --- a/platform/msb430/dev/adc.h +++ /dev/null @@ -1,40 +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. - * - */ - -#ifndef ADC_H -#define ADC_H - -void adc_init(void); -void adc_on(void); -void adc_off(void); - -#endif /* !ADC_H */ diff --git a/platform/msb430/dev/cc1020-internal.h b/platform/msb430/dev/cc1020-internal.h deleted file mode 100644 index f0053ea97..000000000 --- a/platform/msb430/dev/cc1020-internal.h +++ /dev/null @@ -1,263 +0,0 @@ -#ifndef CC1020_INTERNAL_H -#define CC1020_INTERNAL_H - -#include "contiki.h" - -#define CC1020_MAIN 0x00 -#define CC1020_INTERFACE 0x01 -#define CC1020_RESET 0x02 -#define CC1020_SEQUENCING 0x03 -#define CC1020_FREQ_2A 0x04 -#define CC1020_FREQ_1A 0x05 -#define CC1020_FREQ_0A 0x06 -#define CC1020_CLOCK_A 0x07 -#define CC1020_FREQ_2B 0x08 -#define CC1020_FREQ_1B 0x09 -#define CC1020_FREQ_0B 0x0A -#define CC1020_CLOCK_B 0x0B -#define CC1020_VCO 0x0C -#define CC1020_MODEM 0x0D -#define CC1020_DEVIATION 0x0E -#define CC1020_AFC_CONTROL 0x0F -#define CC1020_FILTER 0x10 -#define CC1020_VGA1 0x11 -#define CC1020_VGA2 0x12 -#define CC1020_VGA3 0x13 -#define CC1020_VGA4 0x14 -#define CC1020_LOCK 0x15 -#define CC1020_FRONTEND 0x16 -#define CC1020_ANALOG 0x17 -#define CC1020_BUFF_SWING 0x18 -#define CC1020_BUFF_CURRENT 0x19 -#define CC1020_PLL_BW 0x1A -#define CC1020_CALIBRATE 0x1B -#define CC1020_PA_POWER 0x1C -#define CC1020_MATCH 0x1D -#define CC1020_PHASE_COMP 0x1E -#define CC1020_GAIN_COMP 0x1F -#define CC1020_POWERDOWN 0x20 -#define CC1020_TEST1 0x21 -#define CC1020_TEST2 0x22 -#define CC1020_TEST3 0x23 -#define CC1020_TEST4 0x24 -#define CC1020_TEST5 0x25 -#define CC1020_TEST6 0x26 -#define CC1020_TEST7 0x27 -#define CC1020_STATUS 0x40 -#define CC1020_RESET_DONE 0x41 -#define CC1020_RSS 0x42 -#define CC1020_AFC 0x43 -#define CC1020_GAUSS_FILTER 0x44 -#define CC1020_STATUS1 0x45 -#define CC1020_STATUS2 0x46 -#define CC1020_STATUS3 0x47 -#define CC1020_STATUS4 0x48 -#define CC1020_STATUS5 0x49 -#define CC1020_STATUS6 0x4A -#define CC1020_STATUS7 0x4B - -/* Flags for the MAIN register. */ -#define RESET_N 1 -#define BIAS_PD (1<<1) -#define XOSC_PD (1<<2) -#define FS_PD (1<<3) -#define PD_MODE_1 (1<<4) -#define PD_MODE_2 (1<<5) -#define F_REG (1<<6) -#define RXTX (1<<7) - -/* In power up mode, the MAIN register modifies some flags to the following. */ -#define SEQ_PD (1<<1) -#define SEQ_CAL_1 (1<<2) -#define SEQ_CAL_2 (1<<3) - -// For CC1020_STATUS -#define CARRIER_SENSE 0x08 -#define LOCK_CONTINUOUS 0x10 -#define LOCK_INSTANT 0x20 -#define SEQ_ERROR 0x40 -#define CAL_COMPLETE 0x80 - -#define PA_POWER 0x0F // initial default for output power -#define LOCK_NOK 0x00 -#define LOCK_OK 0x01 -#define LOCK_RECAL_OK 0x02 -#define CAL_TIMEOUT 0x7FFE -#define LOCK_TIMEOUT 0x7FFE -#define RESET_TIMEOUT 0x7FFE -#define TX_CURRENT 0x87 -#define RX_CURRENT 0x86 - -// CC1020 driver configuration - -// PDI (Data in) is on P21 -#define PDO (P2IN & 0x01) - -// PSEL is on P30 and low active -#define PSEL_ON do { P3OUT &= ~0x01; } while(0) -#define PSEL_OFF do { P3OUT |= 0x01; } while(0) -#define PCLK_HIGH do { P2OUT |= 0x08; } while(0) -#define PCLK_LOW do { P2OUT &= ~0x08; } while(0) - -// PDO (Data out) is on P22 -#define PDI_HIGH do { P2OUT |= 0x02; } while(0) - -#define PDI_LOW do { P2OUT &= ~0x02; } while(0) - -// Enable power for LNA (P24, low-active) -#define LNA_POWER_ON() do { P2OUT &= ~0x10; } while(0) - -#define LNA_POWER_OFF() do { P2OUT |= 0x10; } while(0) - -#define CC_LOCK (P2IN & 0x04) - -#define DISABLE_RX_IRQ() \ - do { IE1 &= ~(URXIE0); } while(0) - -#define ENABLE_RX_IRQ() \ - do { IFG1 &= ~URXIFG0; IE1 |= URXIE0; } while(0) - -#define ACK_TIMEOUT_115 4 // In RADIO_STROKE ticks -#define ACK_TIMEOUT_19 16 - -#define MHZ_869525 1 - -const uint8_t cc1020_config_19200[41] = { - 0x01, // 0x00, MAIN - 0x0F, // 0x01, INTERFACE - 0xFF, // 0x02, RESET - 0x8F, // 0x03, SEQUENCING - // 869.525 at 50kHz - 0x3A, // 0x04, FREQ_2A - 0x32, // 0x05, FREQ_1A - 0x97, // 0x06, FREQ_0A // 19200 - 0x38, // 0x07, CLOCK_A // 19200 - 0x3A, // 0x08, FREQ_2B - 0x37, // 0x09, FREQ_1B - 0xEB, // 0x0A, FREQ_0B // 19200 - 0x38, // 0x0B, CLOCK_B // 19200 - 0x44, // 0x0C, VCO 44 - 0x51, // 0x0D, MODEM Manchester - 0x2B, // 0x0E, DEVIATION // FSK - 0x4C, // 0x0F, AFC_CONTROL Ruetten 0xCC - 0x25, // 0x10, FILTER Bandwith 51.2 kHz i.e. channel spacing 100kHz - 0x61, // 0x11, VGA1 - 0x55, // 0x12, VGA2 - 0x2D, // 0x13, VGA3 - 0x37, // 0x14, VGA4 // 0x29, VGA4 ADJUSTED CS to 23! - 0x40, // 0x15, LOCK is Carrier SENSE - 0x76, // 0x16, FRONTEND - 0x87, // 0x17, ANALOG, RX=86/TX=87 - 0x10, // 0x18, BUFF_SWING - 0x25, // 0x19, BUFF_CURRENT - 0xAE, // 0x1A, PLL_BW - 0x34, // 0x1B, CALIBRATE - PA_POWER, // 0x1C, PA_POWER AN025 = 0xA0 - 0xF0, // 0x1D, MATCH - 0x00, // 0x1E, PHASE_COMP - 0x00, // 0x1F, GAIN_COMP - 0x00, // 0x20, POWERDOWN - 0x4d, // 0x4d, // 0x21, - 0x10, // 0x10, // 0x22, - 0x06, // 0x06, // 0x23, - 0x00, // 0x00, // 0x24, - 0x40, // 0x40, // 0x25, - 0x00, // 0x00, // 0x26, - 0x00, // 0x00, // 0x27, - // Not in real config of chipCon from here!!! - ACK_TIMEOUT_19 -}; - -const uint8_t cc1020_config_115200[41] = { - 0x01, // 0x00, MAIN - 0x0F, // 0x01, INTERFACE - 0xFF, // 0x02, RESET - 0x8F, // 0x03, SEQUENCING - // 869.525 at 200kHz - 0x3A, // 0x04, FREQ_2A - 0x32, // 0x05, FREQ_1A - 0x97, // 0x06, FREQ_0A // 19200 - 0x29, // 0x07, CLOCK_A // 19200 - 0x3A, // 0x08, FREQ_2B - 0x37, // 0x09, FREQ_1B - 0xEB, // 0x0A, FREQ_0B // 19200 - 0x29, // 0x0B, CLOCK_B // 19200 - 0x44, // 0x0C, VCO 44 - 0x51, // 0x0D, MODEM Manchester - 0x58, // 0x0E, DEVIATION // FSK - 0x4C, // 0x0F, AFC_CONTROL Ruetten 0xCC - 0x80, // 0x10, FILTER Bandwith 307.2kHz, i.e. channel spacing 500 kHz - 0x61, // 0x11, VGA1 - 0x57, // 0x12, VGA2 - 0x30, // 0x13, VGA3 - 0x35, // 0x14, VGA4 - 0x20, // 0x15, LOCK is Carrier SENSE - 0x76, // 0x16, FRONTEND - 0x87, // 0x17, ANALOG, RX=86/TX=87 - 0x10, // 0x18, BUFF_SWING - 0x25, // 0x19, BUFF_CURRENT - 0xAE, // 0x1A, PLL_BW - 0x34, // 0x1B, CALIBRATE - PA_POWER, // 0x1C, PA_POWER AN025 = 0xA0 - 0xF0, // 0x1D, MATCH - 0x00, // 0x1E, PHASE_COMP - 0x00, // 0x1F, GAIN_COMP - 0x00, // 0x20, POWERDOWN - 0x4d, // 0x21, - 0x10, // 0x22, - 0x06, // 0x23, - 0x00, // 0x24, - 0x40, // 0x25, - 0x00, // 0x26, - 0x00, // 0x27, - // Not in real config of chipCon from here!!! - ACK_TIMEOUT_115 -}; - -/// cc1020 state -enum cc1020_state { - CC1020_OFF = 0, - CC1020_RX = 0x01, - CC1020_TX = 0x02, - - CC1020_RX_SEARCHING = 0x10, // searching for preamble + sync word - CC1020_RX_RECEIVING = 0x20, // receiving bytes - CC1020_RX_PROCESSING = 0x40, // processing data in buffer - - CC1020_OP_STATE = 0x73, - - CC1020_TURN_OFF = 0x80, -}; - -#define CC1020_SET_OPSTATE(opstate) cc1020_state = ((cc1020_state & ~CC1020_OP_STATE) | (opstate)) - -/****************************************************************************** - * @name Packet specification - * @{ - */ - -// header: number of bytes in packet including header -struct cc1020_header { - uint8_t pad; - uint8_t length; -} __attribute__((packed)); - - -#define CC1020_BUFFERSIZE 128 - - -#define PREAMBLE_SIZE 6 -#define PREAMBLE 0xAA - -#define SYNCWORD_SIZE 2 -#define HDR_SIZE (sizeof (struct cc1020_header)) - -#define CRC_SIZE 2 - -#define TAIL_SIZE 2 -#define TAIL 0xFA - - -///@} - -#endif /* CC1020_INTERNAL_H */ diff --git a/platform/msb430/dev/cc1020-uip.c b/platform/msb430/dev/cc1020-uip.c deleted file mode 100644 index 78f18c4e9..000000000 --- a/platform/msb430/dev/cc1020-uip.c +++ /dev/null @@ -1,67 +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. - * - */ - -/** - * \file - * Chipcon CC1020 glue driver for uIP - * \author - * Nicolas Tsiftes - */ - -#include "contiki.h" -#include "cc1020.h" -#include "cc1020-uip.h" -#include "net/uip.h" -#include "net/hc.h" - -static void -receiver(const struct radio_driver *d) -{ - uip_len = cc1020_read(&uip_buf[UIP_LLH_LEN], UIP_BUFSIZE - UIP_LLH_LEN); - if(uip_len > 0) { - uip_len = hc_inflate(&uip_buf[UIP_LLH_LEN], uip_len); - tcpip_input(); - } -} - -void -cc1020_uip_init(void) -{ - cc1020_set_receiver(&receiver); -} - -uint8_t -cc1020_uip_send(void) -{ - uip_len = hc_compress(&uip_buf[UIP_LLH_LEN], uip_len); - return cc1020_send(&uip_buf[UIP_LLH_LEN], uip_len); -} diff --git a/platform/msb430/dev/cc1020-uip.h b/platform/msb430/dev/cc1020-uip.h deleted file mode 100644 index 652b40b3d..000000000 --- a/platform/msb430/dev/cc1020-uip.h +++ /dev/null @@ -1,38 +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. - * - */ -#ifndef CC1020_UIP_H -#define CC1020_UIP_H - -void cc1020_uip_init(void); -uint8_t cc1020_uip_send(void); - -#endif /* !CC1020_UIP_H */ diff --git a/platform/msb430/dev/cc1020.c b/platform/msb430/dev/cc1020.c deleted file mode 100644 index f5c9ba291..000000000 --- a/platform/msb430/dev/cc1020.c +++ /dev/null @@ -1,803 +0,0 @@ -/* - * Copyright 2006, Freie Universitaet Berlin. All rights reserved. - * - * These sources were developed at the Freie Universitaet Berlin, Computer - * Systems and Telematics group. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * - 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. - * - * - Neither the name of Freie Universitaet Berlin (FUB) 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 FUB and the contributors on an "as is" - * basis, without any representations or warranties of any kind, express - * or implied including, but not limited to, representations or - * warranties of non-infringement, merchantability or fitness for a - * particular purpose. In no event shall FUB 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 implementation was originally developed by the CST group at the FUB. - */ - -/** - * \file cc1020.c - * \author FUB ScatterWeb Developers, Michael Baar, Nicolas Tsiftes - **/ - -#include -#include - -#include "contiki.h" -#include "contiki-msb430.h" -#include "cc1020-internal.h" -#include "cc1020.h" -#include "lib/random.h" -#include "lib/crc16.h" -#include "net/rime/rimestats.h" -#include "dev/dma.h" -#include "sys/energest.h" -#include "isr_compat.h" - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -#define SEND_TIMEOUT 10 - -static int cc1020_calibrate(void); -static int cc1020_setupTX(int); -static int cc1020_setupRX(int); -static void cc1020_setupPD(void); -static void cc1020_wakeupTX(int); -static void cc1020_wakeupRX(int); -static uint8_t cc1020_read_reg(uint8_t addr); -static void cc1020_write_reg(uint8_t addr, uint8_t adata); -static void cc1020_load_config(const uint8_t *); -static void cc1020_reset(void); - -static const uint8_t syncword[SYNCWORD_SIZE] = {0xD3, 0x91}; - -/* current mode of cc1020 chip */ -static volatile enum cc1020_state cc1020_state = CC1020_OFF; -static volatile uint8_t cc1020_rxbuf[HDR_SIZE + CC1020_BUFFERSIZE]; -static uint8_t cc1020_txbuf[PREAMBLE_SIZE + SYNCWORD_SIZE + HDR_SIZE + - CC1020_BUFFERSIZE + TAIL_SIZE]; - -/* number of bytes in receive and transmit buffers respectively. */ -static uint8_t cc1020_rxlen; -static uint8_t cc1020_txlen; - -/* received signal strength indicator reading for last received packet */ -static volatile uint8_t rssi; - -/* callback when a packet has been received */ -static uint8_t cc1020_pa_power = PA_POWER; - -static volatile char dma_done; - -/* Radio driver AAPI functions. */ -static int cc1020_init(void); -static int cc1020_prepare(const void *payload, unsigned short payload_len); -static int cc1020_transmit(unsigned short transmit_len); -static int cc1020_send(const void *payload, unsigned short payload_len); -static int cc1020_read(void *buf, unsigned short buf_len); -static int cc1020_channel_clear(void); -static int cc1020_receiving_packet(void); -static int cc1020_pending_packet(void); -static int cc1020_on(void); -static int cc1020_off(void); - -const struct radio_driver cc1020_driver = - { - cc1020_init, - cc1020_prepare, - cc1020_transmit, - cc1020_send, - cc1020_read, - cc1020_channel_clear, - cc1020_receiving_packet, - cc1020_pending_packet, - cc1020_on, - cc1020_off - }; - -#define MS_DELAY(x) clock_delay(354 * (x)) - -PROCESS(cc1020_receiver_process, "CC1020 receiver"); - -static void -dma_callback(void) -{ - dma_done = 1; -} - -static void -reset_receiver(void) -{ - /* reset receiver */ - cc1020_rxlen = 0; - - if((cc1020_state & CC1020_TURN_OFF) && (cc1020_txlen == 0)) { - cc1020_off(); - } else { - CC1020_SET_OPSTATE(CC1020_RX | CC1020_RX_SEARCHING); - cc1020_set_rx(); - ENABLE_RX_IRQ(); - } -} - -static int -cc1020_init(void) -{ - cc1020_setupPD(); - cc1020_reset(); - cc1020_load_config(cc1020_config_19200); - - /* init tx buffer with preamble + syncword */ - memset(cc1020_txbuf, PREAMBLE, PREAMBLE_SIZE); - cc1020_txbuf[PREAMBLE_SIZE] = syncword[0]; - cc1020_txbuf[PREAMBLE_SIZE + 1] = syncword[1]; - - /* calibrate receiver */ - cc1020_wakeupRX(RX_CURRENT); - if(!cc1020_calibrate()) { - PRINTF("cc1020: rx calibration failed\n"); - return -1; - } - - /* calibrate transmitter */ - cc1020_wakeupTX(TX_CURRENT); - if(!cc1020_calibrate()) { - PRINTF("cc1020: tx calibration failed\n"); - return -1; - } - - /* power down */ - cc1020_setupPD(); - - process_start(&cc1020_receiver_process, NULL); - dma_subscribe(0, dma_callback); - - return 0; -} - -void -cc1020_set_rx(void) -{ - int s; - - s = splhigh(); - - /* Reset SEL for P3[1-3] (CC DIO, DIO, DCLK) and P3[4-5] (Camera Rx+Tx) */ - P3SEL &= ~0x3E; - IFG1 &= ~(UTXIE0 | URXIE0); /* Clear interrupt flags */ - ME1 &= ~(UTXE0 | URXE0); /* Disable Uart0 Tx + Rx */ - UCTL0 = SWRST; /* U0 into reset state. */ - UCTL0 |= CHAR | SYNC; /* 8-bit character, SPI, Slave mode */ - - /* CKPH works also, but not CKPH+CKPL or none of them!! */ - UTCTL0 = CKPL | STC; - URCTL0 = 0x00; - UBR00 = 0x00; /* No baudrate divider */ - UBR10 = 0x00; /* settings for a spi */ - UMCTL0 = 0x00; /* slave. */ - ME1 |= URXE0; /* Enable USART0 RXD, disabling does not yield any powersavings */ - P3SEL |= 0x0A; /* Select rx line and clk */ - UCTL0 &= ~SWRST; /* Clear reset bit */ - splx(s); - - /* configure driver */ - cc1020_rxlen = 0; /* receive buffer position to start */ - CC1020_SET_OPSTATE(CC1020_RX | CC1020_RX_SEARCHING); /* driver state to receive mode */ - - /* configure radio */ - ENERGEST_ON(ENERGEST_TYPE_LISTEN); - cc1020_wakeupRX(RX_CURRENT); - cc1020_setupRX(RX_CURRENT); - LNA_POWER_ON(); /* enable amplifier */ - - /* activate */ - IE1 |= URXIE0; /* enable interrupt */ -} - -void -cc1020_set_tx(void) -{ - int s; - - /* configure radio rx */ - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - LNA_POWER_OFF(); /* power down LNA */ - s = splhigh(); - DISABLE_RX_IRQ(); - P3SEL &= ~0x02; /* Ensure Rx line is off */ - splx(s); - - /* configure radio tx */ - ENERGEST_ON(ENERGEST_TYPE_TRANSMIT); - cc1020_wakeupTX(TX_CURRENT); - cc1020_setupTX(TX_CURRENT); - P3SEL |= 0x0C; /* select Tx line and clk */ - U0CTL |= SWRST; /* UART to reset mode */ - IFG1 &= ~UTXIFG0; /* Reset IFG. */ - - /* configure driver */ - CC1020_SET_OPSTATE(CC1020_TX); -} - -void -cc1020_set_power(uint8_t pa_power) -{ - cc1020_pa_power = pa_power; -} - -static int -cc1020_prepare(const void *payload, unsigned short payload_len) -{ - return -1; -} - -static int -cc1020_transmit(unsigned short transmit_len) -{ - return 0; -} - -static int -cc1020_send(const void *buf, unsigned short len) -{ - int normal_header = HDR_SIZE + len; - uint16_t rxcrc = 0xffff; /* For checksum purposes */ - rtimer_clock_t timeout_time; - - timeout_time = RTIMER_NOW() + RTIMER_SECOND / 1000 * SEND_TIMEOUT; - while(cc1020_state & CC1020_RX_RECEIVING) { - if(RTIMER_CLOCK_LT(timeout_time, RTIMER_NOW())) { - PRINTF("cc1020: transmission blocked by reception in progress\n"); - return RADIO_TX_ERR; - } - } - - if(cc1020_state == CC1020_OFF) { - return RADIO_TX_ERR; - } - - if(len > CC1020_BUFFERSIZE) { - return RADIO_TX_ERR; - } - - /* The preamble and the sync word are already in buffer. */ - cc1020_txlen = PREAMBLE_SIZE + SYNCWORD_SIZE; - - /* header */ - cc1020_txbuf[cc1020_txlen++] = 0x00; - cc1020_txbuf[cc1020_txlen++] = normal_header + CRC_SIZE; - - /* Adding the checksum on header and data */ - rxcrc = crc16_add(normal_header & 0xff, rxcrc); - rxcrc = crc16_add((normal_header >> 8) & 0xff, rxcrc); - - rxcrc = crc16_data(buf, len, rxcrc); - - /* data to send */ - memcpy((char *)cc1020_txbuf + cc1020_txlen, buf, len); - cc1020_txlen += len; - - /* Send checksum */ - cc1020_txbuf[cc1020_txlen++] = rxcrc >> 8; - cc1020_txbuf[cc1020_txlen++] = rxcrc & 0xff; - - /* suffix */ - cc1020_txbuf[cc1020_txlen++] = TAIL; - cc1020_txbuf[cc1020_txlen++] = TAIL; - - /* Switch to transceive mode. */ - cc1020_set_tx(); - - /* Initiate radio transfer. */ - dma_done = 0; - dma_transfer((unsigned char *)&TXBUF0, cc1020_txbuf, cc1020_txlen); - while(!dma_done); - - ENERGEST_OFF(ENERGEST_TYPE_TRANSMIT); - RIMESTATS_ADD(lltx); - - /* clean up */ - cc1020_txlen = 0; - if(cc1020_state & CC1020_TURN_OFF) { - cc1020_off(); - } else { - cc1020_set_rx(); - } - - return RADIO_TX_OK; -} - -static int -cc1020_read(void *buf, unsigned short size) -{ - unsigned len; - - if(cc1020_rxlen <= HDR_SIZE) { - return 0; - } - - len = cc1020_rxlen - HDR_SIZE; - if(len > size) { - RIMESTATS_ADD(toolong); - return -1; - } - - memcpy(buf, (char *)cc1020_rxbuf + HDR_SIZE, len); - RIMESTATS_ADD(llrx); - reset_receiver(); - - return len; -} - -static int -cc1020_channel_clear(void) -{ - return (cc1020_read_reg(CC1020_STATUS) & CARRIER_SENSE); -} - -static int -cc1020_receiving_packet(void) -{ - return cc1020_state & CC1020_RX_RECEIVING; -} - -static int -cc1020_pending_packet(void) -{ - return cc1020_state & CC1020_RX_PROCESSING; -} - -int -cc1020_on(void) -{ - if(cc1020_state == CC1020_OFF) { - cc1020_set_rx(); - } else if(cc1020_state & CC1020_TURN_OFF) { - cc1020_state &= ~CC1020_TURN_OFF; - cc1020_set_rx(); - } - - return 1; -} - -int -cc1020_off(void) -{ - int s; - - if(cc1020_state != CC1020_OFF) { - if(cc1020_state & CC1020_RX_SEARCHING) { - /* Discard the current read buffer when the radio is shutting down. */ - cc1020_rxlen = 0; - - LNA_POWER_OFF(); /* power down lna */ - s = splhigh(); - DISABLE_RX_IRQ(); - cc1020_state = CC1020_OFF; - splx(s); - cc1020_setupPD(); /* power down radio */ - ENERGEST_OFF(ENERGEST_TYPE_LISTEN); - cc1020_state = CC1020_OFF; - } else { - cc1020_state |= CC1020_TURN_OFF; - } - } - return 1; -} - -uint8_t -cc1020_get_rssi(void) -{ - return (cc1020_read_reg(CC1020_RSS) & 0x7F); -} - -uint8_t -cc1020_get_packet_rssi(void) -{ - return rssi; -} - -PROCESS_THREAD(cc1020_receiver_process, ev, data) -{ - int len; - - PROCESS_BEGIN(); - - while(1) { - ev = PROCESS_EVENT_NONE; - PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_POLL); - - /* Verify the checksum. */ - uint16_t expected_crc = 0xffff; - uint16_t actual_crc; - - actual_crc = (cc1020_rxbuf[cc1020_rxlen - CRC_SIZE] << 8) | - cc1020_rxbuf[cc1020_rxlen - CRC_SIZE + 1]; - cc1020_rxlen -= CRC_SIZE; - - expected_crc = crc16_add(cc1020_rxlen & 0xff, expected_crc); - expected_crc = crc16_add((cc1020_rxlen >> 8) & 0xff, expected_crc); - expected_crc = crc16_data((char *)&cc1020_rxbuf[HDR_SIZE], - cc1020_rxlen - HDR_SIZE, expected_crc); - - if(expected_crc == actual_crc) { - len = cc1020_read(packetbuf_dataptr(), PACKETBUF_SIZE); - packetbuf_set_datalen(len); - NETSTACK_RDC.input(); - } else { - RIMESTATS_ADD(badcrc); - reset_receiver(); - } - } - - PROCESS_END(); -} - -ISR(UART0RX, cc1020_rxhandler) -{ - static signed char syncbs; - static union { - struct { - uint8_t b2; - uint8_t b1; - uint8_t b4; - uint8_t b3; - }; - struct { - uint16_t i1; - uint16_t i2; - }; - } shiftbuf; - static unsigned char pktlen; - - if(cc1020_state & CC1020_RX_SEARCHING) { - shiftbuf.b1 = shiftbuf.b2; - shiftbuf.b2 = shiftbuf.b3; - shiftbuf.b3 = shiftbuf.b4; - shiftbuf.b4 = RXBUF0; - if(shiftbuf.i1 == 0xAAD3 && shiftbuf.b3 == 0x91) { - /* 0 AA D3 91 00 | FF 00 | */ - syncbs = 0; - cc1020_rxbuf[cc1020_rxlen++] = shiftbuf.b4; - } else if(shiftbuf.i1 == 0x5569 && shiftbuf.i2 == 0xC880) { - /* 1 55 69 C8 80 | 7F 80 | */ - syncbs = -1; - } else if(shiftbuf.i1 == 0xAAB4 && shiftbuf.i2 == 0xE440) { - /* 2 AA B4 E4 40 | 3F C0 | */ - syncbs = -2; - } else if(shiftbuf.i1 == 0x555A && shiftbuf.i2 == 0x7220) { - /* 3 55 5A 72 20 | 1F E0 | */ - syncbs = -3; - } else if(shiftbuf.i1 == 0xAAAD && shiftbuf.i2 == 0x3910) { - /* 4 AA AD 39 10 | 0F F0 | */ - syncbs = -4; - } else if(shiftbuf.i1 == 0x5556 && shiftbuf.i2 == 0x9C88) { - /* 5 55 56 9C 88 | 07 F8 | */ - syncbs = +3; - } else if(shiftbuf.i1 == 0xAAAB && shiftbuf.i2 == 0x4E44) { - /* 6 AA AB 4E 44 | 03 FC | */ - syncbs = +2; - } else if(shiftbuf.i1 == 0x5555 && shiftbuf.i2 == 0xA722) { - /* 7 55 55 A7 22 | 01 FE | */ - syncbs = +1; - } else { - return; - } - rssi = cc1020_get_rssi(); - CC1020_SET_OPSTATE(CC1020_RX | CC1020_RX_RECEIVING); - } else if(cc1020_state & CC1020_RX_RECEIVING) { - if(syncbs == 0) { - cc1020_rxbuf[cc1020_rxlen] = RXBUF0; - } else { - shiftbuf.b3 = shiftbuf.b4; - shiftbuf.b4 = RXBUF0; - if(syncbs < 0) { - shiftbuf.i1 = shiftbuf.i2 << -syncbs; - cc1020_rxbuf[cc1020_rxlen] = shiftbuf.b1; - } else { - shiftbuf.i1 = shiftbuf.i2 >> syncbs; - cc1020_rxbuf[cc1020_rxlen] = shiftbuf.b2; - } - } - - cc1020_rxlen++; - - if(cc1020_rxlen == HDR_SIZE) { - pktlen = ((struct cc1020_header *)cc1020_rxbuf)->length; - if(pktlen == 0 || pktlen > sizeof (cc1020_rxbuf)) { - cc1020_rxlen = 0; - CC1020_SET_OPSTATE(CC1020_RX | CC1020_RX_SEARCHING); - } - } else if(cc1020_rxlen > HDR_SIZE) { - if(cc1020_rxlen == pktlen) { - /* Disable interrupts while processing the packet. */ - DISABLE_RX_IRQ(); - CC1020_SET_OPSTATE(CC1020_RX | CC1020_RX_PROCESSING); - _BIC_SR_IRQ(LPM3_bits); - process_poll(&cc1020_receiver_process); - } - } - } -} - -static void -cc1020_write_reg(uint8_t addr, uint8_t adata) -{ - unsigned int i; - uint8_t data; - - data = addr << 1; - PSEL_ON; - - /* Send address bits */ - for(i = 0; i < 7; i++) { - PCLK_LOW; - if(data & 0x80) { - PDI_HIGH; - } else { - PDI_LOW; - } - data = data << 1; - PCLK_HIGH; - nop(); - } - - /* Send read/write bit */ - /* Ignore bit in data, always use 1 */ - PCLK_LOW; - PDI_HIGH; - PCLK_HIGH; - nop(); - data = adata; - - /* Send data bits */ - for(i = 0; i < 8; i++) { - PCLK_LOW; - if(data & 0x80) { - PDI_HIGH; - } else { - PDI_LOW; - } - data = data << 1; - PCLK_HIGH; - nop(); - } - - PCLK_LOW; - PSEL_OFF; -} - -static uint8_t -cc1020_read_reg(uint8_t addr) -{ - unsigned int i; - uint8_t data; - - data = addr << 1; - PSEL_ON; - - /* Send address bits */ - for(i = 0; i < 7; i++) { - PCLK_LOW; - if(data & 0x80) { - PDI_HIGH; - } else { - PDI_LOW; - } - data = data << 1; - PCLK_HIGH; - nop(); - } - - /* Send read/write bit */ - /* Ignore bit in data, always use 0 */ - PCLK_LOW; - PDI_LOW; - PCLK_HIGH; - nop(); - PCLK_LOW; - - /* Receive data bits */ - for(i = 0; i < 8; i++) { - nop(); - PCLK_HIGH; - nop(); - data = data << 1; - if(PDO) { - data++; - } - PCLK_LOW; - } - - PSEL_OFF; - - return data; -} - -static void -cc1020_load_config(const uint8_t * config) -{ - int i; - - for(i = 0; i < 0x28; i++) - cc1020_write_reg(i, config[i]); -} - -static void -cc1020_reset(void) -{ - /* Reset CC1020 */ - cc1020_write_reg(CC1020_MAIN, 0x0FU & ~0x01U); - - /* Bring CC1020 out of reset */ - cc1020_write_reg(CC1020_MAIN, 0x1F); -} - -static int -cc1020_calibrate(void) -{ - unsigned int timeout_cnt; - - /* Turn off PA to avoid spurs during calibration in TX mode */ - cc1020_write_reg(CC1020_PA_POWER, 0x00); - - /* Start calibration */ - cc1020_write_reg(CC1020_CALIBRATE, 0xB5); - while((cc1020_read_reg(CC1020_STATUS) & CAL_COMPLETE) == 0); - - /* Monitor lock */ - for(timeout_cnt = LOCK_TIMEOUT; timeout_cnt > 0; timeout_cnt--) { - if(cc1020_read_reg(CC1020_STATUS) & LOCK_CONTINUOUS) { - break; - } - } - - /* Restore PA_POWER */ - cc1020_write_reg(CC1020_PA_POWER, cc1020_pa_power); - - /* Return state of LOCK_CONTINUOUS bit */ - return (cc1020_read_reg(CC1020_STATUS) & LOCK_CONTINUOUS) == LOCK_CONTINUOUS; -} - -static int -cc1020_lock(void) -{ - char lock_status; - int i; - - /* Monitor LOCK, lasts 420 - 510 cycles @ 4505600 = 93 us - 113 us */ - for(i = LOCK_TIMEOUT; i > 0; i--) { - lock_status = cc1020_read_reg(CC1020_STATUS) & LOCK_CONTINUOUS; - if(lock_status) { - break; - } - } - - if(lock_status == LOCK_CONTINUOUS) { - return LOCK_OK; - } - - return cc1020_calibrate() ? LOCK_RECAL_OK : LOCK_NOK; -} - -static int -cc1020_setupRX(int analog) -{ - char lock_status; - - /* Switch into RX, switch to freq. reg A */ - cc1020_write_reg(CC1020_MAIN, 0x01); - lock_status = cc1020_lock(); - - /* Switch RX part of CC1020 on */ - cc1020_write_reg(CC1020_INTERFACE, 0x02); - - /* Return LOCK status to application */ - return lock_status; -} - -static int -cc1020_setupTX(int analog) -{ - char lock_status; - - /* Switch into TX, switch to freq. reg B */ - cc1020_write_reg(CC1020_MAIN, 0xC1); - lock_status = cc1020_lock(); - - /* Restore PA_POWER */ - cc1020_write_reg(CC1020_PA_POWER, cc1020_pa_power); - - /* Turn OFF DCLK squelch in TX */ - cc1020_write_reg(CC1020_INTERFACE, 0x01); - - /* Return LOCK status to application */ - return lock_status; -} - -static void -cc1020_setupPD(void) -{ - /* - * Power down components and reset all registers except MAIN - * to their default values. - */ - cc1020_write_reg(CC1020_MAIN, - RESET_N | BIAS_PD | FS_PD | XOSC_PD | PD_MODE_1); - - /* Turn off the power amplifier. */ - cc1020_write_reg(CC1020_PA_POWER, 0x00); - - cc1020_write_reg(CC1020_POWERDOWN, 0x1F); -} - -static void -cc1020_wakeupRX(int analog) -{ - /* Turn on crystal oscillator core. */ - cc1020_write_reg(CC1020_MAIN, 0x1B); - - /* Setup bias current adjustment. */ - cc1020_write_reg(CC1020_ANALOG, analog); - - /* - * Wait for the crystal oscillator to stabilize. - * This typically takes 2-5 ms. - */ - MS_DELAY(5); - - /* Turn on bias generator. */ - cc1020_write_reg(CC1020_MAIN, 0x19); - - /* Turn on frequency synthesizer. */ - cc1020_write_reg(CC1020_MAIN, 0x11); -} - -static void -cc1020_wakeupTX(int analog) -{ - /* Turn on crystal oscillator core. */ - cc1020_write_reg(CC1020_MAIN, 0xDB); - - /* Setup bias current adjustment. */ - cc1020_write_reg(CC1020_ANALOG, analog); - - /* - * Wait for the crystal oscillator to stabilize. - * This typically takes 2-5 ms. - */ - MS_DELAY(5); - - /* Turn on bias generator. */ - cc1020_write_reg(CC1020_MAIN, 0xD9); - - /* Turn on frequency synthesizer. */ - MS_DELAY(1); - cc1020_write_reg(CC1020_MAIN, 0xD1); -} - diff --git a/platform/msb430/dev/cc1020.h b/platform/msb430/dev/cc1020.h deleted file mode 100644 index 364b71650..000000000 --- a/platform/msb430/dev/cc1020.h +++ /dev/null @@ -1,77 +0,0 @@ -/* -Copyright 2006, Freie Universitaet Berlin. All rights reserved. - -These sources were developed at the Freie Universitaet Berlin, Computer -Systems and Telematics group. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -- Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -- 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. - -- Neither the name of Freie Universitaet Berlin (FUB) 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 FUB and the contributors on an "as is" -basis, without any representations or warranties of any kind, express -or implied including, but not limited to, representations or -warranties of non-infringement, merchantability or fitness for a -particular purpose. In no event shall FUB 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 implementation was developed by the CST group at the FUB. - -For documentation and questions please use the web site -http://scatterweb.mi.fu-berlin.de and the mailinglist -scatterweb@lists.spline.inf.fu-berlin.de (subscription via the Website). -Berlin, 2006 -*/ - -/** - * \file cc1020.h - * \author FUB ScatterWeb Developers, Michael Baar, Nicolas Tsiftes - **/ - -#ifndef CC1020_H -#define CC1020_H - -#include "dev/radio.h" - -extern const uint8_t cc1020_config_19200[]; -extern const uint8_t cc1020_config_115200[]; - -#if 0 -void cc1020_init(const uint8_t* config); -#endif -void cc1020_set_rx(void); -void cc1020_set_tx(void); -void cc1020_set_power(uint8_t pa_power); -int cc1020_carrier_sense(void); -uint8_t cc1020_get_rssi(void); -uint8_t cc1020_get_packet_rssi(void); -int cc1020_sending(void); -#if 0 -int cc1020_send(const void *buf, unsigned short size); -int cc1020_read(void *buf, unsigned short size); -void cc1020_set_receiver(void (*recv)(const struct radio_driver *)); -int cc1020_on(void); -int cc1020_off(void); -#endif -extern const struct radio_driver cc1020_driver; - -PROCESS_NAME(cc1020_sender_process); - -#endif diff --git a/platform/msb430/dev/dma.c b/platform/msb430/dev/dma.c deleted file mode 100644 index ce175ee12..000000000 --- a/platform/msb430/dev/dma.c +++ /dev/null @@ -1,121 +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. - * - */ - -/** - * \file - * DMA interrupt handling. - * \author - * Nicolas Tsiftes - */ -#include "contiki.h" - -#include "contiki-msb430.h" -#include "dev/cc1020.h" -#include "dev/dma.h" -#include "isr_compat.h" - -static void (*callbacks[DMA_LINES])(void); - -ISR(DACDMA, irq_dacdma) -{ - if(DMA0CTL & DMAIFG) { - DMA0CTL &= ~(DMAIFG | DMAIE); - if(callbacks[0] != NULL) { - callbacks[0](); - } - _BIC_SR_IRQ(LPM3_bits); - } - - if(DMA1CTL & DMAIFG) { - DMA1CTL &= ~(DMAIFG | DMAIE); - if(callbacks[1] != NULL) { - callbacks[1](); - } - _BIC_SR_IRQ(LPM3_bits); - } - - if(DMA2CTL & DMAIFG) { - DMA2CTL &= ~(DMAIFG | DMAIE); - if(callbacks[2] != NULL) { - callbacks[2](); - } - _BIC_SR_IRQ(LPM3_bits); - } - - if(DAC12_0CTL & DAC12IFG) { - DAC12_0CTL &= ~(DAC12IFG | DAC12IE); - } - - if(DAC12_1CTL & DAC12IFG) { - DAC12_1CTL &= ~(DAC12IFG | DAC12IE); - } -} - -int -dma_subscribe(int line, void (*callback)(void)) -{ - if(line >= DMA_LINES) { - return -1; - } - - callbacks[line] = callback; - return 0; -} - -void -dma_transfer(unsigned char *dst, unsigned char *src, unsigned len) -{ - /* Configure DMA Channel 0 for UART0 TXIFG. */ - DMACTL0 = DMA0TSEL_4; - - /* No DMAONFETCH, ROUNDROBIN, ENNMI. */ - DMACTL1 = 0x0000; - - /* - * Set single transfer mode with byte-per-byte transfers. - * - * The source address is incremented for each byte, while the - * destination address remains constant. - * - * In order to avoid missing the first rising edge of the trigger - * signal, it is important to use the level-sensitive trigger when - * using USART transfer interrupts. - */ - DMA0CTL = DMADT_0 | DMADSTINCR_0 | DMASRCINCR_3 | DMASBDB | DMALEVEL; - - DMA0SA = (unsigned) src; - DMA0DA = (unsigned) dst; - DMA0SZ = len; - - DMA0CTL |= DMAEN | DMAIE; /* enable DMA and interrupts */ - U0CTL &= ~SWRST; /* enable the UART state machine */ -} diff --git a/platform/msb430/dev/dma.h b/platform/msb430/dev/dma.h deleted file mode 100644 index cabcad4d7..000000000 --- a/platform/msb430/dev/dma.h +++ /dev/null @@ -1,44 +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. - * - */ - -#ifndef DMA_H -#define DMA_H - -#define DMA_LINES 2 - -void dma_init(void); -int dma_subscribe(int, void (*)(void)); -void dma_transfer(unsigned char *, unsigned char *, unsigned); - -extern process_event_t dma_event; - -#endif diff --git a/platform/msb430/dev/infomem.c b/platform/msb430/dev/infomem.c deleted file mode 100644 index 53cd27448..000000000 --- a/platform/msb430/dev/infomem.c +++ /dev/null @@ -1,122 +0,0 @@ -/* -Copyright 2007, Freie Universitaet Berlin. All rights reserved. - -These sources were developed at the Freie Universität Berlin, Computer -Systems and Telematics group. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -- Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -- 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. - -- Neither the name of Freie Universitaet Berlin (FUB) 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 FUB and the contributors on an "as is" -basis, without any representations or warranties of any kind, express -or implied including, but not limited to, representations or -warranties of non-infringement, merchantability or fitness for a -particular purpose. In no event shall FUB 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 implementation was developed by the CST group at the FUB. - -For documentation and questions please use the web site -http://scatterweb.mi.fu-berlin.de and the mailinglist -scatterweb@lists.spline.inf.fu-berlin.de (subscription via the Website). -Berlin, 2007 -*/ - -/** - * @file infomem.c - * @addtogroup storage - * @brief MSP430 Infomemory Storage - * @author Michael Baar - * - * Functions to store and read data from the two infomemories (2 x 128 Bytes). - * Offset addresses start at zero, size has a maximum of 128, write operations - * across both blocks are not allowed. - */ -#include -#include -#include "contiki-conf.h" -#include "infomem.h" - -void -infomem_read(void *buffer, unsigned int offset, unsigned char size) -{ - uint8_t *address = (uint8_t *)INFOMEM_START + offset; - memcpy(buffer, address, size); -} - -bool -infomem_write(unsigned int offset, unsigned char count, ...) -{ - char backup[INFOMEM_BLOCK_SIZE]; - uint8_t *buffer; - uint16_t i; - uint8_t *flash; - va_list argp; - uint16_t size; - uint8_t *data; - int s; - - if(offset > (2 * INFOMEM_BLOCK_SIZE)) { - return FALSE; - } - - flash = (uint8_t *)INFOMEM_START; - - s = splhigh(); - - /* backup into RAM */ - memcpy(backup, flash, INFOMEM_BLOCK_SIZE); - - /* merge backup with new data */ - va_start(argp, count); - - buffer = (uint8_t *)backup + offset; - for(i = 0; i < count; i++) { - data = va_arg(argp, uint8_t *); - size = va_arg(argp, uint16_t); - memcpy(buffer, data, size); - buffer += size; - } - - va_end(argp); - - /* init flash access */ - FCTL2 = FWKEY + FSSEL1 + FN2; - FCTL3 = FWKEY; - - /* erase flash */ - FCTL1 = FWKEY + ERASE; - *flash = 0; - - /* write flash */ - FCTL1 = FWKEY + WRT; - buffer = (uint8_t *)backup; - for(i = 0; i < INFOMEM_BLOCK_SIZE; i++) { - *flash++ = *buffer++; - } - - FCTL1 = FWKEY; - FCTL3 = FWKEY + LOCK; - - splx(s); - - return TRUE; -} diff --git a/platform/msb430/dev/infomem.h b/platform/msb430/dev/infomem.h deleted file mode 100644 index 6885551be..000000000 --- a/platform/msb430/dev/infomem.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -Copyright 2006, Freie Universitaet Berlin. All rights reserved. - -These sources were developed at the Freie Universität Berlin, Computer -Systems and Telematics group. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -- Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -- 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. - -- Neither the name of Freie Universitaet Berlin (FUB) 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 FUB and the contributors on an "as is" -basis, without any representations or warranties of any kind, express -or implied including, but not limited to, representations or -warranties of non-infringement, merchantability or fitness for a -particular purpose. In no event shall FUB 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 implementation was developed by the CST group at the FUB. - -For documentation and questions please use the web site -http://scatterweb.mi.fu-berlin.de and the mailinglist -scatterweb@lists.spline.inf.fu-berlin.de (subscription via the Website). -Berlin, 2006 -*/ - -/** - * @file infomem.h - * @addtogroup storage - * @brief MSP430 Infomemory Storage - * - * @author Michael Baar - */ - -#ifndef INFOMEM_H -#define INFOMEM_H - -#if !defined(INFOMEM_START) || !defined(INFOMEM_BLOCK_SIZE) - #error "infomem position (INFOMEM_START) and block size (INFOMEM_BLOCK_SIZE) need to be defined for the platform" -#endif - -/** - * @brief Read bytes from infomemory - * @param[out] buffer Pointer to buffer for read data - * @param[in] offset Offset in infomemory (0-254) - * @param[in] size Number of bytes to read - */ -void infomem_read(void *buffer, unsigned int offset, unsigned char size); - -/** - * @brief Write bytes to infomemory - * @param[in] offset Offset in infomemory (0-254) - * @param[in] count Number of items following - * each item is a pair pointer, length - * - * Example: Infomem_write( 0, 2, &a,3, &b,1 ); - * - * \note: The MSP430 has two consecutive blocks of infomemory. - * Each is 128 bytes large. The offset is the relative address - * starting at the beginning of the first block. You can write an - * arbitrary number of bytes at any offset, but this function - * cannot write across the two blocks of infomemory. - */ -bool infomem_write(unsigned int offset, unsigned char count, ...); - -#endif // !INFOMEM_H diff --git a/platform/msb430/dev/msb430-uart1.c b/platform/msb430/dev/msb430-uart1.c deleted file mode 100644 index d8ce6a44c..000000000 --- a/platform/msb430/dev/msb430-uart1.c +++ /dev/null @@ -1,231 +0,0 @@ -/* -Copyright 2007, Freie Universitaet Berlin. All rights reserved. - -These sources were developed at the Freie Universität Berlin, Computer -Systems and Telematics group. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -- Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -- 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. - -- Neither the name of Freie Universitaet Berlin (FUB) 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 FUB and the contributors on an "as is" -basis, without any representations or warranties of any kind, express -or implied including, but not limited to, representations or -warranties of non-infringement, merchantability or fitness for a -particular purpose. In no event shall FUB 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 implementation was developed by the CST group at the FUB. - -For documentation and questions please use the web site -http://scatterweb.mi.fu-berlin.de and the mailinglist -scatterweb@lists.spline.inf.fu-berlin.de (subscription via the Website). -Berlin, 2007 -*/ - -/** - * @file ScatterWeb.Uart.c - * @addtogroup interfaces - * @brief UART interface - * @author Michael Baar - * - * UART switch for RS232 and SPI protocols on UART1 written for - * ScatterWeb MSB boards. Compatible to ScatterWeb EOS, - * ScatterWeb Bootload and Contiki. - */ - -#include "contiki.h" -#include -#include "dev/msb430-uart1.h" -#include "dev/lpm.h" -#include "isr_compat.h" - -#ifndef U1ME -#define U1ME ME2 -#endif - -volatile unsigned char uart_mode = UART_MODE_RESET; -volatile unsigned char uart_lockcnt = 0; -volatile uint8_t uart_edge = 0; - -static unsigned char uart_speed_br0[UART_NUM_MODES]; -static unsigned char uart_speed_br1[UART_NUM_MODES]; -static unsigned char uart_speed_bmn[UART_NUM_MODES]; -static uart_handler_t uart_handler[UART_NUM_MODES] = {NULL, NULL}; - -/*---------------------------------------------------------------------------*/ -static void -uart_configure(unsigned mode) -{ - _DINT(); /* disable interrupts */ - - UART_WAIT_TXDONE(); /* wait till all buffered data has been transmitted */ - - if(mode == UART_MODE_RS232) { - P5OUT |= 0x01; - /* unselect SPI */ - P3SEL |= 0xC0; - /* select rs232 */ - UCTL1 = SWRST | CHAR; /* 8-bit character */ - UTCTL1 |= SSEL1; /* UCLK = MCLK */ - /* activate */ - U1ME |= UTXE1 | URXE1; /* Enable USART1 TXD/RXD */ - } else if(mode == UART_MODE_SPI) { - P3SEL &= ~0xC0; /* unselect RS232 */ - // to SPI mode - UCTL1 = SWRST | CHAR | SYNC | MM; /* 8-bit SPI Master */ - /* - * SMCLK, 3-pin mode, clock idle low, data valid on - * rising edge, UCLK delayed - */ - UTCTL1 |= CKPH | SSEL1 | SSEL0 | STC; /* activate */ - U1ME |= USPIE1; /* Enable USART1 SPI */ - } - - /* restore speed settings */ - UBR01 = uart_speed_br0[mode]; /* set baudrate */ - UBR11 = uart_speed_br1[mode]; - UMCTL1 = uart_speed_bmn[mode]; /* set modulation */ - - UCTL1 &= ~SWRST; /* clear reset flag */ - _EINT(); /* enable interrupts */ -} -/*---------------------------------------------------------------------------*/ -void -uart_set_speed(unsigned mode, unsigned ubr0, - unsigned ubr1, unsigned umctl) -{ - /* store the setting */ - uart_speed_br0[mode] = ubr0; /* baudrate */ - uart_speed_br1[mode] = ubr1; /* baudrate */ - uart_speed_bmn[mode] = umctl; /* modulation */ - - /* reconfigure, if mode active */ - if(uart_mode == mode) { - uart_configure(mode); - } -} -/*---------------------------------------------------------------------------*/ -void -uart_set_handler(unsigned mode, uart_handler_t handler) -{ - /* store the setting */ - uart_handler[mode] = handler; - if(mode == uart_mode) { - if(handler == NULL) { - IE2 &= ~URXIE1; /* Disable USART1 RX interrupt */ - } else { - IE2 |= URXIE1; /* Enable USART1 RX interrupt */ - } - } -} -/*---------------------------------------------------------------------------*/ -int -uart_lock(unsigned mode) -{ - /* already locked? */ - if(uart_mode != mode && uart_lockcnt > 0) { - return 0; - } - - /* increase lock count */ - uart_lockcnt++; - /* switch mode (if neccessary) */ - uart_set_mode(mode); - return 1; -} -/*---------------------------------------------------------------------------*/ -int -uart_lock_wait(unsigned mode) -{ - while(UART_WAIT_LOCK(mode)) { - _NOP(); - } - return uart_lock(mode); -} -/*---------------------------------------------------------------------------*/ -int -uart_unlock(unsigned mode) -{ - if((uart_lockcnt == 0) || (mode != uart_mode)) { - uart_lockcnt = 0; - uart_set_mode(UART_MODE_DEFAULT); - return 0; - } - - /* decrement lock */ - if(uart_lockcnt > 0) { - uart_lockcnt--; - /* if no more locks, switch back to default mode */ - if(uart_lockcnt == 0) { - uart_set_mode(UART_MODE_DEFAULT); - } - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -void -uart_set_mode(unsigned mode) -{ - /* do nothing if the mode is already set */ - if(mode == uart_mode) { - return; - } - - IE2 &= ~(URXIE1 | UTXIE1); /* disable irq */ - uart_configure(mode); /* configure uart parameters */ - uart_mode = mode; - - if(uart_handler[mode] != NULL) { - IE2 |= URXIE1; /* Enable USART1 RX interrupt */ - } -} -/*---------------------------------------------------------------------------*/ -int -uart_get_mode(void) -{ - return uart_mode; -} -/*---------------------------------------------------------------------------*/ -ISR(UART1RX, uart_rx) -{ - uart_handler_t handler = uart_handler[uart_mode]; - int c; - - if(!(IFG2 & URXIFG1)) { - /* If rising edge is detected, toggle & return */ - uart_edge = 1; - U1TCTL &= ~URXSE; - U1TCTL |= URXSE; - _BIC_SR_IRQ(LPM3_bits); - return; - } - uart_edge = 0; - if(!(URCTL1 & RXERR)) { - c = UART_RX; - if(handler(c)) { - _BIC_SR_IRQ(LPM3_bits); - } - } else { - /* read out the char to clear the interrupt flags. */ - c = UART_RX; - } -} diff --git a/platform/msb430/dev/msb430-uart1.h b/platform/msb430/dev/msb430-uart1.h deleted file mode 100644 index 470eb852d..000000000 --- a/platform/msb430/dev/msb430-uart1.h +++ /dev/null @@ -1,111 +0,0 @@ -/* -Copyright 2007, Freie Universitaet Berlin. All rights reserved. - -These sources were developed at the Freie Universität Berlin, Computer -Systems and Telematics group. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -- Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -- 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. - -- Neither the name of Freie Universitaet Berlin (FUB) 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 FUB and the contributors on an "as is" -basis, without any representations or warranties of any kind, express -or implied including, but not limited to, representations or -warranties of non-infringement, merchantability or fitness for a -particular purpose. In no event shall FUB 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 implementation was developed by the CST group at the FUB. - -For documentation and questions please use the web site -http://scatterweb.mi.fu-berlin.de and the mailinglist -scatterweb@lists.spline.inf.fu-berlin.de (subscription via the Website). -Berlin, 2007 -*/ - -/** - * @addtogroup interfaces - * @{ */ - -/** - * @defgroup uart1 UART1 - * The UART module multiplexes differenct protocol on the MSB's UART1 - * interface. Currently RS232 and SPI are supported. - * @{ - */ - -/** - * \file Header file for for the MSB430 UART driver. - * \author Michael Baar - */ - -#ifndef MSB430_UART1_H -#define MSB430_UART1_H - -#define UART_RX RXBUF1 -#define UART_TX TXBUF1 -#define UART_RESET_RX() do { U1IFG &= ~URXIFG1; } while(0) -#define UART_RESET_RXTX() do { U1IFG &= ~(URXIFG1 | UTXIFG1); } while(0) -#define UART_WAIT_RX() while((U1IFG & URXIFG1) == 0) { _NOP(); } -#define UART_WAIT_TX() while((U1IFG & UTXIFG1) == 0) { _NOP(); } -#define UART_WAIT_TXDONE() while((UTCTL1 & TXEPT) == 0) { _NOP(); } - -/** - * @brief Operating state - */ -extern volatile unsigned char uart_mode; -extern volatile unsigned char uart_lockcnt; - -/** - * @name UART mode flags - * @{ - */ -#define UART_MODE_RS232 (0x00u) ///< RS232 mode -#define UART_MODE_SPI (0x01u) ///< SPI mode -#define UART_MODE_DEFAULT UART_MODE_RS232 -#define UART_NUM_MODES (UART_MODE_SPI + 1) ///< Highest mode number -#define UART_MODE_RESET (0xFFu) ///< reset with current settings -/** @} */ - -#define UART_WAIT_LOCK(x) ((uart_mode != x) && (uart_lockcnt)) -#define UART_MODE_IS(x) (uart_mode == x) - -typedef int(*uart_handler_t)(unsigned char); - -/** - * \brief Initialize the UART module - * - * This function is called from the boot up code to - * initalize the UART module. - */ -void uart_init(void); - -void uart_set_speed(unsigned, unsigned, unsigned, unsigned); -void uart_set_handler(unsigned, uart_handler_t); -int uart_lock(unsigned); -int uart_lock_wait(unsigned); -int uart_unlock(unsigned); -void uart_set_mode(unsigned); -int uart_get_mode(void); - -#endif /* !MSB430_UART1_H */ - -/** @} */ -/** @} */ diff --git a/platform/msb430/dev/rs232.c b/platform/msb430/dev/rs232.c deleted file mode 100644 index 44a299813..000000000 --- a/platform/msb430/dev/rs232.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ - -/** \addtogroup esbrs232 - * @{ */ - -/** - * \file - * RS232 communication device driver for the MSP430. - * \author Adam Dunkels - * - * This file contains an RS232 device driver for the MSP430 microcontroller. - * - */ -#include "contiki.h" -#include -#include "dev/msb430-uart1.h" -#include "rs232.h" - -#ifndef U1IFG -#define U1IFG IFG2 -#endif - -/*---------------------------------------------------------------------------*/ -/** - * Initalize the RS232 port. - * - */ -void -rs232_init(void) -{ - rs232_set_speed(RS232_115200); -} -/*---------------------------------------------------------------------------*/ -int -putchar(int c) -{ - if(uart_get_mode() == UART_MODE_RS232) { - /* Loop until the transmission buffer is available. */ - UART_WAIT_TX(); - /* Transmit the data. */ - UART_TX = c; - return c; - } else { - return -1; - } -} -/*---------------------------------------------------------------------------*/ -void -rs232_send(char c) -{ - /* Check if the UART is in RS232 mode before sending. - This check can be ommitted if every access to rs232 locks the uart - before using it. - */ - - putchar(c); -} -/*---------------------------------------------------------------------------*/ -void -rs232_set_speed(enum rs232_speed speed) -{ - // baud - const unsigned char br_table[5][3] = { - {0x00, 0x01, 0x00}, // 9600 - {0x80, 0x00, 0x00}, // 19200 - {0x40, 0x00, 0x00}, // 38400 - {0x2a, 0x00, 0x5b}, // 57600 - {0x15, 0x00, 0x4a} // 115200 - }; - - uart_set_speed(UART_MODE_RS232, br_table[speed][0], - br_table[speed][1], br_table[speed][2]); -} -/*---------------------------------------------------------------------------*/ -void -rs232_print(char *cptr) -{ - /* lock UART for the print operation */ - if(uart_lock(UART_MODE_RS232)) { - while(*cptr != 0) { - rs232_send(*cptr); - ++cptr; - } - uart_unlock(UART_MODE_RS232); - } -} -/*---------------------------------------------------------------------------*/ -void -rs232_set_input(uart_handler_t f) -{ - uart_set_handler(UART_MODE_RS232, f); -} -/** @} */ diff --git a/platform/msb430/dev/rs232.h b/platform/msb430/dev/rs232.h deleted file mode 100644 index 59f1ffe33..000000000 --- a/platform/msb430/dev/rs232.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ - -/** \addtogroup esb - * @{ */ - -/** - * \defgroup esbrs232 ESB RS232 - * - * @{ - */ - -/** - * \file - * Header file for MSP430 RS232 driver. - * \author Adam Dunkels - * - */ -#ifndef __RS232_H__ -#define __RS232_H__ - -#include "dev/msb430-uart1.h" - -enum rs232_speed { - RS232_9600 = 0, - RS232_19200 = 1, - RS232_38400 = 2, - RS232_57600 = 3, - RS232_115200 = 4 -}; - -/** - * \brief Initialize the RS232 module - * - * This function is called from the boot up code to - * initalize the RS232 module. - */ -void rs232_init(void); - -/** - * \brief Set an input handler for incoming RS232 data - * \param f A pointer to a byte input handler - * - * This function sets the input handler for incoming RS232 - * data. The input handler function is called for every - * incoming data byte. The function is called from the - * RS232 interrupt handler, so care must be taken when - * implementing the input handler to avoid race - * conditions. - * - * The return value of the input handler affects the sleep - * mode of the CPU: if the input handler returns non-zero - * (true), the CPU is awakened to let other processing - * take place. If the input handler returns zero, the CPU - * is kept sleeping. - */ -void rs232_set_input(uart_handler_t f); - -/** - * \brief Configure the speed of the RS232 hardware - * \param speed The speed - * - * This function configures the speed of the RS232 - * hardware. The allowed parameters are RS232_9600, - * RS232_19200, RS232_38400, RS232_57600, and RS232_115200. - */ -void rs232_set_speed(enum rs232_speed speed); - -/** - * \brief Print a text string on RS232 - * \param str A pointer to the string that is to be printed - * - * This function prints a string to RS232. The string must - * be terminated by a null byte. The RS232 module must be - * correctly initalized and configured for this function - * to work. - */ -void rs232_print(char *text); - -/** - * \brief Print a character on RS232 - * \param c The character to be printed - * - * This function prints a character to RS232. The RS232 - * module must be correctly initalized and configured for - * this function to work. - */ -void rs232_send(char c); - -#endif /* __RS232_H__ */ - -/** @} */ -/** @} */ diff --git a/platform/msb430/dev/sd-arch.c b/platform/msb430/dev/sd-arch.c deleted file mode 100644 index 02f5666f0..000000000 --- a/platform/msb430/dev/sd-arch.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2009, 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. - * - */ - -/** - * \file - * Architecture-dependent functions for SD over SPI. - * \author - * Nicolas Tsiftes - */ - -#include "contiki.h" -#include "msb430-uart1.h" -#include "sd-arch.h" - -#define SPI_IDLE 0xff - -int -sd_arch_init(void) -{ - P2SEL &= ~64; - P2DIR &= ~64; - - P5SEL |= 14; - P5SEL &= ~1; - P5OUT |= 1; - P5DIR |= 13; - P5DIR &= ~2; - - uart_set_speed(UART_MODE_SPI, 2, 0, 0); - - return 0; -} - - -void -sd_arch_spi_write(int c) -{ - UART_TX = c; - UART_WAIT_TXDONE(); -} - -void -sd_arch_spi_write_block(uint8_t *bytes, int amount) -{ - int i; - volatile char dummy; - - for(i = 0; i < amount; i++) { - UART_TX = bytes[i]; - UART_WAIT_TXDONE(); - UART_WAIT_RX(); - dummy = UART_RX; - } -} - - -unsigned -sd_arch_spi_read(void) -{ - if((U1IFG & URXIFG1) == 0) { - UART_TX = SPI_IDLE; - UART_WAIT_RX(); - } - return UART_RX; -} diff --git a/platform/msb430/dev/sd-arch.h b/platform/msb430/dev/sd-arch.h deleted file mode 100644 index f540505f6..000000000 --- a/platform/msb430/dev/sd-arch.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2009, 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. - * - */ - -/** - * \file - * SD driver implementation using SPI. - * \author - * Nicolas Tsiftes - */ - -#ifndef SD_ARCH_H -#define SD_ARCH_H - -#include "msb430-uart1.h" - -#ifndef U1IFG -#define U1IFG IFG2 -#endif /* U1IFG */ - -#define MS_DELAY(x) clock_delay(354 * (x)) - -/* Machine-dependent macros. */ -#define LOCK_SPI() do { \ - if(!uart_lock(UART_MODE_SPI)) {\ - return 0; \ - } \ - } while(0) -#define UNLOCK_SPI() do { \ - uart_unlock(UART_MODE_SPI); \ - } while(0) - -#define SD_CONNECTED() !(P2IN & 0x40) -#define LOWER_CS() (P5OUT &= ~0x01) -#define RAISE_CS() do { \ - UART_WAIT_TXDONE(); \ - P5OUT |= 0x01; \ - UART_TX = SPI_IDLE; \ - UART_WAIT_TXDONE(); \ - } while(0) - -/* Configuration parameters. */ -#define SD_TRANSACTION_ATTEMPTS 512 -#define SD_READ_RESPONSE_ATTEMPTS 8 -#define SD_READ_BLOCK_ATTEMPTS 2 - -int sd_arch_init(void); -void sd_arch_spi_write(int c); -void sd_arch_spi_write_block(uint8_t *bytes, int amount); -unsigned sd_arch_spi_read(void); - -#endif /* !SD_ARCH_H */ diff --git a/platform/msb430/dev/sd.c b/platform/msb430/dev/sd.c deleted file mode 100644 index b1ef4c21b..000000000 --- a/platform/msb430/dev/sd.c +++ /dev/null @@ -1,513 +0,0 @@ -/* - * Copyright (c) 2009, 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. - * - */ - -/** - * \file - * SD driver implementation using SPI. - * \author - * Nicolas Tsiftes - */ - -#include "contiki.h" -#include "sd.h" -#include "sd-arch.h" - -#include - -#define DEBUG 0 -#if DEBUG -#include -#define PRINTF(...) printf(__VA_ARGS__) -#else -#define PRINTF(...) -#endif - -#ifndef MIN -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif /* MIN */ - -#define SPI_IDLE 0xff - -/* SD commands */ -#define GO_IDLE_STATE 0 -#define SEND_OP_COND 1 -#define SWITCH_FUNC 6 -#define SEND_IF_COND 8 -#define SEND_CSD 9 -#define SEND_CID 10 -#define STOP_TRANSMISSION 12 -#define SEND_STATUS 13 -#define READ_SINGLE_BLOCK 17 -#define WRITE_BLOCK 24 -#define READ_OCR 58 - -/* SD response lengths. */ -#define R1 1 -#define R2 2 -#define R3 5 -#define R7 5 - -#define START_BLOCK_TOKEN 0xfe - -/* Status codes returned after writing a block. */ -#define DATA_ACCEPTED 2 -#define DATA_CRC_ERROR 5 -#define DATA_WRITE_ERROR 6 - -static uint16_t rw_block_size; -static uint16_t block_size; - -static int read_register(int register_cmd, char *buf, int register_size); -/*---------------------------------------------------------------------------*/ -static int -send_command(uint8_t cmd, uint32_t argument) -{ - uint8_t req[6]; - - req[0] = 0x40 | cmd; - req[1] = argument >> 24; - req[2] = argument >> 16; - req[3] = argument >> 8; - req[4] = argument; - /* The CRC hard-wired to 0x95 is only needed for the initial - GO_IDLE_STATE command. */ - req[5] = 0x95; - - sd_arch_spi_write(SPI_IDLE); - sd_arch_spi_write_block(req, sizeof(req)); - sd_arch_spi_write(SPI_IDLE); - - return 0; -} -/*---------------------------------------------------------------------------*/ -static uint8_t * -get_response(int length) -{ - int i; - int x; - static uint8_t r[R7]; - - for(i = 0; i < SD_READ_RESPONSE_ATTEMPTS; i++) { - x = sd_arch_spi_read(); - if((x & 0x80) == 0) { - /* A get_response byte is indicated by the MSB being 0. */ - r[0] = x; - break; - } - } - - if(i == SD_READ_RESPONSE_ATTEMPTS) { - return NULL; - } - - for(i = 1; i < length; i++) { - r[i] = sd_arch_spi_read(); - } - - return r; -} -/*---------------------------------------------------------------------------*/ -static unsigned char * -transaction(int command, unsigned long argument, - int response_type, unsigned attempts) -{ - unsigned i; - unsigned char *r; - - LOCK_SPI(); - r = NULL; - for(i = 0; i < attempts; i++) { - LOWER_CS(); - send_command(command, argument); - r = get_response(response_type); - RAISE_CS(); - if(r != NULL) { - break; - } - } - UNLOCK_SPI(); - - return r; -} -/*---------------------------------------------------------------------------*/ -int -sd_initialize(void) -{ - unsigned char reg[16]; - int i; - uint8_t *r, read_bl_len; - - if(sd_arch_init() < 0) { - return SD_INIT_ERROR_ARCH; - } - - if(SD_CONNECTED() < 0) { - return SD_INIT_ERROR_NO_CARD; - } - - r = transaction(GO_IDLE_STATE, 0, R1, SD_TRANSACTION_ATTEMPTS); - if(r != NULL) { - PRINTF("Go-idle result: %d\n", r[0]); - } else { - PRINTF("Failed to get go-idle response\n"); - } - - r = transaction(SEND_IF_COND, 0, R7, SD_TRANSACTION_ATTEMPTS); - if(r != NULL) { - PRINTF("IF cond: %d %d %d %d %d\n", r[0], r[1], r[2], r[3], r[4]); - } else { - PRINTF("failed to get IF cond\n"); - return SD_INIT_ERROR_NO_IF_COND; - } - - LOCK_SPI(); - - for(i = 0; i < SD_TRANSACTION_ATTEMPTS; i++) { - LOWER_CS(); - send_command(SEND_OP_COND, 0); - r = get_response(R1); - RAISE_CS(); - if(r != NULL && !(r[0] & 1)) { - break; - } - } - - UNLOCK_SPI(); - - if(r != NULL) { - PRINTF("OP cond: %d (%d iterations)\n", r[0], i); - } else { - PRINTF("Failed to get OP cond get_response\n"); - } - - LOCK_SPI(); - - for(i = 0; i < SD_TRANSACTION_ATTEMPTS; i++) { - LOWER_CS(); - send_command(READ_OCR, 0); - r = get_response(R3); - RAISE_CS(); - if(r != NULL) { - break; - } - } - - UNLOCK_SPI(); - - if(r != NULL) { - PRINTF("OCR: %d %d %d %d %d\n", r[0], r[1], r[2], r[3], r[4]); - } - - - if(read_register(SEND_CSD, reg, sizeof(reg)) < 0) { - PRINTF("Failed to get block size of SD card\n"); - return SD_INIT_ERROR_NO_BLOCK_SIZE; - } - - read_bl_len = reg[5] & 0x0f; - block_size = 1 << read_bl_len; - rw_block_size = (block_size > SD_DEFAULT_BLOCK_SIZE) ? - SD_DEFAULT_BLOCK_SIZE : block_size; - PRINTF("Found block size %d\n", block_size); - - /* XXX Arbitrary wait time here. Need to investigate why this is needed. */ - MS_DELAY(5); - - return SD_OK; -} -/*---------------------------------------------------------------------------*/ -int -sd_write_block(sd_offset_t offset, char *buf) -{ - unsigned char *r; - int retval; - int i; - unsigned char data_response; - unsigned char status_code; - - LOCK_SPI(); - r = NULL; - retval = SD_WRITE_ERROR_NO_CMD_RESPONSE; - for(i = 0; i < SD_TRANSACTION_ATTEMPTS; i++) { - LOWER_CS(); - send_command(WRITE_BLOCK, offset); - r = get_response(R1); - if(r != NULL) { - break; - } - RAISE_CS(); - } - - if(r != NULL && r[0] == 0) { - /* We received an R1 response with no errors. - Send a start block token to the card now. */ - sd_arch_spi_write(START_BLOCK_TOKEN); - - /* Write the data block. */ - sd_arch_spi_write_block(buf, rw_block_size); - - /* Get a response from the card. */ - retval = SD_WRITE_ERROR_NO_BLOCK_RESPONSE; - for(i = 0; i < SD_TRANSACTION_ATTEMPTS; i++) { - data_response = sd_arch_spi_read(); - if((data_response & 0x11) == 1) { - /* Data response token received. */ - status_code = (data_response >> 1) & 0x7; - if(status_code == DATA_ACCEPTED) { - retval = rw_block_size; - } else { - retval = SD_WRITE_ERROR_PROGRAMMING; - } - break; - } - } - } - - RAISE_CS(); - UNLOCK_SPI(); - - return retval; -} -/*---------------------------------------------------------------------------*/ -static int -read_block(unsigned read_cmd, sd_offset_t offset, char *buf, int len) -{ - unsigned char *r; - int i; - int token; - int retval; - - LOCK_SPI(); - - r = NULL; - for(i = 0; i < SD_TRANSACTION_ATTEMPTS; i++) { - LOWER_CS(); - send_command(read_cmd, offset); - r = get_response(R1); - if(r != NULL) { - break; - } - RAISE_CS(); - } - - if(r != NULL && r[0] == 0) { - /* We received an R1 response with no errors. - Get a token from the card now. */ - for(i = 0; i < SD_TRANSACTION_ATTEMPTS; i++) { - token = sd_arch_spi_read(); - if(token == START_BLOCK_TOKEN || (token > 0 && token <= 8)) { - break; - } - } - - if(token == START_BLOCK_TOKEN) { - /* A start block token has been received. Read the block now. */ - for(i = 0; i < len; i++) { - buf[i] = sd_arch_spi_read(); - } - - /* Consume CRC. TODO: Validate the block. */ - sd_arch_spi_read(); - sd_arch_spi_read(); - - retval = len; - } else if(token > 0 && token <= 8) { - /* The card returned a data error token. */ - retval = SD_READ_ERROR_TOKEN; - } else { - /* The card never returned a token after our read attempts. */ - retval = SD_READ_ERROR_NO_TOKEN; - } - - RAISE_CS(); - UNLOCK_SPI(); - return retval; - } - - RAISE_CS(); - UNLOCK_SPI(); - - if(r != NULL) { - PRINTF("status during read: %d\n", r[0]); - } - - return SD_READ_ERROR_NO_CMD_RESPONSE; -} -/*---------------------------------------------------------------------------*/ -int -sd_read_block(sd_offset_t offset, char *buf) -{ - return read_block(READ_SINGLE_BLOCK, offset, buf, rw_block_size); -} -/*---------------------------------------------------------------------------*/ -static int -read_register(int register_cmd, char *buf, int register_size) -{ - return read_block(register_cmd, 0, buf, register_size); -} -/*---------------------------------------------------------------------------*/ -sd_offset_t -sd_get_capacity(void) -{ - unsigned char reg[16]; - int r; - uint16_t c_size; - uint8_t c_size_mult; - sd_offset_t block_nr; - sd_offset_t mult; - - r = read_register(SEND_CSD, reg, sizeof(reg)); - if(r < 0) { - return r; - } - - c_size = ((reg[6] & 3) << 10) + (reg[7] << 2) + ((reg[8] >> 6) & 3); - c_size_mult = ((reg[9] & 3) << 1) + ((reg[10] & 0x80) >> 7); - mult = 1 << (c_size_mult + 2); - block_nr = (c_size + 1) * mult; - - return block_nr * block_size; -} -/*---------------------------------------------------------------------------*/ -char * -sd_error_string(int error_code) -{ -#if DEBUG - switch(error_code) { - case SD_OK: - return "operation succeeded"; - case SD_INIT_ERROR_NO_CARD: - return "no card was found"; - case SD_INIT_ERROR_ARCH: - return "architecture-dependent initialization failed"; - case SD_INIT_ERROR_NO_IF_COND: - return "unable to obtain the interface condition"; - case SD_INIT_ERROR_NO_BLOCK_SIZE: - return "unable to obtain the block size"; - case SD_WRITE_ERROR_NO_CMD_RESPONSE: - return "no response from the card after submitting a write request"; - case SD_WRITE_ERROR_NO_BLOCK_RESPONSE: - return "no response from the card after sending a data block"; - case SD_WRITE_ERROR_PROGRAMMING: - return "the write request failed because of a card error"; - case SD_WRITE_ERROR_TOKEN: - return "the card is not ready to grant a write request"; - case SD_READ_ERROR_NO_TOKEN: - case SD_WRITE_ERROR_NO_TOKEN: - return "did not receive a start block token"; - case SD_READ_ERROR_INVALID_SIZE: - return "invalid read block size"; - case SD_READ_ERROR_TOKEN: - return "the card is not ready to read a data block"; - case SD_READ_ERROR_NO_CMD_RESPONSE: - return "no response from the card after submitting a read request"; - default: - break; - } -#endif - return "unspecified error"; -} -/*---------------------------------------------------------------------------*/ -int -sd_write(sd_offset_t offset, char *buf, size_t size) -{ - sd_offset_t address; - uint16_t offset_in_block; - int r, i; - size_t written; - size_t to_write; - char sd_buf[rw_block_size]; - - /* Emulation of data writing using arbitrary offsets and chunk sizes. */ - memset(sd_buf, 0, sizeof(sd_buf)); - written = 0; - offset_in_block = offset & (rw_block_size - 1); - - do { - to_write = MIN(size - written, rw_block_size - offset_in_block); - address = (offset + written) & ~(rw_block_size - 1); - - for(i = 0; i < SD_READ_BLOCK_ATTEMPTS; i++) { - r = sd_read_block(address, sd_buf); - if(r == sizeof(sd_buf)) { - break; - } - } - if(r != sizeof(sd_buf)) { - return r; - } - - memcpy(&sd_buf[offset_in_block], &buf[written], to_write); - r = sd_write_block(address, sd_buf); - if(r != sizeof(sd_buf)) { - return r; - } - written += to_write; - offset_in_block = 0; - } while(written < size); - - return written; -} -/*---------------------------------------------------------------------------*/ -int -sd_read(sd_offset_t offset, char *buf, size_t size) -{ - size_t total_read; - size_t to_read; - char sd_buf[rw_block_size]; - uint16_t offset_in_block; - int r, i; - - /* Emulation of data reading using arbitrary offsets and chunk sizes. */ - total_read = 0; - offset_in_block = offset & (rw_block_size - 1); - - do { - to_read = MIN(size - total_read, rw_block_size - offset_in_block); - for(i = 0; i < SD_READ_BLOCK_ATTEMPTS; i++) { - r = sd_read_block((offset + total_read) & ~(rw_block_size - 1), sd_buf); - if(r == sizeof(sd_buf)) { - break; - } - } - if(r != sizeof(sd_buf)) { - return r; - } - - memcpy(&buf[total_read], &sd_buf[offset_in_block], to_read); - total_read += to_read; - offset_in_block = 0; - } while(total_read < size); - - return size; -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/msb430/dev/sd.h b/platform/msb430/dev/sd.h deleted file mode 100644 index 8efc33305..000000000 --- a/platform/msb430/dev/sd.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2009, 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. - * - */ - -/** - * \file - * SD driver interface. - * \author - * Nicolas Tsiftes - */ - -#ifndef SD_H -#define SD_H - -#include "sd-arch.h" - -#define SD_DEFAULT_BLOCK_SIZE 512 -#define SD_REGISTER_SIZE 16 - -/* API return codes. */ -#define SD_OK 1 - -#define SD_INIT_ERROR_NO_CARD -1 -#define SD_INIT_ERROR_ARCH -2 -#define SD_INIT_ERROR_NO_IF_COND -3 -#define SD_INIT_ERROR_NO_BLOCK_SIZE -4 - -#define SD_WRITE_ERROR_NO_CMD_RESPONSE -5 -#define SD_WRITE_ERROR_NO_BLOCK_RESPONSE -6 -#define SD_WRITE_ERROR_PROGRAMMING -7 -#define SD_WRITE_ERROR_TOKEN -8 -#define SD_WRITE_ERROR_NO_TOKEN -9 - -#define SD_READ_ERROR_NO_CMD_RESPONSE -10 -#define SD_READ_ERROR_INVALID_SIZE -11 -#define SD_READ_ERROR_TOKEN -12 -#define SD_READ_ERROR_NO_TOKEN -13 - -/* Type definition. */ -typedef uint32_t sd_offset_t; - -/* API */ -int sd_initialize(void); -int sd_write(sd_offset_t, char *, unsigned); -int sd_read(sd_offset_t, char *, unsigned); -int sd_write_block(sd_offset_t, char *); -int sd_read_block(sd_offset_t, char *); -sd_offset_t sd_get_capacity(void); -char *sd_error_string(int); - -#endif /* !SD_H */ diff --git a/platform/msb430/dev/sht11-arch.h b/platform/msb430/dev/sht11-arch.h deleted file mode 100644 index 42dc6b3c8..000000000 --- a/platform/msb430/dev/sht11-arch.h +++ /dev/null @@ -1,52 +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. - * - */ - -/** - * \file - * Architecture-specific definitions for the SHT11 sensor on MSB-430. - * \author - * Nicolas Tsiftes - */ - -#ifndef SHT11_ARCH_H -#define SHT11_ARCH_H - -#define SHT11_ARCH_SDA 4 /* P3.4 */ -#define SHT11_ARCH_SCL 5 /* P3.5 */ -#define SHT11_ARCH_PWR 6 /* P3.6 */ - -#define SHT11_PxDIR P3DIR -#define SHT11_PxIN P3IN -#define SHT11_PxOUT P3OUT -#define SHT11_PxSEL P3SEL - -#endif diff --git a/platform/msb430/doc/msb430.txt b/platform/msb430/doc/msb430.txt deleted file mode 100644 index 840f6db5d..000000000 --- a/platform/msb430/doc/msb430.txt +++ /dev/null @@ -1,51 +0,0 @@ -/** \addtogroup platform - * @{ - **/ - -/** -\defgroup msb430 The Modular Sensor Board - -The Modular Sensor Board (MSB430) was developed by FU-Berlin and was -added as a platform in Contiki in the spring of 2007. In its basic form, -this board consists of a Texas Instruments MSP430f1612 processor, a -Chipcon CC1020 radio chip, an MMA7260Q accelerometer, and a Sensirion -SHT11 temperature and humidity sensor. The MSB also has an SD device, -which makes it suitable for storage-centric sensor networks. There are -also extended versions of the board that are equipped with a GPRS-modem -and a GPS-receiver. - -\section msb430-programming Programming the MSB430 - -The msb430 port requires an installation of mspgcc -(http://mspgcc.sourceforge.net) to compile. Once the compilation tools -have been installed, you can compile your software and Contiki with -three main target types: - -.firmware - A system image in ELF format. -.ihex - A firmware file converted to the Intel Hex format. -.u - Direct upload to a node. - -Before compiling your system, you may want to look at the configuration -options in platform/msb430/configure-conf.h. - -The node is typically programmed by typing - - make TARGET=msb430 .u - -Alternatively, a ready .ihex file can be uploaded to the node by running - - msp430-jtag -l -e -I - -Platform-specific example programs are included in platform/msb430/apps -and can be compiled and uploaded from platform/msb430. A larger set of -examples for Contiki in general are in the examples/ directory. - -More information about the MSB430 platform can be found at -Scatterweb: http://www.scatterweb.com/content/products/MSB_en.html - -@{ - -*/ - -/** @} */ -/** @} */ diff --git a/platform/msb430/init-net-uip.c b/platform/msb430/init-net-uip.c deleted file mode 100644 index 66ee618cd..000000000 --- a/platform/msb430/init-net-uip.c +++ /dev/null @@ -1,79 +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. - * - */ - -/** - * \file - * uIP initialization for the MSB-430 port. - * \author - * Nicolas Tsiftes - */ - -#include "contiki.h" -#include "contiki-net.h" -#include "sys/node-id.h" -#include "dev/slip.h" -#include "dev/cc1020-uip.h" -#include "contiki-msb430.h" - -static struct uip_fw_netif slipif = -{UIP_FW_NETIF(172,16,0,0, 255,255,255,0, slip_send)}; - -static struct uip_fw_netif wsnif = -{UIP_FW_NETIF(0,0,0,0, 0,0,0,0, cc1020_uip_send)}; - -void -init_net(void) -{ - uip_ipaddr_t hostaddr; - cc1020_init(cc1020_config_19200); - - uip_init(); - uip_fw_init(); - /*tcpip_set_forwarding(1);*/ - - process_start(&tcpip_process, NULL); - process_start(&slip_process, NULL); - process_start(&uip_fw_process, NULL); - - rs232_set_input(slip_input_byte); - - cc1020_uip_init(); - cc1020_on(); - - if (node_id > 0) { - uip_ipaddr(&hostaddr, 172, 16, 1, node_id); - uip_sethostaddr(&hostaddr); - } - - uip_fw_register(&slipif); - uip_fw_default(&wsnif); -} diff --git a/platform/msb430/loader/loader-arch.h b/platform/msb430/loader/loader-arch.h deleted file mode 100644 index 260062d5a..000000000 --- a/platform/msb430/loader/loader-arch.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2005, 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. - * - */ -#ifndef __LOADER_ARCH_H__ -#define __LOADER_ARCH_H__ - -/** - * Load a program from EEPROM. - * - * This function loads a program from EEPROM into the flash ROM (code) and RAM (data). - * - * \param code The address of the first byte of code in the EEPROM. - * - * \param codelen The length of the code. - * - * \param data The address of the first byte of data in the EEPROM. - * - * \param datalen The length of the data. - * - */ -void loader_arch_load(unsigned short startaddr); - -/** - * Unload a program. - * - * This function should not be called directly, but accessed through - * the macro LOADER_UNLOAD(). The function unloads a program from both - * RAM and ROM. - * - * \param codeaddr A pointer to the first byte of program code. - * - * \param dataaddr A pointer to the first byte of program data. - */ -void loader_arch_free(void *codeaddr, void *dataaddr); - -extern void *loader_arch_codeaddr, *loader_arch_dataaddr; - -#ifndef LOADER_UNLOAD -#define LOADER_UNLOAD() loader_arch_free(&loader_arch_codeaddr, &loader_arch_dataaddr) -#endif - -#define LOADER_ARCH_MAGIC 0x373a -#define LOADER_ARCH_VERSION 0x0001 - -#endif /* __LOADER_ARCH_H__ */ diff --git a/platform/msb430/msb430-slip-arch.c b/platform/msb430/msb430-slip-arch.c deleted file mode 100644 index 45768acb1..000000000 --- a/platform/msb430/msb430-slip-arch.c +++ /dev/null @@ -1,56 +0,0 @@ -#include "dev/msb430-uart1.h" -#include "dev/rs232.h" -#include "sys/clock.h" -#include "dev/slip.h" - - -void -slip_arch_writeb(unsigned char c) -{ - rs232_send(c); -} -/*---------------------------------------------------------------------------*/ - -/* - * The serial line is used to transfer IP packets using slip. To make - * it possible to send debug output over the same line we send debug - * output as slip frames (i.e delimeted by SLIP_END). - * - */ -int -putchar(int c) -{ -#define SLIP_END 0300 - static char debug_frame = 0; - - if(!debug_frame) { /* Start of debug output */ - slip_arch_writeb(SLIP_END); - slip_arch_writeb('\r'); /* Type debug line == '\r' */ - debug_frame = 1; - } - - slip_arch_writeb((char)c); - - /* - * Line buffered output, a newline marks the end of debug output and - * implicitly flushes debug output. - */ - if(c == '\n') { - slip_arch_writeb(SLIP_END); - debug_frame = 0; - } - - clock_delay(100); - - return c; -} - -/** - * Initalize the RS232 port and the SLIP driver. - * - */ -void -slip_arch_init(unsigned long ubr) -{ - rs232_set_input(slip_input_byte); -} diff --git a/platform/msb430/node-id.c b/platform/msb430/node-id.c deleted file mode 100644 index 62691813e..000000000 --- a/platform/msb430/node-id.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2006, 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. - * - */ - -#include "sys/node-id.h" -#include "dev/infomem.h" - -uint16_t node_id = 0; - -/*---------------------------------------------------------------------------*/ -void -node_id_restore(void) -{ - uint16_t newid[2]; - - infomem_read(newid, INFOMEM_NODE_ID, sizeof(newid)); - node_id = (newid[0] == 0xdead) ? newid[1] : 0; -} -/*---------------------------------------------------------------------------*/ -void -node_id_burn(uint16_t id) -{ - uint16_t buffer[2] = { 0xdead, id }; - infomem_write(INFOMEM_NODE_ID, 1, buffer, sizeof(buffer)); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/msb430/symbols.c b/platform/msb430/symbols.c deleted file mode 100644 index e2f43ffdb..000000000 --- a/platform/msb430/symbols.c +++ /dev/null @@ -1,3 +0,0 @@ -#include "symbols.h" -const int symbols_nelts = 0; -const struct symbols symbols[] = {{0,0}}; diff --git a/platform/msb430/symbols.h b/platform/msb430/symbols.h deleted file mode 100644 index 378215565..000000000 --- a/platform/msb430/symbols.h +++ /dev/null @@ -1,2 +0,0 @@ -#include "loader/symbols.h" -extern const struct symbols symbols[1]; diff --git a/platform/sentilla-usb/Makefile.sentilla-usb b/platform/sentilla-usb/Makefile.sentilla-usb deleted file mode 100644 index c766dd8aa..000000000 --- a/platform/sentilla-usb/Makefile.sentilla-usb +++ /dev/null @@ -1,16 +0,0 @@ -# Use custom platform configuration -CFLAGS += -DPLATFORM_CONF_H=\"platform-sentilla-usb-conf.h\" - -# Some drivers such as ds2411.c only compile under platform sky -CFLAGS += -DCONTIKI_TARGET_SKY - -CONTIKI_TARGET_SOURCEFILES += contiki-sentilla-usb-platform.c \ - battery-sensor.c radio-sensor.c temperature-sensor.c - -include $(CONTIKI)/platform/sky/Makefile.common - -ifneq ($(TMOTE_BSL), 1) - ${warning No $(TMOTE_BSL_FILE) command for jcreate/sentilla-usb found. Please install this command in $(CONTIKI)/tools/sky} -endif - -CONTIKI_TARGET_DIRS += ${addprefix ../sky/,. dev apps} diff --git a/platform/sentilla-usb/contiki-sentilla-usb-platform.c b/platform/sentilla-usb/contiki-sentilla-usb-platform.c deleted file mode 100644 index f5ee8c134..000000000 --- a/platform/sentilla-usb/contiki-sentilla-usb-platform.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2010, 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. - * - */ - -/** - * \file - * Platform setup for the sentilla usb platform - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#include "dev/radio-sensor.h" - -SENSORS(&radio_sensor); - -void -init_platform(void) -{ - process_start(&sensors_process, NULL); -} diff --git a/platform/sentilla-usb/leds-arch.c b/platform/sentilla-usb/leds-arch.c deleted file mode 100644 index 6430f76d6..000000000 --- a/platform/sentilla-usb/leds-arch.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2010, 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. - * - */ - -/** - * \file - * A leds implementation for the sentilla usb platform - * \author - * Adam Dunkels - * Niclas Finne - * Joakim Eriksson - */ - -#include "contiki-conf.h" -#include "dev/leds.h" - -/*---------------------------------------------------------------------------*/ -void -leds_arch_init(void) -{ - LEDS_PxDIR |= (LEDS_CONF_RED | LEDS_CONF_GREEN); - LEDS_PxOUT = (LEDS_CONF_RED | LEDS_CONF_GREEN); -} -/*---------------------------------------------------------------------------*/ -unsigned char -leds_arch_get(void) -{ - unsigned char leds; - leds = LEDS_PxOUT; - return ((leds & LEDS_CONF_RED) ? 0 : LEDS_RED) - | ((leds & LEDS_CONF_GREEN) ? 0 : LEDS_GREEN); -} -/*---------------------------------------------------------------------------*/ -void -leds_arch_set(unsigned char leds) -{ - LEDS_PxOUT = (LEDS_PxOUT & ~(LEDS_CONF_RED|LEDS_CONF_GREEN)) - | ((leds & LEDS_RED) ? 0 : LEDS_CONF_RED) - | ((leds & LEDS_GREEN) ? 0 : LEDS_CONF_GREEN); -} -/*---------------------------------------------------------------------------*/ diff --git a/platform/sentilla-usb/platform-sentilla-usb-conf.h b/platform/sentilla-usb/platform-sentilla-usb-conf.h deleted file mode 100644 index 579c654a3..000000000 --- a/platform/sentilla-usb/platform-sentilla-usb-conf.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2011, 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. - */ - -/** - * \file - * Platform configuration for the Sentilla USB - * \author - * Niclas Finne - * Joakim Eriksson - */ - -#ifndef __PLATFORM_CONF_H__ -#define __PLATFORM_CONF_H__ - -/* - * Definitions below are dictated by the hardware and not really - * changeable! - */ -/* Platform TMOTE_SKY */ -#define TMOTE_SKY 1 - -#define PLATFORM_HAS_LEDS 1 -#define PLATFORM_HAS_BUTTON 0 - -/* CPU target speed in Hz */ -#define F_CPU 3900000uL /*2457600uL*/ - -/* Our clock resolution, this is the same as Unix HZ. */ -#define CLOCK_CONF_SECOND 128UL - -#define BAUD2UBR(baud) ((F_CPU/baud)) - -#define CCIF -#define CLIF - -#define HAVE_STDINT_H -#include "msp430def.h" - - -/* Types for clocks and uip_stats */ -typedef unsigned short uip_stats_t; -typedef unsigned long clock_time_t; -typedef unsigned long off_t; - -/* the low-level radio driver */ -#define NETSTACK_CONF_RADIO cc2420_driver - -/* LED ports */ -#define LEDS_PxDIR P5DIR -#define LEDS_PxOUT P5OUT -#define LEDS_CONF_RED 0x10 -#define LEDS_CONF_GREEN 0x20 -#define LEDS_CONF_YELLOW 0x40 - -/* DCO speed resynchronization for more robust UART, etc. */ -#ifndef DCOSYNCH_CONF_ENABLED -#define DCOSYNCH_CONF_ENABLED 1 -#endif /* DCOSYNCH_CONF_ENABLED */ -#ifndef DCOSYNCH_CONF_PERIOD -#define DCOSYNCH_CONF_PERIOD 30 -#endif /* DCOSYNCH_CONF_PERIOD */ - -#define ROM_ERASE_UNIT_SIZE 512 -#define XMEM_ERASE_UNIT_SIZE (64*1024L) - - -#define CFS_CONF_OFFSET_TYPE long - - -/* Use the first 64k of external flash for node configuration */ -#define NODE_ID_XMEM_OFFSET (0 * XMEM_ERASE_UNIT_SIZE) - -/* Use the second 64k of external flash for codeprop. */ -#define EEPROMFS_ADDR_CODEPROP (1 * XMEM_ERASE_UNIT_SIZE) - -#define CFS_XMEM_CONF_OFFSET (2 * XMEM_ERASE_UNIT_SIZE) -#define CFS_XMEM_CONF_SIZE (1 * XMEM_ERASE_UNIT_SIZE) - -#define CFS_RAM_CONF_SIZE 4096 - -/* - * SPI bus configuration for the TMote Sky. - */ - -/* SPI input/output registers. */ -#define SPI_TXBUF U0TXBUF -#define SPI_RXBUF U0RXBUF - - /* USART0 Tx ready? */ -#define SPI_WAITFOREOTx() while ((U0TCTL & TXEPT) == 0) - /* USART0 Rx ready? */ -#define SPI_WAITFOREORx() while ((IFG1 & URXIFG0) == 0) - /* USART0 Tx buffer ready? */ -#define SPI_WAITFORTxREADY() while ((IFG1 & UTXIFG0) == 0) - -#define SCK 1 /* P3.1 - Output: SPI Serial Clock (SCLK) */ -#define MOSI 2 /* P3.2 - Output: SPI Master out - slave in (MOSI) */ -#define MISO 3 /* P3.3 - Input: SPI Master in - slave out (MISO) */ - -/* - * SPI bus - M25P80 external flash configuration. - */ - -#define FLASH_PWR 3 /* P4.3 Output */ -#define FLASH_CS 4 /* P4.4 Output */ -#define FLASH_HOLD 7 /* P4.7 Output */ - -/* Enable/disable flash access to the SPI bus (active low). */ - -#define SPI_FLASH_ENABLE() ( P4OUT &= ~BV(FLASH_CS) ) -#define SPI_FLASH_DISABLE() ( P4OUT |= BV(FLASH_CS) ) - -#define SPI_FLASH_HOLD() ( P4OUT &= ~BV(FLASH_HOLD) ) -#define SPI_FLASH_UNHOLD() ( P4OUT |= BV(FLASH_HOLD) ) - -/* - * SPI bus - CC2420 pin configuration. - */ - -#define CC2420_CONF_SYMBOL_LOOP_COUNT 800 - -/* P1.0 - Input: FIFOP from CC2420 */ -#define CC2420_FIFOP_PORT(type) P1##type -#define CC2420_FIFOP_PIN 0 -/* P1.3 - Input: FIFO from CC2420 */ -#define CC2420_FIFO_PORT(type) P1##type -#define CC2420_FIFO_PIN 3 -/* P1.4 - Input: CCA from CC2420 */ -#define CC2420_CCA_PORT(type) P1##type -#define CC2420_CCA_PIN 4 -/* P4.1 - Input: SFD from CC2420 */ -#define CC2420_SFD_PORT(type) P4##type -#define CC2420_SFD_PIN 1 -/* P4.2 - Output: SPI Chip Select (CS_N) */ -#define CC2420_CSN_PORT(type) P4##type -#define CC2420_CSN_PIN 2 -/* P4.5 - Output: VREG_EN to CC2420 */ -#define CC2420_VREG_PORT(type) P4##type -#define CC2420_VREG_PIN 5 -/* P4.6 - Output: RESET_N to CC2420 */ -#define CC2420_RESET_PORT(type) P4##type -#define CC2420_RESET_PIN 6 - -#define CC2420_IRQ_VECTOR PORT1_VECTOR - -/* Pin status. */ -#define CC2420_FIFOP_IS_1 (!!(CC2420_FIFOP_PORT(IN) & BV(CC2420_FIFOP_PIN))) -#define CC2420_FIFO_IS_1 (!!(CC2420_FIFO_PORT(IN) & BV(CC2420_FIFO_PIN))) -#define CC2420_CCA_IS_1 (!!(CC2420_CCA_PORT(IN) & BV(CC2420_CCA_PIN))) -#define CC2420_SFD_IS_1 (!!(CC2420_SFD_PORT(IN) & BV(CC2420_SFD_PIN))) - -/* The CC2420 reset pin. */ -#define SET_RESET_INACTIVE() (CC2420_RESET_PORT(OUT) |= BV(CC2420_RESET_PIN)) -#define SET_RESET_ACTIVE() (CC2420_RESET_PORT(OUT) &= ~BV(CC2420_RESET_PIN)) - -/* CC2420 voltage regulator enable pin. */ -#define SET_VREG_ACTIVE() (CC2420_VREG_PORT(OUT) |= BV(CC2420_VREG_PIN)) -#define SET_VREG_INACTIVE() (CC2420_VREG_PORT(OUT) &= ~BV(CC2420_VREG_PIN)) - -/* CC2420 rising edge trigger for external interrupt 0 (FIFOP). */ -#define CC2420_FIFOP_INT_INIT() do { \ - CC2420_FIFOP_PORT(IES) &= ~BV(CC2420_FIFOP_PIN); \ - CC2420_CLEAR_FIFOP_INT(); \ - } while(0) - -/* FIFOP on external interrupt 0. */ -#define CC2420_ENABLE_FIFOP_INT() do {CC2420_FIFOP_PORT(IE) |= BV(CC2420_FIFOP_PIN);} while(0) -#define CC2420_DISABLE_FIFOP_INT() do {CC2420_FIFOP_PORT(IE) &= ~BV(CC2420_FIFOP_PIN);} while(0) -#define CC2420_CLEAR_FIFOP_INT() do {CC2420_FIFOP_PORT(IFG) &= ~BV(CC2420_FIFOP_PIN);} while(0) - -/* - * Enables/disables CC2420 access to the SPI bus (not the bus). - * (Chip Select) - */ - - /* ENABLE CSn (active low) */ -#define CC2420_SPI_ENABLE() (CC2420_CSN_PORT(OUT) &= ~BV(CC2420_CSN_PIN)) - /* DISABLE CSn (active low) */ -#define CC2420_SPI_DISABLE() (CC2420_CSN_PORT(OUT) |= BV(CC2420_CSN_PIN)) -#define CC2420_SPI_IS_ENABLED() ((CC2420_CSN_PORT(OUT) & BV(CC2420_CSN_PIN)) != BV(CC2420_CSN_PIN)) - -#endif /* __PLATFORM_CONF_H__ */