提交 363c9b14 编写于 作者: T tyustli

[bsp] [stm32] fix drv_can.c and can.c bug

上级 200f3d44
......@@ -515,7 +515,11 @@ static int _can_recvmsg(struct rt_can_device *can, void *buf, rt_uint32_t fifo)
/* get len */
pmsg->len = rxheader.DLC;
/* get hdr */
#ifdef BSP_USING_CAN2
pmsg->hdr = rxheader.FilterMatchIndex;
#else
pmsg->hdr = (rxheader.FilterMatchIndex + 1) >> 1;
#endif
return RT_EOK;
}
......
......@@ -853,8 +853,11 @@ void rt_hw_can_isr(struct rt_can_device *can, int event)
level = rt_hw_interrupt_disable();
rx_length = can->hdr[hdr].msgs * sizeof(struct rt_can_msg);
rt_hw_interrupt_enable(level);
if (rx_length)
{
can->hdr[hdr].filter.ind(&can->parent, can->hdr[hdr].filter.args, hdr, rx_length);
}
}
else
#endif
{
......@@ -867,9 +870,12 @@ void rt_hw_can_isr(struct rt_can_device *can, int event)
rx_length = rt_list_len(&rx_fifo->uselist)* sizeof(struct rt_can_msg);
rt_hw_interrupt_enable(level);
if (rx_length)
{
can->parent.rx_indicate(&can->parent, rx_length);
}
}
}
break;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册