How do I access the USB port through the BIOS in 1

2020-07-23 04:43发布

问题:

I'm a newbie to the Assembly world,

I'm trying to write some assembly codes to communicate with Hardware devices like Serial, Parallel, VGA, Keyboard,..etc.

I'm doing this while being in Real Mode of the x86 intel processor, by booting my code from a boostrap I personally wrote to load my assembly code.

Well, according to my knowledge that I gathered from reading tutorials, the easiest way to me was to use BIOS INTs Service Routine (ISR) and on the other hand the LONGEST way is by accessing the different registers of the hardware, like for example: Status Register and Control Registers of the Serial Port....

Q1: Am I right about this?

I could communicate with the VGA and Serial hardwares using BIOS INTs, but I couldn't find any bios interrupts for the USB controller..?!

Q2: Can you help me in this to be able to communicate with the USB port and for other remaining ports, just make it general?

Q3:

回答1:

As Alex says, there is no universal BIOS-level support for USB. However, there have been some attempts at making real-mode DOS drivers for USB devices. I found a page with some source codes which you should be able to use: http://bretjohnson.us/source/source.htm



回答2:

According to the GEUB manual (http://www.gnu.org/software/grub/manual/html_node/Installing-GRUB-using-grub_002dinstall.html), a non-buggy BIOS will expose USB as a hard drive. So, you can use hard drive interrupts (e.g. INT 0x13) to probe for and access USB just like a normal hardware. BIOS does the same thing for CDROM (see http://wiki.osdev.org/El-Torito no emulation mode). I think BIOS will do this for all supported boot options, but I haven't found any document to support this.



回答3:

There's nothing in the PC BIOS to support USB I/O similar to all other I/O (keyboard, display, serial, parallel, disk, speaker). USB arrived too late to the party. The only USB-related thing you can get from the BIOS is support for USB keyboards and storage connected via USB (you can boot from them on modern PCs). Other than that, you have to implement your own USB stack.