| 73 | } |
| 74 | |
| 75 | rt_err_t rt_mbox_controller_unregister(struct rt_mbox_controller *ctrl) |
| 76 | { |
| 77 | struct rt_mbox_chan *chan; |
| 78 | |
| 79 | if (!ctrl) |
| 80 | { |
| 81 | return -RT_EINVAL; |
| 82 | } |
| 83 | |
| 84 | rt_spin_lock(&mbox_ops_lock); |
| 85 | |
| 86 | rt_dm_dev_unbind_fwdata(ctrl->dev, RT_NULL); |
| 87 | rt_list_remove(&ctrl->list); |
| 88 | |
| 89 | rt_spin_unlock(&mbox_ops_lock); |
| 90 | |
| 91 | chan = &ctrl->chans[0]; |
| 92 | |
| 93 | for (int i = ctrl->num_chans - 1; i >= 0; --i, ++chan) |
| 94 | { |
| 95 | rt_mbox_release(&ctrl->chans[i]); |
| 96 | } |
| 97 | |
| 98 | rt_free(ctrl->chans); |
| 99 | |
| 100 | return RT_EOK; |
| 101 | } |
| 102 | |
| 103 | rt_err_t rt_mbox_send(struct rt_mbox_chan *chan, const void *data, |
| 104 | rt_uint32_t timeout_ms) |
no test coverage detected