Merge pull request #2998 from tyustli/can
[bsp] [stm32] fix drv_can.c and can.c bug
This commit is contained in:
commit
f87dd2e7c4
|
@ -515,7 +515,11 @@ static int _can_recvmsg(struct rt_can_device *can, void *buf, rt_uint32_t fifo)
|
||||||
/* get len */
|
/* get len */
|
||||||
pmsg->len = rxheader.DLC;
|
pmsg->len = rxheader.DLC;
|
||||||
/* get hdr */
|
/* get hdr */
|
||||||
|
#ifdef BSP_USING_CAN2
|
||||||
pmsg->hdr = rxheader.FilterMatchIndex;
|
pmsg->hdr = rxheader.FilterMatchIndex;
|
||||||
|
#else
|
||||||
|
pmsg->hdr = (rxheader.FilterMatchIndex + 1) >> 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
return RT_EOK;
|
return RT_EOK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -853,7 +853,10 @@ void rt_hw_can_isr(struct rt_can_device *can, int event)
|
||||||
level = rt_hw_interrupt_disable();
|
level = rt_hw_interrupt_disable();
|
||||||
rx_length = can->hdr[hdr].msgs * sizeof(struct rt_can_msg);
|
rx_length = can->hdr[hdr].msgs * sizeof(struct rt_can_msg);
|
||||||
rt_hw_interrupt_enable(level);
|
rt_hw_interrupt_enable(level);
|
||||||
can->hdr[hdr].filter.ind(&can->parent, can->hdr[hdr].filter.args, hdr, rx_length);
|
if (rx_length)
|
||||||
|
{
|
||||||
|
can->hdr[hdr].filter.ind(&can->parent, can->hdr[hdr].filter.args, hdr, rx_length);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
@ -867,7 +870,10 @@ 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);
|
rx_length = rt_list_len(&rx_fifo->uselist)* sizeof(struct rt_can_msg);
|
||||||
rt_hw_interrupt_enable(level);
|
rt_hw_interrupt_enable(level);
|
||||||
|
|
||||||
can->parent.rx_indicate(&can->parent, rx_length);
|
if (rx_length)
|
||||||
|
{
|
||||||
|
can->parent.rx_indicate(&can->parent, rx_length);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue