source: rtems/cpukit/rtems/src/regioncreate.c @ 9b4422a2

4.115
Last change on this file since 9b4422a2 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 3.0 KB
Line 
1/*
2 *  Region Manager
3 *
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.rtems.com/license/LICENSE.
11 */
12
13#if HAVE_CONFIG_H
14#include "config.h"
15#endif
16
17#include <rtems/system.h>
18#include <rtems/rtems/status.h>
19#include <rtems/rtems/support.h>
20#include <rtems/score/object.h>
21#include <rtems/rtems/options.h>
22#include <rtems/rtems/region.h>
23#include <rtems/score/states.h>
24#include <rtems/score/thread.h>
25#include <rtems/score/apimutex.h>
26
27/*
28 *  rtems_region_create
29 *
30 *  This directive creates a region of physical contiguous memory area
31 *  from which variable sized segments can be allocated.
32 *
33 *  Input parameters:
34 *    name             - user defined region name
35 *    starting_address - physical start address of region
36 *    length           - physical length in bytes
37 *    page_size        - page size in bytes
38 *    attribute_set    - region attributes
39 *    id               - address of region id to set
40 *
41 *  Output parameters:
42 *    id               - region id
43 *    RTEMS_SUCCESSFUL - if successful
44 *    error code       - if unsuccessful
45 */
46
47rtems_status_code rtems_region_create(
48  rtems_name          name,
49  void               *starting_address,
50  uintptr_t           length,
51  uintptr_t           page_size,
52  rtems_attribute     attribute_set,
53  rtems_id           *id
54)
55{
56  rtems_status_code  return_status;
57  Region_Control    *the_region;
58
59  if ( !rtems_is_name_valid( name ) )
60    return RTEMS_INVALID_NAME;
61
62  if ( !starting_address )
63    return RTEMS_INVALID_ADDRESS;
64
65  if ( !id )
66    return RTEMS_INVALID_ADDRESS;
67
68  _RTEMS_Lock_allocator();                      /* to prevent deletion */
69
70    the_region = _Region_Allocate();
71
72    if ( !the_region )
73      return_status = RTEMS_TOO_MANY;
74
75    else {
76
77      the_region->maximum_segment_size = _Heap_Initialize(
78        &the_region->Memory, starting_address, length, page_size
79      );
80
81      if ( !the_region->maximum_segment_size ) {
82        _Region_Free( the_region );
83        return_status = RTEMS_INVALID_SIZE;
84      }
85
86      else {
87
88        the_region->starting_address      = starting_address;
89        the_region->length                = length;
90        the_region->page_size             = page_size;
91        the_region->attribute_set         = attribute_set;
92        the_region->number_of_used_blocks = 0;
93
94        _Thread_queue_Initialize(
95          &the_region->Wait_queue,
96          _Attributes_Is_priority( attribute_set ) ?
97             THREAD_QUEUE_DISCIPLINE_PRIORITY : THREAD_QUEUE_DISCIPLINE_FIFO,
98          STATES_WAITING_FOR_SEGMENT,
99          RTEMS_TIMEOUT
100        );
101
102        _Objects_Open(
103          &_Region_Information,
104          &the_region->Object,
105          (Objects_Name) name
106        );
107
108        *id = the_region->Object.id;
109        return_status = RTEMS_SUCCESSFUL;
110      }
111    }
112
113  _RTEMS_Unlock_allocator();
114  return return_status;
115}
Note: See TracBrowser for help on using the repository browser.