- 论坛徽章:
- 0
|
最后会调用usb_hcd_poll_rh_status(hcd)这个函数定时轮询port,这个函数会调用我的代码 代码如下
顺便说一下 ,我目前移植的是isp1362,有谁做过这个芯片的驱动,指点一下,多谢,卡在这里很多天了没有丝毫进展
- static int isp1362_hub_status_data(struct usb_hcd *hcd, char *buf)
- {
- struct isp1362_hcd *isp1362_hcd = hcd_to_isp1362_hcd(hcd);
- int ports, i, changed = 0;
- unsigned long flags;
- if (!HC_IS_RUNNING(hcd->state))
- return -ESHUTDOWN;
- /* Report no status change now, if we are scheduled to be
- called later */
- if (timer_pending(&hcd->rh_timer))
- return 0;
- ports = isp1362_hcd->rhdesca & RH_A_NDP; //获取端口号 只有2个
- BUG_ON(ports > 2);
- spin_lock_irqsave(&isp1362_hcd->lock, flags);
- if (isp1362_hcd->rhstatus & (RH_HS_LPSC | RH_HS_OCIC))
- buf[0] = changed = 1;
- else
- buf[0] = 0;
- //read每个端口的状态
- for (i = 0; i < ports; i++) {
- u32 status = isp1362_hcd->rhport[i];
- if (status & (RH_PS_CSC | RH_PS_PESC | RH_PS_PSSC |
- RH_PS_OCIC | RH_PS_PRSC)) {
- changed = 1;
- buf[0] |= 1 << (i + 1);
- continue;
- }
- if (!(status & RH_PS_CCS)) //连接状态
- continue;
- }
- spin_unlock_irqrestore(&isp1362_hcd->lock, flags);
- return changed;
- }
复制代码 |
|