source: rtems/cpukit/score/src/wkspace.c @ a0ed4ed

4.104.114.84.95
Last change on this file since a0ed4ed was 05279b84, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/17/04 at 13:32:13

Remove stray white spaces.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 *  Workspace Handler
3 *
4 *  XXX
5 *
6 *  NOTE:
7 *
8 *  COPYRIGHT (c) 1989-1999.
9 *  On-Line Applications Research Corporation (OAR).
10 *
11 *  The license and distribution terms for this file may be
12 *  found in the file LICENSE in this distribution or at
13 *  http://www.rtems.com/license/LICENSE.
14 *
15 *  $Id$
16 */
17
18#include <rtems/system.h>
19#include <rtems/score/wkspace.h>
20#include <rtems/score/interr.h>
21
22/*PAGE
23 *
24 *  _Workspace_Handler_initialization
25 */
26
27void _Workspace_Handler_initialization(
28  void       *starting_address,
29  uint32_t    size
30)
31{
32  uint32_t   *zero_out_array;
33  uint32_t    index;
34  uint32_t    memory_available;
35
36  if ( !starting_address || !_Addresses_Is_aligned( starting_address ) )
37    _Internal_error_Occurred(
38      INTERNAL_ERROR_CORE,
39      TRUE,
40      INTERNAL_ERROR_INVALID_WORKSPACE_ADDRESS
41    );
42
43  if ( _CPU_Table.do_zero_of_workspace ) {
44    for( zero_out_array  = (uint32_t   *) starting_address, index = 0 ;
45         index < size / sizeof( uint32_t   ) ;
46         index++ )
47      zero_out_array[ index ] = 0;
48  }
49
50  memory_available = _Heap_Initialize(
51    &_Workspace_Area,
52    starting_address,
53    size,
54    CPU_HEAP_ALIGNMENT
55  );
56
57  if ( memory_available == 0 )
58    _Internal_error_Occurred(
59      INTERNAL_ERROR_CORE,
60      TRUE,
61      INTERNAL_ERROR_TOO_LITTLE_WORKSPACE
62    );
63}
64
65/*PAGE
66 *
67 *  _Workspace_Allocate_or_fatal_error
68 *
69 */
70
71void *_Workspace_Allocate_or_fatal_error(
72  uint32_t     size
73)
74{
75  void        *memory;
76
77  memory = _Workspace_Allocate( size );
78
79  if ( memory == NULL )
80    _Internal_error_Occurred(
81      INTERNAL_ERROR_CORE,
82      TRUE,
83      INTERNAL_ERROR_WORKSPACE_ALLOCATION
84    );
85
86  return memory;
87}
Note: See TracBrowser for help on using the repository browser.