USB host based on OHCI--The overall architecture

Source: Internet
Author: User
In our system, USB host is used to the U disk to read and write operations, so in the design and architecture is entirely around this purpose. The whole system involves more content, according to the general principle of embedded system development, using hierarchical architecture, the system is divided into several levels according to function, each layer completes the corresponding function. According to the business needs of the system, the overall framework of the system is as follows:
9 Business Application Layer
8 File Operations API Layer
7 File system Layer
6 U Disk Operation Command Interface layer
5 UFI command Layer
4 USB Device Management Layer
3 OHCI Software Interface Layer
2 Register read-write interface layer
1 Hardware layer
This is a layered structure, each layer completes its own function, layer and layer are through the interface between the completion, basically the upper application is only dependent on the next layer, for the individual layer of functional implementation needs to rely on the next 2 layers, which is to consider the convenience of implementation. The function of each layer is described below: 1, hardware This is the bottom of the system, directly complete the hardware part of the USB protocol processing. 2, the register reads and writes the interface AM9200 supports the standard OHCI interface, provides accesses the OHCI register the pointer (PUHP) and the data Exchange area (HCCA), this layer carries on the encapsulation to this pointer and the data Exchange area's access, the external shielding registers reads and writes the detail. If you migrate to a OHCI system later, you can keep the interface unchanged and then encode the layer again. 3, the OHCI software interface according to the OHCI standard, the data transmission is through the endpoint descriptor (ED) and the transmission descriptor (TD) These two kind of data structure to complete, before carries on the transmission needs to the ED and the TD carries on the corresponding setting, only then can guarantee the data transmission correctness, This layer encapsulates the operations of Ed and TD, providing a data transfer interface based on OHCI. For more information on ED and TD please refer to the OHCI specification "Open Host Controller Interface Specification for USB." 4, USB Device management according to the USB standard, USB devices need to provide the device descriptor, configuration descriptor, interface descriptor and endpoint descriptor, and other information, this layer of code provides the command to obtain these descriptors. In addition, this layer also combines the commands for the descriptor to complete the enumeration and detection of USB devices. 5, UFI command according to the "Universal Serial Bus Mass Storage class bulk-only Transport" and "Universal Serial Bus Mass Storage class UFI Comm and specification, which completes the UFI command of the BULKONLY protocol, provides sector read-write commands to the upper level. 6, U disk Operation command interface on the one hand package UFI command layer, to provide a sector of the disk to read and write commands, such as Diskread (), Diskwrite () and other functions, on the other hand, call the UFI command to complete the enumeration and detection of U disk, to determine the number of logical 0 sector, 7, the file system completes the file system initialization, obtains the correlation parameter, provides the directory lookup, the cluster operation and so on the interface to the upper level. 8. The File Operation library function is modeled after the standard document library function of C language, and provides a set of API function libraries for upper level business applications, including file opening, closing, reading and writing, and positioning. 9, business Application This is the industryBusiness logic layer, that is, according to the received billing information to call the corresponding file operation library function, complete the function of the order save. With such a hierarchy, the system has good maintainability and expansibility, as long as the CPU supports OHCI standard, then this system can not modify the direct use, if the CPU does not support the OHCI standard, you need to modify the OHCI layer of the code to maintain the upper level of the call interface, you can complete the system transplant. If you need to extend support for more USB devices, keep the OHCI layer basically unchanged or extended (current OHCI layer code only supports control and bulk transfer, does not support synchronous and interrupt transmission), adding new drivers and upper application is OK. In this article, I have a general description of our system, which is to avoid the elaboration of a variety of technical details, leading to blinders, see Taishan. In this series of articles, all the code is written in accordance with this architectural principle, and remembering this architecture can be a great help in understanding the code. http://lancelot.blog.51cto.com/393579/228153

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.