mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 19:36:35 +08:00
drivers/net: make sure that net driver d_buf is 16-bit aligned
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
committed by
Xiang Xiao
parent
93584f8668
commit
b3cd9090d1
+14
-10
@@ -175,6 +175,10 @@
|
||||
#define enc_bfsgreg(priv,ctrlreg,setbits) \
|
||||
enc_wrgreg2(priv, ENC_BFS | GETADDR(ctrlreg), setbits)
|
||||
|
||||
/* Packet buffer size */
|
||||
|
||||
#define PKTBUF_SIZE (MAX_NETDEV_PKTSIZE + CONFIG_NET_GUARDSIZE)
|
||||
|
||||
/* This is a helper pointer for accessing the contents of Ethernet header */
|
||||
|
||||
#define BUF ((FAR struct eth_hdr_s *)priv->dev.d_buf)
|
||||
@@ -250,7 +254,7 @@ struct enc_driver_s
|
||||
|
||||
/* A single packet buffer is used */
|
||||
|
||||
static uint8_t g_pktbuf[MAX_NETDEV_PKTSIZE + CONFIG_NET_GUARDSIZE];
|
||||
static uint16_t g_pktbuf[CONFIG_ENC28J60_NINTERFACES][(PKTBUF_SIZE + 1) / 2];
|
||||
|
||||
/* Driver status structure */
|
||||
|
||||
@@ -2528,17 +2532,17 @@ int enc_initialize(FAR struct spi_dev_s *spi,
|
||||
memset(g_enc28j60, 0,
|
||||
CONFIG_ENC28J60_NINTERFACES * sizeof(struct enc_driver_s));
|
||||
|
||||
priv->dev.d_buf = g_pktbuf; /* Single packet buffer */
|
||||
priv->dev.d_ifup = enc_ifup; /* I/F down callback */
|
||||
priv->dev.d_ifdown = enc_ifdown; /* I/F up (new IP address) callback */
|
||||
priv->dev.d_txavail = enc_txavail; /* New TX data callback */
|
||||
priv->dev.d_buf = (FAR uint8_t *)g_pktbuf[devno]; /* Single packet buffer */
|
||||
priv->dev.d_ifup = enc_ifup; /* I/F down callback */
|
||||
priv->dev.d_ifdown = enc_ifdown; /* I/F up (new IP address) callback */
|
||||
priv->dev.d_txavail = enc_txavail; /* New TX data callback */
|
||||
#ifdef CONFIG_NET_MCASTGROUP
|
||||
priv->dev.d_addmac = enc_addmac; /* Add multicast MAC address */
|
||||
priv->dev.d_rmmac = enc_rmmac; /* Remove multicast MAC address */
|
||||
priv->dev.d_addmac = enc_addmac; /* Add multicast MAC address */
|
||||
priv->dev.d_rmmac = enc_rmmac; /* Remove multicast MAC address */
|
||||
#endif
|
||||
priv->dev.d_private = priv; /* Used to recover private state from dev */
|
||||
priv->spi = spi; /* Save the SPI instance */
|
||||
priv->lower = lower; /* Save the low-level MCU interface */
|
||||
priv->dev.d_private = priv; /* Used to recover private state from dev */
|
||||
priv->spi = spi; /* Save the SPI instance */
|
||||
priv->lower = lower; /* Save the low-level MCU interface */
|
||||
|
||||
/* The interface should be in the down state. However, this function is
|
||||
* called too early in initialization to perform the ENC28J60 reset in
|
||||
|
||||
Reference in New Issue
Block a user