基于OHCI的USB主机 ―― UFI读状态代码

/**
 * 读取错误原因
 * @param *buf 存放读取出来数据的缓冲区
 * @return 0 - 成功
 */
short ufiRequestSense( BYTE *buf)
{
    REQUEST_SENSE *request;
    CBW *cbw;
 
    // 设置 Bulk-Only 协议参数
    cbw = &ufiCmdRunning. cbw ;
    cbw-> dCBW_Signature = CBW_SIGNATURE;
    cbw-> dCBW_Tag = 0x60a624de;
    cbw-> dCBW_DataXferLen = 0x12;
    cbw-> bCBW_Flag =0x80;
    cbw-> bCBW_LUN =0;
    cbw-> bCBW_CDBLen = 0x0C; //sizeof(CDB_RBC);
 
    // 设置 UFI 命令参数
    request = &(cbw-> cdbRBC . ufiRequestSense );
    request-> OperationCode = 0x03;
    request-> AllocationLen = 0x12;
 
    // 设置状态扫描函数所需要的参数
    ufiCmdRunning. funUfiCmd = bulkRead;
    ufiCmdRunning. pBuf = buf;
    ufiCmdRunning. state = UFI_STATE_BEGIN;
 
    // 通过 Bulk 端口发送读命令
    bulkRead(( unsigned char *)&ufiCmdRunning. cbw , buf, ( unsigned char *)&ufiCmdRunning. csw );
 
    return 0;
}

你可能感兴趣的:(职场,主机,usb,休闲,ohci)