TMS320C6678开发笔记---SRIO例程2

15.5节  创龙例程tl-srio-test分析

15.5.1 工程分析

  • 工程介绍

tl-srio-test与tl-srio-target配合使用完成SRIO数据传输。创龙第二版6678资料包提供的例程,(第一版例程使用创龙自己写的SRIO寄存器操作函数,我认为可用性方面比较狭窄)相对第一版例程,第二版例程基于pdk_C6678_1_1_2_6包,可以更好的与TI的其他例程适配,此处也将调试经验写一下。

  • 程序逻辑如下:
  1. tl-srio-target只负责初始化SRIO,并未做其他操作
  2. tl-srio-test初始化SRIO后,使用NWrite命令向tl-srio-target发送数据,发送完成后,在tl-srio-target固定地址可以收到的数据。
  • 程序运行方法:
  1. 将tl-srio-test加载到dsp0的0核,tl-srio-target加载到dsp1 的0核
  2. 先运行dsp1的tl-srio-target,再运行dsp0的tl-srio-test
  • SRIOInit初始化代码如下:
static Int32 srio_device_init (void)
{
    UInt32             i, wait_time;
    UInt32             status;
    SRIO_PE_FEATURES   peFeatures;
    SRIO_OP_CAR        srcOPCAR;
    /* Get the CSL SRIO Handle. */
    hSrio = CSL_SRIO_Open(0);
    if(hSrio == NULL)
        return -1;
    if(CSL_chipReadReg(CSL_CHIP_DNUM) == CORE_SYS_INIT) {
        /* Code to disable SRIO reset isolation */
        if(CSL_PSC_isModuleResetIsolationEnabled(CSL_PSC_LPSC_SRIO))
            CSL_PSC_disableModuleResetIsolation(CSL_PSC_LPSC_SRIO);
        /* Disable the SRIO Global block */
        CSL_SRIO_GlobalDisable(hSrio);
        /* Disable each of the individual SRIO blocks. */
        for(i = 0; i <= 9; i++)
            CSL_SRIO_DisableBlock(hSrio, i);

        /* BOOT_COMPLETE = 0:  write enabled */
        CSL_SRIO_SetBootComplete(hSrio, 0);

        /* Now enable the SRIO block and all the individual blocks also. */
        CSL_SRIO_GlobalEnable(hSrio);
        for(i = 0; i <= 9; i++)
            CSL_SRIO_EnableBlock(hSrio, i);
        /* Configure SRIO ports mode. */
#ifdef SRIO_CIC_LOOPBACK
        printf("=== mode: loopback transmit\r\n");
        for(i = 0; i <= 3; i++)
            CSL_SRIO_SetLoopbackMode(hSrio, i);
#else
        printf("=== mode: normal transmit\r\n");
        for(i = 0; i <= 3; i++)
            CSL_SRIO_SetNormalMode(hSrio, i);
#endif
        /* Enable Automatic Priority Promotion of response packets. */
        CSL_SRIO_EnableAutomaticPriorityPromotion(hSrio);
        /*
         * Set the SRIO Prescalar select to operate in the range
         * PERSCALER_SELECT = 0: 44.7 ~ 89.5 MHz
         */
        CSL_SRIO_SetPrescalarSelect(hSrio, 0);
        /* Unlock the Boot Configuration Kicker */
        CSL_BootCfgUnlockKicker();
        /*
         * MPY = 0x80: 16x
         * ENPLL = 1: PLL Enable
         * srio_serdes_clock = RefClk(250MHz) * MPY = 2.5GHz
         */
        CSL_BootCfgSetSRIOSERDESConfigPLL(0x81);    // 5G

        /*
         * Configure the SRIO SERDES Receive Configuration
         * ENOC     = 1: Enable offset compensation
         * EQ       = 1: Fully adaptive equalization
         * CDR      = 5: First order with fast lock
         * ALIGN    = 1: Comma alignment enabled
         * TERM     = 1: Input termination, the only valid value for this field is 0x1
         * RATE     = 1: Data Rate = 2 * srio_serdes_clock = 5Gbps
         * BUSWIDTH = 1: Bus width, indicate a 20-bit wide parallel bus to the clock
         * ENRX     = 1: Enable this receiver
         */
        for(i = 0; i <= 3; i++)
            CSL_BootCfgSetSRIOSERDESRxConfig(i, 0x00468495);
        /*
         * Configure the SRIO SERDES Transmit Configuration
         * MSYNC    = 1:  Enables the channel as the master lane
         * FIRUPT   = 1:  Transmitter pre and post cursor FIR filter update
         * TWPST1   = 18: Adjacent post cursor Tap weight
         * TWPRE    = 1:  Precursor Tap weight
         * SWING    = 16: Output swing
         * RATE     = 1:  Data Rate = 2 * srio_serdes_clock = 5Gbps
         * BUSWIDTH = 1:  Bus width, indicate a 20-bit wide parallel bus to the clock
         * ENRX     = 1:  Enable this receiver
         */
        for(i = 0; i <= 3; i++)
            CSL_BootCfgSetSRIOSERDESTxConfig(i, 0x001C8F95);
        /* Loop around till the SERDES PLL is not locked. */
        while(1) {
            /* Get the SRIO SERDES Status */
            CSL_BootCfgGetSRIOSERDESStatus(&status);
            if(status & 0x1)
                break;
        }
        /* Lock the Boot Configuration Kicker */
        CSL_BootCfgLockKicker();
        /* Clear the LSU pending interrupts. */
        CSL_SRIO_ClearLSUPendingInterrupt(hSrio, 0xFFFFFFFF, 0xFFFFFFFF);
	   // 以下操作基本上是都是寄存器的默认值,此处没有删除是想留下函数的调用方法
        CSL_SRIO_GetProcessingElementFeatures (hSrio, &peFeatures);
        // PE 特性配置
        peFeatures.isProcessor                    = 1;
        peFeatures.isFlowControlSupported         = 1;
        peFeatures.isStandardRouteConfigSupported = 1;
        peFeatures.isCTLSSupported                = 1;
        peFeatures.numAddressBitSupported         = 1;
        peFeatures.isExtendedFeaturePtrValid      = 1;
        CSL_SRIO_SetProcessingElementFeatures(hSrio, &peFeatures);
        //SRIOProcessingElementFeaturesSet(0x20000199);
        // 配置源及目标操作
        CSL_SRIO_GetSourceOperationCAR (hSrio, &srcOPCAR);
        srcOPCAR.writeSupport         = 1;
        srcOPCAR.writeResponseSupport = 1;
        CSL_SRIO_SetSourceOperationCAR (hSrio, &srcOPCAR);
        CSL_SRIO_GetDestOperationCAR(hSrio, &srcOPCAR);
        srcOPCAR.writeSupport         = 1;
        srcOPCAR.writeResponseSupport = 1;
        CSL_SRIO_SetDestOperationCAR (hSrio, &srcOPCAR);
        //SRIODestinationOperationsSet(0x0004FDF4);
        //SRIODestinationOperationsSet(0x0000FC04);
        /* Set the 16 bit and 8 bit identifier for the SRIO Device */
        CSL_SRIO_SetDeviceIDCSR(hSrio, CSR_LOCAL_DEVICEID_8BIT, CSR_LOCAL_DEVICEID_16BIT);
#ifndef BOARD_TO_BOARD
        /* Configure the Base Routing Register */
        CSL_SRIO_SetTLMPortBaseRoutingInfo(hSrio, 0, 1, 1, 0, 0);
        CSL_SRIO_SetTLMPortBaseRoutingPatternMatch(hSrio, 0, 1, REMOTE_DEVICEID1_8BIT, 0xFF);
#endif
        /* Configure the PLM for all the ports */
        //for (i = 0; i <= 3; i++)
        {
            /* TODO: We need to ensure that the Port 0 is configured to support both
             * the 2x and 4x modes. The Port Width field is read only. So here we simply
             * ensure that the Input and Output ports are enabled */
            CSL_SRIO_EnableInputPort(hSrio, 0);
            CSL_SRIO_EnableOutputPort(hSrio, 0);
            /*
             * Discovery timer is specified to be 28 msec +/- 4 msec
             * Discovery timer = RefClk(250MHz) period * PRESCALAR_SRV_CLK * 52429 * DISCOVERY_TIMER
             *                 = (1 / 250Mhz) * (250 / 10) * 52429 * 5 = 26.2ms
             * Discovery timer = RefClk(156.25MHz) period * PRESCALAR_SRV_CLK * 52429 * DISCOVERY_TIMER
             *                 = (1 / 156.25Mhz) * (156.25 / 16) * 52429 * 8 = 26.2ms
             */
            CSL_SRIO_SetPLMPortDiscoveryTimer(hSrio, i, 0x8);
        }
        CSL_SRIO_SetPortWriteDeviceId(hSrio,0,REMOTE_DEVICEID1_8BIT, SRIO_ID_8Bit);
        /* Set the Port link timeout CSR */
        CSL_SRIO_SetPortLinkTimeoutCSR(hSrio, 0x000FFF);
        CSL_SRIO_SetPortResponseTimeoutCSR(hSrio, 0xFF0FFF);
        /* Set the Port General CSR: Only executing as Master Enable */
        CSL_SRIO_SetPortGeneralCSR(hSrio, 0, 1, 0);
        /* Clear the sticky register bits */
        CSL_SRIO_SetLLMResetControl(hSrio, 1);
        /* Set the Data Streaming MTU */
        CSL_SRIO_SetDataStreamingMTU(hSrio, 64);

        /* Configure the path mode 4 for the ports */
        CSL_SRIO_SetPLMPortPathControlMode(hSrio, 0, 4);
        /*
         * Set the LLM Port IP Prescalar
         * PRESCALAR_SRV_CLK = RefClk(250MHz) / 10
         * PRESCALAR_SRV_CLK = RefClk(156.25MHz) / 16
         */
        CSL_SRIO_SetLLMPortIPPrescalar(hSrio, 0x19);
        /* Enable the peripheral */
        CSL_SRIO_EnablePeripheral(hSrio);

        /* Configuration has been completed */
        /* BOOT_COMPLETE = 1:  write to read only registers disabled */
        CSL_SRIO_SetBootComplete(hSrio, 1);
        /* This code checks if the ports are operational or not */
        wait_time = 100;
        while(1) {
            if(CSL_SRIO_IsPortOk(hSrio, 0) == TRUE) {
                break;
            } else {
                wait_time --;
                /* Delay 1 ms */
                Task_sleep(1);
            }
        }
        if(wait_time == 0) {
            printf("srio system initialization time out!\r\n");
            return -1;
        }
    } else {
        /* Waiting for the SRIO subsystem to be initialized completelly */
        while(CSL_SRIO_IsPortOk(hSrio, 0) == FALSE);
    }
    /* Initialization has been completed */
    return 0;
}
  • 发送数据函数调用:
static Int8 srio_test(UInt8 LSU_Number, UInt32 target_addr_core, UInt32 transfer_size)
{
SRIO_LSU_TRANSFER   tparams;
。。。。。。
/* wait loopback complete time set as 10ms, base on cpu freq as 1000MHz */
        timeout = 10000000;

        /* 1.1 caculate the read and write buffer for srio transfer address */
        srio_trans_src = (UInt32 *)((UInt32)w_buff_64 + (j * transfer_size));
        srio_trans_dst = (UInt32 *)t_buff_64;

        /* 1.2 set transfer parameters, srio nwrite test, w_buff -> devmem_buff */
        memset((void *)&tparams, 0, sizeof(tparams));
        tparams.rapidIOLSB = (UInt32)srio_trans_dst;
        tparams.dspAddress = (UInt32)srio_trans_src;
        tparams.bytecount = transfer_size;
        tparams.ttype = Srio_Ttype_Write_NWRITE;
        tparams.ftype = Srio_Ftype_WRITE;
        tparams.dstID = REMOTE_DEVICEID1_8BIT;
        tparams.outPortID = SRIO_PORT;
        tparams.idSize = 0;
        /* wait lsu have available shadow register */
        while(1) {
            if (CSL_SRIO_IsLSUFull(hSrio, LSU_Number) == FALSE)
                break;
        }
        /* Get the LSU Context and Transaction Information. */
        CSL_SRIO_GetLSUContextTransaction(hSrio, LSU_Number,
                                           &contextBit, &transactionID);      
        transStart = _itoll(TSCH, TSCL);
        /* start srio transfer */
        CSL_SRIO_SetLSUTransfer(hSrio, LSU_Number, &tparams);
        /* wait for a transfer completion interrupt occur */
        while(timeout) {
           CSL_SRIO_GetLSUCompletionCode(hSrio, LSU_Number, transactionID,
                                            &uiCompletionCode, &context);
           if(context == contextBit) {
               /* disable pending transactions */
               transactionID = 0xFF;
               contextBit = 0xFF;
               if(uiCompletionCode != 0) {
                    status = -1;
                    printf("SRIO transfer have error completed code %d\r\n", -(uiCompletionCode));
                    goto err_transfer;
               }
               break;
           } else {
                timeout--;
                /* delay 1 cpu cyle */
                asm (" nop");
           }
        }
        if(timeout == 0) {
            /* if transfer timeout occurs, return error status */
            status = -1;
            printf("SRIO transfer timeout\r\n");
            goto err_transfer;
        }
}
  • console打印信息如下:

  • targe的0x90000000内存值均为如下图:

15.5.2 SRIO CSL参考文档分析

  • ti 提供的SRIO寄存器操作代码在C:\ti\pdk_C6678_1_1_2_6\packages\ti\csl\csl_srioAux.h中,里面函数编写在h文件中以inline形式存在(有时间要好好研究一下)。
  • 网页参考文件(网页搜索更方便)

file:///C:/ti/pdk_C6678_1_1_2_6/packages/ti/csl/docs/doxygen/html/group___c_s_l___s_r_i_o___f_u_n_c_t_i_o_n.html

与SRIO有关的文件如下:

15.6节  SRIO doorbell

15.6.1 参考文章

参考文章:

《TI_DSP_SRIO - Doorbell原理》

https://blog.csdn.net/kunkliu/article/details/107345417

《TI_DSP_SRIO - Doorbell原理(中断路由到core-1)》

https://blog.csdn.net/kunkliu/article/details/107345503

《TMS320C645x DSP SRIO寄存器(四)——门铃(Doorbell)与CPPI中断》

https://blog.csdn.net/kunkliu/article/details/107027974

《FPGA+DSP SRIO通信(四)——中断系统(一)》

https://blog.csdn.net/kunkliu/article/details/105275229

《FPGA+DSP SRIO通信(四)——中断系统(二)》

https://blog.csdn.net/kunkliu/article/details/105275294

《C66xx SRIO DoorBell的使用》

https://blog.csdn.net/kunkliu/article/details/107407572

 

创龙提供的SRIO中文参考资料《C66x串行快速输入输出(SRIO)用户指南.pdf》

TI官方资料《Serial Rapid IO (SRIO) User Guide.pdf》

15.6.2 门铃中断分析

上文中的几篇博客可以基本了解门铃中断的原理,根据自己理解总结如下:

  • C6678内部硬件上有4组完全一样的门铃中断控制器,每组可以产生16个中断,整个新片共可产生64个门铃中断
  • 每组门铃中断控制器包含的寄存器如下:

Interrupt Condition Routing Register (ICRR):中断路由设置寄存器,共8个(每组有2个)

Interrupt Condition Status Register (ICSR):中断状态寄存器共4个(16个中断的状态)

Interrupt Condition Clear Register (ICCR):中断清除寄存器共4个(清除16个中断)

Interrupt Control Register:还有一个门铃中断选择寄存器(控制门铃中断的选择,参考5)

 

  • 这里重点说一些中断路由设置寄存器(ICRR):

每组门铃的16个中断,可以任意映射到以下16个system event,映射方法为2^4=16,一个门铃中断要4bit才能完成映射,顾16个system event需要16*4=64bit,顾每组寄存器要2个中断路由设置寄存器(ICRR)才可完成全部映射。

  • DSP 6678的SRIO模块共有24个system Interrupt,即INTDST0~23。其中INDTST0~15为通用的system Interrupt,可以连接到LSU或者DoorBell中断,再输入到CIC0,而INTDST16~23只连接DoorBell中断,属于system Event,直接输入到CorePac。
  • DoorBell可以路由至专用中断,也可路由至16个通用中断,由INTERRUPT_CTL寄存器决定,如下图

  • 当INTERRUPT_CTL寄存器的第0bit为1时,映射表如下:

  • 当INTERRUPT_CTL寄存器的第0bit为0时,映射表如下:

  • SRIO DIO传输doorbell类型的包(使用LSU)的最重要的组成就是doorbell_info域,该域由16bit构成,其中5,6位用于选择使用哪一组Doorbell中断状态寄存器,0,1,2,3为用于选择使用该组16个门铃中断中的哪一个中断,其余为reserve位。SRIO控制器根据doorbell_info域设置对应的中断状态寄存器。

举例:doorbell_info0x25SRIO硬件会将DOORBELL1_ICSR的第5位中断请求位置为1。这样通过与第5位绑定的system event产生中断

 

  • 系统初始化时,必须先把doorbell中断路由映射表设置好,才能正常产生门铃中断,代码如下:

CSL_SRIO_SetDoorbellRoute(hSrio, 1);//使用通用中断INTDST0-15
 for (i = 0; i < 16; i++)
 {
	//将doorbit中断 0-15映射到INTDST0-INTDST15,每个门铃信息对应一个中断函数
     CSL_SRIO_RouteDoorbellInterrupts(hSrio, 0, i, i);
 }
//

        // 选择专用门铃中断
        CSL_SRIO_SetDoorbellRoute(hSrio, 0);

        // 将前4个门铃中断映射到专用中断0
        for(i = 0; i < 4; i++)
            CSL_SRIO_RouteDoorbellInterrupts(hSrio, 0, i, 0);

  • INTDST0-INTDST15与BIOS中HWI的对应关系:

KeyStorn模块的DoorBell中断的路由路径有4种,分别为:

经过CIC0EventCombiner

经过CIC0但不经过EventCombiner

不经过 CIC0但经过EventCombiner

不经过CIC0EventCombiner

此处以DSP6678中的core0为例,不经过CIC0和EventCombiner,(SRIO门铃中断映射到门铃专用中断,直接输入到CorePac,映射方法参考9),将门铃中断映射到INTDST16(16+n,n=0)说明core0 SIRO DoorBell中断,BIOS中HWI配置代码如下:

  • 上文中介绍的4种中断路由路径的其他几种暂时没有分析,以后有机会在分析
  • 门铃中断应该就这些内容,主要是理解门铃中断的映射,至于由INTDST0-INTDST15如何产生真正的中断,下次在分析。

 

15.6.3经过CIC0和EventCombiner的门铃中断配置方法

《FPGA+DSP SRIO通信(四)——中断系统(一)》

https://blog.csdn.net/kunkliu/article/details/105275229

《FPGA+DSP SRIO通信(四)——中断系统(二)》

https://blog.csdn.net/kunkliu/article/details/105275294

 

15.6.4 基于PDK门铃发送代码

  • 只是第一步设置tparams不同,其他步骤与NWRITE NREAD等相同
#if 1   // DOORBELL
        /* wait loopback complete time set as 10ms, base on cpu freq as 1000MHz */
        timeout = 10000000;
        /* 1 set transfer parameters, srio nwrite test, w_buff -> devmem_buff */
        memset((void *)&tparams, 0, sizeof(tparams));
        tparams.bytecount = 4;
        tparams.ftype = Srio_Ftype_DOORBELL;
        tparams.dstID = REMOTE_DEVICEID1_8BIT;
        tparams.outPortID = 0;//SRIO_PORT;
        tparams.idSize = 0;
        tparams.doorbellValid = 0;
        tparams.doorbellInfo = SRIO_DoorBell_Message_Notify01;

        /* 2 wait lsu have available shadow register */
        while(1)
        {
            if (CSL_SRIO_IsLSUFull(hSrio, LSU_Number) == FALSE)
                break;
        }
        
        /* 3 Get the LSU Context and Transaction Information. */
        CSL_SRIO_GetLSUContextTransaction(hSrio, LSU_Number, &contextBit, &transactionID);
  
        transStart = _itoll(TSCH, TSCL);

        /* 4 start srio transfer */
        CSL_SRIO_SetLSUTransfer(hSrio, LSU_Number, &tparams);

        /* 5 wait for a transfer completion interrupt occur */
        while(timeout)
        {
           CSL_SRIO_GetLSUCompletionCode(hSrio, LSU_Number, transactionID, &uiCompletionCode, &context);
           if(context == contextBit) {
               /* disable pending transactions */
               transactionID = 0xFF;
               contextBit = 0xFF;
               if(uiCompletionCode != 0)
               {
                    status = -1;
                    printf("SRIO transfer have error completed code %d\r\n", -(uiCompletionCode));
                    goto err_transfer;
               }
               break;
           }
           else
           {
                timeout--;
                /* delay 1 cpu cyle */
                asm (" nop");
           }
        }
        if(timeout == 0)
        {
            /* if transfer timeout occurs, return error status */
            status = -1;
            printf("SRIO transfer timeout\r\n");
            goto err_transfer;
        }
#endif

15.6.5 门铃与数据一起发送

  • 参考文章:

《SRIO 有关门铃和数据的发送》------ 原理性解释

https://blog.csdn.net/kunkliu/article/details/107415812

《SRIO通信dsp在nwrite时如果带门铃信号,完成传输的时间会很长》-----发送时间过长问题处理

https://blog.csdn.net/kunkliu/article/details/107415695

解决方法:

初始化SRIO时设置SP_RT_CTL寄存器,代码如下:

static Int32 srio_device_init (void)
{        
	。。。。。。
CSL_SRIO_SetPortResponseTimeoutCSR(hSrio, 0);
。。。。。。
}
  • 代码:
    //for(j = 0; j < (SRIO_MAX_TRANS_SZIE / transfer_size); j++)
    {
        run_counter++;
        // 挂起信号量
        Semaphore_pend(sem_srio_test, BIOS_WAIT_FOREVER);
        printf("[core0] : get semaphore sem_srio_test\n");
#if 1   // NWRITE
        /* wait loopback complete time set as 10ms, base on cpu freq as 1000MHz */
        timeout = 10000000;

        /* 1.1 caculate the read and write buffer for srio transfer address */
        srio_trans_src = (UInt32 *)((UInt32)w_buff_64 + (j * transfer_size));
        srio_trans_dst = (UInt32 *)t_buff_64;

        /* 1.2 set transfer parameters, srio nwrite test, w_buff -> devmem_buff */
        memset((void *)&tparams, 0, sizeof(tparams));
        tparams.rapidIOLSB = (UInt32)srio_trans_dst;
        tparams.dspAddress = (UInt32)srio_trans_src;
// 每传512个字节就会产生一次doorbell中断,先将数据写入对方内存,然后在产生门铃中断,门铃中断产生事件较长
        tparams.bytecount = transfer_size;      // transfer_size = 512
        tparams.ttype = Srio_Ttype_Write_NWRITE;
        tparams.ftype = Srio_Ftype_WRITE;
        tparams.dstID = REMOTE_DEVICEID1_8BIT;
        tparams.outPortID = 0;//SRIO_PORT;
        tparams.idSize = 0;
//为0 :在发送512字节后不产生门铃中断,为1:在发送512字节后产生门铃中断
        tparams.doorbellValid = 1;  
        tparams.doorbellInfo = SRIO_DoorBell_Message_Notify01;

        /* wait lsu have available shadow register */
        while(1)
        {
            if (CSL_SRIO_IsLSUFull(hSrio, LSU_Number) == FALSE)
                break;
        }
        
        /* Get the LSU Context and Transaction Information. */
        CSL_SRIO_GetLSUContextTransaction(hSrio, LSU_Number, &contextBit, &transactionID);
  
        transStart = _itoll(TSCH, TSCL);

        /* start srio transfer */
        CSL_SRIO_SetLSUTransfer(hSrio, LSU_Number, &tparams);

        /* wait for a transfer completion interrupt occur */
        while(timeout)
        {
           CSL_SRIO_GetLSUCompletionCode(hSrio, LSU_Number, transactionID, &uiCompletionCode, &context);
           if(context == contextBit) {
               /* disable pending transactions */
               transactionID = 0xFF;
               contextBit = 0xFF;
               if(uiCompletionCode != 0)
               {
                    status = -1;
                    printf("SRIO transfer have error completed code %d\r\n", -(uiCompletionCode));
                    goto err_transfer;
               }
               break;
           }
           else
           {
                timeout--;
                /* delay 1 cpu cyle */
                asm (" nop");
           }
        }

        if(timeout == 0)
        {
            /* if transfer timeout occurs, return error status */
            status = -1;
            printf("SRIO transfer timeout\r\n");
            goto err_transfer;
        }

        /* Calculate srio transfer used time */
        transCost = _itoll(TSCH, TSCL) - transStart;
        w_time += transCost;

        /* Calculate srio transfer write rate */
        w_rate += (UInt64)transfer_size * cpuFreq.lo / transCost / 1024 / 1024 * 8;
#endif
  • 响应超时时间修改前

CSL_SRIO_SetPortResponseTimeoutCSR(hSrio, 0xFF0FFF);

  • 响应超时时间修改后

CSL_SRIO_SetPortResponseTimeoutCSR(hSrio, 0)

  • 没有门铃中断时

15.6.6 门铃中断BIOS组件选择与中断配置

工程tl-srio-test-doorbell:

var BIOS         = xdc.useModule('ti.sysbios.BIOS');
var Clock        = xdc.useModule('ti.sysbios.knl.Clock');
var Swi          = xdc.useModule('ti.sysbios.knl.Swi');
var Task         = xdc.useModule('ti.sysbios.knl.Task');
var Semaphore    = xdc.useModule('ti.sysbios.knl.Semaphore');
var Hal_Timer    = xdc.useModule('ti.sysbios.hal.Timer');
var HeapMem      = xdc.useModule('ti.sysbios.heaps.HeapMem');
var Load         = xdc.useModule('ti.sysbios.utils.Load');
var Hwi          = xdc.useModule('ti.sysbios.family.c64p.Hwi');
var Cache        = xdc.useModule('ti.sysbios.family.c66.Cache');
var CpIntc       = xdc.useModule('ti.sysbios.family.c66.tci66xx.CpIntc');
var Exception    = xdc.useModule('ti.sysbios.family.c64p.Exception');
var MPU          = xdc.useM	odule('ti.sysbios.family.c64p.MemoryProtect');
var Timestamp    = xdc.useModule('ti.sysbios.family.c64p.TimestampProvider');
var Memory       = xdc.useModule('xdc.runtime.Memory');

工程tl-srio-test-doorbell头文件:

#include <string.h>
#include <stdio.h>
#include <stdbool.h>

/* XDCtools Header files */
#include <xdc/std.h>
#include <xdc/runtime/Error.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Memory.h>
#include <xdc/runtime/IHeap.h>
#include <xdc/runtime/Types.h>
#include <xdc/cfg/global.h>

/* SYS/BIOS Header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Clock.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/sysbios/knl/Semaphore.h>
#include <ti/sysbios/heaps/HeapBuf.h>
#include <ti/sysbios/heaps/HeapMem.h>
#include <ti/sysbios/family/c66/Cache.h>
#include <ti/sysbios/family/c66/tci66xx/CpIntc.h>
#include <ti/sysbios/family/c64p/hwi.h>

/* CSL Header files */
#include <ti/csl/soc.h>
#include <ti/csl/cslr_device.h>
#include <ti/csl/csl_srio.h>
#include <ti/csl/cslr_srio.h>
#include <ti/csl/csl_srioAux.h>
#include <ti/csl/csl_srioAuxPhyLayer.h>
#include <ti/csl/csl_bootcfgAux.h>
#include <ti/csl/csl_pscAux.h>
#include <ti/csl/csl_chip.h>

/* DRV Header files */
#include <ti/drv/srio/srio_drv.h>

工程tl-srio-test-doorbell HWI初始化:

Void ThreadInit()
{
    Task_Handle task;
    Error_Block eb;
    Task_Params TaskParams;
    Hwi_Params hwiParams;
    Semaphore_Params semParams;
    uint8_t event_id, cic_id, sys_int_id;

    /* Hwi 线程 */
#if 1
    Hwi_Params_init(&hwiParams);
    hwiParams.eventId = 20;
    hwiParams.enableInt = TRUE;
    Hwi_create(4, srio_db_isr, &hwiParams, NULL);
#endif
}

15.6.7 门铃中断1848配置

 

 

 

 

 

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值