"atsamv" BSP legacy network driver status
Peter Dufault
dufault at hda.com
Mon Jan 27 21:10:57 UTC 2020
The "rtems-libbsd" "if_atsam.c" driver is derived from the legacy one. What's the status of the two drivers? I ask because I'm trying to do some small memory testing with the legacy stack on the . It is building but not working, I don't think network packets are going out even though the build is definitely receiving broadcast packets because I see the number of incoming receive interrupts increasing.
My first attempts crashed because the attach function unconditionally de-referenced "config->hardware_address", most legacy drivers conditionalize the de-reference. I modified the driver to do something similar to what the "libbsd" driver does.
After that everything appears to work except networking isn't working. I put the system on its own little section of a managed switch and I don't see any packet activity. The app is running a shell with "netstat" and I can see the count of receive interrupts going up.
Before I go much further I have a few questions.
- What's the usage of the "atsamv" driver? I know there are issues associated with the external SRAM, clock speeds, and maybe clock references. But is the legacy driver used, only the "libbsd" driver used, or neither?
Thanks -
Peter
**** The diffs I made to the driver are:
diff --git a/bsps/arm/atsam/net/if_atsam.c b/bsps/arm/atsam/net/if_atsam.c
index 9665aa1..5c84cdc 100644
--- a/bsps/arm/atsam/net/if_atsam.c
+++ b/bsps/arm/atsam/net/if_atsam.c
@@ -1181,6 +1181,10 @@ static int if_atsam_driver_attach(struct rtems_bsdnet_ifconfig *config)
const if_atsam_config *conf = config->drv_ctrl;
int unitNumber;
char *unitName;
+ /* This is sort of what the libbsd library does for the lack of a MAC address.
+ * except the final byte is 0x11 + unit.
+ */
+ static const uint8_t mac_addr[] = { 0x0e, 0xb0, 0xba, 0x5e, 0xba, 0x11 /* + unit */ };
if (conf != NULL) {
sc->Gmac_inst.retries = conf->mdio_retries;
@@ -1191,7 +1195,11 @@ static int if_atsam_driver_attach(struct rtems_bsdnet_ifconfig *config)
}
/* The MAC address used */
- memcpy(sc->GMacAddress, config->hardware_address, ETHER_ADDR_LEN);
+ if (config->hardware_address) {
+ memcpy(sc->GMacAddress, config->hardware_address, ETHER_ADDR_LEN);
+ } else {
+ memcpy(sc->GMacAddress, mac_addr, ETHER_ADDR_LEN);
+ }
memcpy(sc->arpcom.ac_enaddr, sc->GMacAddress, ETHER_ADDR_LEN);
/*
*** Configuration command is:
../rtems/configure \
--target=arm-rtems5 \
--enable-rtemsbsp=atsamv \
--prefix=/opt/customer/rtems-5/ \
--enable-networking \
--enable-posix \
--disable-smp \
--disable-multiprocessing \
--enable-tests \
--enable-cxx \
--enable-maintainer-mode
Peter
-----------------
Peter Dufault
HD Associates, Inc. Software and System Engineering
This email is delivered through the public internet using protocols subject to interception and tampering.
More information about the devel
mailing list