Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
USB
ZYNQ7000
usbd 驱动适配求助
发布于 2022-04-24 18:41:05 浏览:882
订阅该版
各位大佬好,打扰了。最尝试对照 [vivado 的例程](https://github.com/Xilinx/embeddedsw/blob/master/XilinxProcessorIPLib/drivers/usbps/examples/xusbps_intr_example.c), 用vivado 的官方库适配 rtt 的 usb 驱动, 目前已经可以通过 ep0 完成设备的基本信息枚举了,但不清楚 ep1 的回调接口该调用哪个 usb 的回调函数, 尝试了几个接口,似乎都不行, read 和 wirte 接口都没调用, 特来求助。谢谢! 接口代码: (完整代码: [drv_usbd.c](https://oss-club.rt-thread.org/uploads/20220424/838589cb8e9e56e06e9c64c37e43e64c.c)) ```CXX /*****************************************************************************/ /** * This funtion is registered to handle callbacks for endpoint 1 (Bulk data). * * It is called from an interrupt context such that the amount of processing * performed should be minimized. * * * @param CallBackRef is the reference passed in when the function was * registered. * @param EpNum is the Number of the endpoint on which the event occured. * @param EventType is type of the event that occured. * * @return None. * * @note None. * ******************************************************************************/ static void XUsbPs_Ep1EventHandler(void *CallBackRef, u8 EpNum, u8 EventType, void *Data) { XUsbPs *InstancePtr; int Status; u8 *BufferPtr; u32 BufferLen; u32 InavalidateLen; u32 Handle; rt_kprintf("XUsbPs_Ep1EventHandler\n"); Xil_AssertVoid(NULL != CallBackRef); InstancePtr = (XUsbPs *) CallBackRef; switch (EventType) { case XUSBPS_EP_EVENT_DATA_RX: /* Get the data buffer.*/ Status = XUsbPs_EpBufferReceive(InstancePtr, EpNum, &BufferPtr, &BufferLen, &Handle); /* Invalidate the Buffer Pointer */ InavalidateLen = BufferLen; if (BufferLen % 32) { InavalidateLen = (BufferLen/32) * 32 + 32; } Xil_DCacheInvalidateRange((unsigned int)BufferPtr, InavalidateLen); if (XST_SUCCESS == Status) { /* Handle the storage class request. */ // XUsbPs_HandleStorageReq(InstancePtr, EpNum, // BufferPtr, BufferLen); // /* Release the buffer. */ // rt_usbd_ep_in_handler(&_zynq_udc, 0x81, BufferLen); // 是这个吗? // rt_usbd_ep_out_handler(&_zynq_udc, 1, BufferLen); // 是这个吗? // rt_usbd_sof_handler(&_zynq_udc); // 是这个吗? hex_dump(BufferPtr, BufferLen); // 打印一下收到的数据 rt_kprintf("XUsbPs_HandleStorageReq\n"); XUsbPs_EpBufferRelease(Handle); } break; default: /* Unhandled event. Ignore. */ break; } } ``` 此状态下的控制台输出: ```SHELL _get_string_descriptor w: 0 26 hw_usbd_isr XUsbPs_Ep0EventHandler hw_usbd_isr XUsbPs_Ep0EventHandler rt_usbd_ep0_in_handler message type 0 [ setup_request : 0x0 value : 0x1 length : 0x0 index : 0x0 request : 0x9 ] _set_config rt_usbd_set_config rt_usbd_find_config _set_cfg : 1 _set_cfg 2 : 1 Mass storage function enabled _ep_read_prepare 0x001acf2c 31 hw_usbd_isr [32m01-01 08:00:00 I/drv.mmc usbd: init 'sd0' success [0mhw_usbd_isr XUsbPs_Ep0EventHandler rt_usbd_ep0_in_handler message type 0 [ setup_request : 0xa1 value : 0x0 length : 0x1 index : 0x0 request : 0xfe ] rt_usbd_find_interface mstorage_interface_handler USBREQ_GET_MAX_LUN w: 0 1 hw_usbd_isr XUsbPs_Ep0EventHandler XUsbPs_Ep1EventHandler 00000000: 55 53 42 43 A0 C9 82 32 24 00 00 00 80 00 06 12 USBC...2$....... 00000010: 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 ...$........... XUsbPs_HandleStorageReq hw_usbd_isr hw_usbd_isr XUsbPs_Ep0EventHandler rt_usbd_ep0_in_handler message type 0 [ setup_request : 0x80 value : 0x100 length : 0x40 index : 0x0 request : 0x6 ] _get_device_descriptor w: 0 18 hw_usbd_isr XUsbPs_Ep0EventHandler ```
查看更多
0
个回答
默认排序
按发布时间排序
暂无答案,快来添加答案吧
撰写答案
登录
注册新账号
关注者
0
被浏览
882
关于作者
a1012112796
这家伙很懒,什么也没写!
提问
29
回答
267
被采纳
31
关注TA
发私信
相关问题
1
请教USB Host
2
STM32F4调试USB 读卡器(Slave)提示格式化
3
急求 STM32F4 USB Device MSC+SD 的相关问题
4
USB 框架问题
5
USB键盘
6
LPC17xx 如何添加USB HOST设备
7
RT-Thread目前支持USB HOST了吗?
8
USB HOST的支持问题
9
RTT 2.0.1 USB存储设备问题,枚举到USBREQ_GET_MAX_LUN后复位
10
USB库已经很久没更新了
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
国产MCU移植系列教程汇总,欢迎查看!
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
五分钟玩转RT-Thread新社区
6
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
【RT-Thread】【ci】【scons】将ci.attachconfig.yml和scons结合使用
2
Rt-thread中OTA下载后,bootloader不搬程序
3
ulog 日志 LOG_HEX 输出时间改为本地日期时间
4
在RT-Thread Studio中构建前执行python命令
5
研究一了一段时间RTT,直接标准版上手太难,想用nano,但又舍不得组件
热门标签
RT-Thread Studio
串口
Env
LWIP
SPI
AT
Bootloader
Hardfault
CAN总线
FinSH
ART-Pi
USB
DMA
文件系统
RT-Thread
SCons
RT-Thread Nano
线程
MQTT
STM32
RTC
FAL
rt-smart
I2C_IIC
ESP8266
UART
WIZnet_W5500
ota在线升级
cubemx
PWM
flash
freemodbus
BSP
packages_软件包
潘多拉开发板_Pandora
定时器
ADC
flashDB
GD32
socket
编译报错
中断
Debug
rt_mq_消息队列_msg_queue
SFUD
msh
keil_MDK
ulog
C++_cpp
MicroPython
本月问答贡献
出出啊
1518
个答案
343
次被采纳
小小李sunny
1444
个答案
290
次被采纳
张世争
813
个答案
177
次被采纳
crystal266
547
个答案
161
次被采纳
whj467467222
1222
个答案
149
次被采纳
本月文章贡献
出出啊
1
篇文章
5
次点赞
小小李sunny
1
篇文章
1
次点赞
张世争
1
篇文章
3
次点赞
crystal266
2
篇文章
2
次点赞
whj467467222
2
篇文章
2
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部