diff options
Diffstat (limited to 'firmware/include')
-rw-r--r-- | firmware/include/chunk_alloc.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/firmware/include/chunk_alloc.h b/firmware/include/chunk_alloc.h index 7d64d4b591..ea9f6a64cb 100644 --- a/firmware/include/chunk_alloc.h +++ b/firmware/include/chunk_alloc.h | |||
@@ -28,16 +28,23 @@ | |||
28 | 28 | ||
29 | #define CHUNK_ALLOC_INVALID ((size_t)-1) | 29 | #define CHUNK_ALLOC_INVALID ((size_t)-1) |
30 | 30 | ||
31 | |||
31 | struct chunk_alloc_header | 32 | struct chunk_alloc_header |
32 | { | 33 | { |
34 | struct buflib_context *context; /* buflib context for all allocations */ | ||
35 | int chunk_handle; /* data handle of buflib allocated array of struct chunk */ | ||
36 | |||
33 | size_t chunk_bytes_total; /* total bytes in current chunk */ | 37 | size_t chunk_bytes_total; /* total bytes in current chunk */ |
34 | size_t chunk_bytes_free; /* free bytes in current chunk */ | 38 | size_t chunk_bytes_free; /* free bytes in current chunk */ |
35 | size_t chunk_size; /* default chunk size */ | 39 | size_t chunk_size; /* default chunk size */ |
36 | size_t count; /* total chunks possible */ | 40 | size_t count; /* total chunks possible */ |
37 | size_t current; /* current chunk in use */ | 41 | size_t current; /* current chunk in use */ |
38 | 42 | ||
39 | struct buflib_context *context; /* buflib context for all allocations */ | 43 | struct { |
40 | int chunk_handle; /* data handle of buflib allocated array of struct chunk */ | 44 | int handle; |
45 | size_t min_offset; | ||
46 | size_t max_offset; | ||
47 | } cached_chunk; | ||
41 | }; | 48 | }; |
42 | 49 | ||
43 | void chunk_alloc_free(struct chunk_alloc_header *hdr); | 50 | void chunk_alloc_free(struct chunk_alloc_header *hdr); |
@@ -55,7 +62,7 @@ size_t chunk_alloc(struct chunk_alloc_header *hdr, size_t size); /* Returns offs | |||
55 | 62 | ||
56 | void* chunk_get_data(struct chunk_alloc_header *hdr, size_t offset); /* Returns data */ | 63 | void* chunk_get_data(struct chunk_alloc_header *hdr, size_t offset); /* Returns data */ |
57 | 64 | ||
58 | void chunk_put_data(struct chunk_alloc_header *hdr, size_t offset); | 65 | void chunk_put_data(struct chunk_alloc_header *hdr, void* data, size_t offset); |
59 | 66 | ||
60 | static inline bool chunk_alloc_is_initialized(struct chunk_alloc_header *hdr) | 67 | static inline bool chunk_alloc_is_initialized(struct chunk_alloc_header *hdr) |
61 | { | 68 | { |