comparison src/nucleus/erd.c @ 7:0f80e1e4dce4

src/nucleus: library C code import from FreeNucleus package
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 15 Jul 2018 20:57:33 +0000
parents
children
comparison
equal deleted inserted replaced
6:8b2a9a374324 7:0f80e1e4dce4
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 /* erd.c Nucleus PLUS 1.14 */
17 /* */
18 /* COMPONENT */
19 /* */
20 /* ER - Error Management */
21 /* */
22 /* DESCRIPTION */
23 /* */
24 /* This file contains global data structures for use within the */
25 /* Error Management component. */
26 /* */
27 /* DATA STRUCTURES */
28 /* */
29 /* ERD_Error_Code Contains the system error */
30 /* code */
31 /* ERD_Error_String Contains the ASCII system */
32 /* error string */
33 /* */
34 /* FUNCTIONS */
35 /* */
36 /* None */
37 /* */
38 /* DEPENDENCIES */
39 /* */
40 /* nucleus.h System 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 Modified copyright notice, */
49 /* resulting in version 1.1 */
50 /* */
51 /* 03-18-1994 Verified version 1.1 */
52 /* 04-17-1996 updated to version 1.2 */
53 /* 03-24-1998 Released version 1.3. */
54 /* 11-24-1998 Added ERD_Assert_Count. */
55 /* 03-26-1999 Released 1.11m (new release */
56 /* numbering scheme) */
57 /* 04-07-1999 Release 1.11mA */
58 /* 04-17-2002 Released version 1.13m */
59 /* 11-07-2002 Released version 1.14 */
60 /*************************************************************************/
61 #define NU_SOURCE_FILE
62
63 #include "nucleus.h" /* System definitions */
64
65
66 /* ERD_Error_Code contains the system error code detected by the system. */
67
68 INT ERD_Error_Code;
69
70 #ifdef NU_DEBUG
71
72 /* ERD_Assert_Count contains the number of detected failed assertions. */
73 UNSIGNED ERD_Assert_Count;
74
75 #endif
76
77
78 #ifdef NU_ERROR_STRING
79
80 /* ERD_Error_String is an area for building an ASCII string representation of
81 the system error. */
82
83 CHAR ERD_Error_String[80];
84
85 #endif
86
87 #ifdef NU_DEBUG_MEMORY
88
89 #include "er_defs.h"
90
91 /* NU_DEBUG_MEMORY wraps the calles to DMCE_Allocate_Memory and
92 DMCE_Deallocate_Memory with a set of calls that help track memory
93 problems in a memory pool. The memory pool that will be examined
94 is determined by the NU_MEMORY_POOL macro. */
95
96 /* The functions in NU_DEBUG_MEMORY require error checking.
97 NU_DEBUG_MEMORY can not be defined with NU_NO_ERROR_CHECKING */
98
99 #ifdef NU_NO_ERROR_CHECKING
100 #error Can not define NU_DEBUG_MEMORY and NU_NO_ERROR_CHECKING at the same time!
101 #endif /* NU_NO_ERROR_CHECKING */
102
103 #ifndef NU_DEBUG
104 #error NU_DEBUG must be defined when NU_DEBUG_MEMORY is enabled!
105 #endif /* NU_NO_ERROR_CHECKING */
106
107 /* ERD_AllocationCount is the current number of sucessful allocations that
108 have not been deallocated.
109 ERD_AllocationSequenceCounter identifies each successful allocation by
110 numbering them in the order they are created.
111 ERD_TotalMemoryAllocated is the number of sucessful calls to
112 NU_Allocate_Memory.
113 ERD_TotalMemoryAllocations is the sum of the sizes of each sucessful
114 allocation.
115 ERD_MaxTotalMemoryAllocated is the most memory ever allocated at any
116 point in time.
117 ERD_MaxTotalMemoryAllocations is the most outstanding memory allocations
118 (those that are not deallocated) at any point in time. */
119
120 UINT32 ERD_AllocationCount;
121 UINT32 ERD_AllocationSequenceCounter;
122 UINT32 ERD_TotalMemoryAllocated;
123 UINT32 ERD_TotalMemoryAllocations;
124 UINT32 ERD_MaxTotalMemoryAllocated;
125 UINT32 ERD_MaxTotalMemoryAllocations;
126
127 /* Constants to mark the header and footer */
128 const UINT8 ERD_MemoryAllocationHead[] = {'H','E','A','D'};
129 const UINT8 ERD_MemoryAllocationFoot[] = {'F','O','O','T'};
130
131 /* This is the head of a linked list that holds all the currently
132 outstanding allocations in reverse chronological order.
133 RED_RecentAllocation is the most recent. The 'prev' field always
134 points to the allocation made beforehand. */
135 ER_DEBUG_ALLOCATION *ERD_RecentAllocation;
136
137 #endif /* NU_DEBUG_MEMORY */
138
139
140
141
142