coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
timer.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <timer.h>
4 #include <delay.h>
5 #include <thread.h>
6 
7 __weak void init_timer(void) { /* do nothing */ }
8 
9 void udelay(unsigned int usec)
10 {
11  struct stopwatch sw;
12 
13  /*
14  * As the timer granularity is in microseconds pad the
15  * requested delay by one to get at least >= requested usec delay.
16  */
17  usec += 1;
18 
19  if (!thread_yield_microseconds(usec))
20  return;
21 
22  stopwatch_init_usecs_expire(&sw, usec);
24 }
static void stopwatch_wait_until_expired(struct stopwatch *sw)
Definition: timer.h:161
static void stopwatch_init_usecs_expire(struct stopwatch *sw, long us)
Definition: timer.h:127
int thread_yield_microseconds(unsigned int microsecs)
Definition: thread.c:342
__weak void init_timer(void)
Definition: timer.c:7
void udelay(unsigned int usec)
Definition: timer.c:9
const struct smm_save_state_ops *legacy_ops __weak
Definition: save_state.c:8