⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pm5337_line_sonet_aps.tcl

📁 用于EOS芯片的驱动程序, 供参考 参考
💻 TCL
字号:
#------------------------------------------------------------------------------# FILE NAME: PM5337_LINE_SONET_APS.tcl## DESCRIPTION: 	This file includes the following procedures:#		1) LINE_SONET_Linear_APS_Config#			# NOTES:## REVISION History:# Preliminary 1 - Script created##------------------------------------------------------------------------------#-------------------------------------------------------------------# SCRIPT NAME:	LINE_SONET_Linear_APS_Config## DESCRIPTION:	This procedure enables or disables the line SONET#               Linear APS and sets up smart framing.#		# PARAMETERS:	devID #		enable	- 0 (disable), 1 (enable)## NOTES: The LINE_SONET block must be enable in the following#        sequence #	 1) Enable the LINE_SONET block #	 2) De-assert the LINE_SONET block reset##	 The LINE_SONET block must be disabled in the following sequence#	 1) Assert the LINE_SONET block reset#	 2) Disable the LINE_SONET block###  Only the first slice of the HOPP and LOPP are used.##  The process sets the APS_MODE AND RX_APS_SRC to 0.#-------------------------------------------------------------------proc LINE_SONET_Linear_APS_Config {devID enable} {  source /usr/lib/cgi-bin/apps/tclscripts/PM5337_util.tcl      ################################################  ##### Disable Linear APS                   #####  ################################################  if {$enable == 0} {      ##### Set SLP as input to HOPP for both interfaces #####    admwrb $devID 0x102B 0 0    admwrb $devID 0x102B 8 0         ################################################  ##### Enable Linear APS                    #####  ################################################  } elseif {$enable == 1} {      ##### Set Linear APS RSDM as input to HOPP #####    admwrb $devID 0x102B 0 1    #admwrb $devID 0x102B 8 1            ##### Set the traffic from transmit HOPP #1 to be processed     ##### by both the SLP #1 and SLP #2    admwrb $devID 0x102B 5 0    admwrb $devID 0x102B 4 0    admwrb $devID 0x102B 13 0    admwrb $devID 0x102B 12 0        ##### Set TX1_LOOPT_SRC and TX2_LOOPT_SRC to be recovered from channel 1    #admwrb $devID 0x102B 7 0    #admwrb $devID 0x102B 6 1        #admwrb $devID 0x102B 15 0    #admwrb $devID 0x102B 14 1                if {$devID == -1} {          # Echo SMART Framing Procedure Function to TCL Console      puts "Perform SMART Framing on RX1 and RX2 (See PM5337_LINE_SONET_APS for details) <br>"                } else {            ###########################################      ##### Perform SMART Framing Procedure #####      ###########################################          ##### 1. Check OOF status on all RX links #####            # Check all ESSI Working and Protect RX links to determine which      # links are in frame (ie. OOFV = 0).  If a link is in OOF,        # the Diff_J0[15:0] value will not be used for calculation.             # Check RRMP on Line 1      set OOF_RRMP_1 [admrdb $devID 0x1332 0]            # Check RRMP on Line 2      set OOF_RRMP_2 [admrdb $devID 0x13B2 0]                ## Check to make sure both interfaces are in frame             if {$OOF_RRMP_1 == 1 || $OOF_RRMP_2 == 1} {                puts "Smart Framing Abort: At least one Rx link is out of frame."            return         }                ##### 2. Trigger a transfer of Diff_J0 to holding register #####            # Make sure AFPDLY are 0x0000            set val [rd adm 0x102a]      set val [expr $val & 0xC000 ]            admwr $devID 0x102A $val            # Line 1      admwr $devID 0x1108 0x0000        # Line 2      admwr $devID 0x1188 0x0000                   ##### 3. Wait for TIP_DIFF_J0 to clear #####      # Poll TIP_DIFF_J0 bit until low                   set TIP_DIFF_J0_1 [admrdb $devID 0x1107 2]         set TIP_DIFF_J0_2 [admrdb $devID 0x1187 2]              while {$TIP_DIFF_J0_1 == 1 || $TIP_DIFF_J0_2 == 1} {        set TIP_DIFF_J0_1 [admrdb $devID 0x1107 2]           set TIP_DIFF_J0_2 [admrdb $devID 0x1187 2]      }                    ##### 4. Calculate Frame Pulse Delay Value #####            # Reading diff J0 values for line interface 1      set j0_diff_1 [admrd $devID 0x1108]      set j0_diff_1 [expr $j0_diff_1 & 0xFFFF];                  # Reading diff J0 values for line interface 2      set j0_diff_2 [admrd $devID 0x1188]      set j0_diff_2 [expr $j0_diff_2 & 0xFFFF];                  #### (b) Find maximum DIFF_J0 for wrap around checking ####      set j0_max_tmp 0            if {$j0_diff_1 > $j0_max_tmp} {          set j0_max_tmp $j0_diff_1      }       if {$j0_diff_2 > $j0_max_tmp} {          set j0_max_tmp $j0_diff_2      }                 #### (c) Check for wrap around ####                        if {[expr ($j0_max_tmp - $j0_diff_1)] >= 104 } {        set $j0_diff_1 [expr $j0_diff_1 + 9720]      }      if {[expr ($j0_max_tmp - $j0_diff_2)] >= 104 } {        set $j0_diff_2 [expr $j0_diff_2 + 9720]      }                  #### (d) Check for Min and Max ####        set j0_max_adj 0      set j0_min_adj 19440	;# 2x maxcnt            # finding j0_max_adj           if {$j0_diff_1 > $j0_max_adj } {          set j0_max_adj $j0_diff_1      }       if {$j0_diff_2 > $j0_max_adj } {          set j0_max_adj $j0_diff_2      }                # finding j0_min_adj      if {$j0_diff_1 < $j0_min_adj } {          set j0_min_adj $j0_diff_1      }       if {$j0_diff_2 < $j0_min_adj } {          set j0_min_adj $j0_diff_2      }                         #### (e) Determine the FIFO midpoint ####      set midpoint [expr ($j0_min_adj + $j0_max_adj)/2]            #### (f) Determining the delay offset ####      set maxcnt 9720      set fifosize 104      set fpdly_offset [expr $maxcnt - 1 - $midpoint + $fifosize/2 - 1]                        if {$fpdly_offset > $maxcnt} {        set fpdly_offset [expr $fpdly_offset - $maxcnt]      }                  set val [rd adm 0x102a]      set val [expr $val & 0xc000 ]      set val [expr $val | $fpdly_offset ]            admwr $devID 0x102A $val               wr adm 0x1108 0x0      wr adm 0x1188 0x0      set diff_j01 [rd adm 0x1108]           set diff_j02 [rd adm 0x1188]                           }    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -