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.

How to assign socket to the second mac port?

Other Parts Discussed in Thread: SYSBIOS

Hi all,

      We are using am335x processor to connector to two phy by RGMII and plan to use the processor to run as dual mac mode. We also use sysbios as the os and NDK as the network stack. Now I am able to use socket to drive on the first port. But I am not know how to use the second port to transfer data.

       Could someone provide my these information?

1. How to modify my am335x_sysbios_ind_sdk_1.1.0.3 to drive the am335x to dual mac mode?

2. How to use socket command to transfer data through specify port (like use raw protocal on port 1 and TCP protocal on port 2)?

Thank you!

  • Hello,

    Dual MAC implementation is not available on ISDK as for now. There were plans to bring in this feature, but it never materialized. This post might help - http://e2e.ti.com/support/embedded/tirtos/f/355/t/242288.aspx

    Regards,
    Vinesh

  • Hello Vinesh,

    Thank you for your reply!

    I checked my NSP of am335x in ISDK. My initial parts is like this:

    int AddNetifEntryFn(int initFnTtype)
    {

    if(nimu_device_index < MAX_TABLE_ENTRIES)
    {
    NIMUInitFn initPtr = NULL;
    switch(initFnTtype)
    {
    case 1 :
    initPtr = CpswEmacInit;
    break;
    case 2 :
    // initPtr = EmacInit;
    break;
    default :
    return 0;
    }
    NIMUDeviceTable[nimu_device_index++].init = initPtr ;
    NIMUDeviceTable[nimu_device_index].init = initPtr ;
    }
    return 1;
    }

    Can I change like this to let the NDK to init twice?

    One another question is in CpswEmacInit, shall I connect all of the mac function to two different function block or just use the same?

    The original code is like this:

    strcpy (ptr_device->name, "eth1");
    ptr_device->mtu = ETH_MAX_PAYLOAD - ETHHDR_SIZE;
    ptr_device->pvt_data = (void *)ptr_pvt_data;

    /* Populate the Driver Interface Functions. */
    ptr_device->start = CpswEmacStart;
    ptr_device->stop = CpswEmacStop;
    ptr_device->poll = CpswEmacPoll;
    ptr_device->send = CpswEmacSend;
    ptr_device->pkt_service = CpswEmacPktService;
    ptr_device->ioctl = Cpswioctl;
    ptr_device->add_header = NIMUAddEthernetHeader;

    /* Register the device with NIMU */
    if (NIMURegister (ptr_device) < 0)
    {
    // info_printf ("Error: Unable to register the EMAC\n");
    return -1;
    }

    Shall I make the two different function of this red parts for thesecond mac port?

    Thank you!

  • Hello,

    Ideally you should call AddNetIfEntry twice(with the required instance), and then handle the calls in nimu_eth.c . Instead of creating a copy of the same function(it might work), you can handle it accordingly with respect to the instance number.

    Please note that you'll have to modify the instance numbers in Init while adding a new entry.

    Regards,
    Vinesh

  • Hi Vinesh,

    My problem has not solved yet. I plan to make the dual mac according to your suggestion, But still have these two questions?

    1. How to define special instance name for each port? As I checked the code, I can not find any variable that is used to mark the instance, all thing looks like is under the management of NDK and passed into each emac level functions.

    2. Looks like one member in NETIF_DEVICE structure named "index" can be used to mark each port , Am I right?

    Need your more detail support, Thank you very much!