summaryrefslogtreecommitdiff
path: root/include/system.h
diff options
context:
space:
mode:
authorCaveh Jalali <caveh@chromium.org>2019-10-10 19:26:23 -0700
committerCommit Bot <commit-bot@chromium.org>2019-10-31 03:16:47 +0000
commit0038f1e0dfd6738d71e07de60a0240e449d3f787 (patch)
tree357a4fbc1a0b1342488e950988f0fde0a885df30 /include/system.h
parentb64ff5df1f93d5233cc257d08e451d71c5522d11 (diff)
downloadchrome-ec-0038f1e0dfd6738d71e07de60a0240e449d3f787.tar.gz
system.c: reset statics for testing
this adds a function to reset the state information generated by system_common_pre_init() for testing scenarios that need to call it multiple times. on the EC, main memory (.data + .bss) is reinitialized across sysjumps, so this happens automatically, but we can't really do that from unit tests. so, add a function to reset the relevant static variables to emulate main memory getting reinitialized. BRANCH=none BUG=b:142031466 TEST=make buildall passes Change-Id: I1f65902c21ab6fc17c32388795cfef19c84d8cc8 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1855644 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'include/system.h')
-rw-r--r--include/system.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/system.h b/include/system.h
index 9b6bf0ff48..0d785c6899 100644
--- a/include/system.h
+++ b/include/system.h
@@ -49,6 +49,13 @@ void system_pre_init(void);
void system_common_pre_init(void);
/**
+ * System common re-initialization; called to reset persistent state
+ * left by system_common_pre_init(). This is useful for testing
+ * scenarios calling system_common_pre_init() multiple times.
+ */
+__test_only void system_common_reset_state(void);
+
+/**
* Set up flags that should be saved to battery backed RAM.
*
* @param reset_flags - flags passed into system_reset