summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2025-01-22 20:50:16 +0100
committerxengineering <me@xengineering.eu>2025-01-22 20:50:16 +0100
commite0ddbf7a09fdf8277a64f27b484c3642e32d7a99 (patch)
tree6d43198ae18e842eaf7791f3562f9988616ce282
parentf4a0606e80582b4bbfc70451dbd21ef20ed50b7b (diff)
downloadsoundbox-e0ddbf7a09fdf8277a64f27b484c3642e32d7a99.tar
soundbox-e0ddbf7a09fdf8277a64f27b484c3642e32d7a99.tar.zst
soundbox-e0ddbf7a09fdf8277a64f27b484c3642e32d7a99.zip
fw: Implement print out of MAC address
This validates that a hardware MAC address is available on the chip. Based on that it can be decided if a MAC EEPROM should be added to the PCB.
-rw-r--r--fw/src/main.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/fw/src/main.c b/fw/src/main.c
index 31dbf45..a21e6d7 100644
--- a/fw/src/main.c
+++ b/fw/src/main.c
@@ -1,4 +1,35 @@
+#include <zephyr/logging/log.h>
+#include <zephyr/net/net_if.h>
+
+LOG_MODULE_REGISTER(main);
+
int main(void)
{
+ LOG_INF("Function main was started.");
+
+ struct net_if *iface = net_if_get_default();
+ if (iface == NULL) {
+ LOG_ERR("Could not find default network interface.");
+ goto FINISH;
+ }
+ LOG_DBG("Got default network interface pointer 0x%p", (void *)iface);
+
+ struct net_linkaddr *link_addr = net_if_get_link_addr(iface);
+ if (iface == NULL) {
+ LOG_ERR("Could not determine link address of default network interface.");
+ goto FINISH;
+ }
+ LOG_INF(
+ "Got link address of default network interface: %02x:%02x:%02x:%02x:%02x:%02x",
+ link_addr->addr[0],
+ link_addr->addr[1],
+ link_addr->addr[2],
+ link_addr->addr[3],
+ link_addr->addr[4],
+ link_addr->addr[5]
+ );
+
+FINISH:
+ LOG_INF("Function main was finished.");
return 0;
}