| 15 | #define CYC_PER_10MHZ 1E7 |
| 16 | |
| 17 | void |
| 18 | rte_delay_us_sleep(unsigned int us) |
| 19 | { |
| 20 | HANDLE timer; |
| 21 | LARGE_INTEGER due_time; |
| 22 | |
| 23 | /* create waitable timer */ |
| 24 | timer = CreateWaitableTimer(NULL, TRUE, NULL); |
| 25 | if (!timer) { |
| 26 | RTE_LOG_WIN32_ERR("CreateWaitableTimer()"); |
| 27 | rte_errno = ENOMEM; |
| 28 | return; |
| 29 | } |
| 30 | |
| 31 | /* |
| 32 | * due_time's uom is 100 ns, multiply by 10 to convert to microseconds |
| 33 | * set us microseconds time for timer |
| 34 | */ |
| 35 | due_time.QuadPart = -((int64_t)us * 10); |
| 36 | if (!SetWaitableTimer(timer, &due_time, 0, NULL, NULL, FALSE)) { |
| 37 | RTE_LOG_WIN32_ERR("SetWaitableTimer()"); |
| 38 | rte_errno = EINVAL; |
| 39 | goto end; |
| 40 | } |
| 41 | /* start wait for timer for us microseconds */ |
| 42 | if (WaitForSingleObject(timer, INFINITE) == WAIT_FAILED) { |
| 43 | RTE_LOG_WIN32_ERR("WaitForSingleObject()"); |
| 44 | rte_errno = EINVAL; |
| 45 | } |
| 46 | |
| 47 | end: |
| 48 | CloseHandle(timer); |
| 49 | } |
| 50 | |
| 51 | uint64_t |
| 52 | get_tsc_freq(void) |
no outgoing calls