fixed the z1 platform and generic code used by z1 to work with IAR compiler
This commit is contained in:
parent
c48f8fd39a
commit
77ec0bfa0f
@ -191,7 +191,7 @@ struct file_header {
|
|||||||
uint8_t deprecated_eof_hint;
|
uint8_t deprecated_eof_hint;
|
||||||
uint8_t flags;
|
uint8_t flags;
|
||||||
char name[COFFEE_NAME_LENGTH];
|
char name[COFFEE_NAME_LENGTH];
|
||||||
} __attribute__((packed));
|
};
|
||||||
|
|
||||||
/* This is needed because of a buggy compiler. */
|
/* This is needed because of a buggy compiler. */
|
||||||
struct log_param {
|
struct log_param {
|
||||||
@ -1141,7 +1141,7 @@ cfs_read(int fd, void *buf, unsigned size)
|
|||||||
r = bytes_left;
|
r = bytes_left;
|
||||||
}
|
}
|
||||||
fdp->offset += r;
|
fdp->offset += r;
|
||||||
buf += r;
|
buf = (char *)buf + r;
|
||||||
}
|
}
|
||||||
#endif /* COFFEE_MICRO_LOGS */
|
#endif /* COFFEE_MICRO_LOGS */
|
||||||
|
|
||||||
@ -1208,7 +1208,7 @@ cfs_write(int fd, const void *buf, unsigned size)
|
|||||||
/* A log record was written. */
|
/* A log record was written. */
|
||||||
bytes_left -= i;
|
bytes_left -= i;
|
||||||
fdp->offset += i;
|
fdp->offset += i;
|
||||||
buf += i;
|
buf = (char *)buf + i;
|
||||||
|
|
||||||
/* Update the file end for a potential log merge that might
|
/* Update the file end for a potential log merge that might
|
||||||
occur while writing log records. */
|
occur while writing log records. */
|
||||||
|
@ -39,7 +39,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
#include "io.h"
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
|
#include <io.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
#include "dev/cc2420.h"
|
#include "dev/cc2420.h"
|
||||||
#include "dev/cc2420-aes.h"
|
#include "dev/cc2420-aes.h"
|
||||||
#include "dev/spi.h"
|
#include "dev/spi.h"
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
#elif defined(__MSP430__)
|
#elif defined(__MSP430__)
|
||||||
#ifdef __IAR_SYSTEMS_ICC__
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
#include <io430.h>
|
#include <msp430.h>
|
||||||
#else
|
#else
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -33,9 +33,14 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <io.h>
|
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
|
#include <io.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "lib/sensors.h"
|
#include "lib/sensors.h"
|
||||||
#include "dev/sht11.h"
|
#include "dev/sht11.h"
|
||||||
#include "dev/sht11-sensor.h"
|
#include "dev/sht11-sensor.h"
|
||||||
|
@ -34,9 +34,15 @@
|
|||||||
* temperature sensors.
|
* temperature sensors.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "contiki.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <dev/sht11.h>
|
#include <dev/sht11.h>
|
||||||
#include "sht11-arch.h"
|
#include "sht11-arch.h"
|
||||||
|
@ -29,12 +29,16 @@
|
|||||||
* @(#)$Id: cc2420-arch-sfd.c,v 1.5 2010/12/16 22:49:12 adamdunkels Exp $
|
* @(#)$Id: cc2420-arch-sfd.c,v 1.5 2010/12/16 22:49:12 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "contiki.h"
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "dev/spi.h"
|
#include "dev/spi.h"
|
||||||
#include "dev/cc2420.h"
|
#include "dev/cc2420.h"
|
||||||
#include "contiki-conf.h"
|
|
||||||
|
|
||||||
extern volatile uint8_t cc2420_sfd_counter;
|
extern volatile uint8_t cc2420_sfd_counter;
|
||||||
extern volatile uint16_t cc2420_sfd_start_time;
|
extern volatile uint16_t cc2420_sfd_start_time;
|
||||||
@ -42,7 +46,12 @@ extern volatile uint16_t cc2420_sfd_end_time;
|
|||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* SFD interrupt for timestamping radio packets */
|
/* SFD interrupt for timestamping radio packets */
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#pragma vector=TIMERB1_VECTOR
|
||||||
|
__interrupt void
|
||||||
|
#else
|
||||||
interrupt(TIMERB1_VECTOR)
|
interrupt(TIMERB1_VECTOR)
|
||||||
|
#endif
|
||||||
cc24240_timerb1_interrupt(void)
|
cc24240_timerb1_interrupt(void)
|
||||||
{
|
{
|
||||||
int tbiv;
|
int tbiv;
|
||||||
|
@ -32,10 +32,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "contiki.h"
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
#include "contiki-conf.h"
|
|
||||||
|
|
||||||
#include "sys/energest.h"
|
#include "sys/energest.h"
|
||||||
#include "sys/clock.h"
|
#include "sys/clock.h"
|
||||||
@ -53,7 +56,13 @@ static volatile clock_time_t count = 0;
|
|||||||
/* last_tar is used for calculating clock_fine */
|
/* last_tar is used for calculating clock_fine */
|
||||||
static volatile uint16_t last_tar = 0;
|
static volatile uint16_t last_tar = 0;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
interrupt(TIMERA1_VECTOR) timera1 (void) {
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#pragma vector=TIMERA1_VECTOR
|
||||||
|
__interrupt void
|
||||||
|
#else
|
||||||
|
interrupt(TIMERA1_VECTOR)
|
||||||
|
#endif
|
||||||
|
timera1 (void) {
|
||||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||||
|
|
||||||
watchdog_start();
|
watchdog_start();
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __IAR_SYSTEMS_ICC__
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
#include <io430.h>
|
#include <msp430.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define HWCONF_PIN(name, port, bit) \
|
#define HWCONF_PIN(name, port, bit) \
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
#ifndef __UART0_H__
|
#ifndef __UART0_H__
|
||||||
#define __UART0_H__
|
#define __UART0_H__
|
||||||
|
|
||||||
#include "msp430.h"
|
#include "contiki.h"
|
||||||
|
|
||||||
#define UART0_BAUD2UBR(baud) ((MSP430_CPU_SPEED)/(baud))
|
#define UART0_BAUD2UBR(baud) ((MSP430_CPU_SPEED)/(baud))
|
||||||
|
|
||||||
|
@ -34,8 +34,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "contiki.h"
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "sys/energest.h"
|
#include "sys/energest.h"
|
||||||
#include "dev/uart0.h"
|
#include "dev/uart0.h"
|
||||||
@ -139,7 +145,13 @@ uart0_init(unsigned long ubr)
|
|||||||
#endif /* TX_WITH_INTERRUPT */
|
#endif /* TX_WITH_INTERRUPT */
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#pragma vector=USCIAB0RX_VECTOR
|
||||||
|
__interrupt void
|
||||||
|
#else
|
||||||
interrupt(USCIAB0RX_VECTOR)
|
interrupt(USCIAB0RX_VECTOR)
|
||||||
|
#endif
|
||||||
uart0_rx_interrupt(void)
|
uart0_rx_interrupt(void)
|
||||||
{
|
{
|
||||||
uint8_t c;
|
uint8_t c;
|
||||||
@ -160,19 +172,24 @@ uart0_rx_interrupt(void)
|
|||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#if TX_WITH_INTERRUPT
|
#if TX_WITH_INTERRUPT
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#pragma vector=USCIAB0TX_VECTOR
|
||||||
|
__interrupt void
|
||||||
|
#else
|
||||||
interrupt(USCIAB0TX_VECTOR)
|
interrupt(USCIAB0TX_VECTOR)
|
||||||
|
#endif
|
||||||
uart0_tx_interrupt(void)
|
uart0_tx_interrupt(void)
|
||||||
{
|
{
|
||||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||||
if((IFG2 & UCA0TXIFG)){
|
if((IFG2 & UCA0TXIFG)){
|
||||||
|
|
||||||
if(ringbuf_elements(&txbuf) == 0) {
|
if(ringbuf_elements(&txbuf) == 0) {
|
||||||
transmitting = 0;
|
transmitting = 0;
|
||||||
} else {
|
} else {
|
||||||
UCA0TXBUF = ringbuf_get(&txbuf);
|
UCA0TXBUF = ringbuf_get(&txbuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In a stand-alone app won't work without this. Is the UG misleading? */
|
/* In a stand-alone app won't work without this. Is the UG misleading? */
|
||||||
IFG2 &= ~UCA0TXIFG;
|
IFG2 &= ~UCA0TXIFG;
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
#ifndef __UART1_H__
|
#ifndef __UART1_H__
|
||||||
#define __UART1_H__
|
#define __UART1_H__
|
||||||
|
|
||||||
#include "msp430.h"
|
#include "contiki.h"
|
||||||
|
|
||||||
#define UART1_BAUD2UBR(baud) ((MSP430_CPU_SPEED)/(baud))
|
#define UART1_BAUD2UBR(baud) ((MSP430_CPU_SPEED)/(baud))
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
#ifdef __IAR_SYSTEMS_ICC__
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
#include <io430.h>
|
#include <msp430.h>
|
||||||
#else
|
#else
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
@ -39,10 +39,14 @@
|
|||||||
* $Revision: 1.1 $
|
* $Revision: 1.1 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki-conf.h"
|
#include "contiki.h"
|
||||||
#include "dev/leds.h"
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "dev/leds.h"
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
|
@ -30,11 +30,10 @@
|
|||||||
*
|
*
|
||||||
* @(#)$Id: msp430.c,v 1.15 2011/01/05 13:36:38 joxe Exp $
|
* @(#)$Id: msp430.c,v 1.15 2011/01/05 13:36:38 joxe Exp $
|
||||||
*/
|
*/
|
||||||
|
#include "contiki.h"
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/unistd.h>
|
#include <sys/unistd.h>
|
||||||
#include "msp430.h"
|
|
||||||
#include "msp430def.h"
|
|
||||||
#include "dev/watchdog.h"
|
#include "dev/watchdog.h"
|
||||||
#include "net/uip.h"
|
#include "net/uip.h"
|
||||||
|
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2007, Swedish Institute of Computer Science.
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions
|
|
||||||
* are met:
|
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
|
||||||
* documentation and/or other materials provided with the distribution.
|
|
||||||
* 3. Neither the name of the Institute nor the names of its contributors
|
|
||||||
* may be used to endorse or promote products derived from this software
|
|
||||||
* without specific prior written permission.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
||||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
||||||
* SUCH DAMAGE.
|
|
||||||
*
|
|
||||||
* This file is part of the Contiki operating system.
|
|
||||||
*
|
|
||||||
* $Id: msp430.h,v 1.4 2011/01/05 13:36:38 joxe Exp $
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \file
|
|
||||||
* MSP430 definitions
|
|
||||||
* \author
|
|
||||||
* Adam Dunkels <adam@sics.se>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __MSP430_H__
|
|
||||||
#define __MSP430_H__
|
|
||||||
|
|
||||||
#include "contiki-conf.h"
|
|
||||||
|
|
||||||
#ifdef F_CPU
|
|
||||||
#define MSP430_CPU_SPEED F_CPU
|
|
||||||
#else
|
|
||||||
#define MSP430_CPU_SPEED 2457600UL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define MSP430_REQUIRE_CPUON 0
|
|
||||||
#define MSP430_REQUIRE_LPM1 1
|
|
||||||
#define MSP430_REQUIRE_LPM2 2
|
|
||||||
#define MSP430_REQUIRE_LPM3 3
|
|
||||||
|
|
||||||
void msp430_add_lpm_req(int req);
|
|
||||||
void msp430_remove_lpm_req(int req);
|
|
||||||
|
|
||||||
#endif /* __MSP430_H__ */
|
|
@ -35,12 +35,14 @@
|
|||||||
#ifdef HAVE_STDINT_H
|
#ifdef HAVE_STDINT_H
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#else
|
#else
|
||||||
|
#ifndef uint8_t
|
||||||
typedef unsigned char uint8_t;
|
typedef unsigned char uint8_t;
|
||||||
typedef unsigned short uint16_t;
|
typedef unsigned short uint16_t;
|
||||||
typedef unsigned long uint32_t;
|
typedef unsigned long uint32_t;
|
||||||
typedef signed char int8_t;
|
typedef signed char int8_t;
|
||||||
typedef short int16_t;
|
typedef short int16_t;
|
||||||
typedef long int32_t;
|
typedef long int32_t;
|
||||||
|
#endif
|
||||||
#endif /* !HAVE_STDINT_H */
|
#endif /* !HAVE_STDINT_H */
|
||||||
|
|
||||||
/* These names are deprecated, use C99 names. */
|
/* These names are deprecated, use C99 names. */
|
||||||
@ -106,4 +108,21 @@ void *w_memset(void *out, int value, size_t n);
|
|||||||
#endif /* memcpy */
|
#endif /* memcpy */
|
||||||
#endif /* __GNUC__ && __MSP430__ && MSP430_MEMCPY_WORKAROUND */
|
#endif /* __GNUC__ && __MSP430__ && MSP430_MEMCPY_WORKAROUND */
|
||||||
|
|
||||||
|
|
||||||
|
/* Moved from the msp430.h file with other msp430 related defines */
|
||||||
|
|
||||||
|
#ifdef F_CPU
|
||||||
|
#define MSP430_CPU_SPEED F_CPU
|
||||||
|
#else
|
||||||
|
#define MSP430_CPU_SPEED 2457600UL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MSP430_REQUIRE_CPUON 0
|
||||||
|
#define MSP430_REQUIRE_LPM1 1
|
||||||
|
#define MSP430_REQUIRE_LPM2 2
|
||||||
|
#define MSP430_REQUIRE_LPM3 3
|
||||||
|
|
||||||
|
void msp430_add_lpm_req(int req);
|
||||||
|
void msp430_remove_lpm_req(int req);
|
||||||
|
|
||||||
#endif /* MSP430DEF_H */
|
#endif /* MSP430DEF_H */
|
||||||
|
@ -38,14 +38,16 @@
|
|||||||
* Adam Dunkels <adam@sics.se>
|
* Adam Dunkels <adam@sics.se>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "contiki.h"
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __IAR_SYSTEMS_ICC__
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
#include <io430.h>
|
#include <msp430.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "sys/energest.h"
|
#include "sys/energest.h"
|
||||||
#include "sys/rtimer.h"
|
#include "sys/rtimer.h"
|
||||||
@ -61,7 +63,13 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
interrupt(TIMERA0_VECTOR) timera0 (void) {
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#pragma vector=TIMERA0_VECTOR
|
||||||
|
__interrupt void
|
||||||
|
#else
|
||||||
|
interrupt(TIMERA0_VECTOR)
|
||||||
|
#endif
|
||||||
|
timera0 (void) {
|
||||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||||
|
|
||||||
watchdog_start();
|
watchdog_start();
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#include "contiki-conf.h"
|
#include "contiki-conf.h"
|
||||||
|
|
||||||
#ifdef __IAR_SYSTEMS_ICC__
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
#include <io430.h>
|
#include <msp430.h>
|
||||||
#else
|
#else
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
@ -29,9 +29,13 @@
|
|||||||
* @(#)$Id: spix.c,v 1.1 2010/08/24 16:23:20 joxe Exp $
|
* @(#)$Id: spix.c,v 1.1 2010/08/24 16:23:20 joxe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "contiki.h"
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
#include <signal.h>
|
||||||
#include "contiki-conf.h"
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is SPI initialization code for the MSP430X architecture.
|
* This is SPI initialization code for the MSP430X architecture.
|
||||||
|
@ -41,6 +41,13 @@
|
|||||||
#define asmv(arg) __asm__ __volatile__(arg)
|
#define asmv(arg) __asm__ __volatile__(arg)
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#ifdef UIP_ARCH_IPCHKSUM
|
#ifdef UIP_ARCH_IPCHKSUM
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
u16_t
|
||||||
|
uip_ipchksum(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#else
|
||||||
u16_t
|
u16_t
|
||||||
uip_ipchksum(void)
|
uip_ipchksum(void)
|
||||||
{
|
{
|
||||||
@ -66,4 +73,5 @@ uip_ipchksum(void)
|
|||||||
return (sum == 0) ? 0xffff : sum;
|
return (sum == 0) ? 0xffff : sum;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
@ -30,8 +30,14 @@
|
|||||||
*
|
*
|
||||||
* @(#)$Id: watchdog.c,v 1.12 2010/11/12 15:54:41 nifi Exp $
|
* @(#)$Id: watchdog.c,v 1.12 2010/11/12 15:54:41 nifi Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "contiki.h"
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
#include "dev/watchdog.h"
|
#include "dev/watchdog.h"
|
||||||
|
|
||||||
static int counter = 0;
|
static int counter = 0;
|
||||||
@ -70,7 +76,12 @@ printstring(char *s)
|
|||||||
#endif /* CONTIKI_TARGET_SKY */
|
#endif /* CONTIKI_TARGET_SKY */
|
||||||
#endif /* PRINT_STACK_ON_REBOOT */
|
#endif /* PRINT_STACK_ON_REBOOT */
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#pragma vector=WDT_VECTOR
|
||||||
|
__interrupt void
|
||||||
|
#else
|
||||||
interrupt(WDT_VECTOR)
|
interrupt(WDT_VECTOR)
|
||||||
|
#endif
|
||||||
watchdog_interrupt(void)
|
watchdog_interrupt(void)
|
||||||
{
|
{
|
||||||
#ifdef CONTIKI_TARGET_SKY
|
#ifdef CONTIKI_TARGET_SKY
|
||||||
|
@ -1,7 +1,15 @@
|
|||||||
# $Id: Makefile.z1,v 1.5 2011/02/26 enricmcalvo Exp $
|
# $Id: Makefile.z1,v 1.5 2011/02/26 enricmcalvo Exp $
|
||||||
|
|
||||||
PROJECT_SOURCEFILES += i2cmaster.c adxl345.c
|
PROJECT_SOURCEFILES += i2cmaster.c adxl345.c
|
||||||
|
|
||||||
|
ifdef GCC
|
||||||
CFLAGS+=-Os -g
|
CFLAGS+=-Os -g
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef IAR
|
||||||
|
CFLAGS+=-e --vla
|
||||||
|
endif
|
||||||
|
|
||||||
CLEAN += symbols.c symbols.h
|
CLEAN += symbols.c symbols.h
|
||||||
#CFLAGS += -ffunction-sections
|
#CFLAGS += -ffunction-sections
|
||||||
#LDFLAGS += -Wl,--gc-sections,--undefined=_reset_vector__,--undefined=InterruptVectors,--undefined=_copy_data_init__,--undefined=_clear_bss_init__,--undefined=_end_of_init__
|
#LDFLAGS += -Wl,--gc-sections,--undefined=_reset_vector__,--undefined=InterruptVectors,--undefined=_copy_data_init__,--undefined=_clear_bss_init__,--undefined=_end_of_init__
|
||||||
@ -28,7 +36,7 @@ ifdef nodemac
|
|||||||
CFLAGS += -DMACID=$(nodemac)
|
CFLAGS += -DMACID=$(nodemac)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS) $(CONTIKI_TARGET_MAIN)
|
CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS)
|
||||||
CONTIKI_TARGET_SOURCEFILES += contiki-z1-platform.c
|
CONTIKI_TARGET_SOURCEFILES += contiki-z1-platform.c
|
||||||
|
|
||||||
MCU=msp430x2617
|
MCU=msp430x2617
|
||||||
|
@ -47,8 +47,14 @@
|
|||||||
#include "dev/leds.h"
|
#include "dev/leds.h"
|
||||||
#include "dev/watchdog.h"
|
#include "dev/watchdog.h"
|
||||||
|
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define DEBUG 1
|
#define DEBUG 1
|
||||||
|
@ -108,11 +108,6 @@
|
|||||||
#define ELFLOADER_CONF_DATAMEMORY_SIZE 0x400
|
#define ELFLOADER_CONF_DATAMEMORY_SIZE 0x400
|
||||||
#define ELFLOADER_CONF_TEXTMEMORY_SIZE 0x800
|
#define ELFLOADER_CONF_TEXTMEMORY_SIZE 0x800
|
||||||
|
|
||||||
#define CCIF
|
|
||||||
#define CLIF
|
|
||||||
|
|
||||||
#define CC_CONF_INLINE inline
|
|
||||||
|
|
||||||
#define AODV_COMPLIANCE
|
#define AODV_COMPLIANCE
|
||||||
#define AODV_NUM_RT_ENTRIES 32
|
#define AODV_NUM_RT_ENTRIES 32
|
||||||
|
|
||||||
|
@ -29,14 +29,17 @@
|
|||||||
* @(#)$Id: contiki-z1-main.c,v 1.4 2010/08/26 22:08:11 nifi Exp $
|
* @(#)$Id: contiki-z1-main.c,v 1.4 2010/08/26 22:08:11 nifi Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <signal.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include <io.h>
|
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
|
#include <io.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "dev/cc2420.h"
|
#include "dev/cc2420.h"
|
||||||
#include "dev/leds.h"
|
#include "dev/leds.h"
|
||||||
|
@ -40,7 +40,6 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
#include "adxl345.h"
|
#include "adxl345.h"
|
||||||
#include "cc2420.h"
|
#include "cc2420.h"
|
||||||
@ -374,7 +373,13 @@ PROCESS_THREAD(accmeter_process, ev, data) {
|
|||||||
#if 1
|
#if 1
|
||||||
static struct timer suppressTimer1, suppressTimer2;
|
static struct timer suppressTimer1, suppressTimer2;
|
||||||
|
|
||||||
interrupt(PORT1_VECTOR) port1_isr (void) {
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#pragma vector=PORT1_VECTOR
|
||||||
|
__interrupt void
|
||||||
|
#else
|
||||||
|
interrupt (PORT1_VECTOR)
|
||||||
|
#endif
|
||||||
|
port1_isr (void) {
|
||||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||||
/* ADXL345_IFG.x goes high when interrupt occurs, use to check what interrupted */
|
/* ADXL345_IFG.x goes high when interrupt occurs, use to check what interrupted */
|
||||||
if ((ADXL345_IFG & ADXL345_INT1_PIN) && !(ADXL345_IFG & BV(CC2420_FIFOP_PIN))){
|
if ((ADXL345_IFG & ADXL345_INT1_PIN) && !(ADXL345_IFG & BV(CC2420_FIFOP_PIN))){
|
||||||
|
@ -63,10 +63,19 @@
|
|||||||
#define L_OFF(x) (LEDS_PxOUT |= x)
|
#define L_OFF(x) (LEDS_PxOUT |= x)
|
||||||
|
|
||||||
//XXX Temporary place for defines that are lacking in mspgcc4's gpio.h
|
//XXX Temporary place for defines that are lacking in mspgcc4's gpio.h
|
||||||
|
#ifdef __GNUC__
|
||||||
#ifndef P1SEL2_
|
#ifndef P1SEL2_
|
||||||
#define P1SEL2_ 0x0041 /* Port 1 Selection 2 */
|
#define P1SEL2_ 0x0041 /* Port 1 Selection 2*/
|
||||||
sfrb(P1SEL2, P1SEL2_);
|
sfrb(P1SEL2, P1SEL2_);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#ifndef P1SEL2_
|
||||||
|
#define P1SEL2_ (0x0041u) /* Port 1 Selection 2*/
|
||||||
|
DEFC( P1SEL2 , P1SEL2_)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Used in accm_read_axis(), eg accm_read_axis(X_AXIS);*/
|
/* Used in accm_read_axis(), eg accm_read_axis(X_AXIS);*/
|
||||||
enum ADXL345_AXIS {
|
enum ADXL345_AXIS {
|
||||||
|
@ -35,10 +35,16 @@
|
|||||||
* Updated : $Date: 2010/08/25 19:30:52 $
|
* Updated : $Date: 2010/08/25 19:30:52 $
|
||||||
* $Revision: 1.11 $
|
* $Revision: 1.11 $
|
||||||
*/
|
*/
|
||||||
|
#include "contiki.h"
|
||||||
#include "dev/battery-sensor.h"
|
#include "dev/battery-sensor.h"
|
||||||
#include "dev/sky-sensors.h"
|
#include "dev/sky-sensors.h"
|
||||||
|
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Configure ADC12_2 to sample channel 11 (voltage) and use */
|
/* Configure ADC12_2 to sample channel 11 (voltage) and use */
|
||||||
/* the Vref+ as reference (SREF_1) since it is a stable reference */
|
/* the Vref+ as reference (SREF_1) since it is a stable reference */
|
||||||
|
@ -30,10 +30,18 @@
|
|||||||
*
|
*
|
||||||
* @(#)$Id: button-sensor.c,v 1.2 2010/08/26 16:01:20 joxe Exp $
|
* @(#)$Id: button-sensor.c,v 1.2 2010/08/26 16:01:20 joxe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "contiki.h"
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
|
#include <io.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "lib/sensors.h"
|
#include "lib/sensors.h"
|
||||||
#include "dev/hwconf.h"
|
#include "dev/hwconf.h"
|
||||||
#include "dev/button-sensor.h"
|
#include "dev/button-sensor.h"
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
const struct sensors_sensor button_sensor;
|
const struct sensors_sensor button_sensor;
|
||||||
|
|
||||||
@ -44,7 +52,13 @@ HWCONF_PIN(BUTTON, 2, 5);
|
|||||||
HWCONF_IRQ(BUTTON, 2, 5);
|
HWCONF_IRQ(BUTTON, 2, 5);
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#pragma vector=PORT2_VECTOR
|
||||||
|
__interrupt void
|
||||||
|
#else
|
||||||
interrupt(PORT2_VECTOR)
|
interrupt(PORT2_VECTOR)
|
||||||
|
#endif
|
||||||
irq_p2(void)
|
irq_p2(void)
|
||||||
{
|
{
|
||||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||||
|
@ -29,12 +29,17 @@
|
|||||||
* @(#)$Id: cc2420-arch.c,v 1.1 2010/11/07 08:38:51 enricmcalvo Exp $
|
* @(#)$Id: cc2420-arch.c,v 1.1 2010/11/07 08:38:51 enricmcalvo Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <io.h>
|
|
||||||
#include <signal.h>
|
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
#include "contiki-net.h"
|
#include "contiki-net.h"
|
||||||
|
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
|
#include <io.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "dev/spi.h"
|
#include "dev/spi.h"
|
||||||
#include "dev/cc2420.h"
|
#include "dev/cc2420.h"
|
||||||
|
|
||||||
|
@ -201,7 +201,12 @@ i2c_transmit_n(u8_t byte_ctr, u8_t *tx_buf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
interrupt (USCIAB1TX_VECTOR)
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#pragma vector=USCIAB1TX_VECTOR
|
||||||
|
__interrupt void
|
||||||
|
#else
|
||||||
|
interrupt (USCIAB1TX_VECTOR)
|
||||||
|
#endif
|
||||||
i2c_tx_interrupt (void) {
|
i2c_tx_interrupt (void) {
|
||||||
// TX Part
|
// TX Part
|
||||||
if (UC1IFG & UCB1TXIFG) { // TX int. condition
|
if (UC1IFG & UCB1TXIFG) { // TX int. condition
|
||||||
@ -232,7 +237,12 @@ i2c_tx_interrupt (void) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
interrupt(USCIAB1RX_VECTOR)
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#pragma vector=USCIAB1RX_VECTOR
|
||||||
|
__interrupt void
|
||||||
|
#else
|
||||||
|
interrupt (USCIAB1RX_VECTOR)
|
||||||
|
#endif
|
||||||
i2c_rx_interrupt(void) {
|
i2c_rx_interrupt(void) {
|
||||||
if (UCB1STAT & UCNACKIFG){
|
if (UCB1STAT & UCNACKIFG){
|
||||||
PRINTFDEBUG("!!! NACK received in RX\n");
|
PRINTFDEBUG("!!! NACK received in RX\n");
|
||||||
|
@ -42,12 +42,18 @@
|
|||||||
#define __I2CMASTER_H__
|
#define __I2CMASTER_H__
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
#include "contiki.h"
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <contiki.h>
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
#include <dev/spi.h>
|
#include <dev/spi.h>
|
||||||
#include <dev/leds.h>
|
#include <dev/leds.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void i2c_enable(void);
|
void i2c_enable(void);
|
||||||
|
|
||||||
void i2c_receiveinit(u8_t slave_address);
|
void i2c_receiveinit(u8_t slave_address);
|
||||||
@ -59,10 +65,17 @@ void i2c_transmit_n(u8_t byte_ctr, u8_t *tx_buf);
|
|||||||
u8_t i2c_busy(void);
|
u8_t i2c_busy(void);
|
||||||
|
|
||||||
//XXX Temporary place for defines that are lacking in mspgcc4's gpio.h
|
//XXX Temporary place for defines that are lacking in mspgcc4's gpio.h
|
||||||
|
#ifdef __GNUC__
|
||||||
#ifndef P5SEL2_
|
#ifndef P5SEL2_
|
||||||
#define P5SEL2_ 0x0045 /* Port 5 Selection 2*/
|
#define P5SEL2_ 0x0045 /* Port 5 Selection 2*/
|
||||||
sfrb(P5SEL2, P5SEL2_);
|
sfrb(P5SEL2, P5SEL2_);
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#define P5SEL2_ (0x0045u) /* Port 5 Selection 2*/
|
||||||
|
DEFC( P5SEL2 , P5SEL2_)
|
||||||
|
#endif
|
||||||
|
|
||||||
//XXX Should these defines be in the contiki-conf.h to make it more platform-independent?
|
//XXX Should these defines be in the contiki-conf.h to make it more platform-independent?
|
||||||
#define I2C_PxDIR P5DIR
|
#define I2C_PxDIR P5DIR
|
||||||
#define I2C_PxIN P5IN
|
#define I2C_PxIN P5IN
|
||||||
|
@ -32,13 +32,18 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
|
#include <io.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "lib/sensors.h"
|
#include "lib/sensors.h"
|
||||||
#include "dev/sky-sensors.h"
|
#include "dev/sky-sensors.h"
|
||||||
#include "dev/light-sensor.h"
|
#include "dev/light-sensor.h"
|
||||||
#include "dev/potentiometer-sensor.h"
|
#include "dev/potentiometer-sensor.h"
|
||||||
|
|
||||||
#include <io.h>
|
|
||||||
|
|
||||||
/* Photodiode 1 (P64) on INCH_4 */
|
/* Photodiode 1 (P64) on INCH_4 */
|
||||||
/* Photodiode 2 (P65) on INCH_5 */
|
/* Photodiode 2 (P65) on INCH_5 */
|
||||||
//Enric#define INPUT_CHANNEL ((1 << INCH_4) | (1 << INCH_5))
|
//Enric#define INPUT_CHANNEL ((1 << INCH_4) | (1 << INCH_5))
|
||||||
|
@ -40,9 +40,14 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <io.h>
|
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
|
#include <io.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "dev/light.h"
|
#include "dev/light.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -36,7 +36,15 @@
|
|||||||
|
|
||||||
#include "dev/potentiometer-sensor.h"
|
#include "dev/potentiometer-sensor.h"
|
||||||
#include "dev/sky-sensors.h"
|
#include "dev/sky-sensors.h"
|
||||||
|
|
||||||
|
#include "contiki.h"
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Configure ADC12_2 to sample channel 11 (voltage) and use */
|
/* Configure ADC12_2 to sample channel 11 (voltage) and use */
|
||||||
/* the Vref+ as reference (SREF_1) since it is a stable reference */
|
/* the Vref+ as reference (SREF_1) since it is a stable reference */
|
||||||
@ -44,7 +52,7 @@
|
|||||||
#define INPUT_REFERENCE SREF_0
|
#define INPUT_REFERENCE SREF_0
|
||||||
#define POTENTIOMETER_MEM ADC12MEM4
|
#define POTENTIOMETER_MEM ADC12MEM4
|
||||||
|
|
||||||
const struct sensors_sensor battery_sensor;
|
const struct sensors_sensor potentiometer_sensor;
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static int
|
static int
|
||||||
value(int type)
|
value(int type)
|
||||||
|
@ -39,7 +39,11 @@
|
|||||||
*/
|
*/
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
#include "lib/sensors.h"
|
#include "lib/sensors.h"
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define ADC12MCTL_NO(adcno) ((unsigned char *) ADC12MCTL0_)[adcno]
|
#define ADC12MCTL_NO(adcno) ((unsigned char *) ADC12MCTL0_)[adcno]
|
||||||
|
|
||||||
|
@ -40,7 +40,14 @@
|
|||||||
|
|
||||||
#include "dev/temperature-sensor.h"
|
#include "dev/temperature-sensor.h"
|
||||||
#include "dev/sky-sensors.h"
|
#include "dev/sky-sensors.h"
|
||||||
|
|
||||||
|
#include "contiki.h"
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define INPUT_CHANNEL (1 << INCH_10)
|
#define INPUT_CHANNEL (1 << INCH_10)
|
||||||
#define INPUT_REFERENCE SREF_1
|
#define INPUT_REFERENCE SREF_1
|
||||||
|
@ -40,8 +40,14 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
|
#include <io.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "i2cmaster.h"
|
#include "i2cmaster.h"
|
||||||
#include "tmp102.h"
|
#include "tmp102.h"
|
||||||
|
|
||||||
|
@ -43,10 +43,13 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "contiki.h"
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
#include "contiki.h"
|
|
||||||
|
|
||||||
#include "dev/spi.h"
|
#include "dev/spi.h"
|
||||||
#include "dev/xmem.h"
|
#include "dev/xmem.h"
|
||||||
|
@ -37,8 +37,15 @@
|
|||||||
* Updated : $Date: 2010/11/05 10:31:57 $
|
* Updated : $Date: 2010/11/05 10:31:57 $
|
||||||
* $Revision: 1.3 $
|
* $Revision: 1.3 $
|
||||||
*/
|
*/
|
||||||
#include <io.h>
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
|
#include <io.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "lib/sensors.h"
|
#include "lib/sensors.h"
|
||||||
#include "dev/z1-phidgets.h"
|
#include "dev/z1-phidgets.h"
|
||||||
|
|
||||||
|
@ -30,10 +30,19 @@
|
|||||||
*
|
*
|
||||||
* @(#)$Id: msp430.c,v 1.1 2010/08/24 16:26:38 joxe Exp $
|
* @(#)$Id: msp430.c,v 1.1 2010/08/24 16:26:38 joxe Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "contiki.h"
|
||||||
|
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <msp430.h>
|
||||||
|
#else
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <sys/unistd.h>
|
#include <sys/unistd.h>
|
||||||
#include "msp430.h"
|
#define asmv(arg) __asm__ __volatile__(arg)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "msp430def.h"
|
||||||
#include "dev/watchdog.h"
|
#include "dev/watchdog.h"
|
||||||
#include "net/uip.h"
|
#include "net/uip.h"
|
||||||
|
|
||||||
@ -259,8 +268,10 @@ init_ports(void)
|
|||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* msp430-ld may align _end incorrectly. Workaround in cpu_init. */
|
/* msp430-ld may align _end incorrectly. Workaround in cpu_init. */
|
||||||
|
#ifdef __GNUC__
|
||||||
extern int _end; /* Not in sys/unistd.h */
|
extern int _end; /* Not in sys/unistd.h */
|
||||||
static char *cur_break = (char *)&_end;
|
static char *cur_break = (char *)&_end;
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
msp430_cpu_init(void)
|
msp430_cpu_init(void)
|
||||||
@ -270,39 +281,16 @@ msp430_cpu_init(void)
|
|||||||
init_ports();
|
init_ports();
|
||||||
msp430_quick_synch_dco();
|
msp430_quick_synch_dco();
|
||||||
eint();
|
eint();
|
||||||
|
#ifdef __GNUC__
|
||||||
if((uintptr_t)cur_break & 1) { /* Workaround for msp430-ld bug! */
|
if((uintptr_t)cur_break & 1) { /* Workaround for msp430-ld bug! */
|
||||||
cur_break++;
|
cur_break++;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#define asmv(arg) __asm__ __volatile__(arg)
|
|
||||||
|
|
||||||
#define STACK_EXTRA 32
|
#define STACK_EXTRA 32
|
||||||
|
|
||||||
/*
|
|
||||||
* Allocate memory from the heap. Check that we don't collide with the
|
|
||||||
* stack right now (some other routine might later). A watchdog might
|
|
||||||
* be used to check if cur_break and the stack pointer meet during
|
|
||||||
* runtime.
|
|
||||||
*/
|
|
||||||
void *
|
|
||||||
sbrk(int incr)
|
|
||||||
{
|
|
||||||
char *stack_pointer;
|
|
||||||
|
|
||||||
asmv("mov r1, %0" : "=r" (stack_pointer));
|
|
||||||
stack_pointer -= STACK_EXTRA;
|
|
||||||
if(incr > (stack_pointer - cur_break))
|
|
||||||
return (void *)-1; /* ENOMEM */
|
|
||||||
|
|
||||||
void *old_break = cur_break;
|
|
||||||
cur_break += incr;
|
|
||||||
/*
|
|
||||||
* If the stack was never here then [old_break .. cur_break] should
|
|
||||||
* be filled with zeros.
|
|
||||||
*/
|
|
||||||
return old_break;
|
|
||||||
}
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/*
|
/*
|
||||||
* Mask all interrupts that can be masked.
|
* Mask all interrupts that can be masked.
|
||||||
@ -312,8 +300,13 @@ splhigh_(void)
|
|||||||
{
|
{
|
||||||
/* Clear the GIE (General Interrupt Enable) flag. */
|
/* Clear the GIE (General Interrupt Enable) flag. */
|
||||||
int sr;
|
int sr;
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
sr = __get_SR_register();
|
||||||
|
__bic_SR_register(GIE);
|
||||||
|
#else
|
||||||
asmv("mov r2, %0" : "=r" (sr));
|
asmv("mov r2, %0" : "=r" (sr));
|
||||||
asmv("bic %0, r2" : : "i" (GIE));
|
asmv("bic %0, r2" : : "i" (GIE));
|
||||||
|
#endif
|
||||||
return sr & GIE; /* Ignore other sr bits. */
|
return sr & GIE; /* Ignore other sr bits. */
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
@ -323,8 +316,12 @@ splhigh_(void)
|
|||||||
void
|
void
|
||||||
splx_(int sr)
|
splx_(int sr)
|
||||||
{
|
{
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
__bis_SR_register(sr);
|
||||||
|
#else
|
||||||
/* If GIE was set, restore it. */
|
/* If GIE was set, restore it. */
|
||||||
asmv("bis %0, r2" : : "r" (sr));
|
asmv("bis %0, r2" : : "r" (sr));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* this code will always start the TimerB if not already started */
|
/* this code will always start the TimerB if not already started */
|
||||||
|
@ -45,6 +45,20 @@
|
|||||||
*/
|
*/
|
||||||
#define ZOLERTIA_Z1 1 /* Enric */
|
#define ZOLERTIA_Z1 1 /* Enric */
|
||||||
|
|
||||||
|
#ifdef __IAR_SYSTEMS_ICC__
|
||||||
|
#include <intrinsics.h>
|
||||||
|
#include <in430.h>
|
||||||
|
#define dint() __disable_interrupt()
|
||||||
|
#define eint() __enable_interrupt()
|
||||||
|
#define __MSP430F2617__ 1
|
||||||
|
#define __MSP430__ 1
|
||||||
|
#define CC_CONF_INLINE
|
||||||
|
#define BV(x) (1 << x)
|
||||||
|
#else
|
||||||
|
#define CC_CONF_INLINE inline
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* CPU target speed in Hz */
|
/* CPU target speed in Hz */
|
||||||
/* CPU target speed in Hz */
|
/* CPU target speed in Hz */
|
||||||
#define F_CPU 8000000uL // 8MHz by default
|
#define F_CPU 8000000uL // 8MHz by default
|
||||||
@ -58,8 +72,6 @@
|
|||||||
#define CCIF
|
#define CCIF
|
||||||
#define CLIF
|
#define CLIF
|
||||||
|
|
||||||
#define CC_CONF_INLINE inline
|
|
||||||
|
|
||||||
#define HAVE_STDINT_H
|
#define HAVE_STDINT_H
|
||||||
#define MSP430_MEMCPY_WORKAROUND 1
|
#define MSP430_MEMCPY_WORKAROUND 1
|
||||||
#include "msp430def.h"
|
#include "msp430def.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user