📄 pm5337_core_xc_masu.tcl
字号:
# following, both HO and LO tables are configured identically. # # L-Code to F-Code Mapping Table # ------------------|------------------ # L-Code | F-Code # ===================================== # 0xFF | 0x3E # ------------------------------------- # 0xFE | 0x3D # 0xFD | 0x3C # 0xFC | 0x3B # 0xFB | 0x3A # 0xFA | 0x39 # 0xF9 | 0x38 # 0xF8 | 0x37 # 0xF7 | 0x36 # 0xF6 | 0x35 # 0xF5 | 0x34 # 0xF4 | 0x33 # 0xF3 | 0x32 # 0xF2 to 0xEA | 0x31 # 0xE9 to 0xCE | 0x30 # ------------------------------------- # 0xA0 | 0x29 # 0x9F | 0x28 # 0x9E | 0x27 # 0x9D | 0x26 # 0x9C | 0x25 # 0x9B to 0x92 | 0x24 # 0x91 to 0x88 | 0x23 # ------------------------------------- # 0x87 to 0x7F | 0x22 # 0x7E | 0x21 # ------------------------------------- # 0x7D to 0x00 | 0x1 # ######################################################## # Configure HO and LO L-Code to F-Code Mapping Table 1 # ######################################################## # 0 for LO MAPS table, 0 for HO MAPS table for {set ho_lo_table 0} {$ho_lo_table <= 1} {incr ho_lo_table} { set table 0 ;# L-Code to F-Code Mapping Table 1 ### Set L-Code 0x00 to 0x7D --> F-Code 0x01 ### for {set lcode_range 0x0} {$lcode_range <= 0x7D} {incr lcode_range 0x1} { set lcode $lcode_range set addr [expr 0x6000 + [expr $ho_lo_table << 10]|[expr $table << 8]|[expr $lcode << 0]] admwr $devID $addr 0x1 ;# F-Code = 0x1 } ### Set L-Code 0x7E --> F-Code 0x21 ### set lcode 0x7E set addr [expr 0x6000 + [expr $ho_lo_table << 10]|[expr $table << 8]|[expr $lcode << 0]] admwr $devID $addr 0x21 ;# F-Code = 0x21 ### Set L-Code 0x7F to 0x87 --> F-Code 0x22 ### for {set lcode_range 0x7F} {$lcode_range <= 0x87} {incr lcode_range 0x1} { set lcode $lcode_range set addr [expr 0x6000 + [expr $ho_lo_table << 10]|[expr $table << 8]|[expr $lcode << 0]] admwr $devID $addr 0x22 ;# F-Code = 0x22 } ### Set L-Code 0x88 to 0x91 --> F-Code 0x23 ### for {set lcode_range 0x88} {$lcode_range <= 0x91} {incr lcode_range 0x1} { set lcode $lcode_range set addr [expr 0x6000 + [expr $ho_lo_table << 10]|[expr $table << 8]|[expr $lcode << 0]] admwr $devID $addr 0x23 ;# F-Code = 0x23 } ### Set L-Code 0x92 to 0x9B --> F-Code 0x24 ### for {set lcode_range 0x92} {$lcode_range <= 0x9B} {incr lcode_range 0x1} { set lcode $lcode_range set addr [expr 0x6000 + [expr $ho_lo_table << 10]|[expr $table << 8]|[expr $lcode << 0]] admwr $devID $addr 0x24 ;# F-Code = 0x24 } ### Set L-Code 0x9C to 0xA0 --> F-Code 0x25 to 0x29 ### for {set lcode_range 0x9C} {$lcode_range <= 0xA0} {incr lcode_range 0x1} { set lcode $lcode_range set fcode [expr $lcode_range - 0x77] set addr [expr 0x6000 + [expr $ho_lo_table << 10]|[expr $table << 8]|[expr $lcode << 0]] admwr $devID $addr $fcode ;# F-Code = 0x25 to 0x29 } ### Set L-Code 0xCE to 0xE9 --> F-Code 0x30 ### for {set lcode_range 0xCE} {$lcode_range <= 0xE9} {incr lcode_range 0x1} { set lcode $lcode_range set addr [expr 0x6000 + [expr $ho_lo_table << 10]|[expr $table << 8]|[expr $lcode << 0]] admwr $devID $addr 0x30 ;# F-Code = 0x30 } ### Set L-Code 0xEA to 0xF2 --> F-Code 0x31 ### for {set lcode_range 0xEA} {$lcode_range <= 0xF2} {incr lcode_range 0x1} { set lcode $lcode_range set addr [expr 0x6000 + [expr $ho_lo_table << 10]|[expr $table << 8]|[expr $lcode << 0]] admwr $devID $addr 0x31 ;# F-Code = 0x31 } ### Set L-Code 0xF3 to 0xFF --> F-Code 0x32 to 0x3E ### for {set lcode_range 0xF3} {$lcode_range <= 0xFF} {incr lcode_range 0x1} { set lcode $lcode_range set fcode [expr $lcode_range - 0xC1] set addr [expr 0x6000 + [expr $ho_lo_table << 10]|[expr $table << 8]|[expr $lcode << 0]] admwr $devID $addr $fcode ;# F-Code = 0x25 to 0x29 } } ################################################ ##### 11. Enable MAPS function ##### ################################################ admwrb $devID 0x4800 0 1 admwrb $devID 0x6800 0 1 }#------------------------------------------------------------------# SCRIPT NAME: CORE_XC_LOMP_MAPS_Config## DESCRIPTION: This procedure initializes the LOMP block in# the ADM622 device when MAPS is enabled. ## PARAMETERS: devID ## link - 1 (link 1) or 2 (link 2)## statemachine - 0x0 for Direct Source Selection# 0x1 for Post-hold Timer# 0x2 for WTR Timer# 0x3 for Pre-hold Timer# 0x4 for Pre-hold Timer with Post-Hold # Timer# 0x5 for Pre-hold Timer with WTR Timer## timer - 0x0 to 0x3F; 0x0 = 0 sec, 0x1 = 1sec, etc## mode - This parameter is used to reduce the configuration# steps when some connections in the STM-16 frame are # unused. When set to:## 1 - Only STM-4 #1 is configured# 2 - Only STM-4 #1, STM-4 #2 are configured# 3 - Only STM-4 #1, STM-4 #2, STM-4#3 are configured# 4 - STM4 #1, STM-4 #2, STM-4 #3 and STM-4#4 are configured## NOTES:1. Only 2 ingress sources are enabled. Ingress Source 0 is# assigned with a lower cost then Ingress Source 1.## 2. Pre-scalar is set to 1 sec##-------------------------------------------------------------------proc CORE_XC_LOMP_MAPS_Config {devID link statemachine timer mode} { source /usr/lib/cgi-bin/apps/tclscripts/PM5337_util.tcl ################################################ ##### 1. Temporarily disable MAPS function ##### ################################################ admwrb $devID 0x8009 0 0 ################################################ ##### 2. Ingress Source Configuration ##### ################################################ # Define the number of STM1 needs to be configure # mode 1 - STM1#1 to STM1#4 are configured # mode 2 - STM1#1 to STM1#8 are configured # mode 3 - STM1#1 to STM1#12 are configured # mode 4 - STM1#1 to STM1#16 are configured if {$mode == 1} { set max_STM1 0x3 } elseif {$mode == 2} { set max_STM1 0x7 } elseif {$mode == 3} { set max_STM1 0xB } elseif {$mode == 4} { set max_STM1 0xF } # In this example, only Ingress Source 0 and 1 are enabled. # Ingress Source 0 is assigned with a lower routing cost than # Ingress Source 1 for all paths. for {set stm1 0x0} {$stm1 <= $max_STM1} {incr stm1 0x1} { for {set stm0 0x0} {$stm0 <= 0x2} {incr stm0 0x1} { for {set tug2 0x0} {$tug2 <= 0x6} {incr tug2 0x1} { for {set tu 0x0} {$tu <= 0x3} {incr tu 0x1} { set i0_rcost 0x0 set i0_enable 0x1 set i1_rcost 0x1 set i1_enable 0x1 set value [expr ($i0_rcost << 0)|($i0_enable << 2)|($i1_rcost << 4)|($i1_enable << 6)] set value [dec2hex $value] # Defining register address offset for link 1 and write # settings set addr [expr 0x9000 + ($stm1 << 7)|($stm0 << 5)|($tug2 << 2)|$tu] set addr [dec2hex $addr] admwr $devID $addr $value } } } } ################################################ ##### 3. Protection Group Configuration ##### ################################################ # Specific which protection group state machine to use for {set stm1 0x0} {$stm1 <= $max_STM1} {incr stm1 0x1} { for {set stm0 0x0} {$stm0 <= 0x2} {incr stm0 0x1} { for {set tug2 0x0} {$tug2 <= 0x6} {incr tug2 0x1} { for {set tu 0x0} {$tu <= 0x3} {incr tu 0x1} { # Write PG_ASMSEL[4:0] settings to LOMP Protection Group # Configuration Register set addr [expr 0x9800 + [expr $stm1 << 7]|[expr $stm0 << 5]|[expr $tug2 << 2]|$tu] set value1 [expr $statemachine << 8] admwr $devID $addr $value1 } } } } ################################################ ##### 4. Timer Configuration Procedure ##### ################################################ # The following example shows how to configure the timer. Only # the first set of timer is configured. # a) Configure the pre-scalar values in the first LOMP block # # For this example, the pre-scalar interval #1 is set to 1 second admwr $devID 0x8002 0x1F3F # b) Configure the pre-hold timer, select which pre-scalar to use admwr $devID 0x8006 $timer # c) Configure the post-hold timer admwr $devID 0x8007 $timer # d) Configure the WTR timer admwr $devID 0x8008 $timer # e) Configure the protection group good level if the WTR timer # is used # For this example, the protection group good level is set to an # F-Code of 0x1 if {$statemachine == 0x2 || $statemachine == 0x5} { for {set stm1 0x0} {$stm1 <= $max_STM1} {incr stm1 0x1} { for {set stm0 0x0} {$stm0 <= 0x2} {incr stm0 0x1} { for {set tug2 0x0} {$tug2 <= 0x6} {incr tug2 0x1} { for {set tu 0x0} {$tu <= 0x3} {incr tu 0x1} { # Defining register address offset set addr [expr 0x9000 + [expr $stm1 << 7]|[expr $stm0 << 5]|[expr $tug2 << 2]|$tu] set pg_glvl 0x1 set ivalue [expr [admrd $devID $addr] & 0xFFC0FFFF] set value [expr $ivalue | [expr $pg_glvl << 16]] admwr $devID $addr $value } } } } } ################################################ ##### 5. Enable MAPS function ##### ################################################ admwrb $devID 0x8009 0 1 }#------------------------------------------------------------------# SCRIPT NAME: CORE_XC_LOSU_MAPS_Config## DESCRIPTION: This procedure initializes the LOSU block in# the ADM622 device when MAPS is enabled. ## payload - STS-1, STS-3c, STS-12c, VT15, VT2, VT3, # VT6, AU3/C3, AU4/C4, AU4-4c, AU3/TU11, # AU3/TU12, AU3/TU2, AU4/TU11, AU4/TU12, # AU4/TU2, AU4/TU3## g2i_col - 0x1 to 0x5A (90) # # g2i_row - 0x1 to 0x9 ## mode - This parameter is used to reduce the configuration# steps when some connections in the STM-16 frame are # unused. When set to:## 1 - Only STM-4 #1 is configured# 2 - Only STM-4 #1, STM-4 #2 are configured# 3 - Only STM-4 #1, STM-4 #2, STM-4#3 are configured# 4 - STM4 #1, STM-4 #2, STM-4 #3 and STM-4#4 are configured# # If payload type is TU12 or VT2, mode must be set # to 4. ## NOTES: 1. The following script assumes the hardware CMPS and # CMP_TRIG pins are pull low. ## 2. This script assumes all payload types are identical. # This script needs to be modify to switch mixture of # payloads.## 3. The default mapping is straigh-through, the code will # need to be modified for other mappings. ## 4. Only CM1 (ingress source 1) and CM2 (ingress source 2) # are programmed, CM3 and CM4 are not configured. ## 5. If payload types is TU12 or VT2, the whole STM-16 link# must be configured, or unused time slot must be set to# UNUSED. If unused timeslot is left unconfigured, the # whole STM-16 link will be corrupted.## 6. The default connection is set as following:# - CM1 is configured to take traffic from input link 1# - CM2 is configured to take traffic from input link 2## Input Link 1 (CM1) --------\# -------> Output# Input Link 2 (CM2) --------/##-------------------------------------------------------------------proc CORE_XC_LOSU_MAPS_Config {devID payload g2i_col g2i_row mode} { source /usr/lib/cgi-bin/apps/tclscripts/PM5337_util.tcl ############################################# #### 1. Temporarily Diable MAPS function #### ############################################# admwrb $devID 0x2000 16 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -