comparison src/nucleus/dm_defs.h @ 0:92470e5d0b9e

src: partial import from FC Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 15 May 2020 01:28:16 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:92470e5d0b9e
1 /*************************************************************************/
2 /* */
3 /* Copyright Mentor Graphics Corporation 2002 */
4 /* All Rights Reserved. */
5 /* */
6 /* THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS */
7 /* THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS */
8 /* SUBJECT TO LICENSE TERMS. */
9 /* */
10 /*************************************************************************/
11
12 /*************************************************************************/
13 /* */
14 /* FILE NAME VERSION */
15 /* */
16 /* dm_defs.h Nucleus PLUS 1.14 */
17 /* */
18 /* COMPONENT */
19 /* */
20 /* DM - Dynamic Memory Management */
21 /* */
22 /* DESCRIPTION */
23 /* */
24 /* This file contains data structure definitions and constants for */
25 /* the Dynamic Memory component. */
26 /* */
27 /* DATA STRUCTURES */
28 /* */
29 /* DM_PCB Dynamic Pool control block */
30 /* DM_HEADER Header of each memory block */
31 /* DM_SUSPEND Memory suspension block */
32 /* */
33 /* FUNCTIONS */
34 /* */
35 /* None */
36 /* */
37 /* DEPENDENCIES */
38 /* */
39 /* cs_defs.h Common service definitions */
40 /* tc_defs.h Thread Control definitions */
41 /* */
42 /* HISTORY */
43 /* */
44 /* DATE REMARKS */
45 /* */
46 /* 03-01-1993 Created initial version 1.0 */
47 /* 04-19-1993 Verified version 1.0 */
48 /* 03-01-1994 Moved include files outside of */
49 /* the file #ifndef to allow the */
50 /* use of actual data structures, */
51 /* added padding logic, */
52 /* resulting in version 1.1 */
53 /* */
54 /* 03-18-1994 Verified version 1.1 */
55 /* 04-17-1996 updated to version 1.2 */
56 /* 01-07-1997 Added missing PAD_1 field to */
57 /* DM_HEADER_STRUCT to be */
58 /* consistent with other PLUS */
59 /* structures creating 1.2a. */
60 /* 03-24-1998 Released version 1.3. */
61 /* 03-26-1999 Released 1.11m (new release */
62 /* numbering scheme) */
63 /* 04-17-2002 Released version 1.13m */
64 /* 11-07-2002 Released version 1.14 */
65 /*************************************************************************/
66
67 #include "cs_defs.h" /* Common service constants */
68 #include "tc_defs.h" /* Thread control constants */
69
70
71 /* Check to see if the file has been included already. */
72
73 #ifndef DM_DEFS
74 #define DM_DEFS
75
76
77 /* Adjust a size to something that is evenly divisible by the number of bytes
78 in an UNSIGNED data type. */
79
80 #define DM_ADJUSTED_SIZE(size) \
81 ((((size) + sizeof(UNSIGNED) - 1)/sizeof(UNSIGNED)) * sizeof(UNSIGNED))
82
83 #define DM_ADJUSTED_ALIGNMENT(alignment) DM_ADJUSTED_SIZE(alignment)
84
85 /* Define constants local to this component. */
86
87 #define DM_DYNAMIC_ID 0x44594e41UL
88 #define DM_OVERHEAD ((sizeof(DM_HEADER) + sizeof(UNSIGNED) \
89 - 1)/sizeof(UNSIGNED)) * \
90 sizeof(UNSIGNED)
91
92
93 /* Define the Dynamic Pool Control Block data type. */
94
95 typedef struct DM_PCB_STRUCT
96 {
97 CS_NODE dm_created; /* Node for linking to */
98 /* created dynamic pools */
99 TC_PROTECT dm_protect; /* Protection structure */
100 UNSIGNED dm_id; /* Internal PCB ID */
101 CHAR dm_name[NU_MAX_NAME]; /* Dynamic Pool name */
102 VOID *dm_start_address; /* Starting pool address */
103 UNSIGNED dm_pool_size; /* Size of pool */
104 UNSIGNED dm_min_allocation; /* Minimum allocate size */
105 UNSIGNED dm_available; /* Total available bytes */
106 struct DM_HEADER_STRUCT
107 *dm_memory_list; /* Memory list */
108 struct DM_HEADER_STRUCT
109 *dm_search_ptr; /* Search pointer */
110 BOOLEAN dm_fifo_suspend; /* Suspension type flag */
111 #if PAD_1
112 DATA_ELEMENT dm_padding[PAD_1];
113 #endif
114 UNSIGNED dm_tasks_waiting; /* Number of waiting tasks*/
115 struct DM_SUSPEND_STRUCT
116 *dm_suspension_list; /* Suspension list */
117 } DM_PCB;
118
119
120 /* Define the header structure that is in front of each memory block. */
121
122 typedef struct DM_HEADER_STRUCT
123 {
124 struct DM_HEADER_STRUCT
125 *dm_next_memory, /* Next memory block */
126 *dm_previous_memory; /* Previous memory block */
127 BOOLEAN dm_memory_free; /* Memory block free flag */
128 #if PAD_1
129 DATA_ELEMENT dm_padding[PAD_1];
130 #endif
131 DM_PCB *dm_memory_pool; /* Dynamic pool pointer */
132 } DM_HEADER;
133
134
135 /* Define the dynamic memory suspension structure. This structure is
136 allocated off of the caller's stack. */
137
138 typedef struct DM_SUSPEND_STRUCT
139 {
140 CS_NODE dm_suspend_link; /* Link to suspend blocks */
141 DM_PCB *dm_memory_pool; /* Pointer to pool */
142 UNSIGNED dm_request_size; /* Size of memory request */
143 TC_TCB *dm_suspended_task; /* Task suspended */
144 VOID *dm_return_pointer; /* Return memory address */
145 STATUS dm_return_status; /* Return status */
146 } DM_SUSPEND;
147
148 #endif
149
150
151
152
153