1 // -----------------------------------------------------------------------
2 // Copyright (C) 2005 Mälardalen University, SWEDEN
3 // Scuola Superiore S.Anna, ITALY
4 // Universidad de Cantabria, SPAIN
5 // University of York, UK
7 // FRSH API web pages: http://marte.unican.es/frsh/docs/
8 // http://shark.sssup.it/contrib/first/docs/
10 // This file is part of FRSH API
12 // FRSH API is free software; you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation; either version 2, or (at your option)
17 // FRSH API is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 // General Public License for more details.
22 // You should have received a copy of the GNU General Public License
23 // distributed with FRSH API; see file COPYING. If not, write to the
24 // Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
27 // As a special exception, if you include this header file into source
28 // files to be compiled, this header file does not by itself cause
29 // the resulting executable to be covered by the GNU General Public
30 // License. This exception does not however invalidate any other
31 // reasons why the executable file might be covered by the GNU General
33 // -----------------------------------------------------------------------
34 //==============================================
35 // ******** ******* ******** ** **
36 // **///// /**////** **////// /** /**
37 // ** /** /** /** /** /**
38 // ******* /******* /*********/**********
39 // **//// /**///** ////////**/**//////**
40 // ** /** //** /**/** /**
41 // ** /** //** ******** /** /**
42 // // // // //////// // //
44 // FRSH(FRescor ScHeduler), pronounced "fresh"
45 //================================================
47 // Header file that allows a general testing code to be used for calling
48 // the FRSH primitives in both platforms: MaRTE_OS and SHARK
50 #ifndef _FRSH_OS_COMPATIBILITY_H_
51 #define _FRSH_OS_COMPATIBILITY_H_
52 /////////////////////////////SHARK SECTION /////////////////////////////
55 #define INITIALIZATION_CODE \
61 #define FRSH_STI kern_sti
63 #define FRSH_CLI kern_cli
66 //#define frsh_printf udp_print
67 #define frsh_printf cprintf
68 #define printf cprintf
71 t2d(struct timespec time)
73 return time.tv_nsec*0.000000001 + (double)time.tv_sec;
76 #define t2d( ts ) ((ts).tv_nsec*0.000000001 + (double)((ts).tv_sec))
78 #define ERROR(nn, ss) { if(errno==0) errno=nn ; kern_printf(ss); exit(nn);}
80 #define FINALIZATION_CODE { exit(0); }
82 #define STANDARD_CONSOLE_INIT { }
83 #define SERIAL_CONSOLE_INIT { }
85 #endif /* SHARK_FRSH */
86 //////////////////////////END OF SHARK SECTION /////////////////////////
89 /////////////////////////////MARTE SECTION /////////////////////////////
91 #include <misc/serial_console.h>
92 #include <misc/load.h>
93 #include "calibrate.h"
95 #include <debug_marte.h>
99 #define INITIALIZATION_CODE \
101 /*printf("max_prio = %d\n", sched_get_priority_max(SCHED_FIFO));*/\
102 /*printf("min_prio = %d\n", sched_get_priority_min(SCHED_FIFO));*/\
103 /*SERIAL_CONSOLE_INIT;*/ /*marte1.26i+ */\
104 init_serial_communication_with_gdb(SERIAL_PORT_1); \
105 /*printf("max_prio = %d\n", sched_get_priority_max(SCHED_FIFO));*/\
107 calibrate_cycle(); /*adjust();*/ \
108 /*printf("min_prio = %d\n", sched_get_priority_min(SCHED_FIFO));*/\
109 /*set_break_point_here; */\
112 #define ERROR(nn, ss) {if(errno==0) errno=(nn); perror(ss); exit (nn);}
119 frsh_priority_map (unsigned long plevel)
124 #define frsh_printf printf
126 extern int stop_scheduler; /* Defined at frsh_scheduler.h */
127 //#define FINALIZATION_CODE { stop_scheduler=1; eat(1.0); return 0; }
128 #define FINALIZATION_CODE { stop_scheduler=1; eat_cycles(1000000); return 0; }
130 //#define EAT( tt ) eat( (double)(tt)/(double)1000000 )
131 #define EAT eat_cycles
133 #endif /* MARTE_FRSH */
134 //////////////////////////END OF MARTE SECTION /////////////////////////
136 #endif /* _FRSH_OS_COMPATIBILITY_H_ */