diff options
Diffstat (limited to 'src/aplos.h')
-rw-r--r-- | src/aplos.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/aplos.h b/src/aplos.h new file mode 100644 index 0000000..4e663f4 --- /dev/null +++ b/src/aplos.h @@ -0,0 +1,57 @@ +#include <stdint.h> +#include <stddef.h> +#include <stdarg.h> +#include <uchar.h> + +#define nelem(arr) (sizeof(arr)/sizeof(*(arr))) + +struct framebuffer +{ + void *addr; + uint64_t width; + uint64_t height; + uint64_t pitch; +}; + +struct memmap +{ + uintptr_t start; + uint64_t size; +}; + +struct boot_info +{ + struct framebuffer framebuffer; + uint64_t memmap_count; + struct memmap *memmaps; +}; + +/* boot.c */ +uint64_t cpu_count(void); + +/* main.c */ +void main(struct boot_info *); +#define ASSERT(chk) do{if(!(chk)) halt();}while(0) + +/* screen.c */ +void screen_init(struct framebuffer *); +void screen_draw_pixel(uint32_t, uint32_t, uint32_t); +void print(char8_t *, ...); + +/* font.c */ +void font_init(void); +void font_draw(char8_t *, uint32_t, uint32_t, uint32_t, uint32_t); + +/* util.c */ +uint16_t read_uint16_le(const uint8_t *); +uint16_t read_uint16_be(const uint8_t *); +uint32_t read_uint32_le(const uint8_t *); +int memcmp(const void *, const void *, size_t); + +/* utf8.c */ +int utf8_char_length(const char8_t *); +int utf8_cmp_n(const char8_t *, const char8_t *, uint64_t); +uint32_t utf8_value(const char8_t *); + +/* nasty.S */ +extern void halt(void); |