@@ -46,6 +46,22 @@ extern char *z_setup_new_thread(struct k_thread *new_thread,
4646				void  * p1 , void  * p2 , void  * p3 ,
4747				int  prio , uint32_t  options , const  char  * name );
4848
49+ /** 
50+  * @brief Allocate aligned memory from the current thread's resource pool 
51+  * 
52+  * Threads may be assigned a resource pool, which will be used to allocate 
53+  * memory on behalf of certain kernel and driver APIs. Memory reserved 
54+  * in this way should be freed with k_free(). 
55+  * 
56+  * If called from an ISR, the k_malloc() system heap will be used if it exists. 
57+  * 
58+  * @param align Required memory alignment 
59+  * @param size Memory allocation size 
60+  * @return A pointer to the allocated memory, or NULL if there is insufficient 
61+  * RAM in the pool or there is no pool to draw memory from 
62+  */ 
63+ void  * z_thread_aligned_alloc (size_t  align , size_t  size );
64+ 
4965/** 
5066 * @brief Allocate some memory from the current thread's resource pool 
5167 * 
@@ -59,7 +75,10 @@ extern char *z_setup_new_thread(struct k_thread *new_thread,
5975 * @return A pointer to the allocated memory, or NULL if there is insufficient 
6076 * RAM in the pool or there is no pool to draw memory from 
6177 */ 
62- void  * z_thread_malloc (size_t  size );
78+ static  inline  void  * z_thread_malloc (size_t  size )
79+ {
80+ 	return  z_thread_aligned_alloc (0 , size );
81+ }
6382
6483/* set and clear essential thread flag */ 
6584
0 commit comments