当前位置: 首页>>代码示例>>C++>>正文


C++ USBC_REG_PCTL函数代码示例

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


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

示例1: sw_hcd_port_suspend

/*
*******************************************************************************
*                     sw_hcd_port_suspend
*
* Description:
*    suspend USB port
*
* Parameters:
*    sw_hcd        :  input.  USB¿ØÖÆÆ÷
*    do_suspend  :  input.  flag. is suspend USB port or not?
*
* Return value:
*    void
*
* note:
*    void
*
*******************************************************************************
*/
static void sw_hcd_port_suspend(struct sw_hcd *sw_hcd, bool do_suspend)
{
    u8 power = 0;
	void __iomem *usbc_base = sw_hcd->mregs;

	if (!is_host_active(sw_hcd)){
	    DMSG_PANIC("ERR: usb host is not active\n");
	    return;
	}

	/* NOTE:  this doesn't necessarily put PHY into low power mode,
	 * turning off its clock; that's a function of PHY integration and
	 * sw_hcd_POWER_ENSUSPEND.  PHY may need a clock (sigh) to detect
	 * SE0 changing to connect (J) or wakeup (K) states.
	 */
    power = USBC_Readb(USBC_REG_PCTL(usbc_base));
	if (do_suspend) {
		int retries = 10000;

		DMSG_INFO("[sw_hcd]: suspend port.\n");

        power &= ~(1 << USBC_BP_POWER_H_RESUME);
		power |= (1 << USBC_BP_POWER_H_SUSPEND);
		USBC_Writeb(power, USBC_REG_PCTL(usbc_base));

		/* Needed for OPT A tests */
		power = USBC_Readb(USBC_REG_PCTL(usbc_base));
		while (power & (1 << USBC_BP_POWER_H_SUSPEND)) {
			power = USBC_Readb(USBC_REG_PCTL(usbc_base));
			if (retries-- < 1)
				break;
		}

	    DMSG_DBG_HCD("DBG: Root port suspended, power %02x\n", power);

		sw_hcd->port1_status |= USB_PORT_STAT_SUSPEND;
    }else if (power & (1 << USBC_BP_POWER_H_SUSPEND)){
		DMSG_INFO("[sw_hcd]: suspend portend, resume port.\n");

        power &= ~(1 << USBC_BP_POWER_H_SUSPEND);
		power |= (1 << USBC_BP_POWER_H_RESUME);
		USBC_Writeb(power, USBC_REG_PCTL(usbc_base));

		DMSG_DBG_HCD("DBG: Root port resuming, power %02x\n", power);

		/* later, GetPortStatus will stop RESUME signaling */
		sw_hcd->port1_status |= SW_HCD_PORT_STAT_RESUME;
		sw_hcd->rh_timer = jiffies + msecs_to_jiffies(20);
    }else{
        DMSG_PANIC("WRN: sw_hcd_port_suspend nothing to do\n");
    }

    return ;
}
开发者ID:mfkiwl,项目名称:PhoenixA20_linux_sourcecode,代码行数:73,代码来源:sw_hcd_virt_hub.c

示例2: USBC_Dev_ConectSwitch

/*
***********************************************************************************
*                     USBC_Dev_ConectSwitch
*
* Description:
*    和PC通信的开关
*
* Arguments:
*    hUSB   :  input.  USBC_open_otg获得的句柄, 记录了USBC所需要的一些关键数据
*    is_on  :  input.  1: 打开和PC通信开关. 0: 关闭和PC通信通道
*
* Returns:
*
*
* note:
*    无
*
***********************************************************************************
*/
void USBC_Dev_ConectSwitch(__hdle hUSB, __u32 is_on)
{
    __usbc_otg_t *usbc_otg = (__usbc_otg_t *)hUSB;

	if(usbc_otg == NULL){
		return ;
	}

	if(is_on == USBC_DEVICE_SWITCH_ON){
		USBC_REG_set_bit_b(USBC_BP_POWER_D_SOFT_CONNECT, USBC_REG_PCTL(usbc_otg->base_addr));
	}else{
		USBC_REG_clear_bit_b(USBC_BP_POWER_D_SOFT_CONNECT, USBC_REG_PCTL(usbc_otg->base_addr));
	}
}
开发者ID:dmitry-shavyrin,项目名称:a64_lichee,代码行数:33,代码来源:usbc_dev.c

示例3: __USBC_Dev_TsType_Bulk

static void __USBC_Dev_TsType_Bulk(ulong usbc_base_addr)
{
    //--<1>--disable其他传输类型
    USBC_REG_clear_bit_b(USBC_BP_POWER_D_ISO_UPDATE_EN, USBC_REG_PCTL(usbc_base_addr));

	//--<2>--选择 Ctrl 类型
	/* 不需要配置 */
}
开发者ID:dmitry-shavyrin,项目名称:a64_lichee,代码行数:8,代码来源:usbc_dev.c

示例4: __USBC_Dev_TsType_Iso

static void __USBC_Dev_TsType_Iso(__u32 usbc_base_addr)
{
    //--<1>--disable其他传输类型
    /* 不需要配置 */

    //--<2>--选择 Ctrl 类型
    USBC_REG_set_bit_b(USBC_BP_POWER_D_ISO_UPDATE_EN, USBC_REG_PCTL(usbc_base_addr));
}
开发者ID:Aorjoa,项目名称:bootloader,代码行数:8,代码来源:usbc_dev.c

示例5: USBC_Host_QueryPowerStatus

__u32 USBC_Host_QueryPowerStatus(__hdle hUSB)
{
    __usbc_otg_t *usbc_otg = (__usbc_otg_t *)hUSB;

	if(usbc_otg == NULL){
		return 0;
	}

	return USBC_Readb(USBC_REG_PCTL(usbc_otg->base_addr));
}
开发者ID:BOOKEEN,项目名称:u-boot-2011,代码行数:10,代码来源:usbc_host.c

示例6: USBC_Host_SuspendPort

/* usb 端口suspend */
void USBC_Host_SuspendPort(__hdle hUSB)
{
    __usbc_otg_t *usbc_otg = (__usbc_otg_t *)hUSB;

	if(usbc_otg == NULL){
		return ;
	}

    USBC_REG_set_bit_b(USBC_BP_POWER_H_SUSPEND, USBC_REG_PCTL(usbc_otg->base_addr));
}
开发者ID:BOOKEEN,项目名称:u-boot-2011,代码行数:11,代码来源:usbc_host.c

示例7: USBC_Host_ClearRusumePortFlag

/* USBC_Host_RusumePort和USBC_Host_ClearRusumePortFlag应该合并的, 但是在bsp层延时会影响效率 */
void USBC_Host_ClearRusumePortFlag(__hdle hUSB)
{
    __usbc_otg_t *usbc_otg = (__usbc_otg_t *)hUSB;

	if(usbc_otg == NULL){
		return ;
	}

    USBC_REG_clear_bit_b(USBC_BP_POWER_H_RESUME, USBC_REG_PCTL(usbc_otg->base_addr));
}
开发者ID:BOOKEEN,项目名称:u-boot-2011,代码行数:11,代码来源:usbc_host.c

示例8: USBC_Host_ResetPort

/* reset usb 端口上的设备, 建议reset时间为100ms */
void USBC_Host_ResetPort(__hdle hUSB)
{
    __usbc_otg_t *usbc_otg = (__usbc_otg_t *)hUSB;

	if(usbc_otg == NULL){
		return ;
	}

    USBC_REG_set_bit_b(USBC_BP_POWER_H_RESET, USBC_REG_PCTL(usbc_otg->base_addr));
}
开发者ID:BOOKEEN,项目名称:u-boot-2011,代码行数:11,代码来源:usbc_host.c

示例9: USBC_Host_QueryTransferMode

__u32 USBC_Host_QueryTransferMode(__hdle hUSB)
{
    __usbc_otg_t *usbc_otg = (__usbc_otg_t *)hUSB;

	if(usbc_otg == NULL){
		return USBC_TS_MODE_UNKOWN;
	}

    if(USBC_REG_test_bit_b(USBC_BP_POWER_H_HIGH_SPEED_FLAG, USBC_REG_PCTL(usbc_otg->base_addr))){
		return USBC_TS_MODE_HS;
	}else{
	    return USBC_TS_MODE_FS;
	}
}
开发者ID:BOOKEEN,项目名称:u-boot-2011,代码行数:14,代码来源:usbc_host.c

示例10: __USBC_Host_TsMode_Ls

/* 配置 low speed */
static void __USBC_Host_TsMode_Ls(__u32 usbc_base_addr)
{
    USBC_REG_clear_bit_b(USBC_BP_POWER_H_HIGH_SPEED_EN, USBC_REG_PCTL(usbc_base_addr));
}
开发者ID:BOOKEEN,项目名称:u-boot-2011,代码行数:5,代码来源:usbc_host.c

示例11: __USBC_Dev_TsMode_Fs

static void __USBC_Dev_TsMode_Fs(ulong usbc_base_addr)
{
    USBC_REG_clear_bit_b(USBC_BP_POWER_D_HIGH_SPEED_EN, USBC_REG_PCTL(usbc_base_addr));
}
开发者ID:dmitry-shavyrin,项目名称:a64_lichee,代码行数:4,代码来源:usbc_dev.c

示例12: __USBC_Dev_TsType_default

/*
 ***************************************************************************
 *
 * 选择 usb device 的传输类型。如控制传输、同步传输、中断传输、批量传输。
 *
 ***************************************************************************
 */
static void __USBC_Dev_TsType_default(ulong usbc_base_addr)
{
    //disable所有传输类型
    USBC_REG_clear_bit_b(USBC_BP_POWER_D_ISO_UPDATE_EN, USBC_REG_PCTL(usbc_base_addr));
}
开发者ID:dmitry-shavyrin,项目名称:a64_lichee,代码行数:12,代码来源:usbc_dev.c

示例13: __USBC_Dev_TsMode_Hs

static void __USBC_Dev_TsMode_Hs(__u32 usbc_base_addr)
{
    USBC_REG_set_bit_b(USBC_BP_POWER_D_HIGH_SPEED_EN, USBC_REG_PCTL(usbc_base_addr));
}
开发者ID:Aorjoa,项目名称:bootloader,代码行数:4,代码来源:usbc_dev.c

示例14: sw_hcd_hub_control


//.........这里部分代码省略.........
    				);
    		desc->bPwrOn2PwrGood = 5;	/* msec/2 */
    		desc->bHubContrCurrent = 0;

    		/* workaround bogus struct definition */
    		desc->u.hs.DeviceRemovable[0] = 0x02;	/* port 1 */
    		desc->u.hs.DeviceRemovable[1] = 0xff;
        }
		break;

	    case GetHubStatus:
		    temp = 0;
		    *(__le32 *) buf = cpu_to_le32(temp);
		break;

	    case GetPortStatus:
	    {
    		if (wIndex != 1){
    		    DMSG_PANIC("ERR: GetPortStatus parameter wIndex is not 1.\n");
    		    goto error;
    		}

    		/* finish RESET signaling? */
    		if ((sw_hcd->port1_status & USB_PORT_STAT_RESET)
    				&& time_after_eq(jiffies, sw_hcd->rh_timer)){
    			sw_hcd_port_reset(sw_hcd, false);
    		}

    		/* finish RESUME signaling? */
    		if ((sw_hcd->port1_status & SW_HCD_PORT_STAT_RESUME)
    				&& time_after_eq(jiffies, sw_hcd->rh_timer)) {
    			u8 power = 0;

    			power = USBC_Readb(USBC_REG_PCTL(usbc_base));
				power &= ~(1 << USBC_BP_POWER_H_RESUME);
    			USBC_Writeb(power, USBC_REG_PCTL(usbc_base));

    			DMSG_DBG_HCD("DBG: root port resume stopped, power %02x\n", power);

    			/* ISSUE:  DaVinci (RTL 1.300) disconnects after
    			 * resume of high speed peripherals (but not full
    			 * speed ones).
    			 */

    			sw_hcd->is_active = 1;
    			sw_hcd->port1_status &= ~(USB_PORT_STAT_SUSPEND
    					| SW_HCD_PORT_STAT_RESUME);
    			sw_hcd->port1_status |= USB_PORT_STAT_C_SUSPEND << 16;

    			usb_hcd_poll_rh_status(sw_hcd_to_hcd(sw_hcd));
    		}

    		put_unaligned(cpu_to_le32(sw_hcd->port1_status
    					& ~SW_HCD_PORT_STAT_RESUME),
    				(__le32 *) buf);

    		/* port change status is more interesting */
    		DMSG_DBG_HCD("DBG: port status %08x\n", sw_hcd->port1_status);
    	}
		break;

	    case SetPortFeature:
	    {
    		if ((wIndex & 0xff) != 1){
    		    goto error;
    		}
开发者ID:mfkiwl,项目名称:PhoenixA20_linux_sourcecode,代码行数:67,代码来源:sw_hcd_virt_hub.c

示例15: sw_hcd_port_reset

/*
*******************************************************************************
*                     sw_hcd_port_reset
*
* Description:
*    reset USB port
*
* Parameters:
*    sw_hcd       :  input.  USB¿ØÖÆÆ÷
*    do_reset   :  input.  flag. is reset USB port or not?
*
* Return value:
*    void
*
* note:
*    void
*
*******************************************************************************
*/
static void sw_hcd_port_reset(struct sw_hcd *sw_hcd, bool do_reset)
{
    u8 power = 0;
	void __iomem *usbc_base = sw_hcd->mregs;

	if (!is_host_active(sw_hcd)){
	    DMSG_PANIC("ERR: usb host is not active\n");
	    return;
	}

	/* NOTE:  caller guarantees it will turn off the reset when
	 * the appropriate amount of time has passed
	 */
	power = USBC_Readb(USBC_REG_PCTL(usbc_base));
	if (do_reset) {
        DMSG_INFO("[sw_hcd]: reset port. \n");

		/*
		 * If RESUME is set, we must make sure it stays minimum 20 ms.
		 * Then we must clear RESUME and wait a bit to let sw_hcd start
		 * generating SOFs. If we don't do this, OPT HS A 6.8 tests
		 * fail with "Error! Did not receive an SOF before suspend
		 * detected".
		 */
		if (power & (1 << USBC_BP_POWER_H_RESUME)) {
			while (time_before(jiffies, sw_hcd->rh_timer)){
			    msleep(1);
			}

            power &= ~(1 << USBC_BP_POWER_H_RESUME);
			USBC_Writeb(power, USBC_REG_PCTL(usbc_base));
			msleep(1);
		}

		sw_hcd->ignore_disconnect = true;
		power &= 0xf0;
		power |= (1 << USBC_BP_POWER_H_RESET);
        USBC_Writeb(power, USBC_REG_PCTL(usbc_base));

        sw_hcd->port1_status |= USB_PORT_STAT_RESET;
		sw_hcd->port1_status &= ~USB_PORT_STAT_ENABLE;
		sw_hcd->rh_timer = jiffies + msecs_to_jiffies(50);

		USBC_Host_SetFunctionAddress_Deafult(sw_hcd->sw_hcd_io->usb_bsp_hdle, USBC_EP_TYPE_TX, 0);

		//set address ep0
		{
		    __u32 i = 1;
			__u8 old_ep_index = 0;

			old_ep_index = USBC_GetActiveEp(sw_hcd->sw_hcd_io->usb_bsp_hdle);

			USBC_SelectActiveEp(sw_hcd->sw_hcd_io->usb_bsp_hdle, 0);
			USBC_Host_SetFunctionAddress_Deafult(sw_hcd->sw_hcd_io->usb_bsp_hdle, USBC_EP_TYPE_TX, 0);

			for( i = 1 ; i <= 5; i++){
				USBC_SelectActiveEp(sw_hcd->sw_hcd_io->usb_bsp_hdle, i);
				USBC_Host_SetFunctionAddress_Deafult(sw_hcd->sw_hcd_io->usb_bsp_hdle, USBC_EP_TYPE_TX, i);
				USBC_Host_SetFunctionAddress_Deafult(sw_hcd->sw_hcd_io->usb_bsp_hdle, USBC_EP_TYPE_RX, i);
			}

			USBC_SelectActiveEp(sw_hcd->sw_hcd_io->usb_bsp_hdle, old_ep_index);
		}
    }else{
        DMSG_INFO("[sw_hcd]: reset port stopped.\n");

        UsbPhyEndReset(0);

        power &= ~(1 << USBC_BP_POWER_H_RESET);
        USBC_Writeb(power, USBC_REG_PCTL(usbc_base));

        sw_hcd->ignore_disconnect = false;

        power = USBC_Readb(USBC_REG_PCTL(usbc_base));
        if(power & (1 << USBC_BP_POWER_H_HIGH_SPEED_FLAG)){
            DMSG_DBG_HCD("high-speed device connected\n");
			sw_hcd->port1_status |= USB_PORT_STAT_HIGH_SPEED;
        }

        sw_hcd->port1_status &= ~USB_PORT_STAT_RESET;
		sw_hcd->port1_status |= USB_PORT_STAT_ENABLE
//.........这里部分代码省略.........
开发者ID:mfkiwl,项目名称:PhoenixA20_linux_sourcecode,代码行数:101,代码来源:sw_hcd_virt_hub.c


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