00001 #ifndef __traits_h
00002 #define __traits_h
00003
00004
00005
00006
00007
00008
00009 #include <system/config.h>
00010
00011 __BEGIN_SYS
00012
00013 template <class Imp>
00014 struct Traits
00015 {
00016 static const bool debugged = false;
00017 };
00018
00019 class Null_Debug;
00020 template <> struct Traits<Null_Debug>
00021 {
00022 static const bool error = false;
00023 static const bool warning = false;
00024 static const bool info = false;
00025 static const bool trace = false;
00026 };
00027
00028 class Debug;
00029 template <> struct Traits<Debug>: public Traits<Null_Debug>
00030 {
00031 static const bool error = true;
00032 static const bool warning = true;
00033 static const bool info = true;
00034 static const bool trace = true;
00035 };
00036
00037
00038 template <> struct Traits<Boot>: public Traits<void>
00039 {
00040 };
00041
00042 template <> struct Traits<Setup>: public Traits<void>
00043 {
00044 };
00045
00046 template <> struct Traits<Init>: public Traits<void>
00047 {
00048 };
00049
00050 template <> struct Traits<System>: public Traits<void>
00051 {
00052 };
00053
00054 template <> struct Traits<Framework>: public Traits<void>
00055 {
00056 };
00057
00058
00059 template <> struct Traits<IA32>: public Traits<void>
00060 {
00061 static const int CLOCK = 1000000000;
00062 };
00063
00064 template <> struct Traits<H8>: public Traits<void>
00065 {
00066 static const long CLOCK = 16000000;
00067 };
00068
00069 template <> struct Traits<PPC32>: public Traits<void>
00070 {
00071 static const int CLOCK = 200000000;
00072 };
00073
00074 template <> struct Traits<IA32_MMU>: public Traits<void>
00075 {
00076 static const bool fast_log_to_phy = false;
00077 };
00078
00079 template <> struct Traits<H8_MMU>: public Traits<void>
00080 {
00081 static const bool fast_log_to_phy = false;
00082 };
00083
00084 template <> struct Traits<AVR8_MMU>: public Traits<void>
00085 {
00086 static const bool fast_log_to_phy = false;
00087 };
00088
00089 template <> struct Traits<PPC32_MMU>: public Traits<void>
00090 {
00091 static const bool fast_log_to_phy = false;
00092 };
00093
00094 template <> struct Traits<PC_RTC>: public Traits<void>
00095 {
00096 static const unsigned int EPOCH_DAY = 1;
00097 static const unsigned int EPOCH_MONTH = 1;
00098 static const unsigned int EPOCH_YEAR = 1970;
00099 static const unsigned int EPOCH_DAYS = 719499;
00100 };
00101
00102 template <> struct Traits<PC>: public Traits<void>
00103 {
00104 static const unsigned int BOOT_IMAGE_ADDR = 0x00008000;
00105 static const int INT_BASE = 0x20;
00106 static const int SYSCALL_INT = 0x80;
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119 static const unsigned int APPLICATION_STACK_SIZE = 16 * 1024;
00120 static const unsigned int APPLICATION_HEAP_SIZE = 16 * 1024 * 1024;
00121
00122 static const unsigned int SYSTEM_STACK_SIZE = 4096;
00123 static const unsigned int SYSTEM_HEAP_SIZE = 16 * APPLICATION_STACK_SIZE;
00124 };
00125
00126 template <> struct Traits<PC_UART>: public Traits<void>
00127 {
00128 static const unsigned int CLOCK = 1843200;
00129 static const unsigned int COM1 = 0x3f8;
00130 static const unsigned int COM2 = 0x2f8;
00131 static const unsigned int COM3 = 0x3e8;
00132 static const unsigned int COM4 = 0x2e8;
00133 };
00134
00135 template <> struct Traits<RCX>: public Traits<void>
00136 {
00137 static const unsigned int BOOT_IMAGE_ADDR = 0x8080;
00138 static const int INT_BASE = 0x0A;
00139
00140 static const unsigned int SYSTEM_STACK_SIZE = 512;
00141 static const unsigned int SYSTEM_HEAP_SIZE = 512;
00142 static const unsigned int APPLICATION_STACK_SIZE = 512;
00143 static const unsigned int APPLICATION_HEAP_SIZE = 512;
00144 };
00145
00146 template <> struct Traits<Khomp>: public Traits<void>
00147 {
00148 static const unsigned int BOOT_IMAGE_ADDR = 0x0180;
00149 static const int INT_BASE = 0x00;
00150
00151 static const unsigned int SYSTEM_HEAP_SIZE = 4096;
00152 static const unsigned int SYSTEM_STACK_SIZE = 4096;
00153 static const unsigned int APPLICATION_STACK_SIZE = 4096;
00154 static const unsigned int APPLICATION_HEAP_SIZE = 4096;
00155 };
00156
00157 template <> struct Traits<AT90S>: public Traits<void>
00158 {
00159 static const unsigned int BOOT_IMAGE_ADDR = 0x0000;
00160 static const int INT_BASE = 0x00;
00161
00162 static const unsigned int SYSTEM_STACK_SIZE = 128;
00163 static const unsigned int SYSTEM_HEAP_SIZE = 64;
00164 static const unsigned int APPLICATION_STACK_SIZE = 64;
00165 static const unsigned int APPLICATION_HEAP_SIZE = 64;
00166 };
00167
00168 template <> struct Traits<PC_PCI>: public Traits<void>
00169 {
00170 static const int MAX_BUS = 0;
00171 static const int MAX_DEV_FN = 0xff;
00172 };
00173
00174 template <> struct Traits<PC_Timer>: public Traits<void>
00175 {
00176 static const int FREQUENCY = 100;
00177 };
00178
00179 template <> struct Traits<PC_Display>: public Traits<void>
00180 {
00181 static const bool on_serial = true;
00182 static const int COLUMNS = 80;
00183 static const int LINES = 25;
00184 static const int TAB_SIZE = 8;
00185 static const unsigned int FRAME_BUFFER_ADDRESS = 0xb8000;
00186 };
00187
00188 template <> struct Traits<RCX_Display>: public Traits<void>
00189 {
00190 static const int COLUMNS = 5;
00191 static const int LINES = 1;
00192 static const int TAB_SIZE = 8;
00193 static const unsigned int FRAME_BUFFER_ADDRESS = 0xef43;
00194 static const int DIGIT_SEGMENTS = 7;
00195 static const int SCROLL_DELAY = 2;
00196 };
00197
00198
00199 template <> struct Traits<Alarm>: public Traits<void>
00200 {
00201 static const bool visible = false;
00202 };
00203
00204 template <> struct Traits<Thread>: public Traits<void>
00205 {
00206 static const bool busy_waiting = false;
00207 static const bool active_scheduler = true;
00208 static const unsigned int quantum = 500000;
00209 static const bool preemptive = true;
00210 static const unsigned int STACK_CACHE_SIZE = 4;
00211 };
00212
00213 __END_SYS
00214
00215 #endif