|
|
@@ -968,15 +968,19 @@ rt_err_t rt_hw_can_register(struct rt_can_device *can,
|
|
|
*/
|
|
|
void rt_hw_can_isr(struct rt_can_device *can, int event)
|
|
|
{
|
|
|
+ rt_bool_t is_rxof_event = RT_FALSE;
|
|
|
+
|
|
|
switch (event & 0xff)
|
|
|
{
|
|
|
case RT_CAN_EVENT_RXOF_IND:
|
|
|
{
|
|
|
rt_base_t level;
|
|
|
+ is_rxof_event = RT_TRUE;
|
|
|
level = rt_hw_local_irq_disable();
|
|
|
can->status.dropedrcvpkg++;
|
|
|
rt_hw_local_irq_enable(level);
|
|
|
}
|
|
|
+ /* FALLTHROUGH: RX overflow still tries to fetch one pending frame into software FIFO. */
|
|
|
case RT_CAN_EVENT_RX_IND:
|
|
|
{
|
|
|
struct rt_can_msg tmpmsg;
|
|
|
@@ -1020,7 +1024,10 @@ void rt_hw_can_isr(struct rt_can_device *can, int event)
|
|
|
else if (!rt_list_isempty(&rx_fifo->uselist))
|
|
|
{
|
|
|
listmsg = rt_list_entry(rx_fifo->uselist.next, struct rt_can_msg_list, list);
|
|
|
- can->status.dropedrcvpkg++;
|
|
|
+ if (!is_rxof_event)
|
|
|
+ {
|
|
|
+ can->status.dropedrcvpkg++;
|
|
|
+ }
|
|
|
rt_list_remove(&listmsg->list);
|
|
|
#ifdef RT_CAN_USING_HDR
|
|
|
rt_list_remove(&listmsg->hdrlist);
|