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.

Srio输入时钟配置



您好 我们的应用中,6678的srio时钟是外部给出,在这种情况下,向prescalar_srv_clk寄存器写入输入时钟还有意义吗? 这个寄存器什么时候有用?难道6678能够自己给serdes模块设置时钟频率? 谢谢!
  • 那是与timeout计数相关的寄存器。下面的示例代码或许能帮你理解。

    完整的代码可用从以下链接下载:

    http://www.deyisupport.com/question_answer/dsp_arm/c6000_multicore/f/53/t/47664.aspx

     

    void KeyStone_SRIO_Timeout_Config(SRIO_Config * srio_cfg,
    	Uint32 logicalRepsonseTimeout_us, 
    	Uint32 physicalPortTimeout_us, 
    	Uint32 linkInitSilenceTimeout_us)
    {
    	Uint32 uiTimeout, uiMaxTimeout;
    	Uint32 byteClockMHz;
    
    	/*PRESCALAR_SELECT is used to divide VBUSM clock(normally 333 to 400MHz, 
    	here use 350MHz), (VBUS_M clock)/(PRESCALAR_SELECT+1), 
    	to get about 50MHz clock with about 20ns period.*/
    	gpSRIO_regs->RIO_PER_SET_CNTL= (gpSRIO_regs->RIO_PER_SET_CNTL
    		&(~CSL_SRIO_RIO_PER_SET_CNTL_PRESCALER_SELECT_MASK))
    		|((gDSP_Core_Speed_Hz/1000000/3/50-1)<<CSL_SRIO_RIO_PER_SET_CNTL_PRESCALER_SELECT_SHIFT);
    
    	/*logical layer response timeout
    	logicalRepsonseTimeout = 15 x (scaled VBUS_M clock period) x TIMEOUT_VALUE),
    	TIMEOUT_VALUE = logicalRepsonseTimeout/(scaled VBUS_M clock period)/15 */
    	uiTimeout= logicalRepsonseTimeout_us*1000/20/15;
    	uiMaxTimeout=CSL_SRIO_RIO_SP_RT_CTL_TVAL_MASK
    		>>CSL_SRIO_RIO_SP_RT_CTL_TVAL_SHIFT;
    	if(uiTimeout>uiMaxTimeout)
    		uiTimeout= uiMaxTimeout;
    	if(0==uiTimeout)
    		uiTimeout= 1;
    	gpSRIO_regs->RIO_SP_RT_CTL= uiTimeout<<CSL_SRIO_RIO_SP_RT_CTL_TVAL_SHIFT;
    
    	/*SRV_CLK should be scaled to about 10MHz (about 100ns period).
    	SRV_CLK= (a SRIO internal IP clock)/ PRESCALAR_SRV_CLK.
    	The SRIO internal IP clock is the byte clock of 
    	one of the lanes (selected by SYS_CLK_SEL). 
    	(Byte clock) = (link rate)/20.*/
    	byteClockMHz= 
    		srio_cfg->serdes_cfg->linkSetup[srio_cfg->SYS_CLK_SEL]->linkSpeed_GHz*1000/20;
    	gpSRIO_regs->RIO_PRESCALAR_SRV_CLK= byteClockMHz/10;
    
    	/*physical layer response timeout.
    	physicalPortTimeout = SRV_CLK period * TIMEOUT_VALUE * 3,
    	TIMEOUT_VALUE = physicalPortTimeout/SRV_CLK period/3 */
    	uiTimeout= physicalPortTimeout_us*1000/100/3;
    	uiMaxTimeout=CSL_SRIO_RIO_SP_LT_CTL_TVAL_MASK
    		>>CSL_SRIO_RIO_SP_LT_CTL_TVAL_SHIFT;
    	if(uiTimeout>uiMaxTimeout)
    		uiTimeout= uiMaxTimeout;
    	if(0==uiTimeout)
    		uiTimeout= 1;
    	gpSRIO_regs->RIO_SP_LT_CTL= uiTimeout<<CSL_SRIO_RIO_SP_LT_CTL_TVAL_SHIFT;
    	
    	/*port silence timeout
    	The SRIO starts in the SILENT state. The link output driver is disabled 
    	to force the link partner to initialize regardless of its current state. 
    	The duration of the SILENT state is controlled by the silence_timer. 
    	The duration must be long enough to ensure that the link partner detects 
    	the silence (as a loss of lane_sync) and is forced to initialize but short 
    	enough that it is readily distinguished from a link break.
    	linkInitSilenceTimeout is SRV_CLK period X 410 X SILENCE_TIMER,
    	SILENCE_TIMER= linkInitSilenceTimeout/SRV_CLK period/410*/
    	uiTimeout= linkInitSilenceTimeout_us*1000/100/410;
    	uiMaxTimeout=CSL_SRIO_RIO_PLM_SP_SILENCE_TIMER_SILENCE_TIMER_MASK
    		>>CSL_SRIO_RIO_PLM_SP_SILENCE_TIMER_SILENCE_TIMER_SHIFT;
    	if(uiTimeout>uiMaxTimeout)
    		uiTimeout= uiMaxTimeout;
    	if(0==uiTimeout)
    		uiTimeout= 1;
    	uiTimeout= uiTimeout
    		<<CSL_SRIO_RIO_PLM_SP_SILENCE_TIMER_SILENCE_TIMER_SHIFT;
    	if(srio_cfg->blockEn.bLogic_Port_EN[0])
    		gpSRIO_regs->RIO_PLM[0].RIO_PLM_SP_SILENCE_TIMER= uiTimeout;
    	if(srio_cfg->blockEn.bLogic_Port_EN[1])
    		gpSRIO_regs->RIO_PLM[1].RIO_PLM_SP_SILENCE_TIMER= uiTimeout;
    	if(srio_cfg->blockEn.bLogic_Port_EN[2])
    		gpSRIO_regs->RIO_PLM[2].RIO_PLM_SP_SILENCE_TIMER= uiTimeout;
    	if(srio_cfg->blockEn.bLogic_Port_EN[3])
    		gpSRIO_regs->RIO_PLM[3].RIO_PLM_SP_SILENCE_TIMER= uiTimeout;
    	
    	
    }
    

  • 你好:

           我根据文档查了一下相关代码,基本理解了SRV_CLK的用途,它是另外几个计时器的计时依据,对否?

           另外我还想问一下这些计时器的作用,您看我理解是否正确:

           SP_RT_CTL-TIMEOUT VALUE:每隔TIMEOUT时间,port会发送一个包,检测回应(目的是判断链路通畅?)

           SP_LT_CTL-TIMEOUT VALUE: 当port在TIMEOUT时间后仍然没有link上,就判定Link失败

           PLM Port Discovery Timer: port 在port 2x 4x时检测port的时间?

           Silence Timer:这个不明白,什么叫silence time?另外文档上对它的解释和对discovery timer的解释一模一样,感觉是写错了

           谢谢!

  • SP_RT_CTL-TIMEOUT VALUE:这个timer只有当有真正的数据包发送到时候才会启动,而且这个包的类型是需要响应的。它用于判断响应是否超时,而不是链路是否畅通。

    SP_LT_CTL-TIMEOUT VALUE:SRIO物理层在空闲时会一直发IDLE symbol,繁忙时也会定期发IDLE symol。这个timer就是计最近一次收到IDLE到现在的时间,每收到一个IDLE, 这个timer都会重新开始计数. 如果超时的话,说明物理链路有问题。

    Silence Timer: 用于在发起初始化之前保持静默(不发IDLE),让对方收不到IDLE而超时,从而重启对方的重新初始化流程。

    Discovery Timer: Discovery是初始化过程中的一步,Discovery Timer用于检测这一步是否超时。