unified: Eliminate k_stack_init_with_buffer()
Folds this API into k_stack_init() to provide a single API that requires the caller to pass in the stack buffer, just as is done for other kernel objects initialization APIs involving the use of a buffer. Change-Id: Icad5fd6e5387d634738d1574f8dfbc5421cd642d Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
This commit is contained in:
parent
399d0ad55a
commit
018cd9a656
3 changed files with 4 additions and 11 deletions
|
@ -420,9 +420,8 @@ struct k_stack {
|
||||||
_DEBUG_TRACING_KERNEL_OBJECTS_NEXT_PTR(k_stack);
|
_DEBUG_TRACING_KERNEL_OBJECTS_NEXT_PTR(k_stack);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void k_stack_init(struct k_stack *stack, int num_entries);
|
extern void k_stack_init(struct k_stack *stack,
|
||||||
extern void k_stack_init_with_buffer(struct k_stack *stack, int num_entries,
|
uint32_t *buffer, int num_entries);
|
||||||
uint32_t *buffer);
|
|
||||||
extern void k_stack_push(struct k_stack *stack, uint32_t data);
|
extern void k_stack_push(struct k_stack *stack, uint32_t data);
|
||||||
extern int k_stack_pop(struct k_stack *stack, uint32_t *data, int32_t timeout);
|
extern int k_stack_pop(struct k_stack *stack, uint32_t *data, int32_t timeout);
|
||||||
|
|
||||||
|
|
|
@ -630,7 +630,7 @@ static inline void *nano_lifo_get(struct nano_lifo *lifo,
|
||||||
|
|
||||||
static inline void nano_stack_init(struct nano_stack *stack, uint32_t *data)
|
static inline void nano_stack_init(struct nano_stack *stack, uint32_t *data)
|
||||||
{
|
{
|
||||||
k_stack_init_with_buffer(stack, UINT_MAX, data);
|
k_stack_init(stack, data, UINT_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define nano_stack_push k_stack_push
|
#define nano_stack_push k_stack_push
|
||||||
|
|
|
@ -27,8 +27,7 @@
|
||||||
#include <wait_q.h>
|
#include <wait_q.h>
|
||||||
#include <misc/__assert.h>
|
#include <misc/__assert.h>
|
||||||
|
|
||||||
void k_stack_init_with_buffer(struct k_stack *stack, int num_entries,
|
void k_stack_init(struct k_stack *stack, uint32_t *buffer, int num_entries)
|
||||||
uint32_t *buffer)
|
|
||||||
{
|
{
|
||||||
sys_dlist_init(&stack->wait_q);
|
sys_dlist_init(&stack->wait_q);
|
||||||
stack->next = stack->base = buffer;
|
stack->next = stack->base = buffer;
|
||||||
|
@ -37,11 +36,6 @@ void k_stack_init_with_buffer(struct k_stack *stack, int num_entries,
|
||||||
SYS_TRACING_OBJ_INIT(k_stack, stack);
|
SYS_TRACING_OBJ_INIT(k_stack, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
void k_stack_init(struct k_stack *stack, int num_entries)
|
|
||||||
{
|
|
||||||
k_stack_init_with_buffer(stack, num_entries, (uint32_t *)(stack + 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
void k_stack_push(struct k_stack *stack, uint32_t data)
|
void k_stack_push(struct k_stack *stack, uint32_t data)
|
||||||
{
|
{
|
||||||
struct k_thread *first_pending_thread;
|
struct k_thread *first_pending_thread;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue