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

📄 pm5337_line_sonet_hopp.tcl

📁 用于EOS芯片的驱动程序, 供参考 参考
💻 TCL
📖 第 1 页 / 共 3 页
字号:
#------------------------------------------------------------------------------# FILE NAME: PM5337_LINE_SONET_HOPP.tcl## DESCRIPTION: 	This file includes the following procedures:#               1) LINE_SONET_HO_Payload_Config#               2) LINE_SONET_HO_Trace_Config#               3) LINE_SONET_HO_BER_Config#               4) LINE_SONET_HO_MAPS_Config#               5) LINE_SONET_HO_MAPS_SW_Path_Config#               6) LINE_SONET_HO_MAPS_SW_Line_Config#			# NOTES:## REVISION History:# Preliminary 1 - Script created#------------------------------------------------------------------------------#------------------------------------------------------------------------------# SCRIPT NAME:  LINE_SONET_HO_Payload_Config## DESCRIPTION:  This procedure configures the High Order Payload #               LINE_SONET subsystem. #               # PARAMETERS:   devID     - This parameter is used to specify the device #                           under configuration       ##               interface - 1 (interface 1), 2 (interface 2)##               payload   - STS-1, STS-3c, STS-12c, AU3, AU4, #			    AU4-4c## NOTES:  For rate = OC-3, only time slot 1,5,9 are used.  Rx and #	  Tx config matched.#------------------------------------------------------------------------------proc LINE_SONET_HO_Payload_Config {devID interface payload} {  source /usr/lib/cgi-bin/apps/tclscripts/PM5337_util.tcl    #### Define address for rx, tx based on line interface ###    set rxaddr [expr (0x1005+($interface-1))]    # Interface 2 for tx uses register 0x1009  set txaddr [expr (0x1007+($interface-1)*2)]      ############################################  ##### Configure High Order Playload    #####  ############################################   ### Configure time slots ###  # The options in a STS-12/STM-4 data stream are:   # M = master, S = Slave, X = don't care  #                                     HOPP configuration        # 12x AU3 with C3 (STS-1 with no VT): MMMM MMMM MMMM    # 12x AU3 with TU (STS-1 with VT):    MMMM MMMM MMMM    # 4x AU4 with C4 (4x STS-3c):         MMMM SSSS SSSS    # 1x AU4-4c (1x STS-12c):             MSSS SSSS SSSS    # 4x AU4 with TUG3 (Invalid in SONET):MMMM SSSS SSSS    #  # The options in a STS-3/STM-1 data stream are:  #                                     HOPP configuration        # 3x AU3 with C3 (STS-1 with no VT):  MXXX MXXX MXXX  # 3x AU3 with TU (STS-1 with VT):     MXXX MXXX MXXX  # 1x AU4 with C4 (4x STS-3c):         MXXX SXXX SXXX  # 1x AU4 with TUG3 (Invalid in SONET):MXXX SXXX SXXX   if {$payload == "AU3" || $payload == "STS-1"} {    # Set all time slots to masters      admwr $devID $rxaddr 0x0000FFFF    admwr $devID $txaddr 0x0000FFFF        } elseif {$payload == "AU4" || $payload == "STS-3c"} {    # Set first four time slots to masters    admwr $devID $rxaddr 0x0000000F    admwr $devID $txaddr 0x0000000F         } elseif {$payload == "AU4-4c" || $payload == "STS-12c"} {            ### AU4-4C or STS-12C ###    # Set first time slot to master, all other slaves            admwr $devID $rxaddr 0x00000001    admwr $devID $txaddr 0x00000001  }     ####################  # THPP block setup #  ####################    if {$interface == 1} {      for {set sts3 0x0} {$sts3 <= 0x3} {incr sts3} {      for {set sts1 0x0} {$sts1 <= 0x2} {incr sts1} {        # Set SS bit        admindwr 0 LINE_SONET::LINEINTF::TSVCA_1 0x4800 0x5 $sts3 $sts1        # Enable REGC2EN and disable G1 insertion        admindwr 0 LINE_SONET::HOPP::THPP_1 0x0002 0x01 $sts3 $sts1        # Set C2 to 0x01        admindwr 0 LINE_SONET::HOPP::THPP_1 0x0100 0x03 $sts3 $sts1      }    }      }  if {$interface == 2} {      for {set sts3 0x0} {$sts3 <= 0x3} {incr sts3} {      for {set sts1 0x0} {$sts1 <= 0x2} {incr sts1} {        # Set SS bit        admindwr 0 LINE_SONET::LINEINTF::TSVCA_2 0x4800 0x5 $sts3 $sts1        # Enable REGC2EN and disable G1 insertion        admindwr 0 LINE_SONET::HOPP::THPP_2 0x0002 0x01 $sts3 $sts1        # Set C2 to 0x01        admindwr 0 LINE_SONET::HOPP::THPP_2 0x0100 0x03 $sts3 $sts1      }    }      }  }#------------------------------------------------------------------------------# SCRIPT NAME:	LINE_SONET_HO_Trace_Config## DESCRIPTION:	This procedure configures the RTTP blocks in#               the HOPP.#		# PARAMETERS:	devID     - This parameter is used to specify the device #                           under configuration  #               interface - 1, 2#                    algo - '1', '2', or '3' (see datasheet for details)#                length16 - '0' for 64 bytes or '1' for 16 byte#                    sync - '0' algorithm will synchronize when receiving#                               a byte with it MSB set to 1 #                           '1' algorithm will synchrnoize when receiving#                               a byte with CR/LF	          #                    stm1 - 0 to 3 (STS-3/STM1 #1~#4)#                    stm0 - 0 to 2 (STS-1/STM0 #1~#3)#                  enable - '1' to enable or '0' to disable## NOTE:	      Default trace message in ASCII is#             FF CR 1 2 3 4 5 6 7 8 9 A B C D##------------------------------------------------------------------------------proc LINE_SONET_HO_Trace_Config {devID interface algo length16 sync stm1 stm0 enable} {  source /usr/lib/cgi-bin/apps/tclscripts/PM5337_util.tcl                                     ##### Defining system block name #####  if {$interface == 1 } {     set RTTP "LINE_SONET::HOPP::RTTP_1"  } elseif {$interface == 2} {    set RTTP "LINE_SONET::HOPP::RTTP_2"  }          #### Enable Section Trace Message Monitoring for Interface 1 ###    if {$enable == 1} {    # 1. Set ALOG[1:0] to 0 to disable trace monitoring in all paths    admindwr $devID $RTTP 0x0000 0x03 $stm1 $stm0    # 2. Program the expected trace message for the first 16 bytes    #    Program 64 bytes if required (length16 = 0)            admindwr $devID $RTTP 0xCD 0xC0 $stm1 $stm0    admindwr $devID $RTTP 0x30 0xC1 $stm1 $stm0        admindwr $devID $RTTP 0x31 0xC2 $stm1 $stm0        admindwr $devID $RTTP 0x32 0xC3 $stm1 $stm0        admindwr $devID $RTTP 0x33 0xC4 $stm1 $stm0       admindwr $devID $RTTP 0x34 0xC5 $stm1 $stm0        admindwr $devID $RTTP 0x35 0xC6 $stm1 $stm0        admindwr $devID $RTTP 0x36 0xC7 $stm1 $stm0        admindwr $devID $RTTP 0x37 0xC8 $stm1 $stm0    admindwr $devID $RTTP 0x38 0xC9 $stm1 $stm0    admindwr $devID $RTTP 0x39 0xCa $stm1 $stm0    admindwr $devID $RTTP 0x41 0xCb $stm1 $stm0    admindwr $devID $RTTP 0x42 0xCc $stm1 $stm0    admindwr $devID $RTTP 0x43 0xCd $stm1 $stm0    admindwr $devID $RTTP 0x44 0xCe $stm1 $stm0    admindwr $devID $RTTP 0x45 0xCf $stm1 $stm0             # 3. Set ALGO [1:0], LENGTH16 and SYNC_CRLF value        #    Make sure bit 6 (RESERVED_1) is set to 1    set configvalue [expr [expr $algo << 0]|[expr $length16 << 2]|[expr $sync << 5]]    admindwr $devID $RTTP $configvalue 0x03 $stm1 $stm0    #### Disable Section Trace Message Monitoring for Interface 1 ###       } elseif {$enable == 0} {      # set ALOG[1:0] to 0 to disable trace monitoring      admindwr $devID $RTTP 0x0000 0x03 $stm1 $stm0  }}#------------------------------------------------------------------------------# SCRIPT NAME:  LINE_SONET_HO_BER_Config## DESCRIPTION:  This procedure provides examples of how to:#               - enable and configure the PBER blocks for Signal Degrade detection#               - enable and configure the PBER blocks for Signal Failure detection#               - disable the PBER Signal Degrade detection feature#               - disable the PBER Signal Failure detection feature##  PARAMETERS : devID  - This parameter is used to specify the device #                        under configuration.##               interface - '1' or '2'##               payload - STS-1, STS-3c, STS-12c##               ber_rate  - 3 to 11 ##               sd_sf     - 0 (SF), 1 (SD)##               enable    - 1 (enabled), 0 (disabled)##		stm1      - 0~3 (STS-3/STM1 #1~#4) [optional]##		stm0      - 0~2 (STS-1/STM0 #1~#3) [optional]#               #  NOTE : 	If no values are specified for stm1 or stm0, then#		the process configures all paths.##------------------------------------------------------------------------------proc LINE_SONET_HO_BER_Config {devID interface payload ber_rate sd_sf enable {stm1 -1} {stm0 -1}} {  source /usr/lib/cgi-bin/apps/tclscripts/PM5337_util.tcl       #####################################################################################  ##### Defining Set Integration Period, Set Threshold and Clear Threshold values #####  #####################################################################################    # ipH = High Word of Integration Period  # ipL = Low Word of Integration Period  # sthre = Set Threshold  # cthre = Clear Threshold    if {$payload == "STS-1"} {    if {$ber_rate == 3} {      set ipH 0x0000      set ipL 0x0014      set sthre 0x02A      set cthre 0x024    } elseif {$ber_rate == 4} {      set ipH 0x0000      set ipL 0x0044      set sthre 0x017      set cthre 0x010    } elseif {$ber_rate == 5} {      set ipH 0x0000      set ipL 0x0261      set sthre 0x016      set cthre 0x00F    } elseif {$ber_rate == 6} {      set ipH 0x0000      set ipL 0x177F      set sthre 0x015      set cthre 0x00F    } elseif {$ber_rate == 7} {      set ipH 0x0000      set ipL 0xEAB1      set sthre 0x15      set cthre 0x00F    } elseif {$ber_rate == 8} {      set ipH 0x0009      set ipL 0x2AA7      set sthre 0x015      set cthre 0x00F    } elseif {$ber_rate == 9} {      set ipH 0x005B      set ipL 0xAA40      set sthre 0x015      set cthre 0x00F    } elseif {$ber_rate == 10} {      set ipH 0x0394      set ipL 0xA638      set sthre 0x015      set cthre 0x00F    }   }    if {$payload == "STS-3c"} {    if {$ber_rate == 4} {      set ipH 0x0000      set ipL 0x001D      set sthre 0x01A      set cthre 0x014    } elseif {$ber_rate == 5} {      set ipH 0x0000      set ipL 0x00D0      set sthre 0x016      set cthre 0x00F    } elseif {$ber_rate == 6} {      set ipH 0x0000      set ipL 0x07DA      set sthre 0x015      set cthre 0x00F    } elseif {$ber_rate == 7} {      set ipH 0x0000      set ipL 0x4E40      set sthre 0x15      set cthre 0x00F    } elseif {$ber_rate == 8} {      set ipH 0x0003      set ipL 0x0E3D      set sthre 0x015      set cthre 0x00F    } elseif {$ber_rate == 9} {      set ipH 0x001E      set ipL 0x8E1B      set sthre 0x015      set cthre 0x00F    } elseif {$ber_rate == 10} {      set ipH 0x0131      set ipL 0x8CC3      set sthre 0x015      set cthre 0x00F    } elseif {$ber_rate == 11} {      set ipH 0x0BEF      set ipL 0x7F53      set sthre 0x015      set cthre 0x00F    }  }    if {$payload == "STS-12c"} {        if {$ber_rate == 4} {      set ipH 0x0000      set ipL 0x0014      set sthre 0x02E      set cthre 0x029    } elseif {$ber_rate == 5} {      set ipH 0x0000      set ipL 0x003B      set sthre 0x018      set cthre 0x011    } elseif {$ber_rate == 6} {      set ipH 0x0000      set ipL 0x01FD      set sthre 0x16      set cthre 0x00F    } elseif {$ber_rate == 7} {      set ipH 0x0000      set ipL 0x1396      set sthre 0x015      set cthre 0x00F    } elseif {$ber_rate == 8} {      set ipH 0x0000      set ipL 0xC395      set sthre 0x015      set cthre 0x00F

⌨️ 快捷键说明

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