From 5d162bbb203502516b92934b78316b874c20d176 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Tue, 1 Oct 2024 14:24:39 +0200 Subject: [PATCH] tftp: implement support for LED activity Implement support for LED activity. If the feature is enabled, make the defined ACTIVITY LED to signal traffic. Also turn the ACTIVITY LED OFF if a CTRL-C is detected in the main net loop function. Signed-off-by: Christian Marangi Reviewed-by: Simon Glass --- net/net.c | 4 ++++ net/tftp.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/net/net.c b/net/net.c index 1e0b7c8562..bc16f0d0ce 100644 --- a/net/net.c +++ b/net/net.c @@ -87,6 +87,7 @@ #include #include #include +#include #include #include #include @@ -664,6 +665,9 @@ restart: /* Invalidate the last protocol */ eth_set_last_protocol(BOOTP); + /* Turn off activity LED if triggered */ + led_activity_off(); + puts("\nAbort\n"); /* include a debug print as well incase the debug messages are directed to stderr */ diff --git a/net/tftp.c b/net/tftp.c index d6744bc24e..704b20b4ff 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -185,6 +186,7 @@ static void new_transfer(void) #ifdef CONFIG_CMD_TFTPPUT tftp_put_final_block_sent = 0; #endif + led_activity_blink(); } #ifdef CONFIG_CMD_TFTPPUT @@ -294,6 +296,9 @@ static void tftp_complete(void) time_start * 1000, "/s"); } puts("\ndone\n"); + + led_activity_off(); + if (!tftp_put_active) efi_set_bootdev("Net", "", tftp_filename, map_sysmem(tftp_load_addr, 0), -- 2.39.5