source: rtems/cpukit/rtems/src/dpmemcreate.c @ c499856

4.115
Last change on this file since c499856 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 Create Port
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
28rtems_status_code rtems_port_create(
29  rtems_name    name,
30  void         *internal_start,
31  void         *external_start,
32  uint32_t      length,
33  rtems_id     *id
34)
35{
36  Dual_ported_memory_Control          *the_port;
37
38  if ( !rtems_is_name_valid( name ) )
39    return RTEMS_INVALID_NAME;
40
41  if ( !id )
42    return RTEMS_INVALID_ADDRESS;
43
44  if ( !_Addresses_Is_aligned( internal_start ) ||
45       !_Addresses_Is_aligned( external_start ) )
46    return RTEMS_INVALID_ADDRESS;
47
48  _Thread_Disable_dispatch();             /* to prevent deletion */
49
50  the_port = _Dual_ported_memory_Allocate();
51
52  if ( !the_port ) {
53    _Thread_Enable_dispatch();
54    return RTEMS_TOO_MANY;
55  }
56
57  the_port->internal_base = internal_start;
58  the_port->external_base = external_start;
59  the_port->length        = length - 1;
60
61  _Objects_Open(
62    &_Dual_ported_memory_Information,
63    &the_port->Object,
64    (Objects_Name) name
65  );
66
67  *id = the_port->Object.id;
68  _Thread_Enable_dispatch();
69  return RTEMS_SUCCESSFUL;
70}
Note: See TracBrowser for help on using the repository browser.