From bfbe68da512aa6a87cddb70aa77baf4b40e7d43f Mon Sep 17 00:00:00 2001 From: Thomas Schuetz Date: Fri, 7 Sep 2012 17:14:22 +0200 Subject: [runtime.c / generator.c] reorganized structure of runtime / moved and renamed etGlobalFlags.h to project specific config/etRuntimeConfig.h --- .../src/platforms/MSP430/etDatatypes.h | 72 -------------- .../src/platforms/MSP430/etGlobalFlags.h | 28 ------ .../src/platforms/MSP430/etLogger.c | 78 --------------- .../src/platforms/MSP430/etPlatform.c | 92 ----------------- .../src/platforms/MSP430/etTimer.c | 110 --------------------- .../src/platforms/MSP430/info.txt | 1 - 6 files changed, 381 deletions(-) delete mode 100644 runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/etDatatypes.h delete mode 100644 runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/etGlobalFlags.h delete mode 100644 runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/etLogger.c delete mode 100644 runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/etPlatform.c delete mode 100644 runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/etTimer.c delete mode 100644 runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/info.txt (limited to 'runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430') diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/etDatatypes.h deleted file mode 100644 index a831f66ff..000000000 --- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/etDatatypes.h +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz (initial contribution) - * - *******************************************************************************/ - -#ifndef _ETDATATYPES_H_ -#define _ETDATATYPES_H_ - -/* - * typedefs for platform specific datatypes - * Version for TI MSP 430 - * - * */ - -#include - -/* unsigned integer datatypes */ -typedef unsigned char uint8; -typedef unsigned short int uint16; -typedef unsigned long uint32; -/* typedef unsigned long long uint64; */ /* not available on this platform */ - -/* signed integer datatypes */ -typedef char int8; -typedef short int int16; -typedef long int32; -/* typedef long long int64; */ /* not available on this platform */ - - -/* float datatypes */ -typedef float float32; -/* typedef double float64; */ /* not available on this platform */ - -/* boolean datatypes and values */ -typedef char bool; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/ -typedef bool boolean; -#ifndef TRUE - #define TRUE 1 -#endif -#ifndef FALSE - #define FALSE 0 -#endif - -/* - * typedefs for eTrice Runtime and Testing - * - * */ - -typedef int8 etInt8; -typedef int16 etInt16; -typedef int32 etInt32; - -typedef uint8 etUInt8; -typedef uint16 etUInt16; -typedef uint32 etUInt32; - -typedef bool etBool; - -typedef float32 etFloat32; - -typedef FILE* etFileHandle; - -typedef int8 etAddressId; - -#endif /* _DATATYPES_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/etGlobalFlags.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/etGlobalFlags.h deleted file mode 100644 index 92df9f69b..000000000 --- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/etGlobalFlags.h +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz (initial contribution) - * - *******************************************************************************/ - -#ifndef ETGLOBALFLAGS_H_ -#define ETGLOBALFLAGS_H_ - -/* flags for debugging */ -//#define ET_MSC_LOGGER_ACTIVATE /* needs ET_LOGGER_ACTIVATE */ -//#define ET_LOGGER_ACTIVATE - -#define STRUCT_ALIGN 2 - -/* timing and scheduling */ -//#define FREQUENCY 100L -//#define ET_RUNTIME_MAXLOOP 100000 -#define ET_RUNTIME_ENDLESS - - -#endif /* ETGLOBALFLAGS_H_ */ diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/etLogger.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/etLogger.c deleted file mode 100644 index d43a953ba..000000000 --- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/etLogger.c +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz (initial contribution) - * - *******************************************************************************/ - -/* - * etLogger.c - * - * Created on: 16.01.2012 - * Author: tschuetz - */ - - -#include "debugging/etLogger.h" - -#include - - -void etLogger_logError(const char* message){ - printf("ERROR: %s\n", message); -} - -void etLogger_logWarning(const char* message){ - printf("WARNING: %s\n", message); -} - -void etLogger_logInfo(const char* message){ - printf("INFO: %s\n", message); -} - -void etLogger_logErrorF(const char* format, ... ){ - printf("ERROR: "); - va_list arglist; - va_start( arglist, format ); - vprintf( format, arglist ); - va_end( arglist ); - printf("\n"); -} - -void etLogger_logWarningF(const char* format, ... ){ - printf("WARNING: "); - va_list arglist; - va_start( arglist, format ); - vprintf( format, arglist ); - va_end( arglist ); - printf("\n"); -} - -void etLogger_logInfoF(const char* format, ... ){ - printf("INFO: "); - va_list arglist; - va_start( arglist, format ); - vprintf( format, arglist ); - va_end( arglist ); - printf("\n"); -} - -etFileHandle etLogger_fopen(const char* filename, const char* mode){ - return( fopen(filename, mode) ); -} - -int etLogger_fclose(etFileHandle file){ - return( fclose(file) ); -} - -void etLogger_fprintf(etFileHandle file, const char* format, ... ){ - va_list arglist; - va_start( arglist, format ); - vfprintf(file, format, arglist ); - va_end( arglist ); -} diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/etPlatform.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/etPlatform.c deleted file mode 100644 index 1650cd8a4..000000000 --- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/etPlatform.c +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2012 protos software gmbh (http://www.protos.de). - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * CONTRIBUTORS: - * Thomas Schuetz (initial contribution) - * - *******************************************************************************/ - -#include "msp430f5438a.h" -#include "hal_MSP-EXP430F5438.h" -#include "platform/etTimer.h" - - -/* forward declarations */ -static void prvSetupHardware(void); -void initIO(void); - - -/* implemenatation for eTrice interfaces*/ - -void etUserEntry(void){ - prvSetupHardware(); - etTimer_init(); -} - -void etUserPreRun(void){ - _enable_interrupt(); -} - -void etUserPostRun(void){ } -void etUserExit(void){ } - - -/* platform specific functions */ - -static void prvSetupHardware(void) { - /* Convert a Hz value to a KHz value, as required by the Init_FLL_Settle() - function. */ - unsigned long ulCPU_Clock_KHz = (25000000UL / 1000UL ); - - /* Disable the watchdog. */ - WDTCTL = WDTPW + 0x36; - SFRIE1 |= WDTIE; - - /* select port pin functions */ - halBoardInit(); - - P1DIR |= 0x03; - P2DIR &= ~0xC0; - P2REN |= 0xC0; - P2OUT |= 0xC0; - - LFXT_Start(XT1DRIVE_0); /* enable oszillator */ - Init_FLL_Settle((unsigned short) ulCPU_Clock_KHz, 488); /* clock divisor */ - - -} - -unsigned char getButtonStatus(unsigned int id){ - switch (id){ - case 1:return P2IN & 0x80; - break; - case 2:return P2IN & 0x40; - break; - default: return 0xFF; - }; -} - -void setLedPin (unsigned int id, unsigned int onOff){ - switch (id){ - case 1: - if (onOff){ - P1OUT |= 0x01; - }else{ - P1OUT &= ~0x01; - } - break; - case 2: - if (onOff){ - P1OUT |= 0x02; - }else{ - P1OUT &= ~0x02; - } - break; - default: - } -} - diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/etTimer.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/etTimer.c deleted file mode 100644 index cdffb9636..000000000 --- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/etTimer.c +++ /dev/null @@ -1,110 +0,0 @@ -#include "platform/etTimer.h" - -#include "hal_MSP-EXP430F5438.h" - -/* global timer */ - -static etTargetTime_t targetTime; -static etTargetTime_t lastTargetTime; -static volatile etBool etTimer_executeFlag = FALSE; - -void etTimer_init(void){ - targetTime.nSec=0; - targetTime.sec=0; - lastTargetTime.nSec=0; - lastTargetTime.sec=0; -} - -etBool etTimer_executeNeeded(void){ - if (etTimer_executeFlag == TRUE){ - etTimer_executeFlag = FALSE; - return TRUE; - } - else { - return FALSE; - } -} - -int isTimeGreaterThanActualTime(const etTargetTime_t *t) { - - _disable_interrupt(); - if (t->sec > targetTime.sec) { - _enable_interrupt(); - return 1; - } - - if (t->sec < targetTime.sec) { - _enable_interrupt(); - return 0; - } - - if (t->nSec > targetTime.nSec) { - _enable_interrupt(); - return 1; - } - else { - _enable_interrupt(); - return 0; - } -} - -uint32 getNSecFromTarget(void){ - etTargetTime_t time; - getTimeFromTarget(&time); - return time.nSec; -} - -uint32 getSecFromTarget(void){ - etTargetTime_t time; - getTimeFromTarget(&time); - return time.sec; -} - - -void getTimeFromTarget(etTargetTime_t *t) { - _disable_interrupt(); - *t = targetTime; - _enable_interrupt(); -} - -#define ET_TIMER_TIME_BASE_NS 15625000L -#define ET_TIMER_TIME_BASE_US ET_TIMER_TIME_BASE_NS / 1000L -#define ET_TIMER_TIME_BASE_MS ET_TIMER_TIME_BASE_US / 1000L - -uint32 getTimeBaseNS(void){ - return ET_TIMER_TIME_BASE_NS; -} - -uint32 getTimeBaseUS(void){ - return ET_TIMER_TIME_BASE_US; -} - -uint32 getTimeBaseMS(void){ - return ET_TIMER_TIME_BASE_MS; -} - - -/* the timer interrupt */ -#pragma INTERRUPT(wdt_isr) - -#pragma vector=WDT_VECTOR - -void wdt_isr(void) { -// this interrupt will be called every 15,625ms - - static unsigned char secCounter = 0; - etTimer_executeFlag = TRUE; - - targetTime.nSec += 15625000L; - - if (targetTime.nSec >= 1000000000L) { - targetTime.nSec -= 1000000000L; - targetTime.sec++; - } - secCounter++; - - if (secCounter >= 64) { - secCounter = 0; - } - -} // end interrupt diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/info.txt b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/info.txt deleted file mode 100644 index 71c5f9f3f..000000000 --- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MSP430/info.txt +++ /dev/null @@ -1 +0,0 @@ -TI-MSP430 -- cgit v1.2.3