本文整理汇总了C++中callout_init函数的典型用法代码示例。如果您正苦于以下问题:C++ callout_init函数的具体用法?C++ callout_init怎么用?C++ callout_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了callout_init函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ath_rate_attach
struct ath_ratectrl *
ath_rate_attach(struct ath_softc *sc)
{
struct amrr_softc *asc;
asc = malloc(sizeof(struct amrr_softc), M_DEVBUF, M_NOWAIT|M_ZERO);
if (asc == NULL)
return NULL;
asc->arc.arc_space = sizeof(struct amrr_node);
callout_init(&asc->timer, debug_mpsafenet ? CALLOUT_MPSAFE : 0);
ath_rate_sysctlattach(sc);
return &asc->arc;
}
开发者ID:eyberg,项目名称:rumpkernel-netbsd-src,代码行数:14,代码来源:athrate-amrr.c
示例2: ntb_attach
static int
ntb_attach(device_t device)
{
struct ntb_softc *ntb = DEVICE2SOFTC(device);
struct ntb_hw_info *p = ntb_get_device_info(pci_get_devid(device));
int error;
ntb->device = device;
ntb->type = p->type;
ntb->features = p->features;
/* Heartbeat timer for NTB_SOC since there is no link interrupt */
callout_init(&ntb->heartbeat_timer, CALLOUT_MPSAFE);
callout_init(&ntb->lr_timer, CALLOUT_MPSAFE);
DETACH_ON_ERROR(ntb_map_pci_bars(ntb));
DETACH_ON_ERROR(ntb_initialize_hw(ntb));
DETACH_ON_ERROR(ntb_setup_interrupts(ntb));
pci_enable_busmaster(ntb->device);
return (error);
}
开发者ID:Alkzndr,项目名称:freebsd,代码行数:23,代码来源:ntb_hw.c
示例3: ath_rate_attach
struct ath_ratectrl *
ath_rate_attach(struct ath_softc *sc)
{
struct onoe_softc *osc;
osc = malloc(sizeof(struct onoe_softc), M_DEVBUF, M_NOWAIT|M_ZERO);
if (osc == NULL)
return NULL;
osc->arc.arc_space = sizeof(struct onoe_node);
callout_init(&osc->timer, 0);
ath_rate_sysctlattach(sc);
return &osc->arc;
}
开发者ID:eyberg,项目名称:rumpkernel-netbsd-src,代码行数:14,代码来源:athrate-onoe.c
示例4: hpcfbattach
void
hpcfbattach(struct device *parent, struct device *self, void *aux)
{
struct hpcfb_softc *sc = (struct hpcfb_softc *)self;
struct hpcfb_attach_args *ha = aux;
struct wsemuldisplaydev_attach_args wa;
sc->sc_accessops = ha->ha_accessops;
sc->sc_accessctx = ha->ha_accessctx;
sc->sc_nfbconf = ha->ha_nfbconf;
sc->sc_fbconflist = ha->ha_fbconflist;
if (hpcfbconsole) {
sc->sc_dc = &hpcfb_console_dc;
hpcfb_console_dc.dc_sc = sc;
printf(": %dx%d pixels, %d colors, %dx%d chars",
sc->sc_dc->dc_rinfo.ri_width,sc->sc_dc->dc_rinfo.ri_height,
pow(2, sc->sc_dc->dc_rinfo.ri_depth),
sc->sc_dc->dc_rinfo.ri_cols,sc->sc_dc->dc_rinfo.ri_rows);
/* Set video chip dependent CLUT if any. */
if (sc->sc_accessops->setclut)
sc->sc_accessops->setclut(sc->sc_accessctx,
&hpcfb_console_dc.dc_rinfo);
}
printf("\n");
sc->sc_polling = 0; /* XXX */
sc->sc_mapping = 0; /* XXX */
callout_init(&sc->sc_switch_callout);
/* Add a power hook to power management */
sc->sc_powerhook = powerhook_establish(hpcfb_power, sc);
if (sc->sc_powerhook == NULL)
printf("%s: WARNING: unable to establish power hook\n",
sc->sc_dev.dv_xname);
wa.console = hpcfbconsole;
wa.scrdata = &hpcfb_screenlist;
wa.accessops = &hpcfb_accessops;
wa.accesscookie = sc;
sc->sc_wsdisplay = config_found(self, &wa, wsemuldisplaydevprint);
#ifdef HPCFB_JUMP
/*
* Create a kernel thread to scroll,
*/
kthread_create(hpcfb_create_thread, sc);
#endif /* HPCFB_JUMP */
}
开发者ID:MarginC,项目名称:kame,代码行数:50,代码来源:hpcfb.c
示例5: atkbd_attach_unit
int
atkbd_attach_unit(device_t dev, keyboard_t **kbd, int irq, int flags)
{
keyboard_switch_t *sw;
atkbd_state_t *state;
int args[2];
int error;
int unit;
sw = kbd_get_switch(ATKBD_DRIVER_NAME);
if (sw == NULL)
return ENXIO;
/* reset, initialize and enable the device */
unit = device_get_unit(dev);
args[0] = device_get_unit(device_get_parent(dev));
args[1] = irq;
*kbd = NULL;
error = (*sw->probe)(unit, args, flags);
if (error)
return error;
error = (*sw->init)(unit, kbd, args, flags);
if (error)
return error;
(*sw->enable)(*kbd);
#ifdef KBD_INSTALL_CDEV
/* attach a virtual keyboard cdev */
error = kbd_attach(*kbd);
if (error)
return error;
#endif
/*
* This is a kludge to compensate for lost keyboard interrupts.
* A similar code used to be in syscons. See below. XXX
*/
state = (atkbd_state_t *)(*kbd)->kb_data;
callout_init(&state->ks_timer, 0);
atkbd_timeout(*kbd);
if (bootverbose)
(*sw->diag)(*kbd, bootverbose);
EVENTHANDLER_REGISTER(shutdown_final, atkbd_shutdown_final, *kbd,
SHUTDOWN_PRI_DEFAULT);
return 0;
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:49,代码来源:atkbd.c
示例6: nfscommon_modevent
/*
* Called once to initialize data structures...
*/
static int
nfscommon_modevent(module_t mod, int type, void *data)
{
int error = 0;
static int loaded = 0;
switch (type) {
case MOD_LOAD:
if (loaded)
return (0);
newnfs_portinit();
mtx_init(&nfs_nameid_mutex, "nfs_nameid_mutex", NULL, MTX_DEF);
mtx_init(&nfs_sockl_mutex, "nfs_sockl_mutex", NULL, MTX_DEF);
mtx_init(&nfs_slock_mutex, "nfs_slock_mutex", NULL, MTX_DEF);
mtx_init(&nfs_req_mutex, "nfs_req_mutex", NULL, MTX_DEF);
mtx_init(&nfsrv_nfsuserdsock.nr_mtx, "nfsuserd", NULL,
MTX_DEF);
callout_init(&newnfsd_callout, CALLOUT_MPSAFE);
newnfs_init();
nfsd_call_nfscommon = nfssvc_nfscommon;
loaded = 1;
break;
case MOD_UNLOAD:
if (newnfs_numnfsd != 0 || nfsrv_nfsuserd != 0 ||
nfs_numnfscbd != 0) {
error = EBUSY;
break;
}
nfsd_call_nfscommon = NULL;
callout_drain(&newnfsd_callout);
/* and get rid of the mutexes */
mtx_destroy(&nfs_nameid_mutex);
mtx_destroy(&newnfsd_mtx);
mtx_destroy(&nfs_state_mutex);
mtx_destroy(&nfs_sockl_mutex);
mtx_destroy(&nfs_slock_mutex);
mtx_destroy(&nfs_req_mutex);
mtx_destroy(&nfsrv_nfsuserdsock.nr_mtx);
loaded = 0;
break;
default:
error = EOPNOTSUPP;
break;
}
return error;
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:51,代码来源:nfs_commonport.c
示例7: tc5165buf_attach
void
tc5165buf_attach(struct device *parent, struct device *self, void *aux)
{
struct cs_attach_args *ca = aux;
struct tc5165buf_softc *sc = (void*)self;
struct hpckbd_attach_args haa;
printf(": ");
sc->sc_tc = ca->ca_tc;
sc->sc_chip = &tc5165buf_chip;
callout_init(&sc->sc_chip->scc_soft_ch, 0);
sc->sc_chip->scc_cst = ca->ca_csio.cstag;
if (bus_space_map(sc->sc_chip->scc_cst, ca->ca_csio.csbase,
ca->ca_csio.cssize, 0, &sc->sc_chip->scc_csh)) {
printf("can't map i/o space\n");
return;
}
sc->sc_chip->scc_enabled = 0;
if (ca->ca_irq1 != -1) {
sc->sc_ih = tx_intr_establish(sc->sc_tc, ca->ca_irq1,
IST_EDGE, IPL_TTY,
tc5165buf_intr, sc);
printf("interrupt mode");
} else {
sc->sc_ih = tx39_poll_establish(sc->sc_tc, 1, IPL_TTY,
tc5165buf_intr, sc);
printf("polling mode");
}
if (!sc->sc_ih) {
printf(" can't establish interrupt\n");
return;
}
printf("\n");
/* setup upper interface */
tc5165buf_ifsetup(sc->sc_chip);
haa.haa_ic = &sc->sc_chip->scc_if;
config_found(self, &haa, hpckbd_print);
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:48,代码来源:tc5165buf.c
示例8: kern_timeout_callwheel_init
/*
* kern_timeout_callwheel_init() - initialize previously reserved callwheel
* space.
*
* This code is called just once, after the space reserved for the
* callout wheel has been finalized.
*/
void
kern_timeout_callwheel_init(void)
{
int i;
SLIST_INIT(&callfree);
for (i = 0; i < ncallout; i++) {
callout_init(&callout[i], 0);
callout[i].c_flags = CALLOUT_LOCAL_ALLOC;
SLIST_INSERT_HEAD(&callfree, &callout[i], c_links.sle);
}
for (i = 0; i < callwheelsize; i++) {
TAILQ_INIT(&callwheel[i]);
}
mtx_init(&callout_lock, "callout", NULL, MTX_SPIN | MTX_RECURSE);
}
开发者ID:skizhak,项目名称:open-media-flow-controller,代码行数:23,代码来源:kern_timeout.c
示例9: vcons_init
int
vcons_init(struct vcons_data *vd, void *cookie, struct wsscreen_descr *def,
struct wsdisplay_accessops *ao)
{
/* zero out everything so we can rely on untouched fields being 0 */
memset(vd, 0, sizeof(struct vcons_data));
vd->cookie = cookie;
vd->init_screen = vcons_dummy_init_screen;
vd->show_screen_cb = NULL;
/* keep a copy of the accessops that we replace below with our
* own wrappers */
vd->ioctl = ao->ioctl;
/* configure the accessops */
ao->ioctl = vcons_ioctl;
ao->alloc_screen = vcons_alloc_screen;
ao->free_screen = vcons_free_screen;
ao->show_screen = vcons_show_screen;
#ifdef WSDISPLAY_SCROLLSUPPORT
ao->scroll = vcons_scroll;
#endif
LIST_INIT(&vd->screens);
vd->active = NULL;
vd->wanted = NULL;
vd->currenttype = def;
callout_init(&vd->switch_callout, 0);
callout_setfunc(&vd->switch_callout, vcons_do_switch, vd);
/*
* a lock to serialize access to the framebuffer.
* when switching screens we need to make sure there's no rasops
* operation in progress
*/
#ifdef DIAGNOSTIC
vd->switch_poll_count = 0;
#endif
#ifdef VCONS_SWITCH_ASYNC
kthread_create(PRI_NONE, 0, NULL, vcons_kthread, vd,
&vd->redraw_thread, "vcons_draw");
#endif
return 0;
}
开发者ID:Tommmster,项目名称:netbsd-avr32,代码行数:47,代码来源:wsdisplay_vcons.c
示例10: start_ep_timer
static void
start_ep_timer(struct iwch_ep *ep)
{
CTR2(KTR_IW_CXGB, "%s ep %p", __FUNCTION__, ep);
if (callout_pending(&ep->timer)) {
CTR2(KTR_IW_CXGB, "%s stopped / restarted timer ep %p", __FUNCTION__, ep);
callout_deactivate(&ep->timer);
callout_drain(&ep->timer);
} else {
/*
* XXX this looks racy
*/
get_ep(&ep->com);
callout_init(&ep->timer, 1);
}
callout_reset(&ep->timer, ep_timeout_secs * hz, ep_timeout, ep);
}
开发者ID:cyrilmagsuci,项目名称:freebsd,代码行数:17,代码来源:iw_cxgb_cm.c
示例11: pckbd_attach_unit
static int
pckbd_attach_unit(device_t dev, keyboard_t **kbd, int port, int irq, int flags)
{
keyboard_switch_t *sw;
pckbd_state_t *state;
int args[2];
int error;
int unit;
sw = kbd_get_switch(DRIVER_NAME);
if (sw == NULL)
return ENXIO;
/* reset, initialize and enable the device */
unit = device_get_unit(dev);
args[0] = port;
args[1] = irq;
*kbd = NULL;
error = (*sw->probe)(unit, args, flags);
if (error)
return error;
error = (*sw->init)(unit, kbd, args, flags);
if (error)
return error;
(*sw->enable)(*kbd);
#ifdef KBD_INSTALL_CDEV
/* attach a virtual keyboard cdev */
error = kbd_attach(*kbd);
if (error)
return error;
#endif /* KBD_INSTALL_CDEV */
/*
* This is a kludge to compensate for lost keyboard interrupts.
* A similar code used to be in syscons. See below. XXX
*/
state = (pckbd_state_t *)(*kbd)->kb_data;
callout_init(&state->ks_timer, 0);
pckbd_timeout(*kbd);
if (bootverbose)
(*sw->diag)(*kbd, bootverbose);
return 0;
}
开发者ID:2asoft,项目名称:freebsd,代码行数:46,代码来源:pckbd.c
示例12: acpitz_attach
/*
* acpitz_attach: autoconf(9) attach routine
*/
void
acpitz_attach(struct device *parent, struct device *self, void *aux)
{
struct acpitz_softc *sc = (struct acpitz_softc *)self;
struct acpi_attach_args *aa = aux;
ACPI_STATUS rv;
ACPI_INTEGER v;
#if 0
sc->sc_flags = ATZ_F_VERBOSE;
#endif
sc->sc_devnode = aa->aa_node;
printf(": ACPI Thermal Zone\n");
rv = acpi_eval_integer(sc->sc_devnode->ad_handle, "_TZP", &v);
if (ACPI_FAILURE(rv)) {
printf("%s: unable to get polling interval; using default of",
sc->sc_dev.dv_xname);
sc->sc_zone.tzp = ATZ_TZP_RATE;
} else {
sc->sc_zone.tzp = v;
printf("%s: polling interval is", sc->sc_dev.dv_xname);
}
printf(" %d.%ds\n", sc->sc_zone.tzp / 10, sc->sc_zone.tsp % 10);
/* XXX a value of 0 means "polling is not necessary" */
if (sc->sc_zone.tzp == 0)
sc->sc_zone.tzp = ATZ_TZP_RATE;
acpitz_get_status(sc);
rv = AcpiInstallNotifyHandler(sc->sc_devnode->ad_handle,
ACPI_SYSTEM_NOTIFY, acpitz_notify_handler, sc);
if (ACPI_FAILURE(rv)) {
printf("%s: unable to install SYSTEM NOTIFY handler: %s\n",
sc->sc_dev.dv_xname, AcpiFormatException(rv));
return;
}
callout_init(&sc->sc_callout);
callout_reset(&sc->sc_callout, (sc->sc_zone.tzp / 10) * hz,
acpitz_tick, sc);
acpitz_init_envsys(sc);
}
开发者ID:MarginC,项目名称:kame,代码行数:49,代码来源:acpi_tz.c
示例13: sstouch_attach
void
sstouch_attach(device_t parent, device_t self, void *aux)
{
struct sstouch_softc *sc = device_private(self);
struct s3c2xx0_attach_args *sa = aux;
struct wsmousedev_attach_args mas;
sc->dev = self;
sc->iot = sa->sa_iot;
if (bus_space_map(sc->iot, S3C2440_ADC_BASE,
S3C2440_ADC_SIZE, 0, &sc->ioh)) {
aprint_error(": failed to map registers");
return;
}
sc->next_stylus_intr = STYLUS_DOWN;
/* XXX: Is IPL correct? */
s3c24x0_intr_establish(S3C2440_INT_TC, IPL_BIO, IST_EDGE_RISING,
sstouch_tc_intr, sc);
s3c24x0_intr_establish(S3C2440_INT_ADC, IPL_BIO, IST_EDGE_RISING,
sstouch_adc_intr, sc);
aprint_normal("\n");
mas.accessops = &sstouch_accessops;
mas.accesscookie = sc;
sc->wsmousedev = config_found_ia(self, "wsmousedev", &mas,
wsmousedevprint);
tpcalib_init(&sc->tpcalib);
tpcalib_ioctl(&sc->tpcalib, WSMOUSEIO_SCALIBCOORDS,
(void*)&default_calib, 0, 0);
sc->sample_count = 0;
/* Add CALLOUT_MPSAFE to avoid holding the global kernel lock */
callout_init(&sc->callout, 0);
callout_setfunc(&sc->callout, sstouch_callout, sc);
/* Actual initialization is performed by sstouch_initialize(),
which is called by sstouch_enable() */
}
开发者ID:krytarowski,项目名称:netbsd-current-src-sys,代码行数:46,代码来源:s3c2440_touch.c
示例14: mpcsa_leds_attach
static void
mpcsa_leds_attach(device_t parent, device_t self, void *aux)
{
struct mpcsa_leds_softc *sc = device_private(self);
struct spi_attach_args *sa = aux;
#if NGPIO > 0
struct gpiobus_attach_args gba;
#endif
int n;
aprint_naive(": output buffer\n");
aprint_normal(": 74HC595 or compatible shift register(s)\n");
sc->sc_sh = sa->sa_handle;
sc->sc_pinstate = 0xffff;
callout_init(&sc->sc_c, 0);
#if NGPIO > 0
/* initialize and attach gpio(4) */
for (n = 0; n < MPCSA_LEDS_NPINS; n++) {
sc->sc_pins[n].pin_num = n;
sc->sc_pins[n].pin_caps = (GPIO_PIN_OUTPUT
| GPIO_PIN_PUSHPULL);
sc->sc_pins[n].pin_flags = GPIO_PIN_OUTPUT | GPIO_PIN_LOW;
}
sc->sc_gpio_chipset.gp_cookie = sc;
sc->sc_gpio_chipset.gp_pin_read = mpcsa_leds_pin_read;
sc->sc_gpio_chipset.gp_pin_write = mpcsa_leds_pin_write;
sc->sc_gpio_chipset.gp_pin_ctl = mpcsa_leds_pin_ctl;
gba.gba_gc = &sc->sc_gpio_chipset;
gba.gba_pins = sc->sc_pins;
gba.gba_npins = MPCSA_LEDS_NPINS;
config_found_ia(self, "gpiobus", &gba, mpcsa_ledsbus_print);
#endif
/* attach device */
// config_search_ia(mpcsa_leds_search, self, "mpcsa_leds", mpcsa_leds_print);
/* update leds ten times a second or so */
mpcsa_leds_sc = sc; // @@@@
sc->sc_spi_transfer.st_flags = SPI_F_DONE;
callout_reset(&sc->sc_c, mstohz(LEDS_UPDATE_INTERVAL), mpcsa_leds_timer, sc);
mpcsa_blink_led(LED_HB, 500);
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:46,代码来源:mpcsa_leds.c
示例15: rdattach
static void
rdattach(device_t parent, device_t self, void *aux)
{
struct rd_softc *sc = device_private(self);
struct hpibbus_attach_args *ha = aux;
sc->sc_dev = self;
bufq_alloc(&sc->sc_tab, "disksort", BUFQ_SORT_RAWBLOCK);
if (rdident(parent, sc, ha) == 0) {
aprint_error(": didn't respond to describe command!\n");
return;
}
/*
* Initialize and attach the disk structure.
*/
memset(&sc->sc_dkdev, 0, sizeof(sc->sc_dkdev));
disk_init(&sc->sc_dkdev, device_xname(sc->sc_dev), NULL);
disk_attach(&sc->sc_dkdev);
sc->sc_slave = ha->ha_slave;
sc->sc_punit = ha->ha_punit;
callout_init(&sc->sc_restart_ch, 0);
/* Initialize the hpib job queue entry */
sc->sc_hq.hq_softc = sc;
sc->sc_hq.hq_slave = sc->sc_slave;
sc->sc_hq.hq_start = rdstart;
sc->sc_hq.hq_go = rdgo;
sc->sc_hq.hq_intr = rdintr;
sc->sc_flags = RDF_ALIVE;
#ifdef DEBUG
/* always report errors */
if (rddebug & RDB_ERROR)
rderrthresh = 0;
#endif
/*
* attach the device into the random source list
*/
rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
RND_TYPE_DISK, RND_FLAG_DEFAULT);
}
开发者ID:krytarowski,项目名称:netbsd-current-src-sys,代码行数:45,代码来源:rd.c
示例16: lpt_attach_subr
void
lpt_attach_subr(struct lpt_softc *sc)
{
bus_space_tag_t iot;
bus_space_handle_t ioh;
sc->sc_state = 0;
iot = sc->sc_iot;
ioh = sc->sc_ioh;
bus_space_write_1(iot, ioh, lpt_control, LPC_NINIT);
callout_init(&sc->sc_wakeup_ch, 0);
sc->sc_sih = softint_establish(SOFTINT_SERIAL, lptsoftintr, sc);
sc->sc_dev_ok = 1;
}
开发者ID:eyberg,项目名称:rumpkernel-netbsd-src,代码行数:18,代码来源:lpt.c
示例17: ata_channel_attach
/*
* ata_channel_attach:
*
* Common parts of attaching an atabus to an ATA controller channel.
*/
void
ata_channel_attach(struct ata_channel *chp)
{
if (chp->ch_flags & ATACH_DISABLED)
return;
/* XXX callout_destroy */
callout_init(&chp->ch_callout, 0);
TAILQ_INIT(&chp->ch_queue->queue_xfer);
chp->ch_queue->queue_freeze = 0;
chp->ch_queue->queue_flags = 0;
chp->ch_queue->active_xfer = NULL;
chp->atabus = config_found_ia(chp->ch_atac->atac_dev, "ata", chp,
atabusprint);
}
开发者ID:goroutines,项目名称:rumprun,代码行数:23,代码来源:ata.c
示例18: hwmp_vattach
void
hwmp_vattach(struct ieee80211vap *vap)
{
struct ieee80211_hwmp_state *hs;
KASSERT(vap->iv_opmode == IEEE80211_M_MBSS,
("not a mesh vap, opmode %d", vap->iv_opmode));
hs = malloc(sizeof(struct ieee80211_hwmp_state), M_80211_VAP,
M_NOWAIT | M_ZERO);
if (hs == NULL) {
printf("%s: couldn't alloc HWMP state\n", __func__);
return;
}
hs->hs_maxhops = IEEE80211_HWMP_DEFAULT_MAXHOPS;
callout_init(&hs->hs_roottimer, CALLOUT_MPSAFE);
vap->iv_hwmp = hs;
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:18,代码来源:ieee80211_hwmp.c
示例19: cn_drvinit
static void
cn_drvinit(void *unused)
{
if (mambo_consdev.cn_pri != CN_DEAD &&
mambo_consdev.cn_name[0] != '\0') {
if (OF_finddevice("/mambo") == -1)
return;
tp = tty_alloc(&mambo_ttydevsw, NULL);
tty_init_console(tp, 0);
tty_makedev(tp, NULL, "%s", "mambocons");
polltime = 1;
callout_init(&mambo_callout, CALLOUT_MPSAFE);
callout_reset(&mambo_callout, polltime, mambo_timeout, NULL);
}
}
开发者ID:edgar-pek,项目名称:PerspicuOS,代码行数:19,代码来源:mambo_console.c
示例20: btn_obio_attach
static void
btn_obio_attach(device_t parent, device_t self, void *aux)
{
struct btn_obio_softc *sc;
int i;
aprint_naive("\n");
aprint_normal(": USL-5P buttons\n");
sc = device_private(self);
sc->sc_dev = self;
btn_softc = sc;
callout_init(&sc->sc_guard_ch, 0);
callout_setfunc(&sc->sc_guard_ch, btn_guard_timeout, sc);
sc->sc_ih = extintr_establish(LANDISK_INTR_BTN, IPL_TTY, btn_intr, sc);
if (sc->sc_ih == NULL) {
aprint_error_dev(self, "unable to establish interrupt");
panic("extintr_establish");
}
sc->sc_smpsw.smpsw_name = device_xname(self);
sc->sc_smpsw.smpsw_type = PSWITCH_TYPE_RESET;
if (sysmon_pswitch_register(&sc->sc_smpsw) != 0) {
aprint_error_dev(self, "unable to register with sysmon\n");
return;
}
sc->sc_mask |= BTN_RESET_BIT;
for (i = 0; i < NBUTTON; i++) {
int idx = btnlist[i].idx;
sc->sc_bev[idx].bev_name = btnlist[i].name;
if (btn_event_register(&sc->sc_bev[idx]) != 0) {
aprint_error_dev(self,
"unable to register '%s' button\n",
btnlist[i].name);
} else {
sc->sc_mask |= btnlist[i].mask;
}
}
}
开发者ID:lacombar,项目名称:netbsd-alc,代码行数:43,代码来源:btn_obio.c
注:本文中的callout_init函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论