source: rtems/cpukit/score/inline/rtems/score/stack.inl @ 484a769

4.104.114.95
Last change on this file since 484a769 was 484a769, checked in by Ralf Corsepius <ralf.corsepius@…>, on 09/04/08 at 17:46:39

Convert to "bool".

  • Property mode set to 100644
File size: 2.5 KB
Line 
1/**
2 *  @file  rtems/score/stack.inl
3 *
4 *  This file contains the static inline implementation of the inlined
5 *  routines from the Stack Handler.
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2006.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 *
16 *  $Id$
17 */
18
19#ifndef _RTEMS_SCORE_STACK_H
20# error "Never use <rtems/score/stack.inl> directly; include <rtems/score/stack.h> instead."
21#endif
22
23#ifndef _RTEMS_SCORE_STACK_INL
24#define _RTEMS_SCORE_STACK_INL
25
26/**
27 *  @addtogroup ScoreStack
28 *  @{
29 */
30
31/**
32 *  This routine initializes the_stack record to indicate that
33 *  size bytes of memory starting at starting_address have been
34 *  reserved for a stack.
35 */
36RTEMS_INLINE_ROUTINE void _Stack_Initialize (
37  Stack_Control *the_stack,
38  void          *starting_address,
39  size_t         size
40)
41{
42  the_stack->area = starting_address;
43  the_stack->size = size;
44}
45
46/**
47 *  This function returns the minimum stack size configured
48 *  for this application.
49 *
50 *  @return This method returns the minimum stack size;
51 */
52RTEMS_INLINE_ROUTINE uint32_t _Stack_Minimum (void)
53{
54  return rtems_minimum_stack_size;
55}
56
57/**
58 *  This function returns TRUE if size bytes is enough memory for
59 *  a valid stack area on this processor, and FALSE otherwise.
60 *
61 *  @param[in] size is the stack size to check
62 *
63 *  @return This method returns TRUE if the stack is large enough.
64 */
65RTEMS_INLINE_ROUTINE bool _Stack_Is_enough (
66  size_t size
67)
68{
69  return ( size >= _Stack_Minimum() );
70}
71
72/**
73 *  This function returns the appropriate stack size given the requested
74 *  size.  If the requested size is below the minimum, then the minimum
75 *  configured stack size is returned.
76 *
77 *  @param[in] size is the stack size to check
78 *
79 *  @return This method returns the appropriate stack size.
80 */
81RTEMS_INLINE_ROUTINE size_t _Stack_Ensure_minimum (
82  size_t size
83)
84{
85  if ( size >= _Stack_Minimum() )
86    return size;
87  return _Stack_Minimum();
88}
89
90/**
91 *  This function increases the stack size to ensure that the thread
92 *  has the desired amount of stack space after the initial stack
93 *  pointer is determined based on alignment restrictions.
94 *
95 *  @note
96 *
97 *  The amount of adjustment for alignment is CPU dependent.
98 */
99
100RTEMS_INLINE_ROUTINE uint32_t   _Stack_Adjust_size (
101  size_t size
102)
103{
104  return size + CPU_STACK_ALIGNMENT;
105}
106
107/**@}*/
108
109#endif
110/* end of include file */
Note: See TracBrowser for help on using the repository browser.