Refactor MIP strategy and first driver (CMSIS)

This commit is contained in:
Sergio R. Caprile committed 2025-04-22 12:55:21 -03:00
1 parent 6f697db49d
commit dceb4beb09
11 files changed
+108 -108

No files matched your search

+13 -4
View File
@@ -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;
+5 -4
View File
@@ -784,10 +784,6 @@ static bool cyw_init(uint8_t *mac) {
MG_ERROR(("read MAC failed"));
}
}
#if MG_TCPIP_MCAST
val = 1; if (!cyw_ioctl_iovar_set2_(0, "mcast_list", (uint8_t *)&val, sizeof(val), (uint8_t *)mcast_addr, sizeof(mcast_addr))) return false;
mg_delayms(50);
#endif
return true;
}
// clang-format on
@@ -1188,4 +1184,9 @@ bool mg_wifi_ap_stop(void) {
return cyw_wifi_ap_stop();
}
void mg_tcpip_driver_multicast_add(const uint8_t mcast_addr) {
val = 1; cyw_ioctl_iovar_set2_(0, "mcast_list", (uint8_t *)&val, sizeof(val), (uint8_t *)mcast_addr, sizeof(mcast_addr));
//mg_delayms(50);
}
#endif
+1 -1
View File
@@ -152,7 +152,7 @@ static bool mg_tcpip_driver_stm32f_init(struct mg_tcpip_if *ifp) {
ETH->MACA0LR = (uint32_t) (ifp->mac[3] << 24) |
((uint32_t) ifp->mac[2] << 16) |
((uint32_t) ifp->mac[1] << 8) | ifp->mac[0];
#if MG_TCPIP_MCAST
#if 0 //MG_TCPIP_MCAST
// enable multicast
ETH->MACA1LR = (uint32_t) mcast_addr[3] << 24 |
(uint32_t) mcast_addr[2] << 16 |