source: rtems/c/src/exec/rtems/src/partgetbuffer.c @ 842db5f3

4.104.114.84.95
Last change on this file since 842db5f3 was 842db5f3, checked in by Joel Sherrill <joel.sherrill@…>, on 05/17/99 at 23:15:20

Split Partition Manager into one routine per file.

  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*
2 *  Partition Manager
3 *
4 *
5 *  COPYRIGHT (c) 1989-1998.
6 *  On-Line Applications Research Corporation (OAR).
7 *  Copyright assigned to U.S. Government, 1994.
8 *
9 *  The license and distribution terms for this file may be
10 *  found in the file LICENSE in this distribution or at
11 *  http://www.OARcorp.com/rtems/license.html.
12 *
13 *  $Id$
14 */
15
16#include <rtems/system.h>
17#include <rtems/rtems/status.h>
18#include <rtems/rtems/support.h>
19#include <rtems/score/address.h>
20#include <rtems/score/object.h>
21#include <rtems/rtems/part.h>
22#include <rtems/score/thread.h>
23#include <rtems/score/sysstate.h>
24
25/*PAGE
26 *
27 *  rtems_partition_get_buffer
28 *
29 *  This directive will obtain a buffer from a buffer partition.
30 *
31 *  Input parameters:
32 *    id     - partition id
33 *    buffer - pointer to buffer address
34 *
35 *  Output parameters:
36 *    buffer            - pointer to buffer address filled in
37 *    RTEMS_SUCCESSFUL - if successful
38 *    error code        - if unsuccessful
39 */
40
41rtems_status_code rtems_partition_get_buffer(
42  Objects_Id   id,
43  void       **buffer
44)
45{
46  register Partition_Control *the_partition;
47  Objects_Locations           location;
48  void                       *the_buffer;
49
50  the_partition = _Partition_Get( id, &location );
51  switch ( location ) {
52    case OBJECTS_REMOTE:
53#if defined(RTEMS_MULTIPROCESSING)
54      _Thread_Executing->Wait.return_argument = buffer;
55      return(
56        _Partition_MP_Send_request_packet(
57          PARTITION_MP_GET_BUFFER_REQUEST,
58          id,
59          0           /* Not used */
60        )
61      );
62#endif
63
64    case OBJECTS_ERROR:
65      return RTEMS_INVALID_ID;
66
67    case OBJECTS_LOCAL:
68      the_buffer = _Partition_Allocate_buffer( the_partition );
69      if ( the_buffer ) {
70        the_partition->number_of_used_blocks += 1;
71        _Thread_Enable_dispatch();
72        *buffer = the_buffer;
73        return RTEMS_SUCCESSFUL;
74      }
75      _Thread_Enable_dispatch();
76      return RTEMS_UNSATISFIED;
77  }
78
79  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
80}
Note: See TracBrowser for help on using the repository browser.