00001 /* File : core_portme.h */ 00002 00003 /* 00004 Author : Shay Gal-On, EEMBC 00005 Legal : TODO! 00006 */ 00007 /* Topic : Description 00008 This file contains configuration constants required to execute on different platforms 00009 */ 00010 #ifndef CORE_PORTME_H 00011 #define CORE_PORTME_H 00012 /************************/ 00013 /* Data types and settings */ 00014 /************************/ 00015 /* Configuration : HAS_FLOAT 00016 Define to 1 if the platform supports floating point. 00017 */ 00018 #ifndef HAS_FLOAT 00019 #define HAS_FLOAT 1 00020 #endif 00021 /* Configuration : HAS_TIME_H 00022 Define to 1 if platform has the time.h header file, 00023 and implementation of functions thereof. 00024 */ 00025 #ifndef HAS_TIME_H 00026 #define HAS_TIME_H 1 00027 #endif 00028 /* Configuration : USE_CLOCK 00029 Define to 1 if platform has the time.h header file, 00030 and implementation of functions thereof. 00031 */ 00032 #ifndef USE_CLOCK 00033 #define USE_CLOCK 1 00034 #endif 00035 /* Configuration : HAS_STDIO 00036 Define to 1 if the platform has stdio.h. 00037 */ 00038 #ifndef HAS_STDIO 00039 #define HAS_STDIO 0 00040 #endif 00041 /* Configuration : HAS_PRINTF 00042 Define to 1 if the platform has stdio.h and implements the printf function. 00043 */ 00044 #ifndef HAS_PRINTF 00045 #define HAS_PRINTF 0 00046 #endif 00047 00048 00049 /* Definitions : COMPILER_VERSION, COMPILER_FLAGS, MEM_LOCATION 00050 Initialize these strings per platform 00051 */ 00052 #ifndef COMPILER_VERSION 00053 #ifdef __GNUC__ 00054 #define COMPILER_VERSION "GCC"__VERSION__ 00055 #else 00056 #define COMPILER_VERSION "Please put compiler version here (e.g. gcc 4.1)" 00057 #endif 00058 #endif 00059 #ifndef COMPILER_FLAGS 00060 #define COMPILER_FLAGS FLAGS_STR /* "Please put compiler flags here (e.g. -o3)" */ 00061 #endif 00062 #ifndef MEM_LOCATION 00063 #define MEM_LOCATION "STACK" 00064 #endif 00065 00066 /* Data Types : 00067 To avoid compiler issues, define the data types that need ot be used for 8b, 16b and 32b in <core_portme.h>. 00068 00069 *Imprtant* : 00070 ee_ptr_int needs to be the data type used to hold pointers, otherwise coremark may fail!!! 00071 */ 00072 typedef signed short ee_s16; 00073 typedef unsigned short ee_u16; 00074 typedef signed int ee_s32; 00075 typedef double ee_f32; 00076 typedef unsigned char ee_u8; 00077 typedef unsigned int ee_u32; 00078 typedef ee_u32 ee_ptr_int; 00079 typedef ee_s32 size_t; 00080 #define NULL ((void *)0) 00081 /* align_mem : 00082 This macro is used to align an offset to point to a 32b value. It is used in the Matrix algorithm to initialize the input memory blocks. 00083 */ 00084 #define align_mem(x) (void *)(4 + (((ee_ptr_int)(x) - 1) & ~3)) 00085 00086 /* Configuration : CORE_TICKS 00087 Define type of return from the timing functions. 00088 */ 00089 #define CORETIMETYPE ee_u32 00090 typedef ee_u32 CORE_TICKS; 00091 00092 /* Configuration : SEED_METHOD 00093 Defines method to get seed values that cannot be computed at compile time. 00094 00095 Valid values : 00096 SEED_ARG - from command line. 00097 SEED_FUNC - from a system function. 00098 SEED_VOLATILE - from volatile variables. 00099 */ 00100 #ifndef SEED_METHOD 00101 #define SEED_METHOD SEED_VOLATILE 00102 #endif 00103 00104 /* Configuration : MEM_METHOD 00105 Defines method to get a block of memry. 00106 00107 Valid values : 00108 MEM_MALLOC - for platforms that implement malloc and have malloc.h. 00109 MEM_STATIC - to use a static memory array. 00110 MEM_STACK - to allocate the data block on the stack (NYI). 00111 */ 00112 #ifndef MEM_METHOD 00113 #define MEM_METHOD MEM_STACK 00114 #endif 00115 00116 /* Configuration : MULTITHREAD 00117 Define for parallel execution 00118 00119 Valid values : 00120 1 - only one context (default). 00121 N>1 - will execute N copies in parallel. 00122 00123 Note : 00124 If this flag is defined to more then 1, an implementation for launching parallel contexts must be defined. 00125 00126 Two sample implementations are provided. Use <USE_PTHREAD> or <USE_FORK> to enable them. 00127 00128 It is valid to have a different implementation of <core_start_parallel> and <core_end_parallel> in <core_portme.c>, 00129 to fit a particular architecture. 00130 */ 00131 #ifndef MULTITHREAD 00132 #define MULTITHREAD 1 00133 #define USE_PTHREAD 0 00134 #define USE_FORK 0 00135 #define USE_SOCKET 0 00136 #endif 00137 00138 /* Configuration : MAIN_HAS_NOARGC 00139 Needed if platform does not support getting arguments to main. 00140 00141 Valid values : 00142 0 - argc/argv to main is supported 00143 1 - argc/argv to main is not supported 00144 00145 Note : 00146 This flag only matters if MULTITHREAD has been defined to a value greater then 1. 00147 */ 00148 #ifndef MAIN_HAS_NOARGC 00149 #define MAIN_HAS_NOARGC 0 00150 #endif 00151 00152 /* Configuration : MAIN_HAS_NORETURN 00153 Needed if platform does not support returning a value from main. 00154 00155 Valid values : 00156 0 - main returns an int, and return value will be 0. 00157 1 - platform does not support returning a value from main 00158 */ 00159 #ifndef MAIN_HAS_NORETURN 00160 #define MAIN_HAS_NORETURN 0 00161 #endif 00162 00163 /* Variable : default_num_contexts 00164 Not used for this simple port, must cintain the value 1. 00165 */ 00166 extern ee_u32 default_num_contexts; 00167 00168 typedef struct CORE_PORTABLE_S { 00169 ee_u8 portable_id; 00170 } core_portable; 00171 00172 /* target specific init/fini */ 00173 void portable_init(core_portable *p, int *argc, char *argv[]); 00174 void portable_fini(core_portable *p); 00175 00176 #if !defined(PROFILE_RUN) && !defined(PERFORMANCE_RUN) && !defined(VALIDATION_RUN) 00177 #if (TOTAL_DATA_SIZE==1200) 00178 #define PROFILE_RUN 1 00179 #elif (TOTAL_DATA_SIZE==2000) 00180 #define PERFORMANCE_RUN 1 00181 #else 00182 #define VALIDATION_RUN 1 00183 #endif 00184 #endif 00185 00186 int ee_printf(const char *fmt, ...); 00187 00188 #endif /* CORE_PORTME_H */