scugic : added namespace for all HSI TCL commands.

Signed-off-by: Nava kishore Manne <navam@xilinx.com>
This commit is contained in:
Nava kishore Manne 2015-04-09 13:23:49 +05:30
parent 7ec407e342
commit 3ecea15617
2 changed files with 92 additions and 94 deletions

View file

@ -51,7 +51,7 @@
############################################################
proc generate {drv_handle} {
xdefine_gic_params $drv_handle
xdefine_zynq_include_file $drv_handle "xparameters.h" "XScuGic" "NUM_INSTANCES" "DEVICE_ID" "C_S_AXI_BASEADDR" "C_S_AXI_HIGHADDR" "C_DIST_BASEADDR"
xdefine_zynq_config_file $drv_handle "xscugic_g.c" "XScuGic" "DEVICE_ID" "C_S_AXI_BASEADDR" "C_DIST_BASEADDR"
xdefine_zynq_canonical_xpars $drv_handle "xparameters.h" "ScuGic" "DEVICE_ID" "C_S_AXI_BASEADDR" "C_S_AXI_HIGHADDR" "C_DIST_BASEADDR"
@ -65,10 +65,10 @@ proc generate {drv_handle} {
#
proc xdefine_zynq_include_file {drv_handle file_name drv_string args} {
# Open include file
set file_handle [::hsm::utils::open_include_file $file_name]
set file_handle [::hsi::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 [::hsi::utils::get_common_driver_ips $drv_handle]
# Handle special cases
set arg "NUM_INSTANCES"
@ -76,22 +76,22 @@ proc xdefine_zynq_include_file {drv_handle file_name drv_string args} {
if {$posn > -1} {
puts $file_handle "/* Definitions for driver [string toupper [get_property NAME $drv_handle]] */"
# Define NUM_INSTANCES
puts $file_handle "#define [::hsm::utils::get_driver_param_name $drv_string $arg] [llength $periphs]"
puts $file_handle "#define [::hsi::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]
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 [::hsi::utils::get_driver_param_name $drv_string $arg] [get_property CONFIG.$arg $drv_handle]"
}
}
set args $newargs
set procdrv [get_sw_processor]
set procdrv [hsi::get_sw_processor]
set compiler [get_property CONFIG.compiler $procdrv]
# Print all parameters for all peripherals
set device_id 0
@ -132,8 +132,8 @@ proc xdefine_zynq_include_file {drv_handle file_name drv_string args} {
if {[llength $value] == 0} {
set value 0
}
set value [::hsm::utils::format_addr_string $value $arg]
set arg_name [::hsm::utils::get_ip_param_name $periph $arg]
set value [::hsi::utils::format_addr_string $value $arg]
set arg_name [::hsi::utils::get_ip_param_name $periph $arg]
regsub "S_AXI_" $arg_name "" arg_name
if {[string compare -nocase "HW_VER" $arg] == 0} {
puts $file_handle "#define $arg_name \"$value\""
@ -148,16 +148,16 @@ proc xdefine_zynq_include_file {drv_handle file_name drv_string args} {
}
#-----------------------------------------------------------------------------
# xdefine_zynq_canonical_xpars - Used to print out canonical defines for a driver.
# xdefine_zynq_canonical_xpars - Used to print out canonical defines for a driver.
# Similar to proc xdefine_config_file, except that uses regsub to replace "S_AXI_"
# with "".
#-----------------------------------------------------------------------------
proc xdefine_zynq_canonical_xpars {drv_handle file_name drv_string args} {
# Open include file
set file_handle [::hsm::utils::open_include_file $file_name]
set file_handle [::hsi::utils::open_include_file $file_name]
# Get all the peripherals connected to this driver
set periphs [::hsm::utils::get_common_driver_ips $drv_handle]
set periphs [::hsi::utils::get_common_driver_ips $drv_handle]
# Get the names of all the peripherals connected to this driver
foreach periph $periphs {
@ -171,7 +171,7 @@ proc xdefine_zynq_canonical_xpars {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
@ -184,7 +184,7 @@ proc xdefine_zynq_canonical_xpars {drv_handle file_name drv_string args} {
set i 0
foreach periph $periphs {
set periph_name [string toupper [get_property NAME $periph]]
set procdrv [get_sw_processor]
set procdrv [hsi::get_sw_processor]
set compiler [get_property CONFIG.compiler $procdrv]
# Generate canonical definitions only for the peripherals whose
# canonical name is not the same as hardware instance name
@ -193,13 +193,13 @@ proc xdefine_zynq_canonical_xpars {drv_handle file_name drv_string args} {
set canonical_name [format "%s_%s" $drv_string [lindex $indices $i]]
foreach arg $args {
set lvalue [::hsm::utils::get_driver_param_name $canonical_name $arg]
set lvalue [::hsi::utils::get_driver_param_name $canonical_name $arg]
# replace S_SXI_ with CPU_. This is a temporary fix. Revist when the
# S_AXI_DIST_BASEADDR is generated by the tools
regsub "S_AXI_" $lvalue "CPU_" lvalue
# The commented out rvalue is the name of the instance-specific constant
# set rvalue [::hsm::utils::get_ip_param_name $periph $arg]
# set rvalue [::hsi::utils::get_ip_param_name $periph $arg]
# The rvalue set below is the actual value of the parameter
if {[string compare -nocase "C_S_AXI_BASEADDR" $arg] == 0} {
if {[string compare -nocase $compiler "arm-none-eabi-gcc"] == 0} {
@ -231,7 +231,7 @@ proc xdefine_zynq_canonical_xpars {drv_handle file_name drv_string args} {
if {[llength $rvalue] == 0} {
set rvalue 0
}
set rvalue [::hsm::utils::format_addr_string $rvalue $arg]
set rvalue [::hsi::utils::format_addr_string $rvalue $arg]
puts $file_handle "#define $lvalue $rvalue"
@ -247,27 +247,27 @@ proc xdefine_zynq_canonical_xpars {drv_handle file_name drv_string args} {
proc xdefine_gic_params {drvhandle} {
set config_inc [::hsm::utils::open_include_file "xparameters.h"]
set config_inc [::hsi::utils::open_include_file "xparameters.h"]
# Next define interrupt IDs for each connected peripheral
set periphs [::hsm::utils::get_common_driver_ips $drvhandle]
set periphs [::hsi::utils::get_common_driver_ips $drvhandle]
set device_id 0
foreach periph $periphs {
# get the gic mode information
set scugic_mode [get_property CONFIG.C_IRQ_F2P_MODE $periph]
# get the gic mode information
set scugic_mode [get_property CONFIG.C_IRQ_F2P_MODE $periph]
# Get the edk based name of peripheral for printing redefines
set edk_periph_name [get_property NAME $periph]
# Handle CorenIRQ/FIQ interrupts
xhandle_coreirq_interrupts
xhandle_coreirq_interrupts
# Get ports that are driving the interrupt
#set source_ports [::hsm::utils::get_interrupt_sources $periph]
set pin [get_pins -of_objects $periph IRQ_F2P]
set source_ports [::hsm::utils::get_source_pins $pin]
#set source_ports [::hsi::utils::get_interrupt_sources $periph]
set pin [hsi::get_pins -of_objects $periph IRQ_F2P]
set source_ports [::hsi::utils::get_source_pins $pin]
set i 0
lappend source_list
foreach source_port $source_ports {
@ -277,14 +277,14 @@ proc xdefine_gic_params {drvhandle} {
set source_periph($i) "DUMMY"
set source_name($i) "DUMMY"
} else {
set external_pin [::hsm::utils::is_external_pin $source_port]
set external_pin [::hsi::utils::is_external_pin $source_port]
if {$external_pin} {
set source_port_name($i) [get_property NAME $source_port]
set source_periph($i) "system"
set source_name($i) "system"
} else {
set source_port_name($i) [get_property NAME $source_port]
set source_periph($i) [get_cells -of_object $source_port]
set source_periph($i) [hsi::get_cells -of_object $source_port]
set source_name($i) [get_property NAME $source_periph($i)]
}
}
@ -304,39 +304,39 @@ proc xdefine_gic_params {drvhandle} {
if {[string compare -nocase $scugic_mode "DIRECT"] == 0} {
for {set i 0} {$i < $num_intr_inputs} {incr i} {
for {set i 0} {$i < $num_intr_inputs} {incr i} {
# Skip dummy ports
if {[string compare -nocase $source_port_name($i) "DUMMY"] == 0} {
incr k
continue
}
set j [expr 61 + $k]
if {$j >68} {
set j [expr 84 + $k - 8]
}
puts $config_inc [format "#define XPAR_%s_%s_%s_INTR %d" "FABRIC" [string toupper $source_name($i)] [string toupper $source_port_name($i)] $j]
incr k
}
# Skip dummy ports
if {[string compare -nocase $source_port_name($i) "DUMMY"] == 0} {
incr k
continue
}
set j [expr 61 + $k]
if {$j >68} {
set j [expr 84 + $k - 8]
}
puts $config_inc [format "#define XPAR_%s_%s_%s_INTR %d" "FABRIC" [string toupper $source_name($i)] [string toupper $source_port_name($i)] $j]
incr k
}
} else {
for {set i [expr ($num_intr_inputs-1)]} {$i >= 0} {incr i -1} {
# Skip dummy ports
if {[string compare -nocase $source_port_name($i) "DUMMY"] == 0} {
incr k
continue
}
set j [expr 91 - $k]
if {$j < 84} {
set j [expr 68 - $k + 8]
}
puts $config_inc [format "#define XPAR_%s_%s_%s_INTR %d" "FABRIC" [string toupper $source_name($i)] [string toupper $source_port_name($i)] $j]
incr k
}
# Skip dummy ports
if {[string compare -nocase $source_port_name($i) "DUMMY"] == 0} {
incr k
continue
}
set j [expr 91 - $k]
if {$j < 84} {
set j [expr 68 - $k + 8]
}
puts $config_inc [format "#define XPAR_%s_%s_%s_INTR %d" "FABRIC" [string toupper $source_name($i)] [string toupper $source_port_name($i)] $j]
incr k
}
}
@ -356,7 +356,7 @@ proc xdefine_gic_params {drvhandle} {
if {[string compare -nocase $port_type "global"] == 0} {
continue
}
set drv [get_drivers -filter "HW_INSTANCE==$$source_name($i)"]
set drv [hsi::get_drivers -filter "HW_INSTANCE==$$source_name($i)"]
#set iptype [xget_value $source_periph($i) "OPTION" "IPTYPE"]
if {[llength $source_name($i)] != 0 && [llength $drv] != 0} {
@ -372,7 +372,7 @@ proc xdefine_gic_params {drvhandle} {
#
if { [lcount $source_list $source_name($i)] > 1} {
set port_name [string toupper $source_port_name($i)]
#
# If there are multiple interrupt ports for axi_ethernet, do not include
# the port name in the canonical name, for the port "INTERRUPT". Other ports
@ -438,7 +438,7 @@ proc lcount {list match_entry} {
###################################################################
proc xfind_instance {drvhandle instname} {
set instlist [::hsm::utils::get_common_driver_ips $drvhandle]
set instlist [::hsi::utils::get_common_driver_ips $drvhandle]
set i 0
foreach inst $instlist {
set name [get_property NAME $inst]
@ -458,7 +458,7 @@ proc xfind_instance {drvhandle instname} {
#
###################################################################
proc xget_port_type {port} {
set periph [get_cells -of_objects $port]
set periph [hsi::get_cells -of_objects $port]
if {[llength $periph] == 0} {
return "global"
} else {
@ -470,36 +470,35 @@ proc xget_port_type {port} {
# Tcl procedure for generating Core IRQ interrupts in xparameters.h file
# ----------------------------------------------------------------------------------
proc xhandle_coreirq_interrupts { } {
set file_handle [::hsm::utils::open_include_file "xparameters.h"]
set file_handle [::hsi::utils::open_include_file "xparameters.h"]
puts $file_handle "\n/***Definitions for Core_nIRQ/nFIQ interrupts ****/"
close $file_handle
set periphs [get_cells *]
set periphs [hsi::get_cells *]
foreach periph $periphs {
set intr_pins [get_pins -of_objects $periph -filter "TYPE == INTERRUPT"]
set intr_pins [hsi::get_pins -of_objects $periph -filter "TYPE == INTERRUPT"]
foreach intr_piin $intr_pins {
set sink_pin [::hsm::utils::get_sink_pins $intr_piin]
set sink_pin [::hsi::utils::get_sink_pins $intr_piin]
if { $sink_pin == "Core1_nIRQ" || $sink_pin == "Core0_nIRQ" } {
set ip_name [get_property IP_NAME [get_cells $periph]]
set ip_name [get_property IP_NAME [hsi::get_cells $periph]]
set periph [string toupper $periph]
set intr_pin [string toupper $intr_piin]
if {$ip_name != "ps7_scugic" } {
set intr_id "XPAR_FABRIC_${periph}_${intr_pin}_INTR"
set file_handle [::hsm::utils::open_include_file "xparameters.h"]
set file_handle [::hsi::utils::open_include_file "xparameters.h"]
puts $file_handle "#define ${intr_id} 31"
close $file_handle
}
} elseif { $sink_pin == "Core0_nFIQ" || $sink_pin == "Core1_nFIQ" } {
set ip_name [get_property IP_NAME [get_cells $periph]]
set ip_name [get_property IP_NAME [hsi::get_cells $periph]]
set periph [string toupper $periph]
set intr_pin [string toupper $intr_piin]
if {$ip_name != "ps7_scugic" } {
set intr_id "XPAR_FABRIC_${periph}_${intr_pin}_INTR"
set file_handle [::hsm::utils::open_include_file "xparameters.h"]
set file_handle [::hsi::utils::open_include_file "xparameters.h"]
puts $file_handle "#define ${intr_id} 28"
close $file_handle
}
}
}
}
}
}

View file

@ -30,7 +30,7 @@
#
###############################################################################
##############################################################################
##
##
## MODIFICATION HISTORY:
## Ver Who Date Changes
## ----- ---- -------- ----------------------------------------------------
@ -41,7 +41,7 @@
# Uses $XILINX_EDK/bin/lib/xillib_sw.tcl
# -----------------------------------------------------------------
# Software Project Types (swproj):
# 0 : MemoryTest - Calls basic memorytest routines
# 0 : MemoryTest - Calls basic memorytest routines
# 1 : PeripheralTest - Calls any existing polled_example and/or selftest
# -----------------------------------------------------------------
@ -55,7 +55,7 @@ proc gen_include_files {swproj mhsinst} {
return ""
}
if {$swproj == 1} {
set inc_file_lines {xscugic.h xil_exception.h scugic_header.h}
return $inc_file_lines
}
@ -84,45 +84,45 @@ proc gen_testfunc_call {swproj mhsinst} {
if {$swproj == 0} {
return ""
}
set ipname [get_property NAME $mhsinst]
set ipname [get_property NAME $mhsinst]
set decl " static XScuGic ${ipname};"
set deviceid [::hsm::utils::get_ip_param_name $mhsinst "DEVICE_ID"]
set stdout [get_property CONFIG.STDOUT [get_os]]
set deviceid [::hsi::utils::get_ip_param_name $mhsinst "DEVICE_ID"]
set stdout [get_property CONFIG.STDOUT [hsi::get_os]]
if { $stdout == "" || $stdout == "none" } {
set hasStdout 0
} else {
set hasStdout 1
}
set intcvar intc
set testfunc_call ""
if {${hasStdout} == 0} {
append testfunc_call "
{
int Status;
Status = ScuGicSelfTestExample(${deviceid});
Status = ScuGicInterruptSetup(&${intcvar}, ${deviceid});
}"
} else {
append testfunc_call "
{
int Status;
print(\"\\r\\n Running ScuGicSelfTestExample() for ${ipname}...\\r\\n\");
Status = ScuGicSelfTestExample(${deviceid});
if (Status == 0) {
print(\"ScuGicSelfTestExample PASSED\\r\\n\");
}
@ -131,23 +131,22 @@ proc gen_testfunc_call {swproj mhsinst} {
}
}"
append testfunc_call "
append testfunc_call "
{
int Status;
Status = ScuGicInterruptSetup(&${intcvar}, ${deviceid});
if (Status == 0) {
print(\"ScuGic Interrupt Setup PASSED\\r\\n\");
}
}
else {
print(\"ScuGic Interrupt Setup FAILED\\r\\n\");
}
}
}"
}
return $testfunc_call
}
}