|  | 
 
| dellweiwei 初级用户
 
   
 
 
 积分 111
 发帖 2
 注册 2003-7-10
 状态 离线
 | 
| 『楼 主』:
 关于DOS下的访问USB控制器的问题,请高手帮忙,谢谢
 
使用 LLM 解释/回答一下 
 
 
我是大学计算机系的大四学生,半年以后要找工作了,大家知道这个年头工作难找。
 最后的暑假在一家公司找了个没有钱的实习,当然想留下来的,这次接触特别底层的东西,特别是这次遇到了一个非常困难的技术难题,让我很担忧这件事情是否能做好,下面就让我把这个问题简单描述一下,如果描述里面有什么低级问题,请指出,因为第一次做那么底层的程序。
 
 我加入的TEAM是做一个解决方案的,里面主要的程序都是在计算机刚刚引导还没有进操作系统的情况下运行的(有点类似硬盘保护卡的开机程序),这个几乎在裸机上运行的程序中有一个功能就是要访问一个公司自己研制开发的USB外设硬件。
 我做的模块就围绕这个了,这个USB硬件在WINDOWS下的驱动早就完成了,但是在裸机汇编环境下形式就完全不一样了,让我非常没有头绪。
 
 后来我在贵站上看到这样的程序URL http://newdos.yginfo.net/dosware/usbdrv.zip
 这个程序能让DOS支持USB的设备,程序不大。
 
 后来我看了点关于USB的资料,加上对程序的理解,得出了以下的结论:
 1,汇编或DOS如果要访问USB接口是要通过I/0地址寻址对USB控制器芯片进行操作的,比如初始化,发送数据,其实都是对USB控制器的I/0操作。
 2,如果要我的汇编应用程序对这个硬件达到一定目的的操作,首先要有一个USB控制器驱动,它包装了对控制器底层的操作。然后在控制器驱动的基础上,我再针对我的USB设备开发一个调用控制器驱动的设备驱动。
 如下图所示
 
 汇编应用程序《---》我的USB设备的驱动模块《---》USB控制器驱动《--》USB控制器《-》USB外设
 
 
 再看看那个贵站下载的DUSE程序,虽然它是FOR DOS,但是它的功能和我要做的那个模块差不多的,特别是USB控制器驱动,我发现它是DUSE程序的底层核心,各种不同设备的驱动程序只是在调用它,但我对它一无所知;如果在它的基础上能对USB接口直接发送接收数据了,怎么跟我的USB外设对话我是很熟悉指令的。
 
 不知道我表达的是否清楚,我的最终目的就是用汇编在裸机下访问USB接口并发送数据控制一个特定的公司开发的USB设备(这个设备的控制指令我清楚)。
 请高手指点怎样做通用的USB控制器驱动模块(我看那个DUSE就是在各种机器上都能用的),最好有相关的代码可以直接参考,工作不等人啊,为了我的工作。谢谢高手了,我在上海,如果这件事情作好了,我一定请吃饭。
 
 我的EMAIL:dellweiwei@hotmail.com
 
I'm a senior student in the computer department of a university. I'll be looking for a job half a year later. Everyone knows that it's hard to find a job these days.
 During the last summer vacation, I got an unpaid internship in a company. Of course, I want to stay. This time I've come into contact with very low - level things. Especially this time I encountered a very difficult technical problem, and I'm very worried about whether I can do this well. Now let me briefly describe this problem. Please point out if there are any basic problems in the description, because it's the first time I'm doing such a low - level program.
 
 The TEAM I joined is developing a solution. The main programs in it run just after the computer is booted and before the operating system is entered (it's a bit similar to the boot program of a hard disk protection card). In this program running almost on bare metal, there is a function to access a self - developed USB peripheral hardware of the company.
 
 My module is centered around this. The driver of this USB hardware under WINDOWS has long been completed, but in the bare - metal assembly environment, the form is completely different, which makes me at a loss.
 
 Later, I saw such a program URL on your website: http://newdos.yginfo.net/dosware/usbdrv.zip
 This program can make DOS support USB devices. The program is not large.
 
 Then I read some information about USB and combined with the understanding of the program, I drew the following conclusions:
 1. If assembly or DOS wants to access the USB interface, it needs to address the USB controller chip through I/O addresses for operations, such as initialization and sending data, which are all I/O operations on the USB controller.
 2. If my assembly application program is to perform operations on this hardware to a certain purpose, first, there should be a USB controller driver, which packages the underlying operations on the controller. Then, based on the controller driver, I develop a device driver for my USB device that calls the controller driver.
 The diagram is as follows
 Assembly application program <--- > My USB device's driver module <--- > USB controller driver <-- > USB controller < - > USB peripheral
 
 Looking at the DUSE program downloaded from your website again, although it's for DOS, its function is similar to the module I want to do. Especially the USB controller driver. I find that it's the underlying core of the DUSE program. The driver programs of various different devices just call it, but I know nothing about it; if I can directly send and receive data to the USB interface on the basis of it, how to communicate with my USB peripheral, I'm very familiar with instructions.
 
 I don't know if my expression is clear. My final goal is to use assembly to access the USB interface and send data to control a specific USB device developed by the company under bare metal (I know the control instructions of this device).
 Please experts give guidance on how to make a general USB controller driver module (I see that DUSE can be used on various machines). It's best to have relevant code that can be directly referred to. Time is pressing for my job. I'm doing this for my job. Thank you, experts. I'm in Shanghai. If this matter is done well, I will definitely invite you to dinner.
 
 My EMAIL: dellweiwei@hotmail.com
 
 
 
 |  | 
|  2003-7-10 00:00 |  | 
|  | 
 
| dellweiwei 初级用户
 
   
 
 
 积分 111
 发帖 2
 注册 2003-7-10
 状态 离线
 | 
| 『第 2 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
hehe,我今天去了东华大学计算机博士生实验室,在那里找到了答案,看来这里还是技术有限啊。 
hehe, I went to the Computer Doctoral Laboratory of Donghua University today and found the answer there. It seems that the technology here is still limited. 
 
 
 |  | 
|  2003-7-12 00:00 |  | 
|  | 
 
| hunome 银牌会员
 
      颓废青年
 
 
 积分 2265
 发帖 721
 注册 2003-5-12
 状态 离线
 |  | 
|  2003-7-12 00:00 |  | 
|  | 
 
| 禅宗 元老会员
 
          CEO
 
 
 积分 1019
 发帖 300
 注册 2002-10-20
 来自 广东
 状态 离线
 | 
| 『第 4 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
是啊,对这方面有兴趣:)不知楼主能否贴出来? 
Yeah, I'm interested in this aspect :). I wonder if the original poster can post it? 
 
 
 
 |  
                  |  禅宗——大道至简,知易行难!
 网站: http://www.dgzens.com
 
 QQ: 11951692  微信:  dgzens
 E-MAIL: warmrose@21cn.com
 |  | 
|  2003-7-16 00:00 |  | 
|  | 
 
| libaoli 新手上路
 
  
 
 
 
 积分 6
 发帖 5
 注册 2006-9-7
 状态 离线
 | 
| 『第 5 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
楼主贴出来答案,让晚辈也来学习一下!! 
The LZ posts the answer, let the younger generation also come to learn! 
 
 
 |  | 
|  2006-9-8 05:33 |  | 
|  | 
 
| zyl910 中级用户
 
    
 
 
 
 积分 282
 发帖 126
 注册 2006-5-17
 状态 离线
 | 
| 『第 6 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
关注!
 
 我现在对USB很感兴趣
 
 USB的驱动分为三层:
 主机控制器驱动
 设备类驱动
 应用驱动
 
 Windows已经带了常见的设备类驱动
 主机控制器驱动由主板驱动提供
 写驱动时只需根据该设备特点编写应用驱动
 
 
 而在DOS下,这三层驱动都得自己写
 
 现在正被intel网站下下来的UHCI规范弄得头晕
 
Follow!
 I'm very interested in USB right now.
 
 The drivers for USB are divided into three layers:
 Host controller driver
 Device class driver
 Application driver
 
 Windows already comes with common device class drivers.
 The host controller driver is provided by the motherboard driver.
 When writing drivers, you only need to write the application driver according to the characteristics of the device.
 
 
 But under DOS, you have to write all three layers of drivers by yourself.
 
 Now I'm getting dizzy from the UHCI specification downloaded from the Intel website.
 
 
 
 
 |  
                  |  人类存在的目的就是试图理解人类为何存在
 |  | 
|  2006-9-8 05:56 |  | 
|  | 
 
| johnsonlam 银牌会员
 
      阿林
 
 
 积分 1410
 发帖 497
 注册 2004-6-28
 来自 九龍,香港
 状态 离线
 |  | 
|  2006-9-8 22:39 |  | 
|  | 
 
| kinglin 初级用户
 
   
 
 
 
 积分 62
 发帖 28
 注册 2007-7-3
 状态 离线
 |  | 
|  2007-7-3 15:03 |  | 
|  | 
 
| CrispH 初级用户
 
   
 
 
 
 积分 108
 发帖 49
 注册 2007-3-9
 状态 离线
 | 
| 『第 9 楼』:
 
 
使用 LLM 解释/回答一下 
 
 
好像比较麻烦...我倒是有很多在 DOS 可以动作的 SOURCE CODE. 不过不容易整理出来的.
 
 我觉得,要些 DOS 的关于 USB 的东西.
 需要把 OHCI, UHCI 和 EHCI 的规格的软件层面弄明白.
 
It seems relatively troublesome...I do have a lot of SOURCE CODE that can run under DOS. But it's not easy to sort them out.
 
 I think, I need some things about USB in DOS.
 Need to understand the software aspects of the specifications of OHCI, UHCI and EHCI.
 
 
 
 |  | 
|  2007-7-4 21:42 |  | 
|  | 
 
| p8031 新手上路
 
  
 
 
 
 积分 2
 发帖 1
 注册 2010-12-16
 状态 离线
 |  | 
|  2010-12-23 14:24 |  |