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


C++ device_parent函数代码示例

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


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

示例1: slhci_opio_attach

static void
slhci_opio_attach(struct device *parent, struct device *self, void *aux)
{
	struct slhci_opio_softc *sc = (struct slhci_opio_softc *)self;
	struct obio_attach_args *oba = aux;
	struct opio_softc *psc =
	    (struct opio_softc *)device_parent(self);
	struct obio_softc *bsc =
	    (struct obio_softc *)device_parent(&psc->sc_dev);
	bus_space_tag_t iot = oba->oba_iot;
	bus_space_handle_t ioh;

	printf("\n");

	/* Map I/O space */
	if (bus_space_map(iot, oba->oba_addr, PORTSIZE, 0, &ioh)) {
		printf("%s: can't map I/O space\n",
			sc->sc_sc.sc_bus.bdev.dv_xname);
		return;
	}

	/* Initialize sc */
	sc->sc_sc.sc_iot = iot;
	sc->sc_sc.sc_ioh = ioh;
	sc->sc_sc.sc_dmat = &pxa2x0_bus_dma_tag;	/* XXX */
	sc->sc_sc.sc_enable_power = slhci_opio_enable_power;
	sc->sc_sc.sc_enable_intr  = slhci_opio_enable_intr;
	sc->sc_sc.sc_arg = sc;

	/* Establish the interrupt handler */
	sc->sc_ih = obio_intr_establish(bsc, oba->oba_intr, IPL_BIO, 
	    IST_LEVEL_HIGH, slhci_opio_intr, sc);
	if( sc->sc_ih == NULL) {
		printf("%s: can't establish interrupt\n",
			sc->sc_sc.sc_bus.bdev.dv_xname);
		return;
	}

#if 0
	/* Reset controller */
	obio_peripheral_reset(bsc, 2, 1);
	delay(100);
	obio_peripheral_reset(bsc, 2, 0);
	delay(40000);
#endif

	bus_space_write_1(iot, ioh, SL11_IDX_ADDR, SL11_CTRL);
	bus_space_write_1(iot, ioh, SL11_IDX_DATA, 0x01);

	/* Attach SL811HS/T */
	if (slhci_attach(&sc->sc_sc, self))
		return;
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:53,代码来源:gb225_slhci.c

示例2: slhci_opio_enable_intr

static void
slhci_opio_enable_intr(void *arg, int mode)
{
	struct slhci_opio_softc *sc = arg;
	struct obio_softc *bsc;

	bsc = (struct obio_softc *)device_parent(
	    device_parent(&sc->sc_sc.sc_bus.bdev));

	if (mode == INTR_ON)
		obio_intr_unmask(bsc, sc->sc_ih);
	else
		obio_intr_mask(bsc, sc->sc_ih);
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:14,代码来源:gb225_slhci.c

示例3: fxp_cardbus_setup

static void
fxp_cardbus_setup(struct fxp_softc * sc)
{
    struct fxp_cardbus_softc *csc = (struct fxp_cardbus_softc *)sc;
    struct cardbus_softc *psc = device_private(device_parent(sc->sc_dev));
    cardbus_chipset_tag_t cc = psc->sc_cc;
    cardbus_function_tag_t cf = psc->sc_cf;
    pcireg_t command;

    cardbustag_t tag = cardbus_make_tag(cc, cf, csc->ct->ct_bus,
                                        csc->ct->ct_func);

    command = Cardbus_conf_read(csc->ct, tag, CARDBUS_COMMAND_STATUS_REG);
    if (csc->base0_reg) {
        Cardbus_conf_write(csc->ct, tag,
                           CARDBUS_BASE0_REG, csc->base0_reg);
        (cf->cardbus_ctrl) (cc, CARDBUS_MEM_ENABLE);
        command |= CARDBUS_COMMAND_MEM_ENABLE |
                   CARDBUS_COMMAND_MASTER_ENABLE;
    } else if (csc->base1_reg) {
        Cardbus_conf_write(csc->ct, tag,
                           CARDBUS_BASE1_REG, csc->base1_reg);
        (cf->cardbus_ctrl) (cc, CARDBUS_IO_ENABLE);
        command |= (CARDBUS_COMMAND_IO_ENABLE |
                    CARDBUS_COMMAND_MASTER_ENABLE);
    }

    (cf->cardbus_ctrl) (cc, CARDBUS_BM_ENABLE);

    /* enable the card */
    Cardbus_conf_write(csc->ct, tag, CARDBUS_COMMAND_STATUS_REG, command);
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:32,代码来源:if_fxp_cardbus.c

示例4: vexpress_device_register

void
vexpress_device_register(device_t self, void *aux)
{
	prop_dictionary_t dict = device_properties(self);

	if (device_is_a(self, "armperiph")
	    && device_is_a(device_parent(self), "mainbus")) {
		/*
		 * XXX KLUDGE ALERT XXX
		 * The iot mainbus supplies is completely wrong since it scales
		 * addresses by 2.  The simpliest remedy is to replace with our
		 * bus space used for the armcore regisers (which armperiph uses).
		 */
		struct mainbus_attach_args *const mb = aux;
		mb->mb_iot = &vexpress_bs_tag;
		return;
	}
#if defined(CPU_CORTEXA7) || defined(CPU_CORTEXA15)
	if (device_is_a(self, "armgtmr")) {
		/*
		 * The frequency of the generic timer is the reference
		 * frequency.
		 */
		prop_dictionary_set_uint32(dict, "frequency", VEXPRESS_REF_FREQ);
		return;
	}
#endif
}
开发者ID:krytarowski,项目名称:netbsd-current-src-sys,代码行数:28,代码来源:vexpress_machdep.c

示例5: ibm4xx_device_register

void
ibm4xx_device_register(struct device *dev, void *aux)
{
    struct device *parent = device_parent(dev);

    if (device_is_a(dev, "emac") && device_is_a(parent, "opb")) {
        /* Set the mac-addr of the on-chip Ethernet. */
        struct opb_attach_args *oaa = aux;

        if (oaa->opb_instance < 10) {
            prop_data_t pd;
            unsigned char prop_name[15];

            snprintf(prop_name, sizeof(prop_name),
                     "emac%d-mac-addr", oaa->opb_instance);

            pd = prop_dictionary_get(board_properties, prop_name);
            if (pd == NULL) {
                printf("WARNING: unable to get mac-addr "
                       "property from board properties\n");
                return;
            }
            if (prop_dictionary_set(device_properties(dev),
                                    "mac-addr", pd) == false) {
                printf("WARNING: unable to set mac-addr "
                       "property for %s\n", dev->dv_xname);
            }
        }
        return;
    }
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:31,代码来源:ibm4xx_autoconf.c

示例6: ld_cac_start

int
ld_cac_start(struct ld_softc *ld, struct buf *bp)
{
	int flags, cmd;
	struct cac_softc *cac;
	struct ld_cac_softc *sc;
	struct cac_context cc;

	sc = (struct ld_cac_softc *)ld;
	cac = device_private(device_parent(ld->sc_dv));

	cc.cc_handler = ld_cac_done;
	cc.cc_context = bp;
	cc.cc_dv = ld->sc_dv;

	if ((bp->b_flags & B_READ) == 0) {
		cmd = CAC_CMD_WRITE;
		flags = CAC_CCB_DATA_OUT;
	} else {
		cmd = CAC_CMD_READ;
		flags = CAC_CCB_DATA_IN;
	}

	return (cac_cmd(cac, cmd, bp->b_data, bp->b_bcount, sc->sc_hwunit,
	    bp->b_rawblkno, flags, &cc));
}
开发者ID:yazshel,项目名称:netbsd-kernel,代码行数:26,代码来源:ld_cac.c

示例7: lcd_ioctl

int
lcd_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l)
{
	struct pxa2x0_lcd_softc *sc = v;
	struct obio_softc *osc = 
	    device_private(device_parent(sc->dev));
	uint16_t reg;

	switch (cmd) {
	case WSDISPLAYIO_SVIDEO:
		reg = bus_space_read_2(osc->sc_iot, osc->sc_obioreg_ioh,
		    G42XXEB_LCDCTL);
		if (*(int *)data == WSDISPLAYIO_VIDEO_ON)
			reg |= LCDCTL_BL_ON;
		else
			reg &= ~LCDCTL_BL_ON;
		bus_space_write_2(osc->sc_iot, osc->sc_obioreg_ioh,
			G42XXEB_LCDCTL, reg);
		bus_space_write_1(osc->sc_iot, osc->sc_obioreg_ioh,
			G42XXEB_LED, reg);
		printf("LCD control: %x\n", reg);
		break;			/* turn on/off LCD controller */
	}

	return pxa2x0_lcd_ioctl(v, vs, cmd, data, flag, l);
}
开发者ID:krytarowski,项目名称:netbsd-current-src-sys,代码行数:26,代码来源:g42xxeb_lcd.c

示例8: fdfinish

void
fdfinish(struct fd_softc *fd, struct buf *bp)
{
	struct fdc_softc *fdc = device_private(device_parent(fd->sc_dev));

	/*
	 * Move this drive to the end of the queue to give others a `fair'
	 * chance.  We only force a switch if N operations are completed while
	 * another drive is waiting to be serviced, since there is a long motor
	 * startup delay whenever we switch.
	 */
	(void)BUFQ_GET(fd->sc_q);
	if (TAILQ_NEXT(fd, sc_drivechain) && ++fd->sc_ops >= 8) {
		fd->sc_ops = 0;
		TAILQ_REMOVE(&fdc->sc_drives, fd, sc_drivechain);
		if (BUFQ_PEEK(fd->sc_q) != NULL)
			TAILQ_INSERT_TAIL(&fdc->sc_drives, fd, sc_drivechain);
		else
			fd->sc_active = 0;
	}
	bp->b_resid = fd->sc_bcount;
	fd->sc_skip = 0;

#if NRND > 0
	rnd_add_uint32(&fd->rnd_source, bp->b_blkno);
#endif

	biodone(bp);
	/* turn off motor 5s from now */
	callout_reset(&fd->sc_motoroff_ch, 5 * hz, fd_motor_off, fd);
	fdc->sc_state = DEVIDLE;
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:32,代码来源:fd.c

示例9: device_register

void
device_register(device_t self, void *aux)
{
	device_t parent = device_parent(self);

	if (parent != NULL && device_is_a(parent, "mainbus")) {
		// If we are attaching a mainbus device, see if we know how
		// to bring it out of reset.
		struct mainbus_attach_args * const ma = aux;
		for (const struct cfg_info *map = map_info;
		     map < map_info + __arraycount(map_info);
		     map++) {
			if (device_is_a(self, map->map_name)) {
				ra_device_fixup(ma->ma_memt, map);
				delay(1000);
				break;
			}
		}

#if defined(RT3883) || defined(MT7620)
		if (device_is_a(self, "ohci") || device_is_a(self, "ehci")) {
			const uint32_t cfg1 = bus_space_read_4(ma->ma_memt,
			    ra_sysctl_bsh, RA_SYSCTL_CFG1);
			if ((cfg1 & SYSCTL_CFG1_USB0_HOST_MODE) == 0) {
				bus_space_write_4(ma->ma_memt, ra_sysctl_bsh,
				    RA_SYSCTL_CFG1,
				    cfg1 | SYSCTL_CFG1_USB0_HOST_MODE);
				delay(10);
			}
		}
#endif
	}
}
开发者ID:krytarowski,项目名称:netbsd-current-src-sys,代码行数:33,代码来源:autoconf.c

示例10: zynq7000_device_register

void
zynq7000_device_register(device_t self, void *aux)
{
	prop_dictionary_t dict = device_properties(self);

	if (device_is_a(self, "armperiph")
	    && device_is_a(device_parent(self), "mainbus")) {
		/*
		 * XXX KLUDGE ALERT XXX
		 * The iot mainbus supplies is completely wrong since it scales
		 * addresses by 2.  The simpliest remedy is to replace with our
		 * bus space used for the armcore registers (which armperiph uses).
		 */
		struct mainbus_attach_args * const mb = aux;
		mb->mb_iot = zynq7000_armcore_bst;
		return;
	}

	/*
	 * We need to tell the A9 Global/Watchdog Timer
	 * what frequency it runs at.
	 */
	if (device_is_a(self, "a9tmr") || device_is_a(self, "a9wdt")) {
		prop_dictionary_set_uint32(dict, "frequency",
		    666666666 / PERIPHCLK_N);
		return;
	}
}
开发者ID:ryo,项目名称:netbsd-src,代码行数:28,代码来源:zynq7000_board.c

示例11: parse_ranges_property

parse_ranges_property(device *current,
		      const char *property_name,
		      const char *property_value)
{
  int nr_ranges;
  int range_nr;
  range_property_spec *ranges;
  const char *chp;
  
  /* determine the number of ranges specified */
  nr_ranges = count_entries(current, property_name, property_value, 3);

  /* create a property of that size */
  ranges = zalloc(nr_ranges * sizeof(*ranges));

  /* fill it in */
  chp = property_value;
  for (range_nr = 0; range_nr < nr_ranges; range_nr++) {
    chp = parse_address(current, current,
			chp, &ranges[range_nr].child_address);
    chp = parse_address(current, device_parent(current),
			chp, &ranges[range_nr].parent_address);
    chp = parse_size(current, current,
		     chp, &ranges[range_nr].size);
  }

  /* create it */
  device_add_range_array_property(current, property_name, ranges, nr_ranges);

  zfree(ranges);
}
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:31,代码来源:tree.c

示例12: parse_reg_property

parse_reg_property(device *current,
		   const char *property_name,
		   const char *property_value)
{
  int nr_regs;
  int reg_nr;
  reg_property_spec *regs;
  const char *chp;
  device *bus = device_parent(current);

  /* determine the number of reg entries by counting tokens */
  nr_regs = count_entries(current, property_name, property_value,
			  1 + (device_nr_size_cells(bus) > 0));

  /* create working space */
  regs = zalloc(nr_regs * sizeof(*regs));

  /* fill it in */
  chp = property_value;
  for (reg_nr = 0; reg_nr < nr_regs; reg_nr++) {
    chp = parse_address(current, bus, chp, &regs[reg_nr].address);
    if (device_nr_size_cells(bus) > 0)
      chp = parse_size(current, bus, chp, &regs[reg_nr].size);
    else
      memset(&regs[reg_nr].size, 0, sizeof (&regs[reg_nr].size));
  }

  /* create it */
  device_add_reg_array_property(current, property_name,
				regs, nr_regs);

  zfree(regs);
}
开发者ID:3125788,项目名称:android_toolchain_gdb,代码行数:33,代码来源:tree.c

示例13: spc_intio_attach

static void
spc_intio_attach(device_t parent, device_t self, void *aux)
{
	struct spc_softc *sc = device_private(self);
	struct intio_attach_args *ia = aux;
	bus_space_tag_t iot = ia->ia_bst;
	bus_space_handle_t ioh;

	sc->sc_dev = self;

	intio_map_allocate_region(device_parent(parent), ia,
				  INTIO_MAP_ALLOCATE);
	if (bus_space_map(iot, ia->ia_addr, 0x20, BUS_SPACE_MAP_SHIFTED,
			  &ioh)) {
		aprint_error(": can't map i/o space\n");
		return;
	}
	aprint_normal("\n");

	sc->sc_iot = iot;
	sc->sc_ioh = ioh;
	sc->sc_initiator = IODEVbase->io_sram[0x70] & 0x7; /* XXX */

	if (intio_intr_establish(ia->ia_intr, "spc", spc_intr, sc))
		panic("spcattach: interrupt vector busy");

	spc_attach(sc);
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:28,代码来源:spc.c

示例14: mtustart

static void
mtustart(struct mt_softc *sc)
{

	dlog(LOG_DEBUG, "%s ustart", device_xname(sc->sc_dev));
	if (hpibreq(device_parent(sc->sc_dev), &sc->sc_hq))
		mtstart(sc);
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:8,代码来源:mt.c

示例15: icpsp_intr

void
icpsp_intr(struct icp_ccb *ic)
{
	struct scsipi_xfer *xs;
 	struct icp_softc *icp;
 	int soff;

#ifdef DIAGNOSTIC
	struct icpsp_softc *sc = device_private(ic->ic_dv);
#endif
	xs = ic->ic_context;
	icp = device_private(device_parent(ic->ic_dv));
	soff = ICP_SCRATCH_SENSE + ic->ic_ident *
	    sizeof(struct scsi_sense_data);

	SC_DEBUG(xs->xs_periph, SCSIPI_DB2, ("icpsp_intr\n"));

	bus_dmamap_sync(icp->icp_dmat, icp->icp_scr_dmamap, soff,
	    sizeof(xs->sense.scsi_sense), BUS_DMASYNC_POSTREAD);

	if (ic->ic_status == ICP_S_OK) {
		xs->status = SCSI_OK;
		xs->resid = 0;
	} else if (ic->ic_status != ICP_S_RAW_SCSI || icp->icp_info >= 0x100) {
		xs->error = XS_SELTIMEOUT;
		xs->resid = xs->datalen;
	} else {
		xs->status = icp->icp_info;

		switch (xs->status) {
		case SCSI_OK:
#ifdef DIAGNOSTIC
			printf("%s: error return (%d), but SCSI_OK?\n",
			    device_xname(sc->sc_dv), icp->icp_info);
#endif
			xs->resid = 0;
			break;
		case SCSI_CHECK:
			memcpy(&xs->sense.scsi_sense,
			    (char *)icp->icp_scr + soff,
			    sizeof(xs->sense.scsi_sense));
			xs->error = XS_SENSE;
			/* FALLTHROUGH */
		default:
			/*
			 * XXX Don't know how to get residual count.
			 */
			xs->resid = xs->datalen;
			break;
		}
	}

	if (xs->datalen != 0)
		icp_ccb_unmap(icp, ic);
	icp_ccb_free(icp, ic);
	scsipi_done(xs);
}
开发者ID:eyberg,项目名称:rumpkernel-netbsd-src,代码行数:57,代码来源:icpsp.c


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