summaryrefslogtreecommitdiff
path: root/firmware/include
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/include')
-rw-r--r--firmware/include/chunk_alloc.h13
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
31struct chunk_alloc_header 32struct 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
43void chunk_alloc_free(struct chunk_alloc_header *hdr); 50void 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
56void* chunk_get_data(struct chunk_alloc_header *hdr, size_t offset); /* Returns data */ 63void* chunk_get_data(struct chunk_alloc_header *hdr, size_t offset); /* Returns data */
57 64
58void chunk_put_data(struct chunk_alloc_header *hdr, size_t offset); 65void chunk_put_data(struct chunk_alloc_header *hdr, void* data, size_t offset);
59 66
60static inline bool chunk_alloc_is_initialized(struct chunk_alloc_header *hdr) 67static inline bool chunk_alloc_is_initialized(struct chunk_alloc_header *hdr)
61{ 68{