From 3661ff242eac64ce8ba5d887eb3a6a3b7c30ece2 Mon Sep 17 00:00:00 2001 From: Niclas Finne Date: Tue, 13 Dec 2011 17:34:31 +0100 Subject: [PATCH] io, signal and IAR-GCC checks have been moved into contiki include file --- platform/z1/dev/adxl345.h | 18 +----------------- platform/z1/dev/i2cmaster.h | 18 +----------------- platform/z1/msp430.c | 7 +------ platform/z1/platform-conf.h | 26 +++++++++++++++++++++++--- platform/z1sp/platform-conf.h | 22 ++++++++++++++++++++++ 5 files changed, 48 insertions(+), 43 deletions(-) diff --git a/platform/z1/dev/adxl345.h b/platform/z1/dev/adxl345.h index c7b23be21..0eb80ccff 100644 --- a/platform/z1/dev/adxl345.h +++ b/platform/z1/dev/adxl345.h @@ -41,7 +41,7 @@ #ifndef __ADXL345_H__ #define __ADXL345_H__ #include -#include "i2cmaster.h" +#include "dev/i2cmaster.h" #define DEBUGLEDS 0 #if DEBUGLEDS @@ -62,21 +62,6 @@ #define L_ON(x) (LEDS_PxOUT &= ~x) #define L_OFF(x) (LEDS_PxOUT |= x) -//XXX Temporary place for defines that are lacking in mspgcc4's gpio.h -#ifdef __GNUC__ -#ifndef P1SEL2_ - #define P1SEL2_ 0x0041 /* Port 1 Selection 2*/ - sfrb(P1SEL2, P1SEL2_); -#endif -#endif -#ifdef __IAR_SYSTEMS_ICC__ -#ifndef P1SEL2_ -#define P1SEL2_ (0x0041u) /* Port 1 Selection 2*/ -DEFC( P1SEL2 , P1SEL2_) -#endif -#endif - - /* Used in accm_read_axis(), eg accm_read_axis(X_AXIS);*/ enum ADXL345_AXIS { X_AXIS = 0, @@ -306,4 +291,3 @@ process_event_t int1_event, int2_event; // static ? /* -------------------------------------------------------------------------- */ #endif /* ifndef __ADXL345_H__ */ - diff --git a/platform/z1/dev/i2cmaster.h b/platform/z1/dev/i2cmaster.h index 2f11e1067..beccf3f5f 100644 --- a/platform/z1/dev/i2cmaster.h +++ b/platform/z1/dev/i2cmaster.h @@ -41,12 +41,7 @@ #ifndef __I2CMASTER_H__ #define __I2CMASTER_H__ -#include #include "contiki.h" -#include -#include - - void i2c_enable(void); @@ -58,18 +53,6 @@ void i2c_transmit_n(u8_t byte_ctr, u8_t *tx_buf); u8_t i2c_busy(void); -//XXX Temporary place for defines that are lacking in mspgcc4's gpio.h -#ifdef __GNUC__ -#ifndef P5SEL2_ - #define P5SEL2_ 0x0045 /* Port 5 Selection 2*/ - sfrb(P5SEL2, P5SEL2_); -#endif -#endif -#ifdef __IAR_SYSTEMS_ICC__ -#define P5SEL2_ (0x0045u) /* Port 5 Selection 2*/ -DEFC( P5SEL2 , P5SEL2_) -#endif - //XXX Should these defines be in the contiki-conf.h to make it more platform-independent? #define I2C_PxDIR P5DIR #define I2C_PxIN P5IN @@ -97,6 +80,7 @@ DEFC( P5SEL2 , P5SEL2_) #if 0 +#include #define PRINTFDEBUG(...) printf(__VA_ARGS__) #else #define PRINTFDEBUG(...) diff --git a/platform/z1/msp430.c b/platform/z1/msp430.c index a46902743..920783940 100644 --- a/platform/z1/msp430.c +++ b/platform/z1/msp430.c @@ -33,12 +33,7 @@ #include "contiki.h" -#ifdef __IAR_SYSTEMS_ICC__ -#include -#else -#include -#include -#include +#ifndef __IAR_SYSTEMS_ICC__ #define asmv(arg) __asm__ __volatile__(arg) #endif diff --git a/platform/z1/platform-conf.h b/platform/z1/platform-conf.h index d91e49f33..496f49295 100644 --- a/platform/z1/platform-conf.h +++ b/platform/z1/platform-conf.h @@ -60,10 +60,8 @@ #define CC_CONF_INLINE inline #endif - /* CPU target speed in Hz */ -/* CPU target speed in Hz */ -#define F_CPU 8000000uL // 8MHz by default +#define F_CPU 8000000uL /* 8MHz by default */ //Enric #define F_CPU 3900000uL /*2457600uL*/ /* Our clock resolution, this is the same as Unix HZ. */ @@ -78,6 +76,28 @@ #define MSP430_MEMCPY_WORKAROUND 1 #include "msp430def.h" +/* XXX Temporary place for defines that are lacking in mspgcc4's gpio.h */ +#ifdef __IAR_SYSTEMS_ICC__ +#ifndef P1SEL2_ +#define P1SEL2_ (0x0041u) /* Port 1 Selection 2*/ +DEFC( P1SEL2 , P1SEL2_) +#endif +#ifndef P5SEL2_ +#define P5SEL2_ (0x0045u) /* Port 5 Selection 2*/ +DEFC( P5SEL2 , P5SEL2_) +#endif +#else /* __IAR_SYSTEMS_ICC__ */ +#ifdef __GNUC__ +#ifndef P1SEL2_ + #define P1SEL2_ 0x0041 /* Port 1 Selection 2*/ + sfrb(P1SEL2, P1SEL2_); +#endif +#ifndef P5SEL2_ + #define P5SEL2_ 0x0045 /* Port 5 Selection 2*/ + sfrb(P5SEL2, P5SEL2_); +#endif +#endif /* __GNUC__ */ +#endif /* __IAR_SYSTEMS_ICC__ */ /* Types for clocks and uip_stats */ typedef unsigned short uip_stats_t; diff --git a/platform/z1sp/platform-conf.h b/platform/z1sp/platform-conf.h index a532d5994..063811eff 100644 --- a/platform/z1sp/platform-conf.h +++ b/platform/z1sp/platform-conf.h @@ -65,6 +65,28 @@ #define MSP430_MEMCPY_WORKAROUND 1 #include "msp430def.h" +/* XXX Temporary place for defines that are lacking in mspgcc4's gpio.h */ +#ifdef __IAR_SYSTEMS_ICC__ +#ifndef P1SEL2_ +#define P1SEL2_ (0x0041u) /* Port 1 Selection 2*/ +DEFC( P1SEL2 , P1SEL2_) +#endif +#ifndef P5SEL2_ +#define P5SEL2_ (0x0045u) /* Port 5 Selection 2*/ +DEFC( P5SEL2 , P5SEL2_) +#endif +#else /* __IAR_SYSTEMS_ICC__ */ +#ifdef __GNUC__ +#ifndef P1SEL2_ + #define P1SEL2_ 0x0041 /* Port 1 Selection 2*/ + sfrb(P1SEL2, P1SEL2_); +#endif +#ifndef P5SEL2_ + #define P5SEL2_ 0x0045 /* Port 5 Selection 2*/ + sfrb(P5SEL2, P5SEL2_); +#endif +#endif /* __GNUC__ */ +#endif /* __IAR_SYSTEMS_ICC__ */ /* Types for clocks and uip_stats */ typedef unsigned short uip_stats_t;