修改30ms喂狗,解决初始化超时问题

This commit is contained in:
2025-11-16 22:13:17 +08:00
parent 7dc1e89694
commit 9af585b664
9 changed files with 1243 additions and 1237 deletions

View File

@@ -22,6 +22,8 @@
#include "sdrv_eth.h"
#include "phy/phy.h"
#include <wdt_refresh.h>
/* Eth frame header and crc length. */
#define ETH_FRAME_HEADER_LEN (6 + 6 + 2)
#define ETH_FRAME_OVERHEAD_LEN (ETH_FRAME_HEADER_LEN + 4)
@@ -171,17 +173,18 @@ static void eth_mac_init(dwc_eth_config_t *cfg, struct eqos_priv *eqos)
uint32_t skip_len = eqos->desc_size - sizeof(struct eqos_desc);
uint8_t bus_width = cfg->dma_bus_width ? cfg->dma_bus_width : 64;
eqos->dsl = skip_len * 8 / bus_width;
//DMA init
mac_init_dma(cfg->base, eqos);
//MTL init
mac_init_mtl(cfg->base);
//core init
phy_speed_t speed = (cfg->phy[0].phy_addr == ~0) ?
PHY_SPEED_1000 : cfg->phy[0].speed;
dwmac_core_init(cfg->base, cfg->mtu, speed, cfg->mac_addr);
dwmac_mac_rx_queue_mcbc_routing(cfg->base, 0);
}
@@ -282,14 +285,13 @@ static err_t dwc_eth_init(struct net_driver_s *dev)
#endif
ASSERT(eqos->rx_dma_buf);
memset(eqos->rx_dma_buf, 0, EQOS_RX_BUFFER_SIZE);
#endif
#endif
//init phy
phy_init(&eth_dev->phy_bus);
//init mac
eth_mac_init(cfg, eqos);
// set up dma tx/rx descriptors
memset(eqos->descs, 0, eqos->desc_size * EQOS_DESCRIPTORS_NUM);
@@ -307,7 +309,7 @@ static err_t dwc_eth_init(struct net_driver_s *dev)
arch_clean_cache_range((addr_t)rx_desc, sizeof(struct eqos_desc));
arch_invalidate_cache_range((addr_t)((char *)eqos->rx_dma_buf +
(i * EQOS_MAX_PACKET_SIZE)), EQOS_MAX_PACKET_SIZE);
}
}
//enable rx/tx
mac_start(cfg->base, true);
@@ -773,10 +775,11 @@ int dwc_eth_probe(struct net_driver_s *dev, dwc_eth_config_t *cfg)
for (int i = 0; cfg->phy[i].phy_addr != ~0; i++) {
phy_dev_register(&dw_eth_dev->phy_bus, &cfg->phy[i]);
}
int ret = netdev_register(dev, NET_LL_ETHERNET);
irq_attach(cfg->irq_num, dwc_eth_irq_handler, dev);
irq_enable(cfg->irq_num);
return ret;

File diff suppressed because it is too large Load Diff