source: rtems/cpukit/score/src/wkspace.c @ 1d486eff

4.104.114.84.95
Last change on this file since 1d486eff was 3127180, checked in by Ralf Corsepius <ralf.corsepius@…>, on 03/29/04 at 12:51:43

2004-04-29 Ralf Corsepius <ralf_corsepius@…>

  • score/src/Unlimited.txt, score/src/chain.c, score/src/coremsg.c, score/src/coremsgbroadcast.c, score/src/coremsgclose.c, score/src/coremsgflush.c, score/src/coremsgflushsupp.c, score/src/coremsgseize.c, score/src/coremsgsubmit.c, score/src/coremutex.c, score/src/coremutexflush.c, score/src/coresem.c, score/src/coresemflush.c, score/src/coretod.c, score/src/coretodtickle.c, score/src/coretodtoseconds.c, score/src/coretodvalidate.c, score/src/heap.c, score/src/heapallocate.c, score/src/heapextend.c, score/src/heapfree.c, score/src/heapsizeofuserarea.c, score/src/interr.c, score/src/iterateoverthreads.c, score/src/mpci.c, score/src/object.c, score/src/objectallocate.c, score/src/objectallocatebyindex.c, score/src/objectclearname.c, score/src/objectcomparenameraw.c, score/src/objectcomparenamestring.c, score/src/objectcopynameraw.c, score/src/objectcopynamestring.c, score/src/objectextendinformation.c, score/src/objectfree.c, score/src/objectget.c, score/src/objectgetbyindex.c, score/src/objectgetisr.c, score/src/objectgetnoprotection.c, score/src/objectidtoname.c, score/src/objectinitializeinformation.c, score/src/objectmp.c, score/src/objectnametoid.c, score/src/objectshrinkinformation.c, score/src/thread.c, score/src/threadcreateidle.c, score/src/threadget.c, score/src/threadidlebody.c, score/src/threadinitialize.c, score/src/threadmp.c, score/src/threadq.c, score/src/threadqdequeuepriority.c, score/src/threadqenqueuepriority.c, score/src/threadqfirstpriority.c, score/src/threadqflush.c, score/src/threadreset.c, score/src/threadrestart.c, score/src/threadsettransient.c, score/src/threadstackallocate.c, score/src/threadstart.c, score/src/userext.c, score/src/watchdoginsert.c, score/src/wkspace.c: Convert to using c99 fixed size types.
  • 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.