Lines Matching refs:ptr
30 static void *heap_caps_realloc_base( void *ptr, size_t size, uint32_t caps );
197 void* ptr = heap_caps_malloc_base(size, caps); in heap_caps_malloc() local
200 if (!ptr && size > 0){ in heap_caps_malloc()
204 return ptr; in heap_caps_malloc()
253 HEAP_IRAM_ATTR void *heap_caps_realloc_default( void *ptr, size_t size ) in heap_caps_realloc_default() argument
256 return heap_caps_realloc( ptr, size, MALLOC_CAP_DEFAULT | MALLOC_CAP_INTERNAL ); in heap_caps_realloc_default()
264 r=heap_caps_realloc_base( ptr, size, MALLOC_CAP_DEFAULT | MALLOC_CAP_INTERNAL); in heap_caps_realloc_default()
266 r=heap_caps_realloc_base( ptr, size, MALLOC_CAP_DEFAULT | MALLOC_CAP_SPIRAM); in heap_caps_realloc_default()
271 r=heap_caps_realloc_base( ptr, size, MALLOC_CAP_DEFAULT); in heap_caps_realloc_default()
309 HEAP_IRAM_ATTR void *heap_caps_realloc_prefer( void *ptr, size_t size, size_t num, ... ) in heap_caps_realloc_prefer() argument
317 r = heap_caps_realloc_base( ptr, size, caps ); in heap_caps_realloc_prefer()
360 HEAP_IRAM_ATTR static heap_t *find_containing_heap(void *ptr ) in find_containing_heap() argument
362 intptr_t p = (intptr_t)ptr; in find_containing_heap()
372 HEAP_IRAM_ATTR void heap_caps_free( void *ptr) in heap_caps_free() argument
374 if (ptr == NULL) { in heap_caps_free()
378 if (esp_ptr_in_diram_iram(ptr)) { in heap_caps_free()
382 uint32_t *dramAddrPtr = (uint32_t *)ptr; in heap_caps_free()
383 ptr = (void *)dramAddrPtr[-1]; in heap_caps_free()
386 heap_t *heap = find_containing_heap(ptr); in heap_caps_free()
388 multi_heap_free(heap->heap, ptr); in heap_caps_free()
390 CALL_HOOK(esp_heap_trace_free_hook, ptr); in heap_caps_free()
397 HEAP_IRAM_ATTR static void *heap_caps_realloc_base( void *ptr, size_t size, uint32_t caps) in heap_caps_realloc_base() argument
403 if (ptr == NULL) { in heap_caps_realloc_base()
408 heap_caps_free(ptr); in heap_caps_realloc_base()
418 if(esp_ptr_in_diram_iram((void *)ptr)) { in heap_caps_realloc_base()
419 uint32_t *dram_addr = (uint32_t *)ptr; in heap_caps_realloc_base()
431 heap = find_containing_heap(ptr); in heap_caps_realloc_base()
442 void *r = multi_heap_realloc(heap->heap, ptr, size); in heap_caps_realloc_base()
460 old_size = multi_heap_get_allocated_size(heap->heap, ptr); in heap_caps_realloc_base()
464 memcpy(new_p, ptr, MIN(size, old_size)); in heap_caps_realloc_base()
465 heap_caps_free(ptr); in heap_caps_realloc_base()
472 HEAP_IRAM_ATTR void *heap_caps_realloc( void *ptr, size_t size, uint32_t caps) in heap_caps_realloc() argument
474 ptr = heap_caps_realloc_base(ptr, size, caps); in heap_caps_realloc()
477 if (ptr == NULL && size > 0){ in heap_caps_realloc()
481 return ptr; in heap_caps_realloc()
506 void* ptr = heap_caps_calloc_base(n, size, caps); in heap_caps_calloc() local
509 if (!ptr && size > 0){ in heap_caps_calloc()
513 return ptr; in heap_caps_calloc()
650 size_t heap_caps_get_allocated_size( void *ptr ) in heap_caps_get_allocated_size() argument
652 heap_t *heap = find_containing_heap(ptr); in heap_caps_get_allocated_size()
654 size_t size = multi_heap_get_allocated_size(heap->heap, ptr); in heap_caps_get_allocated_size()
711 HEAP_IRAM_ATTR void heap_caps_aligned_free(void *ptr) in heap_caps_aligned_free() argument
713 heap_caps_free(ptr); in heap_caps_aligned_free()
723 void *ptr = heap_caps_aligned_alloc(alignment,size_bytes, caps); in heap_caps_aligned_calloc() local
724 if(ptr != NULL) { in heap_caps_aligned_calloc()
725 memset(ptr, 0, size_bytes); in heap_caps_aligned_calloc()
728 return ptr; in heap_caps_aligned_calloc()