[PATCH]: libpayload: Document the architecture specific routines
No code changes. Signed-off-by: Jordan Crouse <jordan.crouse@amd.com> Acked-by: Jordan Crouse <jordan.crouse@amd.com> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3552 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
@ -27,9 +27,17 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/** @file i386/timer.c
|
||||||
|
* @brief i386 specific timer routines
|
||||||
|
*/
|
||||||
|
|
||||||
#include <libpayload.h>
|
#include <libpayload.h>
|
||||||
#include <arch/rdtsc.h>
|
#include <arch/rdtsc.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup arch
|
||||||
|
* Global variable containing the speed of the processor in KHz
|
||||||
|
*/
|
||||||
u32 cpu_khz;
|
u32 cpu_khz;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,21 +80,39 @@ static inline void _delay(unsigned int delta)
|
|||||||
while (rdtsc() < timeout) ;
|
while (rdtsc() < timeout) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delay for a specified number of nanoseconds
|
||||||
|
* @param n Number of nanoseconds to delay for
|
||||||
|
*/
|
||||||
void ndelay(unsigned int n)
|
void ndelay(unsigned int n)
|
||||||
{
|
{
|
||||||
_delay(n * cpu_khz / 1000000);
|
_delay(n * cpu_khz / 1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delay for a specified number of microseconds
|
||||||
|
* @param n Number of microseconds to delay for
|
||||||
|
*/
|
||||||
void udelay(unsigned int n)
|
void udelay(unsigned int n)
|
||||||
{
|
{
|
||||||
_delay(n * cpu_khz / 1000);
|
_delay(n * cpu_khz / 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delay for a specified number of milliseconds
|
||||||
|
* @param n Number of milliseconds to delay for
|
||||||
|
*/
|
||||||
|
|
||||||
void mdelay(unsigned int m)
|
void mdelay(unsigned int m)
|
||||||
{
|
{
|
||||||
_delay(m * cpu_khz);
|
_delay(m * cpu_khz);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delay for a specified number of seconds
|
||||||
|
* @param n Number of seconds to delay for
|
||||||
|
*/
|
||||||
|
|
||||||
void delay(unsigned int s)
|
void delay(unsigned int s)
|
||||||
{
|
{
|
||||||
_delay(s * cpu_khz * 1000);
|
_delay(s * cpu_khz * 1000);
|
||||||
|
@ -244,6 +244,7 @@ long int labs(long int j);
|
|||||||
long long int llabs(long long int j);
|
long long int llabs(long long int j);
|
||||||
u8 bin2hex(u8 b);
|
u8 bin2hex(u8 b);
|
||||||
u8 hex2bin(u8 h);
|
u8 hex2bin(u8 h);
|
||||||
|
void fatal(const char* msg) __attribute__ ((noreturn));
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -398,6 +399,8 @@ int lfclose(struct LFILE *file);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup arch Architecture Specific Functions
|
* @defgroup arch Architecture Specific Functions
|
||||||
|
* This modules contains global architecure specific functions.
|
||||||
|
* All architectures are expected to define these functions.
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
int get_coreboot_info(struct sysinfo_t *info);
|
int get_coreboot_info(struct sysinfo_t *info);
|
||||||
@ -411,9 +414,13 @@ void udelay(unsigned int n);
|
|||||||
void mdelay(unsigned int n);
|
void mdelay(unsigned int n);
|
||||||
void delay(unsigned int n);
|
void delay(unsigned int n);
|
||||||
|
|
||||||
#define abort() halt()
|
#define abort() halt() /**< Alias for the halt() function */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stops executions and halts the processor. This function does
|
||||||
|
* not return.
|
||||||
|
*/
|
||||||
void halt(void) __attribute__ ((noreturn));
|
void halt(void) __attribute__ ((noreturn));
|
||||||
void fatal(const char* msg) __attribute__ ((noreturn));
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user