diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-04-21 18:17:41 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-04-21 18:17:41 +0000 |
commit | 87b4b06d09f0a188286304756f84019e4c177922 (patch) | |
tree | 05890f28b7ad36bd13f4b53b080c04c2c7955b18 /misc | |
parent | 2c6eb1d98e93b702ab5fe8dbfd69b9ed95d79843 (diff) | |
download | px4-nuttx-87b4b06d09f0a188286304756f84019e4c177922.tar.gz px4-nuttx-87b4b06d09f0a188286304756f84019e4c177922.tar.bz2 px4-nuttx-87b4b06d09f0a188286304756f84019e4c177922.zip |
Fix RTL driver MAC address
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3529 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'misc')
-rwxr-xr-x | misc/drivers/rtl8187x/rtl8187x.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/misc/drivers/rtl8187x/rtl8187x.c b/misc/drivers/rtl8187x/rtl8187x.c index 437d2d62b..2016bd17f 100755 --- a/misc/drivers/rtl8187x/rtl8187x.c +++ b/misc/drivers/rtl8187x/rtl8187x.c @@ -4011,12 +4011,7 @@ static int rtl8187x_setup(FAR struct rtl8187x_state_s *priv) usleep(10); rtl8187x_eeprom_multiread(priv, RTL8187X_EEPROM_MACADDR, permaddr, 3); - - udbg("%.4x%.4x%.4x", permaddr[0], permaddr[1], permaddr[2]); - -#define RTL8187X_EEPROM_TXPWRCHAN1 0x16 /* 3 channels */ -#define RTL8187X_EEPROM_TXPWRCHAN6 0x1b /* 2 channels */ -#define RTL8187X_EEPROM_TXPWRCHAN4 0x3d /* 2 channels */ + udbg("MAC address: %04x.%04x.%04x", permaddr[0], permaddr[1], permaddr[2]); channel = priv->channels; for (i = 0; i < 3; i++) @@ -4084,9 +4079,22 @@ static int rtl8187x_setup(FAR struct rtl8187x_state_s *priv) } rtl8187x_write(priv, 0, 0x0b7); + + /* Save the MAC address in the device structure */ + + priv->ethdev.d_mac.ether_addr_octet[0] = permaddr[0] & 0xff; + priv->ethdev.d_mac.ether_addr_octet[1] = permaddr[0] >> 8; + priv->ethdev.d_mac.ether_addr_octet[2] = permaddr[1] & 0xff; + priv->ethdev.d_mac.ether_addr_octet[3] = permaddr[1] >> 8; + priv->ethdev.d_mac.ether_addr_octet[4] = permaddr[2] & 0xff; + priv->ethdev.d_mac.ether_addr_octet[5] = permaddr[2] >> 8; + + /* Provide information about the RTL device */ - udbg("hwaddr %.4x%.4x%.4x, rtl8187 V%d + %s\n", - permaddr[0], permaddr[1], permaddr[2], + udbg("hwaddr %02x.%02x.%02x.%02x.%02x.%02x, rtl8187 V%d + %s\n", + priv->ethdev.d_mac.ether_addr_octet[0], priv->ethdev.d_mac.ether_addr_octet[1], + priv->ethdev.d_mac.ether_addr_octet[2], priv->ethdev.d_mac.ether_addr_octet[3], + priv->ethdev.d_mac.ether_addr_octet[4], priv->ethdev.d_mac.ether_addr_octet[5], priv->asicrev, priv->rfinit == rtl8225_rfinit ? "rtl8225" : "rtl8225z2"); |