* Added f2xxx for two series (for example z1)

* f1xxx is baseline and always included
* Cleaned up the names of uart and spi (no x in names)
* Updated SPI configuration for WiSMote
This commit is contained in:
Niclas Finne 2011-10-06 14:05:57 +02:00
parent 1a761ec3eb
commit cdfa8708e3
15 changed files with 289 additions and 204 deletions

View file

@ -7,7 +7,7 @@ CONTIKI_TARGET_SOURCEFILES += contiki-wismote-platform.c \
sky-sensors.c uip-ipchksum.c \
checkpoint-arch.c uart1.c slip_uart1.c uart1-putchar.c
ARCH=spix.c i2c.c node-id.c sensors.c cfs-coffee.c sht15.c \
ARCH=spi.c i2c.c node-id.c sensors.c cfs-coffee.c sht15.c \
cc2520.c cc2520-arch.c cc2520-arch-sfd.c \
sky-sensors.c uip-ipchksum.c \
checkpoint-arch.c uart1.c slip_uart1.c uart1-putchar.c

View file

@ -205,10 +205,10 @@ main(int argc, char **argv)
leds_on(LEDS_ALL);
uart1_init(BAUD2UBR(115200)); /* Must come before first printf */
uart1_init(115200); /* Must come before first printf */
#if WITH_UIP
slip_arch_init(BAUD2UBR(115200));
slip_arch_init(115200);
#endif /* WITH_UIP */
//ds2411_init();

View file

@ -1,92 +0,0 @@
/*
* Copyright (c) 2011, Swedish Institute of Computer Science.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the Institute nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/**
* \file
* Basic SPI macros
* \author
* Niclas Finne <nfi@sics.se>
* Joakim Eriksson <joakime@sics.se>
*/
#ifndef __SPI_H__
#define __SPI_H__
/* Define macros to use for checking SPI transmission status depending
on if it is possible to wait for TX buffer ready. This is possible
on for example MSP430 but not on AVR. */
#ifdef SPI_WAITFORTxREADY
#define SPI_WAITFORTx_BEFORE() SPI_WAITFORTxREADY()
#define SPI_WAITFORTx_AFTER()
#define SPI_WAITFORTx_ENDED() SPI_WAITFOREOTx()
#else /* SPI_WAITFORTxREADY */
#define SPI_WAITFORTx_BEFORE()
#define SPI_WAITFORTx_AFTER() SPI_WAITFOREOTx()
#define SPI_WAITFORTx_ENDED()
#endif /* SPI_WAITFORTxREADY */
extern unsigned char spi_busy;
void spi_init(void);
/* Write one character to SPI */
#define SPI_WRITE(data) \
do { \
UCB0IFG &= ~UCRXIFG; \
SPI_TXBUF = data; \
SPI_WAITFORTxREADY(); \
} while(0)
/* Write one character to SPI - will not wait for end
useful for multiple writes with wait after final */
#define SPI_WRITE_FAST(data) \
do { \
UCB0IFG &= ~UCRXIFG; \
SPI_TXBUF = data; \
SPI_WAITFORTxREADY(); \
} while(0)
/* Read one character from SPI */
#define SPI_READ(data) \
do { \
UCB0IFG &= ~UCRXIFG; \
SPI_TXBUF = 0; \
SPI_WAITFORTxREADY(); \
SPI_BUSY_WAIT(); \
data = SPI_RXBUF; \
} while(0)
/* Flush the SPI read register */
#define SPI_FLUSH() \
do { \
SPI_RXBUF; \
SPI_RXBUF; \
} while(0);
#endif /* __SPI_H__ */

View file

@ -39,8 +39,6 @@
* Definitions below are dictated by the hardware and not really
* changeable!
*/
/* Platform WISMOTE */
#define WISMOTE 1
#define PLATFORM_HAS_LEDS 1
#define PLATFORM_HAS_BUTTON 1
@ -52,7 +50,7 @@
#define CLOCK_CONF_SECOND 128UL
#define RTIMER_CONF_SECOND (4096U*8)
#define BAUD2UBR(baud) ((F_CPU/baud))
#define BAUD2UBR(baud) (baud)
#define CCIF
#define CLIF
@ -96,16 +94,25 @@ typedef unsigned long off_t;
#define SPI_RXBUF UCB0RXBUF
/* USART0 Tx ready? */
#define SPI_WAITFOREOTx() while (!(UCB0IFG & UCRXIFG))
#define SPI_WAITFOREOTx() while ((UCB0STAT & UCBUSY) != 0)
/* USART0 Rx ready? */
#define SPI_WAITFOREORx() while (!(UCB0IFG & UCRXIFG))
#define SPI_WAITFOREORx() while ((UCB0IFG & UCRXIFG) == 0)
/* USART0 Tx buffer ready? */
#define SPI_WAITFORTxREADY() while (!(UCB0IFG & UCRXIFG))
#define SPI_BUSY_WAIT() while ((UCB0STAT & UCBUSY) == 1)
#define SPI_WAITFORTxREADY() while ((UCB0IFG & UCTXIFG) == 0)
/* /\* USART0 Tx ready? *\/ */
/* #define SPI_WAITFOREOTx() while (!(UCB0IFG & UCRXIFG)) */
/* /\* USART0 Rx ready? *\/ */
/* #define SPI_WAITFOREORx() while (!(UCB0IFG & UCRXIFG)) */
/* /\* USART0 Tx buffer ready? *\/ */
/* #define SPI_WAITFORTxREADY() while (!(UCB0IFG & UCRXIFG)) */
/* #define SPI_BUSY_WAIT() while ((UCB0STAT & UCBUSY) == 1) */
#define SCK 1 /* P3.1 - Output: SPI Serial Clock (SCLK) */
#define MOSI 2 /* P3.2 - Output: SPI Master out - slave in (MOSI) */
#define MISO 3 /* P3.3 - Input: SPI Master in - slave out (MISO) */
#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) */
/* #define SCK 1 /\* P3.1 - Output: SPI Serial Clock (SCLK) *\/ */
/* #define MOSI 2 /\* P3.2 - Output: SPI Master out - slave in (MOSI) *\/ */
/* #define MISO 3 /\* P3.3 - Input: SPI Master in - slave out (MISO) *\/ */
/*
* SPI bus - M25P80 external flash configuration.

View file

@ -16,9 +16,9 @@ CLEAN += symbols.c symbols.h
ARCH=msp430.c leds.c watchdog.c xmem.c \
spix.c cc2420.c cc2420-aes.c cc2420-arch.c cc2420-arch-sfd.c\
spi.c cc2420.c cc2420-aes.c cc2420-arch.c cc2420-arch-sfd.c\
node-id.c sensors.c button-sensor.c cfs-coffee.c \
radio-sensor.c uart0x.c uart0-putchar.c uip-ipchksum.c \
radio-sensor.c uart0.c uart0-putchar.c uip-ipchksum.c \
checkpoint-arch.c slip.c slip_uart0.c \
z1-phidgets.c sht11.c sht11-sensor.c light-sensor.c \
battery-sensor.c sky-sensors.c tmp102.c temperature-sensor.c