| 1 |
355 |
julius |
/* File : core_portme.h */
|
| 2 |
|
|
|
| 3 |
|
|
/*
|
| 4 |
|
|
Author : Shay Gal-On, EEMBC
|
| 5 |
|
|
Legal : TODO!
|
| 6 |
|
|
*/
|
| 7 |
|
|
/* Topic : Description
|
| 8 |
|
|
This file contains configuration constants required to execute on different platforms
|
| 9 |
|
|
*/
|
| 10 |
|
|
#ifndef CORE_PORTME_H
|
| 11 |
|
|
#define CORE_PORTME_H
|
| 12 |
|
|
/************************/
|
| 13 |
|
|
/* Data types and settings */
|
| 14 |
|
|
/************************/
|
| 15 |
|
|
/* Configuration : HAS_FLOAT
|
| 16 |
|
|
Define to 1 if the platform supports floating point.
|
| 17 |
|
|
*/
|
| 18 |
|
|
#ifndef HAS_FLOAT
|
| 19 |
|
|
#define HAS_FLOAT 1
|
| 20 |
|
|
#endif
|
| 21 |
|
|
/* Configuration : HAS_TIME_H
|
| 22 |
|
|
Define to 1 if platform has the time.h header file,
|
| 23 |
|
|
and implementation of functions thereof.
|
| 24 |
|
|
*/
|
| 25 |
|
|
#ifndef HAS_TIME_H
|
| 26 |
|
|
#define HAS_TIME_H 0
|
| 27 |
|
|
#endif
|
| 28 |
|
|
/* Configuration : USE_CLOCK
|
| 29 |
|
|
Define to 1 if platform has the time.h header file,
|
| 30 |
|
|
and implementation of functions thereof.
|
| 31 |
|
|
*/
|
| 32 |
|
|
#ifndef USE_CLOCK
|
| 33 |
|
|
#define USE_CLOCK 0
|
| 34 |
|
|
#endif
|
| 35 |
|
|
/* Configuration : HAS_STDIO
|
| 36 |
|
|
Define to 1 if the platform has stdio.h.
|
| 37 |
|
|
*/
|
| 38 |
|
|
#ifndef HAS_STDIO
|
| 39 |
|
|
#define HAS_STDIO 0
|
| 40 |
|
|
#endif
|
| 41 |
|
|
/* Configuration : HAS_PRINTF
|
| 42 |
|
|
Define to 1 if the platform has stdio.h and implements the printf function.
|
| 43 |
|
|
*/
|
| 44 |
|
|
#ifndef HAS_PRINTF
|
| 45 |
|
|
#define HAS_PRINTF 0
|
| 46 |
|
|
#endif
|
| 47 |
|
|
|
| 48 |
|
|
/* Definitions : COMPILER_VERSION, COMPILER_FLAGS, MEM_LOCATION
|
| 49 |
|
|
Initialize these strings per platform
|
| 50 |
|
|
*/
|
| 51 |
|
|
#ifndef COMPILER_VERSION
|
| 52 |
|
|
#ifdef __GNUC__
|
| 53 |
|
|
#define COMPILER_VERSION "GCC"__VERSION__
|
| 54 |
|
|
#else
|
| 55 |
|
|
#define COMPILER_VERSION "Please put compiler version here (e.g. gcc 4.1)"
|
| 56 |
|
|
#endif
|
| 57 |
|
|
#endif
|
| 58 |
|
|
#ifndef COMPILER_FLAGS
|
| 59 |
|
|
#define COMPILER_FLAGS FLAGS_STR /* "Please put compiler flags here (e.g. -o3)" */
|
| 60 |
|
|
#endif
|
| 61 |
|
|
#ifndef MEM_LOCATION
|
| 62 |
|
|
#define MEM_LOCATION "STACK"
|
| 63 |
|
|
#endif
|
| 64 |
|
|
|
| 65 |
|
|
/* Data Types :
|
| 66 |
|
|
To avoid compiler issues, define the data types that need ot be used for 8b, 16b and 32b in <core_portme.h>.
|
| 67 |
|
|
|
| 68 |
|
|
*Imprtant* :
|
| 69 |
|
|
ee_ptr_int needs to be the data type used to hold pointers, otherwise coremark may fail!!!
|
| 70 |
|
|
*/
|
| 71 |
|
|
typedef signed short ee_s16;
|
| 72 |
|
|
typedef unsigned short ee_u16;
|
| 73 |
|
|
typedef signed int ee_s32;
|
| 74 |
|
|
typedef double ee_f32;
|
| 75 |
|
|
typedef unsigned char ee_u8;
|
| 76 |
|
|
typedef unsigned int ee_u32;
|
| 77 |
|
|
typedef ee_u32 ee_ptr_int;
|
| 78 |
|
|
typedef unsigned int ee_size_t;
|
| 79 |
|
|
#define NULL ((void *)0)
|
| 80 |
|
|
/* align_mem :
|
| 81 |
|
|
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.
|
| 82 |
|
|
*/
|
| 83 |
|
|
#define align_mem(x) (void *)(4 + (((ee_ptr_int)(x) - 1) & ~3))
|
| 84 |
|
|
|
| 85 |
|
|
/* Configuration : CORE_TICKS
|
| 86 |
|
|
Define type of return from the timing functions.
|
| 87 |
|
|
*/
|
| 88 |
|
|
#define CORETIMETYPE ee_u32
|
| 89 |
|
|
typedef ee_u32 CORE_TICKS;
|
| 90 |
|
|
|
| 91 |
|
|
/* Configuration : SEED_METHOD
|
| 92 |
|
|
Defines method to get seed values that cannot be computed at compile time.
|
| 93 |
|
|
|
| 94 |
|
|
Valid values :
|
| 95 |
|
|
SEED_ARG - from command line.
|
| 96 |
|
|
SEED_FUNC - from a system function.
|
| 97 |
|
|
SEED_VOLATILE - from volatile variables.
|
| 98 |
|
|
*/
|
| 99 |
|
|
#ifndef SEED_METHOD
|
| 100 |
|
|
#define SEED_METHOD SEED_VOLATILE
|
| 101 |
|
|
#endif
|
| 102 |
|
|
|
| 103 |
|
|
/* Configuration : MEM_METHOD
|
| 104 |
|
|
Defines method to get a block of memry.
|
| 105 |
|
|
|
| 106 |
|
|
Valid values :
|
| 107 |
|
|
MEM_MALLOC - for platforms that implement malloc and have malloc.h.
|
| 108 |
|
|
MEM_STATIC - to use a static memory array.
|
| 109 |
|
|
MEM_STACK - to allocate the data block on the stack (NYI).
|
| 110 |
|
|
*/
|
| 111 |
|
|
#ifndef MEM_METHOD
|
| 112 |
|
|
#define MEM_METHOD MEM_STACK
|
| 113 |
|
|
#endif
|
| 114 |
|
|
|
| 115 |
|
|
/* Configuration : MULTITHREAD
|
| 116 |
|
|
Define for parallel execution
|
| 117 |
|
|
|
| 118 |
|
|
Valid values :
|
| 119 |
|
|
1 - only one context (default).
|
| 120 |
|
|
N>1 - will execute N copies in parallel.
|
| 121 |
|
|
|
| 122 |
|
|
Note :
|
| 123 |
|
|
If this flag is defined to more then 1, an implementation for launching parallel contexts must be defined.
|
| 124 |
|
|
|
| 125 |
|
|
Two sample implementations are provided. Use <USE_PTHREAD> or <USE_FORK> to enable them.
|
| 126 |
|
|
|
| 127 |
|
|
It is valid to have a different implementation of <core_start_parallel> and <core_end_parallel> in <core_portme.c>,
|
| 128 |
|
|
to fit a particular architecture.
|
| 129 |
|
|
*/
|
| 130 |
|
|
#ifndef MULTITHREAD
|
| 131 |
|
|
#define MULTITHREAD 1
|
| 132 |
|
|
#define USE_PTHREAD 0
|
| 133 |
|
|
#define USE_FORK 0
|
| 134 |
|
|
#define USE_SOCKET 0
|
| 135 |
|
|
#endif
|
| 136 |
|
|
|
| 137 |
|
|
/* Configuration : MAIN_HAS_NOARGC
|
| 138 |
|
|
Needed if platform does not support getting arguments to main.
|
| 139 |
|
|
|
| 140 |
|
|
Valid values :
|
| 141 |
|
|
|
| 142 |
|
|
1 - argc/argv to main is not supported
|
| 143 |
|
|
|
| 144 |
|
|
Note :
|
| 145 |
|
|
This flag only matters if MULTITHREAD has been defined to a value greater then 1.
|
| 146 |
|
|
*/
|
| 147 |
|
|
#ifndef MAIN_HAS_NOARGC
|
| 148 |
|
|
#define MAIN_HAS_NOARGC 0
|
| 149 |
|
|
#endif
|
| 150 |
|
|
|
| 151 |
|
|
/* Configuration : MAIN_HAS_NORETURN
|
| 152 |
|
|
Needed if platform does not support returning a value from main.
|
| 153 |
|
|
|
| 154 |
|
|
Valid values :
|
| 155 |
|
|
|
| 156 |
|
|
1 - platform does not support returning a value from main
|
| 157 |
|
|
*/
|
| 158 |
|
|
#ifndef MAIN_HAS_NORETURN
|
| 159 |
|
|
#define MAIN_HAS_NORETURN 0
|
| 160 |
|
|
#endif
|
| 161 |
|
|
|
| 162 |
|
|
/* Variable : default_num_contexts
|
| 163 |
|
|
Not used for this simple port, must cintain the value 1.
|
| 164 |
|
|
*/
|
| 165 |
|
|
extern ee_u32 default_num_contexts;
|
| 166 |
|
|
|
| 167 |
|
|
typedef struct CORE_PORTABLE_S {
|
| 168 |
|
|
ee_u8 portable_id;
|
| 169 |
|
|
} core_portable;
|
| 170 |
|
|
|
| 171 |
|
|
/* target specific init/fini */
|
| 172 |
|
|
void portable_init(core_portable * p, int *argc, char *argv[]);
|
| 173 |
|
|
void portable_fini(core_portable * p);
|
| 174 |
|
|
|
| 175 |
|
|
#if !defined(PROFILE_RUN) && !defined(PERFORMANCE_RUN) && \
|
| 176 |
|
|
!defined(VALIDATION_RUN)
|
| 177 |
|
|
#if (TOTAL_DATA_SIZE==1200)
|
| 178 |
|
|
#define PROFILE_RUN 1
|
| 179 |
|
|
#elif (TOTAL_DATA_SIZE==2000)
|
| 180 |
|
|
#define PERFORMANCE_RUN 1
|
| 181 |
|
|
#else
|
| 182 |
|
|
#define VALIDATION_RUN 1
|
| 183 |
|
|
#endif
|
| 184 |
|
|
#endif
|
| 185 |
|
|
|
| 186 |
|
|
int ee_printf(const char *fmt, ...);
|
| 187 |
|
|
|
| 188 |
|
|
#endif /* CORE_PORTME_H */
|