source: svn/trunk/zas_dstar/hal/include/dsthalPsiMemChain.h @ 2

Last change on this file since 2 was 2, checked in by phkim, 11 years ago

1.phkim

  1. revision copy newcon3sk r27
File size: 2.2 KB
Line 
1/********************************************************************
2 *
3 * memchain.h - Utility for associating allocated memory
4 *
5 * Copyright 1997-2002 TeraLogic, Inc.
6 * All Rights Reserved
7 *
8 * memChainCreate:     Creates a memChain object.
9 *   (O) instance:     returns the memChain instance.
10 *   (I) memLimit:     Optionally limits the memory allocated with a
11 *                     memChain.  Set to 0xFFFFFFFF for no limit.
12 *
13 * memChainDestroy:    Destroys a memChain object.
14 *   (I) instance:     The memChain instance.
15 *
16 * memChainAlloc:      Allocates a memory block and associates it with
17 *                     the specified memChain object.
18 *   (I) instance:     The memChain instance.
19 *   (I) size:         Size of memory (in bytes) requested. 
20 *
21 * _Id: memchain.h,v 1.1 2002/06/10 17:20:08 tvogt Exp
22 ********************************************************************/
23
24#ifndef _memchain_h
25#define _memchain_h
26
27#include "dsthallocal.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif 
32
33
34
35
36/* user-defined malloc/free */
37typedef void* (*myMalloc_f) (unsigned int size, const char *strFunctionName, int nLine);
38typedef void (*myFree_f) (void *block, const char *strFunctionName, int nLine);
39
40/* memChain Setup Info */
41typedef struct memChainSetup {
42        DS_U32          memLimit;
43        myMalloc_f              Malloc;
44        myFree_f                Free;
45} memChainSetup_t, *memChainSetupPtr_t;
46
47typedef struct memChainHead* memId_t;
48
49/* API */
50#define memChainCreate(a, b)                            _memChainCreate((a), (b), __func__, __LINE__)
51#define memChainDestroy(a)                              _memChainDestroy((a), __func__, __LINE__)
52#define memChainAlloc(a, b)                             _memChainAlloc((a), (b),  __func__, __LINE__)
53
54DHL_RESULT _memChainCreate (memId_t *memId, memChainSetupPtr_t setupPtr, const char *func, int nLine);
55DHL_RESULT _memChainDestroy (memId_t memId, const char *func, int nLine);
56void* _memChainAlloc (memId_t memId, DS_U32 size, const char *func, int nLine);
57
58
59
60#ifdef __cplusplus
61}
62#endif 
63
64
65
66#endif /* _memchain_h */
67/********************************************************************
68 * _Log: memchain.h,v
69 * Revision 1.1  2002/06/10 17:20:08  tvogt
70 * First checkin of TL9xx Transport Driver
71 *
72 *
73 * TL8xx Derived Revision 1.6.12.1  2002/01/12 11:09:12  neelakan
74 ********************************************************************/
Note: See TracBrowser for help on using the repository browser.