USB Series Nine: ASPI-based USB drive driver

Source: Internet
Author: User

USB series of Seven and eight introduced ASPI, and through a number of examples to illustrate the programming method based on ASPI, this article uses the knowledge described in the previous two articles and the previous introduction of the DOS driver under the driver of the content of the actual completion of a simple ASPI-based USB flash drive driver, is a summary of the application of ASPI.
In the "USB series six", we completed a simple DOSUSB-based USB drive driver, in fact, our program today is on the basis of the program to change, the basic structure is identical, the idea is exactly the same, just because there is ASPI support, no need to read all kinds of descriptor, read disk, Write disk operation also appears concise a lot, hope to this article interested readers first understand "USB series six" program structure and ideas, and seriously understand "USB series seven", "USB series eight" two articles.
The following is the source program for the ASPI-based USB drive driver that is covered in this article:
Http://blog.hengch.com/source/aspiusb.zip
The program itself has nothing to say, because if you carefully study the reader of the "USB series six" should be very familiar with the program structure, the most changed part of the initialization part, the other sub-programs: Readsec, Writesec, IsReady and Readcapa and "USB series Six "is completely different, but the concept is the same, is to request the device to execute a SCSI command, the rest of the code is the same, the following is only some of those who think more characteristics of the place to say:

      • After the label begin, there are about 10 lines of the program is commented out, which is specifically for the initialization part of debugging, this program first constructs a request Header, and then the driver's interrupt routine address on the stack, so that ES:BX point to the request Header, Finally jump to the program's policy routine execution, when the policy routine execution of the RETF instruction will cause the program to execute the interrupt routine (because the address of the interrupt routine is pressed into the stack), this method we have used many times, so long as we put this program with debug to address offset 0 location, By changing the IP register to 0, you can track the initialization portion of the operation, which is a way to debug the driver initialization section.
      • The return of the BPB table is interesting. In the initialization section, when you finally return BPB in the request header, you need to return a pointer to the BPB pointer, so there is a bpb_ptr variable in the program that must be initialized to return the segment address and offset address of the variable, rather than returning the segment address and offset address of the BPB table But when the driver executes the Get BPB call (Command Code = 2), it returns the BPB segment address and the offset address, instead of bpb_ptr the segment address and offset address of the variable, and I don't know if I'm clear. This is emphasized because I returned the incorrect in the initialization section of the DOSUSB-based driver in the USB series six.
      • There may still be some unused variables in the DOSUSB-based USB drive driver, please don't mind, delete it yourself.

USB Series Nine: ASPI-based USB drive driver

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.