..

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Muazzam
Member
Member
Posts: 543
Joined: Mon Jun 16, 2014 5:59 am
Location: Shahpur, Layyah, Pakistan

..

Post by Muazzam »

..
Last edited by Muazzam on Tue Jul 21, 2015 4:00 am, edited 1 time in total.
Nable
Member
Member
Posts: 453
Joined: Tue Nov 08, 2011 11:35 am

Re: Can we use ATA commands for USB stick?

Post by Nable »

Point one, about IDE I/O ports.
muazzam wrote:Can we use IDE-ATA I/O ports commands for USB Memory Stick emulated as HDD?
If you have a system with custom chipset then it may be possible. On usual PCs BIOS doesn't emulate ATA-HDD (you are talking about this early emulation, aren't you?), it only emulates block device for INT 0x13 service (that is a more abstract thing). So, one cannot use IDE I/O ports to access USB drives on usual PCs.

Second point, about ATA commands: often USB-to-IDE/USB-to-SATA dongles don't just emulate USB mass-storage device, they work as USB<>ATA bridges, so you can use ATA commands to work with storage that is attached to USB but instead of writing to I/O ports, you encapsulate commands into USB packets in some special way (specific to the type of dongle controller).
User avatar
Muazzam
Member
Member
Posts: 543
Joined: Mon Jun 16, 2014 5:59 am
Location: Shahpur, Layyah, Pakistan

Re: Can we use ATA commands for USB stick?

Post by Muazzam »

Nable wrote:Point one, about IDE I/O ports.
muazzam wrote:Can we use IDE-ATA I/O ports commands for USB Memory Stick emulated as HDD?
If you have a system with custom chipset then it may be possible. On usual PCs BIOS doesn't emulate ATA-HDD (you are talking about this early emulation, aren't you?), it only emulates block device for INT 0x13 service (that is a more abstract thing). So, one cannot use IDE I/O ports to access USB drives on usual PCs.

Second point, about ATA commands: often USB-to-IDE/USB-to-SATA dongles don't just emulate USB mass-storage device, they work as USB<>ATA bridges, so you can use ATA commands to work with storage that is attached to USB but instead of writing to I/O ports, you encapsulate commands into USB packets in some special way (specific to the type of dongle controller).
If we don't want to use BIOS interrupts, what is actual way of accessing USB mass storage device (Using ports for example)?.
User avatar
iansjack
Member
Member
Posts: 4709
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Can we use ATA commands for USB stick?

Post by iansjack »

There's a book about programming USB devices here: http://www.amazon.com/USB-Universal-Ser ... rogramming

***Warning*** - this is not easy stuff.
Nable
Member
Member
Posts: 453
Joined: Tue Nov 08, 2011 11:35 am

Re: Can we use ATA commands for USB stick?

Post by Nable »

muazzam wrote:If we don't want to use BIOS interrupts, what is actual way of accessing USB mass storage device (Using ports for example)?.
Then you have to implement USB stack (PCI enumeration support, then drivers for controllers: OHCI+UHCI, then EHCI and possibly XHCI, then drivers for exact types of USB devices) and it's a hard task. You can start reading here: http://wiki.osdev.org/Category:USB
Btw, some OSs here already have working parts of USB support, you can study their code.
Post Reply