14
14
#include <misc/printk.h>
15
15
#include <arch/cpu.h>
16
16
#include <tc_util.h>
17
+ #if defined(CONFIG_ARCH_POSIX )
18
+ #include "posix_board_if.h"
19
+ #endif
17
20
18
21
#define STACKSIZE 4096
19
22
#define PRIORITY 6
@@ -39,13 +42,17 @@ extern s32_t _sys_idle_threshold_ticks;
39
42
* timestamp routines.
40
43
*/
41
44
42
- #if defined(CONFIG_X86 ) || defined(CONFIG_ARC )
45
+ #if defined(CONFIG_X86 ) || defined(CONFIG_ARC ) || defined( CONFIG_ARCH_POSIX )
43
46
typedef u64_t _timer_res_t ;
44
47
#define _TIMER_ZERO 0ULL
45
48
46
49
/* timestamp routines */
47
50
#define _TIMESTAMP_OPEN ()
51
+ #if defined(CONFIG_ARCH_POSIX )
52
+ #define _TIMESTAMP_READ () (posix_get_hw_cycle())
53
+ #else
48
54
#define _TIMESTAMP_READ () (_tsc_read())
55
+ #endif
49
56
#define _TIMESTAMP_CLOSE ()
50
57
51
58
#elif defined(CONFIG_ARM )
@@ -124,6 +131,8 @@ void ticklessTestThread(void)
124
131
#if defined(CONFIG_X86 ) || defined(CONFIG_ARC )
125
132
printk ("Calibrated time stamp period = 0x%x%x\n" ,
126
133
(u32_t )(cal_tsc >> 32 ), (u32_t )(cal_tsc & 0xFFFFFFFFLL ));
134
+ #elif defined(CONFIG_ARCH_POSIX )
135
+ printk ("Calibrated time stamp period = %llu\n" , cal_tsc );
127
136
#elif defined(CONFIG_ARM )
128
137
printk ("Calibrated time stamp period = 0x%x\n" , cal_tsc );
129
138
#endif
@@ -169,6 +178,9 @@ void ticklessTestThread(void)
169
178
(u32_t )(diff_tsc >> 32 ), (u32_t )(diff_tsc & 0xFFFFFFFFULL ));
170
179
printk ("Cal time stamp: 0x%x%x\n" ,
171
180
(u32_t )(cal_tsc >> 32 ), (u32_t )(cal_tsc & 0xFFFFFFFFLL ));
181
+ #elif defined(CONFIG_ARCH_POSIX )
182
+ printk ("diff time stamp: %llu\n" , diff_tsc );
183
+ printk ("Cal time stamp: %llu\n" , cal_tsc );
172
184
#elif defined(CONFIG_ARM ) || defined(CONFIG_SOC_QUARK_SE_C1000_SS )
173
185
printk ("diff time stamp: 0x%x\n" , diff_tsc );
174
186
printk ("Cal time stamp: 0x%x\n" , cal_tsc );
@@ -192,10 +204,6 @@ void ticklessTestThread(void)
192
204
/* release the timer, if necessary */
193
205
_TIMESTAMP_CLOSE ();
194
206
195
- while (1 ) {
196
- ;
197
- }
198
-
199
207
}
200
208
201
209
void test_tickless (void )
0 commit comments