-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4218a41
commit 2dd0ddb
Showing
39 changed files
with
1,296 additions
and
381 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
using System; | ||
|
||
namespace Mosa.BareMetal.HelloWorld.Apps; | ||
|
||
public class Clear : IApp | ||
{ | ||
public string Name => "Clear"; | ||
|
||
public string Description => "Clears the screen."; | ||
|
||
public void Execute() | ||
{ | ||
Console.Clear(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
using System; | ||
|
||
namespace Mosa.BareMetal.HelloWorld.Apps; | ||
|
||
public class Credits : IApp | ||
{ | ||
public string Name => "Credits"; | ||
|
||
public string Description => "Shows everyone who contributed to the project."; | ||
|
||
public void Execute() | ||
{ | ||
Console.WriteLine("*** MOSA Credits ****"); | ||
Console.WriteLine(" Phil Garcia"); | ||
Console.WriteLine(" Simon Wollwage"); | ||
Console.WriteLine(" Michael Frohlich"); | ||
Console.WriteLine(" Stefan Andres Charsley"); | ||
Console.WriteLine(" Chin Ki Yuen"); | ||
Console.WriteLine(" Patrick Reisert"); | ||
Console.WriteLine(" Phillip Webster"); | ||
Console.WriteLine(" Kevin Thompson"); | ||
Console.WriteLine(" Kai P.Reisert"); | ||
Console.WriteLine(" M.de Bruijn"); | ||
Console.WriteLine(" Royce Mitchell III"); | ||
Console.WriteLine(" Sebastian Loncar"); | ||
Console.WriteLine(" AnErrupTion"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
using System; | ||
|
||
namespace Mosa.BareMetal.HelloWorld.Apps; | ||
|
||
public class Help : IApp | ||
{ | ||
public string Name => "Help"; | ||
|
||
public string Description => "Shows information about all commands."; | ||
|
||
public void Execute() | ||
{ | ||
foreach (var app in AppManager.Applications) | ||
Console.WriteLine(app.Name + " - " + app.Description); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
using System; | ||
using Mosa.Kernel.BareMetal; | ||
|
||
namespace Mosa.BareMetal.HelloWorld.Apps; | ||
|
||
public class Mem : IApp | ||
{ | ||
public string Name => "Mem"; | ||
|
||
public string Description => "Shows memory information."; | ||
|
||
public void Execute() | ||
{ | ||
Console.WriteLine("**** Memory ****"); | ||
Console.WriteLine(" Total Pages : " + PageFrameAllocator.TotalPages); | ||
Console.WriteLine(" Used Pages : " + PageFrameAllocator.UsedPages); | ||
Console.WriteLine(" Page Size : " + Page.Size); | ||
Console.WriteLine(" Free Memory : " + (PageFrameAllocator.TotalPages - PageFrameAllocator.UsedPages) * Page.Size / (1024 * 1024) + " MB"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
using System; | ||
using Mosa.DeviceSystem; | ||
using Mosa.DeviceSystem.Service; | ||
|
||
namespace Mosa.BareMetal.HelloWorld.Apps; | ||
|
||
public class Reboot : IApp | ||
{ | ||
public string Name => "Reboot"; | ||
|
||
public string Description => "Reboots the computer."; | ||
|
||
public void Execute() | ||
{ | ||
Console.WriteLine("Rebooting..."); | ||
|
||
var pc = Kernel.BareMetal.Kernel.ServiceManager.GetFirstService<PCService>(); | ||
pc.Reset(); | ||
|
||
for (;;) HAL.Yield(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
using System; | ||
using Mosa.DeviceDriver.ISA; | ||
using Mosa.DeviceSystem; | ||
using Mosa.DeviceSystem.Service; | ||
|
||
namespace Mosa.BareMetal.HelloWorld.Apps; | ||
|
||
public class ShowDisks : IApp | ||
{ | ||
public string Name => "ShowDisks"; | ||
|
||
public string Description => "Shows information about disk controllers and disks."; | ||
|
||
public void Execute() | ||
{ | ||
Console.Write("> Probing for disk controllers..."); | ||
var diskControllers = Program.DeviceService.GetDevices<IDiskControllerDevice>(); | ||
Console.WriteLine("[Completed: " + diskControllers.Count + " found]"); | ||
|
||
foreach (var device in diskControllers) | ||
{ | ||
Console.Write(" "); | ||
Program.Bullet(ConsoleColor.Yellow); | ||
Console.Write(" "); | ||
Program.InBrackets(device.Name, ConsoleColor.White, ConsoleColor.Green); | ||
Console.WriteLine(); | ||
} | ||
|
||
Console.Write("> Probing for disks..."); | ||
var disks = Program.DeviceService.GetDevices<IDiskDevice>(); | ||
Console.WriteLine("[Completed: " + disks.Count + " found]"); | ||
|
||
foreach (var disk in disks) | ||
{ | ||
Console.Write(" "); | ||
Program.Bullet(ConsoleColor.Yellow); | ||
Console.Write(" "); | ||
Program.InBrackets(disk.Name, ConsoleColor.White, ConsoleColor.Green); | ||
Console.Write(" " + (disk.DeviceDriver as IDiskDevice).TotalBlocks + " blocks"); | ||
Console.WriteLine(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
using System; | ||
using Mosa.DeviceSystem; | ||
using Mosa.FileSystem.FAT; | ||
|
||
namespace Mosa.BareMetal.HelloWorld.Apps; | ||
|
||
public class ShowFS : IApp | ||
{ | ||
public string Name => "ShowFS"; | ||
|
||
public string Description => "Shows information about partitions and file systems."; | ||
|
||
public void Execute() | ||
{ | ||
Console.Write("> Finding partitions..."); | ||
var partitions = Program.DeviceService.GetDevices<IPartitionDevice>(); | ||
Console.WriteLine("[Completed: " + partitions.Count + " found]"); | ||
|
||
foreach (var partition in partitions) | ||
{ | ||
Console.Write(" "); | ||
Program.Bullet(ConsoleColor.Yellow); | ||
Console.Write(" "); | ||
Program.InBrackets(partition.Name, ConsoleColor.White, ConsoleColor.Green); | ||
Console.Write(" " + (partition.DeviceDriver as IPartitionDevice).BlockCount + " blocks"); | ||
Console.WriteLine(); | ||
} | ||
|
||
Console.Write("> Finding file systems..."); | ||
|
||
foreach (var partition in partitions) | ||
{ | ||
var fat = new FatFileSystem(partition.DeviceDriver as IPartitionDevice); | ||
if (!fat.IsValid) continue; | ||
|
||
Console.WriteLine("Found a FAT file system!"); | ||
|
||
var location = fat.FindEntry("TEST.TXT"); | ||
if (!location.IsValid) continue; | ||
|
||
Console.Write("Found test file!"); | ||
|
||
var testStream = new FatFileStream(fat, location); | ||
|
||
Console.WriteLine(" - Length: " + (uint)testStream.Length + " bytes"); | ||
Console.Write("Reading File: "); | ||
|
||
for (; ; ) | ||
{ | ||
var i = testStream.ReadByte(); | ||
|
||
if (i < 0) | ||
break; | ||
|
||
Console.Write((char)i); | ||
} | ||
|
||
Console.WriteLine(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
using System; | ||
using Mosa.DeviceDriver.ISA; | ||
|
||
namespace Mosa.BareMetal.HelloWorld.Apps; | ||
|
||
public class ShowISA : IApp | ||
{ | ||
public string Name => "ShowISA"; | ||
|
||
public string Description => "Shows information about ISA devices."; | ||
|
||
public void Execute() | ||
{ | ||
Console.Write("> Probing for ISA devices..."); | ||
|
||
var isaDevices = Program.DeviceService.GetChildrenOf(Program.DeviceService.GetFirstDevice<ISABus>()); | ||
Console.WriteLine("[Completed: " + isaDevices.Count + " found]"); | ||
|
||
foreach (var device in isaDevices) | ||
{ | ||
Console.Write(" "); | ||
Program.Bullet(ConsoleColor.Yellow); | ||
Console.Write(" "); | ||
Program.InBrackets(device.Name, ConsoleColor.White, ConsoleColor.Green); | ||
Console.WriteLine(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
using System; | ||
using Mosa.DeviceSystem.PCI; | ||
|
||
namespace Mosa.BareMetal.HelloWorld.Apps; | ||
|
||
public class ShowPCI : IApp | ||
{ | ||
public string Name => "ShowPCI"; | ||
|
||
public string Description => "Shows information about PCI devices."; | ||
|
||
public void Execute() | ||
{ | ||
Console.Write("> Probing for PCI devices..."); | ||
var devices = Program.DeviceService.GetDevices<PCIDevice>(); | ||
Console.WriteLine("[Completed: " + devices.Count + " found]"); | ||
|
||
foreach (var device in devices) | ||
{ | ||
Console.Write(" "); | ||
Program.Bullet(ConsoleColor.Yellow); | ||
Console.Write(" "); | ||
|
||
var pciDevice = device.DeviceDriver as PCIDevice; | ||
Program.InBrackets(device.Name + ": " + pciDevice.VendorID.ToString("x") + ":" + pciDevice.DeviceID.ToString("x") + " " + pciDevice.SubSystemID.ToString("x") + ":" + pciDevice.SubSystemVendorID.ToString("x") + " (" + pciDevice.ClassCode.ToString("x") + ":" + pciDevice.SubClassCode.ToString("x") + ":" + pciDevice.ProgIF.ToString("x") + ":" + pciDevice.RevisionID.ToString("x") + ")", ConsoleColor.White, ConsoleColor.Green); | ||
|
||
var children = Program.DeviceService.GetChildrenOf(device); | ||
|
||
if (children.Count != 0) | ||
{ | ||
var child = children[0]; | ||
|
||
Console.WriteLine(); | ||
Console.Write(" "); | ||
|
||
Program.InBrackets(child.Name, ConsoleColor.White, ConsoleColor.Green); | ||
} | ||
|
||
Console.WriteLine(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
using System; | ||
using Mosa.DeviceSystem; | ||
using Mosa.DeviceSystem.Service; | ||
|
||
namespace Mosa.BareMetal.HelloWorld.Apps; | ||
|
||
public class Shutdown : IApp | ||
{ | ||
public string Name => "Shutdown"; | ||
|
||
public string Description => "Shuts down the computer."; | ||
|
||
public void Execute() | ||
{ | ||
Console.WriteLine("Shutting down..."); | ||
|
||
var pc = Kernel.BareMetal.Kernel.ServiceManager.GetFirstService<PCService>(); | ||
pc.Shutdown(); | ||
|
||
for (;;) HAL.Yield(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,7 @@ public interface IApp | |
{ | ||
string Name { get; } | ||
|
||
string Description { get; } | ||
|
||
void Execute(); | ||
} |
Oops, something went wrong.