From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hugo Tyson To: ecos-discuss@sources.redhat.com Subject: Re: [ECOS] Where do I put ETH_DRV_SC? Date: Tue, 14 Aug 2001 07:43:00 -0000 Message-id: References: <2253171AF143D21185A60000F8FA748B03795E12@pluto.combitech.se> X-SW-Source: 2001-08/msg00476.html David.Karlberg@combitechsystems.com writes: > Im Trying to get TCP/IP working on a media Enging . I am using the > nanoEnging template and I want to write a hardware driver using the > ETH_DRV_SC()/NETDEVTAB_ENTRY(). They don't say what type of ethernet the mediaEngine has, but I see it's not the same as the i82559(s) on the commEngine and nanoEngine. It just says 10BaseT - does that mean it's an SMSC91C96 or similar? If so you could re-use that driver? > And my question is: where do I put the ETH_DRV_SC()/NETDEVTAB_ENTRY() > code? In the source ;-) That sounds unhelpful, but it's not, really it's not. Take a look at the generic i82559 driver that's used by the nano target. It includes a header that sets up a load of context. The header also does the ETH_DRV_SC(i82559_sc0, ......... NETDEVTAB_ENTRY(i82559_netdev0, ......... invocations for as many devices as you want. The compiled generic driver is linked in to libextras.a by the compile line in its cdl - that's what makes those magic things be linked into the system, just so long as the results of ETH_DRV_SC()/NETDEVTAB_ENTRY() are in the image and no garbage collected. Using libextras.a is what prevents the garbage collection. The other way we do generic drivers is to have the generic driver in a header, and a .c sets up context, including ETH_DRV_SC()/NETDEVTAB_ENTRY() and then includes the header to make all the functions. Same difference; they're really just two ways to compile the catenation of two C files, one from a different package selected according to the target and one generic. If you don't want to separate your driver into a generic part and a specific part, you don't have to. So just have one .c file and put the lot in that. The EBSA285 ethernet driver is like that - only because it's rather old; the generic i82559 driver grew from it, but we didn't change over to help keep the EBSA driver stable. HTH, - Huge