RT,在usb_proc.c里初始化端点5
/* Initialize Endpoint 5 */
SetEPType(ENDP5, EP_BULK);
SetEPTxAddr(ENDP5, ENDP5_TXADDR);
SetEPRxAddr(ENDP5, ENDP5_RXADDR);
SetEPTxCount(ENDP5, BULK_MAX_PACKET_SIZE);
SetEPRxCount(ENDP5, BULK_MAX_PACKET_SIZE);
SetEPRxStatus(ENDP5, EP_RX_VALID);
SetEPTxStatus(ENDP5, EP_TX_NAK);
usb_endp.c
定义下面函数
void EP5_OUT_Callback(void)
{
//接收数据
Data_Len = USB_SIL_Read(/*ENDP5*/EP5_OUT, Bulk_Data_Buff);
}
void EP5_IN_Callback(void)
{
//发送数据
}
现在是能接收数据,但不能发送数据。
还有就是当HOST发了数据后在哪里设置DEVICE的响应时间?
我是在EP5_OUT_Callback里接收到数据后通过下列程序即可将Transi_Buffer里的数据发送给HOST
UserToPMABufferCopy(Transi_Buffer, ENDP5_TXADDR, 0x0a
SetEPTxValid(ENDP5); /* enable endpointx for transmission */
Transi_Buffer里是肯定有数据的,通过USB Monitor观察HOST没收到数据,
001722: Bulk or Interrupt Transfer (DOWN), 01.04.2011 13:50:30.218 +0.156
Pipe Handle: 0x872bf7f4 (Endpoint Address: 0x5)
Send 0xa bytes to the device
63 00 00 00 00 00 01 00 00 00 c.........
001725: Bulk or Interrupt Transfer (UP), 01.04.2011 13:50:30.406 +0.187. Status: 0xc000000c
Pipe Handle: 0x872bf7d4 (Endpoint Address: 0x85)
Get 0x0 bytes from the device
001726: Bulk or Interrupt Transfer (DOWN), 01.04.2011 13:50:30.406 +0.0
Pipe Handle: 0x872bf7f4 (Endpoint Address: 0x5)
Send 0xa bytes to the device
63 00 00 00 00 00 02 00 00 00 c........
/* EP5 */ 0x20字节
/* rx/tx buffer base address */
#define ENDP5_TXADDR (0x120)
#define ENDP5_RXADDR (0x140)
还需不需要其它的设置?接收是没问题的 |