5
Last change
on this file since 84a53988 was
c499856,
checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47
|
Change all references of rtems.com to rtems.org.
|
-
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-2014. |
---|
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.org/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 | |
---|
28 | rtems_status_code rtems_port_external_to_internal( |
---|
29 | rtems_id id, |
---|
30 | void *external, |
---|
31 | void **internal |
---|
32 | ) |
---|
33 | { |
---|
34 | Dual_ported_memory_Control *the_port; |
---|
35 | Objects_Locations location; |
---|
36 | uint32_t ending; |
---|
37 | |
---|
38 | if ( !internal ) |
---|
39 | return RTEMS_INVALID_ADDRESS; |
---|
40 | |
---|
41 | the_port = _Dual_ported_memory_Get( id, &location ); |
---|
42 | switch ( location ) { |
---|
43 | case OBJECTS_LOCAL: |
---|
44 | ending = _Addresses_Subtract( external, the_port->external_base ); |
---|
45 | if ( ending > the_port->length ) |
---|
46 | *internal = external; |
---|
47 | else |
---|
48 | *internal = _Addresses_Add_offset( the_port->internal_base, |
---|
49 | ending ); |
---|
50 | _Objects_Put( &the_port->Object ); |
---|
51 | return RTEMS_SUCCESSFUL; |
---|
52 | |
---|
53 | #if defined(RTEMS_MULTIPROCESSING) |
---|
54 | case OBJECTS_REMOTE: /* this error cannot be returned */ |
---|
55 | #endif |
---|
56 | case OBJECTS_ERROR: |
---|
57 | break; |
---|
58 | } |
---|
59 | |
---|
60 | return RTEMS_INVALID_ID; |
---|
61 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.