基于OHCI的USB主机 —— UFI查询代码

简介:
/**

  磁盘查询命令

 * @param *buf  数据缓冲区指针

 * @return 0 -  成功

 */

short  ufiInquiry( BYTE  *buf)

{

     INQUIRY_SPC  *inquiry;

     CBW  *cbw;

 

     // 设置 Bulk-Only 协议参数

    cbw = &ufiCmdRunning. cbw ;

    cbw-> dCBW_Signature  = CBW_SIGNATURE;

    cbw-> dCBW_Tag  = 0x60a624de;

    cbw-> dCBW_DataXferLen  = 0x24;

    cbw-> bCBW_Flag =0x80;

    cbw-> bCBW_LUN =0;

    cbw-> bCBW_CDBLen  = 6; //sizeof(CDB_RBC);

 

     // 设置 UFI 命令参数

    inquiry = &(cbw-> cdbRBC . ufiInquiry );

    inquiry-> OperationCode  = 0x12;

    inquiry-> Lun  = 0x0;

    inquiry-> PageCode  = 0x0;

    inquiry-> Reserved1  = 0;

    inquiry-> AllocationLen  = 0x24;

 

     // 设置状态扫描函数所需要的参数

    ufiCmdRunning. funUfiCmd  = bulkRead;

    ufiCmdRunning. pBuf  = buf;

    ufiCmdRunning. state  = UFI_STATE_BEGIN;

 

     // 通过 Bulk 端口发送读命令

    bulkRead(( unsigned   char  *)&ufiCmdRunning. cbw , buf, ( unsigned   char *)&ufiCmdRunning. csw );

 

     return  0;

}





本文转自 tywali 51CTO博客,原文链接:http://blog.51cto.com/lancelot/314110,如需转载请自行联系原作者
目录
相关文章