| 1 |
#ifndef UTIL_H |
| 2 |
#define UTIL_H |
| 3 |
|
| 4 |
#include <acpi2_0.h> |
| 5 |
|
| 6 |
void outb(uint16_t addr, uint8_t val); |
| 7 |
void outw(uint16_t addr, uint16_t val); |
| 8 |
void outl(uint16_t addr, uint32_t val); |
| 9 |
uint8_t inb(uint16_t addr); |
| 10 |
uint16_t inw(uint16_t addr); |
| 11 |
uint32_t inl(uint16_t addr); |
| 12 |
void mssleep(uint32_t time); |
| 13 |
|
| 14 |
char *itoa(char *a, unsigned int i); |
| 15 |
int strcmp(const char *cs, const char *ct); |
| 16 |
int strncmp(const char *s1, const char *s2, uint32_t n); |
| 17 |
void *memcpy(void *dest, const void *src, unsigned n); |
| 18 |
void *memmove(void *dest, const void *src, unsigned n); |
| 19 |
char *strcpy(char *dest, const char *src); |
| 20 |
char *strncpy(char *dest, const char *src, unsigned n); |
| 21 |
unsigned strlen(const char *s); |
| 22 |
void * memset(void *s, int c, unsigned n); |
| 23 |
int memcmp(const void *s1, const void *s2, unsigned n); |
| 24 |
void cpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx); |
| 25 |
void byte_to_hex(char *digits, uint8_t byte); |
| 26 |
void uuid_to_string(char *dest, uint8_t *uuid); |
| 27 |
int printf(const char *fmt, ...); |
| 28 |
|
| 29 |
static inline uint8_t mmio_readb(uint8_t *addr) |
| 30 |
{ |
| 31 |
return *(volatile uint8_t *)addr; |
| 32 |
} |
| 33 |
|
| 34 |
static inline uint16_t mmio_readw(uint16_t *addr) |
| 35 |
{ |
| 36 |
return *(volatile uint16_t *)addr; |
| 37 |
} |
| 38 |
|
| 39 |
static inline uint32_t mmio_readl(uint32_t *addr) |
| 40 |
{ |
| 41 |
return *(volatile uint32_t *)addr; |
| 42 |
} |
| 43 |
|
| 44 |
struct acpi_20_rsdp *find_rsdp(void); |
| 45 |
|
| 46 |
#endif |