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.

[参考译文] TDA4VM:TDA4VM -如何在 R5F 内核上配置 RAT

Guru**** 2548520 points


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

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1012107/tda4vm-tda4vm---how-to-config-rat-on-r5f-core

器件型号:TDA4VM

你(们)好。

   我们发现 PDK PCIe drv 提供了在 R5F 上运行的示例代码、示例代码可以 PCIe0和 PCIe1控制器上正常工作。但是、当我们尝试在 PCIe 2控制器上使用示例代码时、它无法工作。由于 PCIe 2控制器"cfg"寄存器的地址通常为0x4400000000。、R5F 无法正常工作 访问地址超过32位。 我们发现 R5F 可以使用 RAT (基于区域的地址转换)来访问地址32位- 48位、但我们只能在 C66内核上找到 RAT 配置代码。

我们的 questios 是:如何在 R5F 上使用 RTA、您是否有配置 R5F RAT 的示例代码、如果您有、请向我们提供。

另一个问题:您是否在 PDK 代码中使用过 PCIe2控制? 我们能否将 PCIe2直接与 PDK PCIe drv 示例代码搭配使用?  

PCIe2_RC:PCIe@2920000{
      兼容="ti、j721e-pcie-host";
      REG =<0x00 0x02920000 0x00 0x1000>、
           0x00 0x02927000 0x00 0x400>、
           0x00 0x0e000000 0x00 0x00800000>、
           0x44 0x00000000 0x00 0x00001000>;
      reg-names ="intd_cfg"、"user_cfg"、"reg"、"cfg";
      TI、SYSCON-PCIe-Ctrl =<&PCIe2_Ctrl>;
      最大链路速度=<3>;
      通道数=<2>;

       一

谢谢

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

    您好!

    有关 RAT 配置、请参阅以下代码片段。 我添加了汇编版本、GEL 文件版本以及 c 代码版本。

    请注意、不同 R5F 内核的 RAT 模块不同、因此您需要从同一内核执行 RAT 配置。

    请注意、MCU R5和主 R5s 的 RAT 基址不同。 0x40F90000与0x0FF90000间的关系。

    您能否为 PCIe 问题创建另一个主题? 我们将请我们的 PCIe 专家来解决这一问题。 如果您发现 RAT 配置有问题、我们可以在该主题上继续。

    ;
    ;  Copyright (c) 2021, Texas Instruments Incorporated
    ;  All rights reserved.
    ; 
    ;  Redistribution and use in source and binary forms, with or without
    ;  modification, are permitted provided that the following conditions
    ;  are met:
    ; 
    ;  *  Redistributions of source code must retain the above copyright
    ;     notice, this list of conditions and the following disclaimer.
    ; 
    ;  *  Redistributions in binary form must reproduce the above copyright
    ;     notice, this list of conditions and the following disclaimer in the
    ;     documentation and/or other materials provided with the distribution.
    ; 
    ;  *  Neither the name of Texas Instruments Incorporated nor the names of
    ;     its contributors may be used to endorse or promote products derived
    ;     from this software without specific prior written permission.
    ; 
    ;  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    ;  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    ;  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    ;  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    ;  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    ;  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    ;  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    ;  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    ;  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    ;  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
    ;  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    ;
    ;
    ; ======== ratConf.asm ========
    ; Sets the RAT for the main domain to map 40-bit ocmram address to 32-bit space
    ;
        .text
        .sect   ".ratConf"
    ;==============================================================================
    ;   void ratConf( void )
    ;==============================================================================
        .global ti_sysbios_family_arm_v7r_keystone3_Hwi_vectors
    
        .global ratConf
    
    ratConf:
            .asmfunc
            push.w  {r0, r1, r5, r7}
            movw    r0, #0x0040
            movt    r0, #0x0FF9
            movw    r1, #0x0013
            movt    r1, #0x8000
            str     r1, [r0]
    
            movw    r1, #0x0000
            movt    r1, #0xD000
            str     r1, [r0, #0x4]
    
            movw    r1, #0x0000
            movt    r1, #0x0200
            str     r1, [r0, #0x8]
    
            movw    r1, #0x004F
            movt    r1, #0x0000
            str     r1, [r0, #0xc]
            pop.w   {r0, r1, r5, r7}
    
            beq     exit
    exit:
            bx      lr
            .endasmfunc
    
            .end
    

    等效 GEL 代码为:

    hotmenu Configure_RAT_50000000(){
            // region 1
                    GEL_TextOut( "Mapping MAIN OCM @ 0x4F_0200_0000 to 0xD000_0000\n");
            *(unsigned int *)(0x0FF90000 + 0x44) = 0xD0000000;  //IN ADDRESS
            *(unsigned int *)(0x0FF90000 + 0x48) = 0x02000000;  //OUT ADDRESS
            *(unsigned int *)(0x0FF90000 + 0x4C) = 0x0000004F;  //Upper 16 bits of the real physical address.
            *(unsigned int *)(0x0FF90000 + 0x40) = 0x80000013;
    }

    相关 C 代码:

    /* Check this header file for more info */
    #include <ti/csl/csl_rat.h>
    ...
    ...
    ...
    #if defined(SOC_J721E) && defined(MCU1_0)
    #define RAT_CFG_BASE_ADDR CSL_MCU_ARMSS_RAT_CFG_BASE
    #if defined(SOC_J721E) && defined(MCU2_0)
    #define RAT_CFG_BASE_ADDR CSL_ARMSS_RAT_CFG_BASE
    #endif
    ...
    ...
    ...
    void ratConf(void)
    {
        CSL_RatTranslationCfgInfo translationCfg;
    	
    	/* Add RAT configuration to access address > 32bit address range */
    	
    	/* Translated address returned on a successful match */
    	translationCfg.translatedAddress    = ADDR_GREATER_THAN_32_BIT;
    	/* Size of region in Bytes */
    	translationCfg.sizeInBytes          = SIZE_IN_BYTES;
    	/* 32-bit base address used in the address comparison */
    	translationCfg.baseAddress          = ADDR_32_BIT;
    
    	/* Set up RAT translation */
    	bool result = CSL_ratConfigRegionTranslation((CSL_ratRegs *)RAT_CFG_BASE_ADDR,
    												0U,
    												&translationCfg);
    	if (result == false)
    	{
    		sbl_puts("App: CSL_ratConfigRegionTranslation Failed! \n");
    	}
    	else
    	{
    		sbl_puts("App: CSL_ratConfigRegionTranslation Successful! \n");
    	}
    }

    此致、

    Karan

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

    您好、Karan Saxena:è s

          我使用了 GEL 代码、主 R5s RTA 运行良好。 但我仍然对参数"地址中"感到困惑。 它在使用 D0000000或0x8000000时工作良好、但在使用0x10000000时不工作、在配置 RAT 时会卡住。 "地址中"参数是否有任何要求?

    谢谢。

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

    您好!

    这可能是因为您需要设置 R5F MPU 来访问 IN 地址。 因此、如果您希望访问地址0x4F_0200_0000并将其映射到某些32位地址、则需要从 R5F 访问该32位地址。

    在您的情况下、您的 MPU 应该具有0x1000_0000的有效条目。

    此致、

    Karan