source: rtems/cpukit/rtems/src/dpmeminternal2external.c @ a2e3f33

4.115
Last change on this file since a2e3f33 was a2e3f33, checked in by Sebastian Huber <sebastian.huber@…>, on 07/24/13 at 11:50:54

score: Create object implementation header

Move implementation specific parts of object.h and object.inl into new
header file objectimpl.h. The object.h contains now only the
application visible API.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Port Internal to External
5 *  @ingroup ClassicDPMEM
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2007.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.com/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/system.h>
22#include <rtems/rtems/status.h>
23#include <rtems/rtems/support.h>
24#include <rtems/score/address.h>
25#include <rtems/rtems/dpmemimpl.h>
26#include <rtems/score/thread.h>
27
28rtems_status_code rtems_port_internal_to_external(
29  rtems_id   id,
30  void      *internal,
31  void     **external
32)
33{
34  register Dual_ported_memory_Control *the_port;
35  Objects_Locations                    location;
36  uint32_t                             ending;
37
38  if ( !external )
39    return RTEMS_INVALID_ADDRESS;
40
41  the_port = _Dual_ported_memory_Get( id, &location );
42  switch ( location ) {
43
44    case OBJECTS_LOCAL:
45      ending = _Addresses_Subtract( internal, the_port->internal_base );
46      if ( ending > the_port->length )
47        *external = internal;
48      else
49        *external = _Addresses_Add_offset( the_port->external_base,
50                                           ending );
51      _Objects_Put( &the_port->Object );
52      return RTEMS_SUCCESSFUL;
53
54#if defined(RTEMS_MULTIPROCESSING)
55    case OBJECTS_REMOTE:        /* this error cannot be returned */
56#endif
57    case OBJECTS_ERROR:
58      break;
59  }
60
61  return RTEMS_INVALID_ID;
62}
Note: See TracBrowser for help on using the repository browser.