OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [exec/] [rtems/] [src/] [dpmeminternal2external.c] - Blame information for rev 30

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  Dual Port Memory Manager
3
 *
4
 *  COPYRIGHT (c) 1989-1999.
5
 *  On-Line Applications Research Corporation (OAR).
6
 *
7
 *  The license and distribution terms for this file may be
8
 *  found in the file LICENSE in this distribution or at
9
 *  http://www.OARcorp.com/rtems/license.html.
10
 *
11
 *  $Id: dpmeminternal2external.c,v 1.2 2001-09-27 11:59:19 chris Exp $
12
 */
13
 
14
#include <rtems/system.h>
15
#include <rtems/rtems/status.h>
16
#include <rtems/rtems/support.h>
17
#include <rtems/score/address.h>
18
#include <rtems/rtems/dpmem.h>
19
#include <rtems/score/object.h>
20
#include <rtems/score/thread.h>
21
#include <rtems/rtems/dpmem.h>
22
 
23
/*PAGE
24
 *
25
 *  rtems_port_internal_to_external
26
 *
27
 *  This directive converts an internal dual-ported memory address to an
28
 *  external dual-ported memory address.  If the given internal address
29
 *  is an invalid dual-ported address, then the external address is set
30
 *  to the given internal address.
31
 *
32
 *  Input parameters:
33
 *    id       - id of dual-ported memory object
34
 *    internal - internal address to set
35
 *    external - pointer to external address
36
 *
37
 *  Output parameters:
38
 *    external          - external address
39
 *    RTEMS_SUCCESSFUL - always succeeds
40
 */
41
 
42
rtems_status_code rtems_port_internal_to_external(
43
  Objects_Id   id,
44
  void        *internal,
45
  void       **external
46
)
47
{
48
  register Dual_ported_memory_Control *the_port;
49
  Objects_Locations                    location;
50
  unsigned32                           ending;
51
 
52
  the_port = _Dual_ported_memory_Get( id, &location );
53
  switch ( location ) {
54
    case OBJECTS_REMOTE:        /* this error cannot be returned */
55
      return RTEMS_INTERNAL_ERROR;
56
 
57
    case OBJECTS_ERROR:
58
      return RTEMS_INVALID_ID;
59
 
60
    case OBJECTS_LOCAL:
61
      ending = _Addresses_Subtract( internal, the_port->internal_base );
62
      if ( ending > the_port->length )
63
        *external = internal;
64
      else
65
        *external = _Addresses_Add_offset( the_port->external_base,
66
                                           ending );
67
      _Thread_Enable_dispatch();
68
      return RTEMS_SUCCESSFUL;
69
  }
70
 
71
  return RTEMS_INTERNAL_ERROR;   /* unreached - only to remove warnings */
72
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.