devcfg : added common namespace to all common tcl commands.
Signed-off-by: Nava kishore Manne <navam@xilinx.com>
This commit is contained in:
parent
50c32af632
commit
7377b860ac
2 changed files with 37 additions and 38 deletions
|
@ -3,7 +3,7 @@
|
|||
# Copyright (C) 2011 - 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
|
||||
# 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
|
||||
|
@ -20,7 +20,7 @@
|
|||
# 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
|
||||
# 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.
|
||||
#
|
||||
|
@ -56,26 +56,26 @@ proc xdefine_include_file_zynq {drv_handle file_name drv_string args} {
|
|||
set file_handle [::hsm::utils::open_include_file $file_name]
|
||||
|
||||
# Get all peripherals connected to this driver
|
||||
set periphs [::hsm::utils::get_common_driver_ips $drv_handle]
|
||||
set periphs [::hsm::utils::get_common_driver_ips $drv_handle]
|
||||
|
||||
# Handle special cases
|
||||
set arg "NUM_INSTANCES"
|
||||
set posn [lsearch -exact $args $arg]
|
||||
if {$posn > -1} {
|
||||
puts $file_handle "/* Definitions for driver [string toupper [get_property NAME $drv_handle]] */"
|
||||
puts $file_handle "/* Definitions for driver [string toupper [common::get_property NAME $drv_handle]] */"
|
||||
# Define NUM_INSTANCES
|
||||
puts $file_handle "#define [::hsm::utils::get_driver_param_name $drv_string $arg] [llength $periphs]"
|
||||
set args [lreplace $args $posn $posn]
|
||||
}
|
||||
# Check if it is a driver parameter
|
||||
|
||||
lappend newargs
|
||||
lappend newargs
|
||||
foreach arg $args {
|
||||
set value [get_property CONFIG.$arg $drv_handle]
|
||||
set value [common::get_property CONFIG.$arg $drv_handle]
|
||||
if {[llength $value] == 0} {
|
||||
lappend newargs $arg
|
||||
} else {
|
||||
puts $file_handle "#define [::hsm::utils::get_driver_param_name $drv_string $arg] [get_property CONFIG.$arg $drv_handle]"
|
||||
puts $file_handle "#define [::hsm::utils::get_driver_param_name $drv_string $arg] [common::get_property CONFIG.$arg $drv_handle]"
|
||||
}
|
||||
}
|
||||
set args $newargs
|
||||
|
@ -84,7 +84,7 @@ proc xdefine_include_file_zynq {drv_handle file_name drv_string args} {
|
|||
set device_id 0
|
||||
foreach periph $periphs {
|
||||
puts $file_handle ""
|
||||
puts $file_handle "/* Definitions for peripheral [string toupper [get_property NAME $periph]] */"
|
||||
puts $file_handle "/* Definitions for peripheral [string toupper [common::get_property NAME $periph]] */"
|
||||
foreach arg $args {
|
||||
if {[string compare -nocase "DEVICE_ID" $arg] == 0} {
|
||||
set value $device_id
|
||||
|
@ -105,16 +105,16 @@ proc xdefine_include_file_zynq {drv_handle file_name drv_string args} {
|
|||
}
|
||||
}
|
||||
puts $file_handle ""
|
||||
}
|
||||
}
|
||||
puts $file_handle "\n/******************************************************************/\n"
|
||||
close $file_handle
|
||||
}
|
||||
|
||||
proc xdefine_devcfg_config_file {drv_handle file_name drv_string args} {
|
||||
set filename [file join "src" $file_name]
|
||||
set filename [file join "src" $file_name]
|
||||
file delete $filename
|
||||
set config_file [open $filename w]
|
||||
::hsm::utils::write_c_header $config_file "Driver configuration"
|
||||
::hsm::utils::write_c_header $config_file "Driver configuration"
|
||||
puts $config_file "#include \"xparameters.h\""
|
||||
puts $config_file "#include \"xdevcfg.h\""
|
||||
puts $config_file "\n/*"
|
||||
|
@ -122,20 +122,20 @@ proc xdefine_devcfg_config_file {drv_handle file_name drv_string args} {
|
|||
puts $config_file "*/\n"
|
||||
puts $config_file [format "%s_Config %s_ConfigTable\[\] =" $drv_string $drv_string]
|
||||
puts $config_file "\{"
|
||||
set periphs [::hsm::utils::get_common_driver_ips $drv_handle]
|
||||
set periphs [::hsm::utils::get_common_driver_ips $drv_handle]
|
||||
set start_comma ""
|
||||
foreach periph $periphs {
|
||||
puts $config_file [format "%s\t\{" $start_comma]
|
||||
set comma ""
|
||||
foreach arg $args {
|
||||
# Check if this is a driver parameter or a peripheral parameter
|
||||
set value [get_property CONFIG.$arg $drv_handle]
|
||||
set value [common::get_property CONFIG.$arg $drv_handle]
|
||||
if {[llength $value] == 0} {
|
||||
set local_value [get_property CONFIG.$arg $periph]
|
||||
set local_value [common::get_property CONFIG.$arg $periph]
|
||||
# If a parameter isn't found locally (in the current
|
||||
# peripheral), we will (for some obscure and ancient reason)
|
||||
# look in peripherals connected via point to point links
|
||||
if { [string compare -nocase $local_value ""] == 0} {
|
||||
if { [string compare -nocase $local_value ""] == 0} {
|
||||
set p2p_name [::hsm::utils::get_p2p_name $periph $arg]
|
||||
if { [string compare -nocase $p2p_name ""] == 0} {
|
||||
set arg_name [::hsm::utils::get_ip_param_name $periph $arg]
|
||||
|
@ -169,7 +169,7 @@ proc xdefine_devcfg_config_file {drv_handle file_name drv_string args} {
|
|||
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# xdefine_canonical_xpars - Used to print out canonical defines for a driver.
|
||||
# xdefine_canonical_xpars - Used to print out canonical defines for a driver.
|
||||
# Given a list of arguments, define each as a canonical constant name, using
|
||||
# the driver name, in an include file.
|
||||
#-----------------------------------------------------------------------------
|
||||
|
@ -182,7 +182,7 @@ proc xdefine_canonical_xpars_zynq {drv_handle file_name drv_string args} {
|
|||
|
||||
# Get the names of all the peripherals connected to this driver
|
||||
foreach periph $periphs {
|
||||
set peripheral_name [string toupper [get_property NAME $periph]]
|
||||
set peripheral_name [string toupper [common::get_property NAME $periph]]
|
||||
lappend peripherals $peripheral_name
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ proc xdefine_canonical_xpars_zynq {drv_handle file_name drv_string args} {
|
|||
foreach periph $periphs {
|
||||
set canonical_name [string toupper [format "%s_%s" $drv_string $device_id]]
|
||||
lappend canonicals $canonical_name
|
||||
|
||||
|
||||
# Create a list of IDs of the peripherals whose hardware instance name
|
||||
# doesn't match the canonical name. These IDs can be used later to
|
||||
# generate canonical definitions
|
||||
|
@ -204,7 +204,7 @@ proc xdefine_canonical_xpars_zynq {drv_handle file_name drv_string args} {
|
|||
|
||||
set i 0
|
||||
foreach periph $periphs {
|
||||
set periph_name [string toupper [get_property NAME $periph]]
|
||||
set periph_name [string toupper [common::get_property NAME $periph]]
|
||||
|
||||
# Generate canonical definitions only for the peripherals whose
|
||||
# canonical name is not the same as hardware instance name
|
||||
|
@ -224,7 +224,7 @@ proc xdefine_canonical_xpars_zynq {drv_handle file_name drv_string args} {
|
|||
set rvalue 0
|
||||
}
|
||||
set rvalue [::hsm::utils::format_addr_string $rvalue $arg]
|
||||
|
||||
|
||||
puts $file_handle "#define $lvalue $rvalue"
|
||||
|
||||
}
|
||||
|
@ -236,4 +236,3 @@ proc xdefine_canonical_xpars_zynq {drv_handle file_name drv_string args} {
|
|||
puts $file_handle "\n/******************************************************************/\n"
|
||||
close $file_handle
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# Copyright (C) 2011 - 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
|
||||
# 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
|
||||
|
@ -20,7 +20,7 @@
|
|||
# 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
|
||||
# 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.
|
||||
#
|
||||
|
@ -54,18 +54,18 @@ proc gen_include_files {swproj mhsinst} {
|
|||
}
|
||||
if {$swproj == 1} {
|
||||
set inc_file_lines {xdevcfg.h devcfg_header.h}
|
||||
}
|
||||
}
|
||||
return $inc_file_lines
|
||||
}
|
||||
|
||||
|
||||
proc gen_src_files {swproj mhsinst} {
|
||||
if {$swproj == 0} {
|
||||
return ""
|
||||
}
|
||||
if {$swproj == 1} {
|
||||
|
||||
|
||||
set inc_file_lines {examples/xdevcfg_selftest_example.c data/devcfg_header.h}
|
||||
|
||||
|
||||
return $inc_file_lines
|
||||
}
|
||||
}
|
||||
|
@ -75,31 +75,31 @@ proc gen_testfunc_def {swproj mhsinst} {
|
|||
}
|
||||
|
||||
proc gen_init_code {swproj mhsinst} {
|
||||
|
||||
|
||||
if {$swproj == 0} {
|
||||
return ""
|
||||
}
|
||||
if {$swproj == 1} {
|
||||
return ""
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
proc gen_testfunc_call {swproj mhsinst} {
|
||||
|
||||
|
||||
if {$swproj == 0} {
|
||||
return ""
|
||||
}
|
||||
|
||||
set ipname [get_property NAME $mhsinst]
|
||||
set ipname [common::get_property NAME $mhsinst]
|
||||
set deviceid [::hsi::utils::get_ip_param_name $mhsinst "DEVICE_ID"]
|
||||
set stdout [get_property CONFIG.STDOUT [get_os]]
|
||||
set stdout [common::get_property CONFIG.STDOUT [hsi::get_os]]
|
||||
if { $stdout == "" || $stdout == "none" } {
|
||||
set hasStdout 0
|
||||
} else {
|
||||
set hasStdout 1
|
||||
}
|
||||
|
||||
|
||||
set testfunc_call ""
|
||||
|
||||
if {${hasStdout} == 0} {
|
||||
|
@ -108,11 +108,11 @@ proc gen_testfunc_call {swproj mhsinst} {
|
|||
|
||||
{
|
||||
int Status;
|
||||
|
||||
|
||||
Status = DcfgSelfTestExample(${deviceid});
|
||||
|
||||
}"
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -120,11 +120,11 @@ proc gen_testfunc_call {swproj mhsinst} {
|
|||
|
||||
{
|
||||
int Status;
|
||||
|
||||
|
||||
print(\"\\r\\n Running DcfgSelfTestExample() for ${ipname}...\\r\\n\");
|
||||
|
||||
|
||||
Status = DcfgSelfTestExample(${deviceid});
|
||||
|
||||
|
||||
if (Status == 0) {
|
||||
print(\"DcfgSelfTestExample PASSED\\r\\n\");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue