Sha256: 8ca8a8ac655f2b0be8bc854dc836f625322e823a3131d2e94e9276d7589e2451

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

module OrigenARMDebug
  class SW_DPController
    include Origen::Controller
    include Helpers
    include DPController

    def write_register(reg, options = {})
      unless reg.writable?
        fail "The :#{reg.name} register is not writeable!"
      end

      if reg.owner == model
        log "Write SW-DP register #{reg.name.to_s.upcase}: #{reg.data.to_hex}" do
          dut.swd.write_dp(reg)
        end
      else
        unless reg.owner.is_a?(AP)
          fail 'The SW-DP can only write to DP or AP registers!'
        end

        select_ap_reg(reg)
        dut.swd.write_ap(reg, options)
      end
    end

    def read_register(reg, options = {})
      unless reg.readable?
        fail "The :#{reg.name} register is not readable!"
      end

      if reg.owner == model
        log "Read SW-DP register #{reg.name.to_s.upcase}: #{Origen::Utility.read_hex(reg)}" do
          dut.swd.read_dp(reg)
        end
      else
        unless reg.owner.is_a?(AP)
          fail 'The SW-DP can only write to DP or AP registers!'
        end

        select_ap_reg(reg)
        dut.swd.read_ap(address: reg.address)
        dut.swd.read_dp(reg, options.merge(address: rdbuff.address))
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
origen_arm_debug-1.1.0 lib/origen_arm_debug/sw_dp_controller.rb
origen_arm_debug-1.0.2 lib/origen_arm_debug/sw_dp_controller.rb
origen_arm_debug-1.0.1 lib/origen_arm_debug/sw_dp_controller.rb