"Fossies" - the Fresh Open Source Software Archive

Member "ethtool-5.1/fec_8xx.c" (24 Aug 2016, 2561 Bytes) of package /linux/misc/ethtool-5.1.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "fec_8xx.c" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Copyright (C) 2004 Intracom S.A.
    3  * Pantelis Antoniou <panto@intracom.gr>
    4  */
    5 
    6 #include <stdio.h>
    7 #include <stdint.h>
    8 #include <stddef.h>
    9 
   10 #include "internal.h"
   11 
   12 struct fec {
   13     uint32_t    addr_low;   /* lower 32 bits of station address */
   14     uint32_t    addr_high;  /* upper 16 bits of station address||0  */
   15     uint32_t    hash_table_high;/* upper 32-bits of hash table      */
   16     uint32_t    hash_table_low; /* lower 32-bits of hash table      */
   17     uint32_t    r_des_start;    /* beginning of Rx descriptor ring  */
   18     uint32_t    x_des_start;    /* beginning of Tx descriptor ring  */
   19     uint32_t    r_buff_size;    /* Rx buffer size           */
   20     uint32_t    res2[9];    /* reserved             */
   21     uint32_t    ecntrl;     /* ethernet control register        */
   22     uint32_t    ievent;     /* interrupt event register     */
   23     uint32_t    imask;      /* interrupt mask register      */
   24     uint32_t    ivec;       /* interrupt level and vector status    */
   25     uint32_t    r_des_active;   /* Rx ring updated flag         */
   26     uint32_t    x_des_active;   /* Tx ring updated flag         */
   27     uint32_t    res3[10];   /* reserved             */
   28     uint32_t    mii_data;   /* MII data register            */
   29     uint32_t    mii_speed;  /* MII speed control register       */
   30     uint32_t    res4[17];   /* reserved             */
   31     uint32_t    r_bound;    /* end of RAM (read-only)       */
   32     uint32_t    r_fstart;   /* Rx FIFO start address        */
   33     uint32_t    res5[6];    /* reserved             */
   34     uint32_t    x_fstart;   /* Tx FIFO start address        */
   35     uint32_t    res6[17];   /* reserved             */
   36     uint32_t    fun_code;   /* fec SDMA function code       */
   37     uint32_t    res7[3];    /* reserved             */
   38     uint32_t    r_cntrl;    /* Rx control register          */
   39     uint32_t    r_hash;     /* Rx hash register         */
   40     uint32_t    res8[14];   /* reserved             */
   41     uint32_t    x_cntrl;    /* Tx control register          */
   42     uint32_t    res9[0x1e]; /* reserved             */
   43 };
   44 
   45 #define DUMP_REG(f, x)  fprintf(stdout, \
   46             "0x%04lx: %-16s 0x%08x\n", \
   47                 (unsigned long)(offsetof(struct fec, x)), \
   48                 #x, f->x)
   49 
   50 int fec_8xx_dump_regs(struct ethtool_drvinfo *info, struct ethtool_regs *regs)
   51 {
   52     struct fec *f = (struct fec *)regs->data;
   53 
   54     fprintf(stdout, "Descriptor Registers\n");
   55     fprintf(stdout, "---------------------\n");
   56 
   57     DUMP_REG(f, addr_low);
   58     DUMP_REG(f, addr_high);
   59     DUMP_REG(f, hash_table_high);
   60     DUMP_REG(f, hash_table_low);
   61     DUMP_REG(f, r_des_start);
   62     DUMP_REG(f, x_des_start);
   63     DUMP_REG(f, r_buff_size);
   64     DUMP_REG(f, ecntrl);
   65     DUMP_REG(f, ievent);
   66     DUMP_REG(f, imask);
   67     DUMP_REG(f, ivec);
   68     DUMP_REG(f, r_des_active);
   69     DUMP_REG(f, x_des_active);
   70     DUMP_REG(f, mii_data);
   71     DUMP_REG(f, mii_speed);
   72     DUMP_REG(f, r_bound);
   73     DUMP_REG(f, r_fstart);
   74     DUMP_REG(f, x_fstart);
   75     DUMP_REG(f, fun_code);
   76     DUMP_REG(f, r_cntrl);
   77     DUMP_REG(f, r_hash);
   78     DUMP_REG(f, x_cntrl);
   79 
   80     return 0;
   81 }