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

Subversion Repositories openrisc

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

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: partreturnbuffer.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_return_buffer
27
 *
28
 *  This directive will return the given buffer to the specified
29
 *  buffer partition.
30
 *
31
 *  Input parameters:
32
 *    id     - partition id
33
 *    buffer - pointer to buffer address
34
 *
35
 *  Output parameters:
36
 *    RTEMS_SUCCESSFUL - if successful
37
 *    error code - if unsuccessful
38
 */
39
 
40
rtems_status_code rtems_partition_return_buffer(
41
  Objects_Id  id,
42
  void       *buffer
43
)
44
{
45
  register Partition_Control *the_partition;
46
  Objects_Locations           location;
47
 
48
  the_partition = _Partition_Get( id, &location );
49
  switch ( location ) {
50
 
51
    case OBJECTS_REMOTE:
52
#if defined(RTEMS_MULTIPROCESSING)
53
      return _Partition_MP_Send_request_packet(
54
          PARTITION_MP_RETURN_BUFFER_REQUEST,
55
          id,
56
          buffer
57
        );
58
#endif
59
 
60
    case OBJECTS_ERROR:
61
      return RTEMS_INVALID_ID;
62
 
63
    case OBJECTS_LOCAL:
64
      if ( _Partition_Is_buffer_valid( buffer, the_partition ) ) {
65
        _Partition_Free_buffer( the_partition, buffer );
66
        the_partition->number_of_used_blocks -= 1;
67
        _Thread_Enable_dispatch();
68
        return RTEMS_SUCCESSFUL;
69
      }
70
      _Thread_Enable_dispatch();
71
      return RTEMS_INVALID_ADDRESS;
72
  }
73
 
74
  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
75
}

powered by: WebSVN 2.1.0

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