This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Error 8b/10b srio



We have the board.
tms320c6678 SRIO( ver. protocol 2.1) connected to Kintex 7 ( ver. protocol 2.2). Mode 1x. We are trying to configure the ports, but get an error decoding 8b / 10b. function CSL_SRIO_IsPortOk never returns the TRUE

Advise the problem, please

/* SRIO Driver Includes. */
#include <ti/drv/srio/srio_types.h>
#include <ti/drv/srio/include/listlib.h>
#include <ti/drv/srio/srio_drv.h>

/* CSL SRIO Functional Layer */
#include <ti/csl/csl_srio.h>
#include <ti/csl/csl_srioAux.h>
#include <ti/csl/csl_srioAuxPhyLayer.h>

/* CSL BootCfg Module */
#include <ti/csl/csl_bootcfg.h>
#include <ti/csl/csl_bootcfgAux.h>

/* CSL Chip Functional Layer */
#include <ti/csl/csl_chip.h>

/* CSL PSC Module */
#include <ti/csl/csl_pscAux.h>

/* QMSS Include */
#include <ti/drv/qmss/qmss_drv.h>
#include <stdio.h>
/**********************************************************************
 ************************* LOCAL Definitions **************************
 **********************************************************************/

/* These are the GARBAGE queues which are used by the TXU to dump the 
 * descriptor if there is an error instead of recycling the descriptor
 * to the free queue. */
#define GARBAGE_LEN_QUEUE		    905
#define GARBAGE_TOUT_QUEUE		    906
#define GARBAGE_RETRY_QUEUE		    907
#define GARBAGE_TRANS_ERR_QUEUE	    908
#define GARBAGE_PROG_QUEUE		    909
#define GARBAGE_SSIZE_QUEUE		    910

/* SRIO Device Information
 * - 16 bit Device Identifier.
 * - 8 bit Device Identifier.
 * - Vendor Identifier. 
 * - Device Revision. */
#define DEVICE_VENDOR_ID            0x30
#define DEVICE_REVISION             0x0

/* SRIO Assembly Information
 * - Assembly Identifier
 * - Assembly Vendor Identifier. 
 * - Assembly Device Revision. 
 * - Assembly Extension Features */
#define DEVICE_ASSEMBLY_ID          0x0
#define DEVICE_ASSEMBLY_VENDOR_ID   0x30
#define DEVICE_ASSEMBLY_REVISION    0x0
#define DEVICE_ASSEMBLY_INFO        0x0100

/**********************************************************************
 ************************* Extern Definitions *************************
 **********************************************************************/

extern const uint32_t DEVICE_ID1_16BIT;
extern const uint32_t DEVICE_ID1_8BIT;
extern const uint32_t DEVICE_ID2_16BIT;
extern const uint32_t DEVICE_ID2_8BIT;
extern const uint32_t DEVICE_ID3_16BIT;
extern const uint32_t DEVICE_ID3_8BIT_ID;
extern const uint32_t DEVICE_ID4_16BIT;
extern const uint32_t DEVICE_ID4_8BIT_ID;

/**********************************************************************
 *********************** DEVICE SRIO FUNCTIONS ***********************
 **********************************************************************/

/** @addtogroup SRIO_DEVICE_API
 @{ */

/**
 *  @b Description
 *  @n  
 *      The function provides the initialization sequence for the SRIO IP
 *      block. This can be modified by customers for their application and
 *      configuration.
 *
 *  @retval
 *      Success     -   0
 *  @retval
 *      Error       -   <0
 */
#pragma CODE_SECTION(SrioDevice_init, ".text:SrioDevice_init");

int32_t SrioDevice_init (void)
{
    CSL_SrioHandle      hSrio;
	int32_t             i;
    SRIO_PE_FEATURES    peFeatures;
    SRIO_OP_CAR         opCar;
    Qmss_QueueHnd       queueHnd;
    uint8_t             isAllocated;
    uint32_t            gargbageQueue[] = { GARBAGE_LEN_QUEUE,  GARBAGE_TOUT_QUEUE,
                                            GARBAGE_RETRY_QUEUE,GARBAGE_TRANS_ERR_QUEUE,
                                            GARBAGE_PROG_QUEUE, GARBAGE_SSIZE_QUEUE };

    /* �������� CSL SRIO Handle. */
    hSrio = CSL_SRIO_Open (0);
    if (hSrio == NULL)
        return -1;
 
    /* ��������� SRIO reset isolation ����������� PSC (Power and Sleep Controller) */
    if (CSL_PSC_isModuleResetIsolationEnabled(CSL_PSC_LPSC_SRIO))
        CSL_PSC_disableModuleResetIsolation(CSL_PSC_LPSC_SRIO);

    /* ��������� ��� ����� � ��������� SRIO
     * Global and Block Enable Registers
     * ���.165 SPRUGW1B KeyStone Architecture Serial Rapid IO (SRIO)
     */
   	CSL_SRIO_GlobalDisable (hSrio);
   	for(i = 0; i <= 9; i++)
   		CSL_SRIO_DisableBlock(hSrio, i);

    /* ��� ������������� ������������ ��������� ������ � ��������,
    * ��������� 0x0 � 24 ���� (BOOT_COMPLETE) ��������
    * Peripheral Setting Control Register (PER_SET_CNTL)
    * ���.161 SPRUGW1B KeyStone Architecture Serial Rapid IO (SRIO)*/
	CSL_SRIO_SetBootComplete(hSrio, 0);

    /* �������� ��� ����� SRIO
     * Global and Block Enable Registers
     * ���.165 SPRUGW1B KeyStone Architecture Serial Rapid IO (SRIO)*/
    CSL_SRIO_GlobalEnable (hSrio);
    for(i = 0; i <= 9; i++)
        CSL_SRIO_EnableBlock(hSrio,i);

    /* �������������� SRIO ��� ������ � ���������� ������
    * ���������� ���������� � 0x0 ���� Loopback [3-0] (7-4)
    * � �������� Peripheral Settings Control Register 1
    * ���.164 SPRUGW1B KeyStone Architecture Serial Rapid IO (SRIO)*/
    CSL_SRIO_SetNormalMode(hSrio,0);
    CSL_SRIO_SetNormalMode(hSrio,1);
    CSL_SRIO_SetNormalMode(hSrio,2);
    CSL_SRIO_SetNormalMode(hSrio,3);

	/* ��������� ��������������� ����������� ���������� ��� ������� ������������.
	 * ���������� ���������� 0�0 � ���� 21(PROMOTE_DIS) ��������
	 * Peripheral Setting Control Register (PER_SET_CNTL)
	 * ���.161 SPRUGW1B KeyStone Architecture Serial Rapid IO (SRIO)*/
	CSL_SRIO_EnableAutomaticPriorityPromotion(hSrio);

	/* Set the SRIO Prescalar select to operate in the range of 44.7 to 89.5
	* Peripheral Setting Control Register (PER_SET_CNTL)
	* ���.161 SPRUGW1B KeyStone Architecture Serial Rapid IO (SRIO)*/
	CSL_SRIO_SetPrescalarSelect (hSrio, 0);

    /* ��������� Boot Configuration Kicker
     * ����� ���������� �������������*/
    CSL_BootCfgUnlockKicker ();

    /***************************************************************
    * ��������� ��������� ������� � SPRUGW1B, ���.151				*
    * KeyStone Architecture Serial Rapid IO (SRIO) User Guide 		*
    * ������� ������� 312.5 MHz, ����������� �� �������� 5 Gbps, 	*
    * ��� ����� ����� ���������� ����������� ���������=8(00100000b) *
    * (0)-Enable PLL.  value -		1b								*
    * (1-8) -PLL multiply. value -	100000b 						*
    * (9)-VCO range. value -		1b								*
    ****************************************************************/
    CSL_BootCfgSetSRIOSERDESConfigPLL (0x221);//1.25

    /************************************************************************
    * ����������� ����� �������� SRIO SERDES Receive Configuration			*
    * ��������� ��������� ������� � SPRUGW1B, ���.153						*
    * KeyStone Architecture Serial Rapid IO (SRIO) User Guide 				*
    * (0) Enable Receiver											- 1b	*
	* (1-3) Bus Width 010b (20 bit)									- 010b	*
	* (4-5) Half rate. Two data samples per PLL output clock cycle	- 01b	*
	* (6) Normal polarity											- 0b 	*
	* (7-9) Termination programmed to be 001						- 001b 	*
	* (10-11) Comma Alignment enabled								- 01b 	*
	* (12-14) Loss of signal detection disabled						- 000b	*
	* (15-17) Configures the clock/data recovery algorithm.					*
	*         Second order. Phase offset tracking up to �313 ppm 			*
	*         with 15 vote threshold								- 000b	*
	* (18-20) Fully adaptive equalization							- 001b	*
	* (22) Offset compensation enabled								- 1b 	*
	* (23-24) Loopback disabled										- 00b	*
	* (25-27) Test pattern mode disabled							- 000b	*
	* (28-31) Reserved												- 0000b	*
	************************************************************************/
    CSL_BootCfgSetSRIOSERDESRxConfig (0, 0x00440495);
    CSL_BootCfgSetSRIOSERDESRxConfig (1, 0x00440495);
    CSL_BootCfgSetSRIOSERDESRxConfig (2, 0x00440495);
    CSL_BootCfgSetSRIOSERDESRxConfig (3, 0x00440495);

    /*************************************************************************
    * ���������� ����������  SRIO SERDES Transmit Configuration.			 *
    * ��������� ��������� ������� � SPRUGW1B, ���.156						 *
    * KeyStone Architecture Serial Rapid IO (SRIO) User Guide 				 *
    * (0) Enable Transmitter										- 1b	 *
    * (1-3) Bus Width 010b (20 bit)									- 010b	 *
    * (4-5) Half rate. Two data samples per PLL output clock cycle	- 01b	 *
	* (6) Normal polarity											- 0b	 *
	* (7-10) Swing max.												- 1111b	 *
	* (11-13) Precursor Tap weight 0%								- 000b 	 *
	* (14-18) Adjacent post cursor Tap weight 0%					- 00000b *
	* (19) Transmitter pre and post cursor FIR filter update		- 1b	 *
	* (20) Synchronization master									- 1b	 *
	* (21-22) Loopback disabled										- 00b	 *
	* (23-25) Test pattern mode disabled							- 000b	 *
	* (26-31) Reserved												- 000000b*
	* ��� 20 ��������������� ������ �� ����� 0(�), ������ ��� ���� �����	 *
	* ������������ SRIO � ����� 4x 											 *
    *************************************************************************/
    CSL_BootCfgSetSRIOSERDESTxConfig (0, 0x00080795);
    CSL_BootCfgSetSRIOSERDESTxConfig (1, 0x00080795);
    CSL_BootCfgSetSRIOSERDESTxConfig (2, 0x00080795);
    CSL_BootCfgSetSRIOSERDESTxConfig (3, 0x00080795);



    /* ��� ���� SERDES PLL ����� � "�������" */
    while (1)
    {
        uint32_t    status;
        /* ��������� ������ SRIO SERDES Status */
        CSL_BootCfgGetSRIOSERDESStatus(&status);
        if (status & 0x1)
            break;
    }

    /* ������� LSU(Load/Store Unit) �������� ���������� */
    CSL_SRIO_ClearLSUPendingInterrupt (hSrio, 0xFFFFFFFF, 0xFFFFFFFF);

    /* ��������� ���������� �� ���������� */
    CSL_SRIO_SetDeviceInfo (hSrio, DEVICE_ID1_16BIT, DEVICE_VENDOR_ID, DEVICE_REVISION);

    /* Set the Assembly Information */
    CSL_SRIO_SetAssemblyInfo(hSrio, DEVICE_ASSEMBLY_ID, DEVICE_ASSEMBLY_VENDOR_ID, 
                             DEVICE_ASSEMBLY_REVISION, DEVICE_ASSEMBLY_INFO);

    /* ��������� ������� ��������� ���������
     * Processing Element Features - PE.
     * ��������� ��������� ������� � SPRUGW1B, ���.203
     */
    peFeatures.isBridge                          = 0;//PE can bridge to another interface
    peFeatures.isEndpoint                        = 0;//PE has physically addressable local address space and can be accessed as an endpoint
    peFeatures.isProcessor                       = 1;//PE physically contains a local processor or similar device that executes code.
    peFeatures.isSwitch                          = 0;//PE can bridge to another external RapidIO interface
    peFeatures.isMultiport                       = 0;
    peFeatures.isFlowArbiterationSupported       = 0;
    peFeatures.isMulticastSupported              = 0;
    peFeatures.isExtendedRouteConfigSupported    = 0;
    peFeatures.isStandardRouteConfigSupported    = 1;//Standard routing table configuration support
    peFeatures.isFlowControlSupported            = 1;//PE supports congestion flow control mechanism
    peFeatures.isCRFSupported                    = 0;//This bit indicates PE support for the Critical Request Flow (CRF) Function
    peFeatures.isCTLSSupported                   = 1;
    peFeatures.isExtendedFeaturePtrValid         = 1;
    peFeatures.numAddressBitSupported            = 1;
    CSL_SRIO_SetProcessingElementFeatures (hSrio, &peFeatures);

    /* Configure the source operation CAR
     * ��������� ��������� ������� � SPRUGW1B, ���.205 */
    memset ((void *) &opCar, 0, sizeof (opCar));
    opCar.portWriteOperationSupport = 1;//PE can support a port-write generation
    opCar.atomicClearSupport        = 1;//PE can support an atomic clear operation
    opCar.atomicSetSupport          = 1;//PE can support an atomic set operation
    opCar.atomicDecSupport          = 1;//PE can support an atomic decrement operation
    opCar.atomicIncSupport          = 1;//PE can support an atomic increment operation
    opCar.atomicTestSwapSupport     = 1;//PE can support an atomic test-and-swap operation
    opCar.doorbellSupport           = 1;//PE can support a doorbell operation
    opCar.dataMessageSupport        = 1;//PE can support a data message operation
    opCar.writeResponseSupport      = 1;//PE can support a write-with-response operation
    opCar.streamWriteSupport        = 1;//PE can support a streaming-write operation
    opCar.writeSupport              = 1;//PE can support a write operation
    opCar.readSupport               = 1;//PE can support a read operation
    opCar.dataStreamingSupport      = 1;//Supports Data Streaming
    CSL_SRIO_SetSourceOperationCAR (hSrio, &opCar);

    /* Configure the destination operation CAR
     * ��������� ��������� ������� � SPRUGW1B, ���.206*/
	memset ((void *) &opCar, 0, sizeof (opCar));
    opCar.portWriteOperationSupport  = 1;//PE can support a port-write operation
    opCar.doorbellSupport            = 1;//PE can support a doorbell operation
    opCar.dataMessageSupport         = 1;//PE can support a data message operation
    opCar.writeResponseSupport       = 1;//PE can support a write-with-response operation
    opCar.streamWriteSupport         = 1;//PE can support a streaming-write operation
    opCar.writeSupport               = 1;//PE can support a write operation
    opCar.readSupport                = 1;//PE can support a read operation
    CSL_SRIO_SetDestOperationCAR (hSrio, &opCar);

    /* Set the 16 bit and 8 bit identifier for the SRIO Device. */
    CSL_SRIO_SetDeviceIDCSR (hSrio, DEVICE_ID1_8BIT, DEVICE_ID1_16BIT);

    /* Enable TLM Base Routing Information for Maintainance Requests & ensure that
     * the BRR's can be used by all the ports. */
    CSL_SRIO_SetTLMPortBaseRoutingInfo(hSrio, 0, 1, 1, 1, 0);
    CSL_SRIO_SetTLMPortBaseRoutingInfo(hSrio, 0, 2, 1, 1, 0);
    CSL_SRIO_SetTLMPortBaseRoutingInfo(hSrio, 0, 3, 1, 1, 0);
    CSL_SRIO_SetTLMPortBaseRoutingInfo(hSrio, 1, 0, 1, 1, 0);

    /* Configure the Base Routing Register to ensure that all packets matching the 
     * Device Identifier & the Secondary Device Id are admitted. */
    CSL_SRIO_SetTLMPortBaseRoutingPatternMatch(hSrio, 0, 1, DEVICE_ID2_16BIT, 0xFFFF);
    CSL_SRIO_SetTLMPortBaseRoutingPatternMatch(hSrio, 0, 2, DEVICE_ID3_16BIT, 0xFFFF);
    CSL_SRIO_SetTLMPortBaseRoutingPatternMatch(hSrio, 0, 3, DEVICE_ID4_16BIT, 0xFFFF);
    CSL_SRIO_SetTLMPortBaseRoutingPatternMatch(hSrio, 1, 0, DEVICE_ID2_8BIT,  0xFF);

    /* We need to open the Garbage collection queues in the QMSS. This is done to ensure that 
     * these queues are not opened by another system entity. */
    for (i = 0; i < 6; i++)
    {
        /* Open the Garabage queues */
        queueHnd = Qmss_queueOpen (Qmss_QueueType_GENERAL_PURPOSE_QUEUE, gargbageQueue[i], &isAllocated);
        if (queueHnd < 0)
            return -1;

        /* Make sure the queue has not been opened already; we dont the queues to be shared by some other
         * entity in the system. */
        if (isAllocated > 1)
            return -1;
    }

    /* Set the Transmit Garbage Collection Information. */
    CSL_SRIO_SetTxGarbageCollectionInfo (hSrio, GARBAGE_LEN_QUEUE, GARBAGE_TOUT_QUEUE, 
                                         GARBAGE_RETRY_QUEUE, GARBAGE_TRANS_ERR_QUEUE, 
                                         GARBAGE_PROG_QUEUE, GARBAGE_SSIZE_QUEUE);

    /* Set the Host Device Identifier. */
    CSL_SRIO_SetHostDeviceID (hSrio, DEVICE_ID1_16BIT);

    /* Configure the component tag CSR */
    CSL_SRIO_SetCompTagCSR (hSrio, 0x00000000);

    /* Configure the PLM for all the ports. */
	for (i = 0; i < 4; i++)
	{
	    /* Set the PLM Port Silence Timer. */	
        CSL_SRIO_SetPLMPortSilenceTimer (hSrio, i, 0x2);

        /* TODO: We need to ensure that the Port 0 is configured to support both
         * the 2x and 4x modes. The Port Width field is read only. So here we simply
         * ensure that the Input and Output ports are enabled. */
        CSL_SRIO_EnableInputPort (hSrio, i);
        CSL_SRIO_EnableOutputPort (hSrio, i);

        /* Set the PLM Port Discovery Timer. */
        CSL_SRIO_SetPLMPortDiscoveryTimer (hSrio, i, 0x2);

        /* Reset the Port Write Reception capture. */
        CSL_SRIO_SetPortWriteReceptionCapture(hSrio, i, 0x0);
    }

    /* Set the Port link timeout CSR */
    CSL_SRIO_SetPortLinkTimeoutCSR (hSrio, 0x0ffFFF);

    /* Set the Port General CSR: Only executing as Master Enable
     * ��������� ��������� ����� CSR: ������
     * ���.212 */
    CSL_SRIO_SetPortGeneralCSR (hSrio, 0, 1, 0);

    /* Clear the sticky register bits. */
    CSL_SRIO_SetLLMResetControl (hSrio, 1);

    /* Set the device id to be 0 for the Maintenance Port-Write operation 
     * to report errors to a system host. */
    CSL_SRIO_SetPortWriteDeviceId (hSrio, 0x0, 0x0, 0x0);

    /* Set the Data Streaming MTU */
    CSL_SRIO_SetDataStreamingMTU (hSrio, 64);

    /* Configure the path mode for the ports.
     * ������������� � ����� 4� ���. 242
     * */
    for(i = 0; i < 4; i++)
        CSL_SRIO_SetPLMPortPathControlMode (hSrio, i, 0);

    /* Set the LLM Port IP Prescalar.
     * The default value of 31 is for an ip_clk frequency of 312.5 MHz.
     * ��������� ��������� ������� � SPRUGW1B, ���.273				*
     * KeyStone Architecture Serial Rapid IO (SRIO) User Guide 		*
     * */
    CSL_SRIO_SetLLMPortIPPrescalar (hSrio, 0x1f);

    /* Enable the peripheral. */
    CSL_SRIO_EnablePeripheral(hSrio);

    /* Configuration has been completed. */
    CSL_SRIO_SetBootComplete(hSrio, 1);

    /* This code checks if the ports are operational or not. The functionality is not supported
     * on the simulator. */
    int cnt=0;
    while(cnt<4)
    {
    	for(i = 0; i < 4; i++)
    	{
    		if(CSL_SRIO_IsPortOk (hSrio, i) == TRUE)
    		{
    			printf("Port %d init",i);
    			cnt++;
    		}
    	}
    }

    /* Set all the queues 0 to operate at the same priority level and to send packets onto Port 0 */
    for (i =0 ; i < 16; i++)
        CSL_SRIO_SetTxQueueSchedInfo(hSrio, i, 0, 0);

    /* Set the Doorbell route to determine which routing table is to be used 
     * This configuration implies that the Interrupt Routing Table is configured as 
     * follows:-
     *  Interrupt Destination 0 - INTDST 16 
     *  Interrupt Destination 1 - INTDST 17 
     *  Interrupt Destination 2 - INTDST 18
     *  Interrupt Destination 3 - INTDST 19 
     */
    CSL_SRIO_SetDoorbellRoute(hSrio, 0);

    /* Route the Doorbell interrupts. 
     *  Doorbell Register 0 - All 16 Doorbits are routed to Interrupt Destination 0. 
     *  Doorbell Register 1 - All 16 Doorbits are routed to Interrupt Destination 1. 
     *  Doorbell Register 2 - All 16 Doorbits are routed to Interrupt Destination 2. 
     *  Doorbell Register 3 - All 16 Doorbits are routed to Interrupt Destination 3. */
    for (i = 0; i < 16; i++)
    {
        CSL_SRIO_RouteDoorbellInterrupts(hSrio, 0, i, 0);
        CSL_SRIO_RouteDoorbellInterrupts(hSrio, 1, i, 1);
        CSL_SRIO_RouteDoorbellInterrupts(hSrio, 2, i, 2);
        CSL_SRIO_RouteDoorbellInterrupts(hSrio, 3, i, 3);
    }

    /* Initialization has been completed. */
    return 0;
}






  • Ganapathi Dhandapani,I need help with the code, not links

  • Hi Art

    We do not do code review over E2E. Have you looked at the links Ganapathi provided? Do they help / are you able to make any correlation to the problem you might be facing with your implementation?

    Regards

    Mukul 

  • I am disappointed in the support of TI. Links absolutely did not help. I do know how to use search of this forum.
    Понабирают джамшутов по объявлениям, вместо помощи спамить только могут.
  • Thanks for clarifying that the links did not help. This helps and glad to hear that you did search the forums prior to posting (much appreciated). 

    Why do you think it is the software issue, prompting you to ask for a code review? Did you use some TI software as the basis to build this code? Are you expecting that you didn't do the port initialization correctly?

    Are you sure that the hardware (I am assuming it is a custom board?) you have this implemented works ok. 

    Help us help you, instead of being condescending , Ganapathi's intention is to help you out. If we were to do code review to look fir software bugs in every users/posters code, this does not help us scale efficiently.  It helps to understand what debug process you have done so far. 

    Regards

    Mukul 

  • I use СCS 5.5
    sample code taken from Pdk6678.
    I think that somewhere is not properly made ​​a port initialization, because  DSP and FPGA have decoding error 8b / 10b.
    In Xilinx Chip Scope seen that from the FPGA are correct Control Symbols and from the DSP is not.

    and I can not imagine how you can help me, not knowing what I'm doing settings, for this and put the code

  • Dan

    Thanks for sending the additional details. Team is looking at it and will get back to you, if we have more suggestions or follow up questions.

    Regards

    Mukul 

  • I found a mistake in setting the speed of the receiver and the transmitter. Corrected, but the initialization still fails. look at the screenshot, you can see that from the DSP are control characters with an error.
  • Hi Dan,

    Please share your updated test code.

    Thanks,

  • Win!!!!

    Наконец-то удалось всё нормально настроить. Проблемы были в настройке передатчика DSP.

    В нашей конфигурации ПЛИС выступает мастером. При настройке линии ПЛИС отправляла на ЦСП служебные символы,ЦСП их принимал и передавал назад.но из-за некорректно настроенного передатчика данные периодически портились (это можно увидеть на скриншотах выше). и инициализация не происходила. Оставил минимальные настройки передатчика и всё заработало.

    Sutup -

    rf_in= 312.5 MHz, data rate = 5 Gbps,rate =half, port mode = 4x

    Spread the correct settings and screenshots

     


    как всегда, проще самому разобраться, чем дождаться помощи от техподдержки. тем более если в ней сидят джамшуты.

    Code -

    /* SRIO Driver Includes. */
    #include <ti/drv/srio/srio_types.h>
    #include <ti/drv/srio/include/listlib.h>
    #include <ti/drv/srio/srio_drv.h>
    
    /* CSL SRIO Functional Layer */
    #include <ti/csl/csl_srio.h>
    #include <ti/csl/csl_srioAux.h>
    #include <ti/csl/csl_srioAuxPhyLayer.h>
    
    /* CSL BootCfg Module */
    #include <ti/csl/csl_bootcfg.h>
    #include <ti/csl/csl_bootcfgAux.h>
    
    /* CSL Chip Functional Layer */
    #include <ti/csl/csl_chip.h>
    
    /* CSL PSC Module */
    #include <ti/csl/csl_pscAux.h>
    
    /* QMSS Include */
    #include <ti/drv/qmss/qmss_drv.h>
    #include <stdio.h>
    #include <ti/csl/csl_tsc.h>
    
    
    /**********************************************************************
     ************************* LOCAL Definitions **************************
     **********************************************************************/
    
    /* These are the GARBAGE queues which are used by the TXU to dump the 
     * descriptor if there is an error instead of recycling the descriptor
     * to the free queue. */
    #define GARBAGE_LEN_QUEUE		    905
    #define GARBAGE_TOUT_QUEUE		    906
    #define GARBAGE_RETRY_QUEUE		    907
    #define GARBAGE_TRANS_ERR_QUEUE	    908
    #define GARBAGE_PROG_QUEUE		    909
    #define GARBAGE_SSIZE_QUEUE		    910
    
    /* SRIO Device Information
     * - 16 bit Device Identifier.
     * - 8 bit Device Identifier.
     * - Vendor Identifier. 
     * - Device Revision. */
    #define DEVICE_VENDOR_ID            0x30
    #define DEVICE_REVISION             0x0
    
    /* SRIO Assembly Information
     * - Assembly Identifier
     * - Assembly Vendor Identifier. 
     * - Assembly Device Revision. 
     * - Assembly Extension Features */
    #define DEVICE_ASSEMBLY_ID          0x0
    #define DEVICE_ASSEMBLY_VENDOR_ID   0x30
    #define DEVICE_ASSEMBLY_REVISION    0x0
    #define DEVICE_ASSEMBLY_INFO        0x0100
    
    #define DEVICE_ID1_16BIT			0xBEEF
    #define DEVICE_ID1_8BIT				0xBE
    /**********************************************************************
     ************************* Extern Definitions *************************
     **********************************************************************/
    
    /** @addtogroup SRIO_DEVICE_API
     @{ */
    
    /**
     *  @b Description
     *  @n  
     *      The function provides the initialization sequence for the SRIO IP
     *      block. This can be modified by customers for their application and
     *      configuration.
     *
     *  @retval
     *      Success     -   0
     *  @retval
     *      Error       -   <0
     */
    #pragma CODE_SECTION(SrioDevice_init, ".text:SrioDevice_init");
    
    int32_t SrioDevice_init (void)
    {
        CSL_SrioHandle      hSrio;
    	int32_t             i;
        SRIO_PE_FEATURES    peFeatures;
        SRIO_OP_CAR         opCar;
        Qmss_QueueHnd       queueHnd;
        uint8_t             isAllocated;
        uint32_t            gargbageQueue[] = { GARBAGE_LEN_QUEUE,  GARBAGE_TOUT_QUEUE,
                                                GARBAGE_RETRY_QUEUE,GARBAGE_TRANS_ERR_QUEUE,
                                                GARBAGE_PROG_QUEUE, GARBAGE_SSIZE_QUEUE };
        uint32_t			srioIDMask = 0xFFFF;
        uint32_t			srio_primary_ID = 0xBEEF;
        uint32_t			srio_secondary_ID = 0xAAAA;
        Uint8				bootCompleteFlag;
    	uint32_t 			rxConfig = 0;
    	uint32_t 			txConfig = 0;
    	Uint8				port;
    
        char		statusText[4]="";
        uint64_t	tscTemp;
    
        //CSR: For VMIN settings
        SRIO_PLM_VMIN_EXPONENT vminExponentConfig;
    
        int32_t openQueueValues[16] = {0};
    
        /* Disable SRIO reset isolation */
        if (CSL_PSC_isModuleResetIsolationEnabled(CSL_PSC_LPSC_SRIO))
        	CSL_PSC_disableModuleResetIsolation(CSL_PSC_LPSC_SRIO);
    
        /* Reset SRIO module and wait for the reset to complete */
        CSL_PSC_setModuleLocalReset (CSL_PSC_LPSC_SRIO,PSC_MDLRST_ASSERTED);
        CSL_PSC_setModuleNextState (CSL_PSC_LPSC_SRIO,PSC_MODSTATE_ENABLE);
        printf ("Debug: Waiting for module reset...\n");
        while (!CSL_PSC_isModuleResetDone(CSL_PSC_LPSC_SRIO));
        printf ("Debug: Waiting for module local reset...\n");
        while (!CSL_PSC_isModuleLocalResetDone (CSL_PSC_LPSC_SRIO));
    
        /* Get the CSL SRIO Handle. */
        hSrio = CSL_SRIO_Open (0);
        if (hSrio == NULL)
            return -1;
    
        /* Enable reception of packets */
    	hSrio->RIO_PCR = (hSrio->RIO_PCR & 0x7) | CSL_SRIO_RIO_PCR_RESTORE_MASK;
    
        /* Disable the SRIO Global block */
    	CSL_SRIO_GlobalDisable (hSrio);
    
    	/* Disable each of the individual SRIO blocks. */
    	for(i = 0; i <= 9; i++)
    		CSL_SRIO_DisableBlock (hSrio, i);
    
    	/* Set boot complete to be 0; we are not done with the initialization. */
    	CSL_SRIO_SetBootComplete (hSrio, 0);
    
        /* Set the sRIO shadow registers for 9/3/2/2 */
        CSL_SRIO_SetLSUShadowRegs (hSrio,0x19,0x19);
    
    	/* Now enable the SRIO block and all the individual blocks also. */
    	CSL_SRIO_GlobalEnable (hSrio);
    	for (i = 0; i <= 9; i++)
    		CSL_SRIO_EnableBlock (hSrio,i);
    
    	/* Configure SRIO to operate in Normal mode. */
    	CSL_SRIO_SetNormalMode (hSrio,0);
    	CSL_SRIO_SetNormalMode (hSrio,1);
    	CSL_SRIO_SetNormalMode (hSrio,2);
    	CSL_SRIO_SetNormalMode (hSrio,3);
    
    
    	/* Enable Automatic Priority Promotion of response packets. */
    	CSL_SRIO_EnableAutomaticPriorityPromotion (hSrio);
    
    	/* Set the SRIO Prescalar select to operate in the range of 44.7 to 89.5 */
    	CSL_SRIO_SetPrescalarSelect (hSrio, 0);
    
        /* Unlock the Boot Configuration Kicker */
        CSL_BootCfgUnlockKicker ();
    
       	/* Set Pll setting for single speed of 5Gpbs */
        CSL_BootCfgSetSRIOSERDESConfigPLL (0x241);
    
        /* Loop around until the SERDES PLL is locked. */
        while (1)
        {
        	uint32_t    status;
    
        	/* Get the SRIO SERDES Status */
            CSL_BootCfgGetSRIOSERDESStatus (&status);
            if (status & 0x1)
            	break;
        }
    
       	/* Get boot complete flag setting */
        CSL_SRIO_GetBootComplete (hSrio, &bootCompleteFlag);
    
        if (bootCompleteFlag == 1)
        /* Set boot complete to be 0; to enable writing to the SRIO registers. */
        CSL_SRIO_SetBootComplete (hSrio, 0);
    
        /* Set rx/tx config values based on the lane rate specified */
        /* Tx and Rx settings for 5 Gbps */
        // (0)     Enable Receiver
        // (1-3)   Bus Width 010b (20 bit)
        // (4-5)   Half rate. One data sample every two PLL output clock cycles
        // (6)     Normal polarity
        // (7-9)   Termination programmed to be 001
        // (10-11) Comma Alignment enabled
        // (12-14) Loss of signal detection disabled
        // (15-17) First order. Phase offset tracking up to +-488 ppm
        // (18-20) Fully adaptive equalization
        // (22)    Offset compensation enabled
        // (23-24) Loopback disabled
        // (25-27) Test pattern mode disabled
        // (28-31) Reserved
    
        rxConfig = 0x00440495;
       // rxConfig=0x004404b5;
    
    	// (0)     Enable Transmitter
    	// (1-3)   Bus Width 010b (20 bit)
        // (4-5)   Half rate. One data sample every two PLL output clock cycles
    	// (6)     Normal polarity
    	// (7-10)  Swing max.
    	// (11-13) Precursor Tap weight 0%
    	// (14-18) Adjacent post cursor Tap weight 0%
    	// (19)    Transmitter pre and post cursor FIR filter update
    	// (20)    Synchronization master
    	// (21-22) Loopback disabled
    	// (23-25) Test pattern mode disabled
    	// (26-31) Reserved
    //    txConfig = 0x000807B5;
      //  txConfig = 0x00000035;
        txConfig = 0x0000015;
    
     	/* Configure the SRIO SERDES Receive Configuration. */
     	CSL_BootCfgSetSRIOSERDESRxConfig (0, rxConfig);
     	CSL_BootCfgSetSRIOSERDESRxConfig (1, rxConfig);
    	CSL_BootCfgSetSRIOSERDESRxConfig (2, rxConfig);
    	CSL_BootCfgSetSRIOSERDESRxConfig (3, rxConfig);
    
    	/* Configure the SRIO SERDES Transmit Configuration. */
    	CSL_BootCfgSetSRIOSERDESTxConfig (0, txConfig);
    	CSL_BootCfgSetSRIOSERDESTxConfig (1, txConfig);
    	CSL_BootCfgSetSRIOSERDESTxConfig (2, txConfig);
    	CSL_BootCfgSetSRIOSERDESTxConfig (3, txConfig);
    
        /* Set boot complete back to 1; configuration is complete. */
        CSL_SRIO_SetBootComplete (hSrio, 1);
    
    
        /* Loop around until the SERDES PLL is locked. */
        while (1)
        {
            uint32_t    status;
    
            /* Get the SRIO SERDES Status */
            CSL_BootCfgGetSRIOSERDESStatus (&status);
            if (status & 0x1)
                break;
        }
    
        /* Clear the LSU pending interrupts. */
        CSL_SRIO_ClearLSUPendingInterrupt (hSrio, 0xFFFFFFFF, 0xFFFFFFFF);
    
        /* Set the Device Information */
        CSL_SRIO_SetDeviceInfo (hSrio, srio_primary_ID, DEVICE_VENDOR_ID, DEVICE_REVISION);
    
        /* Set the Assembly Information */
        CSL_SRIO_SetAssemblyInfo (hSrio, DEVICE_ASSEMBLY_ID, DEVICE_ASSEMBLY_VENDOR_ID,
                                 DEVICE_ASSEMBLY_REVISION, DEVICE_ASSEMBLY_INFO);
    
    	/* Configure the processing element features*/
    	peFeatures.isBridge                          = 0;
    	peFeatures.isEndpoint                        = 0;
    	peFeatures.isProcessor                       = 1;
    	peFeatures.isSwitch                          = 0;
    	peFeatures.isMultiport                       = 0;
    	peFeatures.isFlowArbiterationSupported       = 0;
    	peFeatures.isMulticastSupported              = 0;
    	peFeatures.isExtendedRouteConfigSupported    = 0;
    	peFeatures.isStandardRouteConfigSupported    = 1;
    	peFeatures.isFlowControlSupported            = 1;
    	peFeatures.isCRFSupported                    = 0;
    	peFeatures.isCTLSSupported                   = 1;
    	peFeatures.isExtendedFeaturePtrValid         = 1;
    	peFeatures.numAddressBitSupported            = 1;
    	CSL_SRIO_SetProcessingElementFeatures (hSrio, &peFeatures);
    
    	/* Configure the source operation CAR */
    	memset ((void *) &opCar, 0, sizeof (opCar));
    	opCar.portWriteOperationSupport = 1;
    	opCar.atomicClearSupport        = 1;
    	opCar.atomicSetSupport          = 1;
    	opCar.atomicDecSupport          = 1;
    	opCar.atomicIncSupport          = 1;
    	opCar.atomicTestSwapSupport     = 1;
    	opCar.doorbellSupport           = 1;
    	opCar.dataMessageSupport        = 1;
    	opCar.writeResponseSupport      = 1;
    	opCar.streamWriteSupport        = 1;
    	opCar.writeSupport              = 1;
    	opCar.readSupport               = 1;
    	opCar.dataStreamingSupport      = 1;
    	CSL_SRIO_SetSourceOperationCAR (hSrio, &opCar);
    
    	/* Configure the destination operation CAR */
    	memset ((void *) &opCar, 0, sizeof (opCar));
    	opCar.portWriteOperationSupport  = 1;
    	opCar.doorbellSupport            = 1;
    	opCar.dataMessageSupport         = 1;
    	opCar.writeResponseSupport       = 1;
    	opCar.streamWriteSupport         = 1;
    	opCar.writeSupport               = 1;
    	opCar.readSupport                = 1;
    	CSL_SRIO_SetDestOperationCAR (hSrio, &opCar);
    
    	/* Set the 16 bit and 8 bit identifier for the SRIO Device. */
    	CSL_SRIO_SetDeviceIDCSR (hSrio, DEVICE_ID1_8BIT, DEVICE_ID1_16BIT);
    
        /* Enable TLM Base Routing Information for Maintainance Requests & ensure that
         * the BRR's can be used by all the ports. */
        CSL_SRIO_SetTLMPortBaseRoutingInfo (hSrio, 0, 1, 1, 1, 0);
    	CSL_SRIO_SetTLMPortBaseRoutingInfo (hSrio, 0, 2, 1, 1, 0);
    
        /* Configure the Base Routing Register to ensure that all packets matching the
         * Device Identifier & the Secondary Device Id are admitted. */
        CSL_SRIO_SetTLMPortBaseRoutingPatternMatch (hSrio, 0, 1, srio_primary_ID, srioIDMask);
        CSL_SRIO_SetTLMPortBaseRoutingPatternMatch (hSrio, 0, 2, srio_secondary_ID, srioIDMask);
    
        /* We need to open the Garbage collection queues in the QMSS. This is done to ensure that
         * these queues are not opened by another system entity. */
        for (i = 0; i < 6; i++)
        {
            /* Open the Garabage queues */
            queueHnd = Qmss_queueOpen (Qmss_QueueType_GENERAL_PURPOSE_QUEUE, gargbageQueue[i], &isAllocated);
            if (queueHnd < 0)
                return -1;
    
            /* Make sure the queue has not been opened already; we dont the queues to be shared by some other
             * entity in the system. */
            if (isAllocated > 1)
                return -1;
        }
    
        /* Set the Transmit Garbage Collection Information. */
        CSL_SRIO_SetTxGarbageCollectionInfo (hSrio, GARBAGE_LEN_QUEUE, GARBAGE_TOUT_QUEUE,
                                             GARBAGE_RETRY_QUEUE, GARBAGE_TRANS_ERR_QUEUE,
                                             GARBAGE_PROG_QUEUE, GARBAGE_SSIZE_QUEUE);
    
        /* Set the Host Device Identifier. */
        CSL_SRIO_SetHostDeviceID (hSrio, srio_primary_ID);
    
        /* Configure the component tag CSR */
        CSL_SRIO_SetCompTagCSR (hSrio, 0x00000000);
    
    	/* Configure the PLM for all the ports. */
    	for (i = 0; i < 4; i++)
    	{
    		/* Set the PLM Port Silence Timer. */
    		CSL_SRIO_SetPLMPortSilenceTimer (hSrio, i, 0x2);
    
    		/* TODO: We need to ensure that the Port 0 is configured to support both
    		 * the 2x and 4x modes. The Port Width field is read only. So here we simply
    		 * ensure that the Input and Output ports are enabled. */
    		CSL_SRIO_EnableInputPort (hSrio, i);
    		CSL_SRIO_EnableOutputPort (hSrio, i);
    
    		/* Set the PLM Port Discovery Timer. */
    		CSL_SRIO_SetPLMPortDiscoveryTimer (hSrio, i, 0x2);
    
    		/* Reset the Port Write Reception capture. */
    		CSL_SRIO_SetPortWriteReceptionCapture (hSrio, i, 0x0);
    
    		/* CSR: Set VMIN to 15 as recommended by this post:
    
    		* http://e2e.ti.com/support/dsp/c6000_multi-core_dsps/f/639/t/196080.aspx */
    
    		CSL_SRIO_GetPLMPortVMinExponentConfig(hSrio, i, &vminExponentConfig);
    		vminExponentConfig.vminExp = 15;
    		CSL_SRIO_SetPLMPortVMinExponentConfig(hSrio, i, &vminExponentConfig);
    	}
    
    	/* Set the Port link timeout CSR */
    	// CSL_SRIO_SetPortLinkTimeoutCSR (hSrio, 0x000FFF);
    	CSL_SRIO_SetPortLinkTimeoutCSR (hSrio, 0xFF0FFF);
    	CSL_SRIO_SetPortResponseTimeoutCSR (hSrio, 0xFF0FFF);
    
    	/* Set the Port General CSR: Only executing as Master Enable */
    	CSL_SRIO_SetPortGeneralCSR (hSrio, 0, 1, 0);
    
    	/* Clear the sticky register bits. */
    	CSL_SRIO_SetLLMResetControl (hSrio, 1);
    
    	/* Set the device id to be 0 for the Maintenance Port-Write operation
    	 * to report errors to a system host. */
    	CSL_SRIO_SetPortWriteDeviceId (hSrio, 0x0, 0x0, 0x0);
    
        /* Set the Data Streaming MTU */
        CSL_SRIO_SetDataStreamingMTU (hSrio, 64);
    
        //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    	/* Configure the path mode for the ports. */
        CSL_SRIO_GetBootComplete (hSrio, &bootCompleteFlag);
    
        if (bootCompleteFlag == 1)
       	/* Set boot complete to be 0; to enable writing to the SRIO registers. */
        CSL_SRIO_SetBootComplete (hSrio, 0);
    
        /* Configure the path mode for all ports. */
        for (port = 0; port < 4; port++)
       {
        	/* Configure the path mode for the port. */
        	CSL_SRIO_SetPLMPortPathControlMode (hSrio, port, 0x4);// 4x
    
       }
       if (bootCompleteFlag == 1)
       /* Set boot complete back to 1; configuration is complete. */
       CSL_SRIO_SetBootComplete (hSrio, 1);
    
    
    	/* Set the LLM Port IP Prescalar. */
    	CSL_SRIO_SetLLMPortIPPrescalar (hSrio, 0x1F);
    
    	/* Configure the ingress watermarks */
    	for (i = 0; i < 4; i++)
    	{
    		CSL_SRIO_SetPBMPortIngressPriorityWatermark (hSrio, i, 0, 0x24, 0x24);
    		CSL_SRIO_SetPBMPortIngressPriorityWatermark (hSrio, i, 1, 0x1B, 0x1B);
    		CSL_SRIO_SetPBMPortIngressPriorityWatermark (hSrio, i, 2, 0x12, 0x12);
    		CSL_SRIO_SetPBMPortIngressPriorityWatermark (hSrio, i, 3, 0x9, 0x9);
    	}
    
        /* Disable interrupt pacing for all interrupt destinations. */
        for (i = 0; i < 24; i++)
            CSL_SRIO_DisableInterruptPacing (hSrio, i);
    
    
    	/* Set all the queues 0 to operate at the same priority level and to send packets onto Port 0 */
        for (i =0 ; i < 16; i++)
        	CSL_SRIO_SetTxQueueSchedInfo (hSrio, i, 0, 0);
    
    #ifdef DRV_DEBUG
        //CSL_SRIO_SetTxQueueSchedInfo (hSrio, 8, 2, 0);
        System_printf ("In TXQueueSched DRV_DEBUG area\n");
        /* All TxQueue scheduled to port 2 (and open all TxQueues, except TxQueue 0, to test assignment)
        for (i =0 ; i < 16; i++)
        {
        	CSL_SRIO_SetTxQueueSchedInfo (hSrio, i, 2, 0);
        	//openQueueValues[i] = Qmss_queueOpen (Qmss_QueueType_SRIO_QUEUE , 672 + i,  &isAllocated); //txQueueNum, &isAllocated);
        	//System_printf ("Opening SRIO queue: %i", openQueueValues[i]);
        }
        */
        /* 1st half of TxQueues (except TxQueue 0) open to test assignment
        for (i =1 ; i < 8; i++) //16; i++)
        {
        	openQueueValues[i] = Qmss_queueOpen (Qmss_QueueType_SRIO_QUEUE , 672 + i,  &isAllocated); //txQueueNum, &isAllocated);
        	System_printf ("Opening SRIO queue: %i\n", openQueueValues[i]);
        }
        */
        openQueueValues[0] = Qmss_queueOpen (Qmss_QueueType_SRIO_QUEUE , 673,  &isAllocated);
        System_printf ("Opening SRIO queue: %i\n", openQueueValues[0]);
    	/* Enable the SRIO Transmit channel for each driver instance. */
    	{
        	Cppi_CpDmaInitCfg   srioCPDMACfg;
        	Cppi_Handle			cppiHnd;
    		Cppi_TxChInitCfg    txCfg;
    		Cppi_ChHnd			txChHnd;
    
    	    /* Initialize the SRIO CPDMA config structure. */
    	    memset ((void *)&srioCPDMACfg, 0, sizeof(Cppi_CpDmaInitCfg));
    
    	    /* Setup the SRIO CPDMA Configuration and open the SRIO CPDMA instance; this needs to be done
    	     * for each instance also; since this can be done on each core.  */
    	    srioCPDMACfg.dmaNum = Cppi_CpDma_SRIO_CPDMA;
    	    cppiHnd = Cppi_open (&srioCPDMACfg);
    	    if (cppiHnd == NULL)
    	    {
    	    	System_printf ("\n\n\nError: Initializing CPPI for SRIO CPDMA\n\n\n");
    	    	//Srio_osalLog ("Error: Initializing CPPI for SRIO CPDMA\n");
    	        return NULL;
    	    }
    
    	    /* Disable the SRIO-CPDMA Loopback mode in the CPPI */
    	    if (Cppi_setCpdmaLoopback (cppiHnd, 0) != CPPI_SOK)
    	    {
    	    	System_printf ("\n\n\nError: SRIO CPDMA Loopback mode failed\n\n\n");
    	        //Srio_osalLog ("Error: SRIO CPDMA Loopback mode failed\n");
    	        return -1;
    	    }
    
    		/* Open the SRIO Transmit Channel and keep it disabled. */
    
    		//CSR: Testing TxQueue-TxCh alignment
    		System_printf ("\n\n\n Setting tx channelNums.\n\n\n");
    		txCfg.channelNum   = 1; 			//txCfg.channelNum   = CPPI_PARAM_NOT_SPECIFIED;
    
    		txCfg.priority = Srio_PktDma_Prio_Low; //based on DmaTxPrio set in benchmarking.c being set to lowest
    
    		txCfg.txEnable     = Cppi_ChState_CHANNEL_DISABLE;
    		txCfg.filterEPIB   = 0;
    		txCfg.filterPS     = 0;
    		txCfg.aifMonoMode  = 0;
    		txChHnd = Cppi_txChannelOpen (cppiHnd, &txCfg, &isAllocated);
    		if (txChHnd == NULL)
    		{
    			System_printf ("\n\nError: Opening SRIO Tx channel %d failed\n\n", txCfg.channelNum);
    			//Srio_osalLog ("Error: Opening SRIO Tx channel %d failed\n", txCfg.channelNum);
    			return NULL;
    		}
    	    /* Configure the Transmit Queue Threshold. */
    	    Qmss_setQueueThreshold (673, 1, 1);
    
    	    /* Enable the Transmit Channel. */
    	    if (Cppi_channelEnable (txChHnd) < 0)
    	    {
    	    	System_printf ("\n\n\nError: Enabling SRIO Tx Channel failed\n\n\n");
    	        //Srio_osalLog ("Error: Enabling SRIO Tx Channel failed\n");
    	        return NULL;
    	    }
    	}
    
    #endif
    
    #if 0
        /* Set the Doorbell route to determine which routing table is to be used 
         * This configuration implies that the Interrupt Routing Table is configured as 
         * follows:-
         *  Interrupt Destination 0 - INTDST 16 
         *  Interrupt Destination 1 - INTDST 17 
         *  Interrupt Destination 2 - INTDST 18
         *  Interrupt Destination 3 - INTDST 19 */
        CSL_SRIO_SetDoorbellRoute (hSrio, 0);
    #else
        /* Set the Doorbell route to determine which routing table is to be used
         * This configuration implies that the Interrupt Routing Table is configured as
         * follows:-
         *  Interrupt Destination 0 - INTDST 0
         *  Interrupt Destination 1 - INTDST 1
         *  Interrupt Destination 2 - INTDST 2
         *  Interrupt Destination 3 - INTDST 3 */
       	CSL_SRIO_SetDoorbellRoute (hSrio, 1);
    #endif
    
        /* Route the Doorbell interrupts. 
         *  Doorbell Register 0 - All 16 Doorbits are routed to Interrupt Destination 0. 
         *  Doorbell Register 1 - All 16 Doorbits are routed to Interrupt Destination 1. 
         *  Doorbell Register 2 - All 16 Doorbits are routed to Interrupt Destination 2. 
         *  Doorbell Register 3 - All 16 Doorbits are routed to Interrupt Destination 3. */
        for (i = 0; i < 16; i++)
        {
            CSL_SRIO_RouteDoorbellInterrupts (hSrio, 0, i, 0);
            CSL_SRIO_RouteDoorbellInterrupts (hSrio, 1, i, 1);
            CSL_SRIO_RouteDoorbellInterrupts (hSrio, 2, i, 2);
            CSL_SRIO_RouteDoorbellInterrupts (hSrio, 3, i, 3);
        }
    
    	/* Enable the peripheral. */
    	CSL_SRIO_EnablePeripheral (hSrio);
    
        /* Configuration has been completed. */
        CSL_SRIO_SetBootComplete (hSrio, 1);
    
    
        /* Check Ports and make sure they are operational. */
        //////!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    
        /* Wait for all SRIO ports for specified lane mode to be operational */
        printf ("Debug: Waiting for SRIO ports to be operational...  \n");
        tscTemp = CSL_tscRead () + 5000000000;
        for (port = 0; port < 4; port++)
        {
         	if ((0x1 >> port) & 0x1 == 1)
           	{
           		sprintf (statusText, "NOT ");
           		/* Check for good port status on each valid port, timeout if not received after 5 seconds */
           	    while (CSL_tscRead() < tscTemp)
           	    {
        			if (CSL_SRIO_IsPortOk (hSrio, port) == TRUE)
        			{
        				sprintf (statusText,"");
        				break;
        			}
           	    }
            	    printf ("Debug: SRIO port %d is % soperational.\n", port, statusText);
            		tscTemp = CSL_tscRead() + 1000000000;
            }
       }
    
        /* Initialization has been completed. */
        return 0;
    }