mirror of
https://github.com/apache/nuttx.git
synced 2026-06-08 01:42:58 +08:00
RX65N Ethernet pre-check warnings resolved
This commit is contained in:
@@ -526,9 +526,6 @@ static int rx65n_phyinit(FAR struct rx65n_ethmac_s *priv);
|
||||
static int rx65n_ethreset(FAR struct rx65n_ethmac_s *priv);
|
||||
static int rx65n_macconfig(FAR struct rx65n_ethmac_s *priv);
|
||||
static void rx65n_macaddress(FAR struct rx65n_ethmac_s *priv);
|
||||
#ifdef CONFIG_NET_ICMPv6
|
||||
static void rx65n_ipv6multicast(FAR struct rx65n_ethmac_s *priv);
|
||||
#endif
|
||||
static int rx65n_ethconfig(FAR struct rx65n_ethmac_s *priv);
|
||||
|
||||
static void rx65n_phy_preamble (void);
|
||||
@@ -2388,51 +2385,6 @@ static int rx65n_txavail(struct net_driver_s *dev)
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Function: rx65n_calcethcrc
|
||||
*
|
||||
* Description:
|
||||
* Function to calculate the CRC used by RX65N to check an ethernet frame
|
||||
*
|
||||
* Input Parameters:
|
||||
* data - the data to be checked
|
||||
* length - length of the data
|
||||
*
|
||||
* Returned Value:
|
||||
* None
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#if defined(CONFIG_NET_MCASTGROUP) || defined(CONFIG_NET_ICMPv6)
|
||||
static uint32_t rx65n_calcethcrc(const uint8_t *data, size_t length)
|
||||
{
|
||||
uint32_t crc = 0xffffffff;
|
||||
size_t i;
|
||||
int j;
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
for (j = 0; j < 8; j++)
|
||||
{
|
||||
if (((crc >> 31) ^ (data[i] >> j)) & 0x01)
|
||||
{
|
||||
/* x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1 */
|
||||
|
||||
crc = (crc << 1) ^ 0x04c11db7;
|
||||
}
|
||||
else
|
||||
{
|
||||
crc = crc << 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ~crc;
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Function: rx65n_addmac
|
||||
*
|
||||
@@ -2454,20 +2406,9 @@ static uint32_t rx65n_calcethcrc(const uint8_t *data, size_t length)
|
||||
#if defined(CONFIG_NET_MCASTGROUP) || defined(CONFIG_NET_ICMPv6)
|
||||
static int rx65n_addmac(struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||
{
|
||||
uint32_t regval;
|
||||
uint32_t crc;
|
||||
uint32_t hashindex;
|
||||
uint32_t temp;
|
||||
uint32_t registeraddress;
|
||||
regval = 0;
|
||||
|
||||
ninfo("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
|
||||
crc = rx65n_calcethcrc(mac, 6);
|
||||
|
||||
hashindex = (crc >> 26) & 0x3f;
|
||||
|
||||
/* RX65N do not support add on mac multi cast feature because related
|
||||
* hash table mac multi cast register is not supported in RX65N.
|
||||
*/
|
||||
@@ -2498,20 +2439,9 @@ static int rx65n_addmac(struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||
#ifdef CONFIG_NET_MCASTGROUP
|
||||
static int rx65n_rmmac(struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||
{
|
||||
uint32_t crc;
|
||||
uint32_t hashindex;
|
||||
uint32_t temp;
|
||||
uint32_t registeraddress;
|
||||
|
||||
ninfo("MAC: %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
|
||||
/* Remove the MAC address to the hardware multicast hash table */
|
||||
|
||||
crc = rx65n_calcethcrc(mac, 6);
|
||||
|
||||
hashindex = (crc >> 26) & 0x3f;
|
||||
|
||||
/* RX65N do not support add on mac multi cast feature because related
|
||||
* hash table multi cast mac register not available. This function is
|
||||
* not need to implement.
|
||||
@@ -3784,15 +3714,6 @@ static int rx65n_macconfig(FAR struct rx65n_ethmac_s *priv)
|
||||
|
||||
rx65n_macaddress(priv);
|
||||
|
||||
#ifdef CONFIG_NET_ICMPv6
|
||||
/* Set up the IPv6 multicast address */
|
||||
|
||||
/* Not supported So commented */
|
||||
|
||||
/* rx65n_ipv6multicast(priv); */
|
||||
|
||||
#endif
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -3843,80 +3764,6 @@ static void rx65n_macaddress(FAR struct rx65n_ethmac_s *priv)
|
||||
rx65n_putreg(regval, RX65N_ETH_MALR);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Function: rx65n_ipv6multicast
|
||||
*
|
||||
* Description:
|
||||
* Configure the IPv6 multicast MAC address.
|
||||
*
|
||||
* Input Parameters:
|
||||
* priv - A reference to the private driver state structure
|
||||
*
|
||||
* Returned Value:
|
||||
* OK on success; Negated errno on failure.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_ICMPv6
|
||||
static void rx65n_ipv6multicast(FAR struct rx65n_ethmac_s *priv)
|
||||
{
|
||||
struct net_driver_s *dev;
|
||||
uint16_t tmp16;
|
||||
uint8_t mac[6];
|
||||
|
||||
/* For ICMPv6, we need to add the IPv6 multicast address
|
||||
*
|
||||
* For IPv6 multicast addresses, the Ethernet MAC is derived by
|
||||
* the four low-order octets OR'ed with the MAC 33:33:00:00:00:00,
|
||||
* so for example the IPv6 address FF02:DEAD:BEEF::1:3 would map
|
||||
* to the Ethernet MAC address 33:33:00:01:00:03.
|
||||
*
|
||||
* NOTES: This appears correct for the ICMPv6 Router Solicitation
|
||||
* Message, but the ICMPv6 Neighbor Solicitation message seems to
|
||||
* use 33:33:ff:01:00:03.
|
||||
*/
|
||||
|
||||
mac[0] = 0x33;
|
||||
mac[1] = 0x33;
|
||||
|
||||
dev = &priv->dev;
|
||||
tmp16 = dev->d_ipv6addr[6];
|
||||
mac[2] = 0xff;
|
||||
mac[3] = tmp16 >> 8;
|
||||
|
||||
tmp16 = dev->d_ipv6addr[7];
|
||||
mac[4] = tmp16 & 0xff;
|
||||
mac[5] = tmp16 >> 8;
|
||||
|
||||
ninfo("IPv6 Multicast: %02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
|
||||
(void)rx65n_addmac(dev, mac);
|
||||
|
||||
#ifdef CONFIG_NET_ICMPv6_AUTOCONF
|
||||
/* Add the IPv6 all link-local nodes Ethernet address. This is the
|
||||
* address that we expect to receive ICMPv6 Router Advertisement
|
||||
* packets.
|
||||
*/
|
||||
|
||||
(void)rx65n_addmac(dev, g_ipv6_ethallnodes.ether_addr_octet);
|
||||
|
||||
#endif /* CONFIG_NET_ICMPv6_AUTOCONF */
|
||||
#ifdef CONFIG_NET_ICMPv6_ROUTER
|
||||
/* Add the IPv6 all link-local routers Ethernet address. This is the
|
||||
* address that we expect to receive ICMPv6 Router Solicitation
|
||||
* packets.
|
||||
*/
|
||||
|
||||
(void)rx65n_addmac(dev, g_ipv6_ethallrouters.ether_addr_octet);
|
||||
|
||||
#endif /* CONFIG_NET_ICMPv6_ROUTER */
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NET_ICMPv6 */
|
||||
|
||||
/****************************************************************************
|
||||
* Function: rx65n_ethconfig
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user