File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -968,15 +968,19 @@ rt_err_t rt_hw_can_register(struct rt_can_device *can,
968968 */
969969void rt_hw_can_isr (struct rt_can_device * can , int event )
970970{
971+ rt_bool_t is_rxof_event = RT_FALSE ;
972+
971973 switch (event & 0xff )
972974 {
973975 case RT_CAN_EVENT_RXOF_IND :
974976 {
975977 rt_base_t level ;
978+ is_rxof_event = RT_TRUE ;
976979 level = rt_hw_local_irq_disable ();
977980 can -> status .dropedrcvpkg ++ ;
978981 rt_hw_local_irq_enable (level );
979982 }
983+ /* FALLTHROUGH: RX overflow still tries to fetch one pending frame into software FIFO. */
980984 case RT_CAN_EVENT_RX_IND :
981985 {
982986 struct rt_can_msg tmpmsg ;
@@ -1020,7 +1024,10 @@ void rt_hw_can_isr(struct rt_can_device *can, int event)
10201024 else if (!rt_list_isempty (& rx_fifo -> uselist ))
10211025 {
10221026 listmsg = rt_list_entry (rx_fifo -> uselist .next , struct rt_can_msg_list , list );
1023- can -> status .dropedrcvpkg ++ ;
1027+ if (!is_rxof_event )
1028+ {
1029+ can -> status .dropedrcvpkg ++ ;
1030+ }
10241031 rt_list_remove (& listmsg -> list );
10251032#ifdef RT_CAN_USING_HDR
10261033 rt_list_remove (& listmsg -> hdrlist );
You can’t perform that action at this time.
0 commit comments