USB分析(一):中断函数分析
2018-01-29 21:57
344 查看
USB中断函数分析:
__usb_device_interrupt_handler()首先看下寄存器:
Common Device Host Registers
Device Registers - Endpoint
1、读取中断端口寄存器:
ep_inst = _usb_instances->hw->DEVICE.EPINTSMRY.reg;
2、首先IF判断如果是端点0程序如下:
器件端点中断标志:
代码分析:
1、首先中断标志寄存器赋值
2、回调函数的调用
中断标志如下:
在udd_attach中注册了如下几个回调函数,其他没有注册的指向NULL。
3、其次else为其它端口:
首先读取:Device EndPoint Interrupt Flag判断EndPoint Interrupt Flag 标志:
1、USB_DEVICE_EPINTFLAG_STALL_Msk(Transmit Stall 0 Interrupt Flag 令牌中断&发送中断标志位0)
udd_ep_transfer_process
2、USB_DEVICE_EPINTFLAG_RXSTP ( Received Setup Interrupt Flag 接收建立中断)
_usb_ep0_on_setup
3、USB_DEVICE_EPINTFLAG_TRCPT_Msk ( Transfer Fail 0 Interrupt Flag 传输完成中断0)
_usb_ep0_on_tansfer_ok
4、USB_DEVICE_EPINTFLAG_TRFAIL_Msk( Transfer Fail 0 Interrupt Flag 传输失败中断0)
_usb_ep0_on_tansfer_fail
现在分析下回调函数的注册
第一处:第二处:
配置端口信息中:
bool udd_ep_alloc(udd_ep_id_t ep, uint8_t bmAttributes, uint16_t MaxEndpointSize)
第三处:
Array to store device related callback functions
usb_host_callback_t host_callback[USB_HOST_CALLBACK_N]; usb_host_pipe_callback_t host_pipe_callback[USB_PIPE_NUM][USB_HOST_PIPE_CALLBACK_N];
现在分析register函数和enable函数:
register:enable:
相关文章推荐
- STM32 USB部分中断函数简要分析
- 对于中断函数返回值的分析
- linux EHCI DRIVER之中断处理函数ehci_irq()分析(一)
- stm32学习笔记之USB中断配置初始化函数
- linux EHCI DRIVER之中断处理函数ehci_irq()分析(二)
- 嵌入式linux的中断函数实现和分析(一)
- 针对上一篇按键中断驱动中一些关键函数分析
- linux EHCI DRIVER之中断处理函数ehci_irq()分析(二)
- urb分析,usb_fill_bulk_urb函数理解
- linux EHCI DRIVER之中断处理函数ehci_irq()分析(一)
- 嵌入式linux的中断函数实现和分析
- urb分析,usb_fill_bulk_urb函数理解
- 函数分析之usb_submit_urb
- linux EHCI DRIVER之中断处理函数ehci_irq()分析(二)
- 【转】对于中断函数返回值的分析
- 对于中断函数返回值的分析
- 中断函数参数深入分析总结
- urb分析,usb_fill_bulk_urb函数理解
- STM32 NVIC嵌套向量中断控制器函数分析
- urb分析,usb_fill_bulk_urb函数理解