sc_ethernet: RX/TX not used in two parallel statements

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
Interactive_Matter
XCore Addict
Posts: 216
Joined: Wed Feb 10, 2010 10:26 am

sc_ethernet: RX/TX not used in two parallel statements

Post by Interactive_Matter »

Hi,

I am just playing (=fighting against???) the new sc_ethernet stack from github. It was quite easy to integrate into the XC3 and AP_Led_Tile. But there is one warning that really puzzles me:

Code: Select all

Compiling main.xc
.././src/main.xc:122: warning: `rx' not used in two parallel statements (byte range 0..4)
.././src/main.xc:122: warning: `rx' not used in two parallel statements (byte range 4..8)
.././src/main.xc:122: warning: `tx' not used in two parallel statements (byte range 0..4)
.././src/main.xc:122: warning: `tx' not used in two parallel statements (byte range 4..8)
So far so good, rx and tx are an array of channels, as proposed by the sc_ethernet:

Code: Select all

  chan rx[2], tx[2];
But then again if I inspect the code that it is in fact used in two parallel statements (at leas I told the source to try to):

Code: Select all

    // Threads constrained by I/O or latency requirements
	//the internal 3 port ethernet switch
    on stdcore[2]: {
        int mac_address[2];
		phy_init_two_port(clk_smi, p_mii_resetn, smi_0, smi_1, mii_0, mii_1);
        ethernet_server_two_port(mii_0, mii_1, mac_address, rx, 2, tx, 2, smi_0, smi_1, null);
        ethSwitch(rx[0], rx[1], c_local_rx_in,
        		  tx[0], tx[1],c_local_tx,
        		  cWdog[0]);
    }
Now I am asking myself: Is the compiler too dumb to analyze this and I can ignore the warning?
Or is there something wrong e.g. with my #defines which wrecks the code?
Anybody got some experience with this compiler behaviour or the sc_ethernet?

btw. my ethernet_conf.h looks ok for me – but I can be wrong on this too ;)

Code: Select all

#define MAX_ETHERNET_PACKET_SIZE (1518)

#define NUM_MII_RX_BUF 20
#define NUM_MII_TX_BUF 2

#define MAX_ETHERNET_CLIENTS   (4)    

#define NUM_ETHERNET_PORTS (2)


User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm

Post by Folknology »

Are you trying to use channels between code running on the same thread, I think the compiler expects to allocate 2 chanends on different threads but cannot.

regards
Al
User avatar
Interactive_Matter
XCore Addict
Posts: 216
Joined: Wed Feb 10, 2010 10:26 am

Post by Interactive_Matter »

oopsala, did verlook this. You are right this is complete rubbish!
I think it actually makes much more sense that ethernet_server_two_port and ethSwitch go into two separate threads. At least as far as I understand the source.

Thanks for showing me my mistake!