Lines Matching full:ipm
12 #include <zephyr/drivers/ipm.h>
23 struct ipm_sedi_context *ipm = dev->data; in set_ipm_dev_busy() local
26 atomic_set_bit(&ipm->status, is_write ? IPM_WRITE_BUSY_BIT : IPM_READ_BUSY_BIT); in set_ipm_dev_busy()
33 struct ipm_sedi_context *ipm = dev->data; in clear_ipm_dev_busy() local
36 atomic_clear_bit(&ipm->status, is_write ? IPM_WRITE_BUSY_BIT : IPM_READ_BUSY_BIT); in clear_ipm_dev_busy()
37 if ((!atomic_test_bit(&ipm->status, IPM_WRITE_BUSY_BIT)) in clear_ipm_dev_busy()
38 && (!atomic_test_bit(&ipm->status, IPM_READ_BUSY_BIT))) { in clear_ipm_dev_busy()
47 struct ipm_sedi_context *ipm = dev->data; in ipm_event_dispose() local
53 if (ipm->rx_msg_notify_cb != NULL) { in ipm_event_dispose()
57 sedi_ipc_read_msg(device, ipm->incoming_data_buf, len); in ipm_event_dispose()
58 ipm->rx_msg_notify_cb(dev, in ipm_event_dispose()
59 ipm->rx_msg_notify_cb_data, in ipm_event_dispose()
60 drbl_in, ipm->incoming_data_buf); in ipm_event_dispose()
62 LOG_WRN("no handler for ipm new msg"); in ipm_event_dispose()
66 if (atomic_test_bit(&ipm->status, IPM_WRITE_IN_PROC_BIT)) { in ipm_event_dispose()
67 k_sem_give(&ipm->device_write_msg_sem); in ipm_event_dispose()
82 struct ipm_sedi_context *ipm = dev->data; in ipm_init() local
85 k_sem_init(&ipm->device_write_msg_sem, 0, 1); in ipm_init()
86 k_mutex_init(&ipm->device_write_lock); in ipm_init()
87 ipm->status = 0; in ipm_init()
90 atomic_set_bit(&ipm->status, IPM_PEER_READY_BIT); in ipm_init()
91 LOG_DBG("ipm driver initialized on device: %p", dev); in ipm_init()
122 struct ipm_sedi_context *ipm = dev->data; in ipm_sedi_send() local
129 LOG_ERR("bad params when sending ipm msg on device: %p", dev); in ipm_sedi_send()
134 LOG_ERR("not support no wait mode when sending ipm msg"); in ipm_sedi_send()
142 k_mutex_lock(&ipm->device_write_lock, K_FOREVER); in ipm_sedi_send()
145 if (!atomic_test_bit(&ipm->status, IPM_PEER_READY_BIT)) { in ipm_sedi_send()
156 LOG_ERR("ipm write data fail on device: %p", dev); in ipm_sedi_send()
162 atomic_set_bit(&ipm->status, IPM_WRITE_IN_PROC_BIT); in ipm_sedi_send()
167 LOG_ERR("ipm write doorbell fail on device: %p", dev); in ipm_sedi_send()
173 ret = k_sem_take(&ipm->device_write_msg_sem, K_MSEC(IPM_TIMEOUT_MS)); in ipm_sedi_send()
175 LOG_WRN("ipm write timeout on device: %p", dev); in ipm_sedi_send()
180 atomic_clear_bit(&ipm->status, IPM_WRITE_IN_PROC_BIT); in ipm_sedi_send()
184 k_mutex_unlock(&ipm->device_write_lock); in ipm_sedi_send()
186 LOG_DBG("ipm wrote a new message on device: %p, drbl=%08x", in ipm_sedi_send()
197 struct ipm_sedi_context *ipm = dev->data; in ipm_sedi_register_callback() local
200 LOG_ERR("bad params when add ipm callback on device: %p", dev); in ipm_sedi_register_callback()
204 if (ipm->rx_msg_notify_cb == NULL) { in ipm_sedi_register_callback()
205 ipm->rx_msg_notify_cb = cb; in ipm_sedi_register_callback()
206 ipm->rx_msg_notify_cb_data = user_data; in ipm_sedi_register_callback()
208 LOG_ERR("ipm rx callback already exists on device: %p", dev); in ipm_sedi_register_callback()
223 LOG_ERR("ipm send ack drl fail on device: %p", dev); in ipm_sedi_complete()
263 static DEVICE_API(ipm, ipm_funcs) = {
287 PM_DEVICE_DT_DEFINE(DT_NODELABEL(ipm##n), ipm_power_ctrl); \
290 PM_DEVICE_DT_GET(DT_NODELABEL(ipm##n)), \