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.

[参考译文] RM57L843:RM57L843:LwIP 示例问题-#2

Guru**** 2526700 points


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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1077988/rm57l843-rm57l843-questions-for-lwip-example---2

部件号:RM57L843

您好,

我的客户提到下面的 LwIP 演示示示例。
http://git.ti.com/hercules_examples/hercules_examples/trees/master/Application/LwIP

他希望在系统中实施 LwIP 代码,并有几个问题。
在下面的文件中,  
\Hercules_examples-master\Application\ActiveWebserver\1.1.0\examples\HDK\src\lwip_main.c

在第500行和之后,有 IRQ 中断处理程序。
他希望使用 FIQ 而不是 IRQ 来处理这些功能。

/*
** Interrupt Handler for Core 0 Receive interrupt
*/
volatile int countEMACCore0RxIsr = 0;
#pragma INTERRUPT(EMACCore0RxIsr, IRQ)
void EMACCore0RxIsr(void)
{
		countEMACCore0RxIsr++;
		lwIPRxIntHandler(0);
}

/*
** Interrupt Handler for Core 0 Transmit interrupt
*/
volatile int countEMACCore0TxIsr = 0;
#pragma INTERRUPT(EMACCore0TxIsr, IRQ)
void EMACCore0TxIsr(void)
{
	countEMACCore0TxIsr++;
    lwIPTxIntHandler(0);
}

void IntMasterIRQEnable(void)
{
	_enable_IRQ();
	return;
}

void IntMasterIRQDisable(void)
{
	_disable_IRQ();
	return;
}

队列
1)有 IntMasterIRQEnable()和 IntMasterIRQDisable()函数。
据客户称,他们似乎在 IRQ ISR 内被呼叫。
ISR 内部启用/禁用 IRQ 的原因是什么?

2)客户希望使用 FIQ,因此在 FIQ ISR 内启用/禁用 IRQ 不好。
如何修改这些代码以使用 FIQ 而不是 IRQ?

谢谢,还有雷格斯,
柯一朗·塔希罗

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

    您好 ,Koichiro San,

     ISR 中未调用 IntMasterIRQEnable()和 IntMasterIRQDisable()。 您能告诉我哪一家 ISR 称之为这两个功能? 谢谢

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

    QJ 您好,

    根据客户的说法,这些功能在下面的文件中被调用。
    \Hercules_examples-master\Application\LwIP\v00.04.00\lwip-1.4.1\ports\HDK\sys_arch.c

    sys_prot_t
    sys_arch_protect(void)
    {
      sys_prot_t status;
      status = (IntMasterStatusGet() & 0xFF);
    
      IntMasterIRQDisable();
      return status;
    }
    
    /**
     * This function is used to unlock access to critical sections when lwipopt.h
     * defines SYS_LIGHTWEIGHT_PROT. It enables interrupts if the value of the lev
     * parameter indicates that they were enabled when the matching call to
     * sys_arch_protect() was made.
     *
     * @param lev is the interrupt level when the matching protect function was
     * called
     */
    void
    sys_arch_unprotect(sys_prot_t lev)
    {
      /* Only turn interrupts back on if they were originally on when the matching
         sys_arch_protect() call was made. */
      if((lev & 0x80) == 0) {
        IntMasterIRQEnable();
      }
    }
    

    [引用 userid="45190" url="~ë/support/icls/arm-based 微处理器-组/基于 ARM 的微控制器/f/arm-based 微控制器- forum/1077988/rm57l843-rm57l843-question-for-lwip-example --2/399099996 (#39909999999999999999996"在 QMasterIRQInt[)中 不被调用且未启用。]

    您是否意味着这些函数被调用到 ISR 之外,因此即使使用了 FIQ,它们也可以保持不变?

    谢谢,此致,
    柯一朗·塔希罗

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

    QJ 您好,

    可以回答这个问题吗?

    谢谢,此致,
    柯一朗·塔希罗

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

    SYS_ARCH_unprotect ()

    SYS_ARCH_PROTECT ()

    这两个函数(sys_arch_unprotect()和  sys_arch_protect()) 仅在非常短的关键区域调用,并且只有在端口支持操作系统时才需要。

     不应在 IRQ ISR 内调用 sys_arch_unprotect()。 如果在 IRQ ISR 内调用,则必须在 ISR 结束前启用 ISR。  ARM Cortex-R4/5内核不支持一次使用多个 IRQ。 这主要 是因为它只有一个已保存的程序状态寄存器(SPSR)和一个链接寄存器(LR)寄存器。 如果 IRQ 被另一个 IRQ 中断,这些 CPU 寄存器将被覆盖(损坏),以后再也不可能恢复处理器状态。

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

    您好 ,Koichiro San,

    中断 ISR 中不需要区域保护,因为 IRQ 已被禁用。 您不需要在 IRQ ISR 中调用这两个函数。

    在 FIQ ISR 中,FIQ 和 IQ 都将自动禁用,因此不需要区域保护。  

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

    QJ 您好,

    如果客户想使用 FIQ 而不是 IRQ, 那么 sys_arch_unprotect()和 sys_arch_protect()都是简单的评论吗?

    谢谢,此致,
    柯一朗·塔希罗