void k_queue_init(struct k_queue *queue) { sys_slist_init(&queue->data_q); sys_dlist_init(&queue->wait_q); _INIT_OBJ_POLL_EVENT(queue); SYS_TRACING_OBJ_INIT(k_queue, queue); }
/* * Complete initialization of statically defined timers. */ static int init_timer_module(struct device *dev) { ARG_UNUSED(dev); struct k_timer *timer; for (timer = _k_timer_list_start; timer < _k_timer_list_end; timer++) { SYS_TRACING_OBJ_INIT(k_timer, timer); } return 0; }
/* * Complete initialization of statically defined queues. */ static int init_queue_module(struct device *dev) { ARG_UNUSED(dev); struct k_queue *queue; for (queue = _k_queue_list_start; queue < _k_queue_list_end; queue++) { SYS_TRACING_OBJ_INIT(k_queue, queue); } return 0; }
/* * Complete initialization of statically defined message queues. */ static int init_msgq_module(struct device *dev) { ARG_UNUSED(dev); struct k_msgq *msgq; for (msgq = _k_msgq_list_start; msgq < _k_msgq_list_end; msgq++) { SYS_TRACING_OBJ_INIT(k_msgq, msgq); } return 0; }
void k_pipe_init(struct k_pipe *pipe, unsigned char *buffer, size_t size) { pipe->buffer = buffer; pipe->size = size; pipe->bytes_used = 0; pipe->read_index = 0; pipe->write_index = 0; sys_dlist_init(&pipe->wait_q.writers); sys_dlist_init(&pipe->wait_q.readers); SYS_TRACING_OBJ_INIT(k_pipe, pipe); }
void k_msgq_init(struct k_msgq *q, char *buffer, size_t msg_size, u32_t max_msgs) { q->msg_size = msg_size; q->max_msgs = max_msgs; q->buffer_start = buffer; q->buffer_end = buffer + (max_msgs * msg_size); q->read_ptr = buffer; q->write_ptr = buffer; q->used_msgs = 0; sys_dlist_init(&q->wait_q); SYS_TRACING_OBJ_INIT(k_msgq, q); }
void k_timer_init(struct k_timer *timer, void (*expiry_fn)(struct k_timer *), void (*stop_fn)(struct k_timer *)) { timer->expiry_fn = expiry_fn; timer->stop_fn = stop_fn; timer->status = 0; sys_dlist_init(&timer->wait_q); _init_timeout(&timer->timeout, _timer_expiration_handler); SYS_TRACING_OBJ_INIT(k_timer, timer); timer->_legacy_data = NULL; }
void nano_timer_init(struct nano_timer *timer, void *data) { /* initialize timer in expired state */ timer->timeout_data.delta_ticks_from_prev = -1; /* initialize to no object to wait on */ timer->timeout_data.wait_q = NULL; /* initialize to no fiber waiting for the timer expire */ timer->timeout_data.tcs = NULL; /* nano_timer_test() returns NULL on timer that was not started */ timer->user_data = NULL; timer->user_data_backup = data; SYS_TRACING_OBJ_INIT(nano_timer, timer); }
/* * Do run-time initialization of pipe object subsystem. */ static int init_pipes_module(struct device *dev) { ARG_UNUSED(dev); #if (CONFIG_NUM_PIPE_ASYNC_MSGS > 0) /* * Create pool of asynchronous pipe message descriptors. * * A dummy thread requires minimal initialization, since it never gets * to execute. The _THREAD_DUMMY flag is sufficient to distinguish a * dummy thread from a real one. The threads are *not* added to the * kernel's list of known threads. * * Once initialized, the address of each descriptor is added to a stack * that governs access to them. */ for (int i = 0; i < CONFIG_NUM_PIPE_ASYNC_MSGS; i++) { async_msg[i].thread.thread_state = _THREAD_DUMMY; async_msg[i].thread.swap_data = &async_msg[i].desc; k_stack_push(&pipe_async_msgs, (u32_t)&async_msg[i]); } #endif /* CONFIG_NUM_PIPE_ASYNC_MSGS > 0 */ /* Complete initialization of statically defined mailboxes. */ #ifdef CONFIG_OBJECT_TRACING struct k_pipe *pipe; for (pipe = _k_pipe_list_start; pipe < _k_pipe_list_end; pipe++) { SYS_TRACING_OBJ_INIT(k_pipe, pipe); } #endif /* CONFIG_OBJECT_TRACING */ return 0; }
void nano_stack_init(struct nano_stack *stack, uint32_t *data) { stack->next = stack->base = data; stack->fiber = (struct tcs *)0; SYS_TRACING_OBJ_INIT(nano_stack, stack); }