本文整理汇总了C++中IFM_MAKEWORD函数的典型用法代码示例。如果您正苦于以下问题:C++ IFM_MAKEWORD函数的具体用法?C++ IFM_MAKEWORD怎么用?C++ IFM_MAKEWORD使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IFM_MAKEWORD函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: xmphy_attach
void
xmphy_attach(struct device *parent, struct device *self, void *aux)
{
struct mii_softc *sc = (struct mii_softc *)self;
struct mii_attach_args *ma = aux;
struct mii_data *mii = ma->mii_data;
const struct mii_phydesc *mpd;
mpd = mii_phy_match(ma, xmphys);
printf(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;
sc->mii_funcs = &xmphy_funcs;
sc->mii_pdata = mii;
sc->mii_flags = ma->mii_flags;
sc->mii_anegticks = MII_ANEGTICKS;
sc->mii_flags |= MIIF_NOISOLATE;
#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst),
BMCR_ISO);
PHY_RESET(sc);
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, 0, sc->mii_inst),
XMPHY_BMCR_FDX);
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, IFM_FDX, sc->mii_inst), 0);
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst), 0);
#undef ADD
}
开发者ID:repos-holder,项目名称:openbsd-patches,代码行数:34,代码来源:xmphy.c
示例2: xmphy_attach
static int
xmphy_attach(device_t dev)
{
struct mii_softc *sc;
const char *sep = "";
sc = device_get_softc(dev);
mii_phy_dev_attach(dev, MIIF_NOISOLATE | MIIF_NOMANPAUSE,
&xmphy_funcs, 0);
sc->mii_anegticks = MII_ANEGTICKS;
PHY_RESET(sc);
#define ADD(m) ifmedia_add(&sc->mii_pdata->mii_media, (m), 0, NULL)
#define PRINT(s) printf("%s%s", sep, s); sep = ", "
device_printf(dev, " ");
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, 0, sc->mii_inst));
PRINT("1000baseSX");
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, IFM_FDX, sc->mii_inst));
PRINT("1000baseSX-FDX");
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst));
PRINT("auto");
printf("\n");
#undef ADD
#undef PRINT
MIIBUS_MEDIAINIT(sc->mii_dev);
return (0);
}
开发者ID:hmatyschok,项目名称:MeshBSD,代码行数:33,代码来源:xmphy.c
示例3: nsgphy_attach
static int
nsgphy_attach(device_t dev)
{
struct mii_softc *sc;
struct mii_attach_args *ma;
struct mii_data *mii;
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
mii_softc_init(sc, ma);
sc->mii_dev = device_get_parent(dev);
mii = device_get_softc(sc->mii_dev);
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
sc->mii_inst = mii->mii_instance;
sc->mii_service = nsgphy_service;
/*
* Only retry autonegotiation every 17 seconds.
* Actually, for gigE PHYs, we should wait longer, since
* 5 seconds is the mimimum time the documentation
* says to wait for a 1000mbps link to be established.
*/
sc->mii_anegticks = 17;
sc->mii_pdata = mii;
sc->mii_flags |= MIIF_NOISOLATE;
mii->mii_instance++;
#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst),
MII_MEDIA_NONE);
#if 0
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst),
MII_MEDIA_100_TX);
#endif
mii_phy_reset(sc);
sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
if (sc->mii_capabilities & BMSR_EXTSTAT)
sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR);
device_printf(dev, " ");
if ((sc->mii_capabilities & BMSR_MEDIAMASK) ||
(sc->mii_extcapabilities & EXTSR_MEDIAMASK))
mii_phy_add_media(sc);
else
kprintf("no media present");
kprintf("\n");
#undef ADD
MIIBUS_MEDIAINIT(sc->mii_dev);
return(0);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:56,代码来源:nsgphy.c
示例4: le_dma_supmediastatus
static void
le_dma_supmediastatus(struct lance_softc *sc, struct ifmediareq *ifmr)
{
struct lsi64854_softc *dma = ((struct le_dma_softc *)sc)->sc_dma;
/*
* Notify the world which media we're currently using.
*/
if (L64854_GCSR(dma) & E_TP_AUI)
ifmr->ifm_active = IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, 0);
else
ifmr->ifm_active = IFM_MAKEWORD(IFM_ETHER, IFM_10_5, 0, 0);
}
开发者ID:looncraz,项目名称:haiku,代码行数:13,代码来源:if_le_ledma.c
示例5: brgphy_attach
static int
brgphy_attach(device_t dev)
{
struct mii_softc *sc;
struct mii_attach_args *ma;
struct mii_data *mii;
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
mii_softc_init(sc, ma);
sc->mii_dev = device_get_parent(dev);
mii = device_get_softc(sc->mii_dev);
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
sc->mii_inst = mii->mii_instance;
sc->mii_service = brgphy_service;
sc->mii_reset = brgphy_reset;
sc->mii_pdata = mii;
sc->mii_flags |= MIIF_NOISOLATE;
mii->mii_instance++;
brgphy_reset(sc);
#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst),
MII_MEDIA_NONE);
#if 0
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst),
MII_MEDIA_100_TX);
#endif
#undef ADD
sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
if (sc->mii_capabilities & BMSR_EXTSTAT)
sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR);
device_printf(dev, " ");
if ((sc->mii_capabilities & BMSR_MEDIAMASK) ||
(sc->mii_extcapabilities & EXTSR_MEDIAMASK))
mii_phy_add_media(sc);
else
kprintf("no media present");
kprintf("\n");
MIIBUS_MEDIAINIT(sc->mii_dev);
return(0);
}
开发者ID:varialus,项目名称:DragonFlyX,代码行数:50,代码来源:brgphy.c
示例6: xmphy_attach
static int
xmphy_attach(device_t dev)
{
struct mii_softc *sc;
struct mii_attach_args *ma;
struct mii_data *mii;
const char *sep = "";
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
mii = device_get_softc(sc->mii_dev);
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = xmphy_service;
sc->mii_pdata = mii;
sc->mii_flags |= MIIF_NOISOLATE;
mii->mii_instance++;
#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
#define PRINT(s) printf("%s%s", sep, s); sep = ", "
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst),
BMCR_ISO);
#if 0
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst),
BMCR_LOOP|BMCR_S100);
#endif
mii_phy_reset(sc);
device_printf(dev, " ");
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, 0, sc->mii_inst),
XMPHY_BMCR_FDX);
PRINT("1000baseSX");
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, IFM_FDX, sc->mii_inst), 0);
PRINT("1000baseSX-FDX");
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst), 0);
PRINT("auto");
printf("\n");
#undef ADD
#undef PRINT
MIIBUS_MEDIAINIT(sc->mii_dev);
return (0);
}
开发者ID:luciang,项目名称:haiku,代码行数:50,代码来源:xmphy.c
示例7: lxtphyattach
static void
lxtphyattach(device_t parent, device_t self, void *aux)
{
struct mii_softc *sc = device_private(self);
struct mii_attach_args *ma = aux;
struct mii_data *mii = ma->mii_data;
const struct mii_phydesc *mpd;
mpd = mii_phy_match(ma, lxtphys);
aprint_naive(": Media interface\n");
aprint_normal(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
sc->mii_dev = self;
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;
if (mpd->mpd_model == MII_MODEL_LEVEL1_LXT971)
sc->mii_funcs = &lxtphy971_funcs;
else
sc->mii_funcs = &lxtphy_funcs;
sc->mii_pdata = mii;
sc->mii_flags = ma->mii_flags;
sc->mii_anegticks = MII_ANEGTICKS;
PHY_RESET(sc);
sc->mii_capabilities =
PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
aprint_normal_dev(self, "");
if (sc->mii_flags & MIIF_HAVEFIBER) {
#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, 0, sc->mii_inst),
MII_MEDIA_100_TX);
aprint_normal("100baseFX, ");
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, IFM_FDX, sc->mii_inst),
MII_MEDIA_100_TX_FDX);
aprint_normal("100baseFX-FDX, ");
#undef ADD
}
if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0)
aprint_error("no media present");
else
mii_phy_add_media(sc);
aprint_normal("\n");
if (!pmf_device_register(self, NULL, mii_phy_resume))
aprint_error_dev(self, "couldn't establish power handler\n");
}
开发者ID:Tommmster,项目名称:netbsd-avr32,代码行数:49,代码来源:lxtphy.c
示例8: pnaphy_attach
static int
pnaphy_attach(device_t dev)
{
struct mii_softc *sc;
struct mii_attach_args *ma;
struct mii_data *mii;
const char *sep = "";
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
mii = device_get_softc(sc->mii_dev);
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = pnaphy_service;
sc->mii_pdata = mii;
mii->mii_instance++;
sc->mii_flags |= MIIF_NOISOLATE;
#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
#define PRINT(s) printf("%s%s", sep, s); sep = ", "
mii_phy_reset(sc);
sc->mii_capabilities =
PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
device_printf(dev, " ");
if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0)
printf("no media present");
else {
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_HPNA_1, 0, sc->mii_inst), 0);
PRINT("HomePNA");
}
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst),
BMCR_ISO);
printf("\n");
#undef ADD
#undef PRINT
MIIBUS_MEDIAINIT(sc->mii_dev);
return (0);
}
开发者ID:syedzubairahmed,项目名称:FreeBSD-7.3-dyntick,代码行数:49,代码来源:pnaphy.c
示例9: tdkphy_attach
static int
tdkphy_attach(device_t dev)
{
struct mii_softc *sc;
struct mii_attach_args *ma;
struct mii_data *mii;
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
mii = device_get_softc(sc->mii_dev);
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
if (bootverbose)
device_printf(dev, "OUI 0x%06x, model 0x%04x, rev. %d\n",
MII_OUI(ma->mii_id1, ma->mii_id2),
MII_MODEL(ma->mii_id2), MII_REV(ma->mii_id2));
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = tdkphy_service;
sc->mii_pdata = mii;
mii->mii_instance++;
sc->mii_flags |= MIIF_NOISOLATE;
#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst),
BMCR_ISO);
#if 0
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst),
BMCR_LOOP|BMCR_S100);
#endif
mii_phy_reset(sc);
sc->mii_capabilities =
PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
device_printf(dev, " ");
mii_add_media(mii, sc->mii_capabilities, sc->mii_inst);
printf("\n");
#undef ADD
MIIBUS_MEDIAINIT(sc->mii_dev);
return(0);
}
开发者ID:UnitedMarsupials,项目名称:kame,代码行数:48,代码来源:tdkphy.c
示例10: tlp_cogent_em1x0_tmsw_init
static void
tlp_cogent_em1x0_tmsw_init(struct tulip_softc *sc)
{
struct tulip_21x4x_media *tm;
const char *sep = "";
sc->sc_gp_dir = GPP_COGENT_EM1x0_PINS;
sc->sc_opmode = OPMODE_MBO | OPMODE_PS;
TULIP_WRITE(sc, CSR_OPMODE, sc->sc_opmode);
ifmedia_init(&sc->sc_mii.mii_media, 0, tlp_mediachange,
tlp_mediastatus);
aprint_normal_dev(sc->sc_dev, "");
#define ADD(m, c) \
tm = malloc(sizeof(*tm), M_DEVBUF, M_WAITOK|M_ZERO); \
tm->tm_opmode = (c); \
tm->tm_gpdata = GPP_COGENT_EM1x0_INIT; \
ifmedia_add(&sc->sc_mii.mii_media, (m), 0, tm)
#define PRINT(str) aprint_normal("%s%s", sep, str); sep = ", "
if (sc->sc_srom[32] == 0x15) {
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, 0, 0),
OPMODE_PS | OPMODE_PCS);
PRINT("100baseFX");
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, IFM_FDX, 0),
OPMODE_PS | OPMODE_PCS | OPMODE_FD);
PRINT("100baseFX-FDX");
aprint_normal("\n");
ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_100_FX);
} else {
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, 0, 0),
OPMODE_PS | OPMODE_PCS | OPMODE_SCR);
PRINT("100baseTX");
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, IFM_FDX, 0),
OPMODE_PS | OPMODE_PCS | OPMODE_SCR | OPMODE_FD);
PRINT("100baseTX-FDX");
aprint_normal("\n");
ifmedia_set(&sc->sc_mii.mii_media, IFM_ETHER|IFM_100_TX);
}
#undef ADD
#undef PRINT
}
开发者ID:RyanLucchese,项目名称:rumpkernel-netbsd-src,代码行数:48,代码来源:if_tlp_pci.c
示例11: ip1000phy_attach
static int
ip1000phy_attach(device_t dev)
{
struct mii_softc *sc;
struct mii_attach_args *ma;
struct mii_data *mii;
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
mii_softc_init(sc, ma);
sc->mii_dev = device_get_parent(dev);
mii = device_get_softc(sc->mii_dev);
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
sc->mii_inst = mii->mii_instance;
sc->mii_service = ip1000phy_service;
sc->mii_pdata = mii;
sc->mii_anegticks = MII_ANEGTICKS_GIGE;
sc->mii_flags |= MIIF_NOISOLATE;
mii->mii_instance++;
device_printf(dev, " ");
#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst),
BMCR_ISO);
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, sc->mii_inst),
IP1000PHY_BMCR_10);
kprintf("10baseT, ");
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_FDX, sc->mii_inst),
IP1000PHY_BMCR_10 | IP1000PHY_BMCR_FDX);
kprintf("10baseT-FDX, ");
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, 0, sc->mii_inst),
IP1000PHY_BMCR_100);
kprintf("100baseTX, ");
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_FDX, sc->mii_inst),
IP1000PHY_BMCR_100 | IP1000PHY_BMCR_FDX);
kprintf("100baseTX-FDX, ");
/* 1000baseT half-duplex, really supported? */
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, 0, sc->mii_inst),
IP1000PHY_BMCR_1000);
kprintf("1000baseT, ");
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, IFM_FDX, sc->mii_inst),
IP1000PHY_BMCR_1000 | IP1000PHY_BMCR_FDX);
kprintf("1000baseT-FDX, ");
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst), 0);
kprintf("auto\n");
#undef ADD
ip1000phy_reset(sc);
MIIBUS_MEDIAINIT(sc->mii_dev);
return(0);
}
开发者ID:Gwenio,项目名称:DragonFlyBSD,代码行数:58,代码来源:ip1000phy.c
示例12: pnphy_attach
static int
pnphy_attach(device_t dev)
{
struct mii_softc *sc;
struct mii_attach_args *ma;
struct mii_data *mii;
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
mii_softc_init(sc, ma);
sc->mii_dev = device_get_parent(dev);
mii = device_get_softc(sc->mii_dev);
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
sc->mii_inst = mii->mii_instance;
sc->mii_service = pnphy_service;
sc->mii_pdata = mii;
sc->mii_flags |= MIIF_NOISOLATE;
mii->mii_instance++;
#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
sc->mii_capabilities =
BMSR_100TXFDX|BMSR_100TXHDX|BMSR_10TFDX|BMSR_10THDX;
sc->mii_capabilities &= ma->mii_capmask;
device_printf(dev, " ");
if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0)
kprintf("no media present");
else
mii_phy_add_media(sc);
kprintf("\n");
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst),
MII_MEDIA_NONE);
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst),
MII_MEDIA_100_TX);
#undef ADD
MIIBUS_MEDIAINIT(sc->mii_dev);
return(0);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:44,代码来源:pnphy.c
示例13: e1000phy_attach
static int
e1000phy_attach(device_t dev)
{
struct mii_softc *sc;
struct mii_attach_args *ma;
struct mii_data *mii;
getenv_int("e1000phy_debug", &e1000phy_debug);
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
mii = device_get_softc(sc->mii_dev);
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = e1000phy_service;
sc->mii_pdata = mii;
sc->mii_flags |= MIIF_NOISOLATE;
mii->mii_instance++;
e1000phy_reset(sc);
device_printf(dev, " ");
#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
/*
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst),
E1000_CR_ISOLATE);
*/
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, sc->mii_inst),
E1000_CR_SPEED_10);
printf("10baseT, ");
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_FDX, sc->mii_inst),
E1000_CR_SPEED_10 | E1000_CR_FULL_DUPLEX);
printf("10baseT-FDX, ");
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, 0, sc->mii_inst),
E1000_CR_SPEED_100);
printf("100baseTX, ");
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_FDX, sc->mii_inst),
E1000_CR_SPEED_100 | E1000_CR_FULL_DUPLEX);
printf("100baseTX-FDX, ");
/*
* 1000BT-simplex not supported; driver must ignore this entry,
* but it must be present in order to manually set full-duplex.
*/
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, 0, sc->mii_inst),
E1000_CR_SPEED_1000);
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, IFM_FDX, sc->mii_inst),
E1000_CR_SPEED_1000 | E1000_CR_FULL_DUPLEX);
printf("1000baseTX-FDX, ");
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst), 0);
printf("auto\n");
#undef ADD
MIIBUS_MEDIAINIT(sc->mii_dev);
return(0);
}
开发者ID:MarginC,项目名称:kame,代码行数:59,代码来源:e1000phy.c
示例14: acphy_attach
static int
acphy_attach(device_t dev)
{
struct mii_softc *sc;
struct mii_attach_args *ma;
struct mii_data *mii;
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
mii = device_get_softc(sc->mii_dev);
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = acphy_service;
sc->mii_pdata = mii;
mii->mii_instance++;
acphy_reset(sc);
sc->mii_capabilities =
PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
device_printf(dev, " ");
#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
if ((PHY_READ(sc, MII_ACPHY_MCTL) & AC_MCTL_FX_SEL) != 0) {
sc->mii_flags |= MIIF_HAVEFIBER;
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, 0, sc->mii_inst),
MII_MEDIA_100_TX);
printf("100baseFX, ");
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, IFM_FDX, sc->mii_inst),
MII_MEDIA_100_TX_FDX);
printf("100baseFX-FDX, ");
}
#undef ADD
mii_phy_add_media(sc);
printf("\n");
MIIBUS_MEDIAINIT(sc->mii_dev);
return (0);
}
开发者ID:syedzubairahmed,项目名称:FreeBSD-7.3-dyntick,代码行数:44,代码来源:acphy.c
示例15: rlphy_attach
static int
rlphy_attach(device_t dev)
{
struct mii_softc *sc;
struct mii_attach_args *ma;
struct mii_data *mii;
struct rlphy_softc *rsc;
sc = device_get_softc(dev);
ma = device_get_ivars(dev);
sc->mii_dev = device_get_parent(dev);
mii = device_get_softc(sc->mii_dev);
/*
* Check whether we're the RTL8201L PHY and remember so the status
* routine can query the proper register for speed detection.
*/
rsc = (struct rlphy_softc *)sc;
if (mii_phy_dev_probe(dev, rlphys, 0) == 0)
rsc->sc_is_RTL8201L++;
/*
* The RealTek PHY can never be isolated, so never allow non-zero
* instances!
*/
if (mii->mii_instance != 0) {
device_printf(dev, "ignoring this PHY, non-zero instance\n");
return (ENXIO);
}
LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list);
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;
sc->mii_service = rlphy_service;
sc->mii_pdata = mii;
mii->mii_instance++;
sc->mii_flags |= MIIF_NOISOLATE;
#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP, sc->mii_inst),
MII_MEDIA_100_TX);
mii_phy_reset(sc);
sc->mii_capabilities =
PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
device_printf(dev, " ");
mii_phy_add_media(sc);
printf("\n");
#undef ADD
MIIBUS_MEDIAINIT(sc->mii_dev);
return (0);
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:56,代码来源:rlphy.c
示例16: dcphy_attach
void
dcphy_attach(struct device *parent, struct device *self, void *aux)
{
struct mii_softc *sc = (struct mii_softc *)self;
struct mii_attach_args *ma = aux;
struct mii_data *mii = ma->mii_data;
struct dc_softc *dc_sc;
printf(": internal PHY\n");
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;
sc->mii_funcs = &dcphy_funcs;
sc->mii_pdata = mii;
sc->mii_flags = ma->mii_flags;
sc->mii_anegticks = 50;
sc->mii_flags |= MIIF_NOISOLATE;
dc_sc = mii->mii_ifp->if_softc;
CSR_WRITE_4(dc_sc, DC_10BTSTAT, 0);
CSR_WRITE_4(dc_sc, DC_10BTCTRL, 0);
#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
switch(dc_sc->dc_csid) {
case COMPAQ_PRESARIO_ID:
/* Example of how to only allow 10Mbps modes. */
sc->mii_capabilities = BMSR_ANEG|BMSR_10TFDX|BMSR_10THDX;
break;
default:
if (dc_sc->dc_pmode == DC_PMODE_SIA) {
sc->mii_capabilities =
BMSR_ANEG|BMSR_10TFDX|BMSR_10THDX;
} else {
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_LOOP,
sc->mii_inst), BMCR_LOOP|BMCR_S100);
sc->mii_capabilities =
BMSR_ANEG|BMSR_100TXFDX|BMSR_100TXHDX|
BMSR_10TFDX|BMSR_10THDX;
}
break;
}
if (dc_sc->dc_type == DC_TYPE_21145)
sc->mii_capabilities = BMSR_10THDX;
sc->mii_capabilities &= ma->mii_capmask;
if (sc->mii_capabilities & BMSR_MEDIAMASK)
mii_phy_add_media(sc);
#undef ADD
}
开发者ID:alenichev,项目名称:openbsd-kernel,代码行数:52,代码来源:dcphy.c
示例17: acphyattach
void
acphyattach(struct device *parent, struct device *self, void *aux)
{
struct mii_softc *sc = (struct mii_softc *)self;
struct mii_attach_args *ma = aux;
struct mii_data *mii = ma->mii_data;
const struct mii_phydesc *mpd;
mpd = mii_phy_match(ma, acphys);
printf(": %s, rev. %d\n", mpd->mpd_name, MII_REV(ma->mii_id2));
sc->mii_inst = mii->mii_instance;
sc->mii_phy = ma->mii_phyno;
sc->mii_funcs = &acphy_funcs;
sc->mii_pdata = mii;
sc->mii_flags = ma->mii_flags;
sc->mii_anegticks = MII_ANEGTICKS;
PHY_RESET(sc);
/*
* XXX Check MCR_FX_SEL to set MIIF_HAVE_FIBER?
*/
sc->mii_capabilities =
PHY_READ(sc, MII_BMSR) & ma->mii_capmask;
#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
if (sc->mii_flags & MIIF_HAVEFIBER) {
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, 0, sc->mii_inst),
MII_MEDIA_100_TX);
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_FX, IFM_FDX, sc->mii_inst),
MII_MEDIA_100_TX);
}
#undef ADD
if (sc->mii_capabilities & BMSR_MEDIAMASK)
mii_phy_add_media(sc);
}
开发者ID:ajinkya93,项目名称:OpenBSD,代码行数:39,代码来源:acphy.c
示例18: mii_add_media
/*
* Initialize generic PHY media based on BMSR, called when a PHY is
* attached. We expect to be set up to print a comma-separated list
* of media names. Does not print a newline.
*/
void
mii_add_media(struct mii_softc *sc)
{
const char *sep = "";
struct mii_data *mii;
mii = device_get_softc(sc->mii_dev);
if ((sc->mii_capabilities & BMSR_MEDIAMASK) == 0) {
printf("no media present");
return;
}
#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL)
#define PRINT(s) printf("%s%s", sep, s); sep = ", "
if (sc->mii_capabilities & BMSR_10THDX) {
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, sc->mii_inst), 0);
PRINT("10baseT");
}
if (sc->mii_capabilities & BMSR_10TFDX) {
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_FDX, sc->mii_inst),
BMCR_FDX);
PRINT("10baseT-FDX");
}
if (sc->mii_capabilities & BMSR_100TXHDX) {
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, 0, sc->mii_inst),
BMCR_S100);
PRINT("100baseTX");
}
if (sc->mii_capabilities & BMSR_100TXFDX) {
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_FDX, sc->mii_inst),
BMCR_S100|BMCR_FDX);
PRINT("100baseTX-FDX");
}
if (sc->mii_capabilities & BMSR_100T4) {
/*
* XXX How do you enable 100baseT4? I assume we set
* XXX BMCR_S100 and then assume the PHYs will take
* XXX watever action is necessary to switch themselves
* XXX into T4 mode.
*/
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_T4, 0, sc->mii_inst),
BMCR_S100);
PRINT("100baseT4");
}
if (sc->mii_capabilities & BMSR_ANEG) {
ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst),
BMCR_AUTOEN);
PRINT("auto");
}
#undef ADD
#undef PRINT
}
开发者ID:DangerDexter,项目名称:FreeBSD-8.0-dyntick,代码行数:61,代码来源:mii_physubr.c
示例19: rtems_str2ifmedia
/* convert a string to a media word
* RETURNS: 0 on failure; valid results have always at least IFM_ETHER set
*/
int
rtems_str2ifmedia (const char *str, int phy)
{
int sub, opt = 0;
char *chpt;
if (!strncmp (str, "auto", 4)) {
sub = IFM_AUTO;
} else if ((sub = find_tag (str, ethern_media_strings)) < 0) {
if ((sub = find_tag (str, eth_al_media_strings)) < 0) {
/* allow more */
/* if no number, 0 is returned which will not pass the test */
switch (strtol (str, &chpt, 10)) {
case 10:
sub = IFM_10_T;
break;
case 100:
sub = IFM_100_TX;
break;
case 1000:
sub = IFM_1000_T;
break;
default:
return 0;
}
/* need 'b' or 'base' */
if ('b' != *chpt++)
return 0;
if (!strncmp (chpt, "ase", 3))
chpt += 3;
if (toupper (*chpt++) != 'T')
return 0;
if (IFM_100_TX == sub && toupper (*chpt++) != 'X')
return 0;
}
}
if (strstr (str, "full") || strstr (str, "FDX") || strstr (str, "fdx"))
opt |= IFM_FDX;
return IFM_MAKEWORD (IFM_ETHER, sub, opt, phy);
}
开发者ID:jfpmonteiro,项目名称:rtems-4.8-rhealstone,代码行数:47,代码来源:rtems_mii_ioctl.c
示例20: compat_open
static status_t
compat_open(const char *name, uint32 flags, void **cookie)
{
struct ifnet *ifp;
struct ifreq ifr;
int i;
for (i = 0; i < MAX_DEVICES; i++) {
if (gDevices[i] != NULL && !strcmp(gDevices[i]->device_name, name))
break;
}
if (i == MAX_DEVICES)
return B_ERROR;
if (get_module(NET_STACK_MODULE_NAME, (module_info **)&gStack) != B_OK)
return B_ERROR;
ifp = gDevices[i];
if_printf(ifp, "compat_open(0x%" B_PRIx32 ")\n", flags);
if (atomic_or(&ifp->open_count, 1)) {
put_module(NET_STACK_MODULE_NAME);
return B_BUSY;
}
ifp->if_init(ifp->if_softc);
if (!HAIKU_DRIVER_REQUIRES(FBSD_WLAN)) {
ifp->if_flags &= ~IFF_UP;
ifp->if_ioctl(ifp, SIOCSIFFLAGS, NULL);
}
memset(&ifr, 0, sizeof(ifr));
ifr.ifr_media = IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, 0);
ifp->if_ioctl(ifp, SIOCSIFMEDIA, (caddr_t)&ifr);
ifp->if_flags |= IFF_UP;
ifp->if_ioctl(ifp, SIOCSIFFLAGS, NULL);
*cookie = ifp;
return B_OK;
}
开发者ID:Barrett17,项目名称:haiku-contacts-kit-old,代码行数:43,代码来源:device.c
注:本文中的IFM_MAKEWORD函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论