ca0872c2ea551fc20929f4e6be77c2a2f5e51407
[open-ath9k-htc-firmware.git] / target_firmware / magpie_fw_dev / target / inc / k2 / allocram_api.h
1 /*
2  * Copyright (c) 2007  Atheros Communications, Inc.  All rights reserved.
3  */
4
5 #ifndef __ALLOCRAM_API_H__
6 #define __ALLOCRAM_API_H__
7
8 /* API for Target-side startup-time RAM allocations */
9
10 struct allocram_api {
11         /*
12          * Initialize allocram, providing it with a block of RAM
13          * (an "arena") from which to allocate.
14          *
15          * If arena_start is 0, a default start -- the end of
16          * the application's text & data -- is used.
17          *
18          * If arena_sz is 0, a default size -- which uses most
19          * of physical RAM beyond arena_start -- is used.
20          *
21          * Return value is reserved for future use -- it's an arena handle.
22          */
23         void *(* cmnos_allocram_init)(void *arena_start, A_UINT32 arena_sz);
24
25         /*
26          * Allocate nbytes of memory, returning a pointer to the start
27          * of the allocated block.  Allocation size is rounded up to the
28          * nearest A_CACHE_LINE_SIZE and the returned address similarly
29          * aligned.
30          *
31          * There is no need to check the return value from this function.
32          * A failure to satisfy a RAM allocation request is treated as a
33          * fatal error.
34          *
35          * Allocations are expected to occur only during startup; this
36          * API does not, for instance, guarantee atomicity with respect
37          * to allocations that might (foolishly) be attempted from
38          * interrupt handlers.
39          *
40          * The "which_arena" parameter is currently unused, and should
41          * be set to 0 -- only a single arena is currently supported.
42          */
43         void *(* cmnos_allocram)(void *which_arena, A_UINT32 nbytes);
44     
45         void (* cmnos_allocram_debug)(void);
46 };
47
48 extern void allocram_module_install(struct allocram_api *api);
49
50
51 #endif /* __ALLOCRAM_API_H__ */