SAMV71 Xplained Ultra Software Package 1.4

core_portme.h

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 1
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 1
00046 #endif
00047 
00048 /* Configuration : CORE_TICKS
00049     Define type of return from the timing functions.
00050  */
00051 #include <time.h>
00052 typedef clock_t CORE_TICKS;
00053 
00054 /* Definitions : COMPILER_VERSION, COMPILER_FLAGS, MEM_LOCATION
00055     Initialize these strings per platform
00056 */
00057 #ifndef COMPILER_VERSION 
00058  #ifdef __GNUC__
00059  #define COMPILER_VERSION "GCC"__VERSION__
00060  #else
00061  #define COMPILER_VERSION "Please put compiler version here (e.g. gcc 4.1)"
00062  #endif
00063 #endif
00064 #ifndef COMPILER_FLAGS 
00065  #define COMPILER_FLAGS FLAGS_STR /* "Please put compiler flags here (e.g. -o3)" */
00066 #endif
00067 #ifndef MEM_LOCATION 
00068  #define MEM_LOCATION "STACK"
00069 #endif
00070 
00071 /* Data Types :
00072     To avoid compiler issues, define the data types that need ot be used for 8b, 16b and 32b in <core_portme.h>.
00073     
00074     *Imprtant* :
00075     ee_ptr_int needs to be the data type used to hold pointers, otherwise coremark may fail!!!
00076 */
00077 typedef signed short ee_s16;
00078 typedef unsigned short ee_u16;
00079 typedef signed int ee_s32;
00080 typedef double ee_f32;
00081 typedef unsigned char ee_u8;
00082 typedef unsigned int ee_u32;
00083 typedef ee_u32 ee_ptr_int;
00084 /* align_mem :
00085     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.
00086 */
00087 #define align_mem(x) (void *)(4 + (((ee_ptr_int)(x) - 1) & ~3))
00088 
00089 /* Configuration : SEED_METHOD
00090     Defines method to get seed values that cannot be computed at compile time.
00091     
00092     Valid values :
00093     SEED_ARG - from command line.
00094     SEED_FUNC - from a system function.
00095     SEED_VOLATILE - from volatile variables.
00096 */
00097 #ifndef SEED_METHOD
00098 #define SEED_METHOD SEED_VOLATILE
00099 #endif
00100 
00101 /* Configuration : MEM_METHOD
00102     Defines method to get a block of memry.
00103     
00104     Valid values :
00105     MEM_MALLOC - for platforms that implement malloc and have malloc.h.
00106     MEM_STATIC - to use a static memory array.
00107     MEM_STACK - to allocate the data block on the stack (NYI).
00108 */
00109 #ifndef MEM_METHOD
00110 #define MEM_METHOD MEM_STACK
00111 #endif
00112 
00113 /* Configuration : MULTITHREAD
00114     Define for parallel execution 
00115     
00116     Valid values :
00117     1 - only one context (default).
00118     N>1 - will execute N copies in parallel.
00119     
00120     Note : 
00121     If this flag is defined to more then 1, an implementation for launching parallel contexts must be defined.
00122     
00123     Two sample implementations are provided. Use <USE_PTHREAD> or <USE_FORK> to enable them.
00124     
00125     It is valid to have a different implementation of <core_start_parallel> and <core_end_parallel> in <core_portme.c>,
00126     to fit a particular architecture. 
00127 */
00128 #ifndef MULTITHREAD
00129 #define MULTITHREAD 1
00130 #define USE_PTHREAD 0
00131 #define USE_FORK 0
00132 #define USE_SOCKET 0
00133 #endif
00134 
00135 /* Configuration : MAIN_HAS_NOARGC
00136     Needed if platform does not support getting arguments to main. 
00137     
00138     Valid values :
00139     0 - argc/argv to main is supported
00140     1 - argc/argv to main is not supported
00141     
00142     Note : 
00143     This flag only matters if MULTITHREAD has been defined to a value greater then 1.
00144 */
00145 #ifndef MAIN_HAS_NOARGC 
00146 #define MAIN_HAS_NOARGC 0
00147 #endif
00148 
00149 /* Configuration : MAIN_HAS_NORETURN
00150     Needed if platform does not support returning a value from main. 
00151     
00152     Valid values :
00153     0 - main returns an int, and return value will be 0.
00154     1 - platform does not support returning a value from main
00155 */
00156 #ifndef MAIN_HAS_NORETURN
00157 #define MAIN_HAS_NORETURN 0
00158 #endif
00159 
00160 /* Variable : default_num_contexts
00161     Not used for this simple port, must cintain the value 1.
00162 */
00163 extern ee_u32 default_num_contexts;
00164 
00165 typedef struct CORE_PORTABLE_S {
00166     ee_u8   portable_id;
00167 } core_portable;
00168 
00169 /* target specific init/fini */
00170 void portable_init(core_portable *p, int *argc, char *argv[]);
00171 void portable_fini(core_portable *p);
00172 
00173 #if !defined(PROFILE_RUN) && !defined(PERFORMANCE_RUN) && !defined(VALIDATION_RUN)
00174 #if (TOTAL_DATA_SIZE==1200)
00175 #define PROFILE_RUN 1
00176 #elif (TOTAL_DATA_SIZE==2000)
00177 #define PERFORMANCE_RUN 1
00178 #else
00179 #define VALIDATION_RUN 1
00180 #endif
00181 #endif
00182 
00183 #endif /* CORE_PORTME_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines