Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions components/drivers/can/dev_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ rt_inline int _can_int_tx(struct rt_can_device *can, const struct rt_can_msg *da
no = ((rt_ubase_t)tx_tosnd - (rt_ubase_t)tx_fifo->buffer) / sizeof(struct rt_can_sndbxinx_list);
tx_tosnd->result = RT_CAN_SND_RESULT_WAIT;
rt_completion_init(&tx_tosnd->completion);
can->status.sndchange |= 1<<no;
if (can->ops->sendmsg(can, data, no) != RT_EOK)
{
/* send failed. */
Expand All @@ -196,7 +197,6 @@ rt_inline int _can_int_tx(struct rt_can_device *can, const struct rt_can_msg *da
goto err_ret;
}

can->status.sndchange |= 1<<no;
if (rt_completion_wait(&(tx_tosnd->completion), RT_CANSND_MSG_TIMEOUT) != RT_EOK)
{
level = rt_hw_local_irq_disable();
Expand Down Expand Up @@ -286,11 +286,12 @@ rt_inline int _can_int_tx_priv(struct rt_can_device *can, const struct rt_can_ms
tx_fifo->buffer[no].result = RT_CAN_SND_RESULT_WAIT;
rt_hw_local_irq_enable(level);

can->status.sndchange |= 1<<no;
if (can->ops->sendmsg(can, data, no) != RT_EOK)
{
continue;
}
can->status.sndchange |= 1<<no;

if (rt_completion_wait(&(tx_fifo->buffer[no].completion), RT_CANSND_MSG_TIMEOUT) != RT_EOK)
{
can->status.sndchange &= ~ (1<<no);
Expand Down
3 changes: 3 additions & 0 deletions components/drivers/include/drivers/dev_can.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ enum CANBAUD
#define RT_CAN_MODE_PRIV 0x01
#define RT_CAN_MODE_NOPRIV 0x00

#define RT_CAN_MODE_MASK 0x00
#define RT_CAN_MODE_LIST 0x01

/**
* @defgroup group_drivers_can CAN Driver
* @brief CAN driver api
Expand Down