From 5dcabc245546ce1ae91b449bfd8803bc8ac4fff7 Mon Sep 17 00:00:00 2001 From: balbastrep Date: Tue, 21 Aug 2007 14:00:34 +0000 Subject: [PATCH] Working in the Demo for Brussels git-svn-id: http://www.frescor.org/private/svn/frescor/fosa/trunk@672 35b4ef3e-fd22-0410-ab77-dab3279adceb --- src_rtlinux/Makefile | 11 +- src_rtlinux/fosa_app_def_sched.c | 6 + src_rtlinux/fosa_misc.c | 182 +++++++++++++++++++++++++++++++ 3 files changed, 194 insertions(+), 5 deletions(-) create mode 100644 src_rtlinux/fosa_misc.c diff --git a/src_rtlinux/Makefile b/src_rtlinux/Makefile index c98f9e8..7b85382 100644 --- a/src_rtlinux/Makefile +++ b/src_rtlinux/Makefile @@ -1,6 +1,6 @@ RTLINUX_PATH=../../../rtlinux-3.2-rc1/trunk -OBJS=fosa_app_def_sched.o fosa_mutexes_and_condvars.o fosa_clocks_and_timers.o fosa_threads_and_signals.o +OBJS=fosa_app_def_sched.o fosa_mutexes_and_condvars.o fosa_clocks_and_timers.o fosa_threads_and_signals.o fosa_misc.o pow.o exp.o #fosa_app_def_sched.o fosa_mutexes_and_condvars.o fosa_clocks_and_timers.o fosa_threads_and_signals.o FOSA_INC=../include @@ -8,17 +8,18 @@ FRSH_INC=../../../frsh/trunk/include all: libfosa.a +NAME=libfosa_RT_LINUX.a + include $(RTLINUX_PATH)/rtl.mk CFLAGS+=-I$(FOSA_INC) -I$(FRSH_INC) -DRT_LINUX libfosa.a: $(OBJS) - $(AR) -r libfosa.a $(OBJS) - - + $(AR) -r $(NAME) $(OBJS) + cp $(NAME) ../lib test_fosa_c.o: test_fosa.o - ld -r -o test_fosa_c.o test_fosa.o libfosa.a + ld -r -o test_fosa_c.o test_fosa.o $(NAME) test_fosa.o: test_fosa.c diff --git a/src_rtlinux/fosa_app_def_sched.c b/src_rtlinux/fosa_app_def_sched.c index 8dcd5d0..e17e5e9 100644 --- a/src_rtlinux/fosa_app_def_sched.c +++ b/src_rtlinux/fosa_app_def_sched.c @@ -171,6 +171,12 @@ int fosa_ads_get_appsched_params (frsh_thread_id_t thread, return (!pthread_getappschedparam(thread, param, paramsize))?0:EINVAL; } +int fosa_ads_set_appsched_params (frsh_thread_id_t thread, + const void *param, + size_t paramsize){ + return (!pthread_setappschedparam(thread, (void *)param, paramsize))?0:EINVAL; +} + /********************************* * ADS actions * diff --git a/src_rtlinux/fosa_misc.c b/src_rtlinux/fosa_misc.c new file mode 100644 index 0000000..6c867e0 --- /dev/null +++ b/src_rtlinux/fosa_misc.c @@ -0,0 +1,182 @@ +// ----------------------------------------------------------------------- +// Copyright (C) 2006 - 2007 FRESCOR consortium partners: +// +// Universidad de Cantabria, SPAIN +// University of York, UK +// Scuola Superiore Sant'Anna, ITALY +// Kaiserslautern University, GERMANY +// Univ. Politecnica Valencia, SPAIN +// Czech Technical University in Prague, CZECH REPUBLIC +// ENEA SWEDEN +// Thales Communication S.A. FRANCE +// Visual Tools S.A. SPAIN +// Rapita Systems Ltd UK +// Evidence ITALY +// +// See http://www.frescor.org for a link to partners' websites +// +// FRESCOR project (FP6/2005/IST/5-034026) is funded +// in part by the European Union Sixth Framework Programme +// The European Union is not liable of any use that may be +// made of this code. +// +// This file is part of the FRSH implementation +// +// FRSH is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) +// any later version. +// +// FRSH is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// distributed with FRSH; see file COPYING. If not, write to the +// Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +// +// As a special exception, if you include this header file into source +// files to be compiled, this header file does not by itself cause +// the resulting executable to be covered by the GNU General Public +// License. This exception does not however invalidate any other +// reasons why the executable file might be covered by the GNU General +// Public License. +// ----------------------------------------------------------------------- +//fosa_misc.h +//============================================== +// ******** ****** ******** ********** +// **///// /** ** **////// /** /** +// ** /** ** /** /** /** +// ******* /** ** /********* /********** +// **//// /** ** ////////** /**//////** +// ** /** ** /** /** /** +// ** /** ** ******** /** /** +// // /******/ //////// // // +// +// FOSA(Frescor Operating System Adaptation layer) +//================================================ + +//#include +#include + +extern int vsprintf(char *str, const char *format, va_list ap); +extern void rtl_printf(const char *format, ...); +typedef int size_t; + +static char vsprintf_buffer[512]; + +int vprintf(const char *fmt, va_list ap) { + int i=vsprintf(vsprintf_buffer, fmt, ap); + rtl_printf(vsprintf_buffer); + return i; +} + +int printf(const char *fmt,...) { + int i; + va_list args; + + va_start(args, fmt); + i=vsprintf(vsprintf_buffer, fmt, args); + va_end(args); + rtl_printf(vsprintf_buffer); + return i; +} + +typedef unsigned long FILE; + +FILE stdout=2; + +int vfprintf(FILE *stream, const char *fmt, va_list ap) { + int i=vsprintf(vsprintf_buffer, fmt, ap); + rtl_printf(vsprintf_buffer); + return i; +} + +static void *memccpy(void *dst, const void *src, int c, int count) +{ + char *a = dst; + const char *b = src; + while (count--) + { + *a++ = *b; + if (*b==c) + { + return (void *)a; + } + b++; + } + return 0; +} + +char *strncpy(char *dest, const char *src, size_t n) { + memccpy(dest,src,0,n); + return dest; +} + +int strncmp(const char *s1, const char *s2, size_t n) { + const unsigned char* a=(const unsigned char*)s1; + const unsigned char* b=(const unsigned char*)s2; + const unsigned char* fini=a+n; + while (a