2 * Copyright (C) 2001-2003 by NBMK Encryption Technologies.
5 * NBMK Encryption Technologies provides no support of any kind for
6 * this software. Questions or concerns about it may be addressed to
7 * the members of the relevant open-source community at
8 * <tech-crypto@netbsd.org>.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above
18 * copyright notice, this list of conditions and the following
19 * disclaimer in the documentation and/or other materials provided
20 * with the distribution.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 /*****************************************************************************
36 * @(#) n8_manage_memory.h 1.7@(#)
37 *****************************************************************************/
39 /*****************************************************************************/
40 /** @file n8_manage_memory.h
41 * @brief Common definitions for NSP2000 Interface
43 * Common header file for memory management definitions for NSP2000 project
45 *****************************************************************************/
47 /*****************************************************************************
49 * 05/07/03 brr Reduced functions exposed to user space.
50 * 04/21/03 brr Added support for multiple memory banks.
51 * 07/02/02 brr Added structure for memory statistics.
52 * 06/25/02 brr Moved n8_memoryDisplay back to n8_memory.h.
53 * 06/03/02 hml initial version adapted from n8_memory.h
54 ****************************************************************************/
56 #ifndef N8_MANAGE_MEMORY_H
57 #define N8_MANAGE_MEMORY_H
60 #include "n8_pub_common.h"
61 #include "n8_pub_types.h"
63 #include "n8_OS_intf.h"
67 int sessionID
; /* 0 if free/non-zero process ID of allocater */
68 int numBlocks
; /* Number of contiguous blocks in this allocation */
69 int reqSize
; /* requested size (as opposed to allocated size ) */
73 /**********************************************************
74 The MemBankCtl_t structure describes everything about a
75 contiguous memory area that has been allocated by the
78 memBaseAddress-> ////////////////////////////
80 / MemBankCtl_t structure /
82 memCtlPtr-> ////////////////////////////
86 memBankPtr-> ////////////////////////////
89 / Allocatable memory /
93 ////////////////////////////
95 **********************************************************/
98 unsigned long memBaseAddress
; /* base phys address of entire block */
99 char *memBankPtr
; /* phys pointer to allocatable memory */
100 int allocSize
; /* Size of entire block */
101 int nextIndex
; /* next index to check */
102 n8_atomic_t curAllocated
; /* current total blocks allocated */
103 int maxAllocated
; /* max allocated since creation */
104 int failedAllocs
; /* failed alloc since creation */
105 int maxEntries
; /* number of blocks created */
106 unsigned long granularity
; /* size of each block in bytes */
107 unsigned int bankIndex
; /* The index of this bank */
108 n8_Lock_t allocationMapLock
; /* lock for this structure */
109 MemCtlList_t memCtlList
[0]; /* allocation map */
114 int sessionID
; /* Process ID of the allocater */
115 int curAllocated
; /* current number of blocks allocated */
116 int maxAllocated
; /* max allocated since creation */
117 int failedAllocs
; /* failed alloc since creation */
118 int maxEntries
; /* number of blocks in this pool */
122 unsigned long n8_pmalloc(int bank
,
124 unsigned long sessionID
);
125 void n8_pfree(int bank
, void *ptr
);
127 #endif /* N8_MANAGE_MEMORY_H */