|
1 | | -/* |
2 | | -# _____ ___ ____ ___ ____ |
3 | | -# ____| | ____| | | |____| |
4 | | -# | ___| |____ ___| ____| | \ PS2DEV Open Source Project. |
5 | | -#----------------------------------------------------------------------- |
6 | | -# Copyright 2001-2004, ps2dev - http://www.ps2dev.org |
7 | | -# Licenced under Academic Free License version 2.0 |
8 | | -# Review ps2sdk README & LICENSE files for further details. |
9 | | -*/ |
10 | | - |
11 | | -/** |
12 | | - * @file |
13 | | - * Memory pool management |
14 | | - */ |
15 | | - |
16 | | -#ifndef __THPOOL_H__ |
17 | | -#define __THPOOL_H__ |
18 | | - |
19 | | -#include <types.h> |
20 | | -#include <irx.h> |
21 | | - |
22 | | -#ifdef __cplusplus |
23 | | -extern "C" { |
24 | | -#endif |
25 | | - |
26 | | -// Fixed-length pool attributes |
27 | | -#define FA_THFIFO 0x000 |
28 | | -#define FA_THPRI 0x001 |
29 | | -#define FA_MEMBTM 0x200 |
30 | | - |
31 | | -/* |
32 | | - * Fixed length memory pool |
33 | | - */ |
34 | | - |
35 | | -typedef struct _iop_fpl_param |
36 | | -{ |
37 | | - unsigned int attr; |
38 | | - unsigned int option; |
39 | | - int block_size; |
40 | | - int blocks; |
41 | | -} iop_fpl_param; |
42 | | - |
43 | | -typedef struct _iop_fpl_info |
44 | | -{ |
45 | | - unsigned int attr; |
46 | | - unsigned int option; |
47 | | - int blockSize; |
48 | | - int numBlocks; |
49 | | - int freeBlocks; |
50 | | - int numWaitThreads; |
51 | | - int reserved[4]; |
52 | | -} iop_fpl_info_t; |
53 | | - |
54 | | -extern int CreateFpl(iop_fpl_param *param); |
55 | | -extern int DeleteFpl(int fplId); |
56 | | -extern void *AllocateFpl(int fplId); |
57 | | -extern void *pAllocateFpl(int fplId); |
58 | | -extern void *ipAllocateFpl(int fplId); |
59 | | -extern int FreeFpl(int fplId, void *memory); |
60 | | -extern int ReferFplStatus(int fplId, iop_fpl_info_t *info); |
61 | | -extern int iReferFplStatus(int fplId, iop_fpl_info_t *info); |
62 | | - |
63 | | -#define thfpool_IMPORTS_start DECLARE_IMPORT_TABLE(thfpool, 1, 1) |
64 | | -#define thfpool_IMPORTS_end END_IMPORT_TABLE |
65 | | - |
66 | | -#define I_CreateFpl DECLARE_IMPORT(4, CreateFpl) |
67 | | -#define I_DeleteFpl DECLARE_IMPORT(5, DeleteFpl) |
68 | | -#define I_AllocateFpl DECLARE_IMPORT(6, AllocateFpl) |
69 | | -#define I_pAllocateFpl DECLARE_IMPORT(7, pAllocateFpl) |
70 | | -#define I_ipAllocateFpl DECLARE_IMPORT(8, ipAllocateFpl) |
71 | | -#define I_FreeFpl DECLARE_IMPORT(9, FreeFpl) |
72 | | -#define I_ReferFplStatus DECLARE_IMPORT(11, ReferFplStatus) |
73 | | -#define I_iReferFplStatus DECLARE_IMPORT(12, iReferFplStatus) |
74 | | - |
75 | | -/* |
76 | | - * Variable length memory pool |
77 | | - */ |
78 | | - |
79 | | -// Variable-length pool attributes |
80 | | -#define VA_THFIFO 0x000 |
81 | | -#define VA_THPRI 0x001 |
82 | | -#define VA_MEMBTM 0x200 |
83 | | - |
84 | | -typedef struct _iop_vpl_param |
85 | | -{ |
86 | | - unsigned int attr; |
87 | | - unsigned int option; |
88 | | - int size; |
89 | | -} iop_vpl_param; |
90 | | - |
91 | | -typedef struct _iop_vpl_info |
92 | | -{ |
93 | | - unsigned int attr; |
94 | | - unsigned int option; |
95 | | - int size; |
96 | | - int freeSize; |
97 | | - int numWaitThreads; |
98 | | - int reserved[3]; |
99 | | -} iop_vpl_info_t; |
100 | | - |
101 | | -extern int CreateVpl(iop_vpl_param *param); |
102 | | -extern int DeleteVpl(int vplId); |
103 | | -extern void *AllocateVpl(int vplId, int size); |
104 | | -extern void *pAllocateVpl(int vplId, int size); |
105 | | -extern void *ipAllocateVpl(int vplId, int size); |
106 | | -extern int FreeVpl(int vplId, void *memory); |
107 | | -extern int ReferVplStatus(int vplId, iop_vpl_info_t *info); |
108 | | -extern int iReferVplStatus(int vplId, iop_vpl_info_t *info); |
109 | | - |
110 | | -#define thvpool_IMPORTS_start DECLARE_IMPORT_TABLE(thvpool, 1, 1) |
111 | | -#define thvpool_IMPORTS_end END_IMPORT_TABLE |
112 | | - |
113 | | -#define I_CreateVpl DECLARE_IMPORT(4, CreateVpl) |
114 | | -#define I_DeleteVpl DECLARE_IMPORT(5, DeleteVpl) |
115 | | -#define I_AllocateVpl DECLARE_IMPORT(6, AllocateVpl) |
116 | | -#define I_pAllocateVpl DECLARE_IMPORT(7, pAllocateVpl) |
117 | | -#define I_ipAllocateVpl DECLARE_IMPORT(8, ipAllocateVpl) |
118 | | -#define I_FreeVpl DECLARE_IMPORT(9, FreeVpl) |
119 | | -#define I_ReferVplStatus DECLARE_IMPORT(11, ReferVplStatus) |
120 | | -#define I_iReferVplStatus DECLARE_IMPORT(12, iReferVplStatus) |
121 | | - |
122 | | -#ifdef __cplusplus |
123 | | -} |
124 | | -#endif |
125 | | - |
126 | | -#endif /* __THPOOL_H__ */ |
| 1 | +#include <thfpool.h> |
| 2 | +#include <thvpool.h> |
0 commit comments