Skip to content

Commit

Permalink
dp14rxss: Added multi instance support.
Browse files Browse the repository at this point in the history
The current dp14rxss driver implementation will fail to compile for
multi instances of dp14rx subsystems with different configurations.
This patch fixes the same.

Signed-off-by: Jagadeesh Banisetti <jagadeesh.banisetti@xilinx.com>

Acked-for-series: Vishal Sagar <vishal.sagar@xilinx.com>
  • Loading branch information
Jagadeesh Banisetti authored and saddepal committed Sep 16, 2019
1 parent c439db5 commit d3ce626
Show file tree
Hide file tree
Showing 9 changed files with 258 additions and 158 deletions.
125 changes: 102 additions & 23 deletions XilinxProcessorIPLib/drivers/dp14rxss/data/dp14rxss.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ proc hier_ip_define_config_file {drv_handle file_name drv_string args} {
array set sub_core_params {}
set sub_core_params(displayport) "BASEADDR S_AXI_ACLK LANE_COUNT LINK_RATE MAX_BITS_PER_COLOR QUAD_PIXEL_ENABLE DUAL_PIXEL_ENABLE YCRCB_ENABLE YONLY_ENABLE GT_DATAWIDTH SECONDARY_SUPPORT AUDIO_CHANNELS MST_ENABLE NUMBER_OF_MST_STREAMS PROTOCOL_SELECTION FLOW_DIRECTION"
set sub_core_params(axi_iic) "BASEADDR TEN_BIT_ADR GPO_WIDTH"
set sub_core_params(hdcp) "BASEADDR S_AXI_FREQUENCY IS_RX IS_HDMI"
set sub_core_params(axi_timer) "BASEADDR CLOCK_FREQ_HZ"
set sub_core_params(hdcp) "BASEADDR"
set sub_core_params(axi_timer) "BASEADDR"
set sub_core_params(hdcp22_rx_dp) "BASEADDR"
set total_subcores [array size sub_core_params]

Expand All @@ -67,11 +67,22 @@ proc hier_ip_define_config_file {drv_handle file_name drv_string args} {

set periphs_g [::hsi::utils::get_common_driver_ips $drv_handle]

array set sub_core_inst {
displayport 1
axi_iic 1
hdcp 1
axi_timer 1
hdcp22_rx_dp 1
}

foreach periph_g $periphs_g {
::hsi::current_hw_instance $periph_g;

set child_cells_g [::hsi::get_cells]

puts $config_file "\n/*"
puts $config_file "* List of Sub-cores included from the subsystem"
puts $config_file "*/"
foreach child_cell_g $child_cells_g {
set child_cell_vlnv [::common::get_property VLNV $child_cell_g]
set vlnv_arr [split $child_cell_vlnv :]
Expand All @@ -94,6 +105,40 @@ proc hier_ip_define_config_file {drv_handle file_name drv_string args} {
}
if { $is_slave != 0 } {
puts -nonewline $config_file "#define [string toupper $final_child_cell_instance_name_present_g]\t1\n"

# create dictionary for ip name and it's instance names "ip_name {inst1_name inst2_name}"
dict lappend ss_ip_list $ip_name $child_cell_name_g
}
}
}

puts $config_file "\n/*"
puts $config_file "* List of Sub-cores excluded from the subsystem"
puts $config_file "*/"

foreach sub_core [lsort [array names sub_core_inst]] {
if {[dict exists $ss_ip_list $sub_core]} {
set max_instances $sub_core_inst($sub_core)
#check if core can have multiple instances
#It is possible that not all instances are used in the design
if {$max_instances > 1} {
set ip_instances [dict get $ss_ip_list $sub_core]
set avail_instances [llength $ip_instances]

#check if available instances are less than MAX
#if yes, mark the missing instance
#if all instances are present then skip the core
if {$avail_instances < $max_instances} {
set final_child_cell_instance_name_g "XPAR_${periph_g}_${strval}_PRESENT"
puts -nonewline $config_file "#define [string toupper $final_child_cell_instance_name_g] 0\n"
}
}
} else {
set count 0
while {$count<$sub_core_inst($sub_core)} {
set final_child_cell_instance_name_g "XPAR_${periph_g}_${sub_core}_${count}_PRESENT"
puts -nonewline $config_file "#define [string toupper $final_child_cell_instance_name_g] 0\n"
incr count
}
}
}
Expand All @@ -119,54 +164,88 @@ proc hier_ip_define_config_file {drv_handle file_name drv_string args} {
}

::hsi::current_hw_instance $periph
set child_cells [::hsi::get_cells]
set child_cells_g [::hsi::get_cells]
puts $config_file ",\n"

foreach child_cell $child_cells {
set child_cell_vlnv [::common::get_property VLNV $child_cell]
#This is to get the dictionary of included subcores.
set ss_ip_list [dict create]
foreach child_cell_g $child_cells_g {
set child_cell_vlnv [::common::get_property VLNV $child_cell_g]
set child_cell_name_g [common::get_property NAME $child_cell_g]
set vlnv_arr [split $child_cell_vlnv :]

lassign $vlnv_arr ip_vendor ip_library ip_name ip_version

set ip_type [common::get_property IP_TYPE $child_cell]
set child_cell_name [common::get_property NAME $child_cell]
set final_child_cell_instance_name XPAR_${child_cell_name}_DEVICE_ID
set final_child_cell_instance_name_present XPAR_${child_cell_name}_PRESENT
set ip_type_g [common::get_property IP_TYPE $child_cell_g]

if { [string compare -nocase "BUS" $ip_type] != 0 } {
set interfaces [hsi::get_intf_pins -of_objects $child_cell]
if {[string compare -nocase "BUS" $ip_type_g] != 0} {
set interfaces [hsi::get_intf_pins -of_objects $child_cell_g]
set is_slave 0
foreach interface $interfaces {
set intf_type [common::get_property TYPE $interface]
if { [string compare -nocase "SLAVE" $intf_type] == 0 } {
set is_slave 1
}
}
if {$is_slave != 0} {
# create dictionary for ip name and it's instance names "ip_name {inst1_name inst2_name}"
dict lappend ss_ip_list $ip_name $child_cell_name_g
}
}
}

if { $is_slave != 0 } {
set comma ",\n"
#Check for each subcore if it is included or excluded
foreach sub_core [lsort [array names sub_core_inst]] {
set max_instances $sub_core_inst($sub_core)

if {[dict exists $ss_ip_list $sub_core]} {
#subcore include
set ip_instances [dict get $ss_ip_list $sub_core]
set ip_inst_name [lindex $ip_instances 0]
set final_child_cell_instance_name_present "XPAR_${ip_inst_name}_PRESENT"
set final_child_cell_instance_name "XPAR_${ip_inst_name}_DEVICE_ID"

set comma ",\n"
puts $config_file "\t\t\{"
puts -nonewline $config_file [format "\t\t\t%s" [string toupper $final_child_cell_instance_name_present]]
puts $config_file ","
puts $config_file "\t\t\t\{"
puts -nonewline $config_file [format "\t\t\t\t%s" [string toupper $final_child_cell_instance_name]]

set params_str $sub_core_params($sub_core)
set params_arr [split $params_str " " ]

foreach param $params_arr {
set final_child_cell_param_name XPAR_${ip_inst_name}_$param
puts $config_file ","
puts -nonewline $config_file [format "\t\t\t\t%s" [string toupper $final_child_cell_param_name]]
}
puts $config_file "\n\t\t\t\}"
if { $brace < $total_subcores - 1 } {
puts $config_file "\t\t\},"
incr brace
} else {
puts $config_file "\t\t\}"
}
} else {
#subcore excluded
set count 0
set comma ",\n"
while {$count<$max_instances} {
set final_child_cell_instance_name_present "XPAR_${periph}_${sub_core}_${count}_PRESENT"
puts $config_file "\t\t\{"
puts -nonewline $config_file [format "\t\t\t%s" [string toupper $final_child_cell_instance_name_present]]
puts $config_file ","
puts $config_file "\t\t\t\{"
puts -nonewline $config_file [format "\t\t\t\t%s" [string toupper $final_child_cell_instance_name]]

set params_str $sub_core_params($ip_name)
set params_arr [split $params_str " " ]

foreach param $params_arr {
set final_child_cell_param_name XPAR_${child_cell_name}_$param
puts $config_file ","
puts -nonewline $config_file [format "\t\t\t\t%s" [string toupper $final_child_cell_param_name]]
}
puts -nonewline $config_file "\t\t\t\t0"
puts $config_file "\n\t\t\t\}"
if { $brace < $total_subcores - 1 } {
puts $config_file "\t\t\},"
incr brace
} else {
puts $config_file "\t\t\}"
}
incr count
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ extern "C" {
/***************************** Include Files *********************************/

#include "xparameters.h"
#if (XPAR_DPRXSS_0_HDCP_ENABLE > 0)
#if (XPAR_XHDCP_NUM_INSTANCES > 0)
#include "xhdcp1x.h"
#include "xtmrctr.h"
#endif
Expand Down
18 changes: 0 additions & 18 deletions XilinxProcessorIPLib/drivers/dp14rxss/src/hdcp22/xdprxss_hdcp22.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,24 +58,6 @@ extern "C" {
#define XDPRXSS_HDCP22_MAX_QUEUE_SIZE 16

/**************************** Type Definitions *******************************/
/**
* This typedef contains configuration information for the HDCP22 core.
*/
typedef struct {
u16 DeviceId; /**< Device ID of the sub-core */
UINTPTR AbsAddr; /**< Absolute Base Address of the Sub-cores*/
} XDpRxSs_Hdcp22_Config;

/**
* Sub-Core Configuration Table
*/
typedef struct
{
u16 IsPresent; /**< Flag to indicate if sub-core is present in
the design*/
XDpRxSs_Hdcp22_Config Hdcp22Config; /**< HDCP22 core configuration */
} XDpRxSs_Hdcp22SubCore;

/**
* These constants specify the HDCP22 Events
*/
Expand Down
Loading

0 comments on commit d3ce626

Please sign in to comment.