#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
Include dependency graph for mii-diag.c:
Go to the source code of this file.
Defines | |
#define | SIOCGPARAMS (SIOCDEVPRIVATE+3) |
#define | SIOCSPARAMS (SIOCDEVPRIVATE+4) |
#define | MII_ACTION_NONE 0 |
#define | MII_ACTION_READ 1 |
#define | MII_ACTION_WRITE 2 |
Typedefs | |
typedef u_int32_t | u32 |
typedef u_int16_t | u16 |
typedef u_int8_t | u8 |
Functions | |
int | show_mii_details (long ioaddr, int phy_id) |
void | monitor_mii (long ioaddr, int phy_id) |
int | do_one_xcvr (int skfd) |
int | show_basic_mii (long ioaddr, int phy_id) |
int | mdio_read (int skfd, int phy_id, int location) |
void | mdio_write (int skfd, int phy_id, int location, int value) |
static int | parse_advertise (const char *capabilities) |
static void | monitor_status (long ioaddr, int phy_id) |
int | main (int argc, char **argv) |
Variables | |
static char | version [] |
static const char | usage_msg [] |
static const char | long_usage_msg [] |
const char | shortopts [] = "aA:C:x:y:DfF:gG:hmM:p:rRsvVw?" |
option | longopts [] |
unsigned int | opt_a = 0 |
unsigned int | opt_f = 0 |
unsigned int | opt_g = 0 |
unsigned int | opt_G = 0 |
unsigned int | verbose = 0 |
unsigned int | debug = 0 |
unsigned int | opt_version = 0 |
unsigned int | opt_restart = 0 |
unsigned int | opt_reset = 0 |
unsigned int | opt_status = 0 |
unsigned int | opt_watch = 0 |
static int | msg_level = -1 |
static int | set_BMCR = -1 |
static int | nway_advertise = 0 |
static int | fixed_speed = -1 |
static int | override_phy = -1 |
char * | opt_G_string = NULL |
static int | mii_action = MII_ACTION_NONE |
unsigned | mii_addr = 0xFFFF |
unsigned | mii_value = 0 |
int | silent = 0 |
int | new_ioctl_nums |
int | skfd = -1 |
ifreq | ifr |
static const char * | media_names [] |
static const char * | bmcr_bits [] |
#define MII_ACTION_NONE 0 |
#define MII_ACTION_READ 1 |
#define MII_ACTION_WRITE 2 |
#define SIOCGPARAMS (SIOCDEVPRIVATE+3) |
#define SIOCSPARAMS (SIOCDEVPRIVATE+4) |
typedef u_int16_t u16 |
Definition at line 101 of file mii-diag.c.
typedef u_int32_t u32 |
Definition at line 100 of file mii-diag.c.
typedef u_int8_t u8 |
Definition at line 102 of file mii-diag.c.
int do_one_xcvr | ( | int | skfd | ) |
Definition at line 294 of file mii-diag.c.
References data, debug, exit, mdio_read(), mdio_write(), MII_ACTION_NONE, MII_ACTION_READ, MII_ACTION_WRITE, mii_val, monitor_mii(), monitor_status(), opt_G, opt_g, opt_reset, opt_restart, opt_status, opt_watch, show_basic_mii(), show_mii_details(), SIOCGPARAMS, SIOCSPARAMS, stderr, and verbose.
Referenced by main().
int main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 186 of file mii-diag.c.
References data, debug, do_one_xcvr(), long_usage_msg, longopts, MII_ACTION_NONE, MII_ACTION_READ, MII_ACTION_WRITE, opt_f, opt_G, opt_g, opt_reset, opt_restart, opt_status, opt_version, opt_watch, parse_advertise(), shortopts, stderr, usage_msg, verbose, version, and void().
int mdio_read | ( | int | skfd, | |
int | phy_id, | |||
int | location | |||
) |
void mdio_write | ( | int | skfd, | |
int | phy_id, | |||
int | location, | |||
int | value | |||
) |
void monitor_mii | ( | long | ioaddr, | |
int | phy_id | |||
) |
static void monitor_status | ( | long | ioaddr, | |
int | phy_id | |||
) | [static] |
Definition at line 639 of file mii-diag.c.
References mdio_read(), and stdout.
Referenced by do_one_xcvr().
static int parse_advertise | ( | const char * | capabilities | ) | [static] |
int show_basic_mii | ( | long | ioaddr, | |
int | phy_id | |||
) |
Definition at line 521 of file mii-diag.c.
References mdio_read(), mii_val, opt_f, and verbose.
Referenced by do_one_xcvr().
int show_mii_details | ( | long | ioaddr, | |
int | phy_id | |||
) |
const char* bmcr_bits[] [static] |
Initial value:
{ " Internal Collision-Test enabled!\n", "", " Restarted auto-negotiation in progress!\n", " Transceiver isolated from the MII!\n", " Transceiver powered down!\n", "", "", " Transceiver in loopback mode!\n", " Transceiver currently being reset!\n", }
Definition at line 512 of file mii-diag.c.
unsigned int debug = 0 |
Definition at line 151 of file mii-diag.c.
Referenced by create_elphel353_kdevelop(), createDefaultConfig(), do_one_xcvr(), main(), parse_advertise(), and showUsage().
int fixed_speed = -1 [static] |
Definition at line 160 of file mii-diag.c.
struct ifreq ifr |
Definition at line 175 of file mii-diag.c.
const char long_usage_msg[] [static] |
struct option longopts[] |
Initial value:
{ {"all-interfaces", 0, 0, 'a'}, {"advertise", 1, 0, 'A'}, {"BMCR", 1, 0, 'C'}, {"debug", 0, 0, 'D'}, {"force", 0, 0, 'f'}, {"fixed-speed", 1, 0, 'F'}, {"read-parameters", 0, 0, 'g'}, {"set-parameters", 1, 0, 'G'}, {"mii-addr", 1, 0, 'x'}, {"mii-value", 1, 0, 'y'}, {"help", 0, 0, 'h'}, {"monitor", 0, 0, 'm'}, {"msg-level", 1, 0, 'M'}, {"phy", 1, 0, 'p'}, {"restart", 0, 0, 'r'}, {"reset", 0, 0, 'R'}, {"status", 0, 0, 's'}, {"verbose", 0, 0, 'v'}, {"version", 0, 0, 'V'}, {"watch", 0, 0, 'w'}, {"error", 0, 0, '?'}, { 0, 0, 0, 0 } }
Definition at line 112 of file mii-diag.c.
Referenced by main().
const char* media_names[] [static] |
Initial value:
{ "10baseT", "10baseT-FD", "100baseTx", "100baseTx-FD", "100baseT4", "Flow-control", 0, }
Definition at line 507 of file mii-diag.c.
int mii_action = MII_ACTION_NONE [static] |
Definition at line 167 of file mii-diag.c.
unsigned mii_addr = 0xFFFF |
Definition at line 168 of file mii-diag.c.
unsigned mii_value = 0 |
Definition at line 169 of file mii-diag.c.
int msg_level = -1 [static] |
Definition at line 157 of file mii-diag.c.
int new_ioctl_nums |
Definition at line 173 of file mii-diag.c.
int nway_advertise = 0 [static] |
Definition at line 159 of file mii-diag.c.
unsigned int opt_a = 0 |
Definition at line 146 of file mii-diag.c.
unsigned int opt_f = 0 |
unsigned int opt_G = 0 |
unsigned int opt_g = 0 |
char* opt_G_string = NULL |
Definition at line 162 of file mii-diag.c.
unsigned int opt_reset = 0 |
unsigned int opt_restart = 0 |
unsigned int opt_status = 0 |
unsigned int opt_version = 0 |
unsigned int opt_watch = 0 |
int override_phy = -1 [static] |
Definition at line 161 of file mii-diag.c.
int set_BMCR = -1 [static] |
Definition at line 158 of file mii-diag.c.
const char shortopts[] = "aA:C:x:y:DfF:gG:hmM:p:rRsvVw?" |
int silent = 0 |
int skfd = -1 |
Definition at line 174 of file mii-diag.c.
const char usage_msg[] [static] |
Initial value:
"Usage: %s [--help] [-aDfrRvVw] [-AF <speed+duplex>] [--watch] <interface>.\n"
Definition at line 37 of file mii-diag.c.
Referenced by main().
unsigned int verbose = 0 |
Definition at line 150 of file mii-diag.c.
Referenced by do_one_xcvr(), main(), show_basic_mii(), and test_one_file().
char version[] [static] |
Initial value:
"mii-diag.c:v2.11 3/21/2005 Donald Becker (becker@scyld.com)\n" " http://www.scyld.com/diag/index.html\n"
Definition at line 33 of file mii-diag.c.
Referenced by create_elphel353_kdevelop(), gen_static_xml(), jpeg_session_start(), main(), PrintHelp(), usage(), write_dirent(), and write_sdp().