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

4.115
Last change on this file since a6500136 was a6500136, checked in by Alex Ivanov <alexivanov97@…>, on 12/05/12 at 23:16:48

rtems misc: Clean up Doxygen GCI Task #7

http://www.google-melange.com/gci/task/view/google/gci2012/7950206

  • 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/dpmem.h>
26#include <rtems/score/object.h>
27#include <rtems/score/thread.h>
28#include <rtems/rtems/dpmem.h>
29
30rtems_status_code rtems_port_internal_to_external(
31  rtems_id   id,
32  void      *internal,
33  void     **external
34)
35{
36  register Dual_ported_memory_Control *the_port;
37  Objects_Locations                    location;
38  uint32_t                             ending;
39
40  if ( !external )
41    return RTEMS_INVALID_ADDRESS;
42
43  the_port = _Dual_ported_memory_Get( id, &location );
44  switch ( location ) {
45
46    case OBJECTS_LOCAL:
47      ending = _Addresses_Subtract( internal, the_port->internal_base );
48      if ( ending > the_port->length )
49        *external = internal;
50      else
51        *external = _Addresses_Add_offset( the_port->external_base,
52                                           ending );
53      _Thread_Enable_dispatch();
54      return RTEMS_SUCCESSFUL;
55
56#if defined(RTEMS_MULTIPROCESSING)
57    case OBJECTS_REMOTE:        /* this error cannot be returned */
58#endif
59    case OBJECTS_ERROR:
60      break;
61  }
62
63  return RTEMS_INVALID_ID;
64}
Note: See TracBrowser for help on using the repository browser.