OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [score/] [src/] [wkspace.c] - Blame information for rev 30

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
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.OARcorp.com/rtems/license.html.
14
 *
15
 *  $Id: wkspace.c,v 1.2 2001-09-27 11:59:34 chris Exp $
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
 
27
void _Workspace_Handler_initialization(
28
  void       *starting_address,
29
  unsigned32  size
30
)
31
{
32
  unsigned32 *zero_out_array;
33
  unsigned32  index;
34
  unsigned32  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  = (unsigned32 *) starting_address, index = 0 ;
45
         index < size / sizeof( unsigned32 ) ;
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
 
71
void *_Workspace_Allocate_or_fatal_error(
72
  unsigned32   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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.