Contiki port to the TI EXP5438 MSP430x5438a experimenters board
This commit is contained in:
parent
465c401cdc
commit
959096ca67
91
platform/exp5438/Makefile.exp5438
Normal file
91
platform/exp5438/Makefile.exp5438
Normal file
|
@ -0,0 +1,91 @@
|
|||
# $Id: Makefile.z1,v 1.4 2010/11/07 08:40:24 enricmcalvo Exp $
|
||||
# msp430flasher -n msp430x5437 -w "Firmware.txt" -v -z [VCC]
|
||||
|
||||
ifndef IAR
|
||||
GCC=1
|
||||
endif
|
||||
|
||||
ifdef GCC
|
||||
CFLAGS+=-Os -g
|
||||
else
|
||||
IAR=1
|
||||
endif
|
||||
|
||||
ifdef IAR
|
||||
CFLAGS+=-e --vla -Ohz --multiplier=32 --multiplier_location=4C0 --hw_workaround=CPU40 --core=430X --data_model small --double=32 -D__MSP430F5438A__
|
||||
CFLAGS += --diag_suppress=Pa050
|
||||
#CFLAGS+=--no_cse --no_unroll --no_inline --no_code_motion --no_tbaa --debug -D__MSP430F5438A__ -e --double=32 --dlib_config 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 6.0 Evaluation\430\LIB\DLIB\dl430xsfn.h' --core=430X --data_model=small -Ol --multiplier=32 --multiplier_location=4C0 --hw_workaround=CPU40
|
||||
endif
|
||||
|
||||
CLEAN += *.exp5438 symbols.c symbols.h
|
||||
|
||||
ARCH=msp430.c leds.c watchdog.c \
|
||||
spix.c cc2420.c cc2420-arch.c \
|
||||
rtimer-arch.c node-id.c leds-arch.c uart1x.c lcd.c \
|
||||
hal_lcd.c hal_lcd_fonts.c duty-cycle-scroller.c cfs-ram.c
|
||||
|
||||
ifeq ($(WITH_SLIP),1)
|
||||
ARCH += slip_uart0.c
|
||||
else
|
||||
ARCH += uart1-putchar.c
|
||||
endif
|
||||
|
||||
ifdef NODEID
|
||||
CFLAGS+=-DNODEID=$(NODEID)
|
||||
|
||||
ifdef BURN_NODEID
|
||||
CFLAGS+=-DBURN_NODEID
|
||||
endif # BURN_NODEID
|
||||
endif # NODEID
|
||||
|
||||
help:
|
||||
@echo A few useful make commands:
|
||||
@echo make help - shows this help
|
||||
@echo make TARGET=exp5438 savetarget - stores selection of target to avoid using TARGET= on every make invokation
|
||||
@echo make program.upload - compiles and uploads program to connected board
|
||||
@echo make program.upload GCC=1 - uses the mspgcc compiler instead of IAR
|
||||
@echo make program.upload NODEID=x - uploads with node_id set to x
|
||||
|
||||
CONTIKI_TARGET_DIRS = . dev apps net
|
||||
ifndef CONTIKI_TARGET_MAIN
|
||||
CONTIKI_TARGET_MAIN = contiki-exp5438-main.c
|
||||
endif
|
||||
|
||||
ifdef UIP_CONF_IPV6
|
||||
CFLAGS += -DWITH_UIP6=1
|
||||
endif
|
||||
|
||||
CONTIKI_TARGET_SOURCEFILES += $(ARCH) $(UIPDRIVERS)
|
||||
|
||||
ifdef IAR
|
||||
MCU=msp430x5438a
|
||||
else
|
||||
MCU=msp430x5438
|
||||
endif
|
||||
include $(CONTIKI)/cpu/msp430/Makefile.msp430
|
||||
|
||||
contiki-$(TARGET).a: ${addprefix $(OBJECTDIR)/,symbols.o}
|
||||
# $(AR) rcf $@ $^
|
||||
|
||||
|
||||
ifdef IAR
|
||||
STACKSIZE=300
|
||||
LDFLAGS_ELF=-B -xm "$(IAR_PATH)/lib/dlib/dl430xsfn.r43" -f "$(IAR_PATH)/config/lnk430f5437.xcl" -l contiki-$(TARGET).map -Felf -yn -s __program_start -D_STACK_SIZE=$(STACKSIZE) -D_DATA16_HEAP_SIZE=$(STACKSIZE) -D_DATA20_HEAP_SIZE=$(STACKSIZE)
|
||||
|
||||
LDFLAGS_HEX=-B -xm "$(IAR_PATH)/lib/dlib/dl430xsfn.r43" -f "$(IAR_PATH)/config/lnk430f5437.xcl" -l contiki-$(TARGET).map -Fintel-extended -s __program_start -D_STACK_SIZE=$(STACKSIZE) -D_DATA16_HEAP_SIZE=$(STACKSIZE) -D_DATA20_HEAP_SIZE=$(STACKSIZE)
|
||||
|
||||
LDFLAGS+=$(LDFLAGS_ELF)
|
||||
|
||||
%.hex: %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a
|
||||
$(LD) $(LDFLAGS_HEX) $(TARGET_STARTFILES) ${filter-out %.a,$^} ${filter %.a,$^} $(TARGET_LIBFILES) -o $@
|
||||
|
||||
else
|
||||
%.hex: %.ihex
|
||||
mv $< $@
|
||||
endif
|
||||
|
||||
%.upload: %.hex
|
||||
msp430flasher -n msp430x5438a -e ERASE_MAIN -w $< -v -z [VCC]
|
||||
|
||||
%.upload-clean: %.hex
|
||||
msp430flasher -n msp430x5438a -w $< -v -z [VCC]
|
66
platform/exp5438/blink.c
Normal file
66
platform/exp5438/blink.c
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* 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: blink.c,v 1.1 2008/01/23 20:34:37 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* A quick program that blinks the LEDs
|
||||
* \author
|
||||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#include "dev/leds.h"
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS(blink_process, "Blink");
|
||||
AUTOSTART_PROCESSES(&blink_process);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(blink_process, ev, data)
|
||||
{
|
||||
PROCESS_EXITHANDLER(goto exit;)
|
||||
PROCESS_BEGIN();
|
||||
|
||||
while(1) {
|
||||
static struct etimer et;
|
||||
etimer_set(&et, CLOCK_SECOND);
|
||||
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
|
||||
leds_on(LEDS_ALL);
|
||||
etimer_set(&et, CLOCK_SECOND);
|
||||
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
|
||||
leds_off(LEDS_ALL);
|
||||
}
|
||||
|
||||
exit:
|
||||
leds_off(LEDS_ALL);
|
||||
PROCESS_END();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
93
platform/exp5438/cc2420-arch.c
Normal file
93
platform/exp5438/cc2420-arch.c
Normal file
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* 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: cc2420-arch.c,v 1.9 2010/06/23 10:19:15 joxe Exp $
|
||||
*/
|
||||
|
||||
|
||||
#include "contiki.h"
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include "contiki-net.h"
|
||||
|
||||
#include "dev/spi.h"
|
||||
#include "dev/cc2420.h"
|
||||
#include "dev/leds.h"
|
||||
|
||||
#ifndef CONF_SFD_TIMESTAMPS
|
||||
#define CONF_SFD_TIMESTAMPS 0
|
||||
#endif /* CONF_SFD_TIMESTAMPS */
|
||||
|
||||
#ifdef CONF_SFD_TIMESTAMPS
|
||||
#include "cc2420-arch-sfd.h"
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=CC2420_IRQ_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(CC2420_IRQ_VECTOR)
|
||||
#endif
|
||||
cc24240_fifop_interrupt(void)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
||||
/* check TA0IV - if 4 (CCR2 => FIFOP interrupt ) */
|
||||
if(P1IV == (2 * (1 + CC2420_FIFOP_PIN))) {
|
||||
if(cc2420_interrupt()) {
|
||||
LPM4_EXIT;
|
||||
}
|
||||
}
|
||||
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
cc2420_arch_init(void)
|
||||
{
|
||||
spi_init();
|
||||
|
||||
/* all input by default, set these as output */
|
||||
CC2420_CSN_PORT(DIR) |= BV(CC2420_CSN_PIN);
|
||||
CC2420_VREG_PORT(DIR) |= BV(CC2420_VREG_PIN);
|
||||
CC2420_RESET_PORT(DIR) |= BV(CC2420_RESET_PIN);
|
||||
|
||||
#if CONF_SFD_TIMESTAMPS
|
||||
cc2420_arch_sfd_init();
|
||||
#endif
|
||||
|
||||
/* CC2420_SPI_DISABLE(); /\* Unselect radio. *\/ */
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
260
platform/exp5438/clock.c
Normal file
260
platform/exp5438/clock.c
Normal file
|
@ -0,0 +1,260 @@
|
|||
/*
|
||||
* 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: clock.c,v 1.25 2010/04/04 12:29:50 adamdunkels Exp $
|
||||
*/
|
||||
|
||||
#include "contiki-conf.h"
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include "sys/energest.h"
|
||||
#include "sys/clock.h"
|
||||
#include "sys/etimer.h"
|
||||
#include "rtimer-arch.h"
|
||||
|
||||
#include "dev/leds.h"
|
||||
|
||||
#define INTERVAL (RTIMER_ARCH_SECOND / CLOCK_SECOND)
|
||||
|
||||
#define MAX_TICKS (~((clock_time_t)0) / 2)
|
||||
|
||||
static volatile unsigned long seconds;
|
||||
|
||||
static volatile clock_time_t count = 0;
|
||||
/* last_tar is used for calculating clock_fine, last_ccr might be better? */
|
||||
static unsigned short last_tar = 0;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=TIMER1_A1_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(TIMER1_A1_VECTOR)
|
||||
#endif
|
||||
timera1 (void)
|
||||
{
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
||||
if(TA1IV == 2) {
|
||||
|
||||
/* HW timer bug fix: Interrupt handler called before TR==CCR.
|
||||
* Occurrs when timer state is toggled between STOP and CONT. */
|
||||
while(TA1CTL & MC1 && TA1CCR1 - TA1R == 1);
|
||||
|
||||
/* Make sure interrupt time is future */
|
||||
do {
|
||||
/* TACTL &= ~MC1;*/
|
||||
TA1CCR1 += INTERVAL;
|
||||
/* TACTL |= MC1;*/
|
||||
++count;
|
||||
|
||||
/* Make sure the CLOCK_CONF_SECOND is a power of two, to ensure
|
||||
that the modulo operation below becomes a logical and and not
|
||||
an expensive divide. Algorithm from Wikipedia:
|
||||
http://en.wikipedia.org/wiki/Power_of_two */
|
||||
#if (CLOCK_CONF_SECOND & (CLOCK_CONF_SECOND - 1)) != 0
|
||||
#error CLOCK_CONF_SECOND must be a power of two (i.e., 1, 2, 4, 8, 16, 32, 64, ...).
|
||||
#error Change CLOCK_CONF_SECOND in contiki-conf.h.
|
||||
#endif
|
||||
if(count % CLOCK_CONF_SECOND == 0) {
|
||||
++seconds;
|
||||
energest_flush();
|
||||
}
|
||||
} while((TA1CCR1 - TA1R) > INTERVAL);
|
||||
|
||||
last_tar = TA1R;
|
||||
|
||||
if(etimer_pending() &&
|
||||
(etimer_next_expiration_time() - count - 1) > MAX_TICKS) {
|
||||
etimer_request_poll();
|
||||
LPM4_EXIT;
|
||||
}
|
||||
|
||||
}
|
||||
/* if(process_nevents() >= 0) {
|
||||
LPM4_EXIT;
|
||||
}*/
|
||||
|
||||
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
clock_time_t
|
||||
clock_time(void)
|
||||
{
|
||||
clock_time_t t1, t2;
|
||||
do {
|
||||
t1 = count;
|
||||
t2 = count;
|
||||
} while(t1 != t2);
|
||||
return t1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
clock_set(clock_time_t clock, clock_time_t fclock)
|
||||
{
|
||||
TA1R = fclock;
|
||||
TA1CCR1 = fclock + INTERVAL;
|
||||
count = clock;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
int
|
||||
clock_fine_max(void)
|
||||
{
|
||||
return INTERVAL;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
unsigned short
|
||||
clock_fine(void)
|
||||
{
|
||||
unsigned short t;
|
||||
/* Assign last_tar to local varible that can not be changed by interrupt */
|
||||
t = last_tar;
|
||||
/* perform calc based on t, TAR will not be changed during interrupt */
|
||||
return (unsigned short) (TA1R - t);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
clock_init(void)
|
||||
{
|
||||
dint();
|
||||
|
||||
/* Select SMCLK (2.4576MHz), clear TAR */
|
||||
/* TACTL = TASSEL1 | TACLR | ID_3; */
|
||||
|
||||
/* Select ACLK 32768Hz clock, divide by 2 */
|
||||
/* TA1CTL = TASSEL0 | TACLR | ID_1; */
|
||||
|
||||
#if INTERVAL==32768/CLOCK_SECOND
|
||||
TA1CTL = TASSEL0 | TACLR;
|
||||
#elif INTERVAL==16384/CLOCK_SECOND
|
||||
TA1CTL = TASSEL0 | TACLR | ID_1;
|
||||
#else
|
||||
#error NEED TO UPDATE clock.c to match interval!
|
||||
#endif
|
||||
|
||||
/* Initialize ccr1 to create the X ms interval. */
|
||||
/* CCR1 interrupt enabled, interrupt occurs when timer equals CCR1. */
|
||||
TA1CCTL1 = CCIE;
|
||||
|
||||
/* Interrupt after X ms. */
|
||||
TA1CCR1 = INTERVAL;
|
||||
|
||||
/* Start Timer_A in continuous mode. */
|
||||
TA1CTL |= MC1;
|
||||
|
||||
count = 0;
|
||||
|
||||
/* Enable interrupts. */
|
||||
eint();
|
||||
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Delay the CPU for a multiple of 2.83 us.
|
||||
*/
|
||||
void
|
||||
clock_delay(unsigned int i)
|
||||
{
|
||||
/*
|
||||
* This means that delay(i) will delay the CPU for CONST + 3x
|
||||
* cycles. On a 2.4756 CPU, this means that each i adds 1.22us of
|
||||
* delay.
|
||||
*
|
||||
* do {
|
||||
* --i;
|
||||
* } while(i > 0);
|
||||
*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
asm("add #-1, r12");
|
||||
asm("jnz $-2");
|
||||
#else
|
||||
#ifdef __GNUC__
|
||||
asm("add #-1, r15");
|
||||
asm("jnz $-2");
|
||||
#else
|
||||
do {
|
||||
asm("nop");
|
||||
--i;
|
||||
} while(i > 0);
|
||||
#endif /* __GNUC__ */
|
||||
#endif /* __IAR_SYSTEMS_ICC__ */
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __GNUC__
|
||||
void
|
||||
__delay_cycles(int c)
|
||||
{
|
||||
c /= 4;
|
||||
asm("add #-1, r15");
|
||||
asm("jnz $-2");
|
||||
}
|
||||
#endif /* __GNUC__ */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Wait for a multiple of 10 ms.
|
||||
*
|
||||
*/
|
||||
void
|
||||
clock_wait(int i)
|
||||
{
|
||||
clock_time_t start;
|
||||
|
||||
start = clock_time();
|
||||
while(clock_time() - start < (clock_time_t)i);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
clock_set_seconds(unsigned long sec)
|
||||
{
|
||||
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
unsigned long
|
||||
clock_seconds(void)
|
||||
{
|
||||
unsigned long t1, t2;
|
||||
do {
|
||||
t1 = seconds;
|
||||
t2 = seconds;
|
||||
} while(t1 != t2);
|
||||
return t1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
rtimer_clock_t
|
||||
clock_counter(void)
|
||||
{
|
||||
return TA1R;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
217
platform/exp5438/contiki-conf.h
Normal file
217
platform/exp5438/contiki-conf.h
Normal file
|
@ -0,0 +1,217 @@
|
|||
/* -*- C -*- */
|
||||
/* @(#)$Id: contiki-conf.h,v 1.91 2011/01/09 21:04:14 adamdunkels Exp $ */
|
||||
|
||||
#ifndef CONTIKI_CONF_H
|
||||
#define CONTIKI_CONF_H
|
||||
|
||||
#ifdef PLATFORM_CONF_H
|
||||
#include PLATFORM_CONF_H
|
||||
#else
|
||||
#include "platform-conf.h"
|
||||
#endif /* PLATFORM_CONF_H */
|
||||
|
||||
#ifndef NETSTACK_CONF_MAC
|
||||
#define NETSTACK_CONF_MAC csma_driver
|
||||
#endif /* NETSTACK_CONF_MAC */
|
||||
|
||||
#ifndef NETSTACK_CONF_RDC
|
||||
#define NETSTACK_CONF_RDC contikimac_driver
|
||||
#endif /* NETSTACK_CONF_RDC */
|
||||
|
||||
#ifndef NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE
|
||||
#define NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE 8
|
||||
#endif /* NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE */
|
||||
|
||||
#ifndef NETSTACK_CONF_RADIO
|
||||
#define NETSTACK_CONF_RADIO cc2420_driver
|
||||
#endif /* NETSTACK_CONF_RADIO */
|
||||
|
||||
#ifndef NETSTACK_CONF_FRAMER
|
||||
#define NETSTACK_CONF_FRAMER framer_802154
|
||||
#endif /* NETSTACK_CONF_FRAMER */
|
||||
|
||||
#ifndef CC2420_CONF_AUTOACK
|
||||
#define CC2420_CONF_AUTOACK 1
|
||||
#endif /* CC2420_CONF_AUTOACK */
|
||||
|
||||
#define NULLRDC_CONF_802154_AUTOACK 1
|
||||
|
||||
#if WITH_UIP6
|
||||
/* Network setup for IPv6 */
|
||||
#define NETSTACK_CONF_NETWORK sicslowpan_driver
|
||||
|
||||
/* Specify a minimum packet size for 6lowpan compression to be
|
||||
enabled. This is needed for ContikiMAC, which needs packets to be
|
||||
larger than a specified size, if no ContikiMAC header should be
|
||||
used. */
|
||||
#define SICSLOWPAN_CONF_COMPRESSION_THRESHOLD 63
|
||||
#define CONTIKIMAC_CONF_WITH_CONTIKIMAC_HEADER 0
|
||||
|
||||
#define CXMAC_CONF_ANNOUNCEMENTS 0
|
||||
#define XMAC_CONF_ANNOUNCEMENTS 0
|
||||
|
||||
#ifndef QUEUEBUF_CONF_NUM
|
||||
#define QUEUEBUF_CONF_NUM 8
|
||||
#endif
|
||||
|
||||
#else /* WITH_UIP6 */
|
||||
|
||||
/* Network setup for non-IPv6 (rime). */
|
||||
|
||||
#define NETSTACK_CONF_NETWORK rime_driver
|
||||
|
||||
#define COLLECT_CONF_ANNOUNCEMENTS 1
|
||||
#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
|
||||
|
||||
#ifndef COLLECT_NEIGHBOR_CONF_MAX_COLLECT_NEIGHBORS
|
||||
#define COLLECT_NEIGHBOR_CONF_MAX_COLLECT_NEIGHBORS 32
|
||||
#endif /* COLLECT_NEIGHBOR_CONF_MAX_COLLECT_NEIGHBORS */
|
||||
|
||||
#ifndef QUEUEBUF_CONF_NUM
|
||||
#define QUEUEBUF_CONF_NUM 16
|
||||
#endif /* QUEUEBUF_CONF_NUM */
|
||||
|
||||
#ifndef TIMESYNCH_CONF_ENABLED
|
||||
#define TIMESYNCH_CONF_ENABLED 0
|
||||
#endif /* TIMESYNCH_CONF_ENABLED */
|
||||
|
||||
#if TIMESYNCH_CONF_ENABLED
|
||||
/* CC2420 SDF timestamps must be on if timesynch is enabled. */
|
||||
#undef CC2420_CONF_SFD_TIMESTAMPS
|
||||
#define CC2420_CONF_SFD_TIMESTAMPS 1
|
||||
#endif /* TIMESYNCH_CONF_ENABLED */
|
||||
|
||||
#endif /* WITH_UIP6 */
|
||||
|
||||
#define PACKETBUF_CONF_ATTRS_INLINE 1
|
||||
|
||||
#ifndef RF_CHANNEL
|
||||
#define RF_CHANNEL 26
|
||||
#endif /* RF_CHANNEL */
|
||||
|
||||
#define CONTIKIMAC_CONF_BROADCAST_RATE_LIMIT 0
|
||||
|
||||
#define IEEE802154_CONF_PANID 0xABCD
|
||||
|
||||
#define SHELL_VARS_CONF_RAM_BEGIN 0x1100
|
||||
#define SHELL_VARS_CONF_RAM_END 0x2000
|
||||
|
||||
#define PROFILE_CONF_ON 0
|
||||
#ifndef ENERGEST_CONF_ON
|
||||
#define ENERGEST_CONF_ON 1
|
||||
#endif /* ENERGEST_CONF_ON */
|
||||
|
||||
#define ELFLOADER_CONF_TEXT_IN_ROM 0
|
||||
#ifndef ELFLOADER_CONF_DATAMEMORY_SIZE
|
||||
#define ELFLOADER_CONF_DATAMEMORY_SIZE 0x400
|
||||
#endif /* ELFLOADER_CONF_DATAMEMORY_SIZE */
|
||||
#ifndef ELFLOADER_CONF_TEXTMEMORY_SIZE
|
||||
#define ELFLOADER_CONF_TEXTMEMORY_SIZE 0x800
|
||||
#endif /* ELFLOADER_CONF_TEXTMEMORY_SIZE */
|
||||
|
||||
|
||||
#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*/
|
||||
|
||||
#ifdef WITH_UIP6
|
||||
|
||||
#define RIMEADDR_CONF_SIZE 8
|
||||
|
||||
#define UIP_CONF_LL_802154 1
|
||||
#define UIP_CONF_LLH_LEN 0
|
||||
|
||||
#define UIP_CONF_ROUTER 1
|
||||
#ifndef UIP_CONF_IPV6_RPL
|
||||
#define UIP_CONF_IPV6_RPL 1
|
||||
#endif /* UIP_CONF_IPV6_RPL */
|
||||
|
||||
/* configure number of neighbors and routes */
|
||||
#ifndef UIP_CONF_DS6_NBR_NBU
|
||||
#define UIP_CONF_DS6_NBR_NBU 30
|
||||
#endif /* UIP_CONF_DS6_NBR_NBU */
|
||||
#ifndef UIP_CONF_DS6_ROUTE_NBU
|
||||
#define UIP_CONF_DS6_ROUTE_NBU 30
|
||||
#endif /* UIP_CONF_DS6_ROUTE_NBU */
|
||||
|
||||
#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
|
||||
#ifndef UIP_CONF_IPV6_QUEUE_PKT
|
||||
#define UIP_CONF_IPV6_QUEUE_PKT 0
|
||||
#endif /* UIP_CONF_IPV6_QUEUE_PKT */
|
||||
#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_NEIGHBORS 4
|
||||
#define UIP_CONF_ND6_MAX_DEFROUTERS 2
|
||||
#define UIP_CONF_IP_FORWARD 0
|
||||
#ifndef UIP_CONF_BUFFER_SIZE
|
||||
#define UIP_CONF_BUFFER_SIZE 240
|
||||
#endif
|
||||
|
||||
#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
|
||||
#ifndef SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS
|
||||
#define SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS 5
|
||||
#endif /* SICSLOWPAN_CONF_MAX_MAC_TRANSMISSIONS */
|
||||
#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
|
||||
#ifndef UIP_CONF_RECEIVE_WINDOW
|
||||
#define UIP_CONF_RECEIVE_WINDOW 48
|
||||
#endif
|
||||
#ifndef UIP_CONF_TCP_MSS
|
||||
#define UIP_CONF_TCP_MSS 48
|
||||
#endif
|
||||
#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 0
|
||||
#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
|
||||
|
||||
|
||||
|
||||
/* include the project config */
|
||||
/* PROJECT_CONF_H might be defined in the project Makefile */
|
||||
#ifdef PROJECT_CONF_H
|
||||
#include PROJECT_CONF_H
|
||||
#endif /* PROJECT_CONF_H */
|
||||
|
||||
|
||||
#endif /* CONTIKI_CONF_H */
|
348
platform/exp5438/contiki-exp5438-main.c
Normal file
348
platform/exp5438/contiki-exp5438-main.c
Normal file
|
@ -0,0 +1,348 @@
|
|||
/*
|
||||
* 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: contiki-z1-main.c,v 1.4 2010/08/26 22:08:11 nifi Exp $
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "dev/button-sensor.h"
|
||||
#include "dev/cc2420.h"
|
||||
#include "dev/flash.h"
|
||||
#include "dev/leds.h"
|
||||
#include "dev/serial-line.h"
|
||||
#include "dev/slip.h"
|
||||
#include "dev/uart1.h"
|
||||
#include "dev/watchdog.h"
|
||||
#include "dev/xmem.h"
|
||||
#include "lib/random.h"
|
||||
#include "lib/sensors.h"
|
||||
#include "net/mac/frame802154.h"
|
||||
#include "net/netstack.h"
|
||||
#include "net/rime.h"
|
||||
#include "sys/autostart.h"
|
||||
#include "sys/profile.h"
|
||||
|
||||
#include "node-id.h"
|
||||
#include "lcd.h"
|
||||
#include "duty-cycle-scroller.h"
|
||||
|
||||
#if WITH_UIP6
|
||||
#include "net/uip-ds6.h"
|
||||
#endif /* WITH_UIP6 */
|
||||
|
||||
|
||||
#define DEBUG 1
|
||||
#if DEBUG
|
||||
#include <stdio.h>
|
||||
#define PRINTF(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define PRINTF(...)
|
||||
#endif
|
||||
|
||||
//SENSORS(&button_sensor);
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifndef RF_CHANNEL
|
||||
#define RF_CHANNEL 26
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
set_rime_addr(void)
|
||||
{
|
||||
rimeaddr_t addr;
|
||||
int i;
|
||||
|
||||
memset(&addr, 0, sizeof(rimeaddr_t));
|
||||
#if UIP_CONF_IPV6
|
||||
memcpy(addr.u8, node_mac, sizeof(addr.u8));
|
||||
#else
|
||||
if(node_id == 0) {
|
||||
for(i = 0; i < sizeof(rimeaddr_t); ++i) {
|
||||
addr.u8[i] = node_mac[7 - i];
|
||||
}
|
||||
} else {
|
||||
addr.u8[0] = node_id & 0xff;
|
||||
addr.u8[1] = node_id >> 8;
|
||||
}
|
||||
#endif
|
||||
rimeaddr_set_node_addr(&addr);
|
||||
printf("Rime addr ");
|
||||
for(i = 0; i < sizeof(addr.u8) - 1; i++) {
|
||||
printf("%u.", addr.u8[i]);
|
||||
}
|
||||
printf("%u\n", addr.u8[i]);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
print_processes(struct process * const processes[])
|
||||
{
|
||||
/* const struct process * const * p = processes;*/
|
||||
printf("Starting");
|
||||
while(*processes != NULL) {
|
||||
printf(" %s", (*processes)->name);
|
||||
processes++;
|
||||
}
|
||||
putchar('\n');
|
||||
}
|
||||
/*--------------------------------------------------------------------------*/
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
/*
|
||||
* Initalize hardware.
|
||||
*/
|
||||
msp430_cpu_init();
|
||||
clock_init();
|
||||
leds_init();
|
||||
|
||||
leds_on(LEDS_RED);
|
||||
|
||||
uart1_init(BAUD2UBR(115200)); /* Must come before first printf */
|
||||
#if WITH_UIP
|
||||
slip_arch_init(BAUD2UBR(115200));
|
||||
#endif /* WITH_UIP */
|
||||
|
||||
leds_on(LEDS_GREEN);
|
||||
/* xmem_init(); */
|
||||
|
||||
rtimer_init();
|
||||
|
||||
lcd_init();
|
||||
|
||||
PRINTF(CONTIKI_VERSION_STRING "\n");
|
||||
/*
|
||||
* Hardware initialization done!
|
||||
*/
|
||||
|
||||
leds_on(LEDS_RED);
|
||||
/* Restore node id if such has been stored in external mem */
|
||||
|
||||
// node_id_restore();
|
||||
#ifdef NODEID
|
||||
node_id = NODEID;
|
||||
|
||||
#ifdef BURN_NODEID
|
||||
flash_setup();
|
||||
flash_clear(0x1800);
|
||||
flash_write(0x1800, node_id);
|
||||
flash_done();
|
||||
#endif /* BURN_NODEID */
|
||||
#endif /* NODE_ID */
|
||||
|
||||
if(node_id == 0) {
|
||||
node_id = *((unsigned short *)0x1800);
|
||||
}
|
||||
memset(node_mac, 0, sizeof(node_mac));
|
||||
node_mac[6] = node_id >> 8;
|
||||
node_mac[7] = node_id & 0xff;
|
||||
|
||||
/* for setting "hardcoded" IEEE 802.15.4 MAC addresses */
|
||||
#ifdef MAC_1
|
||||
{
|
||||
uint8_t ieee[] = { MAC_1, MAC_2, MAC_3, MAC_4, MAC_5, MAC_6, MAC_7, MAC_8 };
|
||||
memcpy(node_mac, ieee, sizeof(uip_lladdr.addr));
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize Contiki and our processes.
|
||||
*/
|
||||
process_init();
|
||||
process_start(&etimer_process, NULL);
|
||||
|
||||
ctimer_init();
|
||||
|
||||
set_rime_addr();
|
||||
|
||||
cc2420_init();
|
||||
|
||||
{
|
||||
uint8_t longaddr[8];
|
||||
uint16_t shortaddr;
|
||||
|
||||
shortaddr = (rimeaddr_node_addr.u8[0] << 8) +
|
||||
rimeaddr_node_addr.u8[1];
|
||||
memset(longaddr, 0, sizeof(longaddr));
|
||||
rimeaddr_copy((rimeaddr_t *)&longaddr, &rimeaddr_node_addr);
|
||||
printf("MAC %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
longaddr[0], longaddr[1], longaddr[2], longaddr[3],
|
||||
longaddr[4], longaddr[5], longaddr[6], longaddr[7]);
|
||||
|
||||
cc2420_set_pan_addr(IEEE802154_PANID, shortaddr, longaddr);
|
||||
}
|
||||
|
||||
cc2420_set_channel(RF_CHANNEL);
|
||||
|
||||
leds_off(LEDS_ALL);
|
||||
|
||||
if(node_id > 0) {
|
||||
PRINTF("Node id %u.\n", node_id);
|
||||
} else {
|
||||
PRINTF("Node id not set.\n");
|
||||
}
|
||||
|
||||
#if WITH_UIP6
|
||||
memcpy(&uip_lladdr.addr, node_mac, sizeof(uip_lladdr.addr));
|
||||
/* Setup nullmac-like MAC for 802.15.4 */
|
||||
|
||||
queuebuf_init();
|
||||
|
||||
NETSTACK_RDC.init();
|
||||
NETSTACK_MAC.init();
|
||||
NETSTACK_NETWORK.init();
|
||||
|
||||
printf("%s %lu %u\n",
|
||||
NETSTACK_RDC.name,
|
||||
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0 ? 1:
|
||||
NETSTACK_RDC.channel_check_interval()),
|
||||
RF_CHANNEL);
|
||||
|
||||
process_start(&tcpip_process, NULL);
|
||||
|
||||
printf("IPv6 ");
|
||||
{
|
||||
uip_ds6_addr_t *lladdr;
|
||||
int i;
|
||||
lladdr = uip_ds6_get_link_local(-1);
|
||||
for(i = 0; i < 7; ++i) {
|
||||
printf("%02x%02x:", lladdr->ipaddr.u8[i * 2],
|
||||
lladdr->ipaddr.u8[i * 2 + 1]);
|
||||
}
|
||||
printf("%02x%02x\n", lladdr->ipaddr.u8[14], lladdr->ipaddr.u8[15]);
|
||||
}
|
||||
|
||||
if(!UIP_CONF_IPV6_RPL) {
|
||||
uip_ipaddr_t ipaddr;
|
||||
int i;
|
||||
uip_ip6addr(&ipaddr, 0xaaaa, 0, 0, 0, 0, 0, 0, 0);
|
||||
uip_ds6_set_addr_iid(&ipaddr, &uip_lladdr);
|
||||
uip_ds6_addr_add(&ipaddr, 0, ADDR_TENTATIVE);
|
||||
printf("Tentative global IPv6 address ");
|
||||
for(i = 0; i < 7; ++i) {
|
||||
printf("%02x%02x:",
|
||||
ipaddr.u8[i * 2], ipaddr.u8[i * 2 + 1]);
|
||||
}
|
||||
printf("%02x%02x\n",
|
||||
ipaddr.u8[7 * 2], ipaddr.u8[7 * 2 + 1]);
|
||||
}
|
||||
|
||||
#else /* WITH_UIP6 */
|
||||
|
||||
NETSTACK_RDC.init();
|
||||
NETSTACK_MAC.init();
|
||||
NETSTACK_NETWORK.init();
|
||||
|
||||
printf("%s %lu %u\n",
|
||||
NETSTACK_RDC.name,
|
||||
CLOCK_SECOND / (NETSTACK_RDC.channel_check_interval() == 0? 1:
|
||||
NETSTACK_RDC.channel_check_interval()),
|
||||
RF_CHANNEL);
|
||||
#endif /* WITH_UIP6 */
|
||||
|
||||
#if !WITH_UIP6
|
||||
uart1_set_input(serial_line_input_byte);
|
||||
serial_line_init();
|
||||
#endif
|
||||
|
||||
#if TIMESYNCH_CONF_ENABLED
|
||||
timesynch_init();
|
||||
timesynch_set_authority_level(rimeaddr_node_addr.u8[0]);
|
||||
#endif /* TIMESYNCH_CONF_ENABLED */
|
||||
|
||||
|
||||
/* process_start(&sensors_process, NULL);
|
||||
SENSORS_ACTIVATE(button_sensor);*/
|
||||
|
||||
energest_init();
|
||||
ENERGEST_ON(ENERGEST_TYPE_CPU);
|
||||
|
||||
print_processes(autostart_processes);
|
||||
autostart_start(autostart_processes);
|
||||
|
||||
duty_cycle_scroller_start(CLOCK_SECOND * 2);
|
||||
|
||||
/*
|
||||
* This is the scheduler loop.
|
||||
*/
|
||||
watchdog_start();
|
||||
watchdog_stop(); /* Stop the wdt... */
|
||||
while(1) {
|
||||
int r;
|
||||
do {
|
||||
/* Reset watchdog. */
|
||||
watchdog_periodic();
|
||||
r = process_run();
|
||||
} while(r > 0);
|
||||
|
||||
/*
|
||||
* Idle processing.
|
||||
*/
|
||||
int s = splhigh(); /* Disable interrupts. */
|
||||
/* uart1_active is for avoiding LPM3 when still sending or receiving */
|
||||
if(process_nevents() != 0 || uart1_active()) {
|
||||
splx(s); /* Re-enable interrupts. */
|
||||
} else {
|
||||
static unsigned long irq_energest = 0;
|
||||
|
||||
/* Re-enable interrupts and go to sleep atomically. */
|
||||
ENERGEST_OFF(ENERGEST_TYPE_CPU);
|
||||
ENERGEST_ON(ENERGEST_TYPE_LPM);
|
||||
/* We only want to measure the processing done in IRQs when we
|
||||
are asleep, so we discard the processing time done when we
|
||||
were awake. */
|
||||
energest_type_set(ENERGEST_TYPE_IRQ, irq_energest);
|
||||
watchdog_stop();
|
||||
_BIS_SR(GIE | SCG0 | SCG1 | CPUOFF); /* LPM3 sleep. This
|
||||
statement will block
|
||||
until the CPU is
|
||||
woken up by an
|
||||
interrupt that sets
|
||||
the wake up flag. */
|
||||
|
||||
/* We get the current processing time for interrupts that was
|
||||
done during the LPM and store it for next time around. */
|
||||
dint();
|
||||
irq_energest = energest_type_time(ENERGEST_TYPE_IRQ);
|
||||
eint();
|
||||
watchdog_start();
|
||||
ENERGEST_OFF(ENERGEST_TYPE_LPM);
|
||||
ENERGEST_ON(ENERGEST_TYPE_CPU);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
99
platform/exp5438/duty-cycle-scroller.c
Normal file
99
platform/exp5438/duty-cycle-scroller.c
Normal file
|
@ -0,0 +1,99 @@
|
|||
h/*
|
||||
* 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.
|
||||
*
|
||||
* Author : Adam Dunkels
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#include "duty-cycle-scroller.h"
|
||||
#include "lcd.h"
|
||||
#include "sys/energest.h"
|
||||
|
||||
PROCESS(duty_cycle_scroller_process, "Duty cycle scroller");
|
||||
|
||||
static clock_time_t interval;
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
PROCESS_THREAD(duty_cycle_scroller_process, ev, data)
|
||||
{
|
||||
static struct etimer interval_timer;
|
||||
int height;
|
||||
static uint32_t last_cpu, last_lpm, last_transmit, last_listen;
|
||||
uint32_t cpu, lpm, transmit, listen;
|
||||
uint32_t all_cpu, all_lpm, all_transmit, all_listen;
|
||||
uint32_t radio, time;
|
||||
PROCESS_BEGIN();
|
||||
|
||||
while(1) {
|
||||
etimer_set(&interval_timer, interval);
|
||||
PROCESS_WAIT_UNTIL(etimer_expired(&interval_timer));
|
||||
lcd_scroll_x();
|
||||
|
||||
all_cpu = energest_type_time(ENERGEST_TYPE_CPU);
|
||||
all_lpm = energest_type_time(ENERGEST_TYPE_LPM);
|
||||
all_transmit = energest_type_time(ENERGEST_TYPE_TRANSMIT);
|
||||
all_listen = energest_type_time(ENERGEST_TYPE_LISTEN);
|
||||
|
||||
cpu = all_cpu - last_cpu;
|
||||
lpm = all_lpm - last_lpm;
|
||||
transmit = all_transmit - last_transmit;
|
||||
listen = all_listen - last_listen;
|
||||
|
||||
last_cpu = all_cpu;
|
||||
last_lpm = all_lpm;
|
||||
last_transmit = all_transmit;
|
||||
last_listen = all_listen;
|
||||
|
||||
radio = transmit + listen;
|
||||
time = cpu + lpm;
|
||||
|
||||
height = 1 + (5 + ((1000 * radio) / time)) / 10;
|
||||
if(height >= LCD_MAX_SCROLL_AREA) {
|
||||
height = LCD_MAX_SCROLL_AREA;
|
||||
}
|
||||
lcd_draw_vertical_line(height);
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
duty_cycle_scroller_start(clock_time_t i)
|
||||
{
|
||||
interval = i;
|
||||
process_start(&duty_cycle_scroller_process, NULL);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
duty_cycle_scroller_stop(void)
|
||||
{
|
||||
process_exit(&duty_cycle_scroller_process);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
42
platform/exp5438/duty-cycle-scroller.h
Normal file
42
platform/exp5438/duty-cycle-scroller.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* 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.
|
||||
*
|
||||
* Author : Adam Dunkels
|
||||
*/
|
||||
|
||||
#ifndef DUTY_CYCLE_SCROLLER_H
|
||||
#define DUTY_CYCLE_SCROLLER_H
|
||||
|
||||
#include "sys/clock.h"
|
||||
|
||||
void duty_cycle_scroller_start(clock_time_t interval);
|
||||
void duty_cycle_scroller_stop(void);
|
||||
|
||||
#endif /* DUTY_CYCLE_SCROLLER_H */
|
154
platform/exp5438/flash.c
Normal file
154
platform/exp5438/flash.c
Normal file
|
@ -0,0 +1,154 @@
|
|||
/**
|
||||
* \file
|
||||
* Functions for reading and writing flash ROM.
|
||||
* \author Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
/* Copyright (c) 2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: flash.c,v 1.3 2010/11/15 21:52:54 adamdunkels Exp $
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "dev/flash.h"
|
||||
#include "dev/watchdog.h"
|
||||
|
||||
#define FLASH_TIMEOUT 30
|
||||
#define FLASH_REQ_TIMEOUT 150
|
||||
|
||||
#define INFOMEM_LO (unsigned short *)0x1800
|
||||
#define INFOMEM_HI (unsigned short *)0x1a00
|
||||
|
||||
static uint16_t sfrie;
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
flash_setup(void)
|
||||
{
|
||||
/* disable all interrupts to protect CPU
|
||||
during programming from system crash */
|
||||
dint();
|
||||
|
||||
/* Clear interrupt flag1. */
|
||||
SFRIFG1 = 0;
|
||||
/* The IFG1 = 0; statement locks up contikimac - not sure if this
|
||||
statement needs to be here at all. I've removed it for now, since
|
||||
it seems to work, but leave this little note here in case someone
|
||||
stumbles over this code at some point. */
|
||||
|
||||
/* Stop watchdog. */
|
||||
watchdog_stop();
|
||||
|
||||
/* disable all NMI-Interrupt sources */
|
||||
sfrie = SFRIE1;
|
||||
SFRIE1 = 0x00;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
flash_done(void)
|
||||
{
|
||||
/* Enable interrupts. */
|
||||
SFRIE1 = sfrie;
|
||||
eint();
|
||||
watchdog_start();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
unlock_infomem(void)
|
||||
{
|
||||
FCTL4 = 0xa500;
|
||||
FCTL3 = 0xa540;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
lock_infomem(void)
|
||||
{
|
||||
FCTL3 = 0xa540;
|
||||
FCTL4 = 0xa580;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
flash_clear(unsigned short *ptr)
|
||||
{
|
||||
uint8_t r;
|
||||
|
||||
/* If ptr is in infomem, we need to unlock it first. */
|
||||
if(ptr >= INFOMEM_LO && ptr <= INFOMEM_HI) {
|
||||
unlock_infomem();
|
||||
}
|
||||
|
||||
FCTL3 = 0xa500; /* Lock = 0 */
|
||||
while(FCTL3 & 0x0001) {
|
||||
r++; /* Wait for BUSY = 0, not needed
|
||||
unless run from RAM */
|
||||
}
|
||||
FCTL1 = 0xa502; /* ERASE = 1 */
|
||||
*ptr = 0; /* erase Flash segment */
|
||||
FCTL1 = 0xa500; /* ERASE = 0 automatically done?! */
|
||||
FCTL3 = 0xa510; /* Lock = 1 */
|
||||
|
||||
if(ptr >= INFOMEM_LO && ptr <= INFOMEM_HI) {
|
||||
lock_infomem();
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
flash_write(unsigned short *ptr, unsigned short word)
|
||||
{
|
||||
uint8_t r;
|
||||
|
||||
/* If ptr is in infomem, we need to unlock it first. */
|
||||
if(ptr >= INFOMEM_LO && ptr <= INFOMEM_HI) {
|
||||
unlock_infomem();
|
||||
}
|
||||
|
||||
FCTL3 = 0xa500; /* Lock = 0 */
|
||||
while(FCTL3 & 0x0001) {
|
||||
r++; /* Wait for BUSY = 0, not needed unless
|
||||
run from RAM */
|
||||
}
|
||||
FCTL1 = 0xa540; /* WRT = 1 */
|
||||
*ptr = word; /* program Flash word */
|
||||
FCTL1 = 0xa500; /* WRT = 0 */
|
||||
FCTL3 = 0xa510; /* Lock = 1 */
|
||||
|
||||
if(ptr >= INFOMEM_LO && ptr <= INFOMEM_HI) {
|
||||
lock_infomem();
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
15
platform/exp5438/hal_MSP-EXP430F5438.h
Normal file
15
platform/exp5438/hal_MSP-EXP430F5438.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
/*******************************************************************************
|
||||
Filename: hal_MSP-EXP430F5438.h
|
||||
|
||||
Copyright 2008 Texas Instruments, Inc.
|
||||
|
||||
This is the master header file and also the only necessary file to be included
|
||||
in order to use MSP-EXP430F548 HAL.
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef HAL_MSP_EXP430F5438_H
|
||||
#define HAL_MSP_EXP430F5438_H
|
||||
|
||||
#include "hal_lcd.h"
|
||||
|
||||
#endif
|
1198
platform/exp5438/hal_lcd.c
Normal file
1198
platform/exp5438/hal_lcd.c
Normal file
File diff suppressed because it is too large
Load diff
159
platform/exp5438/hal_lcd.h
Normal file
159
platform/exp5438/hal_lcd.h
Normal file
|
@ -0,0 +1,159 @@
|
|||
/*******************************************************************************
|
||||
*
|
||||
* hal_lcd.h
|
||||
*
|
||||
* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated 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 COPYRIGHT HOLDERS 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 COPYRIGHT
|
||||
* OWNER 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 HAL_LCD_H
|
||||
#define HAL_LCD_H
|
||||
|
||||
#ifndef MIN
|
||||
# define MIN(n, m) (((n) < (m)) ? (n) : (m))
|
||||
#endif
|
||||
|
||||
#ifndef MAX
|
||||
# define MAX(n, m) (((n) < (m)) ? (m) : (n))
|
||||
#endif
|
||||
|
||||
#ifndef ABS
|
||||
# define ABS(n) (((n) < 0) ? -(n) : (n))
|
||||
#endif
|
||||
|
||||
#define LCD_BACKLT_OUT P8OUT
|
||||
#define LCD_BACKLT_DIR P8DIR
|
||||
#define LCD_BACKLT_SEL P8SEL
|
||||
#define LCD_BACKLIGHT_PIN BIT3
|
||||
#define LCD_CS_RST_DIR P9DIR
|
||||
#define LCD_CS_RST_OUT P9OUT
|
||||
#define LCD_CS_PIN BIT6
|
||||
#define LCD_RESET_PIN BIT7
|
||||
#define LCD_SPI_SEL P9SEL
|
||||
#define LCD_SPI_DIR P9DIR
|
||||
#define LCD_MOSI_PIN BIT1
|
||||
#define LCD_MISO_PIN BIT2
|
||||
#define LCD_CLK_PIN BIT3
|
||||
|
||||
#define LCD_ROW 110
|
||||
#define LCD_COL 138
|
||||
#define LCD_Size 3505
|
||||
#define LCD_MEM_Size 110 * 17
|
||||
#define LCD_Max_Column_Offset 0x10
|
||||
|
||||
#define LCD_Last_Pixel 3505
|
||||
|
||||
#define LCD_MEM_Row 0x11
|
||||
#define LCD_Row 0x20
|
||||
|
||||
// Grayscale level definitions
|
||||
#define PIXEL_OFF 0
|
||||
#define PIXEL_LIGHT 1
|
||||
#define PIXEL_DARK 2
|
||||
#define PIXEL_ON 3
|
||||
|
||||
#define INVERT_TEXT BIT0
|
||||
#define OVERWRITE_TEXT BIT2
|
||||
#define GRAYSCALE_TEXT BIT1
|
||||
|
||||
/*-------------------------------------------------------------
|
||||
* Function Prototypes
|
||||
* ------------------------------------------------------------*/
|
||||
extern void halLcdInit(void);
|
||||
extern void halLcdShutDown(void);
|
||||
extern void halLcdBackLightInit(void);
|
||||
extern void halLcdSetBackLight(unsigned char BackLightLevel);
|
||||
extern unsigned int halLcdGetBackLight(void);
|
||||
extern void halLcdShutDownBackLight(void);
|
||||
|
||||
extern void halLcdSendCommand(unsigned char Data[]);
|
||||
extern void halLcdSetContrast(unsigned char ContrastLevel);
|
||||
extern unsigned char halLcdGetContrast(void);
|
||||
extern void halLcdStandby(void);
|
||||
extern void halLcdActive(void);
|
||||
|
||||
//Move to specified LCD address
|
||||
extern void halLcdSetAddress(int Address);
|
||||
|
||||
//Draw at current segment location
|
||||
extern void halLcdDrawCurrentBlock(unsigned int Value);
|
||||
extern void halLcdDrawCurrentLine(const unsigned int *value, int length);
|
||||
|
||||
//Draw at specified location by calling
|
||||
//LCD_Set_Address(Address) & LCD_Draw_Current_Block( value )
|
||||
extern void halLcdDrawBlock(unsigned int Address, unsigned int Value);
|
||||
|
||||
//Read value from LCD CGRAM
|
||||
extern int halLcdReadBlock(unsigned int Address);
|
||||
|
||||
//Clear LCD Screen
|
||||
extern void halLcdClearScreen(void);
|
||||
|
||||
//Invert black to white and vice versa
|
||||
extern void halLcdReverse(void);
|
||||
|
||||
// Draw a Pixel @ (x,y) with GrayScale level
|
||||
extern void halLcdPixel(int x, int y, unsigned char GrayScale);
|
||||
|
||||
//Draw Line from (x1,y1) to (x2,y2) with GrayScale level
|
||||
extern void halLcdLine(int x1, int y1, int x2, int y2, unsigned char GrayScale);
|
||||
extern void halLcdHLine(int x1, int x2, int y, unsigned char GrayScale);
|
||||
extern void halLcdVLine(int x1, int x2, int y, unsigned char GrayScale);
|
||||
|
||||
extern void halLcdCircle(int x, int y, int Radius, int GrayScale);
|
||||
|
||||
extern void halLcdImage(const unsigned int Image[], int Columns, int Rows, int x, int y);
|
||||
extern void halLcdClearImage(int Columns, int Rows, int x, int y);
|
||||
|
||||
//Print String of Length starting at current LCD location
|
||||
extern void halLcdPrint(char String[], unsigned char TextStyle);
|
||||
|
||||
//Print String of Length starting at (x,y)
|
||||
extern void halLcdPrintXY(char String[], int x, int y, unsigned char TextStyle);
|
||||
|
||||
//Print String of Length starting at (x,y)
|
||||
extern void halLcdPrintLine(char String[], unsigned char Line, unsigned char TextStyle);
|
||||
extern void halLcdPrintLineCol(char String[], unsigned char Line, unsigned char Col,
|
||||
unsigned char TextStyle);
|
||||
|
||||
extern void halLcdCursor(void);
|
||||
extern void halLcdCursorOff(void);
|
||||
|
||||
//Scroll a single row of pixels
|
||||
extern void halLcdScrollRow(int y);
|
||||
|
||||
//Scroll a number of consecutive rows from yStart to yEnd
|
||||
extern void halLcdHScroll(int yStart, int yEnd);
|
||||
|
||||
//Scroll a line of text
|
||||
extern void halLcdScrollLine(int Line);
|
||||
|
||||
#endif /* HAL_LCD_H */
|
353
platform/exp5438/hal_lcd_fonts.c
Normal file
353
platform/exp5438/hal_lcd_fonts.c
Normal file
|
@ -0,0 +1,353 @@
|
|||
/*******************************************************************************
|
||||
*
|
||||
* hal_lcd_fonts.c
|
||||
*
|
||||
* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated 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 COPYRIGHT HOLDERS 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 COPYRIGHT
|
||||
* OWNER 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.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
const unsigned char fonts_lookup[] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
64, 65, 0, 69, 0, 68, 67, 0, 0, 1, //'0' = 48 = 0x30
|
||||
2, 3, 4, 5, 6, 7, 8, 9, 66, 0, //'9' = 57 = 0x39
|
||||
0, 70, 0, 62, 0, 10, 11, 12, 13, 14, //'A' --> 'Z'
|
||||
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
|
||||
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
|
||||
35, 0, 0, 0, 71, 0, 0, 36, 37, 38, //'a' = 97
|
||||
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
|
||||
49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
|
||||
59, 60, 61, 62, 0, 0, 0, 72, 73, 74,
|
||||
75, 76, 77, 78, 79, 80, 81 //'z' = 122
|
||||
};
|
||||
|
||||
const unsigned int fonts[] = {
|
||||
0x0000, 0x0ffc, 0x3c0f, 0x3f0f, 0x3fcf, 0x3ccf, 0x3cff, 0x3c3f,
|
||||
0x3c0f, 0x0ffc, 0x0000, 0x0000, 0x0000, 0x0000, 0x00c0, 0x00f0,
|
||||
0x00ff, 0x00f0, 0x00f0, 0x00f0, 0x00f0, 0x00f0, 0x0fff, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f00, 0x03c0,
|
||||
0x00f0, 0x003c, 0x0f0f, 0x0fff, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x03fc, 0x0f0f, 0x0f00, 0x0f00, 0x03f0, 0x0f00, 0x0f00, 0x0f0f,
|
||||
0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f00, 0x0fc0, 0x0ff0,
|
||||
0x0f3c, 0x0f0f, 0x3fff, 0x0f00, 0x0f00, 0x3fc0, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0fff, 0x000f, 0x000f, 0x000f, 0x03ff, 0x0f00,
|
||||
0x0f00, 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0,
|
||||
0x003c, 0x000f, 0x000f, 0x03ff, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x3fff, 0x3c0f, 0x3c0f, 0x3c00,
|
||||
0x0f00, 0x03c0, 0x00f0, 0x00f0, 0x00f0, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f3f, 0x03fc, 0x0fcf, 0x0f0f,
|
||||
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f,
|
||||
0x0f0f, 0x0f0f, 0x0ffc, 0x03c0, 0x03c0, 0x00f0, 0x00fc, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x00f0, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f,
|
||||
0x0fff, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0fff, 0x3c3c, 0x3c3c, 0x3c3c, 0x0ffc, 0x3c3c, 0x3c3c, 0x3c3c,
|
||||
0x0fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0ff0, 0x3c3c, 0x3c0f,
|
||||
0x000f, 0x000f, 0x000f, 0x3c0f, 0x3c3c, 0x0ff0, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x03ff, 0x0f3c, 0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c,
|
||||
0x3c3c, 0x0f3c, 0x03ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x3fff,
|
||||
0x303c, 0x003c, 0x0c3c, 0x0ffc, 0x0c3c, 0x003c, 0x303c, 0x3fff,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x3fff, 0x3c3c, 0x303c, 0x0c3c,
|
||||
0x0ffc, 0x0c3c, 0x003c, 0x003c, 0x00ff, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0ff0, 0x3c3c, 0x3c0f, 0x000f, 0x000f, 0x3f0f, 0x3c0f,
|
||||
0x3c3c, 0x3ff0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f,
|
||||
0x0f0f, 0x0f0f, 0x0fff, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x03fc, 0x00f0, 0x00f0, 0x00f0, 0x00f0,
|
||||
0x00f0, 0x00f0, 0x00f0, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x3fc0, 0x0f00, 0x0f00, 0x0f00, 0x0f00, 0x0f0f, 0x0f0f, 0x0f0f,
|
||||
0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c3f, 0x3c3c, 0x0f3c,
|
||||
0x0f3c, 0x03fc, 0x0f3c, 0x0f3c, 0x3c3c, 0x3c3f, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x00ff, 0x003c, 0x003c, 0x003c, 0x003c, 0x303c,
|
||||
0x3c3c, 0x3c3c, 0x3fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c0f,
|
||||
0x3f3f, 0x3fff, 0x3fff, 0x3ccf, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x3c0f, 0x3c0f, 0x3c3f, 0x3cff,
|
||||
0x3fff, 0x3fcf, 0x3f0f, 0x3c0f, 0x3c0f, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x03f0, 0x0f3c, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f,
|
||||
0x0f3c, 0x03f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x3c3c,
|
||||
0x3c3c, 0x3c3c, 0x0ffc, 0x003c, 0x003c, 0x003c, 0x00ff, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x03f0, 0x0f3c, 0x3c0f, 0x3c0f, 0x3c0f,
|
||||
0x3f0f, 0x3fcf, 0x0ffc, 0x0f00, 0x3fc0, 0x0000, 0x0000, 0x0000,
|
||||
0x0fff, 0x3c3c, 0x3c3c, 0x3c3c, 0x0ffc, 0x0f3c, 0x3c3c, 0x3c3c,
|
||||
0x3c3f, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0f0f,
|
||||
0x000f, 0x00fc, 0x03c0, 0x0f0f, 0x0f0f, 0x03fc, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0fff, 0x0cf3, 0x00f0, 0x00f0, 0x00f0, 0x00f0,
|
||||
0x00f0, 0x00f0, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f,
|
||||
0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f,
|
||||
0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, 0x00f0, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x3c0f, 0x3c0f, 0x3c0f, 0x3c0f, 0x3ccf, 0x3ccf, 0x0f3c,
|
||||
0x0f3c, 0x0f3c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f,
|
||||
0x0f0f, 0x03fc, 0x00f0, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc,
|
||||
0x00f0, 0x00f0, 0x00f0, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x3fff, 0x3f0f, 0x03c3, 0x03c0, 0x00f0, 0x003c, 0x303c, 0x3c0f,
|
||||
0x3fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x03fc, 0x0f00, 0x0ffc, 0x0f0f, 0x0f0f, 0x3cfc, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x003f, 0x003c, 0x003c, 0x0ffc, 0x3c3c, 0x3c3c,
|
||||
0x3c3c, 0x3c3c, 0x0fcf, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x03fc, 0x0f0f, 0x000f, 0x000f, 0x0f0f, 0x03fc,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0fc0, 0x0f00, 0x0f00, 0x0ffc,
|
||||
0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x3cfc, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0fff, 0x000f,
|
||||
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0, 0x0f3c,
|
||||
0x003c, 0x003c, 0x03ff, 0x003c, 0x003c, 0x003c, 0x00ff, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3cfc, 0x0f0f,
|
||||
0x0f0f, 0x0f0f, 0x0ffc, 0x0f00, 0x0f0f, 0x03fc, 0x0000, 0x0000,
|
||||
0x003f, 0x003c, 0x003c, 0x0f3c, 0x3cfc, 0x3c3c, 0x3c3c, 0x3c3c,
|
||||
0x3c3f, 0x0000, 0x0000, 0x0000, 0x0000, 0x03c0, 0x03c0, 0x0000,
|
||||
0x03fc, 0x03c0, 0x03c0, 0x03c0, 0x03c0, 0x3ffc, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0f00, 0x0f00, 0x0000, 0x0ff0, 0x0f00, 0x0f00,
|
||||
0x0f00, 0x0f00, 0x0f0f, 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x003f,
|
||||
0x003c, 0x003c, 0x3c3c, 0x0f3c, 0x03fc, 0x0f3c, 0x3c3c, 0x3c3f,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x03c0, 0x03c0, 0x03c0,
|
||||
0x03c0, 0x03c0, 0x03c0, 0x03c0, 0x3ffc, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x3ccf, 0x3ccf, 0x3ccf,
|
||||
0x3ccf, 0x3c0f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x03ff, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f,
|
||||
0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0fcf, 0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c,
|
||||
0x0ffc, 0x003c, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x3cfc, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x0ffc, 0x0f00, 0x3fc0,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0f3f, 0x3f3c, 0x3cfc,
|
||||
0x003c, 0x003c, 0x00ff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x03fc, 0x0f0f, 0x003c, 0x03c0, 0x0f0f, 0x03fc,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0030, 0x003c, 0x0fff,
|
||||
0x003c, 0x003c, 0x003c, 0x0f3c, 0x03f0, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f,
|
||||
0x0f0f, 0x3cfc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0f0f, 0x0f0f, 0x0f0f, 0x0f0f, 0x03fc, 0x00f0, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x3c0f, 0x3c0f,
|
||||
0x3ccf, 0x3ccf, 0x0f3c, 0x0f3c, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x3c0f, 0x0f3c, 0x03f0, 0x03f0, 0x0f3c,
|
||||
0x3c0f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x3c3c, 0x3c3c, 0x3c3c, 0x3c3c, 0x0ff0, 0x0f00, 0x03c0, 0x00ff,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0fff, 0x0f03, 0x03c0,
|
||||
0x003c, 0x0c0f, 0x0fff, 0x0000, 0x0000, 0x0000, 0x0000, 0x03fc,
|
||||
0x0f0f, 0x0f00, 0x03c0, 0x00f0, 0x00f0, 0x0000, 0x00f0, 0x00f0,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0f00, 0x03c0, 0x00f0, 0x003c, 0x003c, 0x003c, 0x00f0,
|
||||
0x03c0, 0x0f00, 0x0000, 0x0000, 0x0000, 0x0000, 0x003c, 0x00f0,
|
||||
0x03c0, 0x0f00, 0x0f00, 0x0f00, 0x03c0, 0x00f0, 0x003c, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0, 0x03f0, 0x0000,
|
||||
0x0000, 0x03f0, 0x03f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x03f0,
|
||||
0x03f0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x3ffc, 0x3ffc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x03c0, 0x03c0, 0x3ffc, 0x3ffc,
|
||||
0x03c0, 0x03c0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x3ffc, 0x0000, 0x0000, 0x3ffc, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f,
|
||||
0x03fc, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
//0---------------------------
|
||||
0x0000, 0x0ffc, 0x3c0f, 0x3f0f, 0x3fcf, 0x3ccf, 0x3cff, 0x3c3f,
|
||||
0x3c0f, 0x0ffc, 0x0000, 0x0000, 0x0000,
|
||||
//1---------------------------
|
||||
0x0000, 0x00c0, 0x00f0, 0x00ff, 0x00f0, 0x00f0, 0x00f0, 0x00f0,
|
||||
0x00f0, 0x0fff, 0x0000, 0x0000, 0x0000,
|
||||
//2---------------------------
|
||||
0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f00, 0x03c0, 0x00f0, 0x003c,
|
||||
0x0f0f, 0x0fff, 0x0000, 0x0000, 0x0000,
|
||||
//3---------------------------
|
||||
0x0000, 0x03fc, 0x0f0f, 0x0f00, 0x0f00, 0x03f0, 0x0f00, 0x0f00,
|
||||
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000,
|
||||
//4---------------------------
|
||||
0x0000, 0x0f00, 0x0fc0, 0x0ff0, 0x0f3c, 0x0f0f, 0x3fff, 0x0f00,
|
||||
0x0f00, 0x3fc0, 0x0000, 0x0000, 0x0000,
|
||||
//5---------------------------
|
||||
0x0000, 0x0fff, 0x000f, 0x000f, 0x000f, 0x03ff, 0x0f00, 0x0f00,
|
||||
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000,
|
||||
//6---------------------------
|
||||
0x0000, 0x03f0, 0x003c, 0x000f, 0x000f, 0x03ff, 0x0f0f, 0x0f0f,
|
||||
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000,
|
||||
//7---------------------------
|
||||
0x0000, 0x3fff, 0x3c0f, 0x3c0f, 0x3c00, 0x0f00, 0x03c0, 0x00f0,
|
||||
0x00f0, 0x00f0, 0x0000, 0x0000, 0x0000,
|
||||
//8---------------------------
|
||||
0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f3f, 0x03fc, 0x0fcf, 0x0f0f,
|
||||
0x0f0f, 0x03fc, 0x0000, 0x0000, 0x0000,
|
||||
//9---------------------------
|
||||
0x0000, 0x03fc, 0x0f0f, 0x0f0f, 0x0f0f, 0x0ffc, 0x03c0, 0x03c0,
|
||||
0x00f0, 0x00fc, 0x0000, 0x0000, 0x0000,
|
||||
};
|
||||
|
||||
|
||||
const unsigned int GrayScale_fonts[] = {
|
||||
0x0000, 0x0aa8, 0x280a, 0x2a0a, 0x2a8a, 0x288a, 0x28aa, 0x282a,
|
||||
0x280a, 0x0aa8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0080, 0x00a0,
|
||||
0x00aa, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x00a0, 0x0aaa, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a00, 0x0280,
|
||||
0x00a0, 0x0028, 0x0a0a, 0x0aaa, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x02a8, 0x0a0a, 0x0a00, 0x0a00, 0x02a0, 0x0a00, 0x0a00, 0x0a0a,
|
||||
0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a00, 0x0a80, 0x0aa0,
|
||||
0x0a28, 0x0a0a, 0x2aaa, 0x0a00, 0x0a00, 0x2a80, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0aaa, 0x000a, 0x000a, 0x000a, 0x02aa, 0x0a00,
|
||||
0x0a00, 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0,
|
||||
0x0028, 0x000a, 0x000a, 0x02aa, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x2aaa, 0x280a, 0x280a, 0x2800,
|
||||
0x0a00, 0x0280, 0x00a0, 0x00a0, 0x00a0, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a2a, 0x02a8, 0x0a8a, 0x0a0a,
|
||||
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a,
|
||||
0x0a0a, 0x0a0a, 0x0aa8, 0x0280, 0x0280, 0x00a0, 0x00a8, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x00a0, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a,
|
||||
0x0aaa, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0aaa, 0x2828, 0x2828, 0x2828, 0x0aa8, 0x2828, 0x2828, 0x2828,
|
||||
0x0aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0aa0, 0x2828, 0x280a,
|
||||
0x000a, 0x000a, 0x000a, 0x280a, 0x2828, 0x0aa0, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x02aa, 0x0a28, 0x2828, 0x2828, 0x2828, 0x2828,
|
||||
0x2828, 0x0a28, 0x02aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x2aaa,
|
||||
0x2028, 0x0028, 0x0828, 0x0aa8, 0x0828, 0x0028, 0x2028, 0x2aaa,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x2aaa, 0x2828, 0x2028, 0x0828,
|
||||
0x0aa8, 0x0828, 0x0028, 0x0028, 0x00aa, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0aa0, 0x2828, 0x280a, 0x000a, 0x000a, 0x2a0a, 0x280a,
|
||||
0x2828, 0x2aa0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a,
|
||||
0x0a0a, 0x0a0a, 0x0aaa, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x02a8, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
|
||||
0x00a0, 0x00a0, 0x00a0, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x2a80, 0x0a00, 0x0a00, 0x0a00, 0x0a00, 0x0a0a, 0x0a0a, 0x0a0a,
|
||||
0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x282a, 0x2828, 0x0a28,
|
||||
0x0a28, 0x02a8, 0x0a28, 0x0a28, 0x2828, 0x282a, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x00aa, 0x0028, 0x0028, 0x0028, 0x0028, 0x2028,
|
||||
0x2828, 0x2828, 0x2aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x280a,
|
||||
0x2a2a, 0x2aaa, 0x2aaa, 0x288a, 0x280a, 0x280a, 0x280a, 0x280a,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x280a, 0x280a, 0x282a, 0x28aa,
|
||||
0x2aaa, 0x2a8a, 0x2a0a, 0x280a, 0x280a, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x02a0, 0x0a28, 0x280a, 0x280a, 0x280a, 0x280a, 0x280a,
|
||||
0x0a28, 0x02a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0aaa, 0x2828,
|
||||
0x2828, 0x2828, 0x0aa8, 0x0028, 0x0028, 0x0028, 0x00aa, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x02a0, 0x0a28, 0x280a, 0x280a, 0x280a,
|
||||
0x2a0a, 0x2a8a, 0x0aa8, 0x0a00, 0x2a80, 0x0000, 0x0000, 0x0000,
|
||||
0x0aaa, 0x2828, 0x2828, 0x2828, 0x0aa8, 0x0a28, 0x2828, 0x2828,
|
||||
0x282a, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0a0a,
|
||||
0x000a, 0x00a8, 0x0280, 0x0a0a, 0x0a0a, 0x02a8, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0aaa, 0x08a2, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
|
||||
0x00a0, 0x00a0, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a,
|
||||
0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a,
|
||||
0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, 0x00a0, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x280a, 0x280a, 0x280a, 0x280a, 0x288a, 0x288a, 0x0a28,
|
||||
0x0a28, 0x0a28, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a,
|
||||
0x0a0a, 0x02a8, 0x00a0, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8,
|
||||
0x00a0, 0x00a0, 0x00a0, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x2aaa, 0x2a0a, 0x0282, 0x0280, 0x00a0, 0x0028, 0x2028, 0x280a,
|
||||
0x2aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x02a8, 0x0a00, 0x0aa8, 0x0a0a, 0x0a0a, 0x28a8, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x002a, 0x0028, 0x0028, 0x0aa8, 0x2828, 0x2828,
|
||||
0x2828, 0x2828, 0x0a8a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x02a8, 0x0a0a, 0x000a, 0x000a, 0x0a0a, 0x02a8,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0a80, 0x0a00, 0x0a00, 0x0aa8,
|
||||
0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x28a8, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0aaa, 0x000a,
|
||||
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0, 0x0a28,
|
||||
0x0028, 0x0028, 0x02aa, 0x0028, 0x0028, 0x0028, 0x00aa, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x28a8, 0x0a0a,
|
||||
0x0a0a, 0x0a0a, 0x0aa8, 0x0a00, 0x0a0a, 0x02a8, 0x0000, 0x0000,
|
||||
0x002a, 0x0028, 0x0028, 0x0a28, 0x28a8, 0x2828, 0x2828, 0x2828,
|
||||
0x282a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0280, 0x0280, 0x0000,
|
||||
0x02a8, 0x0280, 0x0280, 0x0280, 0x0280, 0x2aa8, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0a00, 0x0a00, 0x0000, 0x0aa0, 0x0a00, 0x0a00,
|
||||
0x0a00, 0x0a00, 0x0a0a, 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x002a,
|
||||
0x0028, 0x0028, 0x2828, 0x0a28, 0x02a8, 0x0a28, 0x2828, 0x282a,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0280, 0x0280, 0x0280,
|
||||
0x0280, 0x0280, 0x0280, 0x0280, 0x2aa8, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0aaa, 0x288a, 0x288a, 0x288a,
|
||||
0x288a, 0x280a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x02aa, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a,
|
||||
0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0a8a, 0x2828, 0x2828, 0x2828, 0x2828,
|
||||
0x0aa8, 0x0028, 0x00aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x28a8, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x0aa8, 0x0a00, 0x2a80,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0a2a, 0x2a28, 0x28a8,
|
||||
0x0028, 0x0028, 0x00aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0028, 0x0280, 0x0a0a, 0x02a8,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0020, 0x0028, 0x0aaa,
|
||||
0x0028, 0x0028, 0x0028, 0x0a28, 0x02a0, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a,
|
||||
0x0a0a, 0x28a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0a0a, 0x0a0a, 0x0a0a, 0x0a0a, 0x02a8, 0x00a0, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x280a, 0x280a,
|
||||
0x288a, 0x288a, 0x0a28, 0x0a28, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x280a, 0x0a28, 0x02a0, 0x02a0, 0x0a28,
|
||||
0x280a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x2828, 0x2828, 0x2828, 0x2828, 0x0aa0, 0x0a00, 0x0280, 0x00aa,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0aaa, 0x0a02, 0x0280,
|
||||
0x0028, 0x080a, 0x0aaa, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a8,
|
||||
0x0a0a, 0x0a00, 0x0280, 0x00a0, 0x00a0, 0x0000, 0x00a0, 0x00a0,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0a00, 0x0280, 0x00a0, 0x0028, 0x0028, 0x0028, 0x00a0,
|
||||
0x0280, 0x0a00, 0x0000, 0x0000, 0x0000, 0x0000, 0x0028, 0x00a0,
|
||||
0x0280, 0x0a00, 0x0a00, 0x0a00, 0x0280, 0x00a0, 0x0028, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0, 0x02a0, 0x0000,
|
||||
0x0000, 0x02a0, 0x02a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x02a0,
|
||||
0x02a0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x2aa8, 0x2aa8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x0280, 0x0280, 0x2aa8, 0x2aa8,
|
||||
0x0280, 0x0280, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x2aa8, 0x0000, 0x0000, 0x2aa8, 0x0000, 0x0000,
|
||||
0x0000, 0x0000, 0x0000, 0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a,
|
||||
0x02a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
//0---------------------------
|
||||
0x0000, 0x0aa8, 0x280a, 0x2a0a, 0x2a8a, 0x288a, 0x28aa, 0x282a,
|
||||
0x280a, 0x0aa8, 0x0000, 0x0000, 0x0000,
|
||||
//1---------------------------
|
||||
0x0000, 0x0080, 0x00a0, 0x00aa, 0x00a0, 0x00a0, 0x00a0, 0x00a0,
|
||||
0x00a0, 0x0aaa, 0x0000, 0x0000, 0x0000,
|
||||
//2---------------------------
|
||||
0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a00, 0x0280, 0x00a0, 0x0028,
|
||||
0x0a0a, 0x0aaa, 0x0000, 0x0000, 0x0000,
|
||||
//2---------------------------
|
||||
0x0000, 0x02a8, 0x0a0a, 0x0a00, 0x0a00, 0x02a0, 0x0a00, 0x0a00,
|
||||
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000,
|
||||
//4---------------------------
|
||||
0x0000, 0x0a00, 0x0a80, 0x0aa0, 0x0a28, 0x0a0a, 0x2aaa, 0x0a00,
|
||||
0x0a00, 0x2a80, 0x0000, 0x0000, 0x0000,
|
||||
//5---------------------------
|
||||
0x0000, 0x0aaa, 0x000a, 0x000a, 0x000a, 0x02aa, 0x0a00, 0x0a00,
|
||||
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000,
|
||||
//6---------------------------
|
||||
0x0000, 0x02a0, 0x0028, 0x000a, 0x000a, 0x02aa, 0x0a0a, 0x0a0a,
|
||||
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000,
|
||||
//7---------------------------
|
||||
0x0000, 0x2aaa, 0x280a, 0x280a, 0x2800, 0x0a00, 0x0280, 0x00a0,
|
||||
0x00a0, 0x00a0, 0x0000, 0x0000, 0x0000,
|
||||
//8---------------------------
|
||||
0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a2a, 0x02a8, 0x0a8a, 0x0a0a,
|
||||
0x0a0a, 0x02a8, 0x0000, 0x0000, 0x0000,
|
||||
//9---------------------------
|
||||
0x0000, 0x02a8, 0x0a0a, 0x0a0a, 0x0a0a, 0x0aa8, 0x0280, 0x0280,
|
||||
0x00a0, 0x00a8, 0x0000, 0x0000, 0x0000,
|
||||
};
|
46
platform/exp5438/hal_lcd_fonts.h
Normal file
46
platform/exp5438/hal_lcd_fonts.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*******************************************************************************
|
||||
*
|
||||
* hal_lcd_fonts.h
|
||||
*
|
||||
* Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated 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 COPYRIGHT HOLDERS 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 COPYRIGHT
|
||||
* OWNER 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 FONTS_H
|
||||
#define FONTS_H
|
||||
|
||||
#define FONT_HEIGHT 12 // Each character has 13 lines
|
||||
|
||||
extern const unsigned char fonts_lookup[];
|
||||
extern const unsigned int fonts[];
|
||||
extern const unsigned int GrayScale_fonts[];
|
||||
|
||||
#endif /* FONTS_H */
|
141
platform/exp5438/lcd.c
Normal file
141
platform/exp5438/lcd.c
Normal file
|
@ -0,0 +1,141 @@
|
|||
/*
|
||||
* 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.
|
||||
*
|
||||
* Author : Adam Dunkels
|
||||
*/
|
||||
|
||||
#include "lcd.h"
|
||||
#include "hal_lcd.h"
|
||||
|
||||
#define WITH_LCD 1
|
||||
|
||||
#define Y_MAX 9
|
||||
#define X_MAX 15
|
||||
static int xpos, ypos;
|
||||
|
||||
#define X_CHAR_SIZE 8
|
||||
#define Y_CHAR_SIZE 9
|
||||
|
||||
#define SCROLL_AREA LCD_MAX_SCROLL_AREA
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
lcd_init(void)
|
||||
{
|
||||
if(WITH_LCD) {
|
||||
halLcdInit();
|
||||
halLcdActive();
|
||||
halLcdBackLightInit();
|
||||
halLcdSetBackLight(8);
|
||||
lcd_clear();
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
lcd_clear(void)
|
||||
{
|
||||
if(WITH_LCD) {
|
||||
halLcdClearScreen();
|
||||
xpos = ypos = 0;
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
lcd_set_pixel(int x, int y, int intensity)
|
||||
{
|
||||
if(WITH_LCD) {
|
||||
halLcdPixel(x, y, intensity);
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
inc_y(void)
|
||||
{
|
||||
if(WITH_LCD) {
|
||||
ypos++;
|
||||
xpos = 0;
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
lcd_write_char(char c)
|
||||
{
|
||||
char string[2];
|
||||
|
||||
if(WITH_LCD) {
|
||||
if(c == '\n') {
|
||||
inc_y();
|
||||
} else {
|
||||
string[0] = c;
|
||||
string[1] = 0;
|
||||
|
||||
if(ypos == Y_MAX) {
|
||||
lcd_clear();
|
||||
ypos = xpos = 0;
|
||||
}
|
||||
|
||||
halLcdPrintXY(string, xpos * X_CHAR_SIZE, ypos * Y_CHAR_SIZE, 0);
|
||||
|
||||
if(xpos == X_MAX) {
|
||||
inc_y();
|
||||
} else {
|
||||
xpos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
lcd_draw_line(int x0, int y0, int x1, int y1)
|
||||
{
|
||||
if(WITH_LCD) {
|
||||
halLcdLine(x0, y0, x1, y1, 3);
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
lcd_draw_vertical_line(int pixels)
|
||||
{
|
||||
if(WITH_LCD) {
|
||||
if(pixels > SCROLL_AREA) {
|
||||
pixels = SCROLL_AREA;
|
||||
}
|
||||
lcd_draw_line(LCD_MAX_X, LCD_MAX_Y - pixels, LCD_MAX_X, LCD_MAX_Y);
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
lcd_scroll_x(void)
|
||||
{
|
||||
if(WITH_LCD) {
|
||||
halLcdHScroll(LCD_MAX_Y - SCROLL_AREA, LCD_MAX_Y);
|
||||
halLcdLine(LCD_MAX_X, LCD_MAX_Y - SCROLL_AREA, LCD_MAX_X, LCD_MAX_Y, 0);
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
50
platform/exp5438/lcd.h
Normal file
50
platform/exp5438/lcd.h
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* 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.
|
||||
*
|
||||
* Author : Adam Dunkels
|
||||
*/
|
||||
#ifndef LCD_H
|
||||
#define LCD_H
|
||||
|
||||
/* Generic LCD routines. */
|
||||
void lcd_init(void);
|
||||
void lcd_clear(void);
|
||||
void lcd_set_pixel(int x, int y, int intensity);
|
||||
void lcd_write_char(char c);
|
||||
|
||||
/*void lcd_draw_line(int x0, int y0, int x1, int y1);*/
|
||||
void lcd_scroll_x(void);
|
||||
void lcd_draw_vertical_line(int pixels);
|
||||
|
||||
#define LCD_MAX_SCROLL_AREA 11
|
||||
#define LCD_MAX_X 136
|
||||
#define LCD_MAX_Y 109
|
||||
|
||||
#endif /* LCD_H */
|
79
platform/exp5438/leds-arch.c
Normal file
79
platform/exp5438/leds-arch.c
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* Copyright (c) 2005, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Configurable Sensor Network Application
|
||||
* Architecture for sensor nodes running the Contiki operating system.
|
||||
*
|
||||
* $Id: leds-arch.c,v 1.1 2006/06/17 22:41:21 adamdunkels Exp $
|
||||
*
|
||||
* -----------------------------------------------------------------
|
||||
*
|
||||
* Author : Adam Dunkels, Joakim Eriksson, Niclas Finne
|
||||
* Created : 2005-11-03
|
||||
* Updated : $Date: 2006/06/17 22:41:21 $
|
||||
* $Revision: 1.1 $
|
||||
*/
|
||||
|
||||
#include "contiki-conf.h"
|
||||
#include "dev/leds.h"
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
/* LED ports */
|
||||
#define LEDS_CONF_RED 0x01
|
||||
#define LEDS_CONF_GREEN 0x02
|
||||
#define LEDS_CONF_YELLOW 0x02
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
leds_arch_init(void)
|
||||
{
|
||||
/* only red and green for now */
|
||||
P1DIR |= LEDS_CONF_RED;
|
||||
P1DIR |= LEDS_CONF_GREEN;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
unsigned char
|
||||
leds_arch_get(void)
|
||||
{
|
||||
return ((P1OUT & LEDS_CONF_RED) ? 0 : LEDS_RED)
|
||||
| ((P1OUT & LEDS_CONF_GREEN) ? 0 : LEDS_GREEN);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
leds_arch_set(unsigned char leds)
|
||||
{
|
||||
P1OUT = (P1OUT & ~LEDS_CONF_RED) | ((leds & LEDS_RED) ? LEDS_CONF_RED : 0);
|
||||
P1OUT = (P1OUT & ~LEDS_CONF_GREEN) |
|
||||
((leds & LEDS_GREEN) ? LEDS_CONF_GREEN : 0);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
316
platform/exp5438/msp430.c
Normal file
316
platform/exp5438/msp430.c
Normal file
|
@ -0,0 +1,316 @@
|
|||
/*
|
||||
* 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: 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 <signal.h>
|
||||
#endif
|
||||
#include "dev/watchdog.h"
|
||||
#include "dev/leds.h"
|
||||
#include "net/uip.h"
|
||||
|
||||
static unsigned long dco_speed;
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#if defined(__MSP430__) && defined(__GNUC__) && MSP430_MEMCPY_WORKAROUND
|
||||
void *
|
||||
w_memcpy(void *out, const void *in, size_t n)
|
||||
{
|
||||
uint8_t *src, *dest;
|
||||
src = (uint8_t *) in;
|
||||
dest = (uint8_t *) out;
|
||||
while(n-- > 0) {
|
||||
*dest++ = *src++;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
#endif /* __GNUC__ && __MSP430__ && MSP430_MEMCPY_WORKAROUND */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#if defined(__MSP430__) && defined(__GNUC__) && MSP430_MEMCPY_WORKAROUND
|
||||
void *
|
||||
w_memset(void *out, int value, size_t n)
|
||||
{
|
||||
uint8_t *dest;
|
||||
dest = (uint8_t *) out;
|
||||
while(n-- > 0) {
|
||||
*dest++ = value & 0xff;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
#endif /* __GNUC__ && __MSP430__ && MSP430_MEMCPY_WORKAROUND */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
msp430_init_dco(void)
|
||||
{
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
unsigned long
|
||||
msp430_dco_speed(void)
|
||||
{
|
||||
return dco_speed;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
msp430_set_dco_speed(unsigned long mhz)
|
||||
{
|
||||
int multiplier;
|
||||
|
||||
dco_speed = mhz;
|
||||
|
||||
dint();
|
||||
/* DCO multiplier m for x MHz:
|
||||
(m + 1) * FLLRef = Fdco
|
||||
(m + 1) * 32768 = x MHz
|
||||
m = x / 32768 - 1
|
||||
Set FLL Div = fDCOCLK/2
|
||||
*/
|
||||
|
||||
multiplier = mhz / 32768UL - 1;
|
||||
|
||||
__bis_SR_register(SCG0);
|
||||
UCSCTL0 = 0x0000;
|
||||
|
||||
/* Select DCO range 24MHz operation */
|
||||
UCSCTL1 = DCORSEL_5;
|
||||
|
||||
/* Set computed DCO multiplier */
|
||||
UCSCTL2 = FLLD_1 + multiplier;
|
||||
|
||||
__bic_SR_register(SCG0);
|
||||
|
||||
do {
|
||||
/* Clear XT2,XT1,DCO fault flags */
|
||||
UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + XT1HFOFFG + DCOFFG);
|
||||
/* Clear fault flags */
|
||||
SFRIFG1 &= ~OFIFG;
|
||||
|
||||
__delay_cycles(10000);
|
||||
/* Test oscillator fault flag */
|
||||
} while(SFRIFG1 & OFIFG);
|
||||
|
||||
UCSCTL3 |= SELREF_0;
|
||||
|
||||
UCSCTL4 |= SELA_0;
|
||||
|
||||
eint();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
msp430_quick_synch_dco(void)
|
||||
{
|
||||
msp430_set_dco_speed(F_CPU);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
init_ports(void)
|
||||
{
|
||||
/* Turn everything off, device drivers enable what is needed. */
|
||||
|
||||
/* All configured for digital I/O */
|
||||
#ifdef P1SEL
|
||||
P1SEL = 0;
|
||||
#endif
|
||||
#ifdef P2SEL
|
||||
P2SEL = 0;
|
||||
#endif
|
||||
#ifdef P3SEL
|
||||
P3SEL = 0;
|
||||
#endif
|
||||
#ifdef P4SEL
|
||||
P4SEL = 0;
|
||||
#endif
|
||||
#ifdef P5SEL
|
||||
P5SEL = 0;
|
||||
#endif
|
||||
#ifdef P6SEL
|
||||
P6SEL = 0;
|
||||
#endif
|
||||
|
||||
/* All available inputs */
|
||||
#ifdef P1DIR
|
||||
P1DIR = 0;
|
||||
P1OUT = 0;
|
||||
#endif
|
||||
#ifdef P2DIR
|
||||
P2DIR = 1 << 6; /* output needed for the below config ? */
|
||||
P2OUT = 0;
|
||||
P2SEL = 1 << 6; /* test for setting the P2.6 to ACKL output */
|
||||
#endif
|
||||
#ifdef P3DIR
|
||||
P3DIR = 0;
|
||||
P3OUT = 0;
|
||||
#endif
|
||||
#ifdef P4DIR
|
||||
P4DIR = 0;
|
||||
P4OUT = 0;
|
||||
#endif
|
||||
|
||||
#ifdef P5DIR
|
||||
P5DIR = 0;
|
||||
P5OUT = 0;
|
||||
#endif
|
||||
|
||||
#ifdef P6DIR
|
||||
P6DIR = 0;
|
||||
P6OUT = 0;
|
||||
#endif
|
||||
|
||||
#ifdef P7DIR
|
||||
P7DIR = 0;
|
||||
P7OUT = 0;
|
||||
P7SEL |= 0x03; /* Configure for ext clock function on these pins */
|
||||
#endif
|
||||
|
||||
#ifdef P8DIR
|
||||
P8DIR = 0;
|
||||
P8OUT = 0;
|
||||
#endif
|
||||
|
||||
P1IE = 0;
|
||||
P2IE = 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* msp430-ld may align _end incorrectly. Workaround in cpu_init. */
|
||||
#ifndef __IAR_SYSTEMS_ICC__
|
||||
extern int _end; /* Not in sys/unistd.h */
|
||||
static char *cur_break = (char *)&_end;
|
||||
#endif
|
||||
|
||||
void
|
||||
msp430_cpu_init(void)
|
||||
{
|
||||
dint();
|
||||
watchdog_init();
|
||||
init_ports();
|
||||
dco_speed = 1048576; /* Default bootup DCO frequency */
|
||||
msp430_quick_synch_dco();
|
||||
eint();
|
||||
#ifndef __IAR_SYSTEMS_ICC__
|
||||
if((uintptr_t)cur_break & 1) { /* Workaround for msp430-ld bug! */
|
||||
cur_break++;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#define asmv(arg) __asm__ __volatile__(arg)
|
||||
|
||||
#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.
|
||||
*/
|
||||
|
||||
#if 0
|
||||
void *
|
||||
sbrk(int incr)
|
||||
{
|
||||
char *stack_pointer;
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
stack_pointer = (char *) __get_SP_register();
|
||||
/* TODO: add code here... */
|
||||
return 0;
|
||||
#else
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/*
|
||||
* Mask all interrupts that can be masked.
|
||||
*/
|
||||
int
|
||||
splhigh_(void)
|
||||
{
|
||||
/* Clear the GIE (General Interrupt Enable) flag. */
|
||||
int sr;
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
sr = __get_SR_register();
|
||||
__bic_SR_register(GIE);
|
||||
#else
|
||||
asmv("mov r2, %0" : "=r" (sr));
|
||||
asmv("bic %0, r2" : : "i" (GIE));
|
||||
#endif
|
||||
return sr & GIE; /* Ignore other sr bits. */
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/*
|
||||
* Restore previous interrupt mask.
|
||||
*/
|
||||
void
|
||||
splx_(int sr)
|
||||
{
|
||||
/* If GIE was set, restore it. */
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
__bis_SR_register(sr);
|
||||
#else
|
||||
asmv("bis %0, r2" : : "r" (sr));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
int __low_level_init(void)
|
||||
{
|
||||
/* turn off watchdog so that C-init will run */
|
||||
WDTCTL = WDTPW + WDTHOLD;
|
||||
/*
|
||||
* Return value:
|
||||
*
|
||||
* 1 - Perform data segment initialization.
|
||||
* 0 - Skip data segment initialization.
|
||||
*/
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
msp430_sync_dco(void)
|
||||
{
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
81
platform/exp5438/node-id.c
Normal file
81
platform/exp5438/node-id.c
Normal file
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* 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.2 2010/08/26 22:08:11 nifi Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* Utility to store a node id in the external flash
|
||||
* \author
|
||||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#include "node-id.h"
|
||||
#include "contiki-conf.h"
|
||||
#include "dev/xmem.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
unsigned short node_id = 0;
|
||||
unsigned char node_mac[8];
|
||||
|
||||
uint8_t id[] = {0xab, 0xcd};
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
node_id_restore(void)
|
||||
{
|
||||
uint8_t *infomem;
|
||||
infomem = (uint8_t *) 0x1800;
|
||||
uint8_t i;
|
||||
if(infomem[0] == id[0] && infomem[1] == id[1]) {
|
||||
for(i = 0; i < 8; i++) {
|
||||
node_mac[i] = infomem[2 + i];
|
||||
}
|
||||
} else {
|
||||
/* default address */
|
||||
node_mac[0] = 0x02;
|
||||
node_mac[1] = 0x012;
|
||||
node_mac[3] = 0x074;
|
||||
node_mac[4] = 0x000;
|
||||
node_mac[5] = 0x01;
|
||||
node_mac[6] = 0x02;
|
||||
node_mac[7] = 0x03;
|
||||
}
|
||||
node_id = node_mac[7] | (node_mac[6] << 2);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
node_id_burn(unsigned short id)
|
||||
{
|
||||
/* add this later */
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
45
platform/exp5438/node-id.h
Normal file
45
platform/exp5438/node-id.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* 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.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
* $Id: node-id.h,v 1.1 2010/08/24 16:26:38 joxe 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;
|
||||
extern unsigned char node_mac[8];
|
||||
|
||||
#endif /* __NODE_ID_H__ */
|
214
platform/exp5438/platform-conf.h
Normal file
214
platform/exp5438/platform-conf.h
Normal file
|
@ -0,0 +1,214 @@
|
|||
/*
|
||||
* 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: platform-conf.h,v 1.1 2010/08/24 16:26:38 joxe Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* A brief description of what this file is
|
||||
* \author
|
||||
* Joakim Eriksson <joakime@sics.se>
|
||||
*/
|
||||
|
||||
#ifndef __PLATFORM_CONF_H__
|
||||
#define __PLATFORM_CONF_H__
|
||||
|
||||
/*
|
||||
* Definitions below are dictated by the hardware and not really
|
||||
* changeable!
|
||||
*/
|
||||
#define TYNDALL 1
|
||||
/* Test for IAR compiler */
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <intrinsics.h>
|
||||
#include <in430.h>
|
||||
#define dint() __disable_interrupt()
|
||||
#define eint() __enable_interrupt()
|
||||
#define __MSP430F5437__ 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 */
|
||||
#define F_CPU 8000000uL // 8MHz by default
|
||||
|
||||
/* 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
|
||||
#define MSP430_MEMCPY_WORKAROUND 1
|
||||
#include "msp430def.h"
|
||||
|
||||
|
||||
/* Types for clocks and uip_stats */
|
||||
typedef unsigned short uip_stats_t;
|
||||
typedef unsigned long clock_time_t;
|
||||
typedef unsigned long off_t;
|
||||
|
||||
/* the low-level radio driver */
|
||||
#define NETSTACK_CONF_RADIO cc2420_driver
|
||||
|
||||
/*
|
||||
* Definitions below are dictated by the hardware and not really
|
||||
* changeable!
|
||||
*/
|
||||
|
||||
/* DCO speed resynchronization for more robust UART, etc. */
|
||||
/* Not needed from MSP430x5xx since it make use of the FLL */
|
||||
#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 ((UCB0IFG & UCRXIFG) == 0)
|
||||
/* USART0 Tx buffer ready? */
|
||||
#define SPI_WAITFORTxREADY() while ((UCB0IFG & UCTXIFG) == 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 6
|
||||
/* P1.3 - Input: FIFO from CC2420 */
|
||||
#define CC2420_FIFO_PORT(type) P1##type
|
||||
#define CC2420_FIFO_PIN 5
|
||||
/* P1.4 - Input: CCA from CC2420 */
|
||||
#define CC2420_CCA_PORT(type) P1##type
|
||||
#define CC2420_CCA_PIN 7
|
||||
/* P4.1 - Input: SFD from CC2420 */
|
||||
#define CC2420_SFD_PORT(type) P1##type
|
||||
#define CC2420_SFD_PIN 3
|
||||
/* 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) P1##type
|
||||
#define CC2420_VREG_PIN 4
|
||||
/* P4.6 - Output: RESET_N to CC2420 */
|
||||
#define CC2420_RESET_PORT(type) P1##type
|
||||
#define CC2420_RESET_PIN 2
|
||||
|
||||
|
||||
#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 (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__ */
|
23
platform/exp5438/port-mapping.txt
Normal file
23
platform/exp5438/port-mapping.txt
Normal file
|
@ -0,0 +1,23 @@
|
|||
LED red P1.0
|
||||
LED yellow P1.1
|
||||
|
||||
|
||||
Serial port UCA1
|
||||
|
||||
|
||||
CC2420 SPI UCB0
|
||||
|
||||
CC2420 CSN P3.0 (UBE0STE)
|
||||
CC2420 MOSI P3.1 (UCB0SIMO/SDA)
|
||||
CC2420 MISO P3.2 (UCB0SOMI/SCL)
|
||||
CC2420 SCK P3.3 (UCB0CLK/STE)
|
||||
|
||||
CC2420 FIFOP P1.6
|
||||
CC2420 FIFO P1.5
|
||||
CC2420 CCA P1.7
|
||||
CC2420 SFD P1.3
|
||||
CC2420 VREN P1.4
|
||||
CC2420 RESET P1.2
|
||||
|
||||
|
||||
Button 1 P2.6
|
115
platform/exp5438/rtimer-arch.c
Normal file
115
platform/exp5438/rtimer-arch.c
Normal file
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
* 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: rtimer-arch.c,v 1.17 2010/11/27 15:27:20 nifi Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file
|
||||
* MSP430-specific rtimer code
|
||||
* \author
|
||||
* Adam Dunkels <adam@sics.se>
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include "sys/energest.h"
|
||||
#include "sys/rtimer.h"
|
||||
#include "sys/process.h"
|
||||
#include "dev/watchdog.h"
|
||||
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#include <stdio.h>
|
||||
#define PRINTF(...) printf(__VA_ARGS__)
|
||||
#else
|
||||
#define PRINTF(...)
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=TIMER1_A0_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(TIMER1_A0_VECTOR)
|
||||
#endif
|
||||
timera0 (void) {
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
|
||||
watchdog_start();
|
||||
|
||||
rtimer_run_next();
|
||||
|
||||
if(process_nevents() > 0) {
|
||||
LPM4_EXIT;
|
||||
}
|
||||
|
||||
watchdog_stop();
|
||||
|
||||
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
rtimer_arch_init(void)
|
||||
{
|
||||
dint();
|
||||
|
||||
/* CCR0 interrupt enabled, interrupt occurs when timer equals CCR0. */
|
||||
TA1CCTL0 = CCIE;
|
||||
|
||||
/* Enable interrupts. */
|
||||
eint();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
rtimer_clock_t
|
||||
rtimer_arch_now(void)
|
||||
{
|
||||
rtimer_clock_t t1, t2;
|
||||
do {
|
||||
t1 = TA1R;
|
||||
t2 = TA1R;
|
||||
} while(t1 != t2);
|
||||
return t1;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
rtimer_arch_schedule(rtimer_clock_t t)
|
||||
{
|
||||
PRINTF("rtimer_arch_schedule time %u\n", t);
|
||||
|
||||
TA1CCR0 = t;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
83
platform/exp5438/spix.c
Normal file
83
platform/exp5438/spix.c
Normal file
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* 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 "contiki-conf.h"
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This is SPI initialization code for the MSP430X architecture.
|
||||
*
|
||||
*/
|
||||
unsigned char spi_busy = 0;
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/*
|
||||
* Initialize SPI bus.
|
||||
*/
|
||||
void
|
||||
spi_init(void)
|
||||
{
|
||||
/* Initalize ports for communication with SPI units. */
|
||||
|
||||
UCB0CTL1 |= UCSWRST; /* Reset USCI */
|
||||
UCB0CTL1 |= UCSSEL_2; /* smclk while usci is reset */
|
||||
/* MSB-first 8-bit, Master, Synchronous, 3 pin SPI master, no ste,
|
||||
watch-out for clock-phase UCCKPH */
|
||||
UCB0CTL0 = (UCMSB | UCMST | UCSYNC | UCCKPL);
|
||||
|
||||
/* Set up SPI bus speed. */
|
||||
UCB0BR1 = 0x00;
|
||||
UCB0BR0 = 0x01;
|
||||
|
||||
/* Dont need modulation control. */
|
||||
/* UCB0MCTL = 0; */
|
||||
|
||||
/* Select Peripheral functionality */
|
||||
P3SEL |= BV(SCK) | BV(MOSI) | BV(MISO);
|
||||
/* Configure as outputs(SIMO,CLK). */
|
||||
P3DIR |= BV(SCK) | BV(MISO);
|
||||
|
||||
/* Clear pending interrupts before enabling. */
|
||||
UCB0IE &= ~UCRXIFG;
|
||||
UCB0IE &= ~UCTXIFG;
|
||||
/* Remove RESET before enabling interrupts */
|
||||
UCB0CTL1 &= ~UCSWRST;
|
||||
|
||||
/* Enable UCB0 Interrupts */
|
||||
/* Enable USCI_B0 TX Interrupts */
|
||||
/* IE2 |= UCB0TXIE; */
|
||||
/* Enable USCI_B0 RX Interrupts */
|
||||
/* IE2 |= UCB0RXIE; */
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
12
platform/exp5438/uart1-putchar.c
Normal file
12
platform/exp5438/uart1-putchar.c
Normal file
|
@ -0,0 +1,12 @@
|
|||
#include <stdio.h>
|
||||
#include "dev/uart1.h"
|
||||
#include "lcd.h"
|
||||
|
||||
int
|
||||
putchar(int c)
|
||||
{
|
||||
uart1_writeb((char)c);
|
||||
|
||||
lcd_write_char((char)c);
|
||||
return c;
|
||||
}
|
143
platform/exp5438/uart1x.c
Normal file
143
platform/exp5438/uart1x.c
Normal file
|
@ -0,0 +1,143 @@
|
|||
/*
|
||||
* 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 $
|
||||
*/
|
||||
|
||||
/*
|
||||
* Yet another machine dependent MSP430X UART1 code.
|
||||
* IF2, etc. can not be used here... need to abstract to some macros
|
||||
* later.
|
||||
*/
|
||||
|
||||
#include "contiki.h"
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "sys/energest.h"
|
||||
#include "dev/uart1.h"
|
||||
#include "dev/watchdog.h"
|
||||
#include "lib/ringbuf.h"
|
||||
#include "dev/leds.h"
|
||||
|
||||
static int (*uart1_input_handler)(unsigned char c);
|
||||
|
||||
static volatile uint8_t transmitting;
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
uint8_t
|
||||
uart1_active(void)
|
||||
{
|
||||
return (UCA1STAT & UCBUSY) | transmitting;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
uart1_set_input(int (*input)(unsigned char c))
|
||||
{
|
||||
uart1_input_handler = input;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
uart1_writeb(unsigned char c)
|
||||
{
|
||||
watchdog_periodic();
|
||||
/* Loop until the transmission buffer is available. */
|
||||
while((UCA1STAT & UCBUSY));
|
||||
|
||||
/* Transmit the data. */
|
||||
UCA1TXBUF = c;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#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 */
|
||||
UCA1CTL1 |= UCSWRST; /* Hold peripheral in reset state */
|
||||
UCA1CTL1 |= UCSSEL_2; /* CLK = SMCLK */
|
||||
|
||||
/* UCA1BR0 = 0x45; /\* 8MHz/115200 = 69 = 0x45 *\/ */
|
||||
UCA1BR0 = ubr & 0xff; //0x45; /* tested... */
|
||||
/* UCA1BR0 = 9; */
|
||||
UCA1BR1 = ubr >> 8;
|
||||
UCA1MCTL = UCBRS_3; /* Modulation UCBRSx = 3 */
|
||||
P5DIR &= ~0x80; /* P5.7 = USCI_A1 RXD as input */
|
||||
P5DIR |= 0x40; /* P5.6 = USCI_A1 TXD as output */
|
||||
P5SEL |= 0xc0; /* P5.6,7 = USCI_A1 TXD/RXD */
|
||||
|
||||
/*UCA1CTL1 &= ~UCSWRST;*/ /* Initialize USCI state machine */
|
||||
|
||||
transmitting = 0;
|
||||
|
||||
/* XXX Clear pending interrupts before enable */
|
||||
UCA1IE &= ~UCRXIFG;
|
||||
UCA1IE &= ~UCTXIFG;
|
||||
|
||||
UCA1CTL1 &= ~UCSWRST; /* Initialize USCI state machine **before** enabling interrupts */
|
||||
UCA1IE |= UCRXIE; /* Enable UCA1 RX interrupt */
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=USCI_A1_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(USCI_A1_VECTOR)
|
||||
#endif
|
||||
uart1_rx_interrupt(void)
|
||||
{
|
||||
uint8_t c;
|
||||
|
||||
ENERGEST_ON(ENERGEST_TYPE_IRQ);
|
||||
/*leds_toggle(LEDS_ALL);*/
|
||||
if(UCA1IV == 2) {
|
||||
if(UCA1STAT & UCRXERR) {
|
||||
c = UCA1RXBUF; /* Clear error flags by forcing a dummy read. */
|
||||
} else {
|
||||
c = UCA1RXBUF;
|
||||
if(uart1_input_handler != NULL) {
|
||||
if(uart1_input_handler(c)) {
|
||||
LPM4_EXIT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ENERGEST_OFF(ENERGEST_TYPE_IRQ);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
161
platform/exp5438/watchdog.c
Normal file
161
platform/exp5438/watchdog.c
Normal file
|
@ -0,0 +1,161 @@
|
|||
/*
|
||||
* 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: watchdog.c,v 1.12 2010/11/12 15:54:41 nifi Exp $
|
||||
*/
|
||||
|
||||
#include "contiki-conf.h"
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#include <msp430.h>
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <signal.h>
|
||||
#endif
|
||||
#include "dev/watchdog.h"
|
||||
|
||||
static int counter = 0;
|
||||
|
||||
#define PRINT_STACK_ON_REBOOT 0
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#if PRINT_STACK_ON_REBOOT
|
||||
#ifdef CONTIKI_TARGET_SKY
|
||||
static void
|
||||
printchar(char c)
|
||||
{
|
||||
/* Transmit the data. */
|
||||
TXBUF1 = c;
|
||||
|
||||
/* Loop until the transmission buffer is available. */
|
||||
while((SFRIFG2 & UTXIFG1) == 0);
|
||||
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
hexprint(uint8_t v)
|
||||
{
|
||||
const char hexconv[] = "0123456789abcdef";
|
||||
printchar(hexconv[v >> 4]);
|
||||
printchar(hexconv[v & 0x0f]);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
printstring(char *s)
|
||||
{
|
||||
while(*s) {
|
||||
printchar(*s++);
|
||||
}
|
||||
}
|
||||
#endif /* CONTIKI_TARGET_SKY */
|
||||
#endif /* PRINT_STACK_ON_REBOOT */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
#ifdef __IAR_SYSTEMS_ICC__
|
||||
#pragma vector=WDT_VECTOR
|
||||
__interrupt void
|
||||
#else
|
||||
interrupt(WDT_VECTOR)
|
||||
#endif
|
||||
watchdog_interrupt(void)
|
||||
{
|
||||
#ifdef CONTIKI_TARGET_SKY
|
||||
#if PRINT_STACK_ON_REBOOT
|
||||
uint8_t dummy;
|
||||
static uint8_t *ptr;
|
||||
static int i;
|
||||
|
||||
ptr = &dummy;
|
||||
printstring("Watchdog reset");
|
||||
printstring("\nStack at $");
|
||||
hexprint(((int)ptr) >> 8);
|
||||
hexprint(((int)ptr) & 0xff);
|
||||
printstring(":\n");
|
||||
|
||||
for(i = 0; i < 64; ++i) {
|
||||
hexprint(ptr[i]);
|
||||
printchar(' ');
|
||||
if((i & 0x0f) == 0x0f) {
|
||||
printchar('\n');
|
||||
}
|
||||
}
|
||||
printchar('\n');
|
||||
#endif /* PRINT_STACK_ON_REBOOT */
|
||||
#endif /* CONTIKI_TARGET_SKY */
|
||||
|
||||
watchdog_reboot();
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
watchdog_init(void)
|
||||
{
|
||||
/* The MSP430 watchdog is enabled at boot-up, so we stop it during
|
||||
initialization. */
|
||||
counter = 0;
|
||||
watchdog_stop();
|
||||
|
||||
SFRIFG1 &= ~WDTIFG;
|
||||
SFRIE1 |= WDTIE;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
watchdog_start(void)
|
||||
{
|
||||
/* We setup the watchdog to reset the device after one second,
|
||||
unless watchdog_periodic() is called. */
|
||||
counter--;
|
||||
if(counter == 0) {
|
||||
WDTCTL = WDTPW | WDTCNTCL | WDT_ARST_1000 | WDTTMSEL;
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
watchdog_periodic(void)
|
||||
{
|
||||
/* This function is called periodically to restart the watchdog
|
||||
timer. */
|
||||
/* if(counter < 0) {*/
|
||||
WDTCTL = (WDTCTL & 0xff) | WDTPW | WDTCNTCL | WDTTMSEL;
|
||||
/* }*/
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
watchdog_stop(void)
|
||||
{
|
||||
counter++;
|
||||
if(counter == 1) {
|
||||
WDTCTL = WDTPW | WDTHOLD;
|
||||
}
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
void
|
||||
watchdog_reboot(void)
|
||||
{
|
||||
WDTCTL = 0;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
Loading…
Reference in a new issue