Lines Matching full:mbox
92 void k_mbox_init(struct k_mbox *mbox) in k_mbox_init() argument
94 z_waitq_init(&mbox->tx_msg_queue); in k_mbox_init()
95 z_waitq_init(&mbox->rx_msg_queue); in k_mbox_init()
96 mbox->lock = (struct k_spinlock) {}; in k_mbox_init()
99 k_obj_core_init_and_link(K_OBJ_CORE(mbox), &obj_type_mailbox); in k_mbox_init()
102 SYS_PORT_TRACING_OBJ_INIT(k_mbox, mbox); in k_mbox_init()
206 * @param mbox Pointer to the mailbox object.
215 static int mbox_message_put(struct k_mbox *mbox, struct k_mbox_msg *tx_msg, in mbox_message_put() argument
231 key = k_spin_lock(&mbox->lock); in mbox_message_put()
233 SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_mbox, message_put, mbox, timeout); in mbox_message_put()
235 _WAIT_Q_FOR_EACH(&mbox->rx_msg_queue, receiving_thread) { in mbox_message_put()
256 z_reschedule(&mbox->lock, key); in mbox_message_put()
260 SYS_PORT_TRACING_OBJ_FUNC_BLOCKING(k_mbox, message_put, mbox, timeout); in mbox_message_put()
266 int ret = z_pend_curr(&mbox->lock, key, NULL, K_FOREVER); in mbox_message_put()
268 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_mbox, message_put, mbox, timeout, ret); in mbox_message_put()
276 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_mbox, message_put, mbox, timeout, -ENOMSG); in mbox_message_put()
278 k_spin_unlock(&mbox->lock, key); in mbox_message_put()
285 z_pend_thread(sending_thread, &mbox->tx_msg_queue, K_FOREVER); in mbox_message_put()
286 k_spin_unlock(&mbox->lock, key); in mbox_message_put()
290 SYS_PORT_TRACING_OBJ_FUNC_BLOCKING(k_mbox, message_put, mbox, timeout); in mbox_message_put()
293 int ret = z_pend_curr(&mbox->lock, key, &mbox->tx_msg_queue, timeout); in mbox_message_put()
295 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_mbox, message_put, mbox, timeout, ret); in mbox_message_put()
300 int k_mbox_put(struct k_mbox *mbox, struct k_mbox_msg *tx_msg, in k_mbox_put() argument
306 SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_mbox, put, mbox, timeout); in k_mbox_put()
308 int ret = mbox_message_put(mbox, tx_msg, timeout); in k_mbox_put()
310 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_mbox, put, mbox, timeout, ret); in k_mbox_put()
316 void k_mbox_async_put(struct k_mbox *mbox, struct k_mbox_msg *tx_msg, in k_mbox_async_put() argument
321 SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_mbox, async_put, mbox, sem); in k_mbox_async_put()
335 (void)mbox_message_put(mbox, &async->tx_msg, K_FOREVER); in k_mbox_async_put()
336 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_mbox, async_put, mbox, sem); in k_mbox_async_put()
387 int k_mbox_get(struct k_mbox *mbox, struct k_mbox_msg *rx_msg, void *buffer, in k_mbox_get() argument
399 key = k_spin_lock(&mbox->lock); in k_mbox_get()
401 SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_mbox, get, mbox, timeout); in k_mbox_get()
403 _WAIT_Q_FOR_EACH(&mbox->tx_msg_queue, sending_thread) { in k_mbox_get()
410 k_spin_unlock(&mbox->lock, key); in k_mbox_get()
415 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_mbox, get, mbox, timeout, result); in k_mbox_get()
423 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_mbox, get, mbox, timeout, -ENOMSG); in k_mbox_get()
426 k_spin_unlock(&mbox->lock, key); in k_mbox_get()
430 SYS_PORT_TRACING_OBJ_FUNC_BLOCKING(k_mbox, get, mbox, timeout); in k_mbox_get()
434 result = z_pend_curr(&mbox->lock, key, &mbox->rx_msg_queue, timeout); in k_mbox_get()
441 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_mbox, get, mbox, timeout, result); in k_mbox_get()
457 STRUCT_SECTION_FOREACH(k_mbox, mbox) { in init_mailbox_obj_core_list()
458 k_obj_core_init_and_link(K_OBJ_CORE(mbox), &obj_type_mailbox); in init_mailbox_obj_core_list()