OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [rtems/] [src/] [partgetbuffer.c] - Blame information for rev 314

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

Line No. Rev Author Line
1 30 unneback
/*
2
 *  Partition 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.OARcorp.com/rtems/license.html.
11
 *
12
 *  $Id: partgetbuffer.c,v 1.2 2001-09-27 11:59:19 chris Exp $
13
 */
14
 
15
#include <rtems/system.h>
16
#include <rtems/rtems/status.h>
17
#include <rtems/rtems/support.h>
18
#include <rtems/score/address.h>
19
#include <rtems/score/object.h>
20
#include <rtems/rtems/part.h>
21
#include <rtems/score/thread.h>
22
#include <rtems/score/sysstate.h>
23
 
24
/*PAGE
25
 *
26
 *  rtems_partition_get_buffer
27
 *
28
 *  This directive will obtain a buffer from a buffer partition.
29
 *
30
 *  Input parameters:
31
 *    id     - partition id
32
 *    buffer - pointer to buffer address
33
 *
34
 *  Output parameters:
35
 *    buffer            - pointer to buffer address filled in
36
 *    RTEMS_SUCCESSFUL - if successful
37
 *    error code        - if unsuccessful
38
 */
39
 
40
rtems_status_code rtems_partition_get_buffer(
41
  Objects_Id   id,
42
  void       **buffer
43
)
44
{
45
  register Partition_Control *the_partition;
46
  Objects_Locations           location;
47
  void                       *the_buffer;
48
 
49
  the_partition = _Partition_Get( id, &location );
50
  switch ( location ) {
51
    case OBJECTS_REMOTE:
52
#if defined(RTEMS_MULTIPROCESSING)
53
      _Thread_Executing->Wait.return_argument = buffer;
54
      return(
55
        _Partition_MP_Send_request_packet(
56
          PARTITION_MP_GET_BUFFER_REQUEST,
57
          id,
58
 
59
        )
60
      );
61
#endif
62
 
63
    case OBJECTS_ERROR:
64
      return RTEMS_INVALID_ID;
65
 
66
    case OBJECTS_LOCAL:
67
      the_buffer = _Partition_Allocate_buffer( the_partition );
68
      if ( the_buffer ) {
69
        the_partition->number_of_used_blocks += 1;
70
        _Thread_Enable_dispatch();
71
        *buffer = the_buffer;
72
        return RTEMS_SUCCESSFUL;
73
      }
74
      _Thread_Enable_dispatch();
75
      return RTEMS_UNSATISFIED;
76
  }
77
 
78
  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
79
}

powered by: WebSVN 2.1.0

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