상속: HardwareDevice, IDevice, IHardwareDevice, IKeyboardDevice
예제 #1
0
        /// <summary>
        /// Start the Device Driver System.
        /// </summary>
        public static void Start()
        {
            // Find all drivers
            Boot.Console.Write("Finding Drivers...");
            deviceDriverRegistry.RegisterBuiltInDeviceDrivers();
            var count = deviceDriverRegistry.GetPCIDeviceDrivers().Count + deviceDriverRegistry.GetISADeviceDrivers().Count;
            Boot.Console.WriteLine("[Completed: " + count.ToString() + " found]");

            // Start drivers for ISA devices
            StartISADevices();

            // Start drivers for PCI devices
            StartPCIDevices();

            // Get CMOS, StandardKeyboard, and PIC driver instances
            CMOS = (CMOS)deviceManager.GetDevices(new FindDevice.WithName("CMOS")).First.Value;
            StandardKeyboard = (StandardKeyboard)deviceManager.GetDevices(new FindDevice.WithName("StandardKeyboard")).First.Value;

            Boot.Console.Write("Finding disk controllers...");
            var diskcontroller = new DiskControllerManager(Setup.DeviceManager);
            diskcontroller.CreateDiskDevices();

            var diskcontrollers = deviceManager.GetDevices(new FindDevice.IsDiskControllerDevice());
            Boot.Console.WriteLine("[Completed: " + diskcontrollers.Count.ToString() + " found]");
            foreach (var device in diskcontrollers)
            {
                Boot.Console.Write("Found controller ");
                Boot.InBrackets(device.Name, Mosa.Kernel.x86.Colors.White, Mosa.Kernel.x86.Colors.LightGreen);
                Boot.Console.WriteLine();
            }

            Boot.Console.Write("Finding disks...");
            var disks = deviceManager.GetDevices(new FindDevice.IsDiskDevice());
            Boot.Console.WriteLine("[Completed: " + disks.Count.ToString() + " found]");
            foreach (var disk in disks)
            {
                Boot.Console.Write("Spinning up disk ");
                Boot.InBrackets(disk.Name, Mosa.Kernel.x86.Colors.White, Mosa.Kernel.x86.Colors.LightGreen);
                Boot.Console.Write(" " + (disk as IDiskDevice).TotalBlocks.ToString() + " blocks");
                Boot.Console.WriteLine();
            }

            partitionManager.CreatePartitionDevices();

            Boot.Console.Write("Finding partitions...");
            var partitions = deviceManager.GetDevices(new FindDevice.IsPartitionDevice());
            Boot.Console.WriteLine("[Completed: " + partitions.Count.ToString() + " found]");
            foreach (var partition in partitions)
            {
                Boot.Console.Write("Opening partition: ");
                Boot.InBrackets(partition.Name, Mosa.Kernel.x86.Colors.White, Mosa.Kernel.x86.Colors.LightGreen);
                Boot.Console.Write(" " + (partition as IPartitionDevice).BlockCount.ToString() + " blocks");
                Boot.Console.WriteLine();
            }

            Boot.Console.Write("Finding file systems...");
            var filesystem = deviceManager.GetDevices(new FindDevice.IsPartitionDevice());

            //Boot.Console.WriteLine("[Completed: " + filesystem.Count.ToString() + " found]");
            foreach (var partition in partitions)
            {
                var fat = new FatFileSystem(partition as IPartitionDevice);

                if (fat.IsValid)
                {
                    Boot.Console.WriteLine("Found a FAT file system!");

                    var filename = "TEST.TXT";

                    var location = fat.FindEntry(filename);

                    if (location.IsValid)
                    {
                        Boot.Console.WriteLine("Found: " + filename);

                        var fatFileStream = new FatFileStream(fat, location);

                        uint len = (uint)fatFileStream.Length;

                        Boot.Console.WriteLine("Length: " + len.ToString());

                        Boot.Console.WriteLine("Reading File:");

                        for (;;)
                        {
                            int i = fatFileStream.ReadByte();

                            if (i < 0)
                                break;

                            Boot.Console.Write((char)i);
                        }
                    }
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Start the Device Driver System.
        /// </summary>
        public static void Start()
        {
            // Find all drivers
            Boot.Console.Write("Finding Drivers...");
            deviceDriverRegistry.RegisterBuiltInDeviceDrivers();
            var count = deviceDriverRegistry.GetPCIDeviceDrivers().Count + deviceDriverRegistry.GetISADeviceDrivers().Count;
            Boot.Console.WriteLine("[Completed: " + count.ToString() + " found]");

            // Start drivers for ISA devices
            StartISADevices();

            // Start drivers for PCI devices
            StartPCIDevices();

            // Get CMOS, StandardKeyboard, and PIC driver instances
            CMOS = (CMOS)deviceManager.GetDevices(new FindDevice.WithName("CMOS")).First.Value;
            Keyboard = (StandardKeyboard)deviceManager.GetDevices(new FindDevice.WithName("StandardKeyboard")).First.Value;
        }
예제 #3
0
        /// <summary>
        /// Start the Device Driver System.
        /// </summary>
        public static void Start()
        {
            // Find all drivers
            deviceDriverRegistry.RegisterBuiltInDeviceDrivers();

            // Start drivers for ISA devices
            StartISADevices();

            // Start drivers for PCI devices
            StartPCIDevices();

            // Get CMOS, StandardKeyboard, and PIC driver instances
            CMOS = (CMOS)deviceManager.GetDevices(new FindDevice.WithName("CMOS")).First.Value;
            Keyboard = (StandardKeyboard)deviceManager.GetDevices(new FindDevice.WithName("StandardKeyboard")).First.Value;
        }