-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtime.c
35 lines (32 loc) · 851 Bytes
/
time.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
* =====================================================================================
*
* Filename: time.c
*
* Description:
*
* Version: 1.0
* Created: 16.11.2011 13:52:55
* Revision: none
* Compiler: gcc
*
* Author: Georg Wassen (gw) (),
* Company:
*
* =====================================================================================
*/
#include "info.h"
#include "smp.h"
void udelay(unsigned long us)
{
uint64_t tsc_now, tsc_end;
smp_status(STATUS_DELAY);
tsc_now = rdtsc();
//printf("tsc %u, tsc_per_usec = %u\n", tsc_now, hw_info.tsc_per_usec);
tsc_end = tsc_now + (us * hw_info.tsc_per_usec);
while (tsc_now < tsc_end) {
tsc_now = rdtsc();
//printf("tsc %lu\n", tsc_now.u64);
}
smp_status(STATUS_RUNNING);
}