This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] Linux/AM3352:调用 AM335x c_CAN_ISR、不会停止

Guru**** 2553450 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/601094/linux-am3352-am335x-c_can_isr-is-called-with-no-stop

器件型号:AM3352

工具/软件:Linux

请参阅 SDK7.0
【问题描述】

Step1、c_can 逐一发送 帧、但没有接收器。

Step2、反复调用函数 c_CAN_close (c_CAN.c)和函数 c_CAN_open。  许多次之后、下面发生了奇怪的事情:

程序运行: c_CAN_Close (1216)-> c_CAN_Close (1222)-> c_CAN_STOP (758)-> c_CAN_ISR (1156)-> c_CAN_ISR (1164)-> c_CAN_ISR (1164)-> c_CAN_ISR (1156)-> c_CAN_ISR (1164)-> c_ISR_1156 (cCAN)-> CAN_ISR (1164)

所有中断被禁用、但调用 c_CAN_ISR 时没有停止、原因是什么?

计划:

1216静态 int c_CAN_close (struct net_device *dev)
1217{
1218 struct c_co_priv_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 (privc);
1228.
1229 CAN_LED_EVENT (DEV、CAN_LED_EVENT_STOP);
1230
1231返回0;
1232}

0752静态空 c_CAN_stop (struct net_device *dev)
0753{
0754 struct c_CAN_priv* priv= netdev_priv(开发);
075
0756 /*禁用所有中断*/
0757 c_CAN_enable_all_interrupts (privc、disable_all_interrupts);
0758.
0759 /*将状态设置为已停止*/
0760 priv->CAN.state = CAN_State_Stopped;
0761}

1156静态 irqreturn_t c_CAN_ISR (int IRQ、void *dev_id)
1157{
1158 struct net_device *dev =(struct net_device *) dev_id;
1159 struct c_co_priv_priv* priv= netdev_priv(dev);
1160
1161 priv->irqstatus = priv->read_reg (priv, C_CAN_INT_REG);
1162如果(!priv->irqstatus)
1163{
1164返回 IRQ_NONE;
1165}
1166.
1167 /*禁用所有中断并调度 NAPI */
1168 c_CAN_enable_all_interrupts (privc、disable_all_interrupts);
1169NAPI_SCHEDUT(&U)->NAPI);
1170 ltrace(priv->irqstatus);
1171返回 IRQ_Handled;
1172}

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    您好!

    是否可以共享以下 CAN 寄存器的值:
    0h CTL CAN 控制寄存器
    4小时(ES 错误和状态寄存器
    8h ERRC 错误计数器寄存器
    通道 BTR 位时序寄存器
    10h 内部 中断寄存器
    1通道 PERR 奇偶校验错误代码寄存器
    80h ABOTR 自动总线接通时间寄存器
    1E0h TIOC CAN TX IO 控制寄存器
    1E4h RIOC CAN RX IO 控制寄存器

    此致、
    Yordan
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好!

    1、代码:

    静态 irqreturn_t c_CAN_ISR (int IRQ、void * dev_id)

     struct net_device *dev =(struct net_device *) dev_id;
     struct c_co_priv_priv* priv= netdev_priv(dev);

     PRIV->irqstatus = priv->read_reg (priv, C_CAN_INT_REG);
     如果(!priv->irqstatus)
     {
           printk ("CTL %04x\n"、readw (priv->base + 0x00));
           printk ("%04x\n"、readw (priv->base + 0x04));
           printk ("%04x\n"、readw (priv->base + 0x08));
           printk ("%04x\n"、readw (priv->base + 0x0C));
           printk ("%04x\n"、readw (priv->base + 0x10));
           printk ("%04x\n"、readw (priv->base + 0x1C));
           printk ("%04x\n"、readw (priv->base + 0x80));
           printk ("%04x\n"、readw (priv->base + 0x1E0));
           printk ("%04x\n"、readw (priv->base + 0x1E4));
           返回 IRQ_NONE;
     } /*禁用所有中断并调度 NAPI */
     c_CAN_enable_all_interrupts (priv, disable_all_interrupts);
     napi_dschedule(&priv->NAPI);

     返回 IRQ_Handled;

    2、结果

    [5785.940885] CTL 0000
    [5785.943177] 0063
    [5785.945100]0080
    [5785.947023]1c0b.
    [5785.948946] 0000
    [5785.950868] 0000
    [5785.952796] 0000
    [5785.954720] 000e
    [5785.956649]0009.
    [5785.958597] CTL 0000
    [5785.960890] 0063
    [5785.962814]0080
    [5785.964740] 1 c0b
    [5785.966665] 0000
    [5785.968589] 0000
    [5785.970513] 0000
    [5785.972440]000e
    [5785.974365]0009.
    [5785.976311] CTL 0000
    [5785.978599]0063
    [5785.980523] 0080
    [5785.982445] 1c0b
    [5785.984368] 0000
    [5785.986292] 0000
    [5785.988218] 0000
    [5785.990142] 000c
    [5785.992065]0008.
    [5785.994009] CTL 0000
    [5785.996302] 0063
    [5785.998228]0080
    [5786.000155] 1c0b
    [5786.002083] 0000
    [5786.004004] 0000
    [5786.005925] 0000
    [5786.007850] 000e
    [5786.009774]0009.

    谢谢