############################################################### # Copyright (c) 2004 Xilinx, Inc. All Rights Reserved. # You may copy and modify these files for your own internal use solely with # Xilinx programmable logic devices and Xilinx EDK system or create IP # modules solely for Xilinx programmable logic devices and Xilinx EDK system. # No rights are granted to distribute any files unless they are distributed in # Xilinx programmable logic devices. # # $Id: xilnet_v2_1_0.tcl,v 1.2.8.6 2005/11/15 23:41:10 salindac Exp $ # ############################################################## #uses "xillib.tcl" set ethernet_ninstances 0 set ethernet_periphs_name_list {} set ethernet_use_axi 0 set ethernet_use_temac 0 proc get_ethernet_periphs {mhs_handle} { global ethernet_ninstances global ethernet_periphs_name_list global ethernet_use_axi global ethernet_use_temac set ipinst_list [xget_hw_ipinst_handle $mhs_handle "*"] set ethernet_ninstances 0 set ethernet_use_axi 0 set ethernet_use_temac 0 set ethernet_periphs_list {} set ethernet_periphs_name_list {} foreach periph $ipinst_list { set periph_type [xget_hw_value $periph] set periph_name [xget_value $periph "name"] # puts "\# Peripheral: type = $periph_type name = $periph_name " if { $periph_type == "axi_ethernet" } { incr ethernet_use_axi incr ethernet_ninstances lappend ethernet_periphs_list $periph lappend ethernet_periphs_name_list $periph_name # puts "\# Ethernet $ethernet_ninstances: type = $periph_type name = $periph_name " } if { $periph_type == "xps_ll_temac" || $periph_type == "opb_ethernetlite" || $periph_type == "xps_ethernetlite" } { incr ethernet_use_temac incr ethernet_ninstances lappend ethernet_periphs_list $periph lappend ethernet_periphs_name_list $periph_name # puts "\# Ethernet $ethernet_ninstances: type = $periph_type name = $periph_name " } } return $ethernet_periphs_list } proc get_ethernet_interface_periph {mhs_handle inst_handle} { set p2p_busifs_i [xget_hw_busifs_by_subproperty $inst_handle "BUS_TYPE" "INITIATOR"] # Add p2p periphs foreach p2p_busif $p2p_busifs_i { set bus_name [string toupper [xget_hw_value $p2p_busif]] set conn_busif_handle [xget_hw_connected_busifs_handle $mhs_handle $bus_name "TARGET"] if { [string compare -nocase $conn_busif_handle ""] == 0} { continue } else { # if there is a single match, we know if it is FIFO or DMA # no need for further iterations set conn_busif_name [xget_hw_name $conn_busif_handle] set target_periph [xget_hw_parent_handle $conn_busif_handle] set target_type [xget_hw_value $target_periph] set target_name [string toupper [xget_hw_name $target_periph]] # puts "\# Bus Name = $bus_name Type = $conn_busif_name" # puts "\# Target Name = $target_name Type = $target_type" return $target_periph } } return } proc get_periph_instances {mhs_handle inst_type} { set ipinst_list [xget_hw_ipinst_handle $mhs_handle "*"] set periphs_list {} foreach periph $ipinst_list { set periph_type [xget_hw_value $periph] set periph_name [xget_value $periph "name"] if { $periph_type == $inst_type } { lappend periphs_list $periph # puts "\# Instance: type = $periph_type name = $periph_name " } } return $periphs_list } proc net_drc {lib_handle} { puts "XilNet DRC ..." } proc net_open_file {filename desc} { set config_inc [open $filename w] xprint_generated_header $config_inc $desc return $config_inc } proc net_open_include_file {file_name} { set filename [file join "./src/" $file_name] return [net_open_file $filename "WARP/XilNet Configuration Parameters"] } proc net_open_config_file {file_name} { set filename [file join "./src/" $file_name] return [net_open_file $filename "WARP/XilNet MAC Configuration File"] } proc generate {lib_handle} { global ethernet_ninstances global ethernet_periphs_name_list set sw_proc_handle [xget_processor] set hw_proc_handle [xget_handle $sw_proc_handle "IPINST"] set mhs_handle [xget_hw_parent_handle $hw_proc_handle] set emac_inst_list [get_ethernet_periphs $mhs_handle] # Error checking if {$ethernet_ninstances == 0} { error "Invalid configuration: 0 Ethernet instances found." "" "mdt_error" return } # Initialize variables for loop set eth_inst_num 0 set h_file [net_open_include_file "xilnet_config.h"] set c_file [net_open_config_file "xilnet_config.c"] set fifo_buf_size [xget_value $lib_handle "PARAMETER" "fifo_buf_size"] set dma_buf_size [xget_value $lib_handle "PARAMETER" "dma_buf_size"] set dma_rcvd_buf_cnt [xget_value $lib_handle "PARAMETER" "dma_rcvd_buf_cnt"] set udp_conns [xget_value $lib_handle "PARAMETER" "no_of_tcp_conns"] set inf_type_list {} # puts "\# --------------------------------------" # puts "\# Num Ethernet instances = $ethernet_ninstances " print_h_file_header $h_file $udp_conns print_c_file_header $c_file foreach inst $emac_inst_list { set inst_type [xget_hw_value $inst] set inst_name [string toupper [xget_hw_name $inst]] # puts "\# Name = $inst_name " # puts "\# Type = $inst_type " # Print out header file delimiter puts $h_file "" puts $h_file "/************************* Ethernet $eth_inst_num Definitions ****************************/" puts $h_file "" # Print out c file delimiter puts $c_file "" puts $c_file "/************************* Ethernet $eth_inst_num Definitions ****************************/" puts $c_file "" if { [string compare -nocase $inst_type "opb_ethernetlite"] == 0 || [string compare -nocase $inst_type "xps_ethernetlite"] == 0} { error "TBD: ethernetlite not yet supported. Please change HW design for $inst_name." "" "mdt_error" return } elseif { [string compare -nocase $inst_type "xps_ll_temac"] == 0} { # Determine the interface attached to the temac set inf_inst [get_ethernet_interface_periph $mhs_handle $inst] if { [llength $inf_inst] != 0 } { set inf_inst_type [xget_hw_value $inf_inst] set inf_inst_name [string toupper [xget_hw_name $inf_inst]] } else { error "Unable to find interface for $inst_name. Some common causes are 1. The interface of the TEMAC is left unconnected. 2. A custom peripheral is connected to the interface. The WARP Xilnet has been designed for use with the LL FIFO peripheral only." "" "mdt_error" } set inf_dma_inst [get_periph_instances $mhs_handle "xps_central_dma"] if { [llength $inf_dma_inst] != 0 } { set inf_dma_inst_type [xget_hw_value $inf_dma_inst] set inf_dma_inst_name [string toupper [xget_hw_name $inf_dma_inst]] print_h_file_temac $h_file $eth_inst_num $inst_name $inf_inst_name $inf_dma_inst_name $dma_rcvd_buf_cnt $fifo_buf_size print_c_file_temac $c_file $eth_inst_num } else { error "Unable to find the central dma interface for $inst_name. Some common causes are 1. A custom peripheral is used for dma to the temac. The WARP Xilnet has been designed for use with the CENTRAL DMA peripherals only." "" "mdt_error" } # Append one entry for TEMAC lappend inf_type_list $inst_type } elseif { [string compare -nocase $inst_type "axi_ethernet"] == 0} { # Determine the interface attached to the axi_ethernet set inf_inst [get_ethernet_interface_periph $mhs_handle $inst] if { [llength $inf_inst] != 0 } { set inf_inst_type [xget_hw_value $inf_inst] set inf_inst_name [string toupper [xget_hw_name $inf_inst]] lappend inf_type_list $inf_inst_type switch $inf_inst_type { "axi_fifo_mm_s" { print_h_file_fifo $h_file $eth_inst_num $inst_name $inf_inst_name $dma_rcvd_buf_cnt $fifo_buf_size print_c_file_fifo $c_file $eth_inst_num } "axi_dma" { print_h_file_dma $h_file $eth_inst_num $inst_name $inf_inst_name $dma_rcvd_buf_cnt $dma_buf_size print_c_file_dma $c_file $eth_inst_num } "default" { error "Unable to handle AXI connections for target type $target_periph_type. Some common causes are 1. The AXI4 Stream interface of the AXI Ethernet is left unconnected. 2. A custom peripheral is connected to the AXI interface. The WARP Xilnet has been designed for use with the AXI Streaming FIFO, and AXI DMA peripherals only." "" "mdt_error" } } } else { error "Unable to find AXI interface for $inst_name. Some common causes are 1. The AXI4 Stream interface of the AXI Ethernet is left unconnected. 2. A custom peripheral is connected to the AXI interface. The WARP Xilnet has been designed for use with the AXI Streaming FIFO, and AXI DMA peripherals only." "" "mdt_error" } } else { error "$inst_name is not a TEMAC or ETHERNETLITE or AXI ETHERNET core. WARPXilNet can work only with such cores." "" "mdt_error" } # increment the instance number for the next iteration of the for loop incr eth_inst_num } print_h_file_footer $h_file print_c_file_footer $c_file $inf_type_list close $h_file close $c_file } proc print_h_file_header {file_handle udp_conns} { global ethernet_ninstances global ethernet_use_axi global ethernet_use_temac puts $file_handle "\#ifndef _XILNET_CONFIG_H" puts $file_handle "\#define _XILNET_CONFIG_H" puts $file_handle "" puts $file_handle "\#ifdef __cplusplus" puts $file_handle "extern \"C\" \{" puts $file_handle "\#endif" puts $file_handle "" # Uncomment the next line and clean the project to enable debug output on the UART # # puts $file_handle "\#define _DEBUG_" # Uncomment the next line and clean the project to enable performance monitoring on oscilloscope: # - Ethernet receive toggles GPIO 1 (see xilnet_eth.c) # - Ethernet transmit toggles GPIO 2 (see xilnet_eth.c) # # puts $file_handle "\#define _PERFORMANCE_MONITOR_" puts $file_handle "" puts $file_handle "/***************************** Include Files *********************************/" puts $file_handle "\#include " puts $file_handle "\#include " puts $file_handle "" if { $ethernet_use_axi != 0 } { puts $file_handle "\#include " puts $file_handle "\#include " } if { $ethernet_use_temac != 0 } { puts $file_handle "\#include " puts $file_handle "\#include " puts $file_handle "\#include " puts $file_handle "\#include " } puts $file_handle "" puts $file_handle "/*************************** Constant Definitions ****************************/" puts $file_handle "" puts $file_handle "// Xilnet Global Defines" puts $file_handle "\#define XILNET_NUM_ETH_DEVICES $ethernet_ninstances // Define the number of Ethernet devices" puts $file_handle "\#define XILNET_BD_ALIGNMENT XAXIDMA_BD_MINIMUM_ALIGNMENT // Buffer Descriptor alignment" puts $file_handle "" puts $file_handle "// Define UDP connections" puts $file_handle "\#define XILNET_MAX_UDP_CONNS $udp_conns // maximum no of open udp conns" puts $file_handle "\#define NO_OF_XILSOCKS XILNET_MAX_UDP_CONNS // Number of sockets per Ethernet Device" puts $file_handle "" puts $file_handle "// Define Ethernet interface types" puts $file_handle "\#define XILNET_AXI_DMA_INF 1" puts $file_handle "\#define XILNET_AXI_FIFO_INF 2" puts $file_handle "\#define XILNET_TEMAC_INF 3" puts $file_handle "" puts $file_handle "// Define which interfaces are used" if { $ethernet_use_axi != 0 } { puts $file_handle "\#define XILNET_AXI_DMA_INF_USED" puts $file_handle "\#define XILNET_AXI_FIFO_INF_USED" } if { $ethernet_use_temac != 0 } { puts $file_handle "\#define XILNET_TEMAC_INF_USED" } puts $file_handle "" } proc print_h_file_fifo {file_handle inst_num inst_name inf_name num_rcv_buf buf_size} { puts $file_handle "// Ethernet device $inst_num" puts $file_handle "\#define $inst_name XILNET_ETH_$inst_num // External name of Ethernet device" puts $file_handle "\#define XILNET_ETH_$inst_num $inst_num // Internal name of Ethernet device" puts $file_handle "" puts $file_handle [format "\#define XILNET_ETH_%s_INF_DEVICE_ID XPAR_%s_DEVICE_ID" $inst_num $inf_name] # Only one receive buffer supported for FIFO mode puts $file_handle [format "\#define XILNET_ETH_%s_NUM_RECV_BUF 1" $inst_num] puts $file_handle [format "\#define XILNET_ETH_%s_BUF_SIZE %s" $inst_num $buf_size] puts $file_handle "" puts $file_handle "// Variables for ETH $inst_num" puts $file_handle [format "extern XLlFifo ETH_%s_FIFO_Instance;" $inst_num] puts $file_handle "" puts $file_handle "// Buffers for ETH $inst_num" puts $file_handle [format "extern unsigned int recvBuffer_eth_%s\[XILNET_ETH_%s_NUM_RECV_BUF*((XILNET_ETH_%s_BUF_SIZE+3)/4)\];" $inst_num $inst_num $inst_num] puts $file_handle [format "extern unsigned int sendBuffer_eth_%s\[(XILNET_ETH_%s_BUF_SIZE+3)/4\];" $inst_num $inst_num] puts $file_handle "" } proc print_h_file_dma {file_handle inst_num inst_name inf_name num_rcv_buf buf_size} { puts $file_handle "// Ethernet device $inst_num" puts $file_handle "\#define $inst_name XILNET_ETH_$inst_num // External name of Ethernet device" puts $file_handle "\#define XILNET_ETH_$inst_num $inst_num // Internal name of Ethernet device" puts $file_handle "" puts $file_handle [format "\#define XILNET_ETH_%s_INF_DEVICE_ID XPAR_%s_DEVICE_ID" $inst_num $inf_name] puts $file_handle [format "\#define XILNET_ETH_%s_NUM_RECV_BUF %s" $inst_num $num_rcv_buf] puts $file_handle [format "\#define XILNET_ETH_%s_BUF_SIZE %s" $inst_num $buf_size] # NOTE: For both Send and Receive, the number of buffer descriptors should equal the number of buffers puts $file_handle [format "\#define XILNET_ETH_%s_RXBD_CNT XILNET_ETH_%s_NUM_RECV_BUF // Number of RxBDs to use" $inst_num $inst_num] puts $file_handle [format "\#define XILNET_ETH_%s_TXBD_CNT 1 // Number of TxBDs to use" $inst_num] puts $file_handle [format "\#define XILNET_ETH_%s_RXBD_SPACE_BYTES (XAxiDma_BdRingMemCalc(XILNET_BD_ALIGNMENT, XILNET_ETH_%s_RXBD_CNT))" $inst_num $inst_num] puts $file_handle [format "\#define XILNET_ETH_%s_TXBD_SPACE_BYTES (XAxiDma_BdRingMemCalc(XILNET_BD_ALIGNMENT, XILNET_ETH_%s_TXBD_CNT))" $inst_num $inst_num] puts $file_handle "" puts $file_handle "// Variables for ETH $inst_num" puts $file_handle [format "extern XAxiDma ETH_%s_DMA_Instance;" $inst_num] puts $file_handle "" puts $file_handle "// Aligned memory segments to be used for buffer descriptors" puts $file_handle [format "extern char ETH_%s_RX_BD_space\[XILNET_ETH_%s_RXBD_SPACE_BYTES\] __attribute__ ((aligned(XILNET_BD_ALIGNMENT)));" $inst_num $inst_num] puts $file_handle [format "extern char ETH_%s_TX_BD_space\[XILNET_ETH_%s_TXBD_SPACE_BYTES\] __attribute__ ((aligned(XILNET_BD_ALIGNMENT)));" $inst_num $inst_num] puts $file_handle "" puts $file_handle "// Buffers for ETH $inst_num" puts $file_handle [format "extern unsigned int recvBuffer_eth_%s\[XILNET_ETH_%s_NUM_RECV_BUF*((XILNET_ETH_%s_BUF_SIZE+3)/4)\];" $inst_num $inst_num $inst_num] puts $file_handle [format "extern unsigned int sendBuffer_eth_%s\[(XILNET_ETH_%s_BUF_SIZE+3)/4\];" $inst_num $inst_num] } proc print_h_file_temac {file_handle inst_num inst_name inf_name inf_dma_name num_rcv_buf buf_size} { puts $file_handle "// Ethernet device $inst_num" puts $file_handle "\#define $inst_name XILNET_ETH_$inst_num // External name of Ethernet device" puts $file_handle "\#define XILNET_ETH_$inst_num $inst_num // Internal name of Ethernet device" puts $file_handle "" puts $file_handle [format "\#define XILNET_ETH_%s_INF_DEVICE_ID XPAR_%s_DEVICE_ID" $inst_num $inf_name] puts $file_handle [format "\#define XILNET_ETH_%s_INF_DMA_DEVICE_ID XPAR_%s_DEVICE_ID" $inst_num $inf_dma_name] # Only one receive buffer supported for FIFO mode puts $file_handle [format "\#define XILNET_ETH_%s_NUM_RECV_BUF 1" $inst_num] puts $file_handle [format "\#define XILNET_ETH_%s_BUF_SIZE %s" $inst_num $buf_size] puts $file_handle "" puts $file_handle "// Variables for ETH $inst_num" puts $file_handle [format "extern XLlFifo ETH_%s_FIFO_Instance;" $inst_num] puts $file_handle [format "extern XDmaCentral ETH_%s_DMA_Instance;" $inst_num] puts $file_handle [format "extern XDmaCentral_Config *ETH_%s_DMA_CFG_ptr;" $inst_num] puts $file_handle "" puts $file_handle "// Buffers for ETH $inst_num" puts $file_handle [format "extern unsigned int recvBuffer_eth_%s\[XILNET_ETH_%s_NUM_RECV_BUF*((XILNET_ETH_%s_BUF_SIZE+3)/4)\];" $inst_num $inst_num $inst_num] puts $file_handle [format "extern unsigned int sendBuffer_eth_%s\[(XILNET_ETH_%s_BUF_SIZE+3)/4\];" $inst_num $inst_num] } proc print_h_file_footer {file_handle} { puts $file_handle "" puts $file_handle "/*********************** Global Variable Definitions *************************/" puts $file_handle "" puts $file_handle "// Ethernet Device Structure" puts $file_handle "extern xilnet_eth_device eth_device\[XILNET_NUM_ETH_DEVICES\];" puts $file_handle "" puts $file_handle "/*************************** Function Prototypes *****************************/" puts $file_handle "" puts $file_handle "void xilnet_init_eth_device_struct(unsigned int);" puts $file_handle "" puts $file_handle "\#endif" puts $file_handle "" puts $file_handle "/*****************************************************************************/" puts $file_handle "" } proc print_c_file_header {file_handle} { global ethernet_ninstances puts $file_handle "" puts $file_handle "/***************************** Include Files *********************************/" puts $file_handle "" puts $file_handle "\#include " puts $file_handle "\#include " puts $file_handle "" } proc print_c_file_fifo {file_handle inst_num} { puts $file_handle "" puts $file_handle "// Variables for ETH $inst_num" puts $file_handle [format "XLlFifo ETH_%s_FIFO_Instance;" $inst_num] puts $file_handle "" puts $file_handle "// Buffers for ETH $inst_num" puts $file_handle [format "unsigned int recvBuffer_eth_%s\[XILNET_ETH_%s_NUM_RECV_BUF*((XILNET_ETH_%s_BUF_SIZE+3)/4)\];" $inst_num $inst_num $inst_num] puts $file_handle [format "unsigned int sendBuffer_eth_%s\[(XILNET_ETH_%s_BUF_SIZE+3)/4\];" $inst_num $inst_num] puts $file_handle [format "struct xilsock_socket xilsock_sockets_eth_%s\[NO_OF_XILSOCKS\];" $inst_num] puts $file_handle [format "struct xilnet_udp_conn xilnet_udp_conns_eth_%s\[XILNET_MAX_UDP_CONNS\];" $inst_num] puts $file_handle "" } proc print_c_file_dma {file_handle inst_num} { puts $file_handle "" puts $file_handle "// Variables for ETH $inst_num" puts $file_handle [format "XAxiDma ETH_%s_DMA_Instance;" $inst_num] puts $file_handle "" puts $file_handle "// Aligned memory segments to be used for buffer descriptors" puts $file_handle [format "char ETH_%s_RX_BD_space\[XILNET_ETH_%s_RXBD_SPACE_BYTES\] __attribute__ ((aligned(XILNET_BD_ALIGNMENT)));" $inst_num $inst_num] puts $file_handle [format "char ETH_%s_TX_BD_space\[XILNET_ETH_%s_TXBD_SPACE_BYTES\] __attribute__ ((aligned(XILNET_BD_ALIGNMENT)));" $inst_num $inst_num] puts $file_handle "" puts $file_handle "// Buffers for ETH $inst_num" puts $file_handle [format "unsigned int recvBuffer_eth_%s\[XILNET_ETH_%s_NUM_RECV_BUF*((XILNET_ETH_%s_BUF_SIZE+3)/4)\];" $inst_num $inst_num $inst_num] puts $file_handle [format "unsigned int sendBuffer_eth_%s\[(XILNET_ETH_%s_BUF_SIZE+3)/4\];" $inst_num $inst_num] puts $file_handle [format "struct xilsock_socket xilsock_sockets_eth_%s\[NO_OF_XILSOCKS\];" $inst_num] puts $file_handle [format "struct xilnet_udp_conn xilnet_udp_conns_eth_%s\[XILNET_MAX_UDP_CONNS\];" $inst_num] puts $file_handle "" } proc print_c_file_temac {file_handle inst_num} { puts $file_handle "" puts $file_handle "// Variables for ETH $inst_num" puts $file_handle [format "XLlFifo ETH_%s_FIFO_Instance;" $inst_num] puts $file_handle [format "XDmaCentral ETH_%s_DMA_Instance;" $inst_num] puts $file_handle "" puts $file_handle "// Buffers for ETH $inst_num" puts $file_handle [format "unsigned int recvBuffer_eth_%s\[XILNET_ETH_%s_NUM_RECV_BUF*((XILNET_ETH_%s_BUF_SIZE+3)/4)\];" $inst_num $inst_num $inst_num] puts $file_handle [format "unsigned int sendBuffer_eth_%s\[(XILNET_ETH_%s_BUF_SIZE+3)/4\];" $inst_num $inst_num] puts $file_handle [format "struct xilsock_socket xilsock_sockets_eth_%s\[NO_OF_XILSOCKS\];" $inst_num] puts $file_handle [format "struct xilnet_udp_conn xilnet_udp_conns_eth_%s\[XILNET_MAX_UDP_CONNS\];" $inst_num] puts $file_handle "" } proc print_c_file_footer {file_handle inf_type_list} { set inst_num 0 puts $file_handle "" puts $file_handle "/*************************** Ethernet Variables ******************************/" puts $file_handle "" puts $file_handle "" puts $file_handle "// Ethernet Device Structure" puts $file_handle "xilnet_eth_device eth_device\[XILNET_NUM_ETH_DEVICES\];" puts $file_handle "" puts $file_handle "" puts $file_handle "void xilnet_init_eth_device_struct(unsigned int eth_dev_num) \{" puts $file_handle "" puts $file_handle " switch( eth_dev_num ) \{" foreach inf_type $inf_type_list { puts $file_handle [format " case XILNET_ETH_%s:" $inst_num] switch $inf_type { "axi_fifo_mm_s" { puts $file_handle " eth_device\[eth_dev_num\].inf_type = XILNET_AXI_FIFO_INF;" puts $file_handle [format " eth_device\[eth_dev_num\].inf_id = XILNET_ETH_%s_INF_DEVICE_ID;" $inst_num] puts $file_handle [format " eth_device\[eth_dev_num\].inf_ref = Ð_%s_FIFO_Instance;" $inst_num] puts $file_handle " eth_device\[eth_dev_num\].inf_cfg_ref = 0;" puts $file_handle " eth_device\[eth_dev_num\].inf_dma_id = 0;" puts $file_handle " eth_device\[eth_dev_num\].inf_dma_ref = 0;" puts $file_handle " eth_device\[eth_dev_num\].inf_dma_cfg_ref = 0;" puts $file_handle " eth_device\[eth_dev_num\].dma_rx_ring_ref = 0;" puts $file_handle " eth_device\[eth_dev_num\].dma_tx_ring_ref = 0;" puts $file_handle " eth_device\[eth_dev_num\].dma_rx_bd_ref = 0;" puts $file_handle " eth_device\[eth_dev_num\].dma_tx_bd_ref = 0;" puts $file_handle " eth_device\[eth_dev_num\].dma_rx_bd_cnt = 0;" puts $file_handle " eth_device\[eth_dev_num\].dma_tx_bd_cnt = 0;" } "axi_dma" { puts $file_handle " eth_device\[eth_dev_num\].inf_type = XILNET_AXI_DMA_INF;" puts $file_handle [format " eth_device\[eth_dev_num\].inf_id = XILNET_ETH_%s_INF_DEVICE_ID;" $inst_num] puts $file_handle [format " eth_device\[eth_dev_num\].inf_ref = Ð_%s_DMA_Instance;" $inst_num] puts $file_handle " eth_device\[eth_dev_num\].inf_cfg_ref = 0;" puts $file_handle " eth_device\[eth_dev_num\].inf_dma_id = 0;" puts $file_handle " eth_device\[eth_dev_num\].inf_dma_ref = 0;" puts $file_handle " eth_device\[eth_dev_num\].inf_dma_cfg_ref = 0;" puts $file_handle " eth_device\[eth_dev_num\].dma_rx_ring_ref = 0;" puts $file_handle " eth_device\[eth_dev_num\].dma_tx_ring_ref = 0;" puts $file_handle [format " eth_device\[eth_dev_num\].dma_rx_bd_ref = Ð_%s_RX_BD_space;" $inst_num] puts $file_handle [format " eth_device\[eth_dev_num\].dma_tx_bd_ref = Ð_%s_TX_BD_space;" $inst_num] puts $file_handle [format " eth_device\[eth_dev_num\].dma_rx_bd_cnt = XILNET_ETH_%s_RXBD_CNT;" $inst_num] puts $file_handle [format " eth_device\[eth_dev_num\].dma_tx_bd_cnt = XILNET_ETH_%s_TXBD_CNT;" $inst_num] } "xps_ll_temac" { puts $file_handle " eth_device\[eth_dev_num\].inf_type = XILNET_TEMAC_INF;" puts $file_handle [format " eth_device\[eth_dev_num\].inf_id = XILNET_ETH_%s_INF_DEVICE_ID;" $inst_num] puts $file_handle [format " eth_device\[eth_dev_num\].inf_ref = Ð_%s_FIFO_Instance;" $inst_num] puts $file_handle " eth_device\[eth_dev_num\].inf_cfg_ref = 0;" puts $file_handle [format " eth_device\[eth_dev_num\].inf_dma_id = XILNET_ETH_%s_INF_DMA_DEVICE_ID;" $inst_num] puts $file_handle [format " eth_device\[eth_dev_num\].inf_dma_ref = Ð_%s_DMA_Instance;" $inst_num] puts $file_handle " eth_device\[eth_dev_num\].inf_dma_cfg_ref = 0;" puts $file_handle " eth_device\[eth_dev_num\].dma_rx_ring_ref = 0;" puts $file_handle " eth_device\[eth_dev_num\].dma_tx_ring_ref = 0;" puts $file_handle " eth_device\[eth_dev_num\].dma_rx_bd_ref = 0;" puts $file_handle " eth_device\[eth_dev_num\].dma_tx_bd_ref = 0;" puts $file_handle " eth_device\[eth_dev_num\].dma_rx_bd_cnt = 0;" puts $file_handle " eth_device\[eth_dev_num\].dma_tx_bd_cnt = 0;" } } puts $file_handle " eth_device\[eth_dev_num\].xilsock_status_flag = 0;" puts $file_handle " eth_device\[eth_dev_num\].sync_IP_octet = 255;" puts $file_handle " eth_device\[eth_dev_num\].is_xilsock_init = 0;" puts $file_handle [format " eth_device\[eth_dev_num\].xilsock_sockets = &xilsock_sockets_eth_%s;" $inst_num] puts $file_handle " eth_device\[eth_dev_num\].is_udp_init = 0;" puts $file_handle [format " eth_device\[eth_dev_num\].xilnet_udp_conns = &xilnet_udp_conns_eth_%s;" $inst_num] puts $file_handle [format " eth_device\[eth_dev_num\].buf_size = XILNET_ETH_%s_BUF_SIZE;" $inst_num] puts $file_handle [format " eth_device\[eth_dev_num\].num_recvbuf = XILNET_ETH_%s_NUM_RECV_BUF;" $inst_num] puts $file_handle [format " eth_device\[eth_dev_num\].recvbuf = (unsigned int *)&recvBuffer_eth_%s;" $inst_num] puts $file_handle [format " eth_device\[eth_dev_num\].sendbuf = (unsigned int *)&sendBuffer_eth_%s;" $inst_num] puts $file_handle " break;" incr inst_num } puts $file_handle " default:" puts $file_handle " xil_printf(\" **** ERROR: Trying to initialize Ethernet device %d. Only %d configured in the HW.\", (eth_dev_num+1), XILNET_NUM_ETH_DEVICES);" puts $file_handle " break;" puts $file_handle " \}" puts $file_handle "\}" puts $file_handle "" puts $file_handle "" puts $file_handle "/*****************************************************************************/" puts $file_handle "" }