From e825cb53bba8536afd9510446a15433ffca6e695 Mon Sep 17 00:00:00 2001 From: garritfra Date: Sun, 17 Mar 2019 15:10:04 +0100 Subject: [PATCH] Add ifndefs to header files --- fb.h | 6 +++--- io.h | 20 ++++++++++++++++++++ kmain.h | 7 ++++++- 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 io.h diff --git a/fb.h b/fb.h index 7469fb6..bcde8b8 100644 --- a/fb.h +++ b/fb.h @@ -1,5 +1,5 @@ -#ifndef INCLUDE_IO_H -#define INCLUDE_IO_H +#ifndef INCLUDE_FRAMEBUFFER +#define INCLUDE_FRAMEBUFFER /* The I/O ports */ #define FB_COMMAND_PORT 0x3D4 @@ -11,7 +11,7 @@ int write(char *buf, unsigned int len); -extern void outb(unsigned short port, unsigned char data); + /** fb_write_cell: * Writes a character with the given foreground and background to position i diff --git a/io.h b/io.h new file mode 100644 index 0000000..9f20745 --- /dev/null +++ b/io.h @@ -0,0 +1,20 @@ +#ifndef INCLUDE_IO +#define INCLUDE_IO + + +/** outb + * Write bytes to an I/O port. + * + * @param port The address of the I/O port + */ +extern void outb(unsigned short port, unsigned char data); + +/** inb: + * Read a byte from an I/O port. + * + * @param port The address of the I/O port + * @return The read byte + */ +unsigned char inb(unsigned short port); + +#endif \ No newline at end of file diff --git a/kmain.h b/kmain.h index ec107a6..a8b2b1d 100644 --- a/kmain.h +++ b/kmain.h @@ -1 +1,6 @@ -int main(); \ No newline at end of file +#ifndef INCLUDE_MAIN +#define INCLUDE_MAIN + +int main(); + +#endif \ No newline at end of file