can驱动优化,支持发送失败后取消发送
This commit is contained in:
@ -154,6 +154,7 @@ rt_inline int _can_int_tx(struct rt_can_device *can, const struct rt_can_msg *da
|
||||
|
||||
no = ((rt_uint32_t)tx_tosnd - (rt_uint32_t)tx_fifo->buffer) / sizeof(struct rt_can_sndbxinx_list);
|
||||
tx_tosnd->result = RT_CAN_SND_RESULT_WAIT;
|
||||
rt_completion_init(&(tx_tosnd->completion));
|
||||
if (can->ops->sendmsg(can, data, no) != RT_EOK)
|
||||
{
|
||||
/* send failed. */
|
||||
@ -192,6 +193,8 @@ rt_inline int _can_int_tx(struct rt_can_device *can, const struct rt_can_msg *da
|
||||
err_ret:
|
||||
level = rt_hw_interrupt_disable();
|
||||
can->status.dropedsndpkg++;
|
||||
//TODO:发送失败,取消发送状态
|
||||
can->ops->control(can, RT_CAN_CMD_CANCEL, (void *)no);
|
||||
rt_hw_interrupt_enable(level);
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user