apps/mii-diag/libmii.c File Reference

#include <unistd.h>
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>

Include dependency graph for libmii.c:

Go to the source code of this file.

Data Structures

struct  mii_partnum
struct  msg_tbl

Typedefs

typedef u_int32_t u32
typedef u_int16_t u16
typedef u_int8_t u8

Functions

void show_mii_details (long ioaddr, int phy_id)
int monitor_mii (long ioaddr, int phy_id)
int mdio_read (long ioaddr, int phy_id, int mii_reg_num)
static void ns83843 (long ioaddr, int phy_id)
static void qs6612 (long ioaddr, int phy_id)
static void smsc83c180 (long ioaddr, int phy_id)
static void tdk78q2120 (long ioaddr, int phy_id)
static void davicom_dm9101 (long ioaddr, int phy_id)
static void intel_i553 (long ioaddr, int phy_id)
static void enablesemi (long ioaddr, int phy_id)
static void amd_pna (long ioaddr, int phy_id)
static void amd_tx (long ioaddr, int phy_id)
static void admtek (long ioaddr, int phy_id)
static void lu3x31 (long ioaddr, int phy_id)
static void myson981 (long ioaddr, int phy_id)
static void via_tahoe (long ioaddr, int phy_id)
static void via_vt6103 (long ioaddr, int phy_id)
static void via_vt6105 (long ioaddr, int phy_id)
static void intel (long ioaddr, int phy_id)
static void msg_if_set (const int val, const struct msg_tbl msg_tbl[])
static void msg_if_set_fmt (const int val, const struct msg_tbl msg_tbl[], const char *fmt)

Variables

static const char version_msg []
static const char * media_names []
mii_partnum oui_map []
static u16 mii_val [32]
static const char * tdk_events [8]
static struct msg_tbl tdk_reg16 []
static struct msg_tbl admtek_reg21 []
static struct msg_tbl myson_reg16 []
static struct msg_tbl via_reg17 []


Typedef Documentation

typedef u_int16_t u16

Definition at line 42 of file libmii.c.

typedef u_int32_t u32

Definition at line 41 of file libmii.c.

typedef u_int8_t u8

Definition at line 43 of file libmii.c.


Function Documentation

static void admtek ( long  ioaddr,
int  phy_id 
) [static]

Definition at line 493 of file libmii.c.

References admtek_reg21, msg_if_set(), and tdk78q2120().

static void amd_pna ( long  ioaddr,
int  phy_id 
) [static]

Definition at line 462 of file libmii.c.

static void amd_tx ( long  ioaddr,
int  phy_id 
) [static]

Definition at line 470 of file libmii.c.

static void davicom_dm9101 ( long  ioaddr,
int  phy_id 
) [static]

Definition at line 440 of file libmii.c.

static void enablesemi ( long  ioaddr,
int  phy_id 
) [static]

Definition at line 451 of file libmii.c.

static void intel ( long  ioaddr,
int  phy_id 
) [static]

Definition at line 606 of file libmii.c.

static void intel_i553 ( long  ioaddr,
int  phy_id 
) [static]

Definition at line 445 of file libmii.c.

static void lu3x31 ( long  ioaddr,
int  phy_id 
) [static]

Definition at line 506 of file libmii.c.

int mdio_read ( long  ioaddr,
int  phy_id,
int  mii_reg_num 
)

Referenced by do_one_xcvr(), monitor_mii(), monitor_status(), show_basic_mii(), show_mii_details(), and smsc83c180().

void monitor_mii ( long  ioaddr,
int  phy_id 
)

Definition at line 239 of file libmii.c.

References mdio_read(), media_names, stderr, and stdout.

Referenced by do_one_xcvr().

static void msg_if_set ( const int  val,
const struct msg_tbl  msg_tbl[] 
) [static]

Definition at line 317 of file libmii.c.

References msg_tbl::bitmask.

Referenced by admtek(), myson981(), and tdk78q2120().

static void msg_if_set_fmt ( const int  val,
const struct msg_tbl  msg_tbl[],
const char *  fmt 
) [static]

Definition at line 325 of file libmii.c.

References msg_tbl::bitmask.

Referenced by via_tahoe().

static void myson981 ( long  ioaddr,
int  phy_id 
) [static]

Definition at line 523 of file libmii.c.

References msg_if_set(), myson_reg16, and tdk_reg16.

static void ns83843 ( long  ioaddr,
int  phy_id 
) [static]

Definition at line 343 of file libmii.c.

static void qs6612 ( long  ioaddr,
int  phy_id 
) [static]

Definition at line 334 of file libmii.c.

int show_mii_details ( long  ioaddr,
int  phy_id 
)

Definition at line 123 of file libmii.c.

References mii_partnum::func(), mdio_read(), media_names, oui_map, mii_partnum::vendor, and version_msg.

Referenced by do_one_xcvr().

static void smsc83c180 ( long  ioaddr,
int  phy_id 
) [static]

Definition at line 364 of file libmii.c.

References mdio_read().

static void tdk78q2120 ( long  ioaddr,
int  phy_id 
) [static]

Definition at line 398 of file libmii.c.

References msg_if_set(), and tdk_reg16.

Referenced by admtek().

static void via_tahoe ( long  ioaddr,
int  phy_id 
) [static]

Definition at line 563 of file libmii.c.

References msg_if_set_fmt(), and via_reg17.

static void via_vt6103 ( long  ioaddr,
int  phy_id 
) [static]

Definition at line 582 of file libmii.c.

static void via_vt6105 ( long  ioaddr,
int  phy_id 
) [static]

Definition at line 595 of file libmii.c.


Variable Documentation

struct msg_tbl admtek_reg21[] [static]

Initial value:

 {
        {0x4000, " Link test diabled: Ignoring lack of 10baseT link beat."},
        {0x2000, " Link forced up."},
        {0x1000, " Tx jabber check disabled."},
        {0x0080, " Transmitting 'Far End Fault'!"},
        {0x0040, " Rx error count full."},
        {0x0008, " Remote loop back enabled."},
        {0, 0},
}

Definition at line 483 of file libmii.c.

Referenced by admtek().

const char* media_names[] [static]

Initial value:

 {
        "10baseT", "10baseT-FD", "100baseTx", "100baseTx-FD", "100baseT4",
        "Flow-control", 0,
}

Definition at line 45 of file libmii.c.

Referenced by monitor_mii(), and show_mii_details().

u16 mii_val[32] [static]

Definition at line 121 of file libmii.c.

Referenced by do_one_xcvr(), and show_basic_mii().

struct msg_tbl myson_reg16[] [static]

Initial value:

 {
        {0x0080, " Far end fault enabled."},
        {0x0040, " Transformer ratio 1.25:1."},
        {0x0020, " Polarity correction diabled."},
        {0x0010, " Link is forced up regardless of link beat."},
        {0x0004, " Bypass Jabber check."},
        {0x0001, " 100baseFx mode selected."},
        {0, 0},
}

Definition at line 513 of file libmii.c.

Referenced by myson981().

struct mii_partnum oui_map[]

Referenced by show_mii_details().

const char* tdk_events[8] [static]

Initial value:

 {
        "Jabber", "Rx error", "Negotiation page received", "Link detection fault",
        "Link partner acknowledge", "Link status change", "Remote partner fault",
        "Auto-Negotiation complete"}

Definition at line 383 of file libmii.c.

struct msg_tbl tdk_reg16[] [static]

Initial value:

 {
        {0x8000, " Transceiver is in repeater mode!"},
        {0x4000, " Interrupt pin set to active high."},
        {0x2000, " Reserved bit 12 is unexpectedly set."},
        {0x1000, " Transmit pins are internally disconnected."},
        {0x0800, " 10baseT signal quality test is disabled."},
        {0x0400, " 10baseT loopback mode."},
        {0, 0},
}

Definition at line 388 of file libmii.c.

Referenced by myson981(), and tdk78q2120().

const char version_msg[] [static]

Initial value:

"libmii.c:v2.11 2/28/2005  Donald Becker (becker@scyld.com)\n"
" http://www.scyld.com/diag/index.html\n"

Definition at line 21 of file libmii.c.

Referenced by show_mii_details().

struct msg_tbl via_reg17[] [static]

Initial value:

 {
        {0x0001, "Auto-Negotiation complete"},
        {0x0002, "Remote fault detected"},
        {0x0004, "Link failure detected"},
        {0x0008, "Bad Start Stream detected"},
        {0x0010, "Parallel detection fault"},
        {0x0020, "Extended negotiation page received"},
        {0x0040, "5B/4B code error detected"},
        {0x0080, "Jabber detected"},
        {0, 0},
}

Definition at line 551 of file libmii.c.

Referenced by via_tahoe().


Generated on Fri Nov 28 00:07:06 2008 for elphel by  doxygen 1.5.1