summaryrefslogtreecommitdiffstats
path: root/cpukit/itron/include/itronsys/fmempool.h
blob: fa72c8eb31f3e055a39b895f08a24d60645011c0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/*
 *  The license and distribution terms for this file may be
 *  found in the file LICENSE in this distribution or at
 *  http://www.OARcorp.com/rtems/license.html.
 *
 *  $Id$
 */

#ifndef __ITRON_FIXED_MEMORYPOOL_h_
#define __ITRON_FIXED_MEMORYPOOL_h_

#ifdef __cplusplus
extern "C" {
#endif

/*
 *  Create Fixed Memory Pool (cre_mpf) Structure
 */

    /* cre_mpf */
typedef struct t_cmpf {
  VP    exinf;     /* extended information */
  ATR   mpfatr;    /* memorypool attributes */
  INT   mpfcnt;    /* block count for entire memorypool */
  INT   blfsz;     /* fixed-size memory block size */
  /* additional information may be included depending on the implementation */
} T_CMPF;

/*
 *  mpfatr
 */

#define TA_TFIFO   0x00   /* waiting tasks are handled by FIFO */
#define TA_TPRI    0x01   /* waiting tasks are handled by priority */


/*
 *  Reference Fixed Memory Pool (ref_mpf) Structure
 */

    /* ref_mpf */
typedef struct t_rmpf {
  VP        exinf;    /* extended information */
  BOOL_ID   wtsk;     /* indicates whether or not there are waiting tasks */
  INT       frbcnt;   /* free block count */
  /* additional information may be included depending on the implementation */
} T_RMPF;

/*
 *  Fixed Memory Pool Functions
 */

/*
 *  cre_mpf - Create Fixed-Size Memorypool
 */

ER cre_mpf(
  ID mpfid,
  T_CMPF *pk_cmpf
);

/*
 *  del_mpf - Delete Fixed-Size Memorypool
 */

ER del_mpf(
  ID mpfid
);

/*
 *  get_blf - Get Fixed-Size Memory Block
 */

ER get_blf(
  VP *p_blf,
  ID mpfid
);

/*
 *  pget_blf - Poll and Get Fixed-Size Memory Block
 */

ER pget_blf(
  VP *p_blf,
  ID mpfid
);

/*
 *  tget_blf - Get Fixed-Size Memory Block with Timeout
 */

ER tget_blf(
  VP *p_blf,
  ID mpfid,
  TMO tmout
);

/*
 *  rel_blf - Release Fixed-Size Memory Block
 */

ER rel_blf(
  ID mpfid,
  VP blf
);

/*
 *  ref_mpf - Reference Fixed-Size Memorypool Status
 */

ER ref_mpf(
  T_RMPF *pk_rmpf,
  ID mpfid
);

#ifdef __cplusplus
}
#endif

#endif
/* end of include file */