source: rtems/cpukit/rtems/include/rtems/rtems/part.h @ 43776b57

4.104.115
Last change on this file since 43776b57 was 43776b57, checked in by Joel Sherrill <joel.sherrill@…>, on 05/05/09 at 21:17:28

2009-05-05 Joel Sherrill <joel.sherrill@…>

  • rtems/include/rtems/rtems/part.h, rtems/inline/rtems/rtems/region.inl: Fix warnings.
  • Property mode set to 100644
File size: 5.0 KB
Line 
1/**
2 * @file rtems/rtems/part.h
3 *
4 *  This include file contains all the constants and structures associated
5 *  with the Partition Manager.  This manager provides facilities to
6 *  dynamically allocate memory in fixed-sized units which are returned
7 *  as buffers.
8 *
9 *  Directives provided are:
10 *
11 *     - create a partition
12 *     - get an ID of a partition
13 *     - delete a partition
14 *     - get a buffer from a partition
15 *     - return a buffer to a partition
16 */
17
18/*  COPYRIGHT (c) 1989-2008.
19 *  On-Line Applications Research Corporation (OAR).
20 *
21 *  The license and distribution terms for this file may be
22 *  found in the file LICENSE in this distribution or at
23 *  http://www.rtems.com/license/LICENSE.
24 *
25 *  $Id$
26 */
27
28#ifndef _RTEMS_RTEMS_PART_H
29#define _RTEMS_RTEMS_PART_H
30
31/**
32 *  This constant is defined to extern most of the time when using
33 *  this header file.  However by defining it to nothing, the data
34 *  declared in this header file can be instantiated.  This is done
35 *  in a single per manager file.
36 */
37#ifndef RTEMS_PART_EXTERN
38#define RTEMS_PART_EXTERN extern
39#endif
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
45#include <rtems/score/address.h>
46#include <rtems/score/object.h>
47#include <rtems/rtems/attr.h>
48#include <rtems/rtems/status.h>
49#include <rtems/rtems/support.h>
50#include <rtems/rtems/types.h>
51
52/**
53 *  @defgroup ClassicPart Classic API Partition
54 *
55 *  This encapsulates functionality related to the
56 *  Classic API Partition Manager.
57 */
58/**@{*/
59
60/**
61 *  The following defines the control block used to manage each partition.
62 */
63typedef struct {
64  /** This field is the object management portion of a Partition instance. */
65  Objects_Control     Object;
66  /** This field is the physical starting address of the Partition. */
67  void               *starting_address;
68  /** This field is the size of the Partition in bytes. */
69  intptr_t            length;
70  /** This field is the size of each buffer in bytes */
71  uint32_t            buffer_size;
72  /** This field is the attribute set provided at create time. */
73  rtems_attribute     attribute_set;
74  /** This field is the of allocated buffers. */
75  uint32_t            number_of_used_blocks;
76  /** This field is the chain used to manage unallocated buffers. */
77  Chain_Control       Memory;
78}   Partition_Control;
79
80/**
81 *  The following defines the information control block used to
82 *  manage this class of objects.
83 */
84RTEMS_PART_EXTERN Objects_Information _Partition_Information;
85
86/**
87 *  @brief Partition_Manager_initialization
88 *
89 *  This routine performs the initialization necessary for this manager.
90 */
91void _Partition_Manager_initialization(void);
92
93/**
94 *  @brief rtems_partition_create
95 *
96 *  This routine implements the rtems_partition_create directive.  The
97 *  partition will have the name name.  The memory area managed by
98 *  the partition is of length bytes and starts at starting_address.
99 *  The memory area will be divided into as many buffers of
100 *  buffer_size bytes as possible.   The attribute_set determines if
101 *  the partition is global or local.  It returns the id of the
102 *  created partition in ID.
103 */
104rtems_status_code rtems_partition_create(
105  rtems_name          name,
106  void               *starting_address,
107  uint32_t            length,
108  uint32_t            buffer_size,
109  rtems_attribute  attribute_set,
110  Objects_Id         *id
111);
112
113/**
114 *  @brief rtems_partition_ident
115 *
116 *  This routine implements the rtems_partition_ident directive.
117 *  This directive returns the partition ID associated with name.
118 *  If more than one partition is named name, then the partition
119 *  to which the ID belongs is arbitrary.  node indicates the
120 *  extent of the search for the ID of the partition named name.
121 *  The search can be limited to a particular node or allowed to
122 *  encompass all nodes.
123 */
124rtems_status_code rtems_partition_ident(
125  rtems_name    name,
126  uint32_t      node,
127  Objects_Id   *id
128);
129
130/**
131 *  @brief rtems_partition_delete
132 *
133 *  This routine implements the rtems_partition_delete directive.  The
134 *  partition indicated by ID is deleted.
135 */
136rtems_status_code rtems_partition_delete(
137  Objects_Id id
138);
139
140/**
141 *  @brief rtems_partition_get_buffer
142 *
143 *  This routine implements the rtems_partition_get_buffer directive.  It
144 *  attempts to allocate a buffer from the partition associated with ID.
145 *  If a buffer is allocated, its address is returned in buffer.
146 */
147rtems_status_code rtems_partition_get_buffer(
148  Objects_Id  id,
149  void       **buffer
150);
151
152/**
153 *  @brief rtems_partition_return_buffer
154 *
155 *  This routine implements the rtems_partition_return_buffer directive.  It
156 *  frees the buffer to the partition associated with ID.  The buffer must
157 *  have been previously allocated from the same partition.
158 */
159rtems_status_code rtems_partition_return_buffer(
160  Objects_Id  id,
161  void       *buffer
162);
163
164#ifndef __RTEMS_APPLICATION__
165#include <rtems/rtems/part.inl>
166#endif
167#if defined(RTEMS_MULTIPROCESSING)
168#include <rtems/rtems/partmp.h>
169#endif
170
171#ifdef __cplusplus
172}
173#endif
174
175/**@}*/
176
177#endif
178/* end of include file */
Note: See TracBrowser for help on using the repository browser.