Sha256: 4f82c8dcd3d24b0525453a535a48666579cf0a7a5ab11003c05a67ef5d48095e

Contents?: true

Size: 890 Bytes

Versions: 4

Compression:

Stored size: 890 Bytes

Contents

module OrigenARMDebug
  class DAPController
    include Origen::Controller
    include Helpers

    attr_accessor :dp

    # Returns the currently enabled DP (or the only DP if only one
    # of them).
    # If no dp is enabled before calling this, it will choose the
    # SW_DP by default.
    def dp
      @dp ||= dps.first
    end

    def set_dp(dp)
      if dps.size > 1
        if dp == :swd || dp == :sw
          @dp = dps.first
        elsif dp == :jtag
          @dp = dps.last
        else
          Origen.log.error 'origen_arm_debug: Only SWD and JTAG DP available'
        end
      else
        Origen.log.warn 'origen_arm_debug: Ignoring set_dp call since only one DP is available'
      end
    end

    def reset_dp
      @dp = nil
    end

    def is_jtag?
      dp.is_jtag?
    end

    def is_swd?
      dp.is_swd?
    end
    alias_method :is_sw?, :is_swd?
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
origen_arm_debug-1.3.1 lib/origen_arm_debug/dap_controller.rb
origen_arm_debug-1.3.0 lib/origen_arm_debug/dap_controller.rb
origen_arm_debug-1.2.0 lib/origen_arm_debug/dap_controller.rb
origen_arm_debug-1.1.4 lib/origen_arm_debug/dap_controller.rb