基本信息
源码名称:usb3.0 msc
源码大小:0.02M
文件格式:.rar
开发语言:C/C++
更新时间:2019-10-25
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
CyFxMscCswReturnStatus_t CyFxMscSendCsw( CyFxMscCswReturnStatus_t cswReturnStatus /* Command Status */ ) { /* Update the residue length in the CSW */ glMscCswStatus[11] = (uint8_t)((glCswDataResidue & 0xFF000000) >> 24); glMscCswStatus[10] = (uint8_t)((glCswDataResidue & 0x00FF0000) >> 16); glMscCswStatus[9] = (uint8_t)((glCswDataResidue & 0x0000FF00) >> 8); glMscCswStatus[8] = (uint8_t)(glCswDataResidue & 0x000000FF); /* Update the status in the CSW */ glMscCswStatus[12] = (uint8_t)(cswReturnStatus & 0x3); /* Check for phase error */ if (cswReturnStatus == CY_FX_CBW_CMD_PHASE_ERROR) { glInPhaseError = CyTrue; CyU3PUsbFlushEp(CY_FX_MSC_EP_BULK_IN); CyU3PUsbFlushEp(CY_FX_MSC_EP_BULK_OUT); /* Stall the IN endpoint */ CyU3PUsbStall(CY_FX_MSC_EP_BULK_IN, CyTrue, CyFalse); /* Stall the OUT endpoint */ CyU3PUsbStall(CY_FX_MSC_EP_BULK_OUT, CyTrue, CyFalse); CyU3PDmaChannelReset(&glChHandleMscIn); CyU3PDmaChannelReset(&glChHandleMscOut); } /* Check for Command failed */ else if (cswReturnStatus == CY_FX_CBW_CMD_FAILED) { /* Only when data is expected or to be sent stall the EPs */ if (glDataTxLength != 0) { /* Check direction */ if (glCmdDirection == 0x00) { /* Stall the OUT endpoint */ CyU3PUsbStall(CY_FX_MSC_EP_BULK_OUT, CyTrue, CyFalse); } else { CyU3PUsbFlushEp(CY_FX_MSC_EP_BULK_IN); /* Stall the IN endpoint */ CyU3PUsbStall(CY_FX_MSC_EP_BULK_IN, CyTrue, CyFalse); CyU3PDmaChannelReset(&glChHandleMscIn); } } } else { /* No operation. Proceed to send the status */ } /* Send the status to the host */ if (CyFxMscSendUSBData(glMscCswStatus, CY_FX_MSC_CSW_MAX_COUNT) != CY_U3P_SUCCESS) { cswReturnStatus = CY_FX_CBW_CMD_MSC_RESET; } /* Return status */ return cswReturnStatus; }