*************************************************************************
*	CPSW Single Core Example 
*	---------------------------------
*
*	(C) Copyright 2009-2011, Texas Instruments, Inc.
*
*	Use of this software is controlled by the terms and conditions found 
*	in the license agreement under which this software has been supplied.
*************************************************************************

The CPSW (EMAC) Single core example demonstrates the use of CPSW CSL APIs to 
configure the ethernet switch on target (silicon and simulator). It further demonstrates 
the use of CPPI/QMSS/PA LLDs to send/receive data through the ethernet switch using 
Host descriptors on any given DSP core.

Check the release notes for prerequisites, version information and steps on how to 
run examples

-------------------------
Execute Project
-------------------------

In order for the example to work successfully, i.e. to be able to send/receive data packets from the wire 
the following configuration needs to be done in the simulator:

    a) Open the target Configuration file located under CCS simulation directory (simulation_csp_ny). For example,
       if CCSv5 is installed to its default directory, i.e., C:\Program Files\Texas Instruments\ccsv5, then
       the configuration file can be found at 
       C:\Program Files\Texas Instruments\ccsv5\ccs_base(_xxx)\simulation_csp_ny\bin\configurations

I.  RGMII-loopback
    b) Make sure that the following two lines are uncommented:
    This enables loopback at EMAC adaptor level (PHY simulation) in the simulator.
    CONNECT11       System.C66XX_S.SHARED_SYSTEM.SWITCHSS.switchss_sgmii0_tx_data_gen_opin, System.C66XX_S.SHARED_SYSTEM.SWITCHSS.switchss_sgmii1_rx_data_gen_ipin;
    CONNECT12       System.C66XX_S.SHARED_SYSTEM.SWITCHSS.switchss_sgmii0_rx_data_gen_ipin, System.C66XX_S.SHARED_SYSTEM.SWITCHSS.switchss_sgmii1_tx_data_gen_opin;
    
II. NIC-loopback 
    b) Pick a NIC on the PC running simulation that you'd like to use to run the example. This will
       be the interface using which the packets will be sent/received by the example.
    c) Under "EMAC_ADAPTOR" section, locate the following line of code,

        			INPUT2	ADAPTOR, OFF;

        Modify the above line of code to:

        			INPUT2	ADAPTOR, ON;

        This will turn on the EMAC adaptor in simulator so as to send/receive packets.
    d) Under the same section, locate and modify the following line of code as follows:

			        INPUT4  NETWORK_ADAPTOR, Broadcom;                    

        Modify the above line of code to include the name of the NIC card you are using, for example if
        the interface you are using for the test on your PC is a "Realtek" card, modify the above line
        to:

			        INPUT4  NETWORK_ADAPTOR, Realtek;            

    e) If the following lines are uncommented, please comment them:                    

    CONNECT11       System.C66XX_S.SHARED_SYSTEM.SWITCHSS.switchss_sgmii0_tx_data_gen_opin, System.C66XX_S.SHARED_SYSTEM.SWITCHSS.switchss_sgmii1_rx_data_gen_ipin;
    CONNECT12       System.C66XX_S.SHARED_SYSTEM.SWITCHSS.switchss_sgmii0_rx_data_gen_ipin, System.C66XX_S.SHARED_SYSTEM.SWITCHSS.switchss_sgmii1_tx_data_gen_opin;
    
    as follows:

    //CONNECT11       System.C66XX_S.SHARED_SYSTEM.SWITCHSS.switchss_sgmii0_tx_data_gen_opin, System.C66XX_S.SHARED_SYSTEM.SWITCHSS.switchss_sgmii1_rx_data_gen_ipin;
    //CONNECT12       System.C66XX_S.SHARED_SYSTEM.SWITCHSS.switchss_sgmii0_rx_data_gen_ipin, System.C66XX_S.SHARED_SYSTEM.SWITCHSS.switchss_sgmii1_tx_data_gen_opin;
    

    This disables loopback at EMAC adaptor level (PHY simulation) in the simulator.

    f) Finally, configure the switch MAC configured in the example, i.e., 0x10-0x11-0x12-0x13-0x14-0x15 on the
       EMAC adaptor so that the simulator can pass all packets matching the switch MAC up to the application.

       example:

			INPUT5  MAC_ADDRESS_PORT0, 10-11-12-13-14-15;   // configure the Port0 MAC to be the switch MAC
			INPUT6  MAC_ADDRESS_PORT1, 00-01-02-03-04-05;       

Launch the CCS Debugger and go to the Debug Perspective.

To execute the project ensure the following is done:-
    a) Reset CPU
    b) Load Program
    c) Once the project is loaded; Run to execute it.
    
Note: The deafult test configuration is for silicon only.
      To run the test at the CCS simulator, there are two options.
      Option1: Rebuild the project with the compiler option SIMULATOR_SUPPORT.
      Option2: Set the following two configuration variables before run:
               cpswSimTest = 1
               cpswLpbkMode = CPSW_LOOPBACK_EXTERNAL (2)       
    
    
