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.

[参考译文] TMS320C6657:以太网堆栈锁定如何通过 emacEnqueueTx() 函数中的 HwiP_disable() 禁用中断

Guru**** 2430620 points


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

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1529854/tms320c6657-ethernet-stack-lockup-how-to-disable-interrupts-via-hwip_disable-in-the-emacenqueuetx-function

部件号:TMS320C6657


工具/软件:

您好、

我们遇到了类似的情况、并希望作出此类修改以进行核查、但我们不确定具体的步骤。 我们没有在`emacEnqueueTx ()`函数中找到任何与中断相关的操作。 请您向我们提供详细的操作步骤。 非常感谢!

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

    您好、

    您可以尝试以下操作:

    1.包含“HWiP.h"头“头文件:#include

    2.修改代码如下:

    uintptr_t key;
    
    //Disable the interrupt
    key = HwiP_disable();
    
    //Existing Code/Test Code
    
    //Restore the interrupt
    HwiP_restore(key);

    为了便于参考、建议您浏览位于“pdk_c665x_2_0_16/packages/ti/osal/HwiP.h"的“的头文件“HwiP.h"</s>“

    此致、

    Betsy Varughese.

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

    您好、Betsy Varughese

    非常感谢您的迅速答复。 我会尽快进行验证、并希望它在我的项目中发挥作用。

    此致

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

    您好、

    请从您的结尾进行检查、并告诉我。

    此致、

    Betsy Varughese.

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

    大家好、我很高兴与大家分享我的最新进展。 虽然我没有根据此类修改执行验证、但在该解决方案的启发下、我们在检查 Nimu 驱动程序代码时发现异常。 我们使用第三方解决方案和代码、他们在 NIMU 驱动程序代码中添加了以下代码。 在我们进行验证之后、这是根本原因。

    我要再次向你表示衷心的感谢。

    我还要提醒遇到类似问题的其他人:首先、确保使用官方 EVM 和相关示例程;其次、如果您使用第三方代码、必须将其与官方代码进行比较以找出差异。

    static EMAC_DRV_ERR_E
    EmacSendPkt
    (
        EMAC_DATA*      ptr_pvt_data
    )
    {
        PBM_Handle hPkt;
        EMAC_DRV_ERR_E emac_send_status;
        register UINT8*     buffer;
        register uint       length;
        EMAC_PKT_DESC_T     pkt_desc;
        EMAC_PKT_QUEUE_T    *pq;
        EMAC_Pkt *pPktHdr;
    
        /* Checking for any queued packets to be transmitted */
    
        /* First check the Raw Packet Tx Queue. If there are any
        * pending packets in this queue, always transmit them
        * first over the IP packets.
        */
        hPkt = PBMQ_deq(&ptr_pvt_data->pdi.PBMQ_rawtx);
    
        /* Check if no raw packet to transmit and if any
        * IP packet to transmit. If no raw or IP packets to
        * transmit, set the "Transmitter Free" TxFree
        * flag for this device to 1.
        */
        if( !hPkt && !(hPkt = PBMQ_deq(&ptr_pvt_data->pdi.PBMQ_tx)) )
        {
            return EMAC_DRV_RESULT_SEND_ERR;
        }
    
        buffer = (Uint8 *)Convert_CoreLocal2GlobalAddr((uint32_t)(PBM_getDataBuffer(hPkt))) + PBM_getDataOffset(hPkt);
        length = PBM_getBufferLen(hPkt);
    
        /* Clean the cache for external addesses */
        if( ((UINT32)buffer & EMAC_EXTMEM) || ((UINT32)buffer & EMAC_MSMCMEM) )
            OEMCacheClean( (void *)buffer, length );
    
        pkt_desc.AppPrivate  = (Uint32)hPkt;
        pkt_desc.pPrev       = NULL;
        pkt_desc.pNext       = NULL;
        pkt_desc.pDataBuffer = (Uint8 *)Convert_CoreLocal2GlobalAddr((uint32_t)(PBM_getDataBuffer(hPkt)));
        pkt_desc.BufferLen   = PBM_getBufferLen(hPkt);
        pkt_desc.Flags       = EMAC_PKT_FLAG_SOP | EMAC_PKT_FLAG_EOP;
        pkt_desc.ValidLen    = PBM_getValidLen(hPkt);
        pkt_desc.DataOffset  = PBM_getDataOffset(hPkt);
        pkt_desc.PktChannel  = coreNum;
        pkt_desc.PktLength   = PBM_getValidLen(hPkt);
        pkt_desc.PktFrags    = 1;
    
        /*This piece of code is both the root cause and the key difference. 
        // while(1) {
        //     pq = (EMAC_PKT_QUEUE_T *)&EMAC_TX_QUEUE(NIMU_PORT_NUM_USED);
        //     pPktHdr = pq->pHead;
        //     if(pPktHdr)
        //         break;
        // }
        
    
        emac_send_status = emac_send(NIMU_PORT_NUM_USED, &pkt_desc);
        return emac_send_status;
    }