Part Number:AM3352
Tool/software: Linux
Refer to SDK7.0
【problem description】
Step1、c_can send frames one by one, with no receiver.
Step2、call function c_can_close ( c_can.c) and function c_can_open repeatedly. Many times later, strange thing has happened as follow:
Program run: c_can_close(1216) -> c_can_close(1222) -> c_can_stop(758) -> c_can_isr(1156) -> c_can_isr(1164) -> c_can_isr(1156) -> c_can_isr(1164) -> c_can_isr(1156) -> c_can_isr(1164) -> ......
All interrupts are disabled, but c_can_isr is called with no stop, why??
program:
1216 static int c_can_close(struct net_device *dev)
1217 {
1218 struct c_can_priv *priv = netdev_priv(dev);
1219
1220 netif_stop_queue(dev);
1221 napi_disable(&priv->napi);
1222 c_can_stop(dev);
1223 free_irq(dev->irq, dev);
1224 close_candev(dev);
1225
1226 c_can_reset_ram(priv, false);
1227 c_can_pm_runtime_put_sync(priv);
1228
1229 can_led_event(dev, CAN_LED_EVENT_STOP);
1230
1231 return 0;
1232}
0752 static void c_can_stop(struct net_device *dev)
0753 {
0754 struct c_can_priv *priv = netdev_priv(dev);
0755
0756 /* disable all interrupts */
0757 c_can_enable_all_interrupts(priv, DISABLE_ALL_INTERRUPTS);
0758
0759 /* set the state as STOPPED */
0760 priv->can.state = CAN_STATE_STOPPED;
0761 }
1156 static irqreturn_t c_can_isr(int irq, void *dev_id)
1157 {
1158 struct net_device *dev = (struct net_device *)dev_id;
1159 struct c_can_priv *priv = netdev_priv(dev);
1160
1161 priv->irqstatus = priv->read_reg(priv, C_CAN_INT_REG);
1162 if (!priv->irqstatus)
1163 {
1164 return IRQ_NONE;
1165 }
1166
1167 /* disable all interrupts and schedule the NAPI */
1168 c_can_enable_all_interrupts(priv, DISABLE_ALL_INTERRUPTS);
1169 napi_schedule(&priv->napi);
1170 ltrace(priv->irqstatus);
1171 return IRQ_HANDLED;
1172 }