Rev 1002 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1002 | Rev 1026 | ||
---|---|---|---|
Line 41... | Line 41... | ||
41 | 41 | ||
42 | struct mem_block |
42 | struct mem_block |
43 | { |
43 | { |
44 | struct mem_block *next; |
44 | struct mem_block *next; |
45 | struct mem_block *prev; |
45 | struct mem_block *prev; |
46 | u32_t start; |
46 | addr_t start; |
47 | size_t size; |
47 | size_t size; |
Line 48... | Line 48... | ||
48 | }; |
48 | }; |
49 | 49 | ||
Line 166... | Line 166... | ||
166 | int base = rhdPtr->FbFreeStart; |
166 | int base = rhdPtr->FbFreeStart; |
Line 167... | Line 167... | ||
167 | 167 | ||
168 | return init_heap(&rhdPtr->fb_heap, base, rhdPtr->FbFreeSize); |
168 | return init_heap(&rhdPtr->fb_heap, base, rhdPtr->FbFreeSize); |
Line 169... | Line 169... | ||
169 | }; |
169 | }; |
170 | 170 | ||
171 | void *rhd_mem_alloc(RHDPtr rhdPtr,int region, int size) |
171 | addr_t rhd_mem_alloc(RHDPtr rhdPtr,int region, int size) |
Line 172... | Line 172... | ||
172 | { |
172 | { |
173 | struct mem_block *block, **heap; |
173 | struct mem_block *block, **heap; |
174 | 174 | ||
Line 175... | Line 175... | ||
175 | heap = get_heap(rhdPtr, region); |
175 | heap = get_heap(rhdPtr, region); |
176 | if (!heap || !*heap) |
176 | if (!heap || !*heap) |
177 | return NULL; |
177 | return 0; |
Line 178... | Line 178... | ||
178 | 178 | ||
Line 179... | Line 179... | ||
179 | /* Make things easier on ourselves: all allocations at least |
179 | /* Make things easier on ourselves: all allocations at least |
Line 180... | Line 180... | ||
180 | * 4k aligned. |
180 | * 4k aligned. |
181 | */ |
181 | */ |
Line 182... | Line 182... | ||
182 | 182 | ||
183 | size = (size+4095) & ~4095; |
183 | size = (size+4095) & ~4095; |
Line 184... | Line 184... | ||
184 | 184 | ||
185 | block = alloc_block(*heap, size); |
185 | block = alloc_block(*heap, size); |
186 | 186 | ||
Line 187... | Line 187... | ||
187 | if (!block) |
187 | if (!block) |
188 | return NULL; |
188 | return 0; |