Where Can I Find Information About Ports: Difference between revisions

no edit summary
[unchecked revision][unchecked revision]
No edit summary
 
(7 intermediate revisions by 6 users not shown)
Line 1:
{{Tone}}
{{FirstPerson}}
{{You}}
== Question: Where Can I Find Information About Ports? ==
<div style="font-size:8pt">
: I have been trying to code a kernel (starting from Brandon's tutorial at osdever). I was lucky to find the ports to display data on screen, to read from a sector, to read the time ([[CMOS]]) and to reboot. Where can I find more information? I want to get into graphics mode, so that I can display images.
 
: The long version: So, I started with a [[Tutorials|tutorial]], writing hello world was easy. Earlier I had worked on [[Assembly|assembly]] and wrote a simple text-drawing program using [[BIOS]] [[Interrupts|interrupts]]. But, this time I faced the [[kernels|kernel]] stuff, and it used [[I/O_Port|ports]] to display data ("Hello World"). I have yet to read the [[Documentation|documents]] properly to appreciate everything. But, anyways I went on searching and I was able to replace "Hello World" with some data on the disk, which required the knowledge of [[LBA]]. I had stumbled on cylinders etc ... the earlier way of reading sector which did not work for me. After knowing the [[LBA]] ports, and going through [[Ext2]] [[Documentation]], I was able to read a small file on the disk. Later, going through other people's code, I came across the code to access [[CMOS]] time and how to reboot.
 
: But, now when I want to add [[Shutdown|shutdown]], [[GraphicsHow_do_I_set_a_graphics_mode|graphics]] mode, [[networking|network]] and other things, its getting a little painful. I feel the need of a guide.
 
: Kindly help!
Line 20 ⟶ 23:
 
===== Legacy Software Interfaces =====
Also, for some devices there's a legacy software interface. This is mostly limited to video cards though (the [[VGA_Resources|VESA/VBE]] interface) because the rest is too crappy{{how}} (no sane person uses the BIOS for [[Serial_ports|serial ports]], [[Parallel_port|parallel ports]], [[PS2_Keyboard|PS/2 keyboard]], [[Floppy_Disk_Controller|floppy]], or [[ATA_PIO_Mode|hard drives]], etc,{{why}} even though it's possible in theory). Like the "legacy hardware interface", this is mostly just a short-term solution (basic functionality with no extra features and poor performance{{how}}).
 
===== Standard Interfaces =====
Lastly, for some device types there's a standard interface. This includes [[USB]] controllers (AFAIK there's only 34 different standards for this - [[UHCI]], [[EHCI]], [[XHCI]] and [[OHCI]]) and [[IDE]]/[[ATAPI]] hard disk controllers (but not [[SCSI]] controllers), and not much else. These standard interfaces are actually good interface (not legacy interfaces).
 
===== Supporting Devices Is Difficult =====
Mostly, to support all devices properly (without using legacy interfaces) you need to read through thousands of pieces of documentation and write thousands of different device drivers (and no, there isn'tare not thousands of guides, one for each device, or any other "hand holding" - you need to find, read and understand the manufacturer's documentation).
 
===== Keep It Minimal =====
Fortunately (IMHO), for a good OS design you don't actually need to write many device drivers{{according to whom}} (a few common drivers to get things started perhaps). You only really need to design, implement and document suitable device driver interface/s, so that other programmers can easily write the device drivers later. For example, you might write one device driver for one [[ethernet]] card, and (hopefully, one day) twenty more people might use your [[documentation]] (and your first device driver, as a reference) to implement fifty more device [[drivers]] for fifty more [[ethernet]] cards.
 
Basically what I'm saying is that (IMHO) sane OS developers don't actually write an OS. Instead they write [[Bootloader]]s, [[kernels]], and [[documentation]]. Only after the [[kernels|kernel]] and [[documentation]] are entirely complete do they worry about device [[drivers]], [[File_Systems|file systems]], [[applications]], etc (except for some common/special case stuff that they need to test the kernel and the kernel's interfaces).
Line 45 ⟶ 48:
 
===== Network Cards =====
For [[:Category:Network Hardware|network]] [[cards]] there is no legacy software interface and no legacy hardware interface - to do it properly you need the manufacturer's documentation (or equivalent documentation).
 
===== Source =====