source: edk_user_repository/WARP/sw_services/WARPxilnet_v3_04_a/data/WARPxilnet_v2_1_0.tcl

Last change on this file was 4361, checked in by welsh, 9 years ago

Update to WARPxilnet. Fixed issue with the location of the second DMA buffer. Placed all WARPxilnet defined memories into a single section so that they can be placed differently in the linker file.

File size: 47.0 KB
Line 
1###############################################################
2# Copyright (c) 2004 Xilinx, Inc. All Rights Reserved.
3# You may copy and modify these files for your own internal use solely with
4# Xilinx programmable logic devices and  Xilinx EDK system or create IP
5# modules solely for Xilinx programmable logic devices and Xilinx EDK system.
6# No rights are granted to distribute any files unless they are distributed in
7# Xilinx programmable logic devices.
8#
9# $Id: xilnet_v2_1_0.tcl,v 1.2.8.6 2005/11/15 23:41:10 salindac Exp $
10# ##############################################################
11#uses "xillib.tcl"
12
13# NOTE:
14#   In order to use the WARPxilnet library, the Ethernet instances within the
15# design need to have either "ETH_A" or "ETH_B" somewhere in the instance
16# name.  Due to some limitations with the Xilinx TCL generation capabilities
17# this script cannot pass instance names up to the MLD file to be displayed
18# as parameter names.  Therefore, this driver has two parameters:
19#   1) ETH_A_uses_xilnet
20#   2) ETH_B_uses_xilnet
21# that are used to control if a given Ethernet instance is controlled by the
22# WARPxilnet library.  If an instance is not controlled by this library, then
23# the library will not allocate buffers or control structures in order to
24# minimize code and data space of this library.
25#
26# This library will complain if:
27#   1) There are more than two Ethernet instances, but will complete and
28#      allocate buffers and control structures for all instances
29#   2) If none of the Ethernet instances contain either "ETH_A" or "ETH_B".
30#      In this case, the *_uses_xilnet parameters will be ignored and
31#      buffers and control structures will be allocated for all instances
32#   3) If the *_uses_xilnet parameter is set to '1' and the corresponding
33#      "ETH_*" doesn't exist, then the driver will error out, except in
34#      the situation of case 2) above.
35#
36
37
38set ethernet_ninstances        0
39set ethernet_use_axi           0
40set ethernet_use_axi_dma       0
41set ethernet_use_axi_fifo      0
42set ethernet_use_temac         0
43
44
45proc get_ethernet_periphs {mhs_handle} {
46    global ethernet_ninstances
47    global ethernet_use_axi
48    global ethernet_use_temac
49
50    set ipinst_list                [xget_hw_ipinst_handle $mhs_handle "*"]
51    set ethernet_ninstances        0
52    set ethernet_use_axi           0
53    set ethernet_use_temac         0
54    set ethernet_periphs_list      {}
55
56    foreach periph $ipinst_list {
57        set periph_type [xget_hw_value $periph]
58        set periph_name [xget_value $periph "name"]
59       
60#        puts "\# Peripheral: type = $periph_type  name = $periph_name  "       
61
62        if { $periph_type == "axi_ethernet"     } {
63       
64            incr ethernet_use_axi
65            incr ethernet_ninstances
66
67#            puts "\# Putting ($periph_name $periph) into list:  $ethernet_periphs_list "
68           
69            if { [regexp -nocase {eth_a} $periph_name] } { 
70                if { [llength $ethernet_periphs_list] > 0 } {
71                    set ethernet_periphs_list [linsert $ethernet_periphs_list 0 $periph]
72                } else {
73                    lappend ethernet_periphs_list      $periph
74                }
75            } else {           
76                if { [regexp -nocase {eth_b} $periph_name] } { 
77                    lappend ethernet_periphs_list      $periph
78                } else {
79                    lappend ethernet_periphs_list      $periph
80                }
81            }
82           
83#            puts "\# Ethernet $ethernet_ninstances: type = $periph_type  name = $periph_name  "       
84        }       
85       
86        if { $periph_type == "xps_ll_temac"     ||
87             $periph_type == "opb_ethernetlite" ||
88             $periph_type == "xps_ethernetlite" } {
89
90            incr ethernet_use_temac
91            incr ethernet_ninstances
92            lappend ethernet_periphs_list      $periph
93
94#            puts "\# Ethernet $ethernet_ninstances: type = $periph_type  name = $periph_name  "
95        }
96    }
97
98   
99#    puts "\# Final List ($ethernet_ninstances elements): $ethernet_periphs_list "
100   
101#    foreach eth_inst $ethernet_periphs_list {
102#        set periph_name [xget_value $eth_inst "name"]
103#
104#        puts "\# Ethernet name = $periph_name  "
105#    }
106   
107    return $ethernet_periphs_list
108}
109
110
111proc get_ethernet_interface_periph {mhs_handle inst_handle} {
112
113    set p2p_busifs_i [xget_hw_busifs_by_subproperty $inst_handle "BUS_TYPE" "INITIATOR"]
114     
115    # Add p2p periphs
116    foreach p2p_busif $p2p_busifs_i {
117
118        set bus_name          [string toupper [xget_hw_value $p2p_busif]]
119        set conn_busif_handle [xget_hw_connected_busifs_handle $mhs_handle $bus_name "TARGET"]
120
121        if { [string compare -nocase $conn_busif_handle ""] == 0} {
122            continue
123        } else {
124            # if there is a single match, we know if it is FIFO or DMA
125            # no need for further iterations
126            set conn_busif_name    [xget_hw_name          $conn_busif_handle]
127            set target_periph      [xget_hw_parent_handle $conn_busif_handle]
128
129            set target_type [xget_hw_value $target_periph]
130            set target_name [string toupper [xget_hw_name $target_periph]]
131
132            # puts "\# Bus Name    = $bus_name  Type = $conn_busif_name"
133            # puts "\# Target Name = $target_name  Type = $target_type"
134
135            return $target_periph
136        }
137    }
138   
139    return
140}
141
142
143proc get_periph_instances {mhs_handle inst_type} {
144    set ipinst_list                [xget_hw_ipinst_handle $mhs_handle "*"]
145    set periphs_list               {}
146
147    foreach periph $ipinst_list {
148        set periph_type [xget_hw_value $periph]
149        set periph_name [xget_value $periph "name"]
150
151        if { $periph_type == $inst_type } {
152       
153            lappend periphs_list      $periph
154
155#            puts "\# Instance: type = $periph_type  name = $periph_name  "       
156        }       
157    }
158
159    return $periphs_list
160}
161
162
163proc net_drc {lib_handle} {
164   
165    puts "XilNet DRC ..."
166}
167
168proc net_open_file {filename desc} {
169    set config_inc [open $filename w]
170    xprint_generated_header $config_inc $desc
171    return $config_inc
172}
173
174proc net_open_include_file {file_name} {
175    set filename [file join "./src/" $file_name]
176    return [net_open_file $filename "WARP/XilNet Configuration Parameters"]
177}
178
179proc net_open_config_file {file_name} {
180    set filename [file join "./src/" $file_name]
181    return [net_open_file $filename "WARP/XilNet MAC Configuration File"]
182}
183
184proc generate {lib_handle} {
185    global ethernet_ninstances
186
187    global ethernet_use_axi
188    global ethernet_use_axi_dma
189    global ethernet_use_axi_fifo
190   
191    set ethernet_use_axi_dma       0
192    set ethernet_use_axi_fifo      0
193   
194    set sw_proc_handle             [xget_processor]       
195    set hw_proc_handle             [xget_handle $sw_proc_handle "IPINST"]
196    set mhs_handle                 [xget_hw_parent_handle $hw_proc_handle]
197    set emac_inst_list             [get_ethernet_periphs $mhs_handle]
198   
199    # Error checking
200    if {$ethernet_ninstances == 0} {
201        error "Invalid configuration:  0 Ethernet instances found." "" "mdt_error"
202        return
203    }   
204   
205    # Initialize variables for loop
206    set eth_inst_num      0
207    set h_file            [net_open_include_file "xilnet_config.h"]
208    set c_file            [net_open_config_file  "xilnet_config.c"]
209
210    set eth_a_uses_drvr   [xget_value $lib_handle "PARAMETER" "ETH_A_uses_xilnet"]
211    set eth_b_uses_drvr   [xget_value $lib_handle "PARAMETER" "ETH_B_uses_xilnet"]
212    set fifo_buf_size     [xget_value $lib_handle "PARAMETER" "fifo_buf_size"]
213    set dma_buf_size      [xget_value $lib_handle "PARAMETER" "dma_buf_size"]
214    set dma_rcvd_buf_cnt  [xget_value $lib_handle "PARAMETER" "dma_rcvd_buf_cnt"]   
215    set udp_conns         [xget_value $lib_handle "PARAMETER" "no_of_tcp_conns"]
216
217    set inf_type_list     {}
218    set ignore_list       {}
219   
220#    puts "\# --------------------------------------"
221#    puts "\# Num Ethernet instances = $ethernet_ninstances  "
222
223    # Check Ethernet instances and instance names
224    #   1) There are more than two Ethernet instances, but will complete and
225    #      allocate buffers and control structures for all instances
226    #   2) If none of the Ethernet instances contain either "ETH_A" or "ETH_B".
227    #      In this case, the *_uses_xilnet parameters will be ignored and
228    #      buffers and control structures will be allocated for all instances
229    #   3) If the *_uses_xilnet parameter is set to '1' and the corresponding
230    #      "ETH_*" doesn't exist, then the driver will error out, except in
231    #      the situation of case 2) above.
232    #
233    if {$ethernet_ninstances > 2} {
234        puts "\# --------------------------------------"
235        puts "\# WARPxilnet WARNING:"
236        puts "\#   More than 2 Ethernet instances."
237        puts "\#   Ignoring ETH_*_uses_xilnet parameters."
238        puts "\# --------------------------------------"
239    } else {
240
241        set eth_name_matches  0
242        set eth_a_exists      0
243        set eth_b_exists      0
244        foreach inst $emac_inst_list {
245            set inst_name [string toupper [xget_hw_name $inst]]
246            if { [regexp -nocase {eth_a} $inst_name] } { 
247                incr eth_name_matches
248                incr eth_a_exists
249            }
250            if { [regexp -nocase {eth_b} $inst_name] } { 
251                incr eth_name_matches
252                incr eth_b_exists
253            }
254        }
255       
256        if { $eth_name_matches == 0 } {
257            puts "\# --------------------------------------"
258            puts "\# WARPxilnet WARNING:"
259            puts "\#   No Ethernet instances contain either \"ETH_A\" or \"ETH_B\"."
260            puts "\#   Ignoring ETH_*_uses_xilnet parameters."
261            puts "\# --------------------------------------"
262        } else {
263            if { $eth_a_uses_drvr == 1 && $eth_a_exists == 0 } {
264                error "Invalid configuration:  ETH_A does not exist but required by library." "" "mdt_error"
265                return           
266            }
267            if { $eth_b_uses_drvr == 1 && $eth_b_exists == 0 } {
268                error "Invalid configuration:  ETH_B does not exist but required by library." "" "mdt_error"
269                return                       
270            }       
271        }
272    }
273
274   
275    # For code size reasons, we need to determine if we need to use the AXI FIFO or the AXI DMA
276    # based on the interface type.  If we are not using AXI, then we can ignore this check.
277    #
278    if { $ethernet_use_axi != 0 } {
279       
280        foreach inst $emac_inst_list {
281            set inst_type [xget_hw_value $inst]
282            set inst_name [string toupper [xget_hw_name $inst]]
283            set ignore    0
284
285            # Check if we should ignore this Ethernet instance
286            #   NOTE: This implementation relies on the fact that all the checks above passed
287            #
288            if { [regexp -nocase {eth_a} $inst_name] && $eth_a_uses_drvr == 0 } { incr ignore }
289            if { [regexp -nocase {eth_b} $inst_name] && $eth_b_uses_drvr == 0 } { incr ignore }
290
291            # If we are not ignoring this interface, then increment the global variables
292            #
293            if { $ignore == 0 } {
294
295                # Determine the interface attached to the axi_ethernet
296                set inf_inst [get_ethernet_interface_periph $mhs_handle $inst]
297
298                if { [llength $inf_inst] != 0 } {
299                    set inf_inst_type [xget_hw_value $inf_inst]
300
301                    switch $inf_inst_type {
302                        "axi_fifo_mm_s" {
303                            incr ethernet_use_axi_fifo
304                        }
305                   
306                        "axi_dma" {
307                            incr ethernet_use_axi_dma
308                        }
309                    }
310                }
311            }
312        }
313    }
314   
315
316    # Process the instances and print the config header and c files
317    print_h_file_header $h_file $udp_conns
318    print_c_file_header $c_file
319     
320    foreach inst $emac_inst_list {
321        set inst_type [xget_hw_value $inst]
322        set inst_name [string toupper [xget_hw_name $inst]]
323        set ignore    0
324
325        # Check if we should ignore this Ethernet instance
326        #   NOTE: This implementation relies on the fact that all the checks above passed
327        #
328        if { [regexp -nocase {eth_a} $inst_name] && $eth_a_uses_drvr == 0 } { incr ignore }
329        if { [regexp -nocase {eth_b} $inst_name] && $eth_b_uses_drvr == 0 } { incr ignore }
330       
331
332#        puts "\# Name   = $inst_name  "
333#        puts "\# Type   = $inst_type  "
334#        puts "\# Ignore = $ignore  "
335
336        # Print out header file delimiter
337        puts $h_file ""
338        puts $h_file "/************************* Ethernet $eth_inst_num Definitions ****************************/"
339        puts $h_file ""
340
341        # Print out c file delimiter
342        puts $c_file ""
343        puts $c_file "/************************* Ethernet $eth_inst_num Definitions ****************************/"
344        puts $c_file ""       
345       
346        if { [string compare -nocase $inst_type "opb_ethernetlite"] == 0 ||
347             [string compare -nocase $inst_type "xps_ethernetlite"] == 0} {
348
349            error "TBD:  ethernetlite not yet supported.  Please change HW design for $inst_name." "" "mdt_error"
350            return
351
352        } elseif { [string compare -nocase $inst_type "xps_ll_temac"] == 0} {
353       
354            # Determine the interface attached to the temac
355            set inf_inst          [get_ethernet_interface_periph $mhs_handle $inst]
356
357            if { [llength $inf_inst] != 0 } {
358                set inf_inst_type [xget_hw_value $inf_inst]
359                set inf_inst_name [string toupper [xget_hw_name $inf_inst]]
360               
361           } else {
362                error "Unable to find interface for $inst_name. Some common causes are
363                       1. The interface of the TEMAC is left unconnected.
364                       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"
365            }
366
367            set inf_dma_inst          [get_periph_instances $mhs_handle "xps_central_dma"]
368
369            if { [llength $inf_dma_inst] != 0 } {
370                set inf_dma_inst_type [xget_hw_value $inf_dma_inst]
371                set inf_dma_inst_name [string toupper [xget_hw_name $inf_dma_inst]]
372               
373                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 $ignore
374                print_c_file_temac $c_file $eth_inst_num $ignore
375
376            } else {
377                error "Unable to find the central dma interface for $inst_name. Some common causes are
378                       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"
379            }
380
381            # Append one entry for TEMAC           
382            lappend inf_type_list $inst_type 
383            lappend ignore_list   $ignore
384
385        } elseif { [string compare -nocase $inst_type "axi_ethernet"] == 0} {
386
387            # Determine the interface attached to the axi_ethernet           
388            set inf_inst [get_ethernet_interface_periph $mhs_handle $inst]
389
390            if { [llength $inf_inst] != 0 } {
391                set inf_inst_type [xget_hw_value $inf_inst]
392                set inf_inst_name [string toupper [xget_hw_name $inf_inst]]
393
394                lappend inf_type_list $inf_inst_type
395                lappend ignore_list   $ignore
396               
397                switch $inf_inst_type {
398                    "axi_fifo_mm_s" {
399                        print_h_file_fifo $h_file $eth_inst_num $inst_name $inf_inst_name $dma_rcvd_buf_cnt $fifo_buf_size $ignore
400                        print_c_file_fifo $c_file $eth_inst_num $ignore
401                    }
402               
403                    "axi_dma" {
404                        print_h_file_dma $h_file $eth_inst_num $inst_name $inf_inst_name $dma_rcvd_buf_cnt $dma_buf_size $ignore
405                        print_c_file_dma $c_file $eth_inst_num $ignore
406                    }
407
408                    "default" {
409                        error "Unable to handle AXI connections for target type $target_periph_type. Some common causes are
410                               1. The AXI4 Stream interface of the AXI Ethernet is left unconnected.
411                               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"
412                    }
413                }
414            } else {
415                if { [regexp -nocase {eth_a} $inst_name] && $eth_a_uses_drvr == 0 || [regexp -nocase {eth_b} $inst_name] && $eth_b_uses_drvr == 0 } {
416                        print_h_file_fifo $h_file $eth_inst_num $inst_name "error" $dma_rcvd_buf_cnt $fifo_buf_size $ignore
417                        print_c_file_fifo $c_file $eth_inst_num $ignore
418                } else { 
419                    error "Unable to find AXI interface for $inst_name. Some common causes are
420                           1. The AXI4 Stream interface of the AXI Ethernet is left unconnected.
421                           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"
422                }
423            }
424
425        } else {
426            error "$inst_name is not a TEMAC or ETHERNETLITE or AXI ETHERNET core. WARPXilNet can work only with such cores." "" "mdt_error"
427        }
428
429        # increment the instance number for the next iteration of the for loop
430        incr eth_inst_num
431    }
432
433    print_h_file_footer $h_file
434    print_c_file_footer $c_file $inf_type_list $ignore_list
435
436    close $h_file
437    close $c_file
438   
439}
440
441
442proc print_h_file_header {file_handle udp_conns} {
443    global ethernet_ninstances
444    global ethernet_use_axi
445    global ethernet_use_axi_dma
446    global ethernet_use_axi_fifo
447    global ethernet_use_temac
448
449#    puts "\# USE DMA   = $ethernet_use_axi_dma"
450#    puts "\# USE FIFO  = $ethernet_use_axi_fifo"
451
452    # Check that if we only have an AXI interface, that we are either using
453    # the DMA or the FIFO.  Otherwise, xilnet should be removed to save code
454    # space.
455    if { $ethernet_use_axi != 0 && $ethernet_use_temac == 0 } {
456        if { $ethernet_use_axi_fifo == 0 && $ethernet_use_axi_dma == 0 } {
457            puts "\# --------------------------------------"
458            puts "\# WARPxilnet WARNING:"
459            puts "\#   For a design only containing AXI Ethernet peripherals,"
460            puts "\#   not using either the AXI DMA or AXI FIFO interfaces."
461            puts "\#   To save code space, please remove WARPxilnet library."
462            puts "\# --------------------------------------"
463        }
464    }
465
466   
467    puts $file_handle "\#ifndef _XILNET_CONFIG_H" 
468    puts $file_handle "\#define _XILNET_CONFIG_H" 
469    puts $file_handle ""
470    puts $file_handle "\#ifdef __cplusplus" 
471    puts $file_handle "extern \"C\" \{" 
472    puts $file_handle "\#endif" 
473    puts $file_handle ""
474
475# Uncomment the next line and clean the project to enable debug output on the UART
476#
477#   puts $file_handle "\#define _DEBUG_"
478
479# Uncomment the next line and clean the project to enable performance monitoring on oscilloscope:
480#   - Ethernet receive  toggles GPIO 1 (see xilnet_eth.c)
481#   - Ethernet transmit toggles GPIO 2 (see xilnet_eth.c)
482#
483#   puts $file_handle "\#define _PERFORMANCE_MONITOR_"
484
485    puts $file_handle ""
486    puts $file_handle "/***************************** Include Files *********************************/"
487    puts $file_handle "\#include <xilnet_xilsock.h>"
488    puts $file_handle "\#include <xilnet_eth.h>"
489    puts $file_handle "\#include <xparameters.h>"
490    puts $file_handle ""
491
492    # Determine HW includes   
493    #
494    if { $ethernet_use_axi_dma != 0 } {
495        puts $file_handle "\#include <xaxidma.h>"
496    }
497    if { $ethernet_use_axi_fifo != 0 } {
498        puts $file_handle "\#include <xllfifo.h>"
499    }   
500    if { $ethernet_use_temac != 0 } {
501        puts $file_handle "\#include <xlltemac.h>"
502        puts $file_handle "\#include <xllfifo.h>"
503        puts $file_handle "\#include <xdmacentral.h>"
504        puts $file_handle "\#include <xdmacentral_l.h>"
505    }
506
507    puts $file_handle ""
508    puts $file_handle "/*************************** Constant Definitions ****************************/"
509    puts $file_handle ""
510    puts $file_handle "// Xilnet Global Defines"
511    puts $file_handle "\#define XILNET_NUM_ETH_DEVICES                   $ethernet_ninstances                             // Define the number of Ethernet devices"
512
513    if { $ethernet_use_axi_dma != 0 } {
514        puts $file_handle "\#define XILNET_BD_ALIGNMENT                      XAXIDMA_BD_MINIMUM_ALIGNMENT  // Buffer Descriptor alignment"
515        puts $file_handle "\#define XILNET_BUFFER_ALIGNMENT                  0x40                          // Buffer alignment (64 byte boundary)"
516    }
517
518    puts $file_handle ""
519    puts $file_handle "// Define UDP connections"
520    puts $file_handle "\#define XILNET_MAX_UDP_CONNS                     $udp_conns                             // maximum no of open udp conns"
521    puts $file_handle "\#define NO_OF_XILSOCKS                           XILNET_MAX_UDP_CONNS          // Number of sockets per Ethernet Device"
522    puts $file_handle ""
523    puts $file_handle "// Define Ethernet interface types"
524    puts $file_handle "\#define XILNET_AXI_DMA_INF                       1"
525    puts $file_handle "\#define XILNET_AXI_FIFO_INF                      2"
526    puts $file_handle "\#define XILNET_TEMAC_INF                         3"
527    puts $file_handle ""   
528    puts $file_handle "// Define which interfaces are used"
529
530    # Set defines for code inclusion in the WARPxilnet library
531    #
532    if { $ethernet_use_axi_dma != 0 } {
533        puts $file_handle "\#define XILNET_AXI_DMA_INF_USED"
534    }
535    if { $ethernet_use_axi_fifo != 0 } {
536        puts $file_handle "\#define XILNET_AXI_FIFO_INF_USED"
537    }
538    if { $ethernet_use_temac != 0 } {
539        puts $file_handle "\#define XILNET_TEMAC_INF_USED"
540    } 
541
542    puts $file_handle ""
543
544}
545
546
547proc print_h_file_fifo {file_handle inst_num inst_name inf_name num_rcv_buf buf_size ignore} {
548
549    puts $file_handle "// Ethernet device $inst_num"
550    puts $file_handle "\#define $inst_name                                XILNET_ETH_$inst_num                  // External name of Ethernet device"
551    puts $file_handle "\#define XILNET_ETH_$inst_num                             $inst_num                             // Internal name of Ethernet device"
552    puts $file_handle ""
553    # Only one receive buffer supported for FIFO mode
554    if { $ignore == 0 } {
555        puts $file_handle [format "\#define XILNET_ETH_%s_INF_DEVICE_ID               XPAR_%s_DEVICE_ID" $inst_num $inf_name]
556        puts $file_handle [format "\#define XILNET_ETH_%s_NUM_RECV_BUF                1" $inst_num]
557        puts $file_handle [format "\#define XILNET_ETH_%s_BUF_SIZE                    ((%s + 31) & 0xFFFFFFE0)      // Align parameter to a 32 byte boundary" $inst_num $buf_size]
558        puts $file_handle [format "\#define XILNET_ETH_%s_BUF_ALIGNMENT               4                             // Alignment of packet within the buffer" $inst_num]
559        puts $file_handle ""
560        puts $file_handle "// Variables for ETH $inst_num"
561        puts $file_handle [format "extern XLlFifo              ETH_%s_FIFO_Instance;" $inst_num]
562        puts $file_handle ""
563        puts $file_handle "// Buffers for ETH $inst_num"
564        puts $file_handle [format "extern unsigned int ETH_%s_recv_buffer\[XILNET_ETH_%s_NUM_RECV_BUF * (XILNET_ETH_%s_BUF_SIZE >> 2)\];" $inst_num $inst_num $inst_num]
565        puts $file_handle [format "extern unsigned int ETH_%s_send_buffer\[(XILNET_ETH_%s_BUF_SIZE >> 2)\];" $inst_num $inst_num]
566        puts $file_handle ""
567    } else {
568        puts $file_handle [format "\#define XILNET_ETH_%s_INF_DEVICE_ID               0" $inst_num]
569        puts $file_handle [format "\#define XILNET_ETH_%s_NUM_RECV_BUF                0" $inst_num]
570        puts $file_handle [format "\#define XILNET_ETH_%s_BUF_SIZE                    0" $inst_num $buf_size]   
571        puts $file_handle ""
572    }
573}
574
575
576proc print_h_file_dma {file_handle inst_num inst_name inf_name num_rcv_buf buf_size ignore} {
577
578    puts $file_handle "// Ethernet device $inst_num"
579    puts $file_handle "\#define $inst_name                                XILNET_ETH_$inst_num                  // External name of Ethernet device"
580    puts $file_handle "\#define XILNET_ETH_$inst_num                             $inst_num                             // Internal name of Ethernet device"
581    puts $file_handle ""
582   
583    if { $ignore == 0 } {
584        puts $file_handle [format "\#define XILNET_ETH_%s_INF_DEVICE_ID               XPAR_%s_DEVICE_ID" $inst_num $inf_name]
585        puts $file_handle [format "\#define XILNET_ETH_%s_NUM_RECV_BUF                %s" $inst_num $num_rcv_buf]
586        puts $file_handle [format "\#define XILNET_ETH_%s_BUF_SIZE                    ((%s + 31) & 0xFFFFFFE0)      // Align parameter to a 32 byte boundary" $inst_num $buf_size]
587        puts $file_handle [format "\#define XILNET_ETH_%s_BUF_ALIGNMENT               4                             // Alignment of packet within the buffer" $inst_num]
588
589        # NOTE:  For both Send and Receive, the number of buffer descriptors should equal the number of buffers
590        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]
591        puts $file_handle [format "\#define XILNET_ETH_%s_TXBD_CNT                    1                             // Number of TxBDs to use" $inst_num]
592
593        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]
594        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]
595        puts $file_handle ""
596        puts $file_handle "// Variables for ETH $inst_num"
597        puts $file_handle [format "extern XAxiDma              ETH_%s_DMA_Instance;" $inst_num]
598        puts $file_handle ""
599        puts $file_handle "// Aligned memory segments to be used for buffer descriptors"
600        puts $file_handle [format "extern char ETH_%s_RX_BD_space\[XILNET_ETH_%s_RXBD_SPACE_BYTES\];" $inst_num $inst_num]
601        puts $file_handle [format "extern char ETH_%s_TX_BD_space\[XILNET_ETH_%s_TXBD_SPACE_BYTES\];" $inst_num $inst_num]
602        puts $file_handle ""
603        puts $file_handle "// Buffers for ETH $inst_num"
604        puts $file_handle [format "extern unsigned int ETH_%s_recv_buffer\[XILNET_ETH_%s_NUM_RECV_BUF * (XILNET_ETH_%s_BUF_SIZE >> 2)\];" $inst_num $inst_num $inst_num]
605        puts $file_handle [format "extern unsigned int ETH_%s_send_buffer\[(XILNET_ETH_%s_BUF_SIZE >> 2)\];" $inst_num $inst_num]
606        puts $file_handle ""
607    } else {
608        puts $file_handle [format "\#define XILNET_ETH_%s_INF_DEVICE_ID               0" $inst_num]
609        puts $file_handle [format "\#define XILNET_ETH_%s_NUM_RECV_BUF                0" $inst_num]
610        puts $file_handle [format "\#define XILNET_ETH_%s_BUF_SIZE                    0" $inst_num]
611
612        # NOTE:  For both Send and Receive, the number of buffer descriptors should equal the number of buffers
613        puts $file_handle [format "\#define XILNET_ETH_%s_RXBD_CNT                    0                             // Number of RxBDs to use" $inst_num]
614        puts $file_handle [format "\#define XILNET_ETH_%s_TXBD_CNT                    0                             // Number of TxBDs to use" $inst_num]
615
616        puts $file_handle [format "\#define XILNET_ETH_%s_RXBD_SPACE_BYTES            0" $inst_num]
617        puts $file_handle [format "\#define XILNET_ETH_%s_TXBD_SPACE_BYTES            0" $inst_num]   
618        puts $file_handle ""
619    }
620}
621
622
623proc print_h_file_temac {file_handle inst_num inst_name inf_name inf_dma_name num_rcv_buf buf_size ignore} {
624
625    puts $file_handle "// Ethernet device $inst_num"
626    puts $file_handle "\#define $inst_name                         XILNET_ETH_$inst_num                  // External name of Ethernet device"
627    puts $file_handle "\#define XILNET_ETH_$inst_num                             $inst_num                             // Internal name of Ethernet device"
628    puts $file_handle ""
629    puts $file_handle [format "\#define XILNET_ETH_%s_INF_DEVICE_ID               XPAR_%s_DEVICE_ID" $inst_num $inf_name]
630    puts $file_handle [format "\#define XILNET_ETH_%s_INF_DMA_DEVICE_ID           XPAR_%s_DEVICE_ID" $inst_num $inf_dma_name]
631    # Only one receive buffer supported for FIFO mode
632    if { $ignore == 0 } {
633        puts $file_handle [format "\#define XILNET_ETH_%s_NUM_RECV_BUF                1" $inst_num]
634        puts $file_handle [format "\#define XILNET_ETH_%s_BUF_SIZE                    ((%s + 31) & 0xFFFFFFE0)      // Align parameter to a 32 byte boundary" $inst_num $buf_size]
635        puts $file_handle [format "\#define XILNET_ETH_%s_BUF_ALIGNMENT               4                             // Alignment of packet within the buffer" $inst_num]
636        puts $file_handle ""
637        puts $file_handle "// Variables for ETH $inst_num"
638        puts $file_handle [format "extern XLlFifo              ETH_%s_FIFO_Instance;" $inst_num]
639        puts $file_handle [format "extern XDmaCentral          ETH_%s_DMA_Instance;" $inst_num]
640        puts $file_handle [format "extern XDmaCentral_Config  *ETH_%s_DMA_CFG_ptr;" $inst_num]
641        puts $file_handle ""
642        puts $file_handle "// Buffers for ETH $inst_num"
643        puts $file_handle [format "extern unsigned int ETH_%s_recv_buffer\[XILNET_ETH_%s_NUM_RECV_BUF * (XILNET_ETH_%s_BUF_SIZE >> 2)\];" $inst_num $inst_num $inst_num]
644        puts $file_handle [format "extern unsigned int ETH_%s_send_buffer\[(XILNET_ETH_%s_BUF_SIZE >> 2)\];" $inst_num $inst_num]
645        puts $file_handle ""
646    } else {
647        puts $file_handle [format "\#define XILNET_ETH_%s_NUM_RECV_BUF                0" $inst_num]
648        puts $file_handle [format "\#define XILNET_ETH_%s_BUF_SIZE                    0" $inst_num]   
649        puts $file_handle ""
650    }
651}
652
653
654proc print_h_file_footer {file_handle} {
655
656    puts $file_handle ""
657    puts $file_handle "/*********************** Global Variable Definitions *************************/"
658    puts $file_handle ""
659    puts $file_handle "// Ethernet Device Structure"
660    puts $file_handle "extern xilnet_eth_device eth_device\[XILNET_NUM_ETH_DEVICES\];"
661    puts $file_handle ""
662    puts $file_handle "/*************************** Function Prototypes *****************************/"
663    puts $file_handle ""
664    puts $file_handle "void xilnet_init_eth_device_struct(unsigned int);"
665    puts $file_handle ""
666    puts $file_handle "\#endif" 
667    puts $file_handle ""
668    puts $file_handle "/*****************************************************************************/"
669    puts $file_handle ""
670
671}
672
673
674proc print_c_file_header {file_handle} {
675    global ethernet_ninstances
676   
677    puts $file_handle ""
678    puts $file_handle "/***************************** Include Files *********************************/"
679    puts $file_handle ""
680    puts $file_handle "\#include <string.h>"
681    puts $file_handle "\#include <xilnet_config.h>"
682    puts $file_handle ""
683   
684}
685
686
687proc print_c_file_fifo {file_handle inst_num ignore} {
688
689    if { $ignore == 0 } {
690        puts $file_handle ""
691        puts $file_handle "// Variables for ETH $inst_num"
692        puts $file_handle [format "XLlFifo                 ETH_%s_FIFO_Instance;" $inst_num]
693        puts $file_handle ""
694        puts $file_handle "// Buffers for ETH $inst_num"
695        puts $file_handle [format "unsigned int            ETH_%s_recv_buffer\[XILNET_ETH_%s_NUM_RECV_BUF * (XILNET_ETH_%s_BUF_SIZE >> 2)\] __attribute__ ((section (\".eth_data\")));" $inst_num $inst_num $inst_num]
696        puts $file_handle [format "unsigned int            ETH_%s_send_buffer\[(XILNET_ETH_%s_BUF_SIZE >> 2)\] __attribute__ ((section (\".eth_data\")));" $inst_num $inst_num]
697        puts $file_handle ""
698        puts $file_handle "// Socket structures for ETH $inst_num"
699        puts $file_handle [format "struct xilsock_socket   ETH_%s_xilsock_sockets\[NO_OF_XILSOCKS\];" $inst_num]
700        puts $file_handle [format "struct xilnet_udp_conn  ETH_%s_xilnet_udp_conns\[XILNET_MAX_UDP_CONNS\];" $inst_num]
701        puts $file_handle ""
702    } else {
703        puts $file_handle ""
704        puts $file_handle "// Variables for ETH $inst_num"
705        puts $file_handle "//   NONE - WARPxilnet library configured to ignore ETH $inst_num"
706        puts $file_handle ""
707        puts $file_handle "// Buffers for ETH $inst_num"
708        puts $file_handle "//   NONE - WARPxilnet library configured to ignore ETH $inst_num"
709        puts $file_handle ""
710    }
711}
712
713
714proc print_c_file_dma {file_handle inst_num ignore} {
715
716    if { $ignore == 0 } {
717        puts $file_handle ""
718        puts $file_handle "// Variables for ETH $inst_num"
719        puts $file_handle [format "XAxiDma                 ETH_%s_DMA_Instance;" $inst_num]
720        puts $file_handle ""
721        puts $file_handle "// Aligned memory segments to be used for buffer descriptors"
722        puts $file_handle [format "char                    ETH_%s_RX_BD_space\[XILNET_ETH_%s_RXBD_SPACE_BYTES\] __attribute__ ((aligned(XILNET_BD_ALIGNMENT))) __attribute__ ((section (\".eth_data\")));" $inst_num $inst_num]
723        puts $file_handle [format "char                    ETH_%s_TX_BD_space\[XILNET_ETH_%s_TXBD_SPACE_BYTES\] __attribute__ ((aligned(XILNET_BD_ALIGNMENT))) __attribute__ ((section (\".eth_data\")));" $inst_num $inst_num]
724        puts $file_handle ""
725        puts $file_handle "// Buffers for ETH $inst_num"
726        puts $file_handle [format "unsigned int            ETH_%s_recv_buffer\[XILNET_ETH_%s_NUM_RECV_BUF * (XILNET_ETH_%s_BUF_SIZE >> 2)\] __attribute__ ((aligned(XILNET_BUFFER_ALIGNMENT))) __attribute__ ((section (\".eth_data\")));" $inst_num $inst_num $inst_num]
727        puts $file_handle [format "unsigned int            ETH_%s_send_buffer\[(XILNET_ETH_%s_BUF_SIZE >> 2)\] __attribute__ ((aligned(XILNET_BUFFER_ALIGNMENT))) __attribute__ ((section (\".eth_data\")));" $inst_num $inst_num]
728        puts $file_handle ""
729        puts $file_handle "// Socket structures for ETH $inst_num"
730        puts $file_handle [format "struct xilsock_socket   ETH_%s_xilsock_sockets\[NO_OF_XILSOCKS\];" $inst_num]
731        puts $file_handle [format "struct xilnet_udp_conn  ETH_%s_xilnet_udp_conns\[XILNET_MAX_UDP_CONNS\];" $inst_num]
732        puts $file_handle ""
733    } else {
734        puts $file_handle ""
735        puts $file_handle "// Variables for ETH $inst_num"
736        puts $file_handle "//   NONE - WARPxilnet library configured to ignore ETH $inst_num"
737        puts $file_handle ""
738        puts $file_handle "// Buffers for ETH $inst_num"
739        puts $file_handle "//   NONE - WARPxilnet library configured to ignore ETH $inst_num"
740        puts $file_handle ""
741    }
742}
743
744
745proc print_c_file_temac {file_handle inst_num ignore} {
746
747    if { $ignore == 0 } {
748        puts $file_handle ""
749        puts $file_handle "// Variables for ETH $inst_num"
750        puts $file_handle [format "XLlFifo                 ETH_%s_FIFO_Instance;" $inst_num]
751        puts $file_handle [format "XDmaCentral             ETH_%s_DMA_Instance;" $inst_num]
752        puts $file_handle ""
753        puts $file_handle "// Buffers for ETH $inst_num"
754        puts $file_handle [format "unsigned int            ETH_%s_recv_buffer\[XILNET_ETH_%s_NUM_RECV_BUF * (XILNET_ETH_%s_BUF_SIZE >> 2)\] __attribute__ ((section (\".eth_data\")));" $inst_num $inst_num $inst_num]
755        puts $file_handle [format "unsigned int            ETH_%s_send_buffer\[(XILNET_ETH_%s_BUF_SIZE >> 2)\] __attribute__ ((section (\".eth_data\")));" $inst_num $inst_num]
756        puts $file_handle ""
757        puts $file_handle "// Socket structures for ETH $inst_num"
758        puts $file_handle [format "struct xilsock_socket   ETH_%s_xilsock_sockets\[NO_OF_XILSOCKS\];" $inst_num]
759        puts $file_handle [format "struct xilnet_udp_conn  ETH_%s_xilnet_udp_conns\[XILNET_MAX_UDP_CONNS\];" $inst_num]
760        puts $file_handle ""
761    } else {
762        puts $file_handle ""
763        puts $file_handle "// Variables for ETH $inst_num"
764        puts $file_handle "//   NONE - WARPxilnet library configured to ignore ETH $inst_num"
765        puts $file_handle ""
766        puts $file_handle "// Buffers for ETH $inst_num"
767        puts $file_handle "//   NONE - WARPxilnet library configured to ignore ETH $inst_num"
768        puts $file_handle ""
769    }
770}
771
772
773proc print_c_file_footer {file_handle inf_type_list ignore_list} {
774
775    set inst_num      0
776
777    puts $file_handle ""
778    puts $file_handle "/*************************** Ethernet Variables ******************************/"
779    puts $file_handle ""
780    puts $file_handle ""
781    puts $file_handle "// Ethernet Device Structure"
782    puts $file_handle "xilnet_eth_device eth_device\[XILNET_NUM_ETH_DEVICES\];"
783    puts $file_handle ""
784    puts $file_handle ""
785    puts $file_handle "void xilnet_init_eth_device_struct(unsigned int eth_dev_num) \{"
786    puts $file_handle ""
787    puts $file_handle "    switch( eth_dev_num ) \{"
788
789    foreach inf_type $inf_type_list {
790        set ignore        [lindex $ignore_list $inst_num]
791
792        puts $file_handle [format "        case XILNET_ETH_%s:" $inst_num]
793        if { $ignore == 0 } {
794            puts $file_handle "            eth_device\[eth_dev_num\].uses_driver          = 1;"
795        } else {
796            puts $file_handle "            eth_device\[eth_dev_num\].uses_driver          = 0;"       
797        }
798       
799        switch $inf_type {
800            "axi_fifo_mm_s" {
801                puts $file_handle "            eth_device\[eth_dev_num\].inf_type             = XILNET_AXI_FIFO_INF;"
802                puts $file_handle [format "            eth_device\[eth_dev_num\].inf_id               = XILNET_ETH_%s_INF_DEVICE_ID;" $inst_num]
803                if { $ignore == 0 } {
804                    puts $file_handle [format "            eth_device\[eth_dev_num\].inf_ref              = &ETH_%s_FIFO_Instance;" $inst_num] 
805                } else {
806                    puts $file_handle "            eth_device\[eth_dev_num\].inf_ref              = 0;"
807                }
808                puts $file_handle "            eth_device\[eth_dev_num\].inf_cfg_ref          = 0;"
809                puts $file_handle "            eth_device\[eth_dev_num\].inf_dma_id           = 0;"
810                puts $file_handle "            eth_device\[eth_dev_num\].inf_dma_ref          = 0;"
811                puts $file_handle "            eth_device\[eth_dev_num\].inf_dma_cfg_ref      = 0;"
812                puts $file_handle "            eth_device\[eth_dev_num\].dma_rx_ring_ref      = 0;"
813                puts $file_handle "            eth_device\[eth_dev_num\].dma_tx_ring_ref      = 0;"
814                puts $file_handle "            eth_device\[eth_dev_num\].dma_rx_bd_ref        = 0;"
815                puts $file_handle "            eth_device\[eth_dev_num\].dma_tx_bd_ref        = 0;"
816                puts $file_handle "            eth_device\[eth_dev_num\].dma_rx_bd_cnt        = 0;"
817                puts $file_handle "            eth_device\[eth_dev_num\].dma_tx_bd_cnt        = 0;"
818            }
819            "axi_dma" {
820                puts $file_handle "            eth_device\[eth_dev_num\].inf_type             = XILNET_AXI_DMA_INF;"
821                puts $file_handle [format "            eth_device\[eth_dev_num\].inf_id               = XILNET_ETH_%s_INF_DEVICE_ID;" $inst_num]
822                if { $ignore == 0 } {
823                    puts $file_handle [format "            eth_device\[eth_dev_num\].inf_ref              = &ETH_%s_DMA_Instance;" $inst_num]
824                } else {
825                    puts $file_handle "            eth_device\[eth_dev_num\].inf_ref              = 0;"
826                }
827                puts $file_handle "            eth_device\[eth_dev_num\].inf_cfg_ref          = 0;"
828                puts $file_handle "            eth_device\[eth_dev_num\].inf_dma_id           = 0;"
829                puts $file_handle "            eth_device\[eth_dev_num\].inf_dma_ref          = 0;"
830                puts $file_handle "            eth_device\[eth_dev_num\].inf_dma_cfg_ref      = 0;"
831                puts $file_handle "            eth_device\[eth_dev_num\].dma_rx_ring_ref      = 0;"
832                puts $file_handle "            eth_device\[eth_dev_num\].dma_tx_ring_ref      = 0;"
833                if { $ignore == 0 } {
834                    puts $file_handle [format "            eth_device\[eth_dev_num\].dma_rx_bd_ref        = &ETH_%s_RX_BD_space;" $inst_num]
835                    puts $file_handle [format "            eth_device\[eth_dev_num\].dma_tx_bd_ref        = &ETH_%s_TX_BD_space;" $inst_num]
836                } else {
837                    puts $file_handle "            eth_device\[eth_dev_num\].dma_rx_bd_ref        = 0;"
838                    puts $file_handle "            eth_device\[eth_dev_num\].dma_tx_bd_ref        = 0;"
839                }
840                puts $file_handle [format "            eth_device\[eth_dev_num\].dma_rx_bd_cnt        = XILNET_ETH_%s_RXBD_CNT;" $inst_num]
841                puts $file_handle [format "            eth_device\[eth_dev_num\].dma_tx_bd_cnt        = XILNET_ETH_%s_TXBD_CNT;" $inst_num]
842            }
843            "xps_ll_temac" {
844                puts $file_handle "            eth_device\[eth_dev_num\].inf_type             = XILNET_TEMAC_INF;"
845                puts $file_handle [format "            eth_device\[eth_dev_num\].inf_id               = XILNET_ETH_%s_INF_DEVICE_ID;" $inst_num]
846                if { $ignore == 0 } {
847                    puts $file_handle [format "            eth_device\[eth_dev_num\].inf_ref              = &ETH_%s_FIFO_Instance;" $inst_num] 
848                } else {
849                    puts $file_handle "            eth_device\[eth_dev_num\].inf_ref              = 0;"
850                }
851                puts $file_handle "            eth_device\[eth_dev_num\].inf_cfg_ref          = 0;"
852                puts $file_handle [format "            eth_device\[eth_dev_num\].inf_dma_id           = XILNET_ETH_%s_INF_DMA_DEVICE_ID;" $inst_num]
853                if { $ignore == 0 } {
854                    puts $file_handle [format "            eth_device\[eth_dev_num\].inf_dma_ref          = &ETH_%s_DMA_Instance;" $inst_num] 
855                } else {
856                    puts $file_handle "            eth_device\[eth_dev_num\].inf_dma_ref          = 0;"
857                }
858                puts $file_handle "            eth_device\[eth_dev_num\].inf_dma_cfg_ref      = 0;"
859                puts $file_handle "            eth_device\[eth_dev_num\].dma_rx_ring_ref      = 0;"
860                puts $file_handle "            eth_device\[eth_dev_num\].dma_tx_ring_ref      = 0;"
861                puts $file_handle "            eth_device\[eth_dev_num\].dma_rx_bd_ref        = 0;"
862                puts $file_handle "            eth_device\[eth_dev_num\].dma_tx_bd_ref        = 0;"
863                puts $file_handle "            eth_device\[eth_dev_num\].dma_rx_bd_cnt        = 0;"
864                puts $file_handle "            eth_device\[eth_dev_num\].dma_tx_bd_cnt        = 0;"
865            }
866            "default" {
867                puts $file_handle "            eth_device\[eth_dev_num\].inf_type             = XILNET_AXI_FIFO_INF;"
868                puts $file_handle [format "            eth_device\[eth_dev_num\].inf_id               = XILNET_ETH_%s_INF_DEVICE_ID;" $inst_num]
869                if { $ignore == 0 } {
870                    puts $file_handle [format "            eth_device\[eth_dev_num\].inf_ref              = &ETH_%s_FIFO_Instance;" $inst_num] 
871                } else {
872                    puts $file_handle "            eth_device\[eth_dev_num\].inf_ref              = 0;"
873                }
874                puts $file_handle "            eth_device\[eth_dev_num\].inf_cfg_ref          = 0;"
875                puts $file_handle "            eth_device\[eth_dev_num\].inf_dma_id           = 0;"
876                puts $file_handle "            eth_device\[eth_dev_num\].inf_dma_ref          = 0;"
877                puts $file_handle "            eth_device\[eth_dev_num\].inf_dma_cfg_ref      = 0;"
878                puts $file_handle "            eth_device\[eth_dev_num\].dma_rx_ring_ref      = 0;"
879                puts $file_handle "            eth_device\[eth_dev_num\].dma_tx_ring_ref      = 0;"
880                puts $file_handle "            eth_device\[eth_dev_num\].dma_rx_bd_ref        = 0;"
881                puts $file_handle "            eth_device\[eth_dev_num\].dma_tx_bd_ref        = 0;"
882                puts $file_handle "            eth_device\[eth_dev_num\].dma_rx_bd_cnt        = 0;"
883                puts $file_handle "            eth_device\[eth_dev_num\].dma_tx_bd_cnt        = 0;"
884            }
885        }
886
887        puts $file_handle "            eth_device\[eth_dev_num\].xilsock_status_flag  = 0;"
888        puts $file_handle "            eth_device\[eth_dev_num\].sync_IP_octet        = 255;"
889        puts $file_handle "            eth_device\[eth_dev_num\].is_xilsock_init      = 0;"
890        if { $ignore == 0 } {
891            puts $file_handle [format "            eth_device\[eth_dev_num\].xilsock_sockets      = &ETH_%s_xilsock_sockets;" $inst_num]
892            puts $file_handle "            eth_device\[eth_dev_num\].is_udp_init          = 0;"
893            puts $file_handle [format "            eth_device\[eth_dev_num\].xilnet_udp_conns     = &ETH_%s_xilnet_udp_conns;" $inst_num]
894            puts $file_handle [format "            eth_device\[eth_dev_num\].buf_size             = XILNET_ETH_%s_BUF_SIZE;" $inst_num]
895            puts $file_handle [format "            eth_device\[eth_dev_num\].num_recvbuf          = XILNET_ETH_%s_NUM_RECV_BUF;" $inst_num]
896            puts $file_handle [format "            eth_device\[eth_dev_num\].recvbuf              = (unsigned int *)((u32)(&ETH_%s_recv_buffer) + XILNET_ETH_%s_BUF_ALIGNMENT);" $inst_num $inst_num]
897            puts $file_handle [format "            eth_device\[eth_dev_num\].sendbuf              = (unsigned int *)((u32)(&ETH_%s_send_buffer) + XILNET_ETH_%s_BUF_ALIGNMENT);" $inst_num $inst_num]
898        } else {
899            puts $file_handle "            eth_device\[eth_dev_num\].xilsock_sockets      = 0;"
900            puts $file_handle "            eth_device\[eth_dev_num\].is_udp_init          = 0;"
901            puts $file_handle "            eth_device\[eth_dev_num\].xilnet_udp_conns     = 0;"
902            puts $file_handle [format "            eth_device\[eth_dev_num\].buf_size             = XILNET_ETH_%s_BUF_SIZE;" $inst_num]
903            puts $file_handle [format "            eth_device\[eth_dev_num\].num_recvbuf          = XILNET_ETH_%s_NUM_RECV_BUF;" $inst_num]
904            puts $file_handle "            eth_device\[eth_dev_num\].recvbuf              = 0;"
905            puts $file_handle "            eth_device\[eth_dev_num\].sendbuf              = 0;"
906        }
907        puts $file_handle "            break;"
908
909        incr inst_num
910    }
911   
912    puts $file_handle "        default:"
913    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);"
914    puts $file_handle "     break;"
915    puts $file_handle "    \}"
916    puts $file_handle "\}"
917    puts $file_handle ""
918    puts $file_handle ""
919    puts $file_handle "/*****************************************************************************/"
920    puts $file_handle ""
921
922}
923
Note: See TracBrowser for help on using the repository browser.