remove PHY_TX/RX

This commit is contained in:
Sergio R. Caprile committed 2026-11-30 12:31:16 -03:00
1 parent 3322a119eb
commit 3d116475af
5 files changed
+17 -36

No files matched your search

@@ -8,31 +8,27 @@
#define LED_LAN PIN(0, 0) // Blue, active low
#define LED_RED PIN(0, 1) // Red, active low
static uint64_t s_radio_led_until;
// Cumulative totals. Up: radio -> LAN; down: LAN -> radio queue.
static uint64_t s_frames_up, s_frames_down, s_bytes_up, s_bytes_down;
static uint64_t s_radio_sent, s_radio_received;
// Radio interface events: count radio frames, blink on reception
static void radio_fn(struct mg_tcpip_if *ifp, int ev, void *ev_data) {
if (ev == MG_TCPIP_EV_PHY_TX) s_radio_sent++;
if (ev == MG_TCPIP_EV_PHY_RX) {
s_radio_received++;
s_radio_led_until = mg_millis() + 2;
}
(void) ifp, (void) ev_data;
}
// Radio activity: successful frames crossing the bridge keep the LED on.
static uint64_t s_radio_led_until;
static size_t eth_up(const void *buf, size_t len, struct mg_tcpip_if *ifp) {
size_t sent = mg_tcpip_driver_rw612.tx(buf, len, ifp);
if (sent != 0) s_frames_up++, s_bytes_up += sent;
if (sent != 0) {
s_frames_up++, s_bytes_up += sent;
s_radio_led_until = mg_millis() + 2;
}
return sent;
}
static size_t eth_down(const void *buf, size_t len, struct mg_tcpip_if *ifp) {
size_t queued = mg_tcpip_driver_rw612w.tx(buf, len, ifp);
if (queued != 0) s_frames_down++, s_bytes_down += queued;
if (queued != 0) {
s_frames_down++, s_bytes_down += queued;
s_radio_led_until = mg_millis() + 2;
}
return queued;
}
@@ -66,7 +62,6 @@ int main(void) {
radio_driver = mg_tcpip_driver_rw612w;
radio_driver.tx = eth_down;
radio.driver = &radio_driver;
radio.fn = radio_fn;
if (!radio.driver->init(&radio)) return 1;
eth_data.mdc_cr = MG_DRIVER_MDC_CR;
@@ -95,9 +90,8 @@ int main(void) {
if (mg_timer_expired(&stats_timer, 5000, now)) {
MG_INFO(
("ETH frames up/down %llu/%llu, bytes up/down "
"%llu/%llu, radio frames sent/rcvd %llu/%llu",
s_frames_up, s_frames_down, s_bytes_up, s_bytes_down, s_radio_sent,
s_radio_received));
"%llu/%llu",
s_frames_up, s_frames_down, s_bytes_up, s_bytes_down));
}
if (eth.nrecv != lan_received) {
lan_received = eth.nrecv;