Class: OrigenARMDebug::DAP
- Inherits:
-
Object
- Object
- OrigenARMDebug::DAP
- Includes:
- Origen::Model
- Defined in:
- lib/origen_arm_debug/dap.rb
Overview
This is the top-level model that instantiates the DP and APs
Instance Attribute Summary collapse
-
#dps ⇒ Object
readonly
Returns the value of attribute dps.
-
#ext_aps ⇒ Object
readonly
Returns the value of attribute ext_aps.
-
#jtag_aps ⇒ Object
readonly
Returns the value of attribute jtag_aps.
-
#mem_aps ⇒ Object
readonly
Returns the value of attribute mem_aps.
Instance Method Summary collapse
-
#add_ap(name, options) ⇒ Object
Method to add additional Access Ports (MEM-AP).
-
#aps ⇒ Object
Returns an array containing all APs.
-
#initialize(options = {}) ⇒ DAP
constructor
A new instance of DAP.
- #instantiate_subblocks(options = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ DAP
Returns a new instance of DAP.
8 9 10 11 12 13 14 15 |
# File 'lib/origen_arm_debug/dap.rb', line 8 def initialize( = {}) @dps = [] @mem_aps = [] # Array of MEM-APs @jtag_aps = [] # Array of JTAG-APs @ext_aps = [] # Array of 'extension' APs instantiate_subblocks() end |
Instance Attribute Details
#dps ⇒ Object (readonly)
Returns the value of attribute dps.
6 7 8 |
# File 'lib/origen_arm_debug/dap.rb', line 6 def dps @dps end |
#ext_aps ⇒ Object (readonly)
Returns the value of attribute ext_aps.
6 7 8 |
# File 'lib/origen_arm_debug/dap.rb', line 6 def ext_aps @ext_aps end |
#jtag_aps ⇒ Object (readonly)
Returns the value of attribute jtag_aps.
6 7 8 |
# File 'lib/origen_arm_debug/dap.rb', line 6 def jtag_aps @jtag_aps end |
#mem_aps ⇒ Object (readonly)
Returns the value of attribute mem_aps.
6 7 8 |
# File 'lib/origen_arm_debug/dap.rb', line 6 def mem_aps @mem_aps end |
Instance Method Details
#add_ap(name, options) ⇒ Object
Method to add additional Access Ports (MEM-AP)
75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/origen_arm_debug/dap.rb', line 75 def add_ap(name, ) domain name.to_sym # class name is deleted from options in sub_block call class_name = [:class_name] ap = sub_block(name.to_sym, ) if class_name == 'MemAP' mem_aps << ap elsif class_name == 'JTAGAP' jtag_aps << ap else ext_aps << ap end end |
#aps ⇒ Object
Returns an array containing all APs
91 92 93 |
# File 'lib/origen_arm_debug/dap.rb', line 91 def aps mem_aps + jtag_aps + ext_aps end |
#instantiate_subblocks(options = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/origen_arm_debug/dap.rb', line 17 def instantiate_subblocks( = {}) if [:swd] || parent.respond_to?(:swd) dps << sub_block(:sw_dp, class_name: 'SW_DP') end if [:jtag] || parent.respond_to?(:jtag) if [:dapv6] [:class_name] = 'JTAG_DPV6' else [:class_name] = 'JTAG_DP' end dps << sub_block(:jtag_dp, ) end Array([:mem_aps]).each do |name, base_address| if base_address.is_a?(Hash) ap_opts = { class_name: 'MemAP' }.merge(base_address) else ap_opts = { class_name: 'MemAP', base_address: base_address } end add_ap(name, ap_opts) end Array([:jtag_aps]).each do |name, base_address| if base_address.is_a?(Hash) ap_opts = { class_name: 'JTAGAP' }.merge(base_address) else ap_opts = { class_name: 'JTAGAP', base_address: base_address } end add_ap(name, ap_opts) end Array([:aps]).each do |name, opts| if opts.is_a?(Hash) klass = opts.delete(:class_name) addr = opts.delete(:base_address) if klass.nil? || addr.nil? fail "[ARM DEBUG] Error: Must specify class_name and base_address if using 'aps' hash to define APs" end ap_opts = { class_name: klass, base_address: addr }.merge(opts) else fail "[ARM DEBUG] Error: Must specify class_name and base_address if using 'aps' hash to define APs" end add_ap(name, ap_opts) end end |