aboutsummaryrefslogtreecommitdiff
path: root/debugger/include
diff options
context:
space:
mode:
authorTarek El-Sherbiny <tarek.el-sherbiny@arm.com>2020-01-07 17:28:00 +0000
committerjimqui01 <54316584+jimqui01@users.noreply.github.com>2020-03-23 14:22:21 +0000
commit15a6a3a3cfcdae0e44277291577b9ff20844de5c (patch)
treed93176191859dc6ef1cc8f66d9a6c29243f021ad /debugger/include
parent21a82b3ca14251d049e7b6580649ca55bb253fc6 (diff)
dbg: Add checkpoint implementation
This patch adds the main checkpoint APIs Change-Id: I73efaba8a5e95286abf961d2f0fb395dfec69d59 Signed-off-by: Tarek El-Sherbiny <tarek.el-sherbiny@arm.com>
Diffstat (limited to 'debugger/include')
-rw-r--r--debugger/include/checkpoint.h109
1 files changed, 109 insertions, 0 deletions
diff --git a/debugger/include/checkpoint.h b/debugger/include/checkpoint.h
new file mode 100644
index 00000000..b913f5b0
--- /dev/null
+++ b/debugger/include/checkpoint.h
@@ -0,0 +1,109 @@
+/*
+ * Arm SCP/MCP Software
+ * Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+#ifndef CHECKPOINT_H
+#define CHECKPOINT_H
+
+#include <stdint.h>
+
+/*!
+ * \addtogroup GroupCLIDebugger
+ * @{
+ */
+
+/*!
+ * Length of checkpoint thread names.
+ *
+ */
+#define CHECKPOINT_NAME_LEN 16
+
+/*!
+ * Length of checkpoint tags.
+ *
+ */
+#define CHECKPOINT_TAG_LEN 32
+
+/*!
+ * \brief Checkpoint bypass value.
+ *
+ */
+enum cp_bypass_value {
+ /*! Stop execution when checkpoint is reached. */
+ CHECKPOINT_ENABLED = 0,
+ /*! Ignore checkpoint */
+ CHECKPOINT_DISABLED = -1
+};
+
+/*!
+ * \brief Checkpoint descriptor
+ *
+ * \details This structure holds the proparities of a checkpoint.
+ * It should be populated by calling checkpoint_register function.
+ *
+ */
+typedef struct {
+ /*! Index in the checkpoint table */
+ uint32_t index;
+ /*! Description of the function registering */
+ char name[CHECKPOINT_NAME_LEN];
+ /*! Tag is used to identify the checkpoint */
+ char tag[CHECKPOINT_TAG_LEN];
+ /*! Enable or disable the checkpoint */
+ volatile int32_t bypass;
+ /*! Valid checkpoint in the checkpoint table */
+ bool in_use;
+ /*! Execution pasused at this checkpoint */
+ volatile bool pause;
+} checkpoint_st;
+
+/*!
+ * \brief Enables all checkpoints in the system.
+ *
+ */
+void checkpoint_enable_all(void);
+
+/*!
+ * \brief Disables all checkpoints in the system.
+ *
+ */
+void checkpoint_disable_all(void);
+
+/*!
+ * \brief Request a new checkpoint structure
+ *
+ * \param c Pointer to a checkpoint_st pointer, is set when the function returns
+ * successfully.
+ * \param name Name or description of the function registering. Must be less
+ * than CHECKPOINT_NAME_LEN characters in length.
+ * \retval FWK_SUCCESS if operation is successful.
+ * \retval FWK_E_NOMEM when checkpoints limit is reached.
+ *
+ */
+int32_t checkpoint_register(checkpoint_st **c, char *name);
+
+/*!
+ * \brief Insert a checkpoint
+ *
+ * \details Checkpoint function for use within code. When this function is
+ * called and checkpoints are disabled, it will return immediately.
+ * If checkpoints are enabled, it will print a message indicating that
+ * it is pausing and activate the CLI. When the command line exists This
+ * function will return and normal execution is resumed.
+ *
+ * \param c Pointer to valid checkpoint structure, obtained through a call to
+ * checkpoint_register.
+ * \param file Name of the file in which the checkpoint exists,
+ * use __FILE__ macro.
+ * \param line Line number of the checkpoint, use __LINE__ macro.
+ * \param tag Checkpoint tag string.
+ */
+void checkpoint(checkpoint_st *c, char *file, int32_t line, char *tag);
+
+/*!
+ * @}
+ */
+
+#endif /* CHECKPOINT_H */