From 5467674fccdbb925ae861237b53f967cb4ca9690 Mon Sep 17 00:00:00 2001 From: Antonio Lignan Date: Tue, 1 Jul 2014 11:22:40 +0200 Subject: [PATCH] Merges Z1SP into Z1 platform --- examples/z1/Makefile | 11 +- examples/z1/test-potent.c | 2 +- examples/z1sp/Makefile | 14 -- examples/z1sp/Makefile.target | 1 - examples/z1sp/test-potentiometer.c | 68 ------- platform/z1/Makefile.common | 2 + platform/z1/Makefile.z1 | 6 +- platform/z1/Makefile.z1sp | 6 + platform/z1/README.z1sp | 9 + platform/z1/platform-conf.h | 8 + platform/z1sp/Makefile.z1sp | 18 -- platform/z1sp/contiki-conf.h | 195 ------------------- platform/z1sp/contiki-z1sp-platform.c | 41 ---- platform/z1sp/dev/potentiometer-sensor.c | 67 ------- platform/z1sp/dev/potentiometer-sensor.h | 46 ----- platform/z1sp/platform-conf.h | 228 ----------------------- 16 files changed, 39 insertions(+), 683 deletions(-) delete mode 100644 examples/z1sp/Makefile delete mode 100644 examples/z1sp/Makefile.target delete mode 100644 examples/z1sp/test-potentiometer.c create mode 100644 platform/z1/Makefile.z1sp create mode 100644 platform/z1/README.z1sp delete mode 100644 platform/z1sp/Makefile.z1sp delete mode 100644 platform/z1sp/contiki-conf.h delete mode 100644 platform/z1sp/contiki-z1sp-platform.c delete mode 100644 platform/z1sp/dev/potentiometer-sensor.c delete mode 100644 platform/z1sp/dev/potentiometer-sensor.h delete mode 100644 platform/z1sp/platform-conf.h diff --git a/examples/z1/Makefile b/examples/z1/Makefile index 99f08955a..2f37d4da7 100644 --- a/examples/z1/Makefile +++ b/examples/z1/Makefile @@ -2,12 +2,17 @@ ifndef TARGET TARGET=z1 endif -CONTIKI_PROJECT = test-phidgets blink test-adxl345 test-tmp102 test-light-ziglet test-battery test-sht11 test-relay-phidget test-tlc59116 #test-potent -CONTIKI_SOURCEFILES += sht11.c# potentiometer-sensor.c +# Enable to pull-in Z1SP specific test/source files +ZOLERTIA_Z1SP=0 + +CONTIKI_PROJECT = test-phidgets blink test-adxl345 test-tmp102 test-light-ziglet test-battery test-sht11 test-relay-phidget test-tlc59116 +CONTIKI_SOURCEFILES += sht11.c APPS=serial-shell +ifeq ($(ZOLERTIA_Z1SP),1) +CONTIKI_PROJECT += test-potent +endif all: $(CONTIKI_PROJECT) - CONTIKI = ../.. include $(CONTIKI)/Makefile.include diff --git a/examples/z1/test-potent.c b/examples/z1/test-potent.c index 7a2881d80..265f0e144 100644 --- a/examples/z1/test-potent.c +++ b/examples/z1/test-potent.c @@ -56,7 +56,7 @@ PROCESS_THREAD(test_potent_process, ev, data) while(1) { uint16_t value = potentiometer_sensor.value(0); - printf("Potentiometer Value: %i\n", v); + printf("Potentiometer Value: %u\n", value); } SENSORS_DEACTIVATE(potentiometer_sensor); diff --git a/examples/z1sp/Makefile b/examples/z1sp/Makefile deleted file mode 100644 index 74dd6b812..000000000 --- a/examples/z1sp/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -ifndef TARGET -TARGET=z1sp -endif - -CONTIKI_PROJECT = test-potentiometer -CONTIKI_SOURCEFILES += cc2420-arch.c -PROJECT_SOURCEFILES = sky-sensors.c potentiometer-sensor.c -APPS=serial-shell - - -all: $(CONTIKI_PROJECT) - -CONTIKI = ../.. -include $(CONTIKI)/Makefile.include diff --git a/examples/z1sp/Makefile.target b/examples/z1sp/Makefile.target deleted file mode 100644 index 503d8f4fa..000000000 --- a/examples/z1sp/Makefile.target +++ /dev/null @@ -1 +0,0 @@ -TARGET = z1sp diff --git a/examples/z1sp/test-potentiometer.c b/examples/z1sp/test-potentiometer.c deleted file mode 100644 index 7a2881d80..000000000 --- a/examples/z1sp/test-potentiometer.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2011, Zolertia(TM) is a trademark of Advancare,SL - * 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 Potentiometer in Zolertia Z1 Starter Platform. - * \author - * Enric M. Calvo - */ - -#include "contiki.h" -#include "dev/potentiometer-sensor.h" -#include - - -/*---------------------------------------------------------------------------*/ -PROCESS(test_potent_process, "Testing Potentiometer in Z1SP"); -AUTOSTART_PROCESSES(&test_potent_process); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(test_potent_process, ev, data) -{ - - PROCESS_BEGIN(); - - SENSORS_ACTIVATE(potentiometer_sensor); - - while(1) { - uint16_t value = potentiometer_sensor.value(0); - - printf("Potentiometer Value: %i\n", v); - } - - SENSORS_DEACTIVATE(potentiometer_sensor); - - PROCESS_END(); -} - -/*---------------------------------------------------------------------------*/ - diff --git a/platform/z1/Makefile.common b/platform/z1/Makefile.common index 1b9e507d7..6247fa383 100644 --- a/platform/z1/Makefile.common +++ b/platform/z1/Makefile.common @@ -1,3 +1,5 @@ +# Common Makefile between the Z1 and Z1SP + ifdef GCC CFLAGS+=-Os -g endif diff --git a/platform/z1/Makefile.z1 b/platform/z1/Makefile.z1 index 03695479b..3d9482748 100644 --- a/platform/z1/Makefile.z1 +++ b/platform/z1/Makefile.z1 @@ -1,10 +1,14 @@ -# Common makefile between Z1 and Z1 Starter Platform +# Common Makefile between Z1 and Z1SP CONTIKI_TARGET_SOURCEFILES += contiki-z1-platform.c CLEAN += *.z1 include $(CONTIKI)/platform/z1/Makefile.common +ifeq ($(ZOLERTIA_Z1SP),1) +include $(CONTIKI)/platform/z1/Makefile.z1sp +endif + MODULES += core/net core/net/ip core/net/ipv6 core/net/ipv4 core/net/rpl \ core/net/rime core/net/mac core/net/mac/contikimac \ dev/cc2420 dev/sht11 diff --git a/platform/z1/Makefile.z1sp b/platform/z1/Makefile.z1sp new file mode 100644 index 000000000..29b8fcbd1 --- /dev/null +++ b/platform/z1/Makefile.z1sp @@ -0,0 +1,6 @@ +# Makefile for Z1 Starter Platform + +# This is the actual flag we need to include specific Z1SP components +CFLAGS += -DZ1_IS_Z1SP + +CONTIKI_TARGET_SOURCEFILES += potentiometer-sensor.c diff --git a/platform/z1/README.z1sp b/platform/z1/README.z1sp new file mode 100644 index 000000000..8db1e48da --- /dev/null +++ b/platform/z1/README.z1sp @@ -0,0 +1,9 @@ +Using the Z1 starter platform (Z1SP) +============================================ + +To enable the Z1SP components, you should include in your application Makefile +the ZOLERTIA_Z1SP flag set to 1, see "examples/z1/Makefile". + +For Z1SP specific information please go to: + +http://zolertia.sourceforge.net/wiki/index.php/Mainpage:z1sp diff --git a/platform/z1/platform-conf.h b/platform/z1/platform-conf.h index 28a17d17d..f57460208 100644 --- a/platform/z1/platform-conf.h +++ b/platform/z1/platform-conf.h @@ -98,11 +98,19 @@ typedef unsigned long off_t; */ /* LED ports */ +#ifdef Z1_IS_Z1SP +#define LEDS_PxDIR P4DIR +#define LEDS_PxOUT P4OUT +#define LEDS_CONF_RED 0x04 +#define LEDS_CONF_GREEN 0x01 +#define LEDS_CONF_YELLOW 0x80 +#else #define LEDS_PxDIR P5DIR #define LEDS_PxOUT P5OUT #define LEDS_CONF_RED 0x10 #define LEDS_CONF_GREEN 0x40 #define LEDS_CONF_YELLOW 0x20 +#endif // Z1_IS_Z1SP /* DCO speed resynchronization for more robust UART, etc. */ #define DCOSYNCH_CONF_ENABLED 0 diff --git a/platform/z1sp/Makefile.z1sp b/platform/z1sp/Makefile.z1sp deleted file mode 100644 index 87cd91c85..000000000 --- a/platform/z1sp/Makefile.z1sp +++ /dev/null @@ -1,18 +0,0 @@ -# Makefile for Z1 Starter Platform, adapted from the Z1 platform makefile - -CFLAGS += -DCONTIKI_TARGET_Z1 - -CONTIKI_TARGET_DIRS += . dev -#CONTIKI_CORE=contiki-z1sp-main -#CONTIKI_TARGET_MAIN = ${CONTIKI_CORE}.c - -# include here -CONTIKI_TARGET_SOURCEFILES += contiki-z1sp-platform.c potentiometer-sensor.c - -CONTIKIZ1PLATFORMDIR = $(CONTIKI)/platform/z1 - -CLEAN += *.z1sp - -include $(CONTIKIZ1PLATFORMDIR)/Makefile.common - -CONTIKI_TARGET_DIRS += ${addprefix $(CONTIKIZ1PLATFORMDIR)/,. dev apps net} diff --git a/platform/z1sp/contiki-conf.h b/platform/z1sp/contiki-conf.h deleted file mode 100644 index a0cfb9699..000000000 --- a/platform/z1sp/contiki-conf.h +++ /dev/null @@ -1,195 +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. - * - */ - -#ifndef CONTIKI_CONF_H -#define CONTIKI_CONF_H - - -#include "platform-conf.h" - -#define XMAC_CONF_COMPOWER 1 -#define CXMAC_CONF_COMPOWER 1 - -#if WITH_UIP6 - -/* Network setup for IPv6 */ -#define NETSTACK_CONF_NETWORK sicslowpan_driver -/* #define NETSTACK_CONF_MAC nullmac_driver */ -/* #define NETSTACK_CONF_RDC sicslowmac_driver */ -#define NETSTACK_CONF_MAC csma_driver -#define NETSTACK_CONF_RDC contikimac_driver -#define NETSTACK_CONF_RADIO cc2420_driver -#define NETSTACK_CONF_FRAMER framer_802154 - -#define CC2420_CONF_AUTOACK 1 -#define NETSTACK_RDC_CHANNEL_CHECK_RATE 8 -#define RIME_CONF_NO_POLITE_ANNOUCEMENTS 0 -#define CXMAC_CONF_ANNOUNCEMENTS 0 -#define XMAC_CONF_ANNOUNCEMENTS 0 - -#define QUEUEBUF_CONF_NUM 4 - -#else /* WITH_UIP6 */ - -/* Network setup for non-IPv6 (rime). */ - -#define NETSTACK_CONF_NETWORK rime_driver -#define NETSTACK_CONF_MAC csma_driver -/* #define NETSTACK_CONF_RDC contikimac_driver */ -#define NETSTACK_CONF_RDC nullrdc_driver -#define NETSTACK_CONF_FRAMER framer_802154 - -#define CC2420_CONF_AUTOACK 0 - -#define COLLECT_CONF_ANNOUNCEMENTS 1 -#define RIME_CONF_NO_POLITE_ANNOUCEMENTS 0 -#define CXMAC_CONF_ANNOUNCEMENTS 0 -#define XMAC_CONF_ANNOUNCEMENTS 0 -#define CONTIKIMAC_CONF_ANNOUNCEMENTS 0 - -#define CONTIKIMAC_CONF_COMPOWER 1 -#define XMAC_CONF_COMPOWER 1 -#define CXMAC_CONF_COMPOWER 1 - -#define COLLECT_NBR_TABLE_CONF_MAX_NEIGHBORS 32 - -#define QUEUEBUF_CONF_NUM 8 - -#endif /* WITH_UIP6 */ - -#define PACKETBUF_CONF_ATTRS_INLINE 1 - -#ifndef RF_CHANNEL -#define RF_CHANNEL 26 -#endif /* RF_CHANNEL */ - -#define IEEE802154_CONF_PANID 0xABCD - -#define SHELL_VARS_CONF_RAM_BEGIN 0x1100 -#define SHELL_VARS_CONF_RAM_END 0x2000 - - -#define CFS_CONF_OFFSET_TYPE long - -#define PROFILE_CONF_ON 0 -#define ENERGEST_CONF_ON 0 - -#define ELFLOADER_CONF_TEXT_IN_ROM 0 -#define ELFLOADER_CONF_DATAMEMORY_SIZE 0x400 -#define ELFLOADER_CONF_TEXTMEMORY_SIZE 0x800 - -#define CCIF -#define CLIF - -#define CC_CONF_INLINE inline - -#define AODV_COMPLIANCE -#define AODV_NUM_RT_ENTRIES 32 - -#define WITH_ASCII 1 - -#define PROCESS_CONF_NUMEVENTS 8 -#define PROCESS_CONF_STATS 1 -/*#define PROCESS_CONF_FASTPOLL 4*/ - - -#define UART0_CONF_TX_WITH_INTERRUPT 0 // So far, printfs without interrupt. - -#ifdef WITH_UIP6 - -#define LINKADDR_CONF_SIZE 8 - -#define UIP_CONF_LL_802154 1 -#define UIP_CONF_LLH_LEN 0 - -#define UIP_CONF_ROUTER 1 -#define UIP_CONF_IPV6_RPL 1 - -/* Handle 10 neighbors */ -#define NBR_TABLE_CONF_MAX_NEIGHBORS 15 -/* Handle 10 routes */ -#define UIP_CONF_MAX_ROUTES 15 - -#define UIP_CONF_ND6_SEND_RA 0 -#define UIP_CONF_ND6_REACHABLE_TIME 600000 -#define UIP_CONF_ND6_RETRANS_TIMER 10000 - -#define UIP_CONF_IPV6 1 -#define UIP_CONF_IPV6_QUEUE_PKT 0 -#define UIP_CONF_IPV6_CHECKS 1 -#define UIP_CONF_IPV6_REASSEMBLY 0 -#define UIP_CONF_NETIF_MAX_ADDRESSES 3 -#define UIP_CONF_ND6_MAX_PREFIXES 3 -#define UIP_CONF_ND6_MAX_DEFROUTERS 2 -#define UIP_CONF_IP_FORWARD 0 -#define UIP_CONF_BUFFER_SIZE 140 - -#define SICSLOWPAN_CONF_COMPRESSION_IPV6 0 -#define SICSLOWPAN_CONF_COMPRESSION_HC1 1 -#define SICSLOWPAN_CONF_COMPRESSION_HC01 2 -#define SICSLOWPAN_CONF_COMPRESSION SICSLOWPAN_COMPRESSION_HC06 -#ifndef SICSLOWPAN_CONF_FRAG -#define SICSLOWPAN_CONF_FRAG 1 -#define SICSLOWPAN_CONF_MAXAGE 8 -#endif /* SICSLOWPAN_CONF_FRAG */ -#define SICSLOWPAN_CONF_CONVENTIONAL_MAC 1 -#define SICSLOWPAN_CONF_MAX_ADDR_CONTEXTS 2 -#else /* WITH_UIP6 */ -#define UIP_CONF_IP_FORWARD 1 -#define UIP_CONF_BUFFER_SIZE 108 -#endif /* WITH_UIP6 */ - -#define UIP_CONF_ICMP_DEST_UNREACH 1 - -#define UIP_CONF_DHCP_LIGHT -#define UIP_CONF_LLH_LEN 0 -#define UIP_CONF_RECEIVE_WINDOW 48 -#define UIP_CONF_TCP_MSS 48 -#define UIP_CONF_MAX_CONNECTIONS 4 -#define UIP_CONF_MAX_LISTENPORTS 8 -#define UIP_CONF_UDP_CONNS 12 -#define UIP_CONF_FWCACHE_SIZE 30 -#define UIP_CONF_BROADCAST 1 -#define UIP_ARCH_IPCHKSUM 1 -#define UIP_CONF_UDP 1 -#define UIP_CONF_UDP_CHECKSUMS 1 -#define UIP_CONF_PINGADDRCONF 0 -#define UIP_CONF_LOGGING 0 - -#define UIP_CONF_TCP_SPLIT 0 - - -#ifdef PROJECT_CONF_H -#include PROJECT_CONF_H -#endif /* PROJECT_CONF_H */ - - - -#endif /* CONTIKI_CONF_H */ diff --git a/platform/z1sp/contiki-z1sp-platform.c b/platform/z1sp/contiki-z1sp-platform.c deleted file mode 100644 index 60272bb00..000000000 --- a/platform/z1sp/contiki-z1sp-platform.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2011, Zolertia(TM) is a trademark of Advancare,SL - * 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: Enric M. Calvo based on previous work by - * Niclas Finne , Joakim Eriksson - * - */ - -#include "dev/button-sensor.h" - -void -init_platform(void) -{ - process_start(&sensors_process, NULL); -} diff --git a/platform/z1sp/dev/potentiometer-sensor.c b/platform/z1sp/dev/potentiometer-sensor.c deleted file mode 100644 index ccfc1e851..000000000 --- a/platform/z1sp/dev/potentiometer-sensor.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2011 Zolertia(TM) is a trademark by Advancare,SL - * 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 : Enric M. Calvo (based on work by A. Dunkels, J. Eriksson, N. Finne) - * Created : 2011-02-22 - * $Revision: 1.0 $ - */ - -#include "contiki.h" -#include "dev/potentiometer-sensor.h" -#include "dev/sky-sensors.h" - -/* Configure ADC12_2 to sample channel 11 (voltage) and use */ -/* the Vref+ as reference (SREF_1) since it is a stable reference */ -#define INPUT_CHANNEL (1 << INCH_4) -#define INPUT_REFERENCE SREF_0 -#define POTENTIOMETER_MEM ADC12MEM4 - -const struct sensors_sensor battery_sensor; -/*---------------------------------------------------------------------------*/ -static int -value(int type) -{ - return POTENTIOMETER_MEM; -} -/*---------------------------------------------------------------------------*/ -static int -configure(int type, int c) -{ - return sky_sensors_configure(INPUT_CHANNEL, INPUT_REFERENCE, type, c); -} -/*---------------------------------------------------------------------------*/ -static int -status(int type) -{ - return sky_sensors_status(INPUT_CHANNEL, type); -} -/*---------------------------------------------------------------------------*/ -SENSORS_SENSOR(potentiometer_sensor, POTENTIOMETER_SENSOR, value, configure, status); diff --git a/platform/z1sp/dev/potentiometer-sensor.h b/platform/z1sp/dev/potentiometer-sensor.h deleted file mode 100644 index d9d8b983d..000000000 --- a/platform/z1sp/dev/potentiometer-sensor.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2011 Zolertia(TM) is a trademark by Advancare,SL - * 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 : Enric M. Calvo (based on work by A. Dunkels, J. Eriksson, N. Finne) - * Created : 2011-02-22 - * $Revision: 1.0 $ - */ - -#ifndef POTENTIOMETER_SENSOR_H_ -#define POTENTIOMETER_SENSOR_H_ - -#include "lib/sensors.h" - -extern const struct sensors_sensor potentiometer_sensor; - -#define POTENTIOMETER_SENSOR "Potentiometer" - -#endif /* POTENTIOMETER_SENSOR_H_ */ diff --git a/platform/z1sp/platform-conf.h b/platform/z1sp/platform-conf.h deleted file mode 100644 index 677942302..000000000 --- a/platform/z1sp/platform-conf.h +++ /dev/null @@ -1,228 +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 - * Platform configuration for the Z1SP platform - * \author - * Joakim Eriksson - */ - -#ifndef PLATFORM_CONF_H_ -#define PLATFORM_CONF_H_ - -/* - * Definitions below are dictated by the hardware and not really - * changeable! - */ -#define ZOLERTIA_Z1 0 /* Enric */ -#define ZOLERTIA_Z1SP 1 /* Enric */ - -/* CPU target speed in Hz */ -#define F_CPU 8000000uL /* 8MHz by default */ -//Enric #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" - -/* XXX Temporary place for defines that are lacking in mspgcc4's gpio.h */ -#ifdef __IAR_SYSTEMS_ICC__ -#ifndef P1SEL2_ -#define P1SEL2_ (0x0041u) /* Port 1 Selection 2*/ -DEFC( P1SEL2 , P1SEL2_) -#endif -#ifndef P5SEL2_ -#define P5SEL2_ (0x0045u) /* Port 5 Selection 2*/ -DEFC( P5SEL2 , P5SEL2_) -#endif -#else /* __IAR_SYSTEMS_ICC__ */ -#ifdef __GNUC__ -#ifndef P1SEL2_ - #define P1SEL2_ 0x0041 /* Port 1 Selection 2*/ - sfrb(P1SEL2, P1SEL2_); -#endif -#ifndef P5SEL2_ - #define P5SEL2_ 0x0045 /* Port 5 Selection 2*/ - sfrb(P5SEL2, P5SEL2_); -#endif -#endif /* __GNUC__ */ -#endif /* __IAR_SYSTEMS_ICC__ */ - -/* 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 - -/* - * Definitions below are dictated by the hardware and not really - * changeable! - */ - -/* LED ports */ -#define LEDS_PxDIR P4DIR -#define LEDS_PxOUT P4OUT -#define LEDS_CONF_RED 0x04 -#define LEDS_CONF_GREEN 0x01 -#define LEDS_CONF_YELLOW 0x80 - -/* DCO speed resynchronization for more robust UART, etc. */ -#define DCOSYNCH_CONF_ENABLED 0 -#define DCOSYNCH_CONF_PERIOD 30 - -#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 UCB0TXBUF -#define SPI_RXBUF UCB0RXBUF - - /* USART0 Tx ready? */ -#define SPI_WAITFOREOTx() while ((UCB0STAT & UCBUSY) != 0) - /* USART0 Rx ready? */ -#define SPI_WAITFOREORx() while ((IFG2 & UCB0RXIFG) == 0) - /* USART0 Tx buffer ready? */ -#define SPI_WAITFORTxREADY() while ((IFG2 & UCB0TXIFG) == 0) - -#define MOSI 1 /* P3.1 - Output: SPI Master out - slave in (MOSI) */ -#define MISO 2 /* P3.2 - Input: SPI Master in - slave out (MISO) */ -#define SCK 3 /* P3.3 - Output: SPI Serial Clock (SCLK) */ - -/* - * SPI bus - M25P80 external flash configuration. - */ -//#define FLASH_PWR 3 /* P4.3 Output */ ALWAYS POWERED ON Z1 -#define FLASH_CS 4 /* P4.4 Output */ -#define FLASH_HOLD 7 /* P5.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() ( P5OUT &= ~BV(FLASH_HOLD) ) -#define SPI_FLASH_UNHOLD() ( P5OUT |= BV(FLASH_HOLD) ) - - -/* - * SPI bus - CC2420 pin configuration. - */ - -#define CC2420_CONF_SYMBOL_LOOP_COUNT 1302 /* 326us msp430X @ 8MHz */ - -/* P1.2 - Input: FIFOP from CC2420 */ -#define CC2420_FIFOP_PORT(type) P1##type -#define CC2420_FIFOP_PIN 2 -/* 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 - /* P3.0 - Output: SPI Chip Select (CS_N) */ -#define CC2420_CSN_PORT(type) P3##type -#define CC2420_CSN_PIN 0 -/* 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_ */