| Rev | Line | |
|---|
| [160] | 1 | #ifndef SRL_MEMSPACE_H |
|---|
| 2 | #define SRL_MEMSPACE_H |
|---|
| 3 | |
|---|
| 4 | /** |
|---|
| 5 | * @file |
|---|
| 6 | * @module{SRL} |
|---|
| 7 | * @short Memory resources |
|---|
| 8 | */ |
|---|
| 9 | |
|---|
| 10 | /** |
|---|
| 11 | @internal |
|---|
| 12 | */ |
|---|
| 13 | typedef struct srl_memspace_s { |
|---|
| 14 | void *buffer; |
|---|
| 15 | uint32_t size; |
|---|
| 16 | } srl_memspace_s; |
|---|
| 17 | |
|---|
| 18 | /** |
|---|
| 19 | The memspace abstract type. |
|---|
| 20 | */ |
|---|
| 21 | typedef struct srl_memspace_s *srl_memspace_t; |
|---|
| 22 | |
|---|
| 23 | #define SRL_MEMSPACE_INITIALIZER( b, s ) \ |
|---|
| 24 | {\ |
|---|
| 25 | .buffer = b,\ |
|---|
| 26 | .size = s,\ |
|---|
| 27 | } |
|---|
| 28 | |
|---|
| 29 | /** |
|---|
| 30 | @this retrieves the base address of a memspace |
|---|
| 31 | |
|---|
| 32 | @param memsp The memspace |
|---|
| 33 | @return the base address of the memspace |
|---|
| 34 | */ |
|---|
| 35 | #define SRL_MEMSPACE_ADDR(memsp) ((memsp)->buffer) |
|---|
| 36 | |
|---|
| 37 | /** |
|---|
| 38 | @this retrieves the size of a memspace |
|---|
| 39 | |
|---|
| 40 | @param memsp The memspace |
|---|
| 41 | @return the size of the memspace |
|---|
| 42 | */ |
|---|
| 43 | #define SRL_MEMSPACE_SIZE(memsp) ((memsp)->size) |
|---|
| 44 | |
|---|
| 45 | #endif |
|---|
Note: See
TracBrowser
for help on using the repository browser.