source: rtems/cpukit/rtems/src/dpmemexternal2internal.c @ 205dbb9d

4.115
Last change on this file since 205dbb9d was 205dbb9d, checked in by Alex Ivanov <alexivanov97@…>, on 12/03/12 at 19:18:33

cpukit: Clean up Doxygen #3 (GCI 2012)

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Port External to Internal
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_external_to_internal(
31  rtems_id   id,
32  void      *external,
33  void     **internal
34)
35{
36  register Dual_ported_memory_Control *the_port;
37  Objects_Locations                    location;
38  uint32_t                             ending;
39
40  if ( !internal )
41    return RTEMS_INVALID_ADDRESS;
42
43  the_port = _Dual_ported_memory_Get( id, &location );
44  switch ( location ) {
45    case OBJECTS_LOCAL:
46      ending = _Addresses_Subtract( external, the_port->external_base );
47      if ( ending > the_port->length )
48        *internal = external;
49      else
50        *internal = _Addresses_Add_offset( the_port->internal_base,
51                                           ending );
52      _Thread_Enable_dispatch();
53      return RTEMS_SUCCESSFUL;
54
55#if defined(RTEMS_MULTIPROCESSING)
56    case OBJECTS_REMOTE:        /* this error cannot be returned */
57#endif
58    case OBJECTS_ERROR:
59      break;
60  }
61
62  return RTEMS_INVALID_ID;
63}
Note: See TracBrowser for help on using the repository browser.