Lines Matching refs:mbox
87 void k_mbox_init(struct k_mbox *mbox) in k_mbox_init() argument
89 z_waitq_init(&mbox->tx_msg_queue); in k_mbox_init()
90 z_waitq_init(&mbox->rx_msg_queue); in k_mbox_init()
91 mbox->lock = (struct k_spinlock) {}; in k_mbox_init()
94 k_obj_core_init_and_link(K_OBJ_CORE(mbox), &obj_type_mailbox); in k_mbox_init()
97 SYS_PORT_TRACING_OBJ_INIT(k_mbox, mbox); in k_mbox_init()
210 static int mbox_message_put(struct k_mbox *mbox, struct k_mbox_msg *tx_msg, in mbox_message_put() argument
226 key = k_spin_lock(&mbox->lock); in mbox_message_put()
228 SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_mbox, message_put, mbox, timeout); in mbox_message_put()
230 _WAIT_Q_FOR_EACH(&mbox->rx_msg_queue, receiving_thread) { in mbox_message_put()
251 z_reschedule(&mbox->lock, key); in mbox_message_put()
255 SYS_PORT_TRACING_OBJ_FUNC_BLOCKING(k_mbox, message_put, mbox, timeout); in mbox_message_put()
261 int ret = z_pend_curr(&mbox->lock, key, NULL, K_FOREVER); in mbox_message_put()
263 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_mbox, message_put, mbox, timeout, ret); in mbox_message_put()
271 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_mbox, message_put, mbox, timeout, -ENOMSG); in mbox_message_put()
273 k_spin_unlock(&mbox->lock, key); in mbox_message_put()
280 z_pend_thread(sending_thread, &mbox->tx_msg_queue, K_FOREVER); in mbox_message_put()
281 k_spin_unlock(&mbox->lock, key); in mbox_message_put()
285 SYS_PORT_TRACING_OBJ_FUNC_BLOCKING(k_mbox, message_put, mbox, timeout); in mbox_message_put()
288 int ret = z_pend_curr(&mbox->lock, key, &mbox->tx_msg_queue, timeout); in mbox_message_put()
290 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_mbox, message_put, mbox, timeout, ret); in mbox_message_put()
295 int k_mbox_put(struct k_mbox *mbox, struct k_mbox_msg *tx_msg, in k_mbox_put() argument
301 SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_mbox, put, mbox, timeout); in k_mbox_put()
303 int ret = mbox_message_put(mbox, tx_msg, timeout); in k_mbox_put()
305 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_mbox, put, mbox, timeout, ret); in k_mbox_put()
311 void k_mbox_async_put(struct k_mbox *mbox, struct k_mbox_msg *tx_msg, in k_mbox_async_put() argument
316 SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_mbox, async_put, mbox, sem); in k_mbox_async_put()
330 (void)mbox_message_put(mbox, &async->tx_msg, K_FOREVER); in k_mbox_async_put()
331 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_mbox, async_put, mbox, sem); in k_mbox_async_put()
382 int k_mbox_get(struct k_mbox *mbox, struct k_mbox_msg *rx_msg, void *buffer, in k_mbox_get() argument
394 key = k_spin_lock(&mbox->lock); in k_mbox_get()
396 SYS_PORT_TRACING_OBJ_FUNC_ENTER(k_mbox, get, mbox, timeout); in k_mbox_get()
398 _WAIT_Q_FOR_EACH(&mbox->tx_msg_queue, sending_thread) { in k_mbox_get()
405 k_spin_unlock(&mbox->lock, key); in k_mbox_get()
410 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_mbox, get, mbox, timeout, result); in k_mbox_get()
418 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_mbox, get, mbox, timeout, -ENOMSG); in k_mbox_get()
421 k_spin_unlock(&mbox->lock, key); in k_mbox_get()
425 SYS_PORT_TRACING_OBJ_FUNC_BLOCKING(k_mbox, get, mbox, timeout); in k_mbox_get()
429 result = z_pend_curr(&mbox->lock, key, &mbox->rx_msg_queue, timeout); in k_mbox_get()
436 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_mbox, get, mbox, timeout, result); in k_mbox_get()
452 STRUCT_SECTION_FOREACH(k_mbox, mbox) { in init_mailbox_obj_core_list()
453 k_obj_core_init_and_link(K_OBJ_CORE(mbox), &obj_type_mailbox); in init_mailbox_obj_core_list()