本文整理汇总了C++中devclass_get_softc函数的典型用法代码示例。如果您正苦于以下问题:C++ devclass_get_softc函数的具体用法?C++ devclass_get_softc怎么用?C++ devclass_get_softc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了devclass_get_softc函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: smapi_ioctl
static int
smapi_ioctl (struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td)
{
struct smapi_softc *sc;
int error;
error = 0;
sc = devclass_get_softc(smapi_devclass, dev2unit(dev));
if (sc == NULL) {
error = ENXIO;
goto fail;
}
switch (cmd) {
case SMAPIOGHEADER:
bcopy((caddr_t)sc->header, data,
sizeof(struct smapi_bios_header));
error = 0;
break;
case SMAPIOCGFUNCTION:
smapi32_offset = sc->smapi32_entry;
error = smapi32((struct smapi_bios_parameter *)data,
(struct smapi_bios_parameter *)data);
break;
default:
error = ENOTTY;
}
fail:
return (error);
}
示例2: mpt_link_peer
static void
mpt_link_peer(struct mpt_softc *mpt)
{
struct mpt_softc *mpt2;
if (mpt->unit == 0) {
return;
}
/*
* XXX: depends on probe order
*/
mpt2 = (struct mpt_softc *)devclass_get_softc(mpt_devclass,mpt->unit-1);
if (mpt2 == NULL) {
return;
}
if (pci_get_vendor(mpt2->dev) != pci_get_vendor(mpt->dev)) {
return;
}
if (pci_get_device(mpt2->dev) != pci_get_device(mpt->dev)) {
return;
}
mpt->mpt2 = mpt2;
mpt2->mpt2 = mpt;
if (mpt->verbose >= MPT_PRT_DEBUG) {
mpt_prt(mpt, "linking with peer (mpt%d)\n",
device_get_unit(mpt2->dev));
}
}
示例3: ucom_dev_write
static int
ucom_dev_write(struct dev_write_args *ap)
{
cdev_t dev = ap->a_head.a_dev;
struct ucom_softc *sc;
struct tty *tp;
int error;
sc = devclass_get_softc(ucom_devclass, minor(dev));
lwkt_gettoken(&tty_token);
tp = sc->sc_tty;
DPRINTF("ucomwrite: tp = %p, flag = 0x%x\n", tp, ap->a_ioflag);
#if 0 /* XXXDF */
if (sc->sc_dying) {
lwkt_reltoken(&tty_token);
return (EIO);
}
#endif
error = (*linesw[tp->t_line].l_write)(tp, ap->a_uio, ap->a_ioflag);
DPRINTF("ucomwrite: error = %d\n", error);
lwkt_reltoken(&tty_token);
return (error);
}
示例4: aac_printstate0
/*
* Print the command queue states for controller 0 (callable from DDB)
*/
void
aac_printstate0(void)
{
struct aac_softc *sc;
sc = devclass_get_softc(devclass_find("aac"), 0);
aac_print_queues(sc);
switch (sc->aac_hwif) {
case AAC_HWIF_I960RX:
case AAC_HWIF_NARK:
device_printf(sc->aac_dev, "IDBR 0x%08x IIMR 0x%08x "
"IISR 0x%08x\n", AAC_MEM0_GETREG4(sc, AAC_RX_IDBR),
AAC_MEM0_GETREG4(sc, AAC_RX_IIMR), AAC_MEM0_GETREG4(sc, AAC_RX_IISR));
device_printf(sc->aac_dev, "ODBR 0x%08x OIMR 0x%08x "
"OISR 0x%08x\n", AAC_MEM0_GETREG4(sc, AAC_RX_ODBR),
AAC_MEM0_GETREG4(sc, AAC_RX_OIMR), AAC_MEM0_GETREG4(sc, AAC_RX_OISR));
AAC_MEM0_SETREG4(sc, AAC_RX_OIMR, 0/*~(AAC_DB_COMMAND_READY |
AAC_DB_RESPONSE_READY | AAC_DB_PRINTF)*/);
device_printf(sc->aac_dev, "ODBR 0x%08x OIMR 0x%08x "
"OISR 0x%08x\n", AAC_MEM0_GETREG4(sc, AAC_RX_ODBR),
AAC_MEM0_GETREG4(sc, AAC_RX_OIMR), AAC_MEM0_GETREG4(sc, AAC_RX_OISR));
break;
case AAC_HWIF_STRONGARM:
/* XXX implement */
break;
}
}