mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-26 12:14:56 +00:00
refactor the rest of the drivers
This commit is contained in:
1 parent
dceb4beb09
commit
1d2a768184
17 files changed
+393
-301
No files matched your search
+14
-9
@@ -124,15 +124,6 @@ static bool mg_tcpip_driver_same54_init(struct mg_tcpip_if *ifp) {
|
||||
MG_U32(ifp->mac[3], ifp->mac[2], ifp->mac[1], ifp->mac[0]);
|
||||
GMAC_REGS->SA[0].GMAC_SAT = MG_U32(0, 0, ifp->mac[5], ifp->mac[4]);
|
||||
|
||||
#if MG_TCPIP_MCAST
|
||||
// Setting Hash Index for 01:00:5e:00:00:fb (multicast)
|
||||
// 24.6.9 Hash addressing
|
||||
// computed hash is 55, which means bit 23 (55 - 32) in
|
||||
// HRT register must be set
|
||||
GMAC_REGS->GMAC_HRT = MG_BIT(23);
|
||||
GMAC_REGS->GMAC_NCFGR |= MG_BIT(6); // enable multicast hash filtering
|
||||
#endif
|
||||
|
||||
GMAC_REGS->GMAC_UR &= ~GMAC_UR_MII_Msk; // Disable MII, use RMII
|
||||
GMAC_REGS->GMAC_NCFGR |= GMAC_NCFGR_MAXFS_Msk | GMAC_NCFGR_MTIHEN_Msk |
|
||||
GMAC_NCFGR_EFRHD_Msk | GMAC_NCFGR_CAF_Msk;
|
||||
@@ -174,7 +165,21 @@ static size_t mg_tcpip_driver_same54_tx(const void *buf, size_t len,
|
||||
return len;
|
||||
}
|
||||
|
||||
static mg_tcpip_driver_same54_update_hash_table(struct mg_tcpip_if *ifp) {
|
||||
// TODO(): read database, rebuild hash table
|
||||
// Setting Hash Index for 01:00:5e:00:00:fb (multicast)
|
||||
// 24.6.9 Hash addressing
|
||||
// computed hash is 55, which means bit 23 (55 - 32) in
|
||||
// HRT register must be set
|
||||
GMAC_REGS->GMAC_HRT = MG_BIT(23);
|
||||
GMAC_REGS->GMAC_NCFGR |= MG_BIT(6); // enable multicast hash filtering
|
||||
}
|
||||
|
||||
static bool mg_tcpip_driver_same54_poll(struct mg_tcpip_if *ifp, bool s1) {
|
||||
if (ifp->update_mac_hash_table) {
|
||||
mg_tcpip_driver_same54_update_hash_table(ifp);
|
||||
ifp->update_mac_hash_table = false;
|
||||
}
|
||||
if (s1) {
|
||||
uint16_t bsr = eth_read_phy(MG_PHY_ADDR, MG_PHYREG_BSR);
|
||||
bool up = bsr & MG_PHYREGBIT_BSR_LINK_STATUS ? 1 : 0;
|
||||
|
||||
Reference in new issue
Block a user