本帖最后由 adams.gh 于 2011-3-26 18:51 编辑
在usb_int.c中的CRT_LP()中,为何EP0的处理会有如下注掉的那部分代码呢?
DIRection为1,是从PC到从机的传输,会有TX吗?
if ((wIstr & ISTR_DIR) == 0){ /* EP0 IN int */
/* DIR = 0 implies that (EP_CTR_TX = 1) always */
_ClearEP_CTR_TX(ENDP0);
In0_Process();
_SetEPRxStatus(ENDP0, SaveRState);
_SetEPTxStatus(ENDP0, SaveTState);
return;
} else { /* SETUP or OUT int */
/* DIR = 1 & (CTR_TX | CTR_RX) => 2 int pending */
wEPVal = _GetENDPOINT(ENDP0); //读端点寄存器
// if ((wEPVal & EP_CTR_TX) != 0) {
// _ClearEP_CTR_TX(ENDP0);
// In0_Process();
// _SetEPRxStatus(ENDP0, SaveRState);
// _SetEPTxStatus(ENDP0, SaveTState);
// return;
// }
// else
if ((wEPVal & EP_SETUP) != 0) { /* SETUP */
_ClearEP_CTR_RX(ENDP0); /* SETUP bit kept frozen while CTR_RX = 1 */
Setup0_Process();
_SetEPRxStatus(ENDP0, SaveRState);
_SetEPTxStatus(ENDP0, SaveTState);
return;
}
else if ((wEPVal & EP_CTR_RX) != 0) { /* OUT */
_ClearEP_CTR_RX(ENDP0);
Out0_Process();
_SetEPRxStatus(ENDP0, SaveRState);
_SetEPTxStatus(ENDP0, SaveTState);
return;
}
} |