// -*- C++ -*- #ifndef __traits_h #define __traits_h // This work is licensed under the Creative Commons // Attribution-NonCommercial-NoDerivs License. To view a copy of this license, // visit http://creativecommons.org/licenses/by-nc-nd/2.0/ or send a letter to // Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. #include __BEGIN_SYS template struct Traits { static const bool debugged = false; }; class Null_Debug; template <> struct Traits { static const bool error = false; static const bool warning = false; static const bool info = false; static const bool trace = false; }; class Debug; template <> struct Traits: public Traits { static const bool error = true; static const bool warning = true; static const bool info = true; static const bool trace = true; }; // System parts template <> struct Traits: public Traits { }; template <> struct Traits: public Traits { }; template <> struct Traits: public Traits { }; template <> struct Traits: public Traits { }; template <> struct Traits: public Traits { }; // Mediators template <> struct Traits: public Traits { static const int CLOCK = 1000000000; }; template <> struct Traits: public Traits { static const long CLOCK = 16000000; }; template <> struct Traits: public Traits { static const int CLOCK = 200000000; }; template <> struct Traits: public Traits { static const bool fast_log_to_phy = false; }; template <> struct Traits: public Traits { static const bool fast_log_to_phy = false; }; template <> struct Traits: public Traits { static const bool fast_log_to_phy = false; }; template <> struct Traits: public Traits { static const bool fast_log_to_phy = false; }; template <> struct Traits: public Traits { static const unsigned int EPOCH_DAY = 1; static const unsigned int EPOCH_MONTH = 1; static const unsigned int EPOCH_YEAR = 1970; static const unsigned int EPOCH_DAYS = 719499; }; template <> struct Traits: public Traits { static const unsigned int BOOT_IMAGE_ADDR = 0x00008000; static const int INT_BASE = 0x20; static const int SYSCALL_INT = 0x80; static const unsigned int SYSTEM_STACK_SIZE = 4096; static const unsigned int SYSTEM_HEAP_SIZE = 4096; static const unsigned int APPLICATION_STACK_SIZE = 4096; static const unsigned int APPLICATION_HEAP_SIZE = 100 * 4096; }; template <> struct Traits: public Traits { static const unsigned int CLOCK = 1843200; // 1.8432 MHz static const unsigned int COM1 = 0x3f8; // to 0x3ff, IRQ4 static const unsigned int COM2 = 0x2f8; // to 0x2ff, IRQ3 static const unsigned int COM3 = 0x3e8; // to 0x3ef, no IRQ static const unsigned int COM4 = 0x2e8; // to 0x2ef, no IRQ }; template <> struct Traits: public Traits { static const unsigned int BOOT_IMAGE_ADDR = 0x8080; static const int INT_BASE = 0x0A; static const unsigned int SYSTEM_STACK_SIZE = 512; static const unsigned int SYSTEM_HEAP_SIZE = 512; static const unsigned int APPLICATION_STACK_SIZE = 512; static const unsigned int APPLICATION_HEAP_SIZE = 512; }; template <> struct Traits: public Traits { static const unsigned int BOOT_IMAGE_ADDR = 0x0180; static const int INT_BASE = 0x00; static const unsigned int SYSTEM_HEAP_SIZE = 4096; static const unsigned int SYSTEM_STACK_SIZE = 4096; static const unsigned int APPLICATION_STACK_SIZE = 4096; static const unsigned int APPLICATION_HEAP_SIZE = 4096; }; template <> struct Traits: public Traits { static const unsigned int BOOT_IMAGE_ADDR = 0x0000; static const int INT_BASE = 0x00; static const unsigned int SYSTEM_STACK_SIZE = 128; static const unsigned int SYSTEM_HEAP_SIZE = 64; static const unsigned int APPLICATION_STACK_SIZE = 64; static const unsigned int APPLICATION_HEAP_SIZE = 64; }; template <> struct Traits: public Traits { static const int MAX_BUS = 0; static const int MAX_DEV_FN = 0xff; }; template <> struct Traits: public Traits { static const int FREQUENCY = 100; // Hz }; template <> struct Traits: public Traits { static const bool on_serial = false; static const int COLUMNS = 80; static const int LINES = 25; static const int TAB_SIZE = 8; static const unsigned int FRAME_BUFFER_ADDRESS = 0xb8000; }; template <> struct Traits: public Traits { static const int COLUMNS = 5; static const int LINES = 1; static const int TAB_SIZE = 8; static const unsigned int FRAME_BUFFER_ADDRESS = 0xef43; static const int DIGIT_SEGMENTS = 7; static const int SCROLL_DELAY = 2; /* (1)=FAST (2)=MEDIUM (3)=SLOW */ }; // Abstractions template <> struct Traits: public Traits { static const bool visible = false; }; template <> struct Traits: public Traits { static const bool busy_waiting = false; static const bool active_scheduler = true; static const unsigned int quantum = 500000; // us static const bool preemptive = true; // static const bool debugged = true; //static const bool trace = true; }; __END_SYS #endif