summary refs log tree commit diff stats
path: root/include/hw/resettable.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/hw/resettable.h')
-rw-r--r--include/hw/resettable.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/hw/resettable.h b/include/hw/resettable.h
index 96073354fd..5e215d94e4 100644
--- a/include/hw/resettable.h
+++ b/include/hw/resettable.h
@@ -154,6 +154,17 @@ struct ResettableState {
 };
 
 /**
+ * resettable_state_clear:
+ * Clear the state. It puts the state to the initial (zeroed) state required
+ * to reuse an object. Typically used in realize step of base classes
+ * implementing the interface.
+ */
+static inline void resettable_state_clear(ResettableState *state)
+{
+    memset(state, 0, sizeof(ResettableState));
+}
+
+/**
  * resettable_reset:
  * Trigger a reset on an object @obj of type @type. @obj must implement
  * Resettable interface.