Re: Duplex mode
"Tom Collins tom-lnEA/wrDJtNWk0Htik3J/[email protected] [rabbit-semi]" <[email protected]> Sat, 26 Sep 2015 18:57:22 -0700
| Newsgroups | gmane.comp.hardware.rabbit-semiconductor |
|---|---|
| Message-ID | <[email protected]> |
Steve, I believe 110 is just used to uniquely identify the ioctl. I'm not looking at the other code, but DE probably holds the ioctl number to match. That assembly code is essentially comparing DE to 110, and jumping to asix_ioctl_networkmode if they match. The second section takes parameters from the stack, re-pushes them on the stack and calls the underlying function. Take a look at pd_networkmode() in PKTDRV.LIB to see the linkage. I believe this is all so you can have a single API (pd_*) that maps to multiple network drivers depending on what the underlying hardware is. Bottom line for you, though, is that pd_networkmode() is the generic function you can use to change the duplex setting. Looking at ASIX.LIB from Dynamic C 10.72 (the only version I have on this computer right now), I would say that you can't change the default, startup duplex setting with a macro. Try using pd_networkmode() to change the duplex setting before your ifconfig() calls to bring the interface up, or before calling sock_init(). You may need to experiment a bit to get the calling order right, in case sock_init() or ifconfig() overwrite your duplex setting. -Tom On Sep 24, 2015, at 9:19 AM, Steve Trigero seecwriter-/[email protected] [rabbit-semi] wrote: > Tom, > > I saw function asix_networkmode(), and tried unsuccessfully to follow the code to see what mode was being set. > > In net_defs.lib is the following define: > > #define PD_NETWORK_MODE 110 // int, int (speed, duplex) > > I can't figure out how to decipher the value of 110. > > And in ASIX.LIB, in function asix_ioctl() is a large switch statement that uses the define in one of the cases: > > #ifdef PD_NETWORK_MODE > ;case PD_NETWORK_MODE: > ld hl, PD_NETWORK_MODE > xor a > sbc hl, de > jp z, .asix_ioctl_networkmode > #endif > > Notice that whatever value is in register de is subtracted from the value 110, with the result placed in hl. > > Then function asix_ioctl_networkmode() is called where the first statement wipes out whatever value was in hl. So now what? > > #ifdef PD_NETWORK_MODE > .asix_ioctl_networkmode: > ;case PD_NETWORK_MODE > ;return asix_networkmode(nic, *(int *) stack, *(int *) (stack + sizeof(int))); > ld hl, (sp+@sp+stack) > ld hl, (hl+sizeof(int)) > push hl > ld hl, (sp+@sp+stack+2) > ld hl, (hl) > push hl > ld hl, (sp+@sp+nic+4) > push hl > asix_internal_call(asix_networkmode) > add sp, 6 > ld (sp+@sp+retval), hl > jr .asix_ioctl_return > #endif > > So I have no clue as to what mode is being set. > > Steve >