origen_swd 1.1.1 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b399ee4c1b8351d8fa4cee70481f86ae8cd57de69c8ae13a8c96f7ff5775bf9e
4
- data.tar.gz: 60a1823aff88c501b169a26b07a4d5c6de517c58bedda449cb189553689939da
3
+ metadata.gz: 51a97998eec9af382325c0f868198587bca8b8881c8508e2f57b9b9e5c252861
4
+ data.tar.gz: 95ae1faa26434393293358c049841a6fa64fece8aac409f300df2db5bb4cc1bb
5
5
  SHA512:
6
- metadata.gz: 4ec8eb5d2530edf0b259d3aa834629bfbca20b96ada266bd398e020bb7b1b882d4869441972a538d91e6789d3abf6b6fb530edefed68097a252217d7ddd5982d
7
- data.tar.gz: d200cc98d56717983494074c2633cb48080633544213c16168ee7944af078d0e93bf08ea9fcbe2a7ba86e8960e5abe2c50de684586058e8697196ace9ce1f13f
6
+ metadata.gz: 2a831ddbb5f522b5af31f3b78fb62c9fda0301125db220a74d4f88ef01c77564823f5bc5911f788ddd8522a9b92af5e32480dbec702e5924a67e8b03d1d18482
7
+ data.tar.gz: 51cd717bcd6c2bceca23fef362650cdab42a011566b6b3387b6d9629e447c4ca6b77b99ed914ff4bdc2e21241c036d460b4a5e2ea8508012f470fd2baee2ef02
data/config/version.rb CHANGED
@@ -1,8 +1,7 @@
1
1
  module OrigenSWD
2
2
  MAJOR = 1
3
3
  MINOR = 1
4
- BUGFIX = 1
4
+ BUGFIX = 3
5
5
  DEV = nil
6
-
7
6
  VERSION = [MAJOR, MINOR, BUGFIX].join(".") + (DEV ? ".pre#{DEV}" : '')
8
7
  end
@@ -14,6 +14,7 @@ module OrigenSWD
14
14
 
15
15
  # Customiz-ible 'turn-round cycle' (TRN) parameter (in cycles)
16
16
  attr_accessor :trn
17
+ attr_accessor :posedge_clk
17
18
 
18
19
  # Initialize class variables
19
20
  #
@@ -30,6 +31,7 @@ module OrigenSWD
30
31
  @current_apaddr = 0
31
32
  @orundetect = 0
32
33
  @trn = 0
34
+ @posedge_clk = '1'
33
35
  end
34
36
 
35
37
  # Write data from Debug Port
@@ -68,7 +70,7 @@ module OrigenSWD
68
70
  def read(ap_dp, reg_or_val, options = {})
69
71
  addr = extract_address(reg_or_val, options.merge(use_reg_or_val_if_you_must: true))
70
72
  send_header(ap_dp, 1, addr) # send read-specific header (rnw = 1)
71
- receive_acknowledgement
73
+ receive_acknowledgement(options)
72
74
  receive_payload(reg_or_val, options)
73
75
  swd_dio.drive(0)
74
76
  end
@@ -143,6 +145,7 @@ module OrigenSWD
143
145
  return reg_or_val.address if reg_or_val.respond_to?(:address)
144
146
  return reg_or_val.addr if reg_or_val.respond_to?(:addr)
145
147
  return reg_or_val if reg_or_val && options[:use_reg_or_val_if_you_must]
148
+
146
149
  fail 'No address given, if supplying a data value instead of a register object, you must supply an :address option'
147
150
  end
148
151
 
@@ -158,13 +161,13 @@ module OrigenSWD
158
161
  # @param [Integer] address Address of register that is being accessed
159
162
  def send_header(apndp, rnw, address)
160
163
  addr = address >> 2
161
- parity = apndp ^ rnw ^ (addr >> 3) ^ (addr >> 2) & (0x01) ^ (addr >> 1) & (0x01) ^ addr & 0x01
164
+ parity = apndp ^ rnw ^ (addr >> 3) ^ (addr >> 2) & (0x01) ^ (addr >> 1) & (0x01) ^ addr & 0x01
162
165
 
163
166
  cc '[SWD] -----------------------------------------------------------------'
164
167
  cc '[SWD] | Start | AP | Read | AD[2] | AD[3] | Par | Stop | Park |'
165
168
  cc "[SWD] | 1 | #{apndp} | #{rnw} | #{addr[0]} | #{addr[1]} | #{parity[0]} | 0 | 1 |"
166
169
  cc '[SWD] -----------------------------------------------------------------'
167
- swd_clk.drive(1)
170
+ swd_clk.drive(posedge_clk)
168
171
  swd_dio.drive!(1) # send start bit (always 1)
169
172
  swd_dio.drive!(apndp) # send apndp bit
170
173
  swd_dio.drive!(rnw) # send rnw bit
@@ -177,11 +180,31 @@ module OrigenSWD
177
180
  end
178
181
 
179
182
  # Waits appropriate number of cycles for the acknowledgement phase
180
- def receive_acknowledgement
183
+ # @param confirm [Symbol] Indicates what type of acknowledgement confirmation should be used. Options are:
184
+ # * [:ignore, :none, :skip] -> Ignore the acknowledgement completely.
185
+ # * [:failure, :fail, :error] -> Verify that the acknowledgement failured; that is,
186
+ # * [:success] (Default) -> Verify the acknowledgement as normal.
187
+ # @param options [Hash] Placeholder for other/future options.
188
+ # @raise [RuntimeError] When an unrecongized :confirm option is given.
189
+ def receive_acknowledgement(options = {})
190
+ confirm = options[:confirm] || :success
181
191
  wait_trn
182
- swd_dio.assert!(1)
183
- swd_dio.assert!(0)
184
- swd_dio.assert!(0)
192
+ if [:ignore, :none, :skip].include?(confirm)
193
+ log('Ignoring Acknowledgement Phase')
194
+ tester.cycle(repeat: 3)
195
+ elsif [:failure, :fail, :error].include?(confirm)
196
+ log('Confirming Error Encountered During Acknowledgement Phase')
197
+ swd_dio.assert!(0)
198
+ swd_dio.assert!(0)
199
+ swd_dio.assert!(1)
200
+ elsif confirm == :success
201
+ log('Confirming Success During Acknowledgement Phase')
202
+ swd_dio.assert!(1)
203
+ swd_dio.assert!(0)
204
+ swd_dio.assert!(0)
205
+ else
206
+ Origen.app!.fail!(message: "OrigenSWD: Origen SWD does not know how to confirm :#{confirm}")
207
+ end
185
208
  swd_dio.dont_care
186
209
  end
187
210
 
@@ -260,7 +283,7 @@ module OrigenSWD
260
283
  end
261
284
 
262
285
  cc options[:arm_debug_comment] if options.key?(:arm_debug_comment)
263
- swd_clk.drive(1)
286
+ swd_clk.drive(posedge_clk)
264
287
 
265
288
  reg_overlay = extract_reg_overlay(reg)
266
289
  if reg_overlay && !options[:no_subr] && !Origen.mode.simulation?
data/lib/origen_swd.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'origen'
2
- require_relative '../config/application.rb'
2
+ require_relative '../config/application'
3
3
 
4
4
  # Include this module to add a SWD driver to your class
5
5
  module OrigenSWD
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: origen_swd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ronnie Lajaunie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-15 00:00:00.000000000 Z
11
+ date: 2024-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: origen
@@ -63,8 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
63
  - !ruby/object:Gem::Version
64
64
  version: 1.8.11
65
65
  requirements: []
66
- rubyforge_project:
67
- rubygems_version: 2.7.7
66
+ rubygems_version: 3.1.6
68
67
  signing_key:
69
68
  specification_version: 4
70
69
  summary: Driver for single-wire-debug interface.