Scatterweb MSB430 port.
This commit is contained in:
parent
66e562f2c0
commit
365f99e5c8
11 changed files with 639 additions and 0 deletions
21
platform/msb430/Makefile
Normal file
21
platform/msb430/Makefile
Normal file
|
@ -0,0 +1,21 @@
|
|||
# $Id: Makefile,v 1.1 2007/06/28 12:49:57 nvt-se Exp $
|
||||
|
||||
all: core
|
||||
upload: core core.u
|
||||
|
||||
core:
|
||||
$(MAKE) core.firmware && \
|
||||
$(MAKE) core.firmware && \
|
||||
$(MAKE) core.firmware
|
||||
|
||||
CONTIKI=../..
|
||||
TARGET=msb430
|
||||
|
||||
blinker.cm: blinker.co blinker2.co
|
||||
|
||||
ifdef ENABLE_BACNET
|
||||
APPS += bacnet
|
||||
APPDIRS += apps/bacnet
|
||||
endif
|
||||
|
||||
include $(CONTIKI)/Makefile.include
|
53
platform/msb430/Makefile.msb430
Normal file
53
platform/msb430/Makefile.msb430
Normal file
|
@ -0,0 +1,53 @@
|
|||
SENSORS = sensors.c irq.c
|
||||
#SD = sd.c sd_cache.c sd_erase.c sd_info.c
|
||||
MSB = dma.c infomem.c node-id.c \
|
||||
msb430-uart1.c rs232.c msb430-slip-arch.c \
|
||||
cc1020.c adc.c
|
||||
|
||||
CONTIKI_TARGET_DIRS = . dev dev/sd apps net loader
|
||||
ifndef CONTIKI_TARGET_MAIN
|
||||
CONTIKI_TARGET_MAIN = contiki-msb430-main.c
|
||||
endif
|
||||
|
||||
CONTIKI_TARGET_SOURCEFILES += $(SENSORS) $(MSB) $(CONTIKI_TARGET_MAIN)
|
||||
|
||||
include $(CONTIKI)/platform/$(TARGET)/apps/Makefile.apps
|
||||
|
||||
MCU=msp430x1612
|
||||
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
|
||||
|
||||
send: $(CONTIKI)/tools/codeprop.c
|
||||
cc -Wall $^ -o send
|
||||
|
||||
%.send: %.cm send
|
||||
send $(BASE_IP) $<
|
||||
|
||||
### System dependent Makefile
|
||||
|
||||
ifndef WINDIR
|
||||
ifdef OS
|
||||
ifneq (,$(findstring Windows,$(OS)))
|
||||
WINDIR := Windows
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq (${HOSTTYPE},FreeBSD)
|
||||
# settings for FreeBSD
|
||||
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.freebsd
|
||||
else
|
||||
ifndef WINDIR
|
||||
# settings for unix
|
||||
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.unix
|
||||
else
|
||||
# settings for windows
|
||||
-include $(CONTIKI)/platform/$(TARGET)/buildscripts/Makefile.win
|
||||
endif
|
||||
endif
|
133
platform/msb430/contiki-conf.h
Normal file
133
platform/msb430/contiki-conf.h
Normal file
|
@ -0,0 +1,133 @@
|
|||
#ifndef __CONTIKI_CONF_H__
|
||||
#define __CONTIKI_CONF_H__
|
||||
|
||||
#define IRQ_PORT1 0x01
|
||||
#define IRQ_PORT2 0x02
|
||||
#define IRQ_ADC 0x03
|
||||
|
||||
// MSB430 SD Card driver
|
||||
#define SD_CACHE 1
|
||||
#define SD_READ_ANY 1
|
||||
#define SD_WRITE 1
|
||||
|
||||
// MSP430 Infomemory
|
||||
#define INFOMEM_START 0x1000
|
||||
#define INFOMEM_BLOCK_SIZE 128
|
||||
#define INFOMEM_NODE_ID 0x0000 /* - 0x0004 */
|
||||
|
||||
#define CFS_SD_CONF_OFFSET 0x0000
|
||||
|
||||
#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 CCIF
|
||||
#define CLIF
|
||||
|
||||
// Clock
|
||||
typedef unsigned short clock_time_t;
|
||||
#define CLOCK_CONF_SECOND 100
|
||||
#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 8-bit unsigned data type.
|
||||
*
|
||||
* This may have to be tweaked for your particular compiler. "unsigned
|
||||
* char" works for most compilers.
|
||||
*/
|
||||
typedef unsigned char u8_t;
|
||||
|
||||
/**
|
||||
* The 16-bit unsigned data type.
|
||||
*
|
||||
* This may have to be tweaked for your particular compiler. "unsigned
|
||||
* short" works for most compilers.
|
||||
*/
|
||||
typedef unsigned short u16_t;
|
||||
|
||||
/**
|
||||
* The 32-bit unsigned data type.
|
||||
*
|
||||
* This may have to be tweaked for your particular compiler. "unsigned
|
||||
* long" works for most compilers.
|
||||
*/
|
||||
typedef unsigned long u32_t;
|
||||
|
||||
/**
|
||||
* The 32-bit signed data type.
|
||||
*
|
||||
* This may have to be tweaked for your particular compiler. "signed
|
||||
* long" works for most compilers.
|
||||
*/
|
||||
typedef long s32_t;
|
||||
|
||||
/**
|
||||
* The statistics data type.
|
||||
*
|
||||
* This datatype determines how high the statistics counters are able
|
||||
* to count.
|
||||
*/
|
||||
typedef unsigned short uip_stats_t;
|
||||
|
||||
/**
|
||||
* ScatterWeb code compatibilty
|
||||
* @{
|
||||
*/
|
||||
typedef char bool;
|
||||
typedef unsigned char UINT8;
|
||||
typedef unsigned int UINT16;
|
||||
typedef unsigned long UINT32;
|
||||
typedef signed char INT8;
|
||||
typedef signed int INT16;
|
||||
typedef signed long INT32;
|
||||
|
||||
#define true 1
|
||||
#define false 0
|
||||
/** @} */
|
||||
|
||||
#define UIP_CONF_MAX_CONNECTIONS 4
|
||||
#define UIP_CONF_MAX_LISTENPORTS 8
|
||||
#define UIP_CONF_BUFFER_SIZE 140
|
||||
/*#define UIP_CONF_RECEIVE_WINDOW 140*/
|
||||
|
||||
#define UIP_CONF_LLH_LEN 6
|
||||
|
||||
#define UIP_CONF_RESOLV_ENTRIES 1
|
||||
|
||||
#define UIP_CONF_PINGADDRCONF 1
|
||||
|
||||
#define UIP_CONF_LOGGING 0
|
||||
|
||||
#define UIP_CONF_UDP_CONNS 6
|
||||
|
||||
#define UIP_CONF_FWCACHE_SIZE 1
|
||||
|
||||
#define UIP_CONF_BROADCAST 1
|
||||
|
||||
#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
|
||||
|
||||
#define SD_LED_READ_ON LEDS_PxOUT &=~LEDS_CONF_RED
|
||||
#define SD_LED_READ_OFF LEDS_PxOUT |= LEDS_CONF_RED
|
||||
#define SD_LED_WRITE_ON SD_LED_READ_ON
|
||||
#define SD_LED_WRITE_OFF SD_LED_READ_OFF
|
||||
|
||||
#endif /* __CONTIKI_CONF_H__ */
|
147
platform/msb430/contiki-msb430-main.c
Normal file
147
platform/msb430/contiki-msb430-main.c
Normal file
|
@ -0,0 +1,147 @@
|
|||
/*
|
||||
* 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 <baar@inf.fu-berlin.de>, Nicolas Tsiftes <nvt@sics.se>
|
||||
*/
|
||||
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "contiki-msb430.h"
|
||||
|
||||
#include "sys/procinit.h"
|
||||
#include "sys/autostart.h"
|
||||
|
||||
#include "dev/adc.h"
|
||||
|
||||
#include "net/mac/nullmac.h"
|
||||
#include "net/mac/xmac.h"
|
||||
|
||||
SENSORS(NULL);
|
||||
|
||||
static void
|
||||
set_rime_addr(void)
|
||||
{
|
||||
rimeaddr_t addr;
|
||||
addr.u16[0] = node_id;
|
||||
rimeaddr_set_node_addr(&addr);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
msp430_cpu_init();
|
||||
|
||||
/* Platform-specific initialization. */
|
||||
msb_ports_init();
|
||||
adc_init();
|
||||
|
||||
clock_init();
|
||||
leds_init();
|
||||
leds_on(LEDS_ALL);
|
||||
|
||||
// low level
|
||||
irq_init();
|
||||
process_init();
|
||||
|
||||
// serial interface
|
||||
rs232_init();
|
||||
|
||||
#ifdef WITH_SDC
|
||||
spi_init();
|
||||
#endif
|
||||
|
||||
uart_lock(UART_MODE_RS232);
|
||||
uart_unlock(UART_MODE_RS232);
|
||||
//slip_arch_init(BAUD2UBR(115200));
|
||||
|
||||
cc1020_init(cc1020_config_19200);
|
||||
|
||||
// network configuration
|
||||
node_id_restore();
|
||||
|
||||
nullmac_init(&cc1020_driver);
|
||||
rime_init(&nullmac_driver);
|
||||
set_rime_addr();
|
||||
|
||||
/* System services */
|
||||
process_start(&etimer_process, NULL);
|
||||
//process_start(&sensors_process, NULL);
|
||||
|
||||
leds_off(LEDS_ALL);
|
||||
|
||||
printf("Autostarting processes\n");
|
||||
autostart_start((struct process **) autostart_processes);
|
||||
|
||||
for (;;) {
|
||||
while (process_run());
|
||||
if (process_nevents() == 0)
|
||||
LPM1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
80
platform/msb430/contiki-msb430.h
Normal file
80
platform/msb430/contiki-msb430.h
Normal file
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* 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 "lib/sensors.h"
|
||||
#include "dev/hwconf.h"
|
||||
#include "dev/irq.h"
|
||||
#include "dev/lpm.h"
|
||||
|
||||
#include "codeprop.h"
|
||||
|
||||
#include "dev/infomem.h"
|
||||
#include "dev/msb430-uart1.h"
|
||||
#include "dev/rs232.h"
|
||||
#include "dev/sdspi.h"
|
||||
|
||||
#include "dev/serial.h"
|
||||
#include "dev/slip.h"
|
||||
#include "dev/cc1020.h"
|
||||
|
||||
#ifdef WITH_SDC
|
||||
#include "dev/sd/sd.h"
|
||||
#include "cfs/cfs-sd.h"
|
||||
#endif
|
||||
|
||||
#include "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 "node-id.h"
|
||||
|
||||
#include "net/rime.h"
|
||||
|
||||
void msp430_cpu_init(void);
|
||||
|
||||
#endif /* __CONTIKI_MSB430_H__ */
|
45
platform/msb430/core.c
Normal file
45
platform/msb430/core.c
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* 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.
|
||||
*
|
||||
* @(#)$Id: core.c,v 1.1 2007/06/28 12:49:57 nvt-se Exp $
|
||||
*/
|
||||
#include "contiki-msb430.h"
|
||||
#include "codeprop-tmp.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
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;
|
||||
}
|
56
platform/msb430/msb430-slip-arch.c
Normal file
56
platform/msb430/msb430-slip-arch.c
Normal file
|
@ -0,0 +1,56 @@
|
|||
#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);
|
||||
}
|
55
platform/msb430/node-id.c
Normal file
55
platform/msb430/node-id.c
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* 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.
|
||||
*
|
||||
* $Id: node-id.c,v 1.1 2007/06/28 12:49:57 nvt-se Exp $
|
||||
*/
|
||||
|
||||
#include "node-id.h"
|
||||
#include "contiki-conf.h"
|
||||
#include "dev/infomem.h"
|
||||
|
||||
unsigned short node_id = 0;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
node_id_restore(void)
|
||||
{
|
||||
unsigned short newid[2];
|
||||
|
||||
infomem_read(newid, INFOMEM_NODE_ID, 2 * sizeof(node_id));
|
||||
node_id = ( newid[0] == 0xdead ) ? newid[1] : newid[0];
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
node_id_burn(unsigned short id)
|
||||
{
|
||||
unsigned short buffer[2] = { 0xdead, id };
|
||||
infomem_write(INFOMEM_NODE_ID, 1, buffer, 2 * sizeof(node_id));
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
44
platform/msb430/node-id.h
Normal file
44
platform/msb430/node-id.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* 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 <adam@sics.se>
|
||||
*
|
||||
* $Id: node-id.h,v 1.1 2007/06/28 12:49:57 nvt-se Exp $
|
||||
*/
|
||||
|
||||
#ifndef __NODE_ID_H__
|
||||
#define __NODE_ID_H__
|
||||
|
||||
void node_id_restore(void);
|
||||
void node_id_burn(unsigned short node_id);
|
||||
|
||||
extern unsigned short node_id;
|
||||
|
||||
#endif /* __NODE_ID_H__ */
|
3
platform/msb430/symbols.c
Normal file
3
platform/msb430/symbols.c
Normal file
|
@ -0,0 +1,3 @@
|
|||
#include "symbols.h"
|
||||
const int symbols_nelts = 0;
|
||||
const struct symbols symbols[] = {{0,0}};
|
2
platform/msb430/symbols.h
Normal file
2
platform/msb430/symbols.h
Normal file
|
@ -0,0 +1,2 @@
|
|||
#include "loader/symbols.h"
|
||||
extern const struct symbols symbols[1];
|
Loading…
Reference in a new issue