int main (void) { init_platform(); XEmacLite *EmacLiteInstPtr = &EmacLiteInstance; XEmacLite_Config *ConfigPtr; ConfigPtr = XEmacLite_LookupConfig(EMAC_DEVICE_ID); XEmacLite_CfgInitialize(EmacLiteInstPtr, ConfigPtr, ConfigPtr->BaseAddress); char s; int port, dev; unsigned int value; #if AEL2005_SR char port_mode_new[4] = {-1,-1,-1,-1}; char port_mode[4] = {-1,-1,-1,-1}; #endif goto INIT; INIT: for(port = 0; port < 4; port ++){ if(port == 0) dev = 2; if(port == 1) dev = 1; if(port == 2) dev = 0; if(port == 3) dev = 3; //xil_printf("Port %d: ", port); ael2005_read (EmacLiteInstPtr, dev, 1, 0xa, &value); /*if(value == 0) { print("No Signal.\r\n"); continue; }*/ for(s = 20; s < 36; s++){ ael2005_i2c_read (EmacLiteInstPtr, dev, MODULE_DEV_ADDR, s, &value); //xil_printf("%c", value); } for(s = 40; s < 56; s++){ ael2005_i2c_read (EmacLiteInstPtr, dev, MODULE_DEV_ADDR, s, &value); //xil_printf("%c", value); } //print("\r\n"); #if AEL2005_SR // Check if we have a 10GBASE-SR cable ael2005_i2c_read (EmacLiteInstPtr, dev, MODULE_DEV_ADDR, 0x3, &value); if((value >> 4) == 1) port_mode_new[port] = MODE_SR; else port_mode_new[port] = MODE_TWINAX; if(port_mode_new[port] != port_mode[port]){ //xil_printf("Port %d Detected new mode %x\r\n", port, port_mode_new[port]); test_initialize(EmacLiteInstPtr, dev, port_mode_new[port]); port_mode[port] = port_mode_new[port]; } #else test_initialize(EmacLiteInstPtr, dev, MODE_TWINAX); #endif }
int main (void) { init_platform(); XEmacLite *EmacLiteInstPtr = &EmacLiteInstance; XEmacLite_Config *ConfigPtr; ConfigPtr = XEmacLite_LookupConfig(EMAC_DEVICE_ID); XEmacLite_CfgInitialize(EmacLiteInstPtr, ConfigPtr, ConfigPtr->BaseAddress); // Hold AXI4-Stream Packet Generator/Checker Xil_Out32(XPAR_NF10_AXIS_GEN_CHECK_0_BASEADDR+0x3, 0x1); Xil_Out32(XPAR_NF10_AXIS_GEN_CHECK_1_BASEADDR+0x3, 0x1); char s; int port, dev; unsigned int value; #if AEL2005_SR char port_mode_new[4] = {-1,-1,-1,-1}; char port_mode[4] = {-1,-1,-1,-1}; #endif print("hiiiiiiiiiiiiiii"); goto INIT; while(1){ print("==NetFPGA-10G==\r\n"); print("i : Initialize AEL2005\r\n"); print("s : Dump status\r\n"); print("t : Run AXI4-Stream Gen/Check\r\n"); print("r : Stop AXI4-Stream Gen/Check\r\n"); s = inbyte(); if(s == 'i'){ INIT: for(port = 0; port < 4; port ++){ if(port == 0) dev = 2; if(port == 1) dev = 1; if(port == 2) dev = 0; if(port == 3) dev = 3; xil_printf("Port %d: ", port); ael2005_read (EmacLiteInstPtr, dev, 1, 0xa, &value); /*if(value == 0) { print("No Signal.\r\n"); continue; }*/ for(s = 20; s < 36; s++){ ael2005_i2c_read (EmacLiteInstPtr, dev, MODULE_DEV_ADDR, s, &value); xil_printf("%c", value); } for(s = 40; s < 56; s++){ ael2005_i2c_read (EmacLiteInstPtr, dev, MODULE_DEV_ADDR, s, &value); xil_printf("%c", value); } print("\r\n"); #if AEL2005_SR // Check if we have a 10GBASE-SR cable ael2005_i2c_read (EmacLiteInstPtr, dev, MODULE_DEV_ADDR, 0x3, &value); if((value >> 4) == 1) port_mode_new[port] = MODE_SR; else port_mode_new[port] = MODE_TWINAX; if(port_mode_new[port] != port_mode[port]){ xil_printf("Port %d Detected new mode %x\r\n", port, port_mode_new[port]); test_initialize(EmacLiteInstPtr, dev, port_mode_new[port]); port_mode[port] = port_mode_new[port]; } #else test_initialize(EmacLiteInstPtr, dev, MODE_TWINAX); #endif } }