コード例 #1
0
ファイル: cs89x0.c プロジェクト: pierre/syslinux-fastboot
static int detect_bnc(struct nic *nic)
{
	clrline(); printf("attempting %s:","BNC");
	control_dc_dc(1);

	writereg(PP_LineCTL, (eth_linectl & ~AUTO_AUI_10BASET) | AUI_ONLY);

	if (send_test_pkt(nic)) {
		return A_CNF_MEDIA_10B_2; }
	else
		return 0;
}
コード例 #2
0
ファイル: cs89x0.c プロジェクト: pdlun92/xcat-dep
static int detect_tp(void)
{
    unsigned long tmo;

    /* Turn on the chip auto detection of 10BT/ AUI */

    clrline();
    printf("attempting %s:","TP");

    /* If connected to another full duplex capable 10-Base-T card
    the link pulses seem to be lost when the auto detect bit in
    the LineCTL is set.  To overcome this the auto detect bit
    will be cleared whilst testing the 10-Base-T interface.
    This would not be necessary for the sparrow chip but is
    simpler to do it anyway. */
    writereg(PP_LineCTL, eth_linectl &~ AUI_ONLY);
    control_dc_dc(0);

    /* Delay for the hardware to work out if the TP cable is
    present - 150ms */
    for (tmo = currticks() + 4; currticks() < tmo; );

    if ((readreg(PP_LineST) & LINK_OK) == 0)
        return 0;

    if (eth_cs_type != CS8900) {

        writereg(PP_AutoNegCTL, eth_auto_neg_cnf & AUTO_NEG_MASK);

        if ((eth_auto_neg_cnf & AUTO_NEG_BITS) == AUTO_NEG_ENABLE) {
            printf(" negotiating duplex... ");
            while (readreg(PP_AutoNegST) & AUTO_NEG_BUSY) {
                if (currticks() - tmo > 40*TICKS_PER_SEC) {
                    printf("time out ");
                    break;
                }
            }
        }
        if (readreg(PP_AutoNegST) & FDX_ACTIVE)
            printf("using full duplex");
        else
            printf("using half duplex");
    }

    return A_CNF_MEDIA_10B_T;
}