• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ CSR_READ_4函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: pnphy_status

static void
pnphy_status(struct mii_softc *sc)
{
	struct mii_data *mii = sc->mii_pdata;
	int reg;
	struct dc_softc		*dc_sc;

	dc_sc = mii->mii_ifp->if_softc;

	mii->mii_media_status = IFM_AVALID;
	mii->mii_media_active = IFM_ETHER;

	reg = CSR_READ_4(dc_sc, DC_ISR);

	if (!(reg & DC_ISR_LINKFAIL))
		mii->mii_media_status |= IFM_ACTIVE;

	if (CSR_READ_4(dc_sc, DC_NETCFG) & DC_NETCFG_SPEEDSEL)
		mii->mii_media_active |= IFM_10_T;
	else
		mii->mii_media_active |= IFM_100_TX;
	if (CSR_READ_4(dc_sc, DC_NETCFG) & DC_NETCFG_FULLDUPLEX)
		mii->mii_media_active |= IFM_FDX;
	else
		mii->mii_media_active |= IFM_HDX;
}
开发者ID:BlueFireworks,项目名称:rtems-libbsd,代码行数:26,代码来源:pnphy.c


示例2: bfe_core_reset

static void
bfe_core_reset( struct bfe_softc * sc )
{
	u_int32_t val;

	/* Disable the core */
	bfe_core_disable(sc);

	/* and bring it back up */
	CSR_WRITE_4(sc, BFE_SBTMSLOW, (BFE_RESET | BFE_CLOCK | BFE_FGC));
	CSR_READ_4(sc, BFE_SBTMSLOW);
	DELAY(10);

	/* Chip bug, clear SERR, IB and TO if they are set. */
	if (CSR_READ_4(sc, BFE_SBTMSHIGH) & BFE_SERR)
		CSR_WRITE_4(sc, BFE_SBTMSHIGH, 0);
	val = CSR_READ_4(sc, BFE_SBIMSTATE);
	if (val & (BFE_IBE | BFE_TO))
		CSR_WRITE_4(sc, BFE_SBIMSTATE, val & ~(BFE_IBE | BFE_TO));

	/* Clear reset and allow it to move through the core */
	CSR_WRITE_4(sc, BFE_SBTMSLOW, (BFE_CLOCK | BFE_FGC));
	CSR_READ_4(sc, BFE_SBTMSLOW);
	DELAY(10);

	/* Leave the clock set */
	CSR_WRITE_4(sc, BFE_SBTMSLOW, BFE_CLOCK);
	CSR_READ_4(sc, BFE_SBTMSLOW);
	DELAY(10);
}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:30,代码来源:if_bfe.c


示例3: aml8726_gpio_pin_setflags

/* Set a specific pin's in/out state. */
static int
aml8726_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags)
{
	struct aml8726_gpio_softc *sc = device_get_softc(dev);
	uint32_t mask = 1U << pin;

	if (pin >= sc->npins)
		return (EINVAL);

	AML_GPIO_LOCK(sc);

	if ((flags & GPIO_PIN_OUTPUT) != 0) {
		/* Output.  Turn on driver.  */
		CSR_WRITE_4(sc, AML_GPIO_OE_N_REG,
		    (CSR_READ_4(sc, AML_GPIO_OE_N_REG) & ~mask));
	} else {
		/* Input.  Turn off driver. */
		CSR_WRITE_4(sc, AML_GPIO_OE_N_REG,
		    (CSR_READ_4(sc, AML_GPIO_OE_N_REG) | mask));
	}
		
	AML_GPIO_UNLOCK(sc);

	return (0);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:26,代码来源:aml8726_gpio.c


示例4: kr_miibus_writereg

static int
kr_miibus_writereg(device_t dev, int phy, int reg, int data)
{
	struct kr_softc * sc = device_get_softc(dev);
	int i;

	i = KR_MII_TIMEOUT;
	while ((CSR_READ_4(sc, KR_MIIMIND) & KR_MIIMIND_BSY) && i)
		i--;

	if (i == 0)
		device_printf(dev, "phy mii is busy %d:%d\n", phy, reg);

	CSR_WRITE_4(sc, KR_MIIMADDR, (phy << 8) | reg);

	i = KR_MII_TIMEOUT;
	while ((CSR_READ_4(sc, KR_MIIMIND) & KR_MIIMIND_BSY) && i)
		i--;

	if (i == 0)
		device_printf(dev, "phy mii is busy %d:%d\n", phy, reg);

	CSR_WRITE_4(sc, KR_MIIMWTD, data);

	i = KR_MII_TIMEOUT;
	while ((CSR_READ_4(sc, KR_MIIMIND) & KR_MIIMIND_BSY) && i)
		i--;

	if (i == 0)
		device_printf(dev, "phy mii is busy %d:%d\n", phy, reg);

	return (0);
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:33,代码来源:if_kr.c


示例5: pcn_getfactaddr

static void
pcn_getfactaddr(pcn_t *pcnp)
{
	uint32_t addr[2];

	addr[0] = CSR_READ_4(pcnp, PCN_IO32_APROM00);
	addr[1] = CSR_READ_4(pcnp, PCN_IO32_APROM01);

	bcopy(&addr[0], &pcnp->pcn_addr[0], sizeof (pcnp->pcn_addr));
}
开发者ID:apprisi,项目名称:illumos-gate,代码行数:10,代码来源:pcn.c


示例6: dcphy_status

static void
dcphy_status(struct mii_softc *sc)
{
	struct mii_data *mii = sc->mii_pdata;
	int reg, anlpar, tstat = 0;
	struct dc_softc		*dc_sc;

	dc_sc = mii->mii_ifp->if_softc;

	mii->mii_media_status = IFM_AVALID;
	mii->mii_media_active = IFM_ETHER;

	if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
		return;

	reg = CSR_READ_4(dc_sc, DC_10BTSTAT);
	if (!(reg & DC_TSTAT_LS10) || !(reg & DC_TSTAT_LS100))
		mii->mii_media_status |= IFM_ACTIVE;

	if (CSR_READ_4(dc_sc, DC_10BTCTRL) & DC_TCTL_AUTONEGENBL) {
		/* Erg, still trying, I guess... */
		tstat = CSR_READ_4(dc_sc, DC_10BTSTAT);
		if ((tstat & DC_TSTAT_ANEGSTAT) != DC_ASTAT_AUTONEGCMP) {
			if ((DC_IS_MACRONIX(dc_sc) || DC_IS_PNICII(dc_sc)) &&
			    (tstat & DC_TSTAT_ANEGSTAT) == DC_ASTAT_DISABLE)
				goto skip;
			mii->mii_media_active |= IFM_NONE;
			return;
		}

		if (tstat & DC_TSTAT_LP_CAN_NWAY) {
			anlpar = tstat >> 16;
			if (anlpar & ANLPAR_TX_FD &&
			    sc->mii_capabilities & BMSR_100TXFDX)
				mii->mii_media_active |= IFM_100_TX | IFM_FDX;
			else if (anlpar & ANLPAR_T4 &&
			    sc->mii_capabilities & BMSR_100T4)
				mii->mii_media_active |= IFM_100_T4 | IFM_HDX;
			else if (anlpar & ANLPAR_TX &&
			    sc->mii_capabilities & BMSR_100TXHDX)
				mii->mii_media_active |= IFM_100_TX | IFM_HDX;
			else if (anlpar & ANLPAR_10_FD)
				mii->mii_media_active |= IFM_10_T | IFM_FDX;
			else if (anlpar & ANLPAR_10)
				mii->mii_media_active |= IFM_10_T | IFM_HDX;
			else
				mii->mii_media_active |= IFM_NONE;
			if (DC_IS_INTEL(dc_sc))
				DC_CLRBIT(dc_sc, DC_10BTCTRL,
				    DC_TCTL_AUTONEGENBL);
			return;
		}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:52,代码来源:dcphy.c


示例7: _bs_r

/* special I/O functions */
static __inline u_int32_t
_bs_r(void *v, bus_space_handle_t ioh, bus_size_t off, u_int32_t be)
{
	u_int32_t data;

	CSR_WRITE_4(PCI_NP_AD, (ioh + off) & ~3);
	CSR_WRITE_4(PCI_NP_CBE, be | COMMAND_NP_IO_READ);
	data = CSR_READ_4(PCI_NP_RDATA);
	if (CSR_READ_4(PCI_ISR) & ISR_PFE)
		CSR_WRITE_4(PCI_ISR, ISR_PFE);

	return data;
}
开发者ID:dcui,项目名称:FreeBSD-9.3_kernel,代码行数:14,代码来源:ixp425_pci_space.c


示例8: dump_regs

static void
dump_regs(Environ *e, Self *s)
{
	dprintf("\n");
	dprintf("ethxpro: scb_rus/scb_cus: %#x\n", CSR_READ_1(s, CSR_SCB_RUSCUS));
	dprintf("ethxpro: scb_statack: %#x\n", CSR_READ_1(s, CSR_SCB_STATACK));
	dprintf("ethxpro: scb_command: %#x\n", CSR_READ_1(s, CSR_SCB_COMMAND));
	dprintf("ethxpro: scb_intrcntl: %#x\n", CSR_READ_1(s, CSR_SCB_INTRCNTL));
	dprintf("ethxpro: scb_general: %#x\n", CSR_READ_4(s, CSR_SCB_GENERAL));
	dprintf("ethxpro: port: %#x\n", CSR_READ_4(s, CSR_PORT));
	dprintf("ethxpro: flash control: %#x\n", CSR_READ_2(s, CSR_FLASHCONTROL));
	dprintf("ethxpro: eeprom ctrl: %#x\n", CSR_READ_2(s, CSR_EEPROMCONTROL));
	dprintf("ethxpro: mdi control: %#x\n", CSR_READ_4(s, CSR_MDICONTROL));
}
开发者ID:cstrotm,项目名称:smartfirmware,代码行数:14,代码来源:ethexpro.c


示例9: aml8726_rng_harvest

static void
aml8726_rng_harvest(void *arg)
{
	struct aml8726_rng_softc *sc = arg;
	uint32_t rn[2];

	rn[0] = CSR_READ_4(sc, AML_RNG_0_REG);
	rn[1] = CSR_READ_4(sc, AML_RNG_1_REG);

	random_harvest(rn, sizeof(rn), sizeof(rn) * NBBY / 2,
	    RANDOM_PURE_AML8726);

	callout_reset(&sc->co, sc->ticks, aml8726_rng_harvest, sc);
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:14,代码来源:aml8726_rng.c


示例10: bfe_clear_stats

static void 
bfe_clear_stats( struct bfe_softc * sc )
{
	u_long reg;

	BFE_LOCK(sc);

	CSR_WRITE_4(sc, BFE_MIB_CTRL, BFE_MIB_CLR_ON_READ);
	for (reg = BFE_TX_GOOD_O; reg <= BFE_TX_PAUSE; reg += 4)
		CSR_READ_4(sc, reg);
	for (reg = BFE_RX_GOOD_O; reg <= BFE_RX_NPAUSE; reg += 4)
		CSR_READ_4(sc, reg);

	BFE_UNLOCK(sc);
}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:15,代码来源:if_bfe.c


示例11: aml8726_usb_phy_detach

static int
aml8726_usb_phy_detach(device_t dev)
{
	struct aml8726_usb_phy_softc *sc = device_get_softc(dev);
	uint32_t i;
	uint32_t value;

	/*
	 * Disable by issuing a power on reset.
	 */

	value = CSR_READ_4(sc, AML_USB_PHY_CFG_REG);

	value |= (AML_USB_PHY_CFG_A_POR | AML_USB_PHY_CFG_B_POR);

	CSR_WRITE_4(sc, AML_USB_PHY_CFG_REG, value);

	CSR_BARRIER(sc, AML_USB_PHY_CFG_REG);

	/* Turn off power */
	i = sc->npwr_en;
	while (i-- != 0) {
		(void)GPIO_PIN_SET(sc->pwr_en[i].dev, sc->pwr_en[i].pin,
		    PIN_OFF_FLAG(sc->pwr_en[i].pol));
	}
	free (sc->pwr_en, M_DEVBUF);
	sc->pwr_en = NULL;

	bus_release_resources(dev, aml8726_usb_phy_spec, sc->res);

	return (0);
}
开发者ID:Digital-Chaos,项目名称:freebsd,代码行数:32,代码来源:aml8726_usb_phy-m3.c


示例12: bfe_wait_bit

static int
bfe_wait_bit( struct bfe_softc * sc, u_int32_t reg, u_int32_t bit, 
              u_long timeout, const int clear )
{
	u_long i;
    int use_sleep = 0;

    /* [email protected]: long timeouts polls are done using a blocking wait */
    if (timeout >= 10000) {
        use_sleep = 1;
        timeout /= 1000;
    }

	for (i = 0; i < timeout; i++) {
		u_int32_t val = CSR_READ_4(sc, reg);

		if (clear && !(val & bit))
			break;
		if (!clear && (val & bit))
			break;

        if (use_sleep)
            IOSleep(10);
        else
            DELAY(10);
	}
	if (i == timeout) {
		DEBUG_LOG("bfe%d: BUG!  Timeout waiting for bit %08x of register "
				  "%x to %s.\n", sc->bfe_unit, bit, reg, 
				  (clear ? "clear" : "set"));
		return -1;
	}
	return 0;
}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:34,代码来源:if_bfe.c


示例13: kse_init

void *
kse_init(unsigned tag, void *data)
{
	struct local *l;
	struct desc *txd, *rxd;
	unsigned i, val, fdx;
	uint8_t *en;

	l = ALLOC(struct local, sizeof(struct desc)); /* desc alignment */
	memset(l, 0, sizeof(struct local));
	l->csr = DEVTOV(pcicfgread(tag, 0x10));

	en = data;
	i = CSR_READ_2(l, MARL);
	en[0] = i;
	en[1] = i >> 8;
	i = CSR_READ_2(l, MARM);
	en[2] = i;
	en[3] = i >> 8;
	i = CSR_READ_2(l, MARH);
	en[4] = i;
	en[5] = i >> 8;

	printf("MAC address %02x:%02x:%02x:%02x:%02x:%02x\n",
	    en[0], en[1], en[2], en[3], en[4], en[5]);

	CSR_WRITE_2(l, CIDR, 1);

	mii_dealan(l, 5);

	val = pcicfgread(tag, PCI_ID_REG);
	if (PCI_PRODUCT(val) == 0x8841) {
		val = CSR_READ_4(l, P1SR);
		fdx = !!(val & (1U << 9));
		printf("%s", (val & (1U << 8)) ? "100Mbps" : "10Mbps");
		if (fdx)
			printf("-FDX");
		printf("\n");
	}

	txd = &l->txd;
	rxd = &l->rxd[0];
	rxd[0].xd0 = htole32(R0_OWN);
	rxd[0].xd1 = htole32(FRAMESIZE);
	rxd[0].xd2 = htole32(VTOPHYS(l->rxstore[0]));
	rxd[0].xd3 = htole32(VTOPHYS(&rxd[1]));
	rxd[1].xd0 = htole32(R0_OWN);
	rxd[1].xd1 = htole32(R1_RER | FRAMESIZE);
	rxd[1].xd2 = htole32(VTOPHYS(l->rxstore[1]));
	rxd[1].xd3 = htole32(VTOPHYS(&rxd[0]));
	l->rx = 0;

	CSR_WRITE_4(l, TDLB, VTOPHYS(txd));
	CSR_WRITE_4(l, RDLB, VTOPHYS(rxd));
	CSR_WRITE_4(l, MDTXC, 07); /* stretch short, add CRC, Tx enable */
	CSR_WRITE_4(l, MDRXC, 01); /* Rx enable */
	CSR_WRITE_4(l, MDRSC, 01); /* start receiving */

	return l;
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:60,代码来源:kse.c


示例14: aml8726_gpio_pin_toggle

/* Toggle a pin's output value. */
static int
aml8726_gpio_pin_toggle(device_t dev, uint32_t pin)
{
	struct aml8726_gpio_softc *sc = device_get_softc(dev);
	uint32_t mask;

	if (pin >= sc->npins)
		return (EINVAL);

	/*
	 * The GPIOAO OUT bits occupy the upper word of the OEN register.
	 */
	if (rman_get_start(sc->res[1]) == rman_get_start(sc->res[0]))
		pin += 16;

	mask = 1U << pin;

	AML_GPIO_LOCK(sc);

	CSR_WRITE_4(sc, AML_GPIO_OUT_REG,
	    CSR_READ_4(sc, AML_GPIO_OUT_REG) ^ mask);

	AML_GPIO_UNLOCK(sc);

	return (0);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:27,代码来源:aml8726_gpio.c


示例15: pxa2x0_i2c_wait

int
pxa2x0_i2c_wait(struct pxa2x0_i2c_softc *sc, int bit, int flags)
{
	uint32_t isr;
	int error;
	int i;

	for (i = I2C_TIMEOUT; i >= 0; --i) {
		isr = CSR_READ_4(sc, I2C_ISR);
		if (isr & (bit | ISR_BED))
			break;
		delay(1);
	}

	if (isr & (ISR_BED | (bit & ISR_ALD)))
		error = EIO;
	else if (isr & (bit & ~ISR_ALD))
		error = 0;
	else
		error = ETIMEDOUT;

	CSR_WRITE_4(sc, I2C_ISR, isr);

	return error;
}
开发者ID:krytarowski,项目名称:netbsd-current-src-sys,代码行数:25,代码来源:pxa2x0_i2c.c


示例16: jz4780_get_timecount

static unsigned
jz4780_get_timecount(struct timecounter *tc)
{
	struct jz4780_timer_softc *sc =
	    (struct jz4780_timer_softc *)tc->tc_priv;

	return CSR_READ_4(sc, JZ_OST_CNT_LO);
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:8,代码来源:jz4780_timer.c


示例17: bfe_pci_setup

static void
bfe_pci_setup( struct bfe_softc * sc, u_int32_t cores )
{
	u_int32_t bar_orig, pci_rev, val;

	bar_orig = pci_read_config(sc->bfe_dev, BFE_BAR0_WIN, 4);
	pci_write_config(sc->bfe_dev, BFE_BAR0_WIN, BFE_REG_PCI, 4);
	pci_rev = CSR_READ_4(sc, BFE_SBIDHIGH) & BFE_RC_MASK;

	val = CSR_READ_4(sc, BFE_SBINTVEC);
	val |= cores;
	CSR_WRITE_4(sc, BFE_SBINTVEC, val);

	val = CSR_READ_4(sc, BFE_SSB_PCI_TRANS_2);
	val |= BFE_SSB_PCI_PREF | BFE_SSB_PCI_BURST;
	CSR_WRITE_4(sc, BFE_SSB_PCI_TRANS_2, val);

	pci_write_config(sc->bfe_dev, BFE_BAR0_WIN, bar_orig, 4);
}
开发者ID:AzerTyQsdF,项目名称:osx,代码行数:19,代码来源:if_bfe.c


示例18: _bs_w

static __inline void
_bs_w(void *v, bus_space_handle_t ioh, bus_size_t off,
	u_int32_t be, u_int32_t data)
{
	CSR_WRITE_4(PCI_NP_AD, (ioh + off) & ~3);
	CSR_WRITE_4(PCI_NP_CBE, be | COMMAND_NP_IO_WRITE);
	CSR_WRITE_4(PCI_NP_WDATA, data);
	if (CSR_READ_4(PCI_ISR) & ISR_PFE)
		CSR_WRITE_4(PCI_ISR, ISR_PFE);
}
开发者ID:dcui,项目名称:FreeBSD-9.3_kernel,代码行数:10,代码来源:ixp425_pci_space.c


示例19: __haiku_disable_interrupts

int
__haiku_disable_interrupts(device_t dev)
{
	struct vge_softc *sc = device_get_softc(dev);

	if (CSR_READ_4(sc, VGE_ISR) == 0)
		return 0;

	CSR_WRITE_4(sc, VGE_IMR, 0x00000000);
	return 1;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:11,代码来源:glue.c


示例20: pxa2x0_i2c_reset

void
pxa2x0_i2c_reset(struct pxa2x0_i2c_softc *sc)
{

	CSR_WRITE_4(sc, I2C_ICR, ICR_UR);
	CSR_WRITE_4(sc, I2C_ISAR, 0);
	CSR_WRITE_4(sc, I2C_ISR, ISR_ALL);
	while (CSR_READ_4(sc, I2C_ICR) & ~ICR_UR)
		continue;
	CSR_WRITE_4(sc, I2C_ICR, sc->sc_icr);
}
开发者ID:krytarowski,项目名称:netbsd-current-src-sys,代码行数:11,代码来源:pxa2x0_i2c.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CSR_WRITE_2函数代码示例发布时间:2022-05-30
下一篇:
C++ CSPUTILSLOG函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap