You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2019/12/06 11:52:26 UTC

[mynewt-core] 01/02: kernel/os: Add os_task_stacktop_get

This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit daeb23b029b292fdf318fb466a3d1753dbe16759
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Thu Dec 5 10:40:06 2019 +0100

    kernel/os: Add os_task_stacktop_get
---
 kernel/os/include/os/os_task.h | 9 +++++++++
 kernel/os/src/os_task.c        | 6 ++++++
 2 files changed, 15 insertions(+)

diff --git a/kernel/os/include/os/os_task.h b/kernel/os/include/os/os_task.h
index 83022e4..b42f51c 100644
--- a/kernel/os/include/os/os_task.h
+++ b/kernel/os/include/os/os_task.h
@@ -172,6 +172,15 @@ int os_task_init(struct os_task *, const char *, os_task_func_t, void *,
 int os_task_remove(struct os_task *t);
 
 /**
+ * Return pointer to top of stack for given task
+ *
+ * @param t The task
+ *
+ * @return pointer to top of stack
+ */
+os_stack_t *os_task_stacktop_get(struct os_task *t);
+
+/**
  * Return the number of tasks initialized.
  *
  * @return number of tasks initialized
diff --git a/kernel/os/src/os_task.c b/kernel/os/src/os_task.c
index cea22dd..2129493 100644
--- a/kernel/os/src/os_task.c
+++ b/kernel/os/src/os_task.c
@@ -126,6 +126,12 @@ err:
     return (rc);
 }
 
+os_stack_t *
+os_task_stacktop_get(struct os_task *t)
+{
+    return &t->t_stackbottom[t->t_stacksize];
+}
+
 int
 os_task_remove(struct os_task *t)
 {