mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-13 06:29:47 -04:00
Use the counter for stall
This commit is contained in:
parent
3e168e192d
commit
32c906fde6
@ -166,11 +166,11 @@ void AcpiOsSleep(UINT64 ms){
|
|||||||
* \brief Active sleep for the given number of microseconds
|
* \brief Active sleep for the given number of microseconds
|
||||||
*/
|
*/
|
||||||
void AcpiOsStall(UINT32 us){
|
void AcpiOsStall(UINT32 us){
|
||||||
auto ticks = timer::ticks();
|
uint64_t c = timer::counter();
|
||||||
auto wait = us * (timer::timer_frequency() / 1000000);
|
uint64_t wait = us * (timer::counter_frequency() / double(1000000));
|
||||||
wait = !wait ? 1 : wait;
|
wait = !wait ? 1 : wait;
|
||||||
|
|
||||||
while(timer::ticks() != ticks + wait){
|
while(timer::counter() != c + wait){
|
||||||
asm volatile("nop");
|
asm volatile("nop");
|
||||||
asm volatile("nop");
|
asm volatile("nop");
|
||||||
asm volatile("nop");
|
asm volatile("nop");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user