Ethernet Configration
"seecwriter" <seecwriter-/[email protected]>
| Newsgroups | gmane.comp.hardware.rabbit-semiconductor |
|---|---|
| Message-ID | <[email protected]> |
I'm using the R3k series of modules with DC 9.25 and 9.62, depending
on the module. But the version of DC doesn't make a difference.
If the Rabbit is plugged into a network, I am able to configure the
Ethernet parameters without a problem. I can set it to Static IP, set
the IP Address, etc. But if the Rabbit is not connected to any
network, and I set it to Static IP, and set the IP Address, when I
read the IP Addess using gethostid(), I get address 0.0.0.0. Connect
to a network, and gethostid() starts returning the actual IP Address.
Also, I reboot the Rabbit after I change the Ethernet configuration.
It seems to work better that way.
In any case, is this normal/correct operation?
This is how I initialize Ethernet on power-up:
// Set Static IP & fallbacks
i = ifconfig( IF_ETH0,
IFS_DHCP, 0,
IFS_IPADDR, static_ip_adrs,
IFS_NETMASK, net_mask,
IFS_END );
sock_init();
// Either acquire an IP address via DHCP, or go to Static IP
i = ifconfig( IF_ETH0,
IFS_IF_CALLBACK, EnetUpDown, // Set Up/Down status
IFS_DHCP, IsDhcpIP(), // Use DHCP to configure port if enabled
IFS_DHCP_TIMEOUT, 65, // Specify timeout in seconds
IFS_DHCP_FALLBACK, 1, // Allow use of fallbacks to
// static configuration
IFS_ICMP_CONFIG, 0, // Don't allow use of directed
// ping to configure.
IFS_END );
Steve