mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-28 12:30:58 +00:00
Refactor MIP strategy and first driver (CMSIS)
This commit is contained in:
1 parent
6f697db49d
commit
dceb4beb09
11 files changed
+108
-108
No files matched your search
+13
-4
@@ -40,10 +40,6 @@ static bool cmsis_init(struct mg_tcpip_if *ifp) {
|
||||
memcpy(&addr, ifp->mac, sizeof(addr));
|
||||
mac->SetMacAddress(&addr);
|
||||
}
|
||||
#if MG_TCPIP_MCAST
|
||||
memcpy(&addr, mcast_addr, sizeof(addr));
|
||||
mac->SetAddressFilter(&addr, 1);
|
||||
#endif
|
||||
phy->PowerControl(ARM_POWER_FULL);
|
||||
phy->SetInterface(cap.media_interface);
|
||||
phy->SetMode(ARM_ETH_PHY_AUTO_NEGOTIATE);
|
||||
@@ -60,7 +56,20 @@ static size_t cmsis_tx(const void *buf, size_t len, struct mg_tcpip_if *ifp) {
|
||||
return len;
|
||||
}
|
||||
|
||||
static void cmsis_update_hash_table(struct mg_tcpip_if *ifp) {
|
||||
// TODO(): read database, rebuild hash table
|
||||
ARM_DRIVER_ETH_MAC *mac = &Driver_ETH_MAC0;
|
||||
ARM_ETH_MAC_ADDR addr;
|
||||
memcpy(&addr, mcast_addr, sizeof(addr));
|
||||
mac->SetAddressFilter(&addr, 1);
|
||||
(void) ifp;
|
||||
}
|
||||
|
||||
static bool cmsis_poll(struct mg_tcpip_if *ifp, bool s1) {
|
||||
if (ifp->update_mac_hash_table) {
|
||||
cmsis_update_hash_table(ifp);
|
||||
ifp->update_mac_hash_table = false;
|
||||
}
|
||||
if (!s1) return false;
|
||||
ARM_DRIVER_ETH_PHY *phy = &Driver_ETH_PHY0;
|
||||
ARM_DRIVER_ETH_MAC *mac = &Driver_ETH_MAC0;
|
||||
|
||||
Reference in new issue
Block a user