阅读:1668回复:4
请问这段代码往底层发送了什么啊?
void CMainFrame::OnBulkRead()
{ // TODO: Add your command handler code here // BULK数据的读操作 int i = 0; char *buffer; char recievedat[1024] = {0}; ULONG length; BULK_TRANSFER_CONTROL bulkControl; int recnBytes = 0; /*命令请求定义*/ char buffer1[64]; VENDOR_OR_CLASS_REQUEST_CONTROL myRequest; ULONG venderlong; /*发送命令,使DSP先定入固定的数据*/ myRequest.direction = 0; myRequest.index = 0; myRequest.value = 2; myRequest.request =0xb6; // vendor specific request type (2) myRequest.requestType=2; // recepient is device (0) myRequest.recepient=0; venderlong = 0; Sx2SendVendorReq(&myRequest, &buffer1[0], venderlong, &recnBytes); /*延时250ms*/ // SleepEx(250,0); |
|
|
沙发#
发布于:2005-03-18 11:24
参看USB协议与头文件中关于VENDOR_OR_CLASS_REQUEST_CONTROL 这个结构的定义。。。。
记得不是很清楚了。。。 myRequest.direction = 0;代表传输方向是像主机传送。。 别的协议又说明的 。。 |
|
|
板凳#
发布于:2005-03-18 11:33
拜托,把你的MYREQUEST的结构列出来.看不懂呀.
|
|
|
地板#
发布于:2005-03-18 14:00
typedef struct _VENDOR_OR_CLASS_REQUEST_CONTROL
{ // transfer direction (0=host to device, 1=device to host) UCHAR direction; // request type (1=class, 2=vendor) UCHAR requestType; // recipient (0=device,1=interface,2=endpoint,3=other) UCHAR recepient; // // see the USB Specification for an explanation of the // following paramaters. // UCHAR requestTypeReservedBits; UCHAR request; USHORT value; USHORT index; } VENDOR_OR_CLASS_REQUEST_CONTROL, *PVENDOR_OR_CLASS_REQUEST_CONTROL; typedef struct _SET_FEATURE_CONTROL { USHORT FeatureSelector; USHORT Index; } SET_FEATURE_CONTROL, *PSET_FEATURE_CONTROL; 结构就是这个 |
|
|
地下室#
发布于:2005-03-19 09:05
??不是吧.director、requestType、recepient是在一个字节里的吧。这个字节的6,7两位表示director,4,5表示requestType,
1,2,3表示recepient。还是说你另外定义了命令的结构?‘requestTypeReservedBits’这又是什么东西? 如果按照标准命令格式分析的话,你这是个由主机传过来的VENDOR(厂商)命令。具体命令(0XB6)的意义要看你的芯片的用户手册 或程序帮助,因为他可能是厂商定义的特殊命令(在用户手册里), 也可能是程序员自己定义的命令。 注意:即使在用户手册里有这个命令,也不一定就是厂商定义的。具 体意义要看程序是怎么解析和执行的。 |
|
|