source: rtems/cpukit/rtems/src/dpmemcreate.c @ 811804fe

4.104.114.84.95
Last change on this file since 811804fe was 1dc030f, checked in by Joel Sherrill <joel.sherrill@…>, on 05/17/99 at 23:18:20

Dual-Ported Memory Manager split into one routine per file.

  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*
2 *  Dual Port Memory Manager
3 *
4 *  COPYRIGHT (c) 1989-1998.
5 *  On-Line Applications Research Corporation (OAR).
6 *  Copyright assigned to U.S. Government, 1994.
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.OARcorp.com/rtems/license.html.
11 *
12 *  $Id$
13 */
14
15#include <rtems/system.h>
16#include <rtems/rtems/status.h>
17#include <rtems/rtems/support.h>
18#include <rtems/score/address.h>
19#include <rtems/rtems/dpmem.h>
20#include <rtems/score/object.h>
21#include <rtems/score/thread.h>
22#include <rtems/rtems/dpmem.h>
23
24/*PAGE
25 *
26 *  rtems_port_create
27 *
28 *  This directive creates a port into a dual-ported memory area.
29 *
30 *  Input parameters:
31 *    name           - user defined port name
32 *    internal_start - internal start address of port
33 *    external_start - external start address of port
34 *    length         - physical length in bytes
35 *    id             - address of port id to set
36 *
37 *  Output parameters:
38 *    id       - port id
39 *    RTEMS_SUCCESSFUL - if successful
40 *    error code - if unsuccessful
41 */
42
43rtems_status_code rtems_port_create(
44  rtems_name    name,
45  void         *internal_start,
46  void         *external_start,
47  unsigned32    length,
48  Objects_Id   *id
49)
50{
51  register Dual_ported_memory_Control *the_port;
52
53  if ( !rtems_is_name_valid( name) )
54    return RTEMS_INVALID_NAME;
55
56  if ( !_Addresses_Is_aligned( internal_start ) ||
57       !_Addresses_Is_aligned( external_start ) )
58    return RTEMS_INVALID_ADDRESS;
59
60  _Thread_Disable_dispatch();             /* to prevent deletion */
61
62  the_port = _Dual_ported_memory_Allocate();
63
64  if ( !the_port ) {
65    _Thread_Enable_dispatch();
66    return RTEMS_TOO_MANY;
67  }
68
69  the_port->internal_base = internal_start;
70  the_port->external_base = external_start;
71  the_port->length        = length - 1;
72
73  _Objects_Open(
74    &_Dual_ported_memory_Information,
75    &the_port->Object,
76    &name
77  );
78
79  *id = the_port->Object.id;
80  _Thread_Enable_dispatch();
81  return RTEMS_SUCCESSFUL;
82}
Note: See TracBrowser for help on using the repository browser.