using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Cosmos.Debug.Kernel;
using Cosmos.HAL;
using Debugger = Cosmos.Debug.Kernel.Debugger;
namespace Cosmos.System
{
///
/// Cosmos global class.
/// Used to init the console, screen and debugger and get/set keyboard keys.
///
public static class Global
{
///
/// Create new instance of the class.
///
static Global()
{
}
///
/// System ring debugger instance, with the tag "Global".
///
public static readonly Debugger mDebugger = DebuggerFactory.CreateDebugger("System", "Global");
///
/// System ring debugger instance, with the tag "FileSystem".
///
public static readonly Debugger mFileSystemDebugger = DebuggerFactory.CreateDebugger("System", "FileSystem");
///
/// Console instance.
///
public static Console Console;
///
/// Get and set keyboard NumLock value.
///
public static bool NumLock
{
get { return KeyboardManager.NumLock; }
set { KeyboardManager.NumLock = value; }
}
///
/// Get and set keyboard CapsLock value.
///
public static bool CapsLock
{
get { return KeyboardManager.CapsLock; }
set { KeyboardManager.CapsLock = value; }
}
///
/// Get and set keyboard ScrollLock value.
///
public static bool ScrollLock
{
get { return KeyboardManager.ScrollLock; }
set { KeyboardManager.ScrollLock = value; }
}
// TODO: continue adding exceptions to the list, as HAL and Core would be documented.
///
/// Init console, screen and keyboard.
///
/// A screen device.
public static void Init(TextScreenBase textScreen)
{
// We must init Console before calling Inits.
// This is part of the "minimal" boot to allow output.
mDebugger.Send("Creating Console");
if (textScreen != null)
{
Console = new Console(textScreen);
}
mDebugger.Send("Creating Keyboard");
mDebugger.Send("HW Init");
HAL.Global.Init(textScreen);
Network.NetworkStack.Init();
mDebugger.Send("Network Stack Init");
NumLock = false;
CapsLock = false;
ScrollLock = false;
}
///
/// Change keyboard layout. Initially set to US_Standard.
///
/// Currently available:
///
/// - US_Standard.
/// - FR_Standard.
/// - DE_Standard.
/// - TR_StandardQ.
///
///
///
/// A key mapping.
public static void ChangeKeyLayout(ScanMapBase scanMap)
{
KeyboardManager.SetKeyLayout(scanMap);
}
}
}