diff mbox series

[v3,16/20] mcdstub: function construct for resets added

Message ID 20231107130323.4126-17-nicolas.eder@lauterbach.com
State New
Headers show
Series first version of mcdstub | expand

Commit Message

nicolas.eder@lauterbach.com Nov. 7, 2023, 1:03 p.m. UTC
---
 include/mcdstub/mcdstub.h |  8 ++++++++
 mcdstub/mcdstub.c         | 18 ++++++++++++++++++
 2 files changed, 26 insertions(+)
diff mbox series

Patch

diff --git a/include/mcdstub/mcdstub.h b/include/mcdstub/mcdstub.h
index 0375cf7311..000d832a39 100644
--- a/include/mcdstub/mcdstub.h
+++ b/include/mcdstub/mcdstub.h
@@ -672,6 +672,14 @@  void handle_query_regs_c(GArray *params, void *user_ctx);
  */
 void handle_open_server(GArray *params, void *user_ctx);
 
+/**
+ * handle_reset() - Handler for performing resets.
+ *
+ * This function is currently not in use.
+ * @params: GArray with all TCP packet parameters.
+ */
+void handle_reset(GArray *params, void *user_ctx);
+
 /**
  * handle_query_state() - Handler for the state query.
  *
diff --git a/mcdstub/mcdstub.c b/mcdstub/mcdstub.c
index 6313459bac..1a10bc6c98 100644
--- a/mcdstub/mcdstub.c
+++ b/mcdstub/mcdstub.c
@@ -511,6 +511,16 @@  int mcd_handle_packet(const char *line_buf)
             cmd_parser = &close_core_cmd_desc;
         }
         break;
+    case TCP_CHAR_RESET:
+        {
+            static MCDCmdParseEntry reset_cmd_desc = {
+                .handler = handle_reset,
+            };
+            reset_cmd_desc.cmd = (char[2]) { TCP_CHAR_RESET, '\0' };
+            strcpy(reset_cmd_desc.schema, (char[2]) { ARG_SCHEMA_INT, '\0' });
+            cmd_parser = &reset_cmd_desc;
+        }
+        break;
     default:
         /* command not supported */
         mcd_put_packet("");
@@ -1568,6 +1578,14 @@  void handle_query_regs_c(GArray *params, void *user_ctx)
     mcd_put_strbuf();
 }
 
+void handle_reset(GArray *params, void *user_ctx)
+{
+    /*
+     * int reset_id = get_param(params, 0)->data_int;
+     * TODO: implement resets
+     */
+}
+
 void handle_query_state(GArray *params, void *user_ctx)
 {
     /*