diff --git a/DSView/pv/dialogs/about.cpp b/DSView/pv/dialogs/about.cpp
index 217007bd..4b800908 100644
--- a/DSView/pv/dialogs/about.cpp
+++ b/DSView/pv/dialogs/about.cpp
@@ -44,6 +44,8 @@ About::About(QWidget *parent) :
QString arch = "x64";
#elif defined(__i386) || defined(_M_IX86)
QString arch = "x86";
+ #elif defined(__arm__) || defined(_M_ARM)
+ QString arch = "arm";
#endif
QString version = tr("DSView %1 (%2)
")
diff --git a/NEWS b/NEWS
index caa55c7f..904514ba 100644
--- a/NEWS
+++ b/NEWS
@@ -1,234 +1,231 @@
0.98 (2017-07-29)
-----------------
--common
- *fix hardware initialization issue(always red led indicator) when power on
- *improve move operations of cursors/label/trigger level, support both press-drag and select-move-release mode
- *update the manually, and integrate into the menu of the software
- *improve the content of 'About' menu, add 'changelogs' information
- *firmware/HDL update
+ * fix hardware initialization issue(always red led indicator) when power on
+ * improve move operations of cursors/label/trigger level, support both press-drag and select-move-release mode
+ * update the manually, and integrate into the menu of the software
+ * improve the content of 'About' menu, add 'changelogs' information
+ * firmware/HDL update
--for logic analyzer
- *improve display scale of decoder contents under exception case
- *fix display issue of progressbar of saving dsl file, when sample depth greater than 4G
- *fix export issue when part of channels enalbed
- *fix pattern search issue.
- *fix out of boundary issue of scroll bar, when sample depth greater than 8G
+ * improve display scale of decoder contents under exception case
+ * fix display issue of progressbar of saving dsl file, when sample depth greater than 4G
+ * fix export issue when part of channels enabled
+ * fix pattern search issue.
+ * fix out of boundary issue of scroll bar, when sample depth greater than 8G
--for oscilloscope
- *fix auto calibraiton issue
- *improve noise processing method
+ * fix auto calibration issue
+ * improve noise processing method
0.97 (2017-06-02)
-----------------
--common
- *fix file save fail issue
- *fix window missing issue when disconnect external monitor
- *fix crash issue when open illegal files
- *improve graphics rendering and operations fluency
- *fix window display issue: maximize/minimize/show/hide...etc
+ * fix file save fail issue
+ * fix window missing issue when disconnect external monitor
+ * fix crash issue when open illegal files
+ * improve graphics rendering and operations fluency
+ * fix window display issue: maximize/minimize/show/hide...etc
--for logic analyzer
- *Enhance stream mode funtion to achieve 100M@3channels / 50M@6channels / 25M@12channels / 20M@16channels
- *improve memory structure, extend sample depth to solve memory alloc fail issue
- *resolve the coupling between channel data, unused channels don't occupy memory space
- *add stop options to support upload already captured data under buffer mode
- *add save/load function for protocol settings
- *add cursor-based edge statistics function
- *add repetitive mode to support repeat trigger acquisiton
- *improve search funciton to support start position setting
- *improve advanced trigger
- *improve cursor measurement method, add 16 sets of measurement between cursors
- *fix trigger issue when sample rate greater than 100MHz
- *fix display issue of trigger position
- *implement free combination of channels under stream mode
- *improve file saving display window, and add cancel button
- *fix partial decoding issue
- *fix messy code issue when add protocol decoder
- *improve the stability of protocol decoder
- *add mapping funtion from graphic decode to list decode
- *add mapping flag between grapic decode and list decode
- *add channel height option for file device
- *add auto snap to edge function when insert cursor
+ * Enhance stream mode function to achieve 100M@3channels / 50M@6channels / 25M@12channels / 20M@16channels
+ * improve memory structure, extend sample depth to solve memory alloc fail issue
+ * resolve the coupling between channel data, unused channels don't occupy memory space
+ * add stop options to support upload already captured data under buffer mode
+ * add save/load function for protocol settings
+ * add cursor-based edge statistics function
+ * add repetitive mode to support repeat trigger acquisition
+ * improve search function to support start position setting
+ * improve advanced trigger
+ * improve cursor measurement method, add 16 sets of measurement between cursors
+ * fix trigger issue when sample rate greater than 100MHz
+ * fix display issue of trigger position
+ * implement free combination of channels under stream mode
+ * improve file saving display window, and add cancel button
+ * fix partial decoding issue
+ * fix messy code issue when adding protocol decoder
+ * improve the stability of protocol decoder
+ * add mapping function from graphic decode to list decode
+ * add mapping flag between graphic decode and list decode
+ * add channel height option for file device
+ * add auto snap to edge function when insert cursor
--for oscilloscope
- *fix dsl file loading issue
- *fix waveform delay display issue after trigger
- *fix crash issue when enable/disable channels
- *fix vertical position moving issue under stop state
- *fix window background rendering issue
+ * fix dsl file loading issue
+ * fix waveform delay display issue after trigger
+ * fix crash issue when enable/disable channels
+ * fix vertical position moving issue under stop state
+ * fix window background rendering issue
0.96 (2016-08-12)
-----------------
--common
- *change color matching of UI
- *fix memory leakage issues
- *improve stability of usb transfer
- *add new hardware support
- *improve interaction of mouse operations
- *improve stability of multi-thread operations
- *change usb driver under windows system
- *add path memory for file operations
- *custom windows title of UI
- *change path of setting files, avoid authority issues
+ * change color matching of UI
+ * fix memory leakage issues
+ * improve stability of usb transfer
+ * add new hardware support
+ * improve interaction of mouse operations
+ * improve stability of multi-thread operations
+ * change usb driver under windows system
+ * add path memory for file operations
+ * custom windows title of UI
+ * change path of setting files, avoid authority issues
--for logic analyzer
- *add list viewer for results of protocol decoders
- *add search function for protocol list viewer
- *add file export for results of protocol decoders
- *improve speed and memory usage of protocol decoders
- *improve protocol decoders scripts (i2c, uart, spi already done)
- *add start and end settings for protocol decoders
- *improve serial trigger, add counter for serial value
- *improve display and settings for protocol decoders
- *add display of trigger time
- *add multi-row search for protocol list viewer
- *add trigger position and time for file save
+ * add list viewer for results of protocol decoders
+ * add search function for protocol list viewer
+ * add file export for results of protocol decoders
+ * improve speed and memory usage of protocol decoders
+ * improve protocol decoders scripts (i2c, uart, spi already done)
+ * add start and end settings for protocol decoders
+ * improve serial trigger, add counter for serial value
+ * improve display and settings for protocol decoders
+ * add display of trigger time
+ * add multi-row search for protocol list viewer
+ * add trigger position and time for file save
--for oscilloscope
- *add FFT function for signal analyzer
- *add auto/trigger shift function
- *improve zero adjustment program
- *add manual zero adjustment
- *add gain adjustment for each vdiv
- *fix signal display issue when resize window
- *fix crash issue when change measure settings
- *fix run-without-display issue
- *add trigger sensitivity setting
- *add display of trigger status
- *fix measure setting reset issue
+ * add FFT function for signal analyzer
+ * add auto/trigger shift function
+ * improve zero adjustment program
+ * add manual zero adjustment
+ * add gain adjustment for each vdiv
+ * fix signal display issue when resize window
+ * fix crash issue when change measure settings
+ * fix run-without-display issue
+ * add trigger sensitivity setting
+ * add display of trigger status
+ * fix measure setting reset issue
0.95 (2015-12-14)
-----------------
- --for logic analyzer
- *add RLE compress mode
- *improve mode setting strategy, fix channel number
- *add edge count function
- *fix memory leakage when run protocol decoder
- *add signal height setting, improve display issue
- *fix crash issue when add group signal
- *fix channel enable/disable issue
- *fix channel display issue when load file input
- *add cursor by mouse double-click
- *fix other issues
+ --for logic analyzer
+ * add RLE compress mode
+ * improve mode setting strategy, fix channel number
+ * add edge count function
+ * fix memory leakage when running protocol decoder
+ * add signal height setting, improve display issue
+ * fix crash issue when adding group signal
+ * fix channel enable/disable issue
+ * fix channel display issue when load file input
+ * add cursor by mouse double-click
+ * fix other issues
- --for oscilloscope
- *add file export/load function
- *fix wait time issue when trigger setted
- *improve display of signal measure
- *add Vrms/Vmean/Vp-p measure
- *fix setting issue when load session
- *imporve add/del of measure ruler
- *fix other issues
+ --for oscilloscope
+ * add file export/load function
+ * fix wait time issue when trigger set
+ * improve display of signal measure
+ * add Vrms/Vmean/Vp-p measure
+ * fix setting issue when loading session
+ * improve add/del of measure ruler
+ * fix other issues
0.94 (2015-06-29)
-----------------
- * add session load/store function
- * add drag-and-drop effect in viewport window
- * improve display effect of dock windows, add scroll bar
- * fix other GUI issues
+ * add session load/store function
+ * add drag-and-drop effect in viewport window
+ * improve display effect of dock windows, add scroll bar
+ * fix other GUI issues
- --for logic analyzer
- * upgrade advance trigger counter from 16bit to 32bit
- * add serial trigger function
- * fix memory leakage issue when load *.dsl files
- * fix delete group signal issue when no data captured
+ --for logic analyzer
+ * upgrade advance trigger counter from 16bit to 32bit
+ * add serial trigger function
+ * fix memory leakage issue when loading *.dsl files
+ * fix delete group signal issue when no data captured
- --for oscilloscope
- * add measurement of width, period, frequency and duty cycle
- * fix instant capture issue @ demo mode
- * add trigger hold-off time function
- * fix channels enable/disable issue
- * fix data error issue of instant capture before normal capture
- * fix trigger position issue when only one channel enabled
- * fix trigger level can't be changed issue when only one channel enabled
+ --for oscilloscope
+ * add measurement of width, period, frequency and duty cycle
+ * fix instant capture issue @ demo mode
+ * add trigger hold-off time function
+ * fix channels enable/disable issue
+ * fix data error issue of instant capture before normal capture
+ * fix trigger position issue when only one channel enabled
+ * fix trigger level can't be changed issue when only one channel enabled
0.93 (2015-05-08)
-----------------
- * Upgrade to qt5 library
- * Support stdc++11
- * Improve measure function @ LA mode
- * Add duty cycle measure @ LA mode
- * Fix out of range issue @ LA mode
- * Add export function, support csv/vcd/gnuplot/zip @ LA mode; and csv @ DSO mode
- * Add x1/x10/x100 probe options @ DSO mode
- * Add measure function @ DSO mode
- * Add voltage display of trigger value @ DSO mode
- * Fix wave disappear issue @ DSO mode
- * Fix trigger issue @ DSO stream mode
- * Fix data repeat when set trigger @ LA stream mode
- * Keep channel settings when reload occurred @ LA mode
- * Fix decoder issue when capture part of data @ LA mode
- * Fix stack decoder add issue @ LA mode
- * Fix other bugs
+ * Upgrade to qt5 library
+ * Support stdc++11
+ * Improve measure function @ LA mode
+ * Add duty cycle measure @ LA mode
+ * Fix out of range issue @ LA mode
+ * Add export function, support csv/vcd/gnuplot/zip @ LA mode; and csv @ DSO mode
+ * Add x1/x10/x100 probe options @ DSO mode
+ * Add measure function @ DSO mode
+ * Add voltage display of trigger value @ DSO mode
+ * Fix wave disappear issue @ DSO mode
+ * Fix trigger issue @ DSO stream mode
+ * Fix data repeat when set trigger @ LA stream mode
+ * Keep channel settings when reload occurred @ LA mode
+ * Fix decoder issue when capture part of data @ LA mode
+ * Fix stack decoder add issue @ LA mode
+ * Fix other bugs
0.92 (2015-04-15)
-----------------
- * Add DSLogic Pro and DSCope support
- * Add Stream mode to DSLogic & DSLogic Pro
- * Support up to 1G samples @ LA mode
- * Add zero adjustment @ Oscilloscope mode
- * Support zero skew parameters restore
- * Enhance stbility
- * Fix other bugs
+ * Add DSLogic Pro and DSCope support
+ * Add Stream mode to DSLogic & DSLogic Pro
+ * Support up to 1G samples @ LA mode
+ * Add zero adjustment @ Oscilloscope mode
+ * Support zero skew parameters restore
+ * Enhance stability
+ * Fix other bugs
0.4 (2014-09-24)
-----------------
- * Add protocol decoders (38) support
- * Improve the hardware configuration under various platforms
- * Add different thresholds support
- * Add options for input filter under logic analyzer mode
- * Add instant capture(trigger ignore) under logic analyzer mode
- * Ad detail capture status display under logic abrary
- * Support stdc++11
- * Improve measure function @ LA mode
- * Add duty cycle measure @ LA mode
- * Fix out of range issue @ LA mode
- * Add export function, support csv/vcd/gnuplot/zip @ LA mode; and csv @ DSO mode
- * Add x1/x10/x100 probe options @ DSO mode
- * Add measure function @ DSO mode
- * Add voltage display of trigger value @ DSO mode
- * Fix wave disappear issue @ DSO mode
- * Fix trigger issue @ DSO stream mode
- * Fix data repeat when set trigger @ LA stream mode
- * Keep channel settings when reload occurred @ LA mode
- * Fix decoder issue when capture part of data @ LA mode
- * Fix stack decoder add issue @ LA mode
- * Fix other bugsnalyzer mode
- * Add quick button for mode shift
- * Redesign the GUI for oscilloscope
- * Add flexible sample rate support under oscilloscope mode
- * Fix trigger value setting issue
- * Improve trigger method under oscilloscope mode
- * Add shortcut keys for major operations
- * Fix other bugs
+ * Add protocol decoders (38) support
+ * Improve the hardware configuration under various platforms
+ * Add different thresholds support
+ * Add options for input filter under logic analyzer mode
+ * Add instant capture(trigger ignore) under logic analyzer mode
+ * Ad detail capture status display under logic abrary
+ * Support stdc++11
+ * Improve measure function @ LA mode
+ * Add duty cycle measure @ LA mode
+ * Fix out of range issue @ LA mode
+ * Add export function, support csv/vcd/gnuplot/zip @ LA mode; and csv @ DSO mode
+ * Add x1/x10/x100 probe options @ DSO mode
+ * Add measure function @ DSO mode
+ * Add voltage display of trigger value @ DSO mode
+ * Fix wave disappear issue @ DSO mode
+ * Fix trigger issue @ DSO stream mode
+ * Fix data repeat when set trigger @ LA stream mode
+ * Keep channel settings when reload occurred @ LA mode
+ * Fix decoder issue when capture part of data @ LA mode
+ * Fix stack decoder add issue @ LA mode
+ * Fix other bugsnalyzer mode
+ * Add quick button for mode shift
+ * Redesign the GUI for oscilloscope
+ * Add flexible sample rate support under oscilloscope mode
+ * Fix trigger value setting issue
+ * Improve trigger method under oscilloscope mode
+ * Add shortcut keys for major operations
+ * Fix other bugs
0.3 (2014-06-29)
-----------------
- * Add DSLogic Oscilloscope module support.
- * Fix data display issue when not all channels be enabled.
- * Fix issue of data mirrored to other channels.
- * Fix radiobutton/checkbox display issue under certain windows theme.
- * Add new simple trigger type
- * Fix bugs of trigger setting and detection
- * Fix other minior issues.
- * Clean up the git repository
+ * Add DSLogic Oscilloscope module support.
+ * Fix data display issue when not all channels are enabled.
+ * Fix issue of data mirrored to other channels.
+ * Fix radiobutton/checkbox display issue under certain windows theme.
+ * Add new simple trigger type
+ * Fix bugs of trigger setting and detection
+ * Fix other minor issues.
+ * Clean up the git repository
0.2.1 (2014-05-08)
------------------
- * Add wireless extension hardware support.
- * Fix libusb_error_io issue on Linux when sample rate >= 100MHz.
- * Fix channel enable/disable bug.
- * Fix device options config issue.
- * Fix some display issues of UI.
+ * Add wireless extension hardware support.
+ * Fix libusb_error_io issue on Linux when sample rate >= 100MHz.
+ * Fix channel enable/disable bug.
+ * Fix device options config issue.
+ * Fix some display issues of UI.
0.2.0 (2014-04-13)
------------------
- * Add DSLogic hardware support.
+ * Add DSLogic hardware support.
0.1.0 (2013-12-15)
------------------
- * Initial release.
+ * Initial release.
-
-
-
diff --git a/libsigrok4DSL/configure.ac b/libsigrok4DSL/configure.ac
index 1b00cca8..a413d6eb 100644
--- a/libsigrok4DSL/configure.ac
+++ b/libsigrok4DSL/configure.ac
@@ -48,6 +48,7 @@ CFLAGS="$CFLAGS -Wall -Wextra -fvisibility=hidden -ludev -Wl,--rpath=/usr/local/
# Checks for programs.
AC_PROG_CC
+AC_PROG_CC_STDC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
diff --git a/libsigrokdecode4DSL/decoders/cjtag_oscan1/__init__.py b/libsigrokdecode4DSL/decoders/cjtag_oscan1/__init__.py
new file mode 100755
index 00000000..ca3fc839
--- /dev/null
+++ b/libsigrokdecode4DSL/decoders/cjtag_oscan1/__init__.py
@@ -0,0 +1,35 @@
+##
+## This file is part of the libsigrokdecode project.
+##
+## Copyright (C) 2012 Uwe Hermann
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+##
+
+'''
+JTAG (Joint Test Action Group), a.k.a. "IEEE 1149.1: Standard Test Access Port
+and Boundary-Scan Architecture", is a protocol used for testing, debugging,
+and flashing various digital ICs.
+
+Details:
+https://en.wikipedia.org/wiki/Joint_Test_Action_Group
+http://focus.ti.com/lit/an/ssya002c/ssya002c.pdf
+
+This decoders handles a tiny part of IEEE 1149.7, the so called CJTAG OSCAN1
+format
+http://developers-club.com/posts/237885/
+'''
+
+from .pd import Decoder
diff --git a/libsigrokdecode4DSL/decoders/cjtag_oscan1/pd.py b/libsigrokdecode4DSL/decoders/cjtag_oscan1/pd.py
new file mode 100755
index 00000000..251e6e3c
--- /dev/null
+++ b/libsigrokdecode4DSL/decoders/cjtag_oscan1/pd.py
@@ -0,0 +1,298 @@
+##
+## Copyright (C) 2018 Sebastien Riou
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+##
+
+import sigrokdecode as srd
+
+jtag_states = [
+ # Intro "tree"
+ 'TEST-LOGIC-RESET', 'RUN-TEST/IDLE',
+ # DR "tree"
+ 'SELECT-DR-SCAN', 'CAPTURE-DR', 'UPDATE-DR', 'PAUSE-DR',
+ 'SHIFT-DR', 'EXIT1-DR', 'EXIT2-DR',
+ # IR "tree"
+ 'SELECT-IR-SCAN', 'CAPTURE-IR', 'UPDATE-IR', 'PAUSE-IR',
+ 'SHIFT-IR', 'EXIT1-IR', 'EXIT2-IR',
+]
+
+oscan1_phases = ['nTDI','TMS','TDO']
+
+class Decoder(srd.Decoder):
+ api_version = 2
+ id = 'cjtag_oscan1'
+ name = 'CJTAG OSCAN1'
+ longname = 'Joint Test Action Group (IEEE 1149.7 OSCAN1)'
+ desc = 'Protocol for testing, debugging, and flashing ICs.'
+ license = 'gplv2+'
+ inputs = ['logic']
+ outputs = ['jtag']
+ channels = (
+ {'id': 'tck', 'name': 'TCK', 'desc': 'Test clock'},
+ {'id': 'tms', 'name': 'TMS', 'desc': 'Test mode select'},
+ )
+ annotations = tuple([tuple([s.lower(), s]) for s in oscan1_phases]) + tuple([tuple([s.lower(), s]) for s in jtag_states])
+ others = ( \
+ ('bit-tdi', 'Bit (TDI)'),
+ ('bit-tdo', 'Bit (TDO)'),
+ ('bitstring-tdi', 'Bitstring (TDI)'),
+ ('bitstring-tdo', 'Bitstring (TDO)'),
+ )
+ annotation_rows = (
+ # ('bits-tdi', 'Bits (TDI)', (16,)),
+ # ('bits-tdo', 'Bits (TDO)', (17,)),
+ # ('bitstrings-tdi', 'Bitstring (TDI)', (18,)),
+ # ('bitstrings-tdo', 'Bitstring (TDO)', (19,)),
+ ('oscan1-phase', 'OSCAN1 phase', tuple(range(0,0+3)) ),
+ ('states', 'States', tuple(range(3,3+15+1))),
+
+ )
+
+ def __init__(self):
+ self.state = 'RUN-TEST/IDLE'
+ self.phase = 'nTDI'
+ self.oldstate = None
+ self.oldpins = (-1, -1, -1, -1)
+ self.oldtck = -1
+ self.bits_tdi = []
+ self.bits_tdo = []
+ self.bits_samplenums_tdi = []
+ self.bits_samplenums_tdo = []
+ self.samplenum = 0
+ self.ss_item = self.es_item = None
+ self.ss_bitstring = self.es_bitstring = None
+ self.last_clock_samplenum = None
+ self.saved_item = None
+ self.first = True
+ self.first_bit = True
+ self.bits_cnt = 0
+ self.data_ready = False
+
+ def start(self):
+ self.out_python = self.register(srd.OUTPUT_PYTHON)
+ self.out_ann = self.register(srd.OUTPUT_ANN)
+
+ def putx(self, data):
+ self.put(self.ss_item, self.es_item, self.out_ann, data)
+
+ def putp(self, data):
+ self.put(self.ss_item, self.es_item, self.out_python, data)
+
+ def putx_bs(self, data):
+ self.put(self.ss_bitstring, self.es_bitstring, self.out_ann, data)
+
+ def putp_bs(self, data):
+ self.put(self.ss_bitstring, self.es_bitstring, self.out_python, data)
+
+ def advance_state_machine(self, tms):
+ self.oldstate = self.state
+
+ # Intro "tree"
+ if self.state == 'TEST-LOGIC-RESET':
+ # self.state = 'TEST-LOGIC-RESET' if (tms) else 'RUN-TEST/IDLE'
+ # if we reach this state we are not in OSCAN1 anymore. Since we don't handle anything else we stay in this state to show clearly the failure
+ self.state = 'TEST-LOGIC-RESET'
+ elif self.state == 'RUN-TEST/IDLE':
+ self.state = 'SELECT-DR-SCAN' if (tms) else 'RUN-TEST/IDLE'
+
+ # DR "tree"
+ elif self.state == 'SELECT-DR-SCAN':
+ self.state = 'SELECT-IR-SCAN' if (tms) else 'CAPTURE-DR'
+ elif self.state == 'CAPTURE-DR':
+ self.state = 'EXIT1-DR' if (tms) else 'SHIFT-DR'
+ elif self.state == 'SHIFT-DR':
+ self.state = 'EXIT1-DR' if (tms) else 'SHIFT-DR'
+ elif self.state == 'EXIT1-DR':
+ self.state = 'UPDATE-DR' if (tms) else 'PAUSE-DR'
+ elif self.state == 'PAUSE-DR':
+ self.state = 'EXIT2-DR' if (tms) else 'PAUSE-DR'
+ elif self.state == 'EXIT2-DR':
+ self.state = 'UPDATE-DR' if (tms) else 'SHIFT-DR'
+ elif self.state == 'UPDATE-DR':
+ self.state = 'SELECT-DR-SCAN' if (tms) else 'RUN-TEST/IDLE'
+
+ # IR "tree"
+ elif self.state == 'SELECT-IR-SCAN':
+ self.state = 'TEST-LOGIC-RESET' if (tms) else 'CAPTURE-IR'
+ elif self.state == 'CAPTURE-IR':
+ self.state = 'EXIT1-IR' if (tms) else 'SHIFT-IR'
+ elif self.state == 'SHIFT-IR':
+ self.state = 'EXIT1-IR' if (tms) else 'SHIFT-IR'
+ elif self.state == 'EXIT1-IR':
+ self.state = 'UPDATE-IR' if (tms) else 'PAUSE-IR'
+ elif self.state == 'PAUSE-IR':
+ self.state = 'EXIT2-IR' if (tms) else 'PAUSE-IR'
+ elif self.state == 'EXIT2-IR':
+ self.state = 'UPDATE-IR' if (tms) else 'SHIFT-IR'
+ elif self.state == 'UPDATE-IR':
+ self.state = 'SELECT-DR-SCAN' if (tms) else 'RUN-TEST/IDLE'
+
+ def handle_rising_tck_edge(self, tck, tms):
+
+ if self.phase == 'nTDI':
+ self.tdi = 1-tms
+ if self.first:
+ # Save the start sample and item for later (no output yet).
+ self.ss_item = self.samplenum
+ self.first = False
+ elif self.phase == 'TMS':
+ self.tms = tms
+ elif self.phase == 'TDO':
+ self.tdo = tms
+ self.advance_state_machine(self.tms)
+
+ # Output the saved item (from the last CLK edge to the current).
+ self.es_item = self.samplenum
+ if self.ss_item is not None:
+ # Output the old state (from last rising TCK edge to current one).
+ self.putx([3+jtag_states.index(self.oldstate), [self.oldstate]])
+ # self.putp(['NEW STATE', self.state])
+
+ self.ss_item = self.samplenum
+
+ if 0:
+ # Upon SHIFT-IR/SHIFT-DR collect the current TDI/TDO values.
+ if self.state.startswith('SHIFT-'):
+ if self.bits_cnt > 0:
+ if self.bits_cnt == 1:
+ self.ss_bitstring = self.samplenum
+
+ if self.bits_cnt > 1:
+ self.putx([16, [str(self.bits_tdi[0])]])
+ self.putx([17, [str(self.bits_tdo[0])]])
+ # Use self.samplenum as ES of the previous bit.
+ self.bits_samplenums_tdi[0][1] = self.samplenum
+ self.bits_samplenums_tdo[0][1] = self.samplenum
+
+ self.bits_tdi.insert(0, tdi)
+ self.bits_tdo.insert(0, tdo)
+
+ # Use self.samplenum as SS of the current bit.
+ self.bits_samplenums_tdi.insert(0, [self.samplenum, -1])
+ self.bits_samplenums_tdo.insert(0, [self.samplenum, -1])
+
+ self.bits_cnt = self.bits_cnt + 1
+
+ # Output all TDI/TDO bits if we just switched from SHIFT-* to EXIT1-*.
+ if self.oldstate.startswith('SHIFT-') and \
+ self.state.startswith('EXIT1-'):
+
+ #self.es_bitstring = self.samplenum
+ if self.bits_cnt > 0:
+ if self.bits_cnt == 1: # Only shift one bit
+ self.ss_bitstring = self.samplenum
+ self.bits_tdi.insert(0, tdi)
+ self.bits_tdo.insert(0, tdo)
+ ## Use self.samplenum as SS of the current bit.
+ self.bits_samplenums_tdi.insert(0, [self.samplenum, -1])
+ self.bits_samplenums_tdo.insert(0, [self.samplenum, -1])
+ else:
+ ### ----------------------------------------------------------------
+ self.putx([16, [str(self.bits_tdi[0])]])
+ self.putx([17, [str(self.bits_tdo[0])]])
+ ### Use self.samplenum as ES of the previous bit.
+ self.bits_samplenums_tdi[0][1] = self.samplenum
+ self.bits_samplenums_tdo[0][1] = self.samplenum
+
+ self.bits_tdi.insert(0, tdi)
+ self.bits_tdo.insert(0, tdo)
+
+ ## Use self.samplenum as SS of the current bit.
+ self.bits_samplenums_tdi.insert(0, [self.samplenum, -1])
+ self.bits_samplenums_tdo.insert(0, [self.samplenum, -1])
+ ## ----------------------------------------------------------------
+
+ self.data_ready = True
+
+ self.first_bit = True
+ self.bits_cnt = 0
+ if self.oldstate.startswith('EXIT'):
+ if self.data_ready:
+ self.data_ready = False
+ self.es_bitstring = self.samplenum
+ t = self.state[-2:] + ' TDI'
+ b = ''.join(map(str, self.bits_tdi))
+ h = ' (0x%X' % int('0b' + b, 2) + ')'
+ s = t + ': ' + h + ', ' + str(len(self.bits_tdi)) + ' bits' #b +
+ self.putx_bs([18, [s]])
+ self.bits_samplenums_tdi[0][1] = self.samplenum # ES of last bit.
+ self.putp_bs([t, [b, self.bits_samplenums_tdi]])
+ self.putx([16, [str(self.bits_tdi[0])]]) # Last bit.
+ self.bits_tdi = []
+ self.bits_samplenums_tdi = []
+
+ t = self.state[-2:] + ' TDO'
+ b = ''.join(map(str, self.bits_tdo))
+ h = ' (0x%X' % int('0b' + b, 2) + ')'
+ s = t + ': ' + h + ', ' + str(len(self.bits_tdo)) + ' bits' #+ b
+ self.putx_bs([19, [s]])
+ self.bits_samplenums_tdo[0][1] = self.samplenum # ES of last bit.
+ self.putp_bs([t, [b, self.bits_samplenums_tdo]])
+ self.putx([17, [str(self.bits_tdo[0])]]) # Last bit.
+ self.bits_tdo = []
+ self.bits_samplenums_tdo = []
+
+
+ def handle_falling_tck_edge(self, tck, tms):
+
+ if self.phase == 'nTDI':
+ next_phase = 'TMS'
+ elif self.phase == 'TMS':
+ next_phase = 'TDO'
+ elif self.phase == 'TDO':
+ next_phase = 'nTDI'
+
+ if self.last_clock_samplenum is not None:
+ self.put(self.last_clock_samplenum, self.samplenum, self.out_ann, [0+oscan1_phases.index(self.phase), [self.phase]])
+
+ self.last_clock_samplenum = self.samplenum
+ self.phase = next_phase
+
+ def decode(self, ss, es, logic):
+ for (self.samplenum, pins) in logic:
+ logic.logic_mask = 0b11
+ logic.cur_pos = self.samplenum
+ logic.edge_index = -1
+
+ if self.last_clock_samplenum is None:
+ self.last_clock_samplenum = self.samplenum
+ elif self.last_clock_samplenum >= self.samplenum:
+ continue
+
+ # If none of the pins changed, there's nothing to do.
+ if self.oldpins == pins:
+ continue
+
+ # Store current pin values for the next round.
+ self.oldpins = pins
+
+ # Get individual pin values into local variables.
+ # Unused channels will have a value of > 1.
+ ( tck, tms) = pins
+
+ # We only care about TCK edges (either rising or falling).
+ if (self.oldtck == tck):
+ continue
+
+ # Store start/end sample for later usage.
+ self.ss, self.es = ss, es
+
+ if (self.oldtck == 0 and tck == 1):
+ self.handle_rising_tck_edge( tck, tms)
+ elif (self.oldtck == 1 and tck == 0):
+ self.handle_falling_tck_edge( tck, tms)
+
+ self.oldtck = tck