summaryrefslogtreecommitdiff
path: root/nuttx/arch/rgmp
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-03-21 17:35:08 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2013-03-21 17:35:08 +0000
commitaee2b5f63b4eef1751605731688fd80d20593b81 (patch)
tree936c832a3c90c8ba410bcd050d0c97c4cfdb7cb0 /nuttx/arch/rgmp
parent55a46f0500f36567ce352048454534135aff92f2 (diff)
downloadnuttx-aee2b5f63b4eef1751605731688fd80d20593b81.tar.gz
nuttx-aee2b5f63b4eef1751605731688fd80d20593b81.tar.bz2
nuttx-aee2b5f63b4eef1751605731688fd80d20593b81.zip
Add a up_stack_frame() interface to allocate a frame of data on a task's stack.
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5768 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/rgmp')
-rw-r--r--nuttx/arch/rgmp/src/nuttx.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/nuttx/arch/rgmp/src/nuttx.c b/nuttx/arch/rgmp/src/nuttx.c
index 79f97fcfc..f218b3f18 100644
--- a/nuttx/arch/rgmp/src/nuttx.c
+++ b/nuttx/arch/rgmp/src/nuttx.c
@@ -168,6 +168,31 @@ int up_use_stack(struct tcb_s *tcb, void *stack, size_t stack_size)
return OK;
}
+#ifdef CONFIG_NUTTX_KERNEL
+FAR void *up_stack_frame(FAR struct tcb_s *tcb, size_t frame_size)
+{
+ uintptr_t topaddr;
+
+ /* Align the frame_size */
+
+ frame_size = (frame_size + 3) & ~3;
+
+ /* Is there already a stack allocated? Is it big enough? */
+
+ if (!tcb->stack_alloc_ptr || tcb->adj_stack_size <= frame_size) {
+ return NULL;
+ }
+
+ /* Save the adjusted stack values in the struct tcb_s */
+
+ topaddr = (uintptr_t)tcb->adj_stack_ptr - frame_size;
+ tcb->adj_stack_ptr = (FAR void *)topaddr;
+ tcb->adj_stack_size -= frame_size;
+
+ return (FAR void *)(topaddr + sizeof(uint32_t));
+}
+#endif
+
void up_release_stack(struct tcb_s *dtcb, uint8_t ttype)
{
/* Is there a stack allocated? */