1 /* 2 * Copyright (c) 2025 Silicon Laboratories Inc. www.silabs.com 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 #include <zephyr/sys/sys_heap.h> 7 #include <zephyr/kernel.h> 8 9 static size_t i; 10 static struct sys_heap *heaps[CONFIG_SYS_HEAP_ARRAY_SIZE]; 11 sys_heap_array_save(struct sys_heap * heap)12int sys_heap_array_save(struct sys_heap *heap) 13 { 14 if (heap == NULL) { 15 return -EINVAL; 16 } 17 18 if (i < CONFIG_SYS_HEAP_ARRAY_SIZE) { 19 heaps[i++] = heap; 20 } else { 21 return -EINVAL; 22 } 23 24 return 0; 25 } 26 sys_heap_array_get(struct sys_heap *** heap)27int sys_heap_array_get(struct sys_heap ***heap) 28 { 29 if (heap == NULL) { 30 return -EINVAL; 31 } 32 33 *heap = heaps; 34 35 return i; 36 } 37