source: rtems/cpukit/rtems/src/partreturnbuffer.c @ fed6210d

4.104.114.84.95
Last change on this file since fed6210d was 08311cc3, checked in by Joel Sherrill <joel.sherrill@…>, on 11/17/99 at 17:51:34

Updated copyright notice.

  • Property mode set to 100644
File size: 1.8 KB
Line 
1/*
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$
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
40rtems_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}
Note: See TracBrowser for help on using the repository browser.