[ECOS] who can tell me the relations between net device and net driver?

张 亮 johnsonest@hotmail.com
Sat Jan 4 07:11:00 GMT 2003


Hello,everyone!
     I am confused by ecos net driver,following is a sample:
 this is device i82559:

typedef struct i82559 {
    cyg_uint8                           // (split up for atomic byte 
access)
        found:1,                        // was hardware discovered?
        mac_addr_ok:1,                  // can we bring up?
        active:1,                       // has this if been brung up?
        hardwired_esa:1,                // set if ESA is hardwired via CDL
        promisc:1,                      // set if in promisc mode
        multicast_all:1,                // set if MultiCastALL mode
        oversized:1,                    // set if oversized packets are 
received (VLAN mode)
        spare1:1; 
    cyg_uint8                           // Count nested sends to reject
        within_send:8;                  //     nested requests to send
    cyg_uint8
        tx_in_progress:1,               // transmit in progress flag
        tx_queue_full:1,                // all Tx descriptors used flag
        spare3:6; 
    cyg_uint8  index;                   // 0 or 1 or whatever
    cyg_uint32 devid;                   // PCI device id
    cyg_uint32 memory_address;          // PCI memory address
    cyg_uint32 io_address;              // memory mapped I/O address
    cyg_uint8  mac_address[6];          // mac (hardware) address
    void *ndp;                          // Network Device Pointer

    int next_rx_descriptor;             // descriptor index for RFDs
    RFD* rx_ring[MAX_RX_DESCRIPTORS];   // location of Rx descriptors

    int tx_descriptor_add;              // descriptor index for additions
    int tx_descriptor_active;           // descriptor index for active tx
    int tx_descriptor_remove;           // descriptor index for remove

    TxCB* tx_ring[MAX_TX_DESCRIPTORS];  // location of Tx descriptors
    unsigned long tx_keys[MAX_TX_DESCRIPTORS];
                                        // keys for tx q management

    // Interrupt handling stuff
    cyg_vector_t    vector;             // interrupt vector
    cyg_handle_t    interrupt_handle;   // handle for int.handler
    cyg_interrupt   interrupt_object;

#ifdef KEEP_STATISTICS
    void *p_statistics;                 // pointer to statistical counters
#endif

    cyg_uint32 platform_timeout;        // Some platforms use a timeout
    int tx_descriptor_timeout;          // Is it fixated on this tx?

} I82559;

I do not know "void *ndp; // Network Device Pointer" pointer what? it 
should be a hardware independent device,but no this device structure was 
defined.
 and i do not find where to init __NETDEVTAB__[] !

in following code:

typedef struct cyg_netdevtab_entry {
    const char        *name;
    bool             (*init)(struct cyg_netdevtab_entry *tab);
    void              *device_instance;  // Local data, instance specific
    unsigned long     status;
} CYG_HAL_TABLE_TYPE cyg_netdevtab_entry_t;
 device_instance is what? i guess it is a device

and struct eth_drv_sc {
    struct eth_hwr_funs *funs;
    void                *driver_private;
    const char          *dev_name;
    int                  state;
    struct arpcom        sc_arpcom; /* ethernet common */
};

who can explain in details to me ? thank you very much!!!!!!!!!!!!!!
please email to me

BRS/johnsonest

_________________________________________________________________
ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£ http://www.hotmail.com 


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss



More information about the Ecos-discuss mailing list