USB driver under WinCE

Source: Internet
Author: User

First, a linked list structure of ED and TD is provided. I believe it is much easier to understand the code with this diagram!
Headptr --> Ed --> ed
Ed --> TD --> td...

According to ohci spec: Each ed (endpoint descriptor) describes all data transmission at one endpoint of the USB device, all Ed is connected together, and TD (Transfer descriptor) the description is the final data packet to be transmitted on the USB bus. The TD belonging to the same USB device endpoint is connected together and mounted on the corresponding ed. 1) ohcd. c
This file is in platform and can replace the system. c file that comes with Wince (under public/common/oak/Drivers/USB/HCD/OHC ). The functions in this file are called by the HCD _ stream interface function in the hcddrv. c file. 2) hcddrv. cpp
The file is under public/common/oak/Drivers/USB/HCD/common. The specific setting function in the file is as follows:
Hcdmdd_creatememoryobject
Hcdmdd_createhcdobject
Hcdmdd_destroymemoryobject
Hcdmdd_destroyhcdobject
Hcdmdd_poweron
Hcdmdd_powerdown
Hcdmdd_setcapability
It is also called by functions in ohcd. C.
Cuhcd --> CHW --> chcd (inherited relationship, the instance of cuhcd is created) initialization function call Process
1) hcd_init () [hcddrv. cpp] 2) hcdpdd_init () [ohcd. C] 3) initializeohci () [ohcd. C]
Configure iobase and IRQ. The Registry can be read or configured by the program. 4) hcdmdd_creatememoryobject (); hcdmdd_createhcdobject () [hcddrv. cpp]
Hcdmdd_creatememoryobject () ==> cphysmem-> inittedok () [USB/HCD/common/cphysmem. HPP]
Hcdmdd_createhcdobject () ==> chcd-> deviceinitialize () [USB/HCD/ohcd2/cuhcd. cpp] chcd: deviceinitialize () Process
1) cdeviceglobal: Initialize () [USB/HCD/common/cdevice. cpp]
Load usbd. dll and call hcdattach () [USB/usbd/usbddrv. cpp]. Use gc_hcdfuncs in hcddrv. cpp to set the function of usbd layer [phcd-> phcdfuncs]
2) CHW: Initialize () [USB/HCD/ohcd2/CHW. cpp]
Initializes hardware, controller registers, creates threads for processing HC ist, and CALLS signalcheckfordonetransfer () to listen for transmission completion.
3) chccarea: Initialize () [USB/HCD/ohcd2/cpipe. cpp]
Initialize the static variable of cpipe, establish the air-conditioner degree of the butler linked list, and establish the interrupt queue head tree. The creation thread is used to process the completion of transmission. Ioportbase = usb_base and sys_irq initialization process
1) hcdpdd_init () [ohcd. C]
2) initializeohci () [ohcd. C]
3) configureohcicard () [ohcd. C]: configured here; hcdmdd_createhcdobject () [hcddrv. cpp]
4) createhcdobject () [cuhcd. cpp]: In this new cuhcd, initialize its parent class CHW, and initialize its member variable m_portbase [CHW. cpp] Transfer Process during CHW initialization.
All issuetransfer will eventually call cpipe: issuetransfer () [cpipe. cpp]
1) New stransfer and configure
2) copy the client buffer to the out transfer
3) addtransfer: sets the TDS linked list and adds it to the corresponding ed.
4) scheduletransfer
5) CHW: listcontrol () [the following uses bulk as an example]
1) In CHW: Initialize (),
CHW: m_pbulkhead = & m_portbase-> hcbulkheaded;
2) In each pipe class: openpipe (),
* (CHW: m_pbulkhead) = (PA) m_ped; therefore, HC reads and writes the specified memory based on The Ed value during transmission, the specific data is controlled by the corresponding bits of hccontrol and hccommandstatus in each TD in the TDS linked list under each ed.

This article is from the "bluefish" blog, please be sure to keep this source http://bluefish.blog.51cto.com/214870/72920

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.