How to read data from USB with in/out in pmode?
I searched Google,but I got few information about that.Then I tried to search osdev forum,there is no results,too!
I found USB class code and subclass in PCI wiki(http://wiki.osdev.org/PCI),so I guess I can get io ports in PCI.If I'm right,how to use the ports?
Can you help me write an example?Thank you very much!
How to read data from USB with in/out in pmode?
- thepowersgang
- Member
- Posts: 734
- Joined: Tue Dec 25, 2007 6:03 am
- Libera.chat IRC: thePowersGang
- Location: Perth, Western Australia
- Contact:
Re: How to read data from USB with in/out in pmode?
It's a lot harder than you think. USB is essentially a network protocol (except not really, but it's about as complex, and it helps to think of it this way).
If you're really interested, I'd look at the USB page on the wiki, as well as the OHCI/UHCI/EHCI datasheets. I'd guess from the way your post is framed that you're only just starting out, and want to handle USB mass storage and input devices. I would (and did) leave USB support until after my OS was stable with full multithreading and a partial network stack, just so the groundwork is covered.
If you're really interested, I'd look at the USB page on the wiki, as well as the OHCI/UHCI/EHCI datasheets. I'd guess from the way your post is framed that you're only just starting out, and want to handle USB mass storage and input devices. I would (and did) leave USB support until after my OS was stable with full multithreading and a partial network stack, just so the groundwork is covered.
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Re: How to read data from USB with in/out in pmode?
If you are asking about the x86 instructions "in" and "out," the answer is that you can't.windows8 wrote:How to read data from USB with in/out in pmode?
I searched Google,but I got few information about that.Then I tried to search osdev forum,there is no results,too!
I found USB class code and subclass in PCI wiki(http://wiki.osdev.org/PCI),so I guess I can get io ports in PCI.If I'm right,how to use the ports?
Can you help me write an example?Thank you very much!
Although "in" and "out" can be used to configure the USB device's PCI configuration space... what goes there is a physical memory address.
Reads and writes to the USB device are then done using memory access, not "in" and "out."
Re: How to read data from USB with in/out in pmode?
I would also like to know: Why is the reason for the apparently strong insistence about even having multithreading and network stack to implement USB?thepowersgang wrote:It's a lot harder than you think. USB is essentially a network protocol (except not really, but it's about as complex, and it helps to think of it this way).
If you're really interested, I'd look at the USB page on the wiki, as well as the OHCI/UHCI/EHCI datasheets. I'd guess from the way your post is framed that you're only just starting out, and want to handle USB mass storage and input devices. I would (and did) leave USB support until after my OS was stable with full multithreading and a partial network stack, just so the groundwork is covered.
I see that the BIOS can handle USB input devices as well as mass storage devices, and it is a 16-bit program with no multithreading and presumably not a network stack, or at least not even required for USB support.
Then I would attempt to implement USB just like the BIOS (first an easy, monotasking version, and then iterate it to naturally adapt it to a multitasking environment over a period of time).
YouTube:
http://youtube.com/@AltComp126
My x86 OS/software:
https://sourceforge.net/projects/api-simple-completa/
Donate to get more food/programming resources/computers:
https://www.paypal.com/donate/?hosted_b ... QS2YTW3V64
http://youtube.com/@AltComp126
My x86 OS/software:
https://sourceforge.net/projects/api-simple-completa/
Donate to get more food/programming resources/computers:
https://www.paypal.com/donate/?hosted_b ... QS2YTW3V64
- thepowersgang
- Member
- Posts: 734
- Joined: Tue Dec 25, 2007 6:03 am
- Libera.chat IRC: thePowersGang
- Location: Perth, Western Australia
- Contact:
Re: How to read data from USB with in/out in pmode?
I suggested waiting mostly because of the extra experience it gives you (network particularly, as it's a similar idea), but you're right - USB doesn't require full threading (just some basic timing) but it helps immensely with interrupt handling.
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc