98DX3236上电实现自动初始化系统和光口

来源:互联网 发布:手机游戏编程入门 编辑:程序博客网 时间:2024/06/05 00:34

1.背景

    98DX3236为Marvell的AlleyCat3系列交换机的SOC,可用于开发三层交换机,目前仅需要98DX3236实现二层交换机的功能即可,实现的效果是交换机开机后就可以直接使用,不需要通过luaCLI命令来初始化交换机系统和端口[1]。

    在《98DX3236初始化脚本程序》一文中,使用了以下三组命令用于实现交换机的系统和端口的初始化:

(1)初始化系统

配置命令:

Console# cpssinitsystem 19,2,0
作用:初始化交换机系统,使网络口Port 0-Port 23工作在QSGMII模式下,网速为10/100/1000自适应。

(2)初始化光口

配置命令:

Console# configure
Console(config)# interface range ethernet 0/24-27
Console(config-if)# speed 10000 mode SR_LR
Console(config-if)# end
作用:使光口Port 24-Port 27工作在SR_LR模式,光口速率为10000M。
(3)25号和27号光口接收与发送端极性对调
配置命令:
Console# cpss-api call cpssDxChPortSerdesPolaritySet devNum 0 portNum 25 laneBmp 1 invertTx true invertRx false
Console# cpss-api call cpssDxChPortSerdesPolaritySet devNum 0 portNum 27 laneBmp 1 invertTx true invertRx true
作用:在交换机的PCB上,考虑到布线的方便,25号光口的Tx_P与Tx_N反接,Rx_P与Rx_N反接,27号光口的Tx_P与Tx_N反接,
为了使25号和27号光口正常工作,需要通过软件设置将25号和27号的Tx口正负极对调,再将27号口的Rx的正负极对调。

98DX3236内核调试目标:将以上三组命令直接编写到CPSS源代码中,实现交换机上电后后自动配置系统和端口的功能。

2.调试环境

软件:
(1)虚拟机:                     VMware Workstation10.0.1
(2)Linux操作系统:         ubuntu14.10
(3)CPSS源码阅读器:     Source Insight 3.50.0038
(4)串口调试工具:          SecureCRT 5.2.2
(5)命令提示符cmd

说明:
    ubuntu14.10操作系统用于搭建linux交叉编译环境,命令提示符cmd配合命令ping用来测试端口的连通性。

硬件:
(1)FAT32格式的U盘              *1
(2)串口转RJ45连接线           *1
(3)万兆光纤线                       *1
(4)超5类网线                        *2
(5)12V电源适配器                 *2
(6)98DX3236开发板             *2

说明:
    98DX3236通过USB口烧写内核文件,烧写过程详见《Marvell 98DX3236系列交换机Uboot及内核文件烧写》[2],USB口仅支持格式为FAT32的U盘,NTFS格式的不支持。
    测试交换机的网络口时,需要使用两条网线,每条网线的一头接交换机的一个网口,另一头接电脑或者路由器,通过命令“ping IP地址 -t”依次检验交换机24口之间的连通性。
    测试交换机的万兆光纤口时,需将两块交换机的任意一个网络口通过网线连接路由器或者电脑网口,两块交换机之间需要通过万兆光纤线连接,最后通过命令“ping IP地址 -t”依次检验两块开发板光口之间的连通性。

3.面临的问题

(1)如何实现交换机上电后自动初始化系统和端口?
最初有三种解决思路:

思路一:编写配置脚本文件(*.sh文件),当交换机系统启动后让该文件自动运行;

思路二:使交换机上电时工作在Fast Boot模式,交换机的初始化工作通过EPROM内写入的寄存器配置来完成;

思路三:直接修改CPSS源代码,当交换机上电后进入luaCLI的界面中,自动完成系统和端口的初始化。

    首先对思路一进行简单的分析,当交换机进入luaCLI命令窗口时,通过使用指令“CLIexit”可以退出命令行模式,

接着在串口中输入命令“osShell”,可以进入交换机操作系统的根文件系统,具体操作如下:

Console# CLIexit->osShellBusyBox v1.01 (2017.10.11-07:36+0000) Built-in shell (ash)Enter 'help' for a list of built-in commands./ # ls3240_0400_6270.bin      home                    sbin88X32xx-FW.hdr          init                    sys88X33xx-Z2-FW.hdr       lib                     tmpbin                     linuxrc                 usrdev                     mnt                     varetc                     procflashdownloadslave.bin  root/ # 
思路一在后续的摸索中遇到了一些无法克服的问题,比如:Xcat3交换机无法通过NFS或者TFTP协议传输文件、交换机操作系统
的文件系统大部分只有可读不可写的权限、Marvell根文件夹系统与通用的Linux根文件系统差别比较大,不知从何改起。在调试
的后期,思路一直接放弃了!

    思路二Fast Boot模式,在文档《MV-S800865-00C---CPSS-4.1-User-Guide》的第37章第2小节有简短的介绍,主要难点有
系统中断的设置和EPROM程序,由于无法找到突破口,此思路也被放弃。

    思路三是后期调试中意外发现的,主要难点在于需要修改什么文件,需要调用什么功能函数,通过什么手段可以找到突破口?

(2)修改CPSS源码时,如何定位需要修改的C文件,定位后需要添加那些功能函数才能实现我想要的功能?

1)关于交换机以太网口的的初始化,可以通过以下调试信息找到突破口:

Console# cpssinitsystem 19,2,0   bspPciGetIntVec (single) int vector 0x21, internal Int 0x0  bspPciGetIntVec (single) int vector 0x21, internal Int 0x0  Device[0] ID 0xF40011AB revision A1  Core clock = 167Mhz    Allocating 32784 bytes for DMA  Allocating 32784 bytes for DMA  Allocating 32000 bytes for DMA  Allocating 3200 bytes for DMA  Allocating 309601 bytes for DMA  Allocating 45232 bytes for DMA  Allocating 45232 bytes for DMA  Warning:Tried to allocate 8388608 which is bigger than the memory chunk size.     [UTF]: utfInit: ************************  [UTF]: prvUtfExtrasInit: PP dev [0], phy ports [28], virt ports [64] ports bmp[0x0fffffff]  UTF: used port type [PRV_TGF_28_PORT_DEVICE_TYPE_E] , with ports up to[28]  [UTF]: utfInit: OK, number of tests [3562]  Run utfHelp 0 for help about UTF usage  [UTF]: utfInit: ************************      [UTF]: utfHelp: ****************************  *****UTF functions:*****  utfHelp             - to log a help about the function.  utfTestsList        - to log list of all configured (available) suits and tests.  utfTestsTypeList    - to log list of all configured suits by given UT type list (generic, enhanced, etc.)  utfTestsRun         - to run suits and tests  utfTestsTypeRun     - to run all UT by given UT type list (generic, enhanced, etc.)  utfLogOutputSelect  - to change output log mode (all, final, file, debug)  utfLogOpen          - to open logger with defined file name  utfLogClose         - to close logger  utfRandomRunModeSet - to set test's random run mode  utfTestRunFirstSet  - to put specific test to be run first    *****Examples:*****  utfHelp 0                - to printout this help info.  utfHelp "utfTestsList"   - to get detailed info about command "utfTestsList"  utfTestsList 0           - to log list of all configured (available) suits.  utfTestsList "tgfBridge" - to log list of test cases inside suit "tgfBridge".  utfTestsTypeList 6, 0    - to log list of all Enhanced UTs  utfTestsTypeList 1, 6, 0 - to log list of all Generic and Enhanced UTs  utfTestsRun 0, 1, 1      - to run all suits once with no interrupts after first failure  utfTestsRun "tgfBridge",1,1 - to run all tests from suit "tgfBridge" once  utfTestsRun "tgfBridge.tgfBasicDynamicLearning",1,1 - to run test "tgfBasicDynamicLearning" from suit "tgfBridge" once  utfTestsRun ".tgfBasicDynamicLearning",1,1 - to run test "tgfBasicDynamicLearning" once  utfTestsRun "tgfBridge-tgfIp",1,0 - to run all tests in a range between suits  utfTestsRun "suit1.test1-suit2.test2",1,0 - to run a range of tests starting from certain test to certain test  utfTestsRun "suit1-suit2.test",1,0 - to run a range of tests starting from certain suit to certain test  utfTestsTypeRun 1, 1, 6, 0 - to run all Enhanced UT    utfTestsTypeRun 1, 1, 1, 6, 0 - to run all Generic and Enhanced UT    utfLogOutputSelect 0     - to change output log to serial  utfLogOutputSelect 1     - to change output log to only final report  utfLogOutputSelect 2     - to change output log to file  utfLogOutputSelect 3     - to change output log to debug  utfLogOpen "results.log" - to set logger into file "results.log"  utfLogClose              - to close opened logger  utfRandomRunModeSet 1, 5 - to enable random run mode with seed 5 for random generator  utfTestRunFirstSet "tgfBasicDynamicLearning" - to run "tgfBasicDynamicLearning" test first  prvUtfSkipLongTestsFlagSet 1 - to state that when running tests skip those with 'long execution time'     Run utfHelp "utfTestsList" for example to get detailed info about command  [UTF]: utfHelp: ****************************    [UTF]: utfInit: enh-UT : tested ports are : 0 8 18 23   cpssInitSystem time: 0 sec., 325479939 nanosec.  Time processing the cpssInitSystem (from 'phase1 init') is [0] seconds + [322038232] nanoseconds   Init system returned:0  devices, ports to be used by LUA tests , and configuration files ==> {    {      dev=0,      port={ 0, 8, 18, 24, 20, 2 },      portCPU=63    }  }  Default PCL CFG Table Access mode configured on dev: 0  Console#   
调试信息中的关键信息是“cpssInitSystem time:”、“Time processing the cpssInitSystem (from 'phase1 init') is”等,通过
sourceInsight软件搜索以上关键信息,基本上可以定位cpssInitSystem()函数来自文件:
~/work/cpss/cpssEnabler/mainSysConfig/src/appDemo/boardConfig/appDemoBoardConfig.c

如果想将函数cpssInitSystem()添加在luaCLI的初始化程序中如何处理呢?
luaCLI的启动提示信息如下:

Call cpssInitSystem(index,boardRevId,reloadEeprom), where:          index        - The index of the system to be initialized.          boardRevId   - The index of the board revision.          reloadEeprom - Whether the device's eeprom should be reloaded                            after start-init.    CPSS Version Stream: CPSS_4.1_502  SW_INFRA_HWSERVICES_4.1_106  Cpss DxCh version: CPSS 4.1.12  LSP version:  LSP version: linux-3.4.69-2014_T2.1p13    ***************************************   Prestera commander shell server ready   ***************************************     Memory used by Lua 5515460  nChunks=63117     LUA CLI based on LUA 5.1 from www.lua.org   LUA CLI uses Mini-XML engine from www.minixml.org  ***************************************************                 LUA CLI shell ready  ***************************************************  
关键信息是:“LUA CLI shell ready”、“Prestera commander shell server ready”、
“LUA CLI based on LUA 5.1 from www.lua.org”、“LUA CLI uses Mini-XML engine from www.minixml.org”等,
通过sourceInsight软件搜索以上关键信息,基本上可以定位以上调试信息来自文件:
~/work/cpss/mainExtUtils/src/extUtils/luaCLI/luaCLIEngineCLI.c
那么,只需要在以上C程序的合理位置上调用cpssInitSystem()即可完成以太网口的初始化工作。

2)关于光口的模式速度配置以及接口极性的翻转

如果在luaCLIEngineCLI.c继续调用光口的设置函数,可能需要在其包含的*.h文件中添加大量的函数入口和特殊类变量的申明,
为了降低调试工作量,直接将光口的设置函数添加到C程序appDemoBoardConfig.c中的功能函数cpssInitSystem()的尾部。

关于部分光口的极性翻转,通过关键函数cpssDxChPortSerdesPolaritySet()很好定位,现在主要的工作是如何找到光口工作模式与速度控制的功能函数,通过关键字“SR_LR”,搜索出最有可能的功能函数名称如下:

static GT_STATUS internal_cpssDxChPortModeSpeedSet(    IN  GT_U8                           devNum,    IN  CPSS_PORTS_BMP_STC              portsBmp,    IN  GT_BOOL                         powerUp,    IN  CPSS_PORT_INTERFACE_MODE_ENT    ifMode,    IN  CPSS_PORT_SPEED_ENT             speed)GT_STATUS cpssDxChPortModeSpeedSet(    IN  GT_U8                           devNum,    IN  CPSS_PORTS_BMP_STC              portsBmp,    IN  GT_BOOL                         powerUp,    IN  CPSS_PORT_INTERFACE_MODE_ENT    ifMode,    IN  CPSS_PORT_SPEED_ENT             speed)static GT_STATUS prvCpssDxChPortXcat3ModeSpeedSet(    IN  GT_U8                           devNum,    IN  CPSS_PORTS_BMP_STC              portsBmp,    IN  GT_BOOL                         powerUp,    IN  CPSS_PORT_INTERFACE_MODE_ENT    ifMode,    IN  CPSS_PORT_SPEED_ENT             speed)GT_STATUS prvCpssDxChPortLion2InterfaceModeHwGet(    IN  GT_U8                          devNum,    IN  GT_PHYSICAL_PORT_NUM           portNum,    OUT CPSS_PORT_INTERFACE_MODE_ENT   *ifModePtr)
以上功能函数,究竟谁能实现光口的初始化配置,需要通过调试结果来判断,通过调试发现功能函数cpssDxChPortModeSpeedSet()
能够达到预期的要求。

4.具体调试过程

(1)实现自动配置cpssInitSystem(19,2,0)

第一步:在luaCLIEngineCLI.h中添加cpssInitSystem函数申明:

# gedit ~/work/cpss/mainExtUtils/h/extUtils/luaCLI/luaCLIEngineCLI.h

添加以下代码后,退出并保存!
/******************************************************************************** cpssReInitSystem** DESCRIPTION:*       Run cpssInitSystem according to previously initialized parameters** INPUTS:*       None.** OUTPUTS:*       None.** RETURNS:*       GT_OK   - on success,*       GT_FAIL - otherwise.** COMMENTS:*       None.********************************************************************************/GT_STATUS cpssInitSystem(    IN  GT_U32  boardIdx,    IN  GT_U32  boardRevId,    IN  GT_U32  reloadEeprom);
第二步:在luaCLI初始化函数中添加cpssInitSystem(19,2,0)的命令

# gedit ./cpss/mainExtUtils/src/extUtils/luaCLI/luaCLIEngineCLI.c

在代码/* accept and handle input as long as connected */
    while (IOStream->connected(IOStream))之前添加命令:

rc = cpssInitSystem(19,2,0);if(rc!=GT_OK)        return rc;

之后保存并退出;

以上调试思路存在两点错误:

第一,变量rc需要在luaCLIEngineCLI.c程序中申明;

第二,在rc已经申明的情况下,如果进行命令窗口的切换,会导致cpssInitSystem()被二次调用,系统程序会跑飞。

为了克服以上问题,请查看博文《Marvell交换机luaCLI引擎启动流程以及如何解决函数cpssInitSystem()被二次调用的问题 - CSDN博客 》


第三步:回到终端,在~/work目录下重新编译内核文件

# ./build_cpss.sh MSYS DX_ALL CUST

(2)实现光口初始化和部分光口极性翻转

思路:在函数cpssInitSystem()的尾部,添加端口模式速度配置函数cpssDxChPortModeSpeedSet()和串行信号极性翻转函数
cpssDxChPortSerdesPolaritySet(),它们的函数申明如下:

/******************************************************************************** cpssDxChPortModeSpeedSet** DESCRIPTION:*       Configure Interface mode and speed on a specified port and execute*        on port's serdeses power up sequence; or configure power down on port's*        serdeses.** APPLICABLE DEVICES:*        xCat; xCat3; Lion; xCat2; Lion2; Bobcat2; Caelum; Aldrin; AC3X; Bobcat3.** NOT APPLICABLE DEVICES:*        DxCh1; DxCh1_Diamond; DxCh2; DxCh3.** INPUTS:*       devNum    - physical device number*       portsBmp  - physical port number (or CPU port)*       powerUp   - serdes power:*                       GT_TRUE - up;*                       GT_FALSE - down;*       ifMode    - interface mode (related only for serdes power up [powerUp==GT_TRUE])*       speed     - port data speed (related only for serdes power up [powerUp==GT_TRUE])** OUTPUTS:*       None** RETURNS:*       GT_OK             - on success*       GT_BAD_PARAM      - on wrong port number or device*       GT_HW_ERROR       - on hardware error*       GT_NOT_SUPPORTED  - on not supported interface for given port*       GT_NOT_APPLICABLE_DEVICE - on not applicable device** COMMENTS:*        Supposed to replace old API's:*           cpssDxChPortInterfaceModeSet*           cpssDxChPortSpeedSet*           cpssDxChPortSerdesPowerStatusSet**       The API rolls back a port's mode and speed to their last values*       if they cannot be set together on the device.**       Pay attention! Before configure CPSS_PORT_INTERFACE_MODE_NO_SERDES_PORT_E*       MUST execute power down for port with this interface.**       Pay attention! Unlike other interfaces which are ready to forward traffic*       after this API pass, interlaken interfaces require call afterwards*       cpssDxChPortIlknChannelSpeedSet to configure channel.********************************************************************************/GT_STATUS cpssDxChPortModeSpeedSet(    IN  GT_U8                           devNum,    IN  CPSS_PORTS_BMP_STC              portsBmp,    IN  GT_BOOL                         powerUp,    IN  CPSS_PORT_INTERFACE_MODE_ENT    ifMode,    IN  CPSS_PORT_SPEED_ENT             speed)/******************************************************************************** cpssDxChPortSerdesPolaritySet** DESCRIPTION:*   Invert the Tx or Rx serdes polarity.** APPLICABLE DEVICES:*   xCat; xCat3; Lion; xCat2; Lion2; Bobcat2; Caelum; Aldrin; AC3X; Bobcat3.** NOT APPLICABLE DEVICES:*   DxCh1; DxCh1_Diamond; DxCh2; DxCh3.** INPUTS:*   devNum - physical device number*   portNum - physical port number*   laneBmp - bitmap of SERDES lanes (bit 0-> lane 0, etc.) to define*               polarity on.*   invertTx ? GT_TRUE - Transmit Polarity Invert.*               GT_FALSE ?no invert*   invertRx ? GT_TRUE - Receive Polarity Invert.*               GT_FALSE ?no invert** OUTPUTS:*   None.** RETURNS:*   GT_OK                       - on success.*   GT_BAD_PARAM                - on bad parameters*   GT_NOT_APPLICABLE_DEVICE    - on not applicable device*   GT_NOT_INITIALIZED          - if serdes was not intialized** COMMENTS:*   This API should be egaged by application after serdes power up. Important to*       wrap both steps i.e. "serdes power up" and "serdes polarity set" by port*       disable and link_change interrupt lock and restore port enable and*       reenable link change interrupt only after "serdes polarity set" to*       prevent interrupt toggling during the process.********************************************************************************/GT_STATUS cpssDxChPortSerdesPolaritySet(    IN GT_U8                devNum,    IN GT_PHYSICAL_PORT_NUM portNum,    IN GT_U32               laneBmp,    IN GT_BOOL              invertTx,    IN GT_BOOL              invertRx)
说明:
结构体CPSS_PORTS_BMP_STC的定义如下:

/* * Typedef: structure CPSS_PORTS_BMP_STC * * Description: Defines the bmp of ports (up to 512 ports) * * Fields: *      ports - array of bmp of ports *              ports[0] - hold bmp of the ports 0  - 31 *              ports[1] - hold bmp of the ports 32 - 63 *              ports[2] - hold bmp of the ports 64 - 95 *              ports[3] - hold bmp of the ports 96 - 127 *              ports[4] - hold bmp of the ports 128 - 159 *              ports[5] - hold bmp of the ports 160 - 191 *              ports[6] - hold bmp of the ports 192 - 223 *              ports[7] - hold bmp of the ports 224 - 255 *              ports[8] - hold bmp of the ports 256 - 287 *              ports[9] - hold bmp of the ports 288 - 319 *              ports[10] - hold bmp of the ports 320 - 351 *              ports[11] - hold bmp of the ports 352 - 383 *              ports[12] - hold bmp of the ports 384 - 415 *              ports[13] - hold bmp of the ports 416 - 447 *              ports[14] - hold bmp of the ports 448 - 479 *              ports[15] - hold bmp of the ports 480 - 511 * *  notes: *  can use next macros , for single port operation: *  CPSS_PORTS_BMP_PORT_SET_MAC , CPSS_PORTS_BMP_PORT_CLEAR_MAC *  CPSS_PORTS_BMP_IS_PORT_SET_MAC * *  bitwise operations on portsBmp: *  CPSS_PORTS_BMP_BITWISE_OR_MAC ,  CPSS_PORTS_BMP_BITWISE_AND_MAC , *  CPSS_PORTS_BMP_BITWISE_AND_NOT_MAC , CPSS_PORTS_BMP_BITWISE_NOT_MAC * *  others operations on portsBmp: *  CPSS_PORTS_BMP_PORT_CLEAR_ALL_MAC , CPSS_PORTS_BMP_IS_ZERO_MAC */typedef struct{    GT_U32      ports[CPSS_MAX_PORTS_BMP_NUM_CNS];}CPSS_PORTS_BMP_STC;
其中CPSS_MAX_PORTS_BMP_NUM_CNS为一宏定义
#define CPSS_MAX_PORTS_BMP_NUM_CNS   ((CPSS_MAX_PORTS_NUM_CNS + 31) / 32)

/* max ports in device in PPs of Prestera family  */
#define CPSS_MAX_PORTS_NUM_CNS          512

CPSS_MAX_PORTS_NUM_CNS为Prestera系列包处理器支持的最大端口数,等于512。
CPSS_MAX_PORTS_BMP_NUM_CNS的大小等于((CPSS_MAX_PORTS_NUM_CNS + 31) / 32)的结果取整等于16。
结构体CPSS_PORTS_BMP_STC内的成员为一元素大小为32位,元素个数为16的数组ports[16]。
访问结构体portsBmp的成员数组Ports[16]的某个元素时,可以参考下方操作:

portsBmp.ports[1]=0x0F000000; /* ports 56-59 */
        portsBmp.ports[2]=0x00000003; /* ports 64,65 */
portsBmp.ports[2]=0x000000FC; /* ports 66-71 */

说明:对结构体成员赋值之前,先要调用CPSS_PORTS_BMP_PORT_CLEAR_ALL_MAC(&portsBmp)!

根据结构体CPSS_PORTS_BMP_STC的介绍,如果想修改98DX3236的24-27口,需要将portsBmp.ports[0]
的第25位到第28位置1,具体操作如下:

portsBmp.ports[2]=0x0F000000; /* ports 24-27 */

98DX3236光口模式速度设置的代码如下:

CPSS_PORTS_BMP_STC              portsBmp;CPSS_PORTS_BMP_PORT_CLEAR_ALL_MAC(&portsBmp);portsBmp.ports[0]=0x0F000000; /* ports 24-27 */rc = cpssDxChPortModeSpeedSet(0,portsBmp,GT_TRUE,CPSS_PORT_INTERFACE_MODE_SR_LR_E,CPSS_PORT_SPEED_10000_E);if(rc!=GT_OK)return rc;
光口程序修改的具体步骤如下:

第一步:找到函数cpssInitSystem()所在C文件以及所在位置,并使用编辑器打开该文件

$ cd ~/work
$ gedit ./cpss/cpssEnabler/mainSysConfig/src/appDemo/boardConfig/appDemoBoardConfig.c

第二步:在函数cpssInitSystem()的尾部添加以下代码,

/******************************************************************************** Modified by: snaking616@163.com* Date: 20171023* DESCRIPTION:auto set the follow functions *cpssDxChPortModeSpeedSet(0,portsBmp,GT_TRUE,CPSS_PORT_INTERFACE_MODE_SR_LR_E,CPSS_PORT_SPEED_10000_E);*cpssDxChPortSerdesPolaritySet(0,25,1,GT_TRUE,GT_FALSE); *cpssDxChPortSerdesPolaritySet(0,27,1,GT_TRUE,GT_TRUE);********************************************************************************//* Init dev 0 ,Port 24-27 */ cpssOsPrintf("Modified by: snaking616@163.com\n");cpssOsPrintf("interface range ethernet 0/24-27\n");cpssOsPrintf("speed 10000 mode SR_LR\n");CPSS_PORTS_BMP_STC              portsBmp;CPSS_PORTS_BMP_PORT_CLEAR_ALL_MAC(&portsBmp);portsBmp.ports[0]=0x0F000000; /* ports 24-27 */rc = cpssDxChPortModeSpeedSet(0,portsBmp,GT_TRUE,CPSS_PORT_INTERFACE_MODE_SR_LR_E,CPSS_PORT_SPEED_10000_E);if(rc!=GT_OK) return rc;/*cpssDxChPortSerdesPolaritySet */ cpssOsPrintf("Modified by: snaking616@163.com\n");cpssOsPrintf("cpss-api call cpssDxChPortSerdesPolaritySet devNum 0 portNum 25 laneBmp 1 invertTx true invertRx false\n"); cpssOsPrintf("cpss-api call cpssDxChPortSerdesPolaritySet devNum 0 portNum 27 laneBmp 1 invertTx true invertRx true\n");rc = cpssDxChPortSerdesPolaritySet(0,25,1,GT_TRUE,GT_FALSE);if(rc!=GT_OK) return rc;rc = cpssDxChPortSerdesPolaritySet(0,27,1,GT_TRUE,GT_TRUE);if(rc!=GT_OK) return rc;        return rc; 

说明:以上代码需要注意一点,“return rc;”必须放在函数cpssInitSystem()的最尾部,之后保存并退出!

第三步:回到终端,在~/work目录下重新编译内核文件

# ./build_cpss.sh MSYS DX_ALL CUST

5.参考:
[1] 98DX3236初始化脚本程序 - CSDN博客
http://blog.csdn.net/snaking616/article/details/77967601

[2]Marvell 98DX3236系列交换机Uboot及内核文件烧写 - CSDN博客
http://blog.csdn.net/snaking616/article/details/77775670


[3]Marvell交换机luaCLI引擎启动流程以及如何解决函数cpssInitSystem()被二次调用的问题 - CSDN博客
http://blog.csdn.net/snaking616/article/details/78397806


原创粉丝点击