您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ HCS_N_PORTS函数代码示例

51自学网 2021-06-01 21:22:40
  C++
这篇教程C++ HCS_N_PORTS函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中HCS_N_PORTS函数的典型用法代码示例。如果您正苦于以下问题:C++ HCS_N_PORTS函数的具体用法?C++ HCS_N_PORTS怎么用?C++ HCS_N_PORTS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了HCS_N_PORTS函数的21个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: get_ehci_connect_status

int get_ehci_connect_status(int usbc_no){    struct usb_hcd 	*hcd 	= NULL;	struct ehci_hcd *ehci	= NULL;	struct sw_hci_hcd *sw_ehci = NULL;	int	port;	int connect = 0;    if(usbc_no < 0 || usbc_no > 2){        printk("usbc_no : %d invalid/n", usbc_no);        return 0;    }	sw_ehci = g_sw_ehci[usbc_no];    if(!sw_ehci){                return 0;    }	hcd = sw_ehci->hcd;    if(!hcd){                return 0;    }	ehci = hcd_to_ehci(hcd);	if(!ehci){                return 0;    }        port = HCS_N_PORTS(ehci->hcs_params);    while(port--)        connect |= readl(&ehci->regs->port_status[port]) & PORT_CONNECT;    return connect;}
开发者ID:pocketbook,项目名称:U7,代码行数:31,


示例2: store_companion

/* * Dedicate or undedicate a port to the companion controller. * Syntax is "[-]portnum", where a leading '-' sign means * return control of the port to the EHCI controller. */static ssize_t store_companion(struct device *dev,                               struct device_attribute *attr,                               const char *buf, size_t count){    struct ehci_hcd		*ehci;    int			portnum, new_owner;    ehci = hcd_to_ehci(dev_get_drvdata(dev));    new_owner = PORT_OWNER;		/* Owned by companion */    if (sscanf(buf, "%d", &portnum) != 1)        return -EINVAL;    if (portnum < 0) {        portnum = - portnum;        new_owner = 0;		/* Owned by EHCI */    }    if (portnum <= 0 || portnum > HCS_N_PORTS(ehci->hcs_params))        return -ENOENT;    portnum--;    if (new_owner)        set_bit(portnum, &ehci->companion_ports);    else        clear_bit(portnum, &ehci->companion_ports);    set_owner(ehci, portnum, new_owner);    return count;}
开发者ID:jgroen,项目名称:rtt_tests,代码行数:30,


示例3: ehci_hub_descriptor

static voidehci_hub_descriptor (	struct ehci_hcd			*ehci,	struct usb_hub_descriptor	*desc) {	int		ports = HCS_N_PORTS (ehci->hcs_params);	u16		temp;	desc->bDescriptorType = 0x29;	desc->bPwrOn2PwrGood = 0;	/* FIXME: f(system power) */	desc->bHubContrCurrent = 0;	desc->bNbrPorts = ports;	temp = 1 + (ports / 8);	desc->bDescLength = 7 + 2 * temp;	/* two bitmaps:  ports removable, and usb 1.0 legacy PortPwrCtrlMask */	memset (&desc->bitmap [0], 0, temp);	memset (&desc->bitmap [temp], 0xff, temp);	temp = 0x0008;			/* per-port overcurrent reporting */	if (HCS_PPC (ehci->hcs_params))		temp |= 0x0001;		/* per-port power control */	if (HCS_INDICATOR (ehci->hcs_params))		temp |= 0x0080;		/* per-port indicators (LEDs) */	desc->wHubCharacteristics = cpu_to_le16 (temp);}
开发者ID:liuxueyang,项目名称:Linux-Unix,代码行数:27,


示例4: ci_imx_ehci_bus_resume

static int ci_imx_ehci_bus_resume(struct usb_hcd *hcd){	struct ehci_hcd *ehci = hcd_to_ehci(hcd);	int port;	int ret = orig_bus_resume(hcd);	if (ret)		return ret;	port = HCS_N_PORTS(ehci->hcs_params);	while (port--) {		u32 __iomem *reg = &ehci->regs->port_status[port];		u32 portsc = ehci_readl(ehci, reg);		/*		 * Notify PHY after resume signal has finished, it is		 * for global suspend case.		 */		if (hcd->usb_phy			&& test_bit(port, &ehci->bus_suspended)			&& (portsc & PORT_CONNECT)			&& (ehci_port_speed(ehci, portsc) ==				USB_PORT_STAT_HIGH_SPEED))			/* notify the USB PHY */			usb_phy_notify_resume(hcd->usb_phy, USB_SPEED_HIGH);	}	return 0;}
开发者ID:brickrisk,项目名称:linux-2.6-imx-maxim-3.14.28,代码行数:29,


示例5: ehci_ci_portpower

static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable){	struct ehci_hcd *ehci = hcd_to_ehci(hcd);	struct ehci_ci_priv *priv = (struct ehci_ci_priv *)ehci->priv;	struct device *dev = hcd->self.controller;	int ret = 0;	int port = HCS_N_PORTS(ehci->hcs_params);	if (priv->reg_vbus) {		if (port > 1) {			dev_warn(dev,				"Not support multi-port regulator control/n");			return 0;		}		if (enable)			ret = regulator_enable(priv->reg_vbus);		else			ret = regulator_disable(priv->reg_vbus);		if (ret) {			dev_err(dev,				"Failed to %s vbus regulator, ret=%d/n",				enable ? "enable" : "disable", ret);			return ret;		}	}	return 0;};
开发者ID:Claude1986,项目名称:Atheros-CSI-Tool,代码行数:27,


示例6: ehci_brcm_hub_control

/* ehci_brcm_hub_control * Intercept echi-hcd request to complete RESUME and align it to the start * of the next microframe. * If RESUME is complete too late in the microframe, host controller * detects babble on suspended port and resets the port afterwards. * This s/w workaround allows to avoid this problem. * See http://jira.broadcom.com/browse/SWLINUX-1909 for more details */static int ehci_brcm_hub_control(	struct usb_hcd	*hcd,	u16		typeReq,	u16		wValue,	u16		wIndex,	char		*buf,	u16		wLength){	struct ehci_hcd	*ehci = hcd_to_ehci(hcd);	int		ports = HCS_N_PORTS(ehci->hcs_params);	u32 __iomem	*status_reg = &ehci->regs->port_status[				(wIndex & 0xff) - 1];	unsigned long flags;	int retval, irq_disabled = 0;	/* RESUME is cleared when GetPortStatus() is called 20ms after start	  of RESUME */	if ((typeReq == GetPortStatus) &&	    (wIndex && wIndex <= ports) &&	    ehci->reset_done[wIndex-1] &&	    time_after_eq(jiffies, ehci->reset_done[wIndex-1]) &&	    (ehci_readl(ehci, status_reg) & PORT_RESUME)) {		/* to make sure we are not interrupted until RESUME bit		  is cleared, disable interrupts on current CPU */		ehci_dbg(ehci, "SOF alignment workaround/n");		irq_disabled = 1;		local_irq_save(flags);		ehci_brcm_wait_for_sof(ehci, 5);	}	retval = ehci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength);	if (irq_disabled)		local_irq_restore(flags);	return retval;}
开发者ID:jameshilliard,项目名称:20-4-4,代码行数:43,


示例7: ehci_hsic_phy_power

static void ehci_hsic_phy_power(struct ehci_hcd *ehci, int is_low_power){	unsigned port;	port = HCS_N_PORTS(ehci->hcs_params);	while (port--) {		u32 __iomem	*hostpc_reg;		u32		t3;		hostpc_reg = (u32 __iomem *)((u8 *) ehci->regs				+ 0x84 + 4 * port);		t3 = ehci_readl(ehci, hostpc_reg);		ehci_dbg(ehci, "Port %d phy low-power mode org %08x/n",				port, t3);		if (is_low_power)			ehci_writel(ehci, t3 | HOSTPC_PHCD, hostpc_reg);		else			ehci_writel(ehci, t3 & ~HOSTPC_PHCD, hostpc_reg);		t3 = ehci_readl(ehci, hostpc_reg);		ehci_dbg(ehci, "Port %d phy low-power mode chg %08x/n",				port, t3);	}}
开发者ID:NotKit,项目名称:android-ia_kernel_intel_baytrail,代码行数:25,


示例8: ehci_msm_run

// mainly a copy of ehci_run(), can perhaps be reduced:static int ehci_msm_run(struct usb_hcd *hcd){	struct ehci_hcd *ehci  = hcd_to_ehci(hcd);	int             retval = 0;	int     	port   = HCS_N_PORTS(ehci->hcs_params);	u32 __iomem     *reg_ptr;	u32             hcc_params;	hcd->uses_new_polling = 1;	hcd->poll_rh = 0;	/* set hostmode */	reg_ptr = (u32 __iomem *)(((u8 __iomem *)ehci->regs) + USBMODE);	ehci_writel(ehci, (USBMODE_VBUS | USBMODE_SDIS), reg_ptr);	/* port configuration - phy, port speed, port power, port enable */	while (port--)		ehci_writel(ehci, (PORTSC_PTS_ULPI | PORT_POWER |				PORT_PE), &ehci->regs->port_status[port]);	ehci_writel(ehci, ehci->periodic_dma, &ehci->regs->frame_list);	ehci_writel(ehci, (u32)ehci->async->qh_dma, &ehci->regs->async_next);	hcc_params = ehci_readl(ehci, &ehci->caps->hcc_params);	if (HCC_64BIT_ADDR(hcc_params))		ehci_writel(ehci, 0, &ehci->regs->segment);	ehci->command &= ~(CMD_LRESET|CMD_IAAD|CMD_PSE|CMD_ASE|CMD_RESET);	ehci->command |= CMD_RUN;	ehci_writel(ehci, ehci->command, &ehci->regs->command);	/*	 * Start, enabling full USB 2.0 functionality ... usb 1.1 devices	 * are explicitly handed to companion controller(s), so no TT is	 * involved with the root hub.  (Except where one is integrated,	 * and there's no companion controller unless maybe for USB OTG.)	 *	 * Turning on the CF flag will transfer ownership of all ports	 * from the companions to the EHCI controller.  If any of the	 * companions are in the middle of a port reset at the time, it	 * could cause trouble.  Write-locking ehci_cf_port_reset_rwsem	 * guarantees that no resets are in progress.  After we set CF,	 * a short delay lets the hardware catch up; new resets shouldn't	 * be started before the port switching actions could complete.	 */	down_write(&ehci_cf_port_reset_rwsem);	hcd->state = HC_STATE_RUNNING;	ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag);	ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */	msleep(5);	up_write(&ehci_cf_port_reset_rwsem);	/*Enable appropriate Interrupts*/	ehci_writel(ehci, INTR_MASK,			&ehci->regs->intr_enable);	return retval;}
开发者ID:franjoweb,项目名称:liquid_chocolate_ics_kernel,代码行数:60,


示例9: ehci_turn_off_all_ports

/* On some systems, leaving remote wakeup enabled prevents system shutdown. * The firmware seems to think that powering off is a wakeup event! * This routine turns off remote wakeup and everything else, on all ports. */static void ehci_turn_off_all_ports(struct ehci_hcd *ehci){	int	port = HCS_N_PORTS(ehci->hcs_params);	while (port--)		ehci_writel(ehci, PORT_RWC_BITS,				&ehci->regs->port_status[port]);}
开发者ID:franjoweb,项目名称:liquid_chocolate_ics_kernel,代码行数:12,


示例10: ehci_port_power

static void ehci_port_power (struct ehci_hcd *ehci, int is_on){	unsigned port;	if (!HCS_PPC (ehci->hcs_params))		return;	ehci_dbg (ehci, "...power%s ports.../n", is_on ? "up" : "down");	for (port = HCS_N_PORTS (ehci->hcs_params); port > 0; )		(void) ehci_hub_control(ehci_to_hcd(ehci),				is_on ? SetPortFeature : ClearPortFeature,				USB_PORT_FEAT_POWER,				port--, NULL, 0);	msleep(20);}
开发者ID:foxsat-hdr,项目名称:linux-kernel,代码行数:15,


示例11: ehci_lpm_set_da

/* this file is part of ehci-hcd.c */static int __maybe_unused ehci_lpm_set_da(struct ehci_hcd *ehci, int dev_addr, int port_num){	u32 __iomem portsc;	ehci_dbg(ehci, "set dev address %d for port %d/n", dev_addr, port_num);	if (port_num > HCS_N_PORTS(ehci->hcs_params)) {		ehci_dbg(ehci, "invalid port number %d/n", port_num);		return -ENODEV;	}	portsc = ehci_readl(ehci, &ehci->regs->port_status[port_num-1]);	portsc &= ~PORT_DEV_ADDR;	portsc |= dev_addr<<25;	ehci_writel(ehci, portsc, &ehci->regs->port_status[port_num-1]);	return 0;}
开发者ID:Claruarius,项目名称:stblinux-2.6.37,代码行数:16,


示例12: ehci_hsic_port_power

static void ehci_hsic_port_power(struct ehci_hcd *ehci, int is_on){	unsigned port;	if (!HCS_PPC(ehci->hcs_params))		return;	dev_dbg(&pci_dev->dev, "...power%s ports.../n", is_on ? "up" : "down");	for (port = HCS_N_PORTS(ehci->hcs_params); port > 0; )		(void) ehci_hub_control(ehci_to_hcd(ehci),				is_on ? SetPortFeature : ClearPortFeature,				USB_PORT_FEAT_POWER,				port--, NULL, 0);	/* Flush those writes */	ehci_readl(ehci, &ehci->regs->command);}
开发者ID:NotKit,项目名称:android-ia_kernel_intel_baytrail,代码行数:16,


示例13: ehci_ci_portpower

static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable){	struct ehci_hcd *ehci = hcd_to_ehci(hcd);	struct ehci_ci_priv *priv = (struct ehci_ci_priv *)ehci->priv;	struct device *dev = hcd->self.controller;	struct ci_hdrc *ci = dev_get_drvdata(dev);	int ret = 0;	int port = HCS_N_PORTS(ehci->hcs_params);	if (priv->reg_vbus) {		if (port > 1) {			dev_warn(dev,				"Not support multi-port regulator control/n");			return 0;		}		if (enable)			ret = regulator_enable(priv->reg_vbus);		else			ret = regulator_disable(priv->reg_vbus);		if (ret) {			dev_err(dev,				"Failed to %s vbus regulator, ret=%d/n",				enable ? "enable" : "disable", ret);			return ret;		}	}	if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL &&			ci->usb_phy && ci->usb_phy->set_vbus) {		if (enable)			ci->usb_phy->set_vbus(ci->usb_phy, 1);		else			ci->usb_phy->set_vbus(ci->usb_phy, 0);	}	if (enable && (ci->platdata->phy_mode == USBPHY_INTERFACE_MODE_HSIC)) {		/*		 * Marvell 28nm HSIC PHY requires forcing the port to HS mode.		 * As HSIC is always HS, this should be safe for others.		 */		hw_port_test_set(ci, 5);		hw_port_test_set(ci, 0);	}	return 0;};
开发者ID:enclustra-bsp,项目名称:xilinx-linux,代码行数:46,


示例14: ehci_hub_status_data

static intehci_hub_status_data (struct usb_hcd *hcd, char *buf){	struct ehci_hcd	*ehci = hcd_to_ehci (hcd);	u32		temp, status = 0;	int		ports, i, retval = 1;	unsigned long	flags;	/* init status to no-changes */	buf [0] = 0;	ports = HCS_N_PORTS (ehci->hcs_params);	if (ports > 7) {		buf [1] = 0;		retval++;	}		/* no hub change reports (bit 0) for now (power, ...) */	/* port N changes (bit N)? */	spin_lock_irqsave (&ehci->lock, flags);	for (i = 0; i < ports; i++) {		temp = readl (&ehci->regs->port_status [i]);		if (temp & PORT_OWNER) {			/* don't report this in GetPortStatus */			if (temp & PORT_CSC) {				temp &= ~PORT_CSC;				writel (temp, &ehci->regs->port_status [i]);			}			continue;		}		if (!(temp & PORT_CONNECT))			ehci->reset_done [i] = 0;		if ((temp & (PORT_CSC | PORT_PEC | PORT_OCC)) != 0) {			if (i < 7)			    buf [0] |= 1 << (i + 1);			else			    buf [1] |= 1 << (i - 7);			status = STS_PCD;		}	}	spin_unlock_irqrestore (&ehci->lock, flags);	return status ? retval : 0;}
开发者ID:iwangv,项目名称:edimax-br-6528n,代码行数:43,


示例15: ehci_msm_run

static int ehci_msm_run(struct usb_hcd *hcd){	struct ehci_hcd *ehci  = hcd_to_ehci(hcd);	struct msmusb_hcd *mhcd = hcd_to_mhcd(hcd);	int             retval = 0;	int     	port   = HCS_N_PORTS(ehci->hcs_params);	u32 __iomem     *reg_ptr;	u32             hcc_params;	struct msm_usb_host_platform_data *pdata = mhcd->pdata;	hcd->uses_new_polling = 1;	hcd->poll_rh = 0;	USBH_INFO("%s/n", __func__);	/* set hostmode */	reg_ptr = (u32 __iomem *)(((u8 __iomem *)ehci->regs) + USBMODE);	ehci_writel(ehci, (USBMODE_VBUS | USBMODE_SDIS), reg_ptr);	/* port configuration - phy, port speed, port power, port enable */	while (port--)		ehci_writel(ehci, (PTS_VAL(pdata->phy_info) | PORT_POWER |				PORT_PE), &ehci->regs->port_status[port]);	ehci_writel(ehci, ehci->periodic_dma, &ehci->regs->frame_list);	ehci_writel(ehci, (u32)ehci->async->qh_dma, &ehci->regs->async_next);	hcc_params = ehci_readl(ehci, &ehci->caps->hcc_params);	if (HCC_64BIT_ADDR(hcc_params))		ehci_writel(ehci, 0, &ehci->regs->segment);	ehci->command &= ~(CMD_LRESET|CMD_IAAD|CMD_PSE|CMD_ASE|CMD_RESET);	ehci->command |= CMD_RUN;	ehci_writel(ehci, ehci->command, &ehci->regs->command);	ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */	hcd->state = HC_STATE_RUNNING;	/*Enable appropriate Interrupts*/	ehci_writel(ehci, INTR_MASK, &ehci->regs->intr_enable);	return retval;}
开发者ID:Alex163,项目名称:htc-kernel-pyramid,代码行数:42,


示例16: show_companion

/* Display the ports dedicated to the companion controller */static ssize_t show_companion(struct device *dev,                              struct device_attribute *attr,                              char *buf){    struct ehci_hcd		*ehci;    int			nports, index, n;    int			count = PAGE_SIZE;    char			*ptr = buf;    ehci = hcd_to_ehci(dev_get_drvdata(dev));    nports = HCS_N_PORTS(ehci->hcs_params);    for (index = 0; index < nports; ++index) {        if (test_bit(index, &ehci->companion_ports)) {            n = scnprintf(ptr, count, "%d/n", index + 1);            ptr += n;            count -= n;        }    }    return ptr - buf;}
开发者ID:jgroen,项目名称:rtt_tests,代码行数:22,


示例17: ci_ehci_bus_suspend

static int ci_ehci_bus_suspend(struct usb_hcd *hcd){	struct ehci_hcd *ehci = hcd_to_ehci(hcd);	int port;	u32 tmp;	int ret = orig_bus_suspend(hcd);	if (ret)		return ret;	port = HCS_N_PORTS(ehci->hcs_params);	while (port--) {		u32 __iomem *reg = &ehci->regs->port_status[port];		u32 portsc = ehci_readl(ehci, reg);		if (portsc & PORT_CONNECT) {			/*			 * For chipidea, the resume signal will be ended			 * automatically, so for remote wakeup case, the			 * usbcmd.rs may not be set before the resume has			 * ended if other resume paths consumes too much			 * time (~24ms), in that case, the SOF will not			 * send out within 3ms after resume ends, then the			 * high speed device will enter full speed mode.			 */			tmp = ehci_readl(ehci, &ehci->regs->command);			tmp |= CMD_RUN;			ehci_writel(ehci, tmp, &ehci->regs->command);			/*			 * It needs a short delay between set RS bit and PHCD.			 */			usleep_range(150, 200);			break;		}	}	return 0;}
开发者ID:Claude1986,项目名称:Atheros-CSI-Tool,代码行数:40,


示例18: ehci_omap_bus_suspend

static int ehci_omap_bus_suspend(struct usb_hcd *hcd){	struct usb_bus *bus = hcd_to_bus(hcd);	int ret;#ifdef CONFIG_LOGIC_OMAP3530_USB3320_HACK	struct ehci_hcd_omap *omap = platform_get_drvdata(to_platform_device(						    hcd->self.controller));	struct ehci_hcd *ehci = omap->ehci;	int ports = HCS_N_PORTS (omap->ehci->hcs_params);	int i;		// Manually suspend the ports HERE.  We want to be able to switch to	// GPIO lines before it shuts down the controller entirely;	// Otherwise, it'll wake up the PHY again.	for(i=0;i<ports;++i)	{	    u32 __iomem *status_reg = &omap->ehci->regs->port_status[i];	    u32 temp = ehci_readl(omap->ehci, status_reg);	    	    if((temp & PORT_PE) == 0 || (temp & PORT_RESET) != 0)		continue;	    ehci_writel(omap->ehci, temp | PORT_SUSPEND, status_reg);	    set_bit(i, &ehci->suspended_ports);	}		msleep(1);		usb3320_hack_install();#endif	ret = ehci_bus_suspend(hcd);	ehci_omap_dev_suspend(bus->controller);	return ret;}
开发者ID:Aircell,项目名称:asp-kernel,代码行数:38,


示例19: ehci_hub_control

static int ehci_hub_control (	struct usb_hcd	*hcd,	u16		typeReq,	u16		wValue,	u16		wIndex,	char		*buf,	u16		wLength) {	struct ehci_hcd	*ehci = hcd_to_ehci (hcd);	int		ports = HCS_N_PORTS (ehci->hcs_params);	u32		temp, status;	unsigned long	flags;	int		retval = 0;	/*	 * FIXME:  support SetPortFeatures USB_PORT_FEAT_INDICATOR.	 * HCS_INDICATOR may say we can change LEDs to off/amber/green.	 * (track current state ourselves) ... blink for diagnostics,	 * power, "this is the one", etc.  EHCI spec supports this.	 */	spin_lock_irqsave (&ehci->lock, flags);	switch (typeReq) {	case ClearHubFeature:		switch (wValue) {		case C_HUB_LOCAL_POWER:		case C_HUB_OVER_CURRENT:			/* no hub-wide feature/status flags */			break;		default:			goto error;		}		break;	case ClearPortFeature:		if (!wIndex || wIndex > ports)			goto error;		wIndex--;		temp = readl (&ehci->regs->port_status [wIndex]);		if (temp & PORT_OWNER)			break;		switch (wValue) {		case USB_PORT_FEAT_ENABLE:			writel (temp & ~PORT_PE,				&ehci->regs->port_status [wIndex]);			break;		case USB_PORT_FEAT_C_ENABLE:			writel (temp | PORT_PEC,				&ehci->regs->port_status [wIndex]);			break;		case USB_PORT_FEAT_SUSPEND:		case USB_PORT_FEAT_C_SUSPEND:			/* ? */			break;		case USB_PORT_FEAT_POWER:			if (HCS_PPC (ehci->hcs_params))				writel (temp & ~PORT_POWER,					&ehci->regs->port_status [wIndex]);			break;		case USB_PORT_FEAT_C_CONNECTION:			writel (temp | PORT_CSC,				&ehci->regs->port_status [wIndex]);			break;		case USB_PORT_FEAT_C_OVER_CURRENT:			writel (temp | PORT_OCC,				&ehci->regs->port_status [wIndex]);			break;		case USB_PORT_FEAT_C_RESET:			/* GetPortStatus clears reset */			break;		default:			goto error;		}		readl (&ehci->regs->command);	/* unblock posted write */		break;	case GetHubDescriptor:		ehci_hub_descriptor (ehci, (struct usb_hub_descriptor *)			buf);		break;	case GetHubStatus:		/* no hub-wide feature/status flags */		memset (buf, 0, 4);		//cpu_to_le32s ((u32 *) buf);		break;	case GetPortStatus:		if (!wIndex || wIndex > ports)			goto error;		wIndex--;		status = 0;		temp = readl (&ehci->regs->port_status [wIndex]);		// wPortChange bits		if (temp & PORT_CSC)			status |= 1 << USB_PORT_FEAT_C_CONNECTION;		if (temp & PORT_PEC)			status |= 1 << USB_PORT_FEAT_C_ENABLE;		// USB_PORT_FEAT_C_SUSPEND		if (temp & PORT_OCC)			status |= 1 << USB_PORT_FEAT_C_OVER_CURRENT;//.........这里部分代码省略.........
开发者ID:iwangv,项目名称:edimax-br-6528n,代码行数:101,


示例20: ehci_pci_setup

//.........这里部分代码省略.........				u8 tmp;				ehci_info(ehci, "applying AMD SB600/SB700 USB "					"freeze workaround/n");				pci_read_config_byte(pdev, 0x53, &tmp);				pci_write_config_byte(pdev, 0x53, tmp | (1<<3));			}			pci_dev_put(p_smbus);		}		break;	case PCI_VENDOR_ID_NETMOS:		/* MosChip frame-index-register bug */		ehci_info(ehci, "applying MosChip frame-index workaround/n");		ehci->frame_index_bug = 1;		break;	}	/* optional debug port, normally in the first BAR */	temp = pci_find_capability(pdev, 0x0a);	if (temp) {		pci_read_config_dword(pdev, temp, &temp);		temp >>= 16;		if ((temp & (3 << 13)) == (1 << 13)) {			temp &= 0x1fff;			ehci->debug = ehci_to_hcd(ehci)->regs + temp;			temp = ehci_readl(ehci, &ehci->debug->control);			ehci_info(ehci, "debug port %d%s/n",				HCS_DEBUG_PORT(ehci->hcs_params),				(temp & DBGP_ENABLED)					? " IN USE"					: "");			if (!(temp & DBGP_ENABLED))				ehci->debug = NULL;		}	}	ehci_reset(ehci);	/* at least the Genesys GL880S needs fixup here */	temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params);	temp &= 0x0f;	if (temp && HCS_N_PORTS(ehci->hcs_params) > temp) {		ehci_dbg(ehci, "bogus port configuration: "			"cc=%d x pcc=%d < ports=%d/n",			HCS_N_CC(ehci->hcs_params),			HCS_N_PCC(ehci->hcs_params),			HCS_N_PORTS(ehci->hcs_params));		switch (pdev->vendor) {		case 0x17a0:		/* GENESYS */			/* GL880S: should be PORTS=2 */			temp |= (ehci->hcs_params & ~0xf);			ehci->hcs_params = temp;			break;		case PCI_VENDOR_ID_NVIDIA:			/* NF4: should be PCC=10 */			break;		}	}	/* Serial Bus Release Number is at PCI 0x60 offset */	pci_read_config_byte(pdev, 0x60, &ehci->sbrn);	if (pdev->vendor == PCI_VENDOR_ID_STMICRO	    && pdev->device == PCI_DEVICE_ID_STMICRO_USB_HOST)		ehci->sbrn = 0x20; /* ConneXT has no sbrn register */	/* Keep this around for a while just in case some EHCI	 * implementation uses legacy PCI PM support.  This test	 * can be removed on 17 Dec 2009 if the dev_warn() hasn't	 * been triggered by then.	 */	if (!device_can_wakeup(&pdev->dev)) {		u16	port_wake;		pci_read_config_word(pdev, 0x62, &port_wake);		if (port_wake & 0x0001) {			dev_warn(&pdev->dev, "Enabling legacy PCI PM/n");			device_set_wakeup_capable(&pdev->dev, 1);		}	}#ifdef	CONFIG_USB_SUSPEND	/* REVISIT: the controller works fine for wakeup iff the root hub	 * itself is "globally" suspended, but usbcore currently doesn't	 * understand such things.	 *	 * System suspend currently expects to be able to suspend the entire	 * device tree, device-at-a-time.  If we failed selective suspend	 * reports, system suspend would fail; so the root hub code must claim	 * success.  That's lying to usbcore, and it matters for runtime	 * PM scenarios with selective suspend and remote wakeup...	 */	if (ehci->no_selective_suspend && device_can_wakeup(&pdev->dev))		ehci_warn(ehci, "selective suspend/wakeup unavailable/n");#endif	ehci_port_power(ehci, 1);	retval = ehci_pci_reinit(ehci, pdev);done:	return retval;}
开发者ID:404992361,项目名称:mi1_kernel,代码行数:101,


示例21: ehci_pci_setup

//.........这里部分代码省略.........	case PCI_VENDOR_ID_VIA:		if (pdev->device == 0x3104 && (pdev->revision & 0xf0) == 0x60) {			u8 tmp;			/* The VT6212 defaults to a 1 usec EHCI sleep time which			 * hogs the PCI bus *badly*. Setting bit 5 of 0x4B makes			 * that sleep time use the conventional 10 usec.			 */			pci_read_config_byte(pdev, 0x4b, &tmp);			if (tmp & 0x20)				break;			pci_write_config_byte(pdev, 0x4b, tmp | 0x20);		}		break;	case PCI_VENDOR_ID_ATI:		/* SB600 and old version of SB700 have a bug in EHCI controller,		 * which causes usb devices lose response in some cases.		 */		if ((pdev->device == 0x4386) || (pdev->device == 0x4396)) {			p_smbus = pci_get_device(PCI_VENDOR_ID_ATI,						 PCI_DEVICE_ID_ATI_SBX00_SMBUS,						 NULL);			if (!p_smbus)				break;			rev = p_smbus->revision;			if ((pdev->device == 0x4386) || (rev == 0x3a)			    || (rev == 0x3b)) {				u8 tmp;				ehci_info(ehci, "applying AMD SB600/SB700 USB "					"freeze workaround/n");				pci_read_config_byte(pdev, 0x53, &tmp);				pci_write_config_byte(pdev, 0x53, tmp | (1<<3));			}			pci_dev_put(p_smbus);		}		break;	}	ehci_reset(ehci);	/* at least the Genesys GL880S needs fixup here */	temp = HCS_N_CC(ehci->hcs_params) * HCS_N_PCC(ehci->hcs_params);	temp &= 0x0f;	if (temp && HCS_N_PORTS(ehci->hcs_params) > temp) {		ehci_dbg(ehci, "bogus port configuration: "			"cc=%d x pcc=%d < ports=%d/n",			HCS_N_CC(ehci->hcs_params),			HCS_N_PCC(ehci->hcs_params),			HCS_N_PORTS(ehci->hcs_params));		switch (pdev->vendor) {		case 0x17a0:		/* GENESYS */			/* GL880S: should be PORTS=2 */			temp |= (ehci->hcs_params & ~0xf);			ehci->hcs_params = temp;			break;		case PCI_VENDOR_ID_NVIDIA:			/* NF4: should be PCC=10 */			break;		}	}	/* Serial Bus Release Number is at PCI 0x60 offset */	pci_read_config_byte(pdev, 0x60, &ehci->sbrn);	/* Keep this around for a while just in case some EHCI	 * implementation uses legacy PCI PM support.  This test	 * can be removed on 17 Dec 2009 if the dev_warn() hasn't	 * been triggered by then.	 */	if (!device_can_wakeup(&pdev->dev)) {		u16	port_wake;		pci_read_config_word(pdev, 0x62, &port_wake);		if (port_wake & 0x0001) {			dev_warn(&pdev->dev, "Enabling legacy PCI PM/n");			device_set_wakeup_capable(&pdev->dev, 1);		}	}#ifdef	CONFIG_USB_SUSPEND	/* REVISIT: the controller works fine for wakeup iff the root hub	 * itself is "globally" suspended, but usbcore currently doesn't	 * understand such things.	 *	 * System suspend currently expects to be able to suspend the entire	 * device tree, device-at-a-time.  If we failed selective suspend	 * reports, system suspend would fail; so the root hub code must claim	 * success.  That's lying to usbcore, and it matters for for runtime	 * PM scenarios with selective suspend and remote wakeup...	 */	if (ehci->no_selective_suspend && device_can_wakeup(&pdev->dev))		ehci_warn(ehci, "selective suspend/wakeup unavailable/n");#endif	ehci_port_power(ehci, 1);	retval = ehci_pci_reinit(ehci, pdev);done:	return retval;}
开发者ID:percy-g2,项目名称:rowboat-kernel,代码行数:101,



注:本文中的HCS_N_PORTS函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ HC_LENGTH函数代码示例
C++ HCD_IsDeviceConnected函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。