added some files for MSP430X I/O

This commit is contained in:
joxe 2010-08-24 16:23:20 +00:00
parent ef880ddf1f
commit c0549cad3d
8 changed files with 585 additions and 4 deletions

View File

@ -1,4 +1,4 @@
# $Id: Makefile.msp430,v 1.32 2010/04/20 15:38:09 nifi Exp $
# $Id: Makefile.msp430,v 1.33 2010/08/24 16:23:20 joxe Exp $
ifdef nodeid
CFLAGS += -DNODEID=$(nodeid)
@ -14,7 +14,7 @@ CONTIKI_CPU=$(CONTIKI)/cpu/msp430
CONTIKI_CPU_DIRS = . dev
MSP430 = msp430.c flash.c clock.c leds.c leds-arch.c \
watchdog.c lpm.c mtarch.c uart1.c slip_uart1.c uart1-putchar.c rtimer-arch.c
watchdog.c lpm.c mtarch.c rtimer-arch.c
UIPDRIVERS = me.c me_tabs.c slip.c crc16.c
ELFLOADER = elfloader.c elfloader-msp430.c symtab.c

View File

@ -0,0 +1,9 @@
#include "dev/uart0.h"
#include <stdio.h>
int
putchar(int c)
{
uart0_writeb((char)c);
return c;
}

53
cpu/msp430/dev/uart0.h Normal file
View File

@ -0,0 +1,53 @@
/*
* Copyright (c) 2010, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* This file is part of the Contiki operating system.
*
* $Id: uart0.h,v 1.1 2010/08/24 16:23:20 joxe Exp $
*/
/**
* \file
* UART0 header file
* \author
* Enric M. Calvo <ecalvo@zolertia.com>
*/
#ifndef __UART0_H__
#define __UART0_H__
#include "msp430.h"
#define UART0_BAUD2UBR(baud) ((MSP430_CPU_SPEED)/(baud))
void uart0_set_input(int (*input)(unsigned char c));
void uart0_writeb(unsigned char c);
void uart0_init(unsigned long ubr);
uint8_t uart0_active(void);
#endif /* __UART0_H__ */

181
cpu/msp430/dev/uart0x.c Normal file
View File

@ -0,0 +1,181 @@
/*
* 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.
*
* @(#)$Id: uart0x.c,v 1.1 2010/08/24 16:23:20 joxe Exp $
*/
/*
* Machine dependent MSP430X UART0 code.
*/
#include <stdlib.h>
#include <signal.h>
#include "sys/energest.h"
#include "dev/uart0.h"
#include "dev/watchdog.h"
#include "lib/ringbuf.h"
#include "dev/leds.h"
static int (*uart0_input_handler)(unsigned char c);
static volatile uint8_t transmitting;
#ifdef UART0_CONF_TX_WITH_INTERRUPT
#define TX_WITH_INTERRUPT UART0_CONF_TX_WITH_INTERRUPT
#else /* UART0_CONF_TX_WITH_INTERRUPT */
#define TX_WITH_INTERRUPT 1
#endif /* UART0_CONF_TX_WITH_INTERRUPT */
#if TX_WITH_INTERRUPT
#define TXBUFSIZE 64
static struct ringbuf txbuf;
static uint8_t txbuf_data[TXBUFSIZE];
#endif /* TX_WITH_INTERRUPT */
/*---------------------------------------------------------------------------*/
uint8_t
uart0_active(void)
{
return (UCA0STAT & UCBUSY) | transmitting;
}
/*---------------------------------------------------------------------------*/
void
uart0_set_input(int (*input)(unsigned char c))
{
uart0_input_handler = input;
}
/*---------------------------------------------------------------------------*/
void
uart0_writeb(unsigned char c)
{
watchdog_periodic();
#if TX_WITH_INTERRUPT
/* Put the outgoing byte on the transmission buffer. If the buffer
is full, we just keep on trying to put the byte into the buffer
until it is possible to put it there. */
while(ringbuf_put(&txbuf, c) == 0);
/* If there is no transmission going, we need to start it by putting
the first byte into the UART. */
if(transmitting == 0) {
transmitting = 1;
UCA0TXBUF = ringbuf_get(&txbuf);
}
#else /* TX_WITH_INTERRUPT */
/* Loop until the transmission buffer is available. */
/*Enric while((IFG2 & UCA0TXIFG) == 0); */
while((UCA0STAT & UCBUSY));
/* Transmit the data. */
UCA0TXBUF = c;
#endif /* TX_WITH_INTERRUPT */
}
/*---------------------------------------------------------------------------*/
#if ! WITH_UIP /* If WITH_UIP is defined, putchar() is defined by the SLIP driver */
#endif /* ! WITH_UIP */
/*---------------------------------------------------------------------------*/
/**
* Initalize the RS232 port.
*
*/
void
uart0_init(unsigned long ubr)
{
/* RS232 */
UCA0CTL1 |= UCSWRST; /* Hold peripheral in reset state */
UCA0CTL1 |= UCSSEL_2; /* CLK = SMCLK */
UCA0BR0 = 0x45; /* 8MHz/115200 = 69 = 0x45 */
UCA0BR1 = 0x00;
UCA0MCTL = UCBRS_3; /* Modulation UCBRSx = 3 */
P3DIR &= ~0x20; /* P3.5 = USCI_A0 RXD as input */
P3DIR |= 0x10; /* P3.4 = USCI_A0 TXD as output */
P3SEL |= 0x30; /* P3.4,5 = USCI_A0 TXD/RXD */
/*UCA0CTL1 &= ~UCSWRST;*/ /* Initialize USCI state machine */
transmitting = 0;
/* XXX Clear pending interrupts before enable */
IFG2 &= ~UCA0RXIFG;
IFG2 &= ~UCA0TXIFG;
UCA0CTL1 &= ~UCSWRST; /* Initialize USCI state machine **before** enabling interrupts */
IE2 |= UCA0RXIE; /* Enable UCA0 RX interrupt */
/* Enable USCI_A0 TX interrupts (if TX_WITH_INTERRUPT enabled) */
#if TX_WITH_INTERRUPT
ringbuf_init(&txbuf, txbuf_data, sizeof(txbuf_data));
IE2 |= UCA0TXIE; /* Enable UCA0 TX interrupt */
#endif /* TX_WITH_INTERRUPT */
}
/*---------------------------------------------------------------------------*/
interrupt(USCIAB0RX_VECTOR)
uart0_rx_interrupt(void)
{
uint8_t c;
ENERGEST_ON(ENERGEST_TYPE_IRQ);
leds_toggle(LEDS_RED);
if(UCA0STAT & UCRXERR) {
c = UCA0RXBUF; /* Clear error flags by forcing a dummy read. */
} else {
c = UCA0RXBUF;
if(uart0_input_handler != NULL) {
if(uart0_input_handler(c)) {
LPM4_EXIT;
}
}
}
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
#if TX_WITH_INTERRUPT
interrupt(USCIAB0TX_VECTOR)
uart0_tx_interrupt(void)
{
ENERGEST_ON(ENERGEST_TYPE_IRQ);
if((IFG2 & UCA0TXIFG)){
if(ringbuf_elements(&txbuf) == 0) {
transmitting = 0;
} else {
UCA0TXBUF = ringbuf_get(&txbuf);
}
}
/* In a stand-alone app won't work without this. Is the UG misleading? */
IFG2 &= ~UCA0TXIFG;
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
#endif /* TX_WITH_INTERRUPT */
/*---------------------------------------------------------------------------*/

162
cpu/msp430/dev/uart1x.c Normal file
View File

@ -0,0 +1,162 @@
/*
* 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.
*
* @(#)$Id: uart1x.c,v 1.1 2010/08/24 16:23:20 joxe Exp $
*/
/*
* Machine dependent MSP430X UART1 code.
*/
#include <stdlib.h>
#include <io.h>
#include <signal.h>
#include "sys/energest.h"
#include "dev/uart1.h"
#include "dev/watchdog.h"
#include "lib/ringbuf.h"
static int (*uart1_input_handler)(unsigned char c);
static volatile uint8_t transmitting;
#ifdef UART1_CONF_TX_WITH_INTERRUPT
#define TX_WITH_INTERRUPT UART1_CONF_TX_WITH_INTERRUPT
#else /* UART1_CONF_TX_WITH_INTERRUPT */
#define TX_WITH_INTERRUPT 1
#endif /* UART1_CONF_TX_WITH_INTERRUPT */
#if TX_WITH_INTERRUPT
#define TXBUFSIZE 64
static struct ringbuf txbuf;
static uint8_t txbuf_data[TXBUFSIZE];
#endif /* TX_WITH_INTERRUPT */
/*---------------------------------------------------------------------------*/
uint8_t
uart1_active(void)
{
return (UCA0STAT & UCBUSY) | transmitting;
}
/*---------------------------------------------------------------------------*/
void
uart1_set_input(int (*input)(unsigned char c))
{
uart1_input_handler = input;
}
/*---------------------------------------------------------------------------*/
void
uart1_writeb(unsigned char c)
{
/* watchdog_periodic(); */
#if TX_WITH_INTERRUPT
/* Put the outgoing byte on the transmission buffer. If the buffer
is full, we just keep on trying to put the byte into the buffer
until it is possible to put it there. */
while(ringbuf_put(&txbuf, c) == 0);
/* If there is no transmission going, we need to start it by putting
the first byte into the UART. */
if(transmitting == 0) {
transmitting = 1;
UCA0TXBUF = ringbuf_get(&txbuf);
}
#else /* TX_WITH_INTERRUPT */
/* Loop until the transmission buffer is available. */
while(!(IFG2 & UCA0TXIFG));
/* Transmit the data. */
UCA0TXBUF = c;
#endif /* TX_WITH_INTERRUPT */
}
/*---------------------------------------------------------------------------*/
#if ! WITH_UIP /* If WITH_UIP is defined, putchar() is defined by the SLIP driver */
#endif /* ! WITH_UIP */
/*---------------------------------------------------------------------------*/
/**
* Initalize the RS232 port.
*
*/
void
uart1_init(unsigned long ubr)
{
/* RS232 */
P3SEL |= 0x30; /* P3.4,5 = USCI_A0 TXD/RXD */
UCA0CTL1 |= UCSSEL_2; /* CLK = SMCLK */
UCA0BR0 = 0x45; /* 8MHz/115200 = 69 = 0x45 */
UCA0BR1 = 0x00;
UCA0MCTL = UCBRS2; /* Modulation UCBRSx = 4 */
UCA0CTL1 &= ~UCSWRST; /* Initialize USCI state machine */
transmitting = 0;
}
/*---------------------------------------------------------------------------*/
interrupt(USCIAB1RX_VECTOR)
uart1_rx_interrupt(void)
{
uint8_t c;
ENERGEST_ON(ENERGEST_TYPE_IRQ);
/* Check status register for receive errors. */
if(UCA0STAT & UCRXERR) {
c = UCA0RXBUF; /* Clear error flags by forcing a dummy read. */
} else {
c = UCA0RXBUF;
if(uart1_input_handler != NULL) {
if(uart1_input_handler(c)) {
LPM4_EXIT;
}
}
}
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
/*---------------------------------------------------------------------------*/
#if TX_WITH_INTERRUPT
interrupt(USCIAB1TX_VECTOR)
uart1_tx_interrupt(void)
{
ENERGEST_ON(ENERGEST_TYPE_IRQ);
if(IFG2 & UCA0TXIFG) {
if(ringbuf_elements(&txbuf) == 0) {
transmitting = 0;
} else {
UCA0TXBUF = ringbuf_get(&txbuf);
}
}
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
}
#endif /* TX_WITH_INTERRUPT */
/*---------------------------------------------------------------------------*/

94
cpu/msp430/slip_uart0.c Normal file
View File

@ -0,0 +1,94 @@
/*
* 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.
*
* @(#)$Id: slip_uart0.c,v 1.1 2010/08/24 16:23:20 joxe Exp $
*/
/*
* Machine dependent MSP430 SLIP routines for UART0.
*/
#include <io.h>
#include <signal.h>
#include "contiki.h"
#include "dev/slip.h"
#include "dev/uart0.h"
/*---------------------------------------------------------------------------*/
void
slip_arch_writeb(unsigned char c)
{
uart0_writeb(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).
*
*/
/*---------------------------------------------------------------------------*/
#if WITH_UIP
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;
}
return c;
}
#endif
/*---------------------------------------------------------------------------*/
/**
* Initalize the RS232 port and the SLIP driver.
*
*/
void
slip_arch_init(unsigned long ubr)
{
uart0_set_input(slip_input_byte);
}
/*---------------------------------------------------------------------------*/

78
cpu/msp430/spix.c Normal file
View File

@ -0,0 +1,78 @@
/*
* 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.
*
* @(#)$Id: spix.c,v 1.1 2010/08/24 16:23:20 joxe Exp $
*/
#include <io.h>
#include "contiki-conf.h"
/*
* This is SPI initialization code for the MSP430X architecture.
*
*/
unsigned char spi_busy = 0;
/*
* Initialize SPI bus.
*/
void
spi_init(void)
{
//static unsigned char spi_inited = 0;
//if (spi_inited)
//return;
// Initalize ports for communication with SPI units.
UCB0CTL1 |= UCSWRST; //reset usci
UCB0CTL1 |= UCSSEL_2; //smclk while usci is reset
UCB0CTL0 = ( UCMSB | UCMST | UCSYNC | UCCKPL); // MSB-first 8-bit, Master, Synchronous, 3 pin SPI master, no ste, watch-out for clock-phase UCCKPH
UCB0BR1 = 0x00;
UCB0BR0 = 0x02;
// UCB0MCTL = 0; // Dont need modulation control.
P3SEL |= BV(SCK) | BV(MOSI) | BV(MISO); // Select Peripheral functionality
P3DIR |= BV(SCK) | BV(MISO); // Configure as outputs(SIMO,CLK).
//ME1 |= USPIE0; // Module enable ME1 --> U0ME? xxx/bg
// Clear pending interrupts before enable!!!
IFG2 &= ~UCB0RXIFG;
IFG2 &= ~UCB0TXIFG;
UCB0CTL1 &= ~UCSWRST; // Remove RESET before enabling interrupts
//Enable UCB0 Interrupts
//IE2 |= UCB0TXIE; // Enable USCI_B0 TX Interrupts
//IE2 |= UCB0RXIE; // Enable USCI_B0 RX Interrupts
}

View File

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: watchdog.c,v 1.8 2010/04/04 12:30:10 adamdunkels Exp $
* @(#)$Id: watchdog.c,v 1.9 2010/08/24 16:23:20 joxe Exp $
*/
#include <io.h>
#include <signal.h>
@ -36,6 +36,7 @@
static int stopped = 0;
/*---------------------------------------------------------------------------*/
#ifdef CONTIKI_TARGET_SKY
static void
printchar(char c)
{
@ -62,16 +63,17 @@ printstring(char *s)
printchar(*s++);
}
}
#endif
/*---------------------------------------------------------------------------*/
interrupt(WDT_VECTOR)
watchdog_interrupt(void)
{
#ifdef CONTIKI_TARGET_SKY
uint8_t dummy;
static uint8_t *ptr;
static int i;
ptr = &dummy;
printstring("Watchdog reset");
/* printstring("Watchdog reset at PC $");
hexprint(ptr[3]);
@ -89,6 +91,8 @@ watchdog_interrupt(void)
}
}
printchar('\n');
#endif
watchdog_reboot();
}
/*---------------------------------------------------------------------------*/