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

C++ device_get_sysctl_ctx函数代码示例

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

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



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

示例1: acpi_dock_attach

static int
acpi_dock_attach(device_t dev)
{
    struct acpi_dock_softc *sc;
    ACPI_HANDLE	h;

    sc = device_get_softc(dev);
    h = acpi_get_handle(dev);
    if (sc == NULL || h == NULL)
        return (ENXIO);

    sc->status = ACPI_DOCK_STATUS_UNKNOWN;

    AcpiEvaluateObject(h, "_INI", NULL, NULL);

    ACPI_SERIAL_BEGIN(dock);

    acpi_dock_device_check(dev);

    /* Get the sysctl tree */
    sc->sysctl_ctx = device_get_sysctl_ctx(dev);
    sc->sysctl_tree = device_get_sysctl_tree(dev);

    SYSCTL_ADD_INT(sc->sysctl_ctx,
                   SYSCTL_CHILDREN(sc->sysctl_tree),
                   OID_AUTO, "_sta", CTLFLAG_RD,
                   &sc->_sta, 0, "Dock _STA");
    SYSCTL_ADD_INT(sc->sysctl_ctx,
                   SYSCTL_CHILDREN(sc->sysctl_tree),
                   OID_AUTO, "_bdn", CTLFLAG_RD,
                   &sc->_bdn, 0, "Dock _BDN");
    SYSCTL_ADD_INT(sc->sysctl_ctx,
                   SYSCTL_CHILDREN(sc->sysctl_tree),
                   OID_AUTO, "_uid", CTLFLAG_RD,
                   &sc->_uid, 0, "Dock _UID");
    SYSCTL_ADD_PROC(sc->sysctl_ctx,
                    SYSCTL_CHILDREN(sc->sysctl_tree),
                    OID_AUTO, "status",
                    CTLTYPE_INT|CTLFLAG_RW, dev, 0,
                    acpi_dock_status_sysctl, "I",
                    "Dock/Undock operation");

    ACPI_SERIAL_END(dock);

    AcpiInstallNotifyHandler(h, ACPI_ALL_NOTIFY,
                             acpi_dock_notify_handler, dev);

    return (0);
}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:49,代码来源:acpi_dock.c


示例2: ath_rate_sysctlattach

static void
ath_rate_sysctlattach(struct ath_softc *sc, struct sample_softc *osc)
{
	struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
	struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);

	/* XXX bounds check [0..100] */
	SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
		"smoothing_rate", CTLFLAG_RW, &osc->ath_smoothing_rate, 0,
		"rate control: retry threshold to credit rate raise (%%)");
	/* XXX bounds check [2..100] */
	SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
		"sample_rate", CTLFLAG_RW, &osc->ath_sample_rate,0,
		"rate control: # good periods before raising rate");
}
开发者ID:syedzubairahmed,项目名称:FreeBSD-7.3-dyntick,代码行数:15,代码来源:sample.c


示例3: ath_sysctl_stats_attach_rxphyerr

static void
ath_sysctl_stats_attach_rxphyerr(struct ath_softc *sc, struct sysctl_oid_list *parent)
{
	struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
	struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);
	struct sysctl_oid_list *child = SYSCTL_CHILDREN(tree);
	int i;
	char sn[8];

	tree = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, "rx_phy_err", CTLFLAG_RD, NULL, "Per-code RX PHY Errors");
	child = SYSCTL_CHILDREN(tree);
	for (i = 0; i < 64; i++) {
		snprintf(sn, sizeof(sn), "%d", i);
		SYSCTL_ADD_UINT(ctx, child, OID_AUTO, sn, CTLFLAG_RD, &sc->sc_stats.ast_rx_phy[i], 0, "");
	}
}
开发者ID:dcui,项目名称:FreeBSD-9.3_kernel,代码行数:16,代码来源:if_ath_sysctl.c


示例4: sfxge_vpd_init

static int
sfxge_vpd_init(struct sfxge_softc *sc)
{
	struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->dev);
	struct sysctl_oid *vpd_node;
	struct sysctl_oid_list *vpd_list;
	char keyword[3];
	efx_vpd_value_t value;
	int rc;

	if ((rc = efx_vpd_size(sc->enp, &sc->vpd_size)) != 0)
		goto fail;
	sc->vpd_data = malloc(sc->vpd_size, M_SFXGE, M_WAITOK);
	if ((rc = efx_vpd_read(sc->enp, sc->vpd_data, sc->vpd_size)) != 0)
		goto fail2;

	/* Copy ID (product name) into device description, and log it. */
	value.evv_tag = EFX_VPD_ID;
	if (efx_vpd_get(sc->enp, sc->vpd_data, sc->vpd_size, &value) == 0) {
		value.evv_value[value.evv_length] = 0;
		device_set_desc_copy(sc->dev, value.evv_value);
		device_printf(sc->dev, "%s\n", value.evv_value);
	}

	vpd_node = SYSCTL_ADD_NODE(
		ctx, SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev)),
		OID_AUTO, "vpd", CTLFLAG_RD, NULL, "Vital Product Data");
	vpd_list = SYSCTL_CHILDREN(vpd_node);

	/* Add sysctls for all expected and any vendor-defined keywords. */
	sfxge_vpd_try_add(sc, vpd_list, EFX_VPD_RO, "PN");
	sfxge_vpd_try_add(sc, vpd_list, EFX_VPD_RO, "EC");
	sfxge_vpd_try_add(sc, vpd_list, EFX_VPD_RO, "SN");
	keyword[0] = 'V';
	keyword[2] = 0;
	for (keyword[1] = '0'; keyword[1] <= '9'; keyword[1]++)
		sfxge_vpd_try_add(sc, vpd_list, EFX_VPD_RO, keyword);
	for (keyword[1] = 'A'; keyword[1] <= 'Z'; keyword[1]++)
		sfxge_vpd_try_add(sc, vpd_list, EFX_VPD_RO, keyword);

	return 0;
	
fail2:
	free(sc->vpd_data, M_SFXGE);
fail:
	return rc;
}
开发者ID:AhmadTux,项目名称:freebsd,代码行数:47,代码来源:sfxge.c


示例5: tegra124_coretemp_attach

static int
tegra124_coretemp_attach(device_t dev)
{
	struct tegra124_coretemp_softc *sc;
	device_t pdev;
	struct sysctl_oid *oid;
	struct sysctl_ctx_list *ctx;
	int rv;

	sc = device_get_softc(dev);
	sc->dev = dev;
	sc->cpu_id = device_get_unit(dev);
	sc->core_max_temp = 102000;
	pdev = device_get_parent(dev);

	rv = tegra124_coretemp_ofw_parse(sc);
	if (rv != 0)
		return (rv);

	ctx = device_get_sysctl_ctx(dev);

	oid = SYSCTL_ADD_NODE(ctx,
	    SYSCTL_CHILDREN(device_get_sysctl_tree(pdev)), OID_AUTO,
	    "coretemp", CTLFLAG_RD, NULL, "Per-CPU thermal information");

	/*
	 * Add the MIBs to dev.cpu.N and dev.cpu.N.coretemp.
	 */
	SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(device_get_sysctl_tree(pdev)),
	    OID_AUTO, "temperature", CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE,
	    dev, CORETEMP_TEMP, coretemp_get_val_sysctl, "IK",
	    "Current temperature");
	SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "delta",
	    CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, dev, CORETEMP_DELTA,
	    coretemp_get_val_sysctl, "I",
	    "Delta between TCC activation and current temperature");
	SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "resolution",
	    CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, dev, CORETEMP_RESOLUTION,
	    coretemp_get_val_sysctl, "I",
	    "Resolution of CPU thermal sensor");
	SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(oid), OID_AUTO, "tjmax",
	    CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, dev, CORETEMP_TJMAX,
	    coretemp_get_val_sysctl, "IK",
	    "TCC activation temperature");

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


示例6: sfxge_ev_init

int
sfxge_ev_init(struct sfxge_softc *sc)
{
	struct sysctl_ctx_list *sysctl_ctx = device_get_sysctl_ctx(sc->dev);
	struct sysctl_oid *sysctl_tree = device_get_sysctl_tree(sc->dev);
	struct sfxge_intr *intr;
	int index;
	int rc;

	intr = &sc->intr;

	sc->evq_count = intr->n_alloc;

	KASSERT(intr->state == SFXGE_INTR_INITIALIZED,
	    ("intr->state != SFXGE_INTR_INITIALIZED"));

	/* Set default interrupt moderation; add a sysctl to
	 * read and change it.
	 */
	sc->ev_moderation = SFXGE_MODERATION;
	SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree),
			OID_AUTO, "int_mod", CTLTYPE_UINT|CTLFLAG_RW,
			sc, 0, sfxge_int_mod_handler, "IU",
			"sfxge interrupt moderation (us)");

	/*
	 * Initialize the event queue(s) - one per interrupt.
	 */
	for (index = 0; index < sc->evq_count; index++) {
		if ((rc = sfxge_ev_qinit(sc, index)) != 0)
			goto fail;
	}

#if EFSYS_OPT_QSTATS
	sfxge_ev_stat_init(sc);
#endif

	return (0);

fail:
	while (--index >= 0)
		sfxge_ev_qfini(sc, index);

	sc->evq_count = 0;
	return (rc);
}
开发者ID:JasonFord53,项目名称:freebsd,代码行数:46,代码来源:sfxge_ev.c


示例7: bcm_fb_sysctl_init

static void
bcm_fb_sysctl_init(struct bcmsc_softc *sc)
{
	struct sysctl_ctx_list *ctx;
	struct sysctl_oid *tree_node;
	struct sysctl_oid_list *tree;

	/*
	 * Add system sysctl tree/handlers.
	 */
	ctx = device_get_sysctl_ctx(sc->dev);
	tree_node = device_get_sysctl_tree(sc->dev);
	tree = SYSCTL_CHILDREN(tree_node);
	SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "resync",
	    CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc),
	    bcm_fb_resync_sysctl, "IU", "Set to resync framebuffer with VC");
}
开发者ID:KingD512,项目名称:freebsd,代码行数:17,代码来源:bcm2835_fbd.c


示例8: ath_rate_sysctlattach

static void
ath_rate_sysctlattach(struct ath_softc *sc)
{
	struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev);
	struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev);

	SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
		"rate_interval", CTLFLAG_RW, &ath_rateinterval, 0,
		"rate control: operation interval (ms)");
	/* XXX bounds check values */
	SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
		"rate_raise", CTLFLAG_RW, &ath_rate_raise, 0,
		"rate control: retry threshold to credit rate raise (%%)");
	SYSCTL_ADD_INT(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
		"rate_raise_threshold", CTLFLAG_RW, &ath_rate_raise_threshold,0,
		"rate control: # good periods before raising rate");
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:17,代码来源:onoe.c


示例9: vchi_audio_sysctl_init

static void
vchi_audio_sysctl_init(struct bcm2835_audio_info *sc)
{
	struct sysctl_ctx_list *ctx;
	struct sysctl_oid *tree_node;
	struct sysctl_oid_list *tree;

	/*
	 * Add system sysctl tree/handlers.
	 */
	ctx = device_get_sysctl_ctx(sc->dev);
	tree_node = device_get_sysctl_tree(sc->dev);
	tree = SYSCTL_CHILDREN(tree_node);
	SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "dest",
	    CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc),
	    sysctl_bcm2835_audio_dest, "IU", "audio destination, "
	    "0 - auto, 1 - headphones, 2 - HDMI");
}
开发者ID:fengsi,项目名称:freebsd,代码行数:18,代码来源:bcm2835_audio.c


示例10: sfxge_vpd_try_add

static void
sfxge_vpd_try_add(struct sfxge_softc *sc, struct sysctl_oid_list *list,
		  efx_vpd_tag_t tag, const char *keyword)
{
	struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->dev);
	efx_vpd_value_t value;

	/* Check whether VPD tag/keyword is present */
	value.evv_tag = tag;
	value.evv_keyword = EFX_VPD_KEYWORD(keyword[0], keyword[1]);
	if (efx_vpd_get(sc->enp, sc->vpd_data, sc->vpd_size, &value) != 0)
		return;

	SYSCTL_ADD_PROC(
		ctx, list, OID_AUTO, keyword, CTLTYPE_STRING|CTLFLAG_RD,
		sc, tag << 16 | EFX_VPD_KEYWORD(keyword[0], keyword[1]),
		sfxge_vpd_handler, "A", "");
}
开发者ID:AhmadTux,项目名称:freebsd,代码行数:18,代码来源:sfxge.c


示例11: acpi_sony_attach

static int
acpi_sony_attach(device_t dev)
{
	struct acpi_sony_softc *sc;
	int i;

	sc = device_get_softc(dev);
	acpi_GetInteger(acpi_get_handle(dev), ACPI_SONY_GET_PID, &sc->pid);
	device_printf(dev, "PID %x\n", sc->pid);
	for (i = 0 ; acpi_sony_oids[i].nodename != NULL; i++){
		SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev),
		    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)),
		    i, acpi_sony_oids[i].nodename , CTLTYPE_INT |
		    ((acpi_sony_oids[i].setmethod)? CTLFLAG_RW: CTLFLAG_RD),
		    dev, i, sysctl_acpi_sony_gen_handler, "I",
		    acpi_sony_oids[i].comment);
	}
	return (0);
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:19,代码来源:acpi_sony.c


示例12: ti_adc_sysctl_init

static void
ti_adc_sysctl_init(struct ti_adc_softc *sc)
{
	char pinbuf[3];
	struct sysctl_ctx_list *ctx;
	struct sysctl_oid *tree_node, *inp_node, *inpN_node;
	struct sysctl_oid_list *tree, *inp_tree, *inpN_tree;
	int ain;

	/*
	 * Add per-pin sysctl tree/handlers.
	 */
	ctx = device_get_sysctl_ctx(sc->sc_dev);
	tree_node = device_get_sysctl_tree(sc->sc_dev);
	tree = SYSCTL_CHILDREN(tree_node);
	SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "clockdiv",
	    CTLFLAG_RW | CTLTYPE_UINT,  sc, 0,
	    ti_adc_clockdiv_proc, "IU", "ADC clock prescaler");
	inp_node = SYSCTL_ADD_NODE(ctx, tree, OID_AUTO, "ain",
	    CTLFLAG_RD, NULL, "ADC inputs");
	inp_tree = SYSCTL_CHILDREN(inp_node);

	for (ain = 0; ain < TI_ADC_NPINS; ain++) {

		snprintf(pinbuf, sizeof(pinbuf), "%d", ain);
		inpN_node = SYSCTL_ADD_NODE(ctx, inp_tree, OID_AUTO, pinbuf,
		    CTLFLAG_RD, NULL, "ADC input");
		inpN_tree = SYSCTL_CHILDREN(inpN_node);

		SYSCTL_ADD_PROC(ctx, inpN_tree, OID_AUTO, "enable",
		    CTLFLAG_RW | CTLTYPE_UINT, &ti_adc_inputs[ain], 0,
		    ti_adc_enable_proc, "IU", "Enable ADC input");
		SYSCTL_ADD_PROC(ctx, inpN_tree, OID_AUTO, "open_delay",
		    CTLFLAG_RW | CTLTYPE_UINT,  &ti_adc_inputs[ain], 0,
		    ti_adc_open_delay_proc, "IU", "ADC open delay");
		SYSCTL_ADD_PROC(ctx, inpN_tree, OID_AUTO, "samples_avg",
		    CTLFLAG_RW | CTLTYPE_UINT,  &ti_adc_inputs[ain], 0,
		    ti_adc_samples_avg_proc, "IU", "ADC samples average");
		SYSCTL_ADD_INT(ctx, inpN_tree, OID_AUTO, "input",
		    CTLFLAG_RD, &ti_adc_inputs[ain].value, 0,
		    "Converted raw value for the ADC input");
	}
}
开发者ID:MattDooner,项目名称:freebsd-west,代码行数:43,代码来源:ti_adc.c


示例13: sfxge_ev_stat_init

static void
sfxge_ev_stat_init(struct sfxge_softc *sc)
{
	struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->dev);
	struct sysctl_oid_list *stat_list;
	unsigned int id;
	char name[40];

	stat_list = SYSCTL_CHILDREN(sc->stats_node);

	for (id = 0; id < EV_NQSTATS; id++) {
		snprintf(name, sizeof(name), "ev_%s",
			 efx_ev_qstat_name(sc->enp, id));
		SYSCTL_ADD_PROC(
			ctx, stat_list,
			OID_AUTO, name, CTLTYPE_U64|CTLFLAG_RD,
			sc, id, sfxge_ev_stat_handler, "Q",
			"");
	}
}
开发者ID:dcui,项目名称:FreeBSD-9.3_kernel,代码行数:20,代码来源:sfxge_ev.c


示例14: at24co2n_attach

static int
at24co2n_attach(device_t dev)
{
	struct at24co2n_softc *sc = device_get_softc(dev);
	struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(dev);
	struct sysctl_oid *tree = device_get_sysctl_tree(dev);

	if(sc == NULL) {
		printf("at24co2n_attach device_get_softc failed\n");
		return (0);
	}
	sc->sc_dev = dev;
	sc->sc_addr = iicbus_get_addr(dev);

	SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
		"eeprom-mac", CTLTYPE_STRING | CTLFLAG_RD, sc, 0,
		at24co2n_mac_sysctl, "A", "mac address");

	return (0);
}
开发者ID:BillTheBest,项目名称:libuinet,代码行数:20,代码来源:at24co2n.c


示例15: uart_pps_init

static void
uart_pps_init(struct uart_softc *sc)
{
	struct sysctl_ctx_list *ctx;
	struct sysctl_oid *tree;

	ctx = device_get_sysctl_ctx(sc->sc_dev);
	tree = device_get_sysctl_tree(sc->sc_dev);

	/*
	 * The historical default for pps capture mode is either DCD or CTS,
	 * depending on the UART_PPS_ON_CTS kernel option.  Start with that,
	 * then try to fetch the tunable that overrides the mode for all uart
	 * devices, then try to fetch the sysctl-tunable that overrides the mode
	 * for one specific device.
	 */
#ifdef UART_PPS_ON_CTS
	sc->sc_pps_mode = UART_PPS_CTS;
#else
	sc->sc_pps_mode = UART_PPS_DCD;
#endif
	TUNABLE_INT_FETCH("hw.uart.pps_mode", &sc->sc_pps_mode);
	SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, "pps_mode",
	    CTLTYPE_INT | CTLFLAG_RWTUN, sc, 0, uart_pps_mode_sysctl, "I",
	    "pulse mode: 0/1/2=disabled/CTS/DCD; "
	    "add 0x10 to invert, 0x20 for narrow pulse");

	if (!uart_pps_mode_valid(sc->sc_pps_mode)) {
		device_printf(sc->sc_dev, 
		    "Invalid pps_mode 0x%02x configured; disabling PPS capture\n",
		    sc->sc_pps_mode);
		sc->sc_pps_mode = UART_PPS_DISABLED;
	} else if (bootverbose) {
		uart_pps_print_mode(sc);
	}

	sc->sc_pps.ppscap = PPS_CAPTUREBOTH;
	sc->sc_pps.driver_mtx = uart_tty_getlock(sc);
	sc->sc_pps.driver_abi = PPS_ABI_VERSION;
	pps_init_abi(&sc->sc_pps);
}
开发者ID:2trill2spill,项目名称:freebsd,代码行数:41,代码来源:uart_core.c


示例16: rstmgr_add_sysctl

static int
rstmgr_add_sysctl(struct rstmgr_softc *sc)
{
	struct sysctl_oid_list *children;
	struct sysctl_ctx_list *ctx;

	ctx = device_get_sysctl_ctx(sc->dev);
	children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->dev));

	SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "fpga2hps",
	    CTLTYPE_UINT | CTLFLAG_RW, sc, RSTMGR_SYSCTL_FPGA2HPS,
	    rstmgr_sysctl, "I", "Enable fpga2hps bridge");
	SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "lwhps2fpga",
	    CTLTYPE_UINT | CTLFLAG_RW, sc, RSTMGR_SYSCTL_LWHPS2FPGA,
	    rstmgr_sysctl, "I", "Enable lwhps2fpga bridge");
	SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "hps2fpga",
	    CTLTYPE_UINT | CTLFLAG_RW, sc, RSTMGR_SYSCTL_HPS2FPGA,
	    rstmgr_sysctl, "I", "Enable hps2fpga bridge");

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


示例17: ds1307_start

static void
ds1307_start(void *xdev)
{
	device_t dev;
	struct ds1307_softc *sc;
	struct sysctl_ctx_list *ctx;
	struct sysctl_oid *tree_node;
	struct sysctl_oid_list *tree;

	dev = (device_t)xdev;
	sc = device_get_softc(dev);
	ctx = device_get_sysctl_ctx(dev);
	tree_node = device_get_sysctl_tree(dev);
	tree = SYSCTL_CHILDREN(tree_node);

	config_intrhook_disestablish(&sc->enum_hook);
	/* Set the 24 hours mode. */
	if (ds1307_set_24hrs_mode(sc) != 0)
		return;
	/* Enable the oscillator if halted. */
	if (ds1307_osc_enable(sc) != 0)
		return;

	/* Configuration parameters. */
	SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "sqwe",
	    CTLFLAG_RW | CTLTYPE_UINT | CTLFLAG_MPSAFE, sc, 0,
	    ds1307_sqwe_sysctl, "IU", "DS1307 square-wave enable");
	SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "sqw_freq",
	    CTLFLAG_RW | CTLTYPE_UINT | CTLFLAG_MPSAFE, sc, 0,
	    ds1307_sqw_freq_sysctl, "IU",
	    "DS1307 square-wave output frequency");
	SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "sqw_out",
	    CTLFLAG_RW | CTLTYPE_UINT | CTLFLAG_MPSAFE, sc, 0,
	    ds1307_sqw_out_sysctl, "IU", "DS1307 square-wave output state");

	/* 1 second resolution. */
	clock_register(dev, 1000000);
}
开发者ID:2asoft,项目名称:freebsd,代码行数:38,代码来源:ds1307.c


示例18: spigen_sysctl_init

static void
spigen_sysctl_init(struct spigen_softc *sc)
{
    struct sysctl_ctx_list *ctx;
    struct sysctl_oid *tree_node;
    struct sysctl_oid_list *tree;

    /*
     * Add system sysctl tree/handlers.
     */
    ctx = device_get_sysctl_ctx(sc->sc_dev);
    tree_node = device_get_sysctl_tree(sc->sc_dev);
    tree = SYSCTL_CHILDREN(tree_node);
    SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "command_length_max",
                    CTLFLAG_MPSAFE | CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc),
                    spigen_command_length_max_proc, "IU", "SPI command header portion (octets)");
    SYSCTL_ADD_PROC(ctx, tree, OID_AUTO, "data_length_max",
                    CTLFLAG_MPSAFE | CTLFLAG_RW | CTLTYPE_UINT, sc, sizeof(*sc),
                    spigen_data_length_max_proc, "IU", "SPI data trailer portion (octets)");
    SYSCTL_ADD_INT(ctx, tree, OID_AUTO, "data", CTLFLAG_RW,
                   &sc->sc_debug, 0, "debug flags");

}
开发者ID:bsd-hacker,项目名称:freebsd,代码行数:23,代码来源:spigen.c


示例19: max6657_attach

static int
max6657_attach(device_t dev)
{
	struct max6657_softc *sc = device_get_softc(dev);
	struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(dev);
	struct sysctl_oid *tree = device_get_sysctl_tree(dev);

	if(sc==NULL) {
		printf("max6657_attach device_get_softc failed\n");
		return (0);
	}
	sc->sc_dev = dev;
	sc->sc_addr = iicbus_get_addr(dev);

	SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
		"temp", CTLTYPE_INT | CTLFLAG_RD, sc, 0,
		max6657_sysctl_temp, "I", "operating temperature");

	device_printf(dev, "Chip temperature {%d} Degree Celsius\n",
		max6657_read(sc->sc_dev, sc->sc_addr, MAX6657_EXT_TEMP));

	return (0);
}
开发者ID:coyizumi,项目名称:cs111,代码行数:23,代码来源:max6657.c


示例20: gpiobacklight_attach

static int
gpiobacklight_attach(device_t dev)
{
    struct gpiobacklight_softc *sc;
    struct sysctl_ctx_list *ctx;
    struct sysctl_oid *tree;
    phandle_t node;

    sc = device_get_softc(dev);

    if ((node = ofw_bus_get_node(dev)) == -1)
        return (ENXIO);

    if (OF_hasprop(node, "default-on"))
        sc->sc_brightness = true;
    else
        sc->sc_brightness = false;

    gpio_pin_get_by_ofw_idx(dev, node, 0, &sc->sc_pin);
    if (sc->sc_pin == NULL) {
        device_printf(dev, "failed to map GPIO pin\n");
        return (ENXIO);
    }

    gpio_pin_setflags(sc->sc_pin, GPIO_PIN_OUTPUT);

    gpiobacklight_update_brightness(sc);

    /* Init backlight interface */
    ctx = device_get_sysctl_ctx(dev);
    tree = device_get_sysctl_tree(dev);
    sc->sc_oid = SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO,
                                 "brightness", CTLTYPE_INT | CTLFLAG_RW, sc, 0,
                                 gpiobacklight_sysctl, "I", "backlight brightness");

    return (0);
}
开发者ID:tomtor,项目名称:freebsd,代码行数:37,代码来源:gpiobacklight.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ device_get_sysctl_tree函数代码示例发布时间:2022-05-30
下一篇:
C++ device_get_softc函数代码示例发布时间: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