mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-12 19:04:59 +00:00
Change-Id: I4d6c6810b91294a7e401a4a1a446218c04c98e55 Signed-off-by: Jonathan Neuschäfer <j.neuschaefer@gmx.net> Reviewed-on: https://review.coreboot.org/21590 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Mario Scheithauer <mario.scheithauer@siemens.com>
39 lines
1.0 KiB
C
39 lines
1.0 KiB
C
/*
|
|
* This file is part of the coreboot project.
|
|
*
|
|
* Copyright 2014 Google Inc.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; version 2 of the License.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*/
|
|
|
|
#include <console/console.h>
|
|
#include <timer.h>
|
|
#include <delay.h>
|
|
#include <thread.h>
|
|
|
|
__attribute__((weak)) void init_timer(void) { /* do nothing */ }
|
|
|
|
void udelay(unsigned int usec)
|
|
{
|
|
struct stopwatch sw;
|
|
|
|
/*
|
|
* As the timer granularity is in microseconds pad the
|
|
* requested delay by one to get at least >= requested usec delay.
|
|
*/
|
|
usec += 1;
|
|
|
|
if (!thread_yield_microseconds(usec))
|
|
return;
|
|
|
|
stopwatch_init_usecs_expire(&sw, usec);
|
|
stopwatch_wait_until_expired(&sw);
|
|
}
|