examples/nxscope: add UDP interface

add UDP interface for examples/nxscope

Signed-off-by: raiden00pl <raiden00@railab.me>
diff --git a/examples/nxscope/Kconfig b/examples/nxscope/Kconfig
index b29f97f..49d36f2 100644
--- a/examples/nxscope/Kconfig
+++ b/examples/nxscope/Kconfig
@@ -43,6 +43,15 @@
 
 endif # LOGGING_NXSCOPE_INTF_SERIAL
 
+if LOGGING_NXSCOPE_INTF_UDP
+
+config EXAMPLES_NXSCOPE_UDP_PORT
+	int "nxscope UDP local port"
+	default 50000
+	range 1 65535
+
+endif # LOGGING_NXSCOPE_INTF_UDP
+
 config EXAMPLES_NXSCOPE_FORCE_ENABLE
 	bool "nxscope force enable"
 	default n
diff --git a/examples/nxscope/nxscope_main.c b/examples/nxscope/nxscope_main.c
index b2311a7..5d5102e 100644
--- a/examples/nxscope/nxscope_main.c
+++ b/examples/nxscope/nxscope_main.c
@@ -431,6 +431,9 @@
 #ifdef CONFIG_LOGGING_NXSCOPE_INTF_SERIAL
   struct nxscope_ser_cfg_s    nxs_ser_cfg;
 #endif
+#ifdef CONFIG_LOGGING_NXSCOPE_INTF_UDP
+  struct nxscope_udp_cfg_s    nxs_udp_cfg;
+#endif
 #ifdef CONFIG_LOGGING_NXSCOPE_INTF_DUMMY
   struct nxscope_dummy_cfg_s  nxs_dummy_cfg;
 #endif
@@ -484,6 +487,22 @@
     }
 #endif
 
+#ifdef CONFIG_LOGGING_NXSCOPE_INTF_UDP
+  /* Configuration */
+
+  nxs_udp_cfg.port     = CONFIG_EXAMPLES_NXSCOPE_UDP_PORT;
+  nxs_udp_cfg.nonblock = true;
+
+  /* Initialize UDP interface */
+
+  ret = nxscope_udp_init(&intf, &nxs_udp_cfg);
+  if (ret < 0)
+    {
+      printf("ERROR: nxscope_udp_init failed %d\n", ret);
+      goto errout_nointf;
+    }
+#endif
+
 #ifdef CONFIG_LOGGING_NXSCOPE_INTF_DUMMY
   /* Configuration */
 
@@ -733,6 +752,9 @@
 #if defined(CONFIG_LOGGING_NXSCOPE_INTF_SERIAL)
   nxscope_ser_deinit(&intf);
 #endif
+#if defined(CONFIG_LOGGING_NXSCOPE_INTF_UDP)
+  nxscope_udp_deinit(&intf);
+#endif
 #if defined(CONFIG_LOGGING_NXSCOPE_INTF_DUMMY)
   nxscope_dummy_deinit(&intf);
 #endif