2014-06-24 16:45:01 +05:30
|
|
|
###############################################################################
|
|
|
|
#
|
|
|
|
# Copyright (C) 2010 - 2014 Xilinx, Inc. All rights reserved.
|
|
|
|
#
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
|
|
# in the Software without restriction, including without limitation the rights
|
|
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
|
|
# furnished to do so, subject to the following conditions:
|
|
|
|
#
|
|
|
|
# The above copyright notice and this permission notice shall be included in
|
|
|
|
# all copies or substantial portions of the Software.
|
|
|
|
#
|
|
|
|
# Use of the Software is limited solely to applications:
|
|
|
|
# (a) running on a Xilinx device, or
|
|
|
|
# (b) that interact with a Xilinx device through a bus or interconnect.
|
|
|
|
#
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
# XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
|
|
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
|
|
|
# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
# SOFTWARE.
|
|
|
|
#
|
|
|
|
# Except as contained in this notice, the name of the Xilinx shall not be used
|
|
|
|
# in advertising or otherwise to promote the sale, use or other dealings in
|
|
|
|
# this Software without prior written authorization from Xilinx.
|
|
|
|
#
|
|
|
|
# MODIFICATION HISTORY:
|
|
|
|
#
|
|
|
|
# 05/12/10 asa First Release based on the LL TEMAC driver tcl
|
|
|
|
# 01/07/13 srt Added C_PHYADDR configuration parameter to support SGMII mode
|
|
|
|
# 02/03/13 srt Added support for IPI designs (CR 698249)
|
|
|
|
# 02/14/13 srt Added support for Zynq (CR 681136)
|
|
|
|
# 04/24/13 srt Modified parameter *_SGMII_PHYADDR to *_PHYADDR, the config
|
2015-04-09 17:20:45 +05:30
|
|
|
# parameter C_PHYADDR applies to SGMII/1000BaseX modes of
|
2014-06-24 16:45:01 +05:30
|
|
|
# operation (CR 704195)
|
2015-04-09 17:20:45 +05:30
|
|
|
# 08/06/13 srt Added support to handle multiple instances of AxiEthernet
|
2014-06-24 16:45:01 +05:30
|
|
|
# FIFO interface (CR 721141)
|
2014-08-06 19:09:27 +05:30
|
|
|
# 06/08/14 adk Modified the driver tcl to handle the open/close of files
|
|
|
|
# properly (CR 810643)
|
2014-10-29 15:58:12 +05:30
|
|
|
# 29/10/14 adk Added support for generating parameters for SGMII/1000BaseX modes
|
|
|
|
# When IP is configured with the PCS/PMA core (CR 828796)
|
2014-06-24 16:45:01 +05:30
|
|
|
#
|
|
|
|
###############################################################################
|
|
|
|
#uses "xillib.tcl"
|
|
|
|
|
|
|
|
set periph_config_params 0
|
|
|
|
set periph_ninstances 0
|
|
|
|
|
|
|
|
proc init_periph_config_struct { deviceid } {
|
|
|
|
global periph_config_params
|
|
|
|
set periph_config_params($deviceid) [list]
|
|
|
|
}
|
|
|
|
|
|
|
|
proc get_periph_config_struct_fields { deviceid } {
|
|
|
|
global periph_config_params
|
|
|
|
return $periph_config_params($deviceid)
|
|
|
|
}
|
|
|
|
proc add_field_to_periph_config_struct { deviceid fieldval } {
|
|
|
|
global periph_config_params
|
|
|
|
lappend periph_config_params($deviceid) $fieldval
|
|
|
|
}
|
|
|
|
proc display_avb_warning_if_applicable { periph } {
|
|
|
|
set avb_param_val ""
|
2014-12-23 10:56:56 +05:30
|
|
|
set avb_param_val [::hsi::utils::get_param_value $periph C_AVB]
|
|
|
|
if { $avb_param_val == 1 } {
|
2014-06-24 16:45:01 +05:30
|
|
|
puts "*******************************************************************************\r\n"
|
|
|
|
puts "WARNING: Audio Video Bridging (AVB) functionality is ENABLED in the AXI Ethernet core."
|
|
|
|
puts "The AXI Ethernet driver does not support AVB functionality."
|
|
|
|
puts "Please refer to the System Integration section of the Ethernet AVB User Guide"
|
|
|
|
puts "http://www.xilinx.com/support/documentation/ip_documentation/eth_avb_endpoint_ug492.pdf for information on AXI-Ethernet AVB Driver integration.\r\n"
|
|
|
|
puts "*******************************************************************************\r\n"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
# Given an Axi Ethernet peripheral, generate all the stuff required in
|
|
|
|
# the system include file.
|
|
|
|
#
|
|
|
|
# Given an Axi Ethernet which is an initiator on a
|
|
|
|
# Axi4 Stream interface, traverse the Axi4 Stream to the target side,
|
|
|
|
# figure out the peripheral type that is connected and
|
|
|
|
# put in appropriate defines. The peripheral on the other side
|
|
|
|
# can be AXI DMA or AXI Streaming FIFO.
|
|
|
|
#
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
proc xdefine_axiethernet_include_file {drv_handle file_name drv_string} {
|
|
|
|
global periph_ninstances
|
|
|
|
|
|
|
|
# Open include file
|
2014-12-23 10:56:56 +05:30
|
|
|
set file_handle [::hsi::utils::open_include_file $file_name]
|
2014-06-24 16:45:01 +05:30
|
|
|
|
|
|
|
# Get all peripherals connected to this driver
|
2014-12-23 10:56:56 +05:30
|
|
|
set periphs [::hsi::utils::get_common_driver_ips $drv_handle]
|
2014-06-24 16:45:01 +05:30
|
|
|
|
|
|
|
# ----------------------------------------------
|
|
|
|
# PART 1 - AXI Ethernet related parameters
|
|
|
|
# ----------------------------------------------
|
|
|
|
|
|
|
|
# Handle NUM_INSTANCES
|
|
|
|
set periph_ninstances 0
|
2015-04-09 17:20:45 +05:30
|
|
|
puts $file_handle "/* Definitions for driver [string toupper [common::get_property NAME $drv_handle]] */"
|
2014-06-24 16:45:01 +05:30
|
|
|
foreach periph $periphs {
|
2014-12-23 10:56:56 +05:30
|
|
|
init_periph_config_struct $periph_ninstances
|
|
|
|
incr periph_ninstances 1
|
2014-06-24 16:45:01 +05:30
|
|
|
}
|
2014-12-23 10:56:56 +05:30
|
|
|
puts $file_handle "\#define [::hsi::utils::get_driver_param_name $drv_string NUM_INSTANCES] $periph_ninstances"
|
2014-06-24 16:45:01 +05:30
|
|
|
|
2014-08-06 19:09:27 +05:30
|
|
|
close $file_handle
|
2014-06-24 16:45:01 +05:30
|
|
|
# Now print all useful parameters for all peripherals
|
|
|
|
set device_id 0
|
|
|
|
foreach periph $periphs {
|
2014-08-06 19:09:27 +05:30
|
|
|
#puts $file_handle ""
|
2014-12-23 10:56:56 +05:30
|
|
|
|
2014-06-24 16:45:01 +05:30
|
|
|
xdefine_include_file $drv_handle "xparameters.h" "XAxiEthernet" "NUM_INSTANCES" "DEVICE_ID" "C_BASEADDR" "C_HIGHADDR" "C_TYPE" "C_TXCSUM" "C_RXCSUM" "C_PHY_TYPE" "C_TXVLAN_TRAN" "C_RXVLAN_TRAN" "C_TXVLAN_TAG" "C_RXVLAN_TAG" "C_TXVLAN_STRP" "C_RXVLAN_STRP" "C_MCAST_EXTEND" "C_STATS" "C_AVB" "C_PHYADDR"
|
2014-12-23 10:56:56 +05:30
|
|
|
|
|
|
|
set file_handle [::hsi::utils::open_include_file $file_name]
|
2014-06-24 16:45:01 +05:30
|
|
|
# Create canonical definitions
|
2014-12-23 10:56:56 +05:30
|
|
|
xdefine_temac_params_canonical $file_handle $periph $device_id
|
|
|
|
|
2014-06-24 16:45:01 +05:30
|
|
|
# Interrupt ID (canonical)
|
2015-04-09 17:20:45 +05:30
|
|
|
xdefine_temac_interrupt $file_handle $periph $device_id
|
|
|
|
|
2014-10-29 15:58:12 +05:30
|
|
|
generate_sgmii_params $drv_handle "xparameters.h"
|
|
|
|
|
|
|
|
display_avb_warning_if_applicable $periph
|
2015-04-09 17:20:45 +05:30
|
|
|
|
2014-06-24 16:45:01 +05:30
|
|
|
incr device_id
|
|
|
|
puts $file_handle "\n"
|
2014-08-06 19:09:27 +05:30
|
|
|
close $file_handle
|
2015-04-09 17:20:45 +05:30
|
|
|
|
2014-06-24 16:45:01 +05:30
|
|
|
}
|
|
|
|
# -------------------------------------------------------
|
|
|
|
# PART 2 -- AXIFIFO/AXIDMA Connection related parameters
|
|
|
|
# -------------------------------------------------------
|
2014-12-23 10:56:56 +05:30
|
|
|
set file_handle [::hsi::utils::open_include_file $file_name]
|
2014-06-24 16:45:01 +05:30
|
|
|
xdefine_axi_target_params $periphs $file_handle
|
|
|
|
|
|
|
|
puts $file_handle "\n/******************************************************************/\n"
|
|
|
|
close $file_handle
|
|
|
|
}
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
# Main generate function - called by the tools
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
proc generate {drv_handle} {
|
|
|
|
|
|
|
|
xdefine_axiethernet_include_file $drv_handle "xparameters.h" "XAxiEthernet"
|
|
|
|
xdefine_axiethernet_config_file "xaxiethernet_g.c" "XAxiEthernet"
|
|
|
|
}
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------------
|
2015-04-09 17:20:45 +05:30
|
|
|
# Given each AXI4 Stream peripheral which is an initiator on a AXI4
|
2014-06-24 16:45:01 +05:30
|
|
|
# Stream interface, traverse to the target side, figure out the peripheral
|
|
|
|
# type that is connected and put in appropriate defines.
|
|
|
|
# The peripheral on the other side can be AXI DMA or AXi Streaming FIFO.
|
|
|
|
#
|
|
|
|
# NOTE: This procedure assumes that each AXI4 Stream on each peripheral
|
|
|
|
# corresponds to a unique device id in the system and populates
|
|
|
|
# the global device config params structure accordingly.
|
|
|
|
# ---------------------------------------------------------------------------
|
|
|
|
proc xdefine_axi_target_params {periphs file_handle} {
|
|
|
|
|
|
|
|
global periph_ninstances
|
|
|
|
|
|
|
|
#
|
|
|
|
# First dump some enumerations on AXI_TYPE
|
|
|
|
#
|
|
|
|
puts $file_handle "/* AxiEthernet TYPE Enumerations */"
|
|
|
|
puts $file_handle "#define XPAR_AXI_FIFO 1"
|
|
|
|
puts $file_handle "#define XPAR_AXI_DMA 2"
|
|
|
|
puts $file_handle ""
|
2015-04-09 17:20:45 +05:30
|
|
|
|
2014-06-24 16:45:01 +05:30
|
|
|
set device_id 0
|
|
|
|
set validentry 0
|
2015-04-09 17:20:45 +05:30
|
|
|
|
2014-06-24 16:45:01 +05:30
|
|
|
# Get unique list of p2p peripherals
|
|
|
|
foreach periph $periphs {
|
|
|
|
set p2p_periphs [list]
|
2015-04-09 17:20:45 +05:30
|
|
|
set periph_name [string toupper [common::get_property NAME $periph]]
|
2014-06-24 16:45:01 +05:30
|
|
|
# Get all point2point buses for periph
|
2015-04-09 17:20:45 +05:30
|
|
|
set p2p_busifs_i [hsi::get_intf_pins -of_objects $periph -filter "TYPE==INITIATOR"]
|
|
|
|
|
2014-06-24 16:45:01 +05:30
|
|
|
puts $file_handle ""
|
|
|
|
puts $file_handle "/* Canonical Axi parameters for $periph_name */"
|
|
|
|
|
|
|
|
# Add p2p periphs
|
|
|
|
foreach p2p_busif $p2p_busifs_i {
|
|
|
|
|
2015-04-09 17:20:45 +05:30
|
|
|
set busif_name [string toupper [common::get_property NAME $p2p_busif]]
|
2014-12-23 10:56:56 +05:30
|
|
|
set conn_busif_handle [::hsi::utils::get_connected_intf $periph $busif_name]
|
2014-06-24 16:45:01 +05:30
|
|
|
if { [string compare -nocase $conn_busif_handle ""] == 0} {
|
|
|
|
continue
|
|
|
|
} else {
|
2015-04-09 17:20:45 +05:30
|
|
|
# if there is a single match, we know if it is FIFO or DMA
|
|
|
|
# no need for further iterations
|
|
|
|
set conn_busif_name [common::get_property NAME $conn_busif_handle]
|
|
|
|
set target_periph [hsi::get_cells -of_objects $conn_busif_handle]
|
|
|
|
set target_periph_type [common::get_property IP_NAME $target_periph]
|
2014-06-24 16:45:01 +05:30
|
|
|
if { [string compare -nocase $target_periph_type "tri_mode_ethernet_mac"] == 0 } {
|
|
|
|
continue
|
|
|
|
}
|
2015-04-09 17:20:45 +05:30
|
|
|
set tartget_per_name [common::get_property NAME $target_periph]
|
|
|
|
set target_periph_name [string toupper [common::get_property NAME $target_periph]]
|
2014-06-24 16:45:01 +05:30
|
|
|
set canonical_tag [string toupper [format "AXIETHERNET_%d" $device_id ]]
|
|
|
|
set validentry 1
|
2015-04-09 17:20:45 +05:30
|
|
|
break
|
2014-06-24 16:45:01 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
if {$validentry == 1} {
|
|
|
|
if {$target_periph_type == "axi_fifo_mm_s"} {
|
|
|
|
#
|
|
|
|
# Handle the connection type (FIFO in this case)
|
|
|
|
#
|
|
|
|
set canonical_name [format "XPAR_%s_CONNECTED_TYPE" $canonical_tag]
|
|
|
|
puts $file_handle "#define $canonical_name XPAR_AXI_FIFO"
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
2015-04-09 17:20:45 +05:30
|
|
|
|
|
|
|
set axi_fifo_baseaddr [common::get_property CONFIG.C_BASEADDR $target_periph]
|
2014-06-24 16:45:01 +05:30
|
|
|
set canonical_name [format "XPAR_%s_CONNECTED_BASEADDR" $canonical_tag]
|
|
|
|
puts $file_handle [format "#define $canonical_name %s" $axi_fifo_baseaddr]
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
|
|
|
# FIFO Interrupts Handling
|
2015-04-09 17:20:45 +05:30
|
|
|
set int_pin [hsi::get_pins -of_objects [hsi::get_cells $tartget_per_name] INTERRUPT]
|
2014-12-23 10:56:56 +05:30
|
|
|
set intc_periph_type [::hsi::utils::get_connected_intr_cntrl $tartget_per_name $int_pin]
|
2015-04-09 17:20:45 +05:30
|
|
|
set intc_name [common::get_property IP_NAME $intc_periph_type]
|
2014-06-24 16:45:01 +05:30
|
|
|
if { $intc_name != [format "ps7_scugic"] } {
|
2015-04-09 17:20:45 +05:30
|
|
|
set int_id [::hsi::utils::get_port_intr_id [hsi::get_cells $tartget_per_name] $int_pin]
|
2014-06-24 16:45:01 +05:30
|
|
|
set canonical_name [format "XPAR_%s_CONNECTED_FIFO_INTR" $canonical_tag]
|
|
|
|
puts $file_handle [format "#define $canonical_name %d" $int_id]
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
|
|
|
puts $file_handle [format "#define XPAR_%s_CONNECTED_DMARX_INTR 0xFF" $canonical_tag]
|
|
|
|
puts $file_handle [format "#define XPAR_%s_CONNECTED_DMATX_INTR 0xFF" $canonical_tag]
|
|
|
|
add_field_to_periph_config_struct $device_id 0xFF
|
|
|
|
add_field_to_periph_config_struct $device_id 0xFF
|
|
|
|
} else {
|
|
|
|
set canonical_name [format "XPAR_%s_CONNECTED_FIFO_INTR" $canonical_tag]
|
2015-04-09 17:20:45 +05:30
|
|
|
set target_periph_name [string toupper [common::get_property NAME $target_periph_type]]
|
|
|
|
puts $file_handle [format "#define $canonical_name XPAR_FABRIC_%s_S2MM_INTROUT_INTR" $target_periph_name]
|
|
|
|
add_field_to_periph_config_struct $deviceid $canonical_name
|
2014-06-24 16:45:01 +05:30
|
|
|
puts $file_handle [format "#define XPAR_%s_CONNECTED_DMARX_INTR 0xFF" $canonical_tag]
|
|
|
|
puts $file_handle [format "#define XPAR_%s_CONNECTED_DMATX_INTR 0xFF" $canonical_tag]
|
|
|
|
add_field_to_periph_config_struct $device_id 0xFF
|
|
|
|
add_field_to_periph_config_struct $device_id 0xFF
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if {$target_periph_type == "axi_dma"} {
|
2015-04-09 17:20:45 +05:30
|
|
|
set axi_dma_baseaddr [common::get_property CONFIG.C_BASEADDR $target_periph]
|
2014-06-24 16:45:01 +05:30
|
|
|
# Handle base address and connection type
|
|
|
|
set canonical_name [format "XPAR_%s_CONNECTED_TYPE" $canonical_tag]
|
|
|
|
puts $file_handle "#define $canonical_name XPAR_AXI_DMA"
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
|
|
|
set canonical_name [format "XPAR_%s_CONNECTED_BASEADDR" $canonical_tag]
|
|
|
|
puts $file_handle [format "#define $canonical_name %s" $axi_dma_baseaddr]
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
2015-04-09 17:20:45 +05:30
|
|
|
|
2014-06-24 16:45:01 +05:30
|
|
|
puts $file_handle [format "#define XPAR_%s_CONNECTED_FIFO_INTR 0xFF" $canonical_tag]
|
|
|
|
add_field_to_periph_config_struct $device_id 0xFF
|
|
|
|
set dmarx_signal [format "s2mm_introut"]
|
|
|
|
set dmatx_signal [format "mm2s_introut"]
|
|
|
|
xdefine_dma_interrupts $file_handle $target_periph $device_id $canonical_tag $dmarx_signal $dmatx_signal
|
|
|
|
}
|
|
|
|
incr device_id
|
2015-04-09 17:20:45 +05:30
|
|
|
|
2014-06-24 16:45:01 +05:30
|
|
|
}
|
2015-04-09 17:20:45 +05:30
|
|
|
|
2014-06-24 16:45:01 +05:30
|
|
|
if {$validentry !=1} {
|
|
|
|
puts "*******************************************************************************\r\n"
|
|
|
|
puts "The target Peripheral(Axi DMA or AXI FIFO) is not connected properly to the AXI Ethernet core."
|
|
|
|
puts "*******************************************************************************\r\n"
|
2015-04-09 17:20:45 +05:30
|
|
|
}
|
2014-06-24 16:45:01 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
# This procedure creates XPARs that are canonical/normalized for the
|
|
|
|
# hardware design parameters. It also adds these to the Config table.
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
proc xdefine_temac_params_canonical {file_handle periph device_id} {
|
|
|
|
|
2015-04-09 17:20:45 +05:30
|
|
|
puts $file_handle "\n/* Canonical definitions for peripheral [string toupper [common::get_property NAME $periph]] */"
|
2014-06-24 16:45:01 +05:30
|
|
|
|
|
|
|
set canonical_tag [string toupper [format "XPAR_AXIETHERNET_%d" $device_id]]
|
|
|
|
|
|
|
|
# Handle device ID
|
|
|
|
set canonical_name [format "%s_DEVICE_ID" $canonical_tag]
|
|
|
|
puts $file_handle "\#define $canonical_name $device_id"
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
|
|
|
|
|
|
|
# Handle BASEADDR specially
|
|
|
|
set canonical_name [format "%s_BASEADDR" $canonical_tag]
|
2014-12-23 10:56:56 +05:30
|
|
|
puts $file_handle "\#define $canonical_name [::hsi::utils::get_param_value $periph C_BASEADDR]"
|
2014-06-24 16:45:01 +05:30
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
|
|
|
|
|
|
|
# Handle HIGHADDR specially
|
|
|
|
set canonical_name [format "%s_HIGHADDR" $canonical_tag]
|
2014-12-23 10:56:56 +05:30
|
|
|
puts $file_handle "\#define $canonical_name [::hsi::utils::get_param_value $periph C_HIGHADDR]"
|
2014-06-24 16:45:01 +05:30
|
|
|
|
|
|
|
set canonical_name [format "%s_TEMAC_TYPE" $canonical_tag]
|
2014-12-23 10:56:56 +05:30
|
|
|
set value [::hsi::utils::get_param_value $periph C_TYPE]
|
2014-06-24 16:45:01 +05:30
|
|
|
if {[llength $value] == 0} {
|
|
|
|
set value 0
|
|
|
|
}
|
|
|
|
puts $file_handle "\#define $canonical_name $value"
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
2014-12-23 10:56:56 +05:30
|
|
|
|
2014-06-24 16:45:01 +05:30
|
|
|
set canonical_name [format "%s_TXCSUM" $canonical_tag]
|
2014-12-23 10:56:56 +05:30
|
|
|
set value [::hsi::utils::get_param_value $periph C_TXCSUM]
|
2014-06-24 16:45:01 +05:30
|
|
|
if {[llength $value] == 0} {
|
2014-12-23 10:56:56 +05:30
|
|
|
set value 0
|
2014-06-24 16:45:01 +05:30
|
|
|
}
|
|
|
|
puts $file_handle "\#define $canonical_name $value"
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
|
|
|
|
|
|
|
set canonical_name [format "%s_RXCSUM" $canonical_tag]
|
2014-12-23 10:56:56 +05:30
|
|
|
set value [::hsi::utils::get_param_value $periph C_RXCSUM]
|
2014-06-24 16:45:01 +05:30
|
|
|
if {[llength $value] == 0} {
|
|
|
|
set value 0
|
|
|
|
}
|
|
|
|
puts $file_handle "\#define $canonical_name $value"
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
|
|
|
|
|
|
|
set canonical_name [format "%s_PHY_TYPE" $canonical_tag]
|
2014-12-23 10:56:56 +05:30
|
|
|
set value [::hsi::utils::get_param_value $periph C_PHY_TYPE]
|
2014-06-24 16:45:01 +05:30
|
|
|
if {[llength $value] == 0} {
|
2014-12-23 10:56:56 +05:30
|
|
|
set value 0
|
2014-06-24 16:45:01 +05:30
|
|
|
}
|
|
|
|
puts $file_handle "\#define $canonical_name $value"
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
|
|
|
|
|
|
|
set canonical_name [format "%s_TXVLAN_TRAN" $canonical_tag]
|
2014-12-23 10:56:56 +05:30
|
|
|
set value [::hsi::utils::get_param_value $periph C_TXVLAN_TRAN]
|
2014-06-24 16:45:01 +05:30
|
|
|
if {[llength $value] == 0} {
|
2014-12-23 10:56:56 +05:30
|
|
|
set value 0
|
2014-06-24 16:45:01 +05:30
|
|
|
}
|
|
|
|
puts $file_handle "\#define $canonical_name $value"
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
|
|
|
|
|
|
|
set canonical_name [format "%s_RXVLAN_TRAN" $canonical_tag]
|
2014-12-23 10:56:56 +05:30
|
|
|
set value [::hsi::utils::get_param_value $periph C_RXVLAN_TRAN]
|
2014-06-24 16:45:01 +05:30
|
|
|
if {[llength $value] == 0} {
|
2014-12-23 10:56:56 +05:30
|
|
|
set value 0
|
2014-06-24 16:45:01 +05:30
|
|
|
}
|
|
|
|
puts $file_handle "\#define $canonical_name $value"
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
|
|
|
|
|
|
|
set canonical_name [format "%s_TXVLAN_TAG" $canonical_tag]
|
2014-12-23 10:56:56 +05:30
|
|
|
set value [::hsi::utils::get_param_value $periph C_TXVLAN_TAG]
|
2014-06-24 16:45:01 +05:30
|
|
|
if {[llength $value] == 0} {
|
|
|
|
set value 0
|
|
|
|
}
|
|
|
|
puts $file_handle "\#define $canonical_name $value"
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
|
|
|
|
|
|
|
set canonical_name [format "%s_RXVLAN_TAG" $canonical_tag]
|
2014-12-23 10:56:56 +05:30
|
|
|
set value [::hsi::utils::get_param_value $periph C_RXVLAN_TAG]
|
2014-06-24 16:45:01 +05:30
|
|
|
if {[llength $value] == 0} {
|
2014-12-23 10:56:56 +05:30
|
|
|
set value 0
|
2014-06-24 16:45:01 +05:30
|
|
|
}
|
|
|
|
puts $file_handle "\#define $canonical_name $value"
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
|
|
|
|
|
|
|
set canonical_name [format "%s_TXVLAN_STRP" $canonical_tag]
|
2014-12-23 10:56:56 +05:30
|
|
|
set value [::hsi::utils::get_param_value $periph C_TXVLAN_STRP]
|
2014-06-24 16:45:01 +05:30
|
|
|
if {[llength $value] == 0} {
|
|
|
|
set value 0
|
|
|
|
}
|
|
|
|
puts $file_handle "\#define $canonical_name $value"
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
|
|
|
|
|
|
|
set canonical_name [format "%s_RXVLAN_STRP" $canonical_tag]
|
2014-12-23 10:56:56 +05:30
|
|
|
set value [::hsi::utils::get_param_value $periph C_RXVLAN_STRP]
|
2014-06-24 16:45:01 +05:30
|
|
|
if {[llength $value] == 0} {
|
2014-12-23 10:56:56 +05:30
|
|
|
set value 0
|
2014-06-24 16:45:01 +05:30
|
|
|
}
|
|
|
|
puts $file_handle "\#define $canonical_name $value"
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
|
|
|
|
|
|
|
set canonical_name [format "%s_MCAST_EXTEND" $canonical_tag]
|
2014-12-23 10:56:56 +05:30
|
|
|
set value [::hsi::utils::get_param_value $periph C_MCAST_EXTEND]
|
2014-06-24 16:45:01 +05:30
|
|
|
if {[llength $value] == 0} {
|
|
|
|
set value 0
|
|
|
|
}
|
|
|
|
puts $file_handle "\#define $canonical_name $value"
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
|
|
|
|
|
|
|
set canonical_name [format "%s_STATS" $canonical_tag]
|
2014-12-23 10:56:56 +05:30
|
|
|
set value [::hsi::utils::get_param_value $periph C_STATS]
|
2014-06-24 16:45:01 +05:30
|
|
|
if {[llength $value] == 0} {
|
2014-12-23 10:56:56 +05:30
|
|
|
set value 0
|
2014-06-24 16:45:01 +05:30
|
|
|
}
|
|
|
|
puts $file_handle "\#define $canonical_name $value"
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
|
|
|
|
|
|
|
set canonical_name [format "%s_AVB" $canonical_tag]
|
2014-12-23 10:56:56 +05:30
|
|
|
set value [::hsi::utils::get_param_value $periph C_AVB]
|
2014-06-24 16:45:01 +05:30
|
|
|
if {[llength $value] == 0} {
|
|
|
|
set value 0
|
|
|
|
}
|
|
|
|
puts $file_handle "\#define $canonical_name $value"
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
|
|
|
set canonical_name [format "%s_ENABLE_SGMII_OVER_LVDS" $canonical_tag]
|
2014-12-23 10:56:56 +05:30
|
|
|
set value [::hsi::utils::get_param_value $periph C_ENABLE_LVDS]
|
2014-06-24 16:45:01 +05:30
|
|
|
if {[llength $value] == 0} {
|
|
|
|
set value 0
|
|
|
|
}
|
|
|
|
puts $file_handle "\#define $canonical_name $value"
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
|
|
|
set canonical_name [format "%s_PHYADDR" $canonical_tag]
|
2014-12-23 10:56:56 +05:30
|
|
|
set phyaddr [::hsi::utils::get_param_value $periph C_PHYADDR]
|
|
|
|
set value [::hsi::utils::convert_binary_to_decimal $phyaddr]
|
2014-06-24 16:45:01 +05:30
|
|
|
if {[llength $value] == 0} {
|
|
|
|
set value 0
|
|
|
|
}
|
|
|
|
puts $file_handle "\#define $canonical_name $value"
|
2014-10-29 15:58:12 +05:30
|
|
|
|
2014-06-24 16:45:01 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
# Create configuration C file as required by Xilinx drivers
|
|
|
|
# Use the config field list technique
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
proc xdefine_axiethernet_config_file {file_name drv_string} {
|
|
|
|
global periph_ninstances
|
|
|
|
|
|
|
|
set filename [file join "src" $file_name]
|
|
|
|
file delete $filename
|
|
|
|
set config_file [open $filename w]
|
2014-12-23 10:56:56 +05:30
|
|
|
::hsi::utils::write_c_header $config_file "Driver configuration"
|
2014-06-24 16:45:01 +05:30
|
|
|
puts $config_file "\#include \"xparameters.h\""
|
|
|
|
puts $config_file "\#include \"[string tolower $drv_string].h\""
|
|
|
|
puts $config_file "\n/*"
|
|
|
|
puts $config_file "* The configuration table for devices"
|
|
|
|
puts $config_file "*/\n"
|
|
|
|
puts $config_file [format "%s_Config %s_ConfigTable\[\] =" $drv_string $drv_string]
|
|
|
|
puts $config_file "\{"
|
|
|
|
|
|
|
|
set start_comma ""
|
|
|
|
for {set i 0} {$i < $periph_ninstances} {incr i} {
|
|
|
|
|
|
|
|
puts $config_file [format "%s\t\{" $start_comma]
|
|
|
|
set comma ""
|
|
|
|
foreach field [get_periph_config_struct_fields $i] {
|
|
|
|
puts -nonewline $config_file [format "%s\t\t%s" $comma $field]
|
|
|
|
set comma ",\n"
|
|
|
|
}
|
|
|
|
|
|
|
|
puts -nonewline $config_file "\n\t\}"
|
|
|
|
set start_comma ",\n"
|
|
|
|
}
|
|
|
|
puts $config_file "\n\};\n"
|
|
|
|
close $config_file
|
|
|
|
}
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
# Find the two LocalLink DMA interrupts (RX and TX), and define
|
|
|
|
# the canonical constants in xparameters.h and the config table
|
|
|
|
# ------------------------------------------------------------------
|
|
|
|
proc xdefine_dma_interrupts {file_handle target_periph deviceid canonical_tag dmarx_signal dmatx_signal} {
|
|
|
|
|
2015-04-09 17:20:45 +05:30
|
|
|
set target_periph_name [string toupper [common::get_property NAME $target_periph]]
|
2014-06-24 16:45:01 +05:30
|
|
|
|
|
|
|
# First get the interrupt ports on this AXI peripheral
|
2015-04-09 17:20:45 +05:30
|
|
|
set interrupt_port [hsi::get_pins -of_objects $target_periph -filter {TYPE==INTERRUPT&&DIRECTION==O}]
|
2014-06-24 16:45:01 +05:30
|
|
|
if {$interrupt_port == ""} {
|
2015-04-09 17:20:45 +05:30
|
|
|
puts "Info: There are no AXIDMA Interrupt ports"
|
2014-06-24 16:45:01 +05:30
|
|
|
puts $file_handle [format "#define XPAR_%s_CONNECTED_DMARX_INTR 0xFF" $canonical_tag]
|
|
|
|
add_field_to_periph_config_struct $deviceid 0xFF
|
|
|
|
puts $file_handle [format "#define XPAR_%s_CONNECTED_DMATX_INTR 0xFF" $canonical_tag]
|
|
|
|
add_field_to_periph_config_struct $deviceid 0xFF
|
2015-04-09 17:20:45 +05:30
|
|
|
return
|
2014-06-24 16:45:01 +05:30
|
|
|
}
|
|
|
|
# For each interrupt port, find out the ordinal of the interrupt line
|
|
|
|
# as connected to an interrupt controller
|
|
|
|
set addentry 0
|
|
|
|
set dmarx "null"
|
|
|
|
set dmatx "null"
|
|
|
|
foreach intr_port $interrupt_port {
|
2015-04-09 17:20:45 +05:30
|
|
|
set interrupt_signal_name [common::get_property NAME $intr_port]
|
|
|
|
set intc_port [hsi::get_pins -of_objects $target_periph -filter {TYPE==INTERRUPT&&DIRECTION==O}]
|
|
|
|
|
2014-06-24 16:45:01 +05:30
|
|
|
# Make sure the interrupt signal was connected in this design. We assume
|
|
|
|
# at least one is. (could be a bug if user just wants polled mode)
|
|
|
|
if { $intc_port != "" } {
|
|
|
|
set found_intc ""
|
|
|
|
foreach intr_sink $intc_port {
|
2014-12-23 10:56:56 +05:30
|
|
|
set pname_type [::hsi::utils::get_connected_intr_cntrl $target_periph $intr_sink]
|
2014-06-24 16:45:01 +05:30
|
|
|
if {$pname_type != "chipscope_ila"} {
|
2015-04-09 17:20:45 +05:30
|
|
|
set special [common::get_property IP_TYPE $pname_type]
|
2014-12-23 10:56:56 +05:30
|
|
|
if {[string compare -nocase $special "INTERRUPT_CNTLR"] == 0} {
|
2015-04-09 17:20:45 +05:30
|
|
|
set found_intc $intr_sink
|
|
|
|
}
|
2014-06-24 16:45:01 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if {$found_intc == ""} {
|
|
|
|
puts "Info: DMA interrupt not connected to intc\n"
|
|
|
|
puts "Info: There are no AXIDMA Interrupt ports"
|
|
|
|
puts $file_handle [format "#define XPAR_%s_CONNECTED_DMARX_INTR 0xFF" $canonical_tag]
|
|
|
|
add_field_to_periph_config_struct $deviceid 0xFF
|
|
|
|
puts $file_handle [format "#define XPAR_%s_CONNECTED_DMATX_INTR 0xFF" $canonical_tag]
|
|
|
|
add_field_to_periph_config_struct $deviceid 0xFF
|
2015-04-09 17:20:45 +05:30
|
|
|
return
|
2014-06-24 16:45:01 +05:30
|
|
|
}
|
2015-04-09 17:20:45 +05:30
|
|
|
set intc_periph [hsi::get_cells -of_objects $found_intc]
|
|
|
|
set intc_periph_type [common::get_property IP_NAME $pname_type]
|
|
|
|
set intc_name [string toupper [common::get_property NAME $pname_type]]
|
2014-06-24 16:45:01 +05:30
|
|
|
} else {
|
|
|
|
puts "Info: $target_periph_name interrupt signal $interrupt_signal_name not connected"
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
# A bit of ugliness here. The only way to figure the ordinal is to
|
|
|
|
# iterate over the interrupt lines again and see if a particular signal
|
|
|
|
# matches the original interrupt signal we were tracking.
|
|
|
|
# If it does, put out the XPAR
|
|
|
|
if { $intc_periph_type != [format "ps7_scugic"] } {
|
2014-12-23 10:56:56 +05:30
|
|
|
set rx_int_id [::hsi::utils::get_port_intr_id $target_periph $dmarx_signal]
|
2014-06-24 16:45:01 +05:30
|
|
|
set canonical_name [format "XPAR_%s_CONNECTED_DMARX_INTR" $canonical_tag]
|
|
|
|
puts $file_handle [format "#define $canonical_name %d" $rx_int_id]
|
|
|
|
add_field_to_periph_config_struct $deviceid $canonical_name
|
2014-12-23 10:56:56 +05:30
|
|
|
set tx_int_id [::hsi::utils::get_port_intr_id $target_periph $dmatx_signal]
|
2014-06-24 16:45:01 +05:30
|
|
|
set canonical_name [format "XPAR_%s_CONNECTED_DMATX_INTR" $canonical_tag]
|
|
|
|
puts $file_handle [format "#define $canonical_name %d" $tx_int_id]
|
|
|
|
add_field_to_periph_config_struct $deviceid $canonical_name
|
2015-04-09 17:20:45 +05:30
|
|
|
} else {
|
|
|
|
set addentry 2
|
2014-06-24 16:45:01 +05:30
|
|
|
}
|
2015-04-09 17:20:45 +05:30
|
|
|
|
2014-06-24 16:45:01 +05:30
|
|
|
|
|
|
|
# Now add to the config table in the proper order (RX first, then TX
|
|
|
|
|
|
|
|
if { $intc_periph_type == [format "ps7_scugic"] } {
|
2015-04-09 17:20:45 +05:30
|
|
|
set canonical_name [format "XPAR_%s_CONNECTED_DMARX_INTR" $canonical_tag]
|
2014-06-24 16:45:01 +05:30
|
|
|
puts $file_handle [format "#define $canonical_name XPAR_FABRIC_%s_S2MM_INTROUT_INTR" $target_periph_name]
|
2015-04-09 17:20:45 +05:30
|
|
|
add_field_to_periph_config_struct $deviceid $canonical_name
|
2014-06-24 16:45:01 +05:30
|
|
|
set canonical_name [format "XPAR_%s_CONNECTED_DMATX_INTR" $canonical_tag]
|
|
|
|
puts $file_handle [format "#define $canonical_name XPAR_FABRIC_%s_MM2S_INTROUT_INTR" $target_periph_name]
|
2015-04-09 17:20:45 +05:30
|
|
|
add_field_to_periph_config_struct $deviceid $canonical_name
|
2014-06-24 16:45:01 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
if { $addentry == 1} {
|
|
|
|
# for some reason, only one DMA interrupt was connected (probably a bug),
|
|
|
|
# but fill in a dummy entry for the other (may be the wrong direction!)
|
|
|
|
puts "WARNING: only one SDMA interrupt line connected for $target_periph_name"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------------
|
|
|
|
# This procedure re-forms the AXI Ethernet interrupt ID XPAR constant and adds it to
|
|
|
|
# the driver config table. This Tcl needs to be careful of the order of the
|
|
|
|
# config table entries
|
|
|
|
# ------------------------------------------------------------------------------------
|
|
|
|
proc xdefine_temac_interrupt {file_handle periph device_id} {
|
|
|
|
|
|
|
|
#set mhs_handle [xget_hw_parent_handle $periph]
|
2015-04-09 17:20:45 +05:30
|
|
|
set periph_name [string toupper [common::get_property NAME $periph]]
|
2014-06-24 16:45:01 +05:30
|
|
|
|
|
|
|
# set up the canonical constant name
|
|
|
|
set canonical_name [format "XPAR_AXIETHERNET_%d_INTR" $device_id]
|
|
|
|
|
|
|
|
#
|
|
|
|
# In order to reform the XPAR for the interrupt ID, we need to hunt
|
|
|
|
# for the interrupt ID based on the interrupt signal name of the TEMAC
|
|
|
|
#
|
|
|
|
# First get the interrupt ports on this peripheral
|
2015-04-09 17:20:45 +05:30
|
|
|
set interrupt_port [hsi::get_pins -of_objects $periph -filter {TYPE==INTERRUPT&&DIRECTION==O}]
|
2014-06-24 16:45:01 +05:30
|
|
|
if {$interrupt_port == ""} {
|
2015-04-09 17:20:45 +05:30
|
|
|
puts "Info: There are no AXI Ethernet Interrupt ports"
|
|
|
|
# No interrupts were connected, so add dummy entry to the config structure
|
2014-06-24 16:45:01 +05:30
|
|
|
puts $file_handle [format "#define $canonical_name 0xFF"]
|
|
|
|
add_field_to_periph_config_struct $device_id 0xFF
|
|
|
|
}
|
2015-04-09 17:20:45 +05:30
|
|
|
|
2014-06-24 16:45:01 +05:30
|
|
|
# For each interrupt port, find out the ordinal of the interrupt line
|
|
|
|
# as connected to an interrupt controller
|
|
|
|
set addentry 0
|
2015-04-09 17:20:45 +05:30
|
|
|
set interrupt_signal_name [common::get_property NAME $interrupt_port]
|
2014-12-23 10:56:56 +05:30
|
|
|
#set interrupt_signal [xget_hw_value $interrupt_port]
|
2015-04-09 17:20:45 +05:30
|
|
|
set intc_prt [::hsi::utils::get_sink_pins [hsi::get_pins -of_objects [hsi::get_cells $periph] INTERRUPT]]
|
2014-06-24 16:45:01 +05:30
|
|
|
|
|
|
|
# Make sure the interrupt signal was connected in this design. We assume
|
|
|
|
# at least one is. (could be a bug if user just wants polled mode)
|
|
|
|
if { $intc_prt != "" } {
|
|
|
|
set found_intc ""
|
|
|
|
foreach intr_sink $intc_prt {
|
2015-04-09 17:20:45 +05:30
|
|
|
set phandle [hsi::get_cells -of_objects $intr_sink]
|
|
|
|
set pname_type [common::get_property NAME $phandle]
|
2014-06-24 16:45:01 +05:30
|
|
|
if {$pname_type != "chipscope_ila"} {
|
2015-04-09 17:20:45 +05:30
|
|
|
set special [common::get_property IP_TYPE [hsi::get_cells $pname_type]]
|
|
|
|
if {[string compare -nocase $special "INTERRUPT_CNTLR"] == 0} {
|
|
|
|
set found_intc $intr_sink
|
|
|
|
break
|
|
|
|
}
|
2014-06-24 16:45:01 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if {$found_intc == ""} {
|
|
|
|
puts "Info: Axi Ethernet interrupt not connected to intc\n"
|
|
|
|
# No interrupts were connected, so add dummy entry to the config structure
|
|
|
|
puts $file_handle [format "#define $canonical_name 0xFF"]
|
2015-04-09 17:20:45 +05:30
|
|
|
add_field_to_periph_config_struct $device_id 0xFF
|
|
|
|
return
|
2014-06-24 16:45:01 +05:30
|
|
|
}
|
|
|
|
|
2015-04-09 17:20:45 +05:30
|
|
|
set intc_periph [hsi::get_cells -of_objects $found_intc]
|
|
|
|
set intc_periph_type [common::get_property IP_NAME $intc_periph]
|
|
|
|
set intc_name [string toupper [common::get_property NAME $intc_periph]]
|
2014-06-24 16:45:01 +05:30
|
|
|
} else {
|
2015-04-09 17:20:45 +05:30
|
|
|
puts "Info: $periph_name interrupt signal $interrupt_signal_name not connected"
|
|
|
|
# No interrupts were connected, so add dummy entry to the config structure
|
2014-06-24 16:45:01 +05:30
|
|
|
puts $file_handle [format "#define $canonical_name 0xFF"]
|
|
|
|
add_field_to_periph_config_struct $device_id 0xFF
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
# A bit of ugliness here. The only way to figure the ordinal is to
|
|
|
|
# iterate over the interrupt lines again and see if a particular signal
|
|
|
|
# matches the original interrupt signal we were tracking.
|
|
|
|
|
|
|
|
if { $intc_periph_type != [format "ps7_scugic"] } {
|
2015-04-09 17:20:45 +05:30
|
|
|
set ethernet_int_signal_name [hsi::get_pins -of_objects $periph INTERRUPT]
|
2014-12-23 10:56:56 +05:30
|
|
|
set int_id [::hsi::utils::get_port_intr_id $periph $ethernet_int_signal_name]
|
2014-06-24 16:45:01 +05:30
|
|
|
puts $file_handle "\#define $canonical_name $int_id"
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
|
|
|
set addentry 1
|
|
|
|
} else {
|
|
|
|
puts $file_handle [format "#define $canonical_name XPAR_FABRIC_%s_INTERRUPT_INTR" $periph_name]
|
|
|
|
add_field_to_periph_config_struct $device_id $canonical_name
|
2015-04-09 17:20:45 +05:30
|
|
|
set addentry 1
|
2014-06-24 16:45:01 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
if { $addentry == 0 } {
|
|
|
|
# No interrupts were connected, so add dummy entry to the config structure
|
|
|
|
puts $file_handle [format "#define $canonical_name 0xFF"]
|
|
|
|
add_field_to_periph_config_struct $device_id 0xFF
|
|
|
|
}
|
|
|
|
}
|
2014-10-29 15:58:12 +05:30
|
|
|
|
|
|
|
proc generate_sgmii_params {drv_handle file_name} {
|
2014-12-23 10:56:56 +05:30
|
|
|
set file_handle [::hsi::utils::open_include_file $file_name]
|
2015-04-09 17:20:45 +05:30
|
|
|
set ips [hsi::get_cells "*"]
|
2014-10-29 15:58:12 +05:30
|
|
|
|
|
|
|
foreach ip $ips {
|
2015-04-09 17:20:45 +05:30
|
|
|
set periph [common::get_property IP_NAME $ip]
|
2014-10-29 15:58:12 +05:30
|
|
|
if { [string compare -nocase $periph "gig_ethernet_pcs_pma"] == 0} {
|
2015-04-09 17:20:45 +05:30
|
|
|
set PhyStandard [common::get_property CONFIG.Standard $ip]
|
2014-10-29 15:58:12 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ip $ips {
|
2015-04-09 17:20:45 +05:30
|
|
|
set periph [common::get_property IP_NAME $ip]
|
2014-10-29 15:58:12 +05:30
|
|
|
if { [string compare -nocase $periph "axi_ethernet_buffer"] == 0} {
|
|
|
|
set phya [is_gige_pcs_pma_ip_present $ip]
|
|
|
|
if { $phya == 0} {
|
|
|
|
close $file_handle
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
if { $PhyStandard == "1000BASEX" } {
|
|
|
|
puts $file_handle "/* Definitions related to PCS PMA PL IP*/"
|
|
|
|
puts $file_handle "\#define XPAR_GIGE_PCS_PMA_1000BASEX_CORE_PRESENT 1"
|
|
|
|
puts $file_handle "\#define XPAR_PCSPMA_1000BASEX_PHYADDR $phya"
|
|
|
|
puts $file_handle "\n/******************************************************************/\n"
|
|
|
|
} else {
|
|
|
|
puts $file_handle "/* Definitions related to PCS PMA PL IP*/"
|
|
|
|
puts $file_handle "\#define XPAR_GIGE_PCS_PMA_SGMII_CORE_PRESENT 1"
|
|
|
|
puts $file_handle "\#define XPAR_PCSPMA_SGMII_PHYADDR $phya"
|
|
|
|
puts $file_handle "\n/******************************************************************/\n"
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
close $file_handle
|
|
|
|
}
|
|
|
|
|
|
|
|
proc is_gige_pcs_pma_ip_present {slave} {
|
|
|
|
set port_value 0
|
|
|
|
set phy_addr 0
|
|
|
|
set ipconv 0
|
|
|
|
|
2015-04-09 17:20:45 +05:30
|
|
|
set ips [hsi::get_cells "*"]
|
|
|
|
set enetipinstance_name [common::get_property IP_NAME $slave]
|
2014-10-29 15:58:12 +05:30
|
|
|
|
|
|
|
foreach ip $ips {
|
2015-04-09 17:20:45 +05:30
|
|
|
set periph [common::get_property IP_NAME $ip]
|
2014-10-29 15:58:12 +05:30
|
|
|
if { [string compare -nocase $periph "gig_ethernet_pcs_pma"] == 0} {
|
2015-04-09 17:20:45 +05:30
|
|
|
set sgmii_param [common::get_property CONFIG.c_is_sgmii $ip]
|
|
|
|
set PhyStandarrd [common::get_property CONFIG.Standard $ip]
|
2014-10-29 15:58:12 +05:30
|
|
|
if {$sgmii_param == true || $PhyStandarrd == "1000BASEX"} {
|
|
|
|
set ipconv $ip
|
|
|
|
}
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if { $ipconv != 0 } {
|
2015-04-09 17:20:45 +05:30
|
|
|
set port_value [hsi::get_pins -of_objects [hsi::get_nets -of_objects [hsi::get_pins -of_objects $ipconv gmii_txd]]]
|
2014-10-29 15:58:12 +05:30
|
|
|
if { $port_value != 0 } {
|
|
|
|
if { [string compare -nocase $enetipinstance_name "axi_ethernet_buffer"] == 0} {
|
2014-12-23 10:56:56 +05:30
|
|
|
set phyaddr [::hsi::utils::get_param_value $ipconv C_PHYADDR]
|
|
|
|
set phy_addr [::hsi::utils::convert_binary_to_decimal $phyaddr]
|
2014-10-29 15:58:12 +05:30
|
|
|
if {[llength $phy_addr] == 0} {
|
|
|
|
set phy_addr 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $phy_addr
|
|
|
|
}
|