/******************************************************************************* * Macro Name : SetEPDblBuffCount / SetEPDblBuf0Count / SetEPDblBuf1Count. * Description : Gets buffer 0/1 address of a double buffer endpoint. * Input : bEpNum: endpoint number. * : bDir: endpoint dir EP_DBUF_OUT = OUT * EP_DBUF_IN = IN * : wCount: Counter value * Output : None. * Return : None. *******************************************************************************/
#define _SetEPDblBuf0Count(bEpNum, bDir, wCount) { \
if(bDir == EP_DBUF_OUT)\
/* OUT endpoint */ \
{_SetEPRxDblBuf0Count(bEpNum,wCount);} \
else if(bDir == EP_DBUF_IN)\
/* IN endpoint */ \
*_pEPTxCount(bEpNum) = (uint32_t)wCount; \
} /* SetEPDblBuf0Count*/
#define _SetEPDblBuf1Count(bEpNum, bDir, wCount) { \
if(bDir == EP_DBUF_OUT)\
/* OUT endpoint */ \
{_SetEPRxCount(bEpNum,wCount);}\
else if(bDir == EP_DBUF_IN)\
/* IN endpoint */\
*_pEPRxCount(bEpNum) = (uint32_t)wCount; \
} /* SetEPDblBuf1Count */
上面这个是在STM32的USB LIB里面的一段代码(usb_regs.h中),上面分别对DBL的BUF0和DBL的BUF1设置数值,而第2个(红色部分)是不是应该也是*pEPTxCount(bEpNum)呢?
我是USB初学,大家莫笑我低级哟!