From cf138201c24fdc83ee7835b65cce67e7d7a85e70 Mon Sep 17 00:00:00 2001 From: Patrick Williams Date: Tue, 18 May 2010 15:55:03 -0500 Subject: Create simple console. --- src/include/kernel/console.H | 25 +++++++++++++++++++++++++ src/include/stdint.h | 17 +++++++++++++++++ src/include/string.h | 17 +++++++++++++++++ src/include/util/singleton.H | 18 ++++++++++++++++++ 4 files changed, 77 insertions(+) create mode 100644 src/include/kernel/console.H create mode 100644 src/include/stdint.h create mode 100644 src/include/string.h create mode 100644 src/include/util/singleton.H (limited to 'src/include') diff --git a/src/include/kernel/console.H b/src/include/kernel/console.H new file mode 100644 index 000000000..4c5f7a52a --- /dev/null +++ b/src/include/kernel/console.H @@ -0,0 +1,25 @@ +#ifndef __KERNEL_CONSOLE_H +#define __KERNEL_CONSOLE_H + +#include +#include + +void printk(const char*); + +class Console +{ + public: + int putc(int); + + enum { BUFFER_SIZE = 1024 * 4 }; + + protected: + Console(); + ~Console() {}; + + private: + char * iv_buffer; + size_t iv_pos; +}; + +#endif diff --git a/src/include/stdint.h b/src/include/stdint.h new file mode 100644 index 000000000..350f4c3da --- /dev/null +++ b/src/include/stdint.h @@ -0,0 +1,17 @@ +#ifndef __STDINT_H +#define __STDINT_H + +typedef char int8_t; +typedef short int int16_t; +typedef long int int32_t; +typedef long long int int64_t; + +typedef unsigned char uint8_t; +typedef unsigned short int uint16_t; +typedef unsigned long int uint32_t; +typedef unsigned long long int uint64_t; + +typedef uint64_t size_t; +typedef int64_t ssize_t; + +#endif diff --git a/src/include/string.h b/src/include/string.h new file mode 100644 index 000000000..f1465a4c0 --- /dev/null +++ b/src/include/string.h @@ -0,0 +1,17 @@ +#ifndef __STRING_H +#define __STRING_H + +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + + void* memset(void* s, int c, size_t n); + +#ifdef __cplusplus +}; +#endif + +#endif diff --git a/src/include/util/singleton.H b/src/include/util/singleton.H new file mode 100644 index 000000000..f448303df --- /dev/null +++ b/src/include/util/singleton.H @@ -0,0 +1,18 @@ +#ifndef __UTIL_SINGLETON_H +#define __UTIL_SINGLETON_H + +template +class Singleton : private _T +{ + public: + static _T& instance() + { + static Singleton<_T> instance; + return instance; + }; + + private: + Singleton() : _T() {}; +}; + +#endif -- cgit v1.2.1