Zephyr API Documentation 4.1.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
test_kheap_api.c File Reference
#include <zephyr/ztest.h>
#include <zephyr/irq_offload.h>
#include "test_kheap.h"

Macros

#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACK_SIZE)
 
#define ALLOC_SIZE_1   1024
 
#define ALLOC_SIZE_2   1536
 
#define ALLOC_SIZE_3   2049
 
#define CALLOC_NUM   256
 
#define CALLOC_SIZE   sizeof(uint32_t)
 

Functions

 K_THREAD_STACK_DEFINE (tstack,(512+CONFIG_TEST_EXTRA_STACK_SIZE))
 
 K_HEAP_DEFINE (k_heap_test, 2048)
 
static void tIsr_kheap_alloc_nowait (void *data)
 
static void thread_alloc_heap (void *p1, void *p2, void *p3)
 
static void thread_alloc_heap_null (void *p1, void *p2, void *p3)
 
 K_HEAP_DEFINE (tiny_heap, 1)
 
void test_k_heap_min_size (void)
 Test a minimum-size static k_heap.
 
void test_k_heap_alloc (void)
 Test to demonstrate k_heap_alloc() and k_heap_free() API usage.
 
void test_k_heap_alloc_fail (void)
 Test to demonstrate k_heap_alloc() and k_heap_free() API usage.
 
void test_k_heap_free (void)
 Test to demonstrate k_heap_free() API functionality.
 
void test_kheap_alloc_in_isr_nowait (void)
 Validate allocation and free heap memory in isr context.
 
void test_k_heap_alloc_pending (void)
 Validate the k_heap support wait between different threads.
 
void test_k_heap_alloc_pending_null (void)
 Validate the k_heap alloc_pending_null support.
 
void test_k_heap_calloc (void)
 Test to demonstrate k_heap_calloc() and k_heap_free() API usage.
 

Variables

struct k_thread tdata
 
volatile uint32_t heap_guard0
 
volatile uint32_t heap_guard1
 

Macro Definition Documentation

◆ ALLOC_SIZE_1

#define ALLOC_SIZE_1   1024

◆ ALLOC_SIZE_2

#define ALLOC_SIZE_2   1536

◆ ALLOC_SIZE_3

#define ALLOC_SIZE_3   2049

◆ CALLOC_NUM

#define CALLOC_NUM   256

◆ CALLOC_SIZE

#define CALLOC_SIZE   sizeof(uint32_t)

◆ STACK_SIZE

#define STACK_SIZE   (512 + CONFIG_TEST_EXTRA_STACK_SIZE)

Function Documentation

◆ K_HEAP_DEFINE() [1/2]

K_HEAP_DEFINE ( k_heap_test ,
2048  )

◆ K_HEAP_DEFINE() [2/2]

K_HEAP_DEFINE ( tiny_heap ,
1  )

◆ K_THREAD_STACK_DEFINE()

K_THREAD_STACK_DEFINE ( tstack ,
(512+CONFIG_TEST_EXTRA_STACK_SIZE)  )

◆ thread_alloc_heap()

static void thread_alloc_heap ( void * p1,
void * p2,
void * p3 )
static

◆ thread_alloc_heap_null()

static void thread_alloc_heap_null ( void * p1,
void * p2,
void * p3 )
static

◆ tIsr_kheap_alloc_nowait()

static void tIsr_kheap_alloc_nowait ( void * data)
static

Variable Documentation

◆ heap_guard0

volatile uint32_t heap_guard0

◆ heap_guard1

volatile uint32_t heap_guard1

◆ tdata

struct k_thread tdata