emugine
驱动牛犊
驱动牛犊
  • 注册日期2002-03-05
  • 最后登录2006-03-24
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:985回复:0

如何从endpoint0中读写register我描述不清!重新整理了一下,还望继续帮我!

楼主#
更多 发布于:2004-07-20 11:23
芯片的firmware是产商写好了的,我现在仅写PC端的驱动:

芯片资料上是这么说的:Endpoint 0 是一个控制端点,主要用来枚举和设置。利用供应商提供的命令使用控制传输来进行传感器的读写。
原文如下:
Endpoint 0 is a control endpoint used for device numeration and configuration. The sensor function registers are written and read using control transfers of vendor specific commands to endpoint 0.
功能传感器描述图:
Function Register Map
就是下面这个Index
Index   Name     Description   Read/Write Access
0x08    CTRLA    Control Register A R/W
0x09    CTRLB    Control Register B R/W
0x0A    CTRLC    Control Register C R/W

我想住芯片寄存器CTRLB中写入数据0x05,应该怎么组织URB呢?

我写过下面的函数:
UsbBuildVendorRequest(urb, //ptr to urb     URB_FUNCTION_VENDOR_DEVICE,
   (USHORT) siz, //siz of urb     0,
              0x42,//reservedbits=bmRequestType,0表示主机到设备关于设备的标准请求,我这里用0x42表示主机到设备关于端点0的产商请求
 0xCE,//request =IOCTL_WRITE_REGISTER 这是我定义的,
              wValue,// 这个wValue是不是就是我写寄存器CTRLB地址和数据的地方?
0, // index 这个Index我用0表示从主机到设备端点0
0,//TransferBuffer不知道是不是该从这里传送数据
NULL, //mdl (unused)
0, //bufferlength
NULL);

我对RequestType,request,wValue,wIndex没有完全理解,各位大侠大牛们,帮我分析一把,万分感谢!

[编辑 -  7/20/04 by  emugine]

[编辑 -  7/20/04 by  emugine]

[编辑 -  7/20/04 by  emugine]
你有好的想法吗? 来,我们一起驱动它!
游客

返回顶部