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

📄 pm5337_pdh.tcl

📁 用于EOS芯片的驱动程序, 供参考 参考
💻 TCL
📖 第 1 页 / 共 5 页
字号:
      ##############################################################      ### Mode 0: Mapping/demapping DS1 to/from AU3/TU11 (VT1.5) ###      ### Mode 3: Mapping/demapping DS1 to/from AU4/TU11         ###              ##############################################################      set stm1_ind 0x4      set tug3_ind 0x1            for {set tug2_ind 0x1} {$tug2_ind <= 0x7} {incr tug2_ind} {        for {set tu_ind 0x1} {$tu_ind <= 0x4} {incr tu_ind} {          # Ensure Busy Bit is low          Poll_BUSY_Bit $devID 0xC280 15                  # Set CONFIG[1:0] to 11b for VT-1.5          admwr $devID 0xC281 0x00001800                  # Trigger Indirect Access          set iaddr_value [expr [expr $stm1_ind << 8]|[expr $tug3_ind << 6]|[expr $tug2_ind << 3]|$tu_ind]          set iaddr_value [dec2hex $iaddr_value]          admwr $devID 0xC280 $iaddr_value          }      }            }        if {$mode == 1 || $mode == 2 || $mode == 4 || $mode == 5 } {        ############################################################      ### Mode 1: Mapping/demapping E1 to/from AU3/TU12        ###      ### Mode 2: Mapping/demapping DS1 to/from AU3/TU12 (VT2) ###      ### Mode 4: Mapping/demapping DS1 to/from AU4/TU12 (VT2) ###      ### Mode 5: Mapping/demapping E1 to/from AU4/TU12 (VT2)  ###      ############################################################        set stm1_ind 0x4      set tug3_ind 0x1          for {set tug2_ind 0x1} {$tug2_ind <= 0x7} {incr tug2_ind} {        for {set tu_ind 0x1} {$tu_ind <= 0x3} {incr tu_ind} {          # Ensure Busy Bit is low          Poll_BUSY_Bit $devID 0xC280 15                # Set CONFIG[1:0] to 10b for VT-2          admwr $devID 0xC281 0x00001000                # Trigger Indirect Access          set iaddr_value [expr [expr $stm1_ind << 8]|[expr $tug3_ind << 6]|[expr $tug2_ind << 3]|$tu_ind]          set iaddr_value [dec2hex $iaddr_value]          admwr $devID 0xC280 $iaddr_value        }      }            }    }                  ###########################################  ###  Software Workaround for Errata 2.3 ###  ###########################################   # Loop through all provisioned links, setting MAP_CAPTURE_ADDRESS[6:5]=0b00,   # MAP_CAPTURE_ADDRESS[4:3]=TU # (0-3), # and MAP_CAPTURE_ADDRESS[2:0]=TUG2 # (0-6).    # For each link, read MAP_CAPTURE_DATA[1:0].      # 1. If MAP_CAPTURE_DATA[1:0] is not equal to 0b00, perform the following step:    # 2. Reset and configure TTMP  # 3. Reset and configure DE1_FRMR    # 4. Check MAP_CAPTURE_DATA[1:0] again  # 5. Perform step 1 again if MAP_CAPTURE_DATA[1:0] is not 00b.  #  # If MAP_CAPTURE_DATA[1:0] is equal to 0b00, perform the following step:  # 1. Configure JAT and ELST  #     ##########################################################  ### Workaround Step 1 (Checking MAP_CAPTURE_DATA[1:0]) ###  ##########################################################    set flag 0     wr adm 0xcfe8 0x80 ;# setting MAP_CAPTURE_ENABLE = 1  for {set tug2_ind 0} {$tug2_ind <= 6} {incr tug2_ind} {    for {set tu_ind 0} {$tu_ind <= 3} {incr tu_ind} {                  set map_capture_addr [expr ($tu_ind << 3)|($tug2_ind << 0)]      admwr $devID 0xCFE7 $map_capture_addr      after 10      set map_capture_data [expr [admrd $devID 0xCFE9]& 0x3]                      if {$map_capture_data != 0} {        set flag 1              }          }  }    # Use counter to track the number of reset  set loopcounter 0        while {$flag == 1} {          #######################################################    ### Workaround Step 2 (Reset and Reconfigure TTMP)  ###    #######################################################        admwrb $devID 0xC000 18 1    after 1    admwrb $devID 0xC000 18 0    after 1    wr adm 0xcfe8 0x80 ;# setting MAP_CAPTURE_ENABLE = 1        ##### Configuring TTMP block to process the proper payload types #####    if {$mode == 0 || $mode == 3} {                        ### Mode 0: Mapping/demapping DS1 to/from AU3/TU11 (VT1.5) ###      ### Mode 3: Mapping/demapping DS1 to/from AU4/TU11         ###                        # Configuring TU 1 Tributary Control Register      for {set tug2_ind 0} {$tug2_ind <= 6} {incr tug2_ind} {        set addr [expr 0xCF80 + $tug2_ind]        set addr [dec2hex $addr]        # Set TU11 = 1, T1 = 1, PROV = 1        admwr $devID $addr 0x0000000E0          }      # Configuring TU 2 to 4 Tributary Control Register          for {set tug2_ind 0} {$tug2_ind <= 6} {incr tug2_ind} {        for {set tu_ind 0} {$tu_ind <= 2} {incr tu_ind} {          set addr [expr 0xCF88 + $tug2_ind + (8*$tu_ind)]          set addr [dec2hex $addr]          # Set T1 = 1, PROV = 1          admwr $devID $addr 0x000000060            }      }              } elseif {$mode == 1 || $mode == 5} {             ### Mode 1: Mapping/demapping E1 to/from AU3/TU12 ###        ### Mode 5: Mapping/demapping E1 to/from AU4/TU12 (VT2) ###              # Configuring TU 1 Tributary Control Register      for {set tug2_ind 0} {$tug2_ind <= 6} {incr tug2_ind} {        set addr [expr 0xCF80 + $tug2_ind]        set addr [dec2hex $addr]        # Set TU11 = 0, T1 = 0, PROV = 1        admwr $devID $addr 0x000000020          }      # Configuring TU 2 to 4 Tributary Control Register          for {set tug2_ind 0} {$tug2_ind <= 6} {incr tug2_ind} {        for {set tu_ind 0} {$tu_ind <= 2} {incr tu_ind} {          set addr [expr 0xCF88 + $tug2_ind + (8*$tu_ind)]          set addr [dec2hex $addr]          # Set T1 = 0, PROV = 1          admwr $devID $addr 0x000000020            }      }           } elseif {$mode == 2 || $mode == 4} {                 ### Mode 2: Mapping/demapping DS1 to/from AU3/TU12 (VT2) ###      ### Mode 4: Mapping/demapping DS1 to/from AU4/TU12 (VT2) ###                 # Configuring TU 1 Tributary Control Register      for {set tug2_ind 0} {$tug2_ind <= 6} {incr tug2_ind} {        set addr [expr 0xCE00 + $tug2_ind]        set addr [dec2hex $addr]        # Set TU11 = 0, T1 = 1, PROV = 1        admwr $devID $addr 0x000000060          }      # Configuring TU 2 to 4 Tributary Control Register          for {set tug2_ind 0} {$tug2_ind <= 6} {incr tug2_ind} {        for {set tu_ind 0} {$tu_ind <= 2} {incr tu_ind} {          set addr [expr 0xCE08 + $tug2_ind + (8*$tu_ind)]          set addr [dec2hex $addr]          # Set T1 = 1, PROV = 1          admwr $devID $addr 0x000000060            }      }         }           #######################################################    ### Workaround Step 3 (Reset and Reconfigure FRMR)  ###    #######################################################          admwrb $devID 0xCC04 1 1    after 1    admwrb $devID 0xCC04 1 0    after 1        # Set T1 framing mode      if {$mode == 0 || $mode == 2 || $mode == 3 || $mode == 4} {            # spe = 1 specifies drop path      # spe = 2 specifies add path      # index = 1 to 28 specifies the T1 index          for {set spe 1} {$spe <= 2} {incr spe} {      #set spe 2        for {set index 1} {$index <= 28} {incr index} {          set index [format "0x%04X" $index]          set val [expr ([admindrd $devID PDH_SONET::DE1_SLICE::DS1E1_FRMR 0xCC12 0 0 $spe $index] & 0xFC7F)];                    if {$t1_framing == 0} {              #D4            set val [expr ($val | 0x0000)]                      } elseif {$t1_framing == 1} {            #SLC96            set val [expr ($val | 0x0100)]          } elseif {$t1_framing == 2} {            #Transparent            set val [expr ($val | 0x0080)]          } elseif {$t1_framing == 3} {            #ESF            set val [expr ($val | 0x0600)]          }           set val [format "0x%04X" $val]          #puts $val          admindwr $devID PDH_SONET::DE1_SLICE::DS1E1_FRMR $val 0xCC12 0 0 $spe $index                    # Configure JPN bit           set val [expr ([admindrd $devID PDH_SONET::DE1_SLICE::DS1E1_FRMR 0xCC13 0 0 $spe $index] & 0x7ff7)];          set val [expr ($val | ($jpn << 15))]          admindwr $devID PDH_SONET::DE1_SLICE::DS1E1_FRMR $val 0xCC13 0 0 $spe $index                                }      }    }     # Set E1 framer to transparent mode (unframed)    if {$mode == 1 || $mode == 5} {           # spe = 1 specifies drop path      # spe = 2 specifies add path      # index = 1 to 21 specifies the T1 index                for {set spe 1} {$spe <= 2} {incr spe} {      #set spe 2        for {set index 1} {$index <= 21} {incr index} {          set index [format "0x%04X" $index]          set val [expr ([admindrd $devID PDH_SONET::DE1_SLICE::DS1E1_FRMR 0xCC12 0 0 $spe $index] & 0xF47F)];                    if {$e1_framing == 1} {              #PMC31            set val [expr ($val | 0x0100)]                      } elseif {$e1_framing == 0} {            #PMC30            set val [expr ($val | 0x0000)]                      }                               set val [expr ($val | ($crc << 7) | ($crc << 11) | 1 << 9)]          set val [format "0x%04X" $val]                    admindwr $devID PDH_SONET::DE1_SLICE::DS1E1_FRMR $val 0xCC12 0 0 $spe $index                              set val [expr ([admindrd $devID PDH_SONET::DE1_SLICE::DS1E1_FRMR 0xCC13 0 0 $spe $index] & 0xfff6)];                    if {$e1_framing == 2} {            set val [expr ($val | 1)];          }          admindwr $devID PDH_SONET::DE1_SLICE::DS1E1_FRMR $val 0xCC13 0 0 $spe $index                                 }      }    }                  ##########################################################    ### Workaround Step 5 (Re-check MAP_CAPTURE_DATA[1:0]) ###    ##########################################################        set flag 0       wr adm 0xcfe8 0x80 ;# setting MAP_CAPTURE_ENABLE = 1    for {set tug2_ind 0} {$tug2_ind <= 6} {incr tug2_ind} {      for {set tu_ind 0} {$tu_ind <= 3} {incr tu_ind} {                      set map_capture_addr [expr ($tu_ind << 3)|($tug2_ind << 0)]        admwr $devID 0xCFE7 $map_capture_addr        after 10        set map_capture_data [expr [admrd $devID 0xCFE9]& 0x3]                          if {$map_capture_data != 0} {          set flag 1                }            }    }        # Increment counter    set loopcounter [expr $loopcounter + 1]    if {$loopcounter >= 10} {      puts "Error: Errata 2.3 workaround looped 10 times"      return      }                 }    ##############################################################################################  # Workaround Completed  ##############################################################################################          ##############################  ##### JAT  Configuration #####  ##############################  ### For the ADD direction (SPE = 2) ###  # 0xCC0E Bit 6 - REFSEL = 0  # 0xCC0E Bit 1 - ACKEN = 0  # 0xCC0E Bit 0 - BYPASS = 1        for {set link 0x1} {$link <= 0x1C} {incr link} {    set link [dec2hex $link]        admindwr 0 PDH_SONET::DE1_SLICE::DS1E1_JAT 0x1 0x2 $link  }    # 0xCC0F Bit [7:6] - CLKMODE[1:0] = 10  for {set link 0x41} {$link <= 0x5C} {incr link} {    set link [dec2hex $link]    admwr $devID 0xCC0F 0x84    admwr $devID 0xCC0D $link    admwr $devID 0xCC0C 0x80    after 1     }   ### For the DROP direction (SPE = 1) ###    # 0xCC0E Bit 6 - REFSEL = 1  # 0xCC0E Bit 1 - ACKEN = 1  # 0xCC0E Bit 0 - BYPASS = 1    for {set link 0x1} {$link <= 0x1C} {incr link} {    set link [dec2hex $link]    admindwr 0 PDH_SONET::DE1_SLICE::DS1E1_JAT 0x43 0x1 $link  }  # 0xCC0F Bit [7:6] - CLKMODE[1:0] = 11    for {set link 0x21} {$link <= 0x3C} {incr link} {    set link [dec2hex $link]    admwr $devID 0xCC0F 0xC4    admwr $devID 0xCC0D $link    admwr $devID 0xCC0C 0x80    after 1     }           }#------------------------------------------------------------------------------# SCRIPT NAME:	PDH_EC1_Config## DESCRIPTION:	This script configures the EC1 interface in the PDH subsystem #		# PARAMETERS:   devID - This parameter is used to specify the device #                       under configuration#               #               intf - 0 (port 1), 1 (port 2), 2 (port 3)##               mode - valid value are from 0 to 2.  See Note for details.## NOTES:	mode          SONET/SDH Payload#               -----------------------------------------#                0            STS-1 or AU3/C3#                1            STS-1 with all VT1.5 (AU3 with all TU11)#                2            STS-1 with all VT2 (AU3 with all TU12)##------------------------------------------------------------------------------proc PDH_EC1_Config {devID intf mode} {     source /usr/lib/cgi-bin/apps/tclscripts/PM5337_util.tcl  

⌨️ 快捷键说明

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