logic-agent-mcp 0.0.0-stage → 1.3.0
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.
- package/API.cmd +5 -0
- package/CAPTURE.cmd +8 -0
- package/CHECK.cmd +7 -0
- package/FIRMWARE-RECOVER.cmd +6 -0
- package/FIRMWARE-STATUS.cmd +8 -0
- package/INSTALL-DRIVER.cmd +6 -0
- package/INSTALL-MCP.cmd +16 -0
- package/LICENSE +31 -0
- package/MCP.cmd +5 -0
- package/README.md +127 -2
- package/SELF-TEST.cmd +6 -0
- package/THIRD-PARTY-NOTICES.md +32 -0
- package/VERIFY-FILES.cmd +6 -0
- package/VERSION.txt +17 -0
- package/VIEW.cmd +16 -0
- package/checksums.sha256 +449 -0
- package/docs/DRIVER.md +54 -0
- package/docs/DSLOGIC-PLUS.md +180 -0
- package/docs/FIRMWARE.md +53 -0
- package/docs/INSTALL.md +74 -0
- package/docs/MCP-CLIENTS.md +213 -0
- package/docs/PROTOCOLS.md +200 -0
- package/docs/TROUBLESHOOTING.md +41 -0
- package/docs/UPSTREAM-SYNC.md +141 -0
- package/docs/WAVEFORM-VIEWER.md +48 -0
- package/firmware/DSLogicPlus.fw +0 -0
- package/firmware/LICENSE-DreamSourceLab.txt +20 -0
- package/launcher/logic-agent-mcp.mjs +106 -0
- package/package.json +56 -6
- package/runtime/app/logic_agent/__init__.py +4 -0
- package/runtime/app/logic_agent/analysis.py +84 -0
- package/runtime/app/logic_agent/backends/__init__.py +7 -0
- package/runtime/app/logic_agent/backends/base.py +37 -0
- package/runtime/app/logic_agent/backends/dslab.py +278 -0
- package/runtime/app/logic_agent/backends/mock.py +101 -0
- package/runtime/app/logic_agent/backends/sigrok.py +252 -0
- package/runtime/app/logic_agent/cli.py +387 -0
- package/runtime/app/logic_agent/decoders.py +868 -0
- package/runtime/app/logic_agent/errors.py +50 -0
- package/runtime/app/logic_agent/importer.py +129 -0
- package/runtime/app/logic_agent/mcp_clients.py +956 -0
- package/runtime/app/logic_agent/mcp_server.py +345 -0
- package/runtime/app/logic_agent/models.py +150 -0
- package/runtime/app/logic_agent/protocols.py +233 -0
- package/runtime/app/logic_agent/service.py +378 -0
- package/runtime/app/logic_agent/signal.py +206 -0
- package/runtime/app/logic_agent/store.py +197 -0
- package/runtime/bin/_bz2.pyd +0 -0
- package/runtime/bin/_ctypes.pyd +0 -0
- package/runtime/bin/_decimal.pyd +0 -0
- package/runtime/bin/_elementtree.pyd +0 -0
- package/runtime/bin/_hashlib.pyd +0 -0
- package/runtime/bin/_lzma.pyd +0 -0
- package/runtime/bin/_multiprocessing.pyd +0 -0
- package/runtime/bin/_socket.pyd +0 -0
- package/runtime/bin/_sqlite3.pyd +0 -0
- package/runtime/bin/_ssl.pyd +0 -0
- package/runtime/bin/dslab.exe +0 -0
- package/runtime/bin/libglib-2.0-0.dll +0 -0
- package/runtime/bin/libiconv-2.dll +0 -0
- package/runtime/bin/libintl-8.dll +0 -0
- package/runtime/bin/libpcre2-8-0.dll +0 -0
- package/runtime/bin/libusb-1.0.dll +0 -0
- package/runtime/bin/libwinpthread-1.dll +0 -0
- package/runtime/bin/libz-1.dll +0 -0
- package/runtime/bin/msvcp100.dll +0 -0
- package/runtime/bin/msvcr100.dll +0 -0
- package/runtime/bin/pyexpat.pyd +0 -0
- package/runtime/bin/python34.dll +0 -0
- package/runtime/bin/python34.zip +0 -0
- package/runtime/bin/res/DSCope.bin +0 -0
- package/runtime/bin/res/DSCope.fw +0 -0
- package/runtime/bin/res/DSCope1.def.dsc +88 -0
- package/runtime/bin/res/DSCope2.def.dsc +54 -0
- package/runtime/bin/res/DSCope20.bin +0 -0
- package/runtime/bin/res/DSCope20.fw +0 -0
- package/runtime/bin/res/DSCopeC20B.bin +0 -0
- package/runtime/bin/res/DSCopeC20P.bin +0 -0
- package/runtime/bin/res/DSCopeU2B100.bin +0 -0
- package/runtime/bin/res/DSCopeU2B20.bin +0 -0
- package/runtime/bin/res/DSCopeU2P20.bin +0 -0
- package/runtime/bin/res/DSCopeU3P100.bin +0 -0
- package/runtime/bin/res/DSLogic.fw +0 -0
- package/runtime/bin/res/DSLogic0.def.dsc +297 -0
- package/runtime/bin/res/DSLogic1.def.dsc +82 -0
- package/runtime/bin/res/DSLogic2.def.dsc +52 -0
- package/runtime/bin/res/DSLogic33.bin +0 -0
- package/runtime/bin/res/DSLogic50.bin +0 -0
- package/runtime/bin/res/DSLogicBasic.bin +0 -0
- package/runtime/bin/res/DSLogicPlus-pgl12-2.bin +0 -0
- package/runtime/bin/res/DSLogicPlus-pgl12.bin +0 -0
- package/runtime/bin/res/DSLogicPlus.bin +0 -0
- package/runtime/bin/res/DSLogicPlus.fw +0 -0
- package/runtime/bin/res/DSLogicPro.bin +0 -0
- package/runtime/bin/res/DSLogicPro.fw +0 -0
- package/runtime/bin/res/DSLogicU2Basic-pgl12-2.bin +0 -0
- package/runtime/bin/res/DSLogicU2Basic-pgl12.bin +0 -0
- package/runtime/bin/res/DSLogicU2Basic.bin +0 -0
- package/runtime/bin/res/DSLogicU2Pro16.bin +0 -0
- package/runtime/bin/res/DSLogicU3Pro16.bin +0 -0
- package/runtime/bin/res/DSLogicU3Pro32.bin +0 -0
- package/runtime/bin/res/license.txt +20 -0
- package/runtime/bin/res/virtual-demo1.dsc +68 -0
- package/runtime/bin/select.pyd +0 -0
- package/runtime/bin/sigrok-cli.exe +0 -0
- package/runtime/bin/unicodedata.pyd +0 -0
- package/runtime/bin/winsound.pyd +0 -0
- package/runtime/decoders/ac97/__init__.py +38 -0
- package/runtime/decoders/ac97/pd.py +477 -0
- package/runtime/decoders/ad5626/__init__.py +25 -0
- package/runtime/decoders/ad5626/pd.py +62 -0
- package/runtime/decoders/ad79x0/__init__.py +25 -0
- package/runtime/decoders/ad79x0/pd.py +137 -0
- package/runtime/decoders/ade77xx/__init__.py +31 -0
- package/runtime/decoders/ade77xx/lists.py +102 -0
- package/runtime/decoders/ade77xx/pd.py +131 -0
- package/runtime/decoders/adf435x/__init__.py +29 -0
- package/runtime/decoders/adf435x/pd.py +230 -0
- package/runtime/decoders/adns5020/__init__.py +27 -0
- package/runtime/decoders/adns5020/pd.py +116 -0
- package/runtime/decoders/adxl345/__init__.py +26 -0
- package/runtime/decoders/adxl345/lists.py +96 -0
- package/runtime/decoders/adxl345/pd.py +453 -0
- package/runtime/decoders/am230x/__init__.py +36 -0
- package/runtime/decoders/am230x/pd.py +229 -0
- package/runtime/decoders/amulet_ascii/__init__.py +28 -0
- package/runtime/decoders/amulet_ascii/lists.py +73 -0
- package/runtime/decoders/amulet_ascii/pd.py +699 -0
- package/runtime/decoders/arm_etmv3/__init__.py +25 -0
- package/runtime/decoders/arm_etmv3/pd.py +567 -0
- package/runtime/decoders/arm_itm/__init__.py +25 -0
- package/runtime/decoders/arm_itm/pd.py +373 -0
- package/runtime/decoders/arm_tpiu/__init__.py +28 -0
- package/runtime/decoders/arm_tpiu/pd.py +131 -0
- package/runtime/decoders/atsha204a/__init__.py +30 -0
- package/runtime/decoders/atsha204a/pd.py +323 -0
- package/runtime/decoders/aud/__init__.py +31 -0
- package/runtime/decoders/aud/pd.py +108 -0
- package/runtime/decoders/avr_isp/__init__.py +25 -0
- package/runtime/decoders/avr_isp/parts.py +163 -0
- package/runtime/decoders/avr_isp/pd.py +278 -0
- package/runtime/decoders/avr_pdi/__init__.py +42 -0
- package/runtime/decoders/avr_pdi/pd.py +574 -0
- package/runtime/decoders/caliper/__init__.py +36 -0
- package/runtime/decoders/caliper/pd.py +146 -0
- package/runtime/decoders/can/__init__.py +31 -0
- package/runtime/decoders/can/pd.py +519 -0
- package/runtime/decoders/cc1101/__init__.py +28 -0
- package/runtime/decoders/cc1101/lists.py +115 -0
- package/runtime/decoders/cc1101/pd.py +294 -0
- package/runtime/decoders/cec/__init__.py +25 -0
- package/runtime/decoders/cec/pd.py +311 -0
- package/runtime/decoders/cec/protocoldata.py +117 -0
- package/runtime/decoders/cfp/__init__.py +34 -0
- package/runtime/decoders/cfp/pd.py +110 -0
- package/runtime/decoders/cjtag/__init__.py +36 -0
- package/runtime/decoders/cjtag/pd.py +323 -0
- package/runtime/decoders/common/__init__.py +19 -0
- package/runtime/decoders/common/plugtrx/__init__.py +20 -0
- package/runtime/decoders/common/plugtrx/mod.py +192 -0
- package/runtime/decoders/common/sdcard/__init__.py +20 -0
- package/runtime/decoders/common/sdcard/mod.py +150 -0
- package/runtime/decoders/common/srdhelper/__init__.py +20 -0
- package/runtime/decoders/common/srdhelper/mod.py +98 -0
- package/runtime/decoders/counter/__init__.py +28 -0
- package/runtime/decoders/counter/pd.py +145 -0
- package/runtime/decoders/dali/__init__.py +24 -0
- package/runtime/decoders/dali/lists.py +98 -0
- package/runtime/decoders/dali/pd.py +244 -0
- package/runtime/decoders/dcf77/__init__.py +28 -0
- package/runtime/decoders/dcf77/pd.py +311 -0
- package/runtime/decoders/dmx512/__init__.py +25 -0
- package/runtime/decoders/dmx512/pd.py +361 -0
- package/runtime/decoders/ds1307/__init__.py +25 -0
- package/runtime/decoders/ds1307/pd.py +270 -0
- package/runtime/decoders/ds2408/__init__.py +25 -0
- package/runtime/decoders/ds2408/pd.py +129 -0
- package/runtime/decoders/ds243x/__init__.py +25 -0
- package/runtime/decoders/ds243x/pd.py +270 -0
- package/runtime/decoders/ds28ea00/__init__.py +25 -0
- package/runtime/decoders/ds28ea00/pd.py +93 -0
- package/runtime/decoders/dsi/__init__.py +24 -0
- package/runtime/decoders/dsi/pd.py +157 -0
- package/runtime/decoders/edid/__init__.py +35 -0
- package/runtime/decoders/edid/pd.py +671 -0
- package/runtime/decoders/edid/pnpids.txt +2135 -0
- package/runtime/decoders/eeprom24xx/__init__.py +25 -0
- package/runtime/decoders/eeprom24xx/lists.py +214 -0
- package/runtime/decoders/eeprom24xx/pd.py +443 -0
- package/runtime/decoders/eeprom93xx/__init__.py +32 -0
- package/runtime/decoders/eeprom93xx/pd.py +163 -0
- package/runtime/decoders/em4100/__init__.py +24 -0
- package/runtime/decoders/em4100/pd.py +238 -0
- package/runtime/decoders/em4305/__init__.py +24 -0
- package/runtime/decoders/em4305/pd.py +394 -0
- package/runtime/decoders/enc28j60/__init__.py +32 -0
- package/runtime/decoders/enc28j60/lists.py +161 -0
- package/runtime/decoders/enc28j60/pd.py +294 -0
- package/runtime/decoders/flexray/__init__.py +32 -0
- package/runtime/decoders/flexray/pd.py +413 -0
- package/runtime/decoders/graycode/__init__.py +24 -0
- package/runtime/decoders/graycode/pd.py +197 -0
- package/runtime/decoders/guess_bitrate/__init__.py +40 -0
- package/runtime/decoders/guess_bitrate/pd.py +79 -0
- package/runtime/decoders/hdcp/__init__.py +27 -0
- package/runtime/decoders/hdcp/pd.py +191 -0
- package/runtime/decoders/i2c/__init__.py +25 -0
- package/runtime/decoders/i2c/pd.py +364 -0
- package/runtime/decoders/i2cdemux/__init__.py +27 -0
- package/runtime/decoders/i2cdemux/pd.py +80 -0
- package/runtime/decoders/i2cfilter/__init__.py +37 -0
- package/runtime/decoders/i2cfilter/pd.py +106 -0
- package/runtime/decoders/i2s/__init__.py +29 -0
- package/runtime/decoders/i2s/pd.py +179 -0
- package/runtime/decoders/ieee488/__init__.py +26 -0
- package/runtime/decoders/ieee488/pd.py +849 -0
- package/runtime/decoders/ir_irmp/__init__.py +25 -0
- package/runtime/decoders/ir_irmp/irmp_library.py +168 -0
- package/runtime/decoders/ir_irmp/pd.py +139 -0
- package/runtime/decoders/ir_nec/__init__.py +25 -0
- package/runtime/decoders/ir_nec/lists.py +93 -0
- package/runtime/decoders/ir_nec/pd.py +300 -0
- package/runtime/decoders/ir_rc5/__init__.py +24 -0
- package/runtime/decoders/ir_rc5/lists.py +93 -0
- package/runtime/decoders/ir_rc5/pd.py +182 -0
- package/runtime/decoders/ir_rc6/__init__.py +24 -0
- package/runtime/decoders/ir_rc6/pd.py +205 -0
- package/runtime/decoders/ir_sirc/__init__.py +26 -0
- package/runtime/decoders/ir_sirc/lists.py +201 -0
- package/runtime/decoders/ir_sirc/pd.py +215 -0
- package/runtime/decoders/jitter/__init__.py +29 -0
- package/runtime/decoders/jitter/pd.py +198 -0
- package/runtime/decoders/jtag/__init__.py +30 -0
- package/runtime/decoders/jtag/pd.py +235 -0
- package/runtime/decoders/jtag_ejtag/__init__.py +25 -0
- package/runtime/decoders/jtag_ejtag/pd.py +408 -0
- package/runtime/decoders/jtag_stm32/__init__.py +29 -0
- package/runtime/decoders/jtag_stm32/pd.py +269 -0
- package/runtime/decoders/lfast/__init__.py +35 -0
- package/runtime/decoders/lfast/pd.py +335 -0
- package/runtime/decoders/lin/__init__.py +28 -0
- package/runtime/decoders/lin/pd.py +247 -0
- package/runtime/decoders/lm75/__init__.py +25 -0
- package/runtime/decoders/lm75/pd.py +186 -0
- package/runtime/decoders/lpc/__init__.py +25 -0
- package/runtime/decoders/lpc/pd.py +365 -0
- package/runtime/decoders/ltc242x/__init__.py +25 -0
- package/runtime/decoders/ltc242x/pd.py +86 -0
- package/runtime/decoders/ltc26x7/__init__.py +25 -0
- package/runtime/decoders/ltc26x7/pd.py +187 -0
- package/runtime/decoders/maple_bus/__init__.py +25 -0
- package/runtime/decoders/maple_bus/pd.py +222 -0
- package/runtime/decoders/max72xx/__init__.py +25 -0
- package/runtime/decoders/max72xx/pd.py +130 -0
- package/runtime/decoders/mcp230xx/__init__.py +25 -0
- package/runtime/decoders/mcp230xx/pd.py +143 -0
- package/runtime/decoders/mcs48/__init__.py +31 -0
- package/runtime/decoders/mcs48/pd.py +126 -0
- package/runtime/decoders/mdio/__init__.py +39 -0
- package/runtime/decoders/mdio/pd.py +325 -0
- package/runtime/decoders/microwire/__init__.py +40 -0
- package/runtime/decoders/microwire/pd.py +194 -0
- package/runtime/decoders/midi/__init__.py +28 -0
- package/runtime/decoders/midi/lists.py +840 -0
- package/runtime/decoders/midi/pd.py +627 -0
- package/runtime/decoders/miller/__init__.py +26 -0
- package/runtime/decoders/miller/pd.py +190 -0
- package/runtime/decoders/mlx90614/__init__.py +25 -0
- package/runtime/decoders/mlx90614/pd.py +82 -0
- package/runtime/decoders/modbus/__init__.py +28 -0
- package/runtime/decoders/modbus/pd.py +941 -0
- package/runtime/decoders/morse/__init__.py +28 -0
- package/runtime/decoders/morse/pd.py +250 -0
- package/runtime/decoders/mrf24j40/__init__.py +25 -0
- package/runtime/decoders/mrf24j40/lists.py +165 -0
- package/runtime/decoders/mrf24j40/pd.py +188 -0
- package/runtime/decoders/mxc6225xu/__init__.py +28 -0
- package/runtime/decoders/mxc6225xu/pd.py +217 -0
- package/runtime/decoders/nes_gamepad/__init__.py +54 -0
- package/runtime/decoders/nes_gamepad/pd.py +92 -0
- package/runtime/decoders/nrf24l01/__init__.py +29 -0
- package/runtime/decoders/nrf24l01/pd.py +332 -0
- package/runtime/decoders/nrf905/__init__.py +26 -0
- package/runtime/decoders/nrf905/pd.py +301 -0
- package/runtime/decoders/numbers_and_state/__init__.py +41 -0
- package/runtime/decoders/numbers_and_state/pd.py +377 -0
- package/runtime/decoders/nunchuk/__init__.py +30 -0
- package/runtime/decoders/nunchuk/pd.py +207 -0
- package/runtime/decoders/onewire_link/__init__.py +56 -0
- package/runtime/decoders/onewire_link/pd.py +347 -0
- package/runtime/decoders/onewire_network/__init__.py +56 -0
- package/runtime/decoders/onewire_network/pd.py +185 -0
- package/runtime/decoders/ook/__init__.py +36 -0
- package/runtime/decoders/ook/pd.py +484 -0
- package/runtime/decoders/ook_oregon/__init__.py +25 -0
- package/runtime/decoders/ook_oregon/lists.py +75 -0
- package/runtime/decoders/ook_oregon/pd.py +389 -0
- package/runtime/decoders/ook_vis/__init__.py +25 -0
- package/runtime/decoders/ook_vis/pd.py +194 -0
- package/runtime/decoders/pan1321/__init__.py +25 -0
- package/runtime/decoders/pan1321/pd.py +164 -0
- package/runtime/decoders/parallel/__init__.py +45 -0
- package/runtime/decoders/parallel/pd.py +285 -0
- package/runtime/decoders/pca9571/__init__.py +25 -0
- package/runtime/decoders/pca9571/pd.py +122 -0
- package/runtime/decoders/pjdl/__init__.py +27 -0
- package/runtime/decoders/pjdl/pd.py +723 -0
- package/runtime/decoders/pjon/__init__.py +25 -0
- package/runtime/decoders/pjon/pd.py +603 -0
- package/runtime/decoders/ps2/__init__.py +26 -0
- package/runtime/decoders/ps2/pd.py +126 -0
- package/runtime/decoders/pwm/__init__.py +24 -0
- package/runtime/decoders/pwm/pd.py +167 -0
- package/runtime/decoders/qi/__init__.py +25 -0
- package/runtime/decoders/qi/pd.py +244 -0
- package/runtime/decoders/rc_encode/__init__.py +40 -0
- package/runtime/decoders/rc_encode/pd.py +215 -0
- package/runtime/decoders/rfm12/__init__.py +25 -0
- package/runtime/decoders/rfm12/pd.py +497 -0
- package/runtime/decoders/rgb_led_spi/__init__.py +25 -0
- package/runtime/decoders/rgb_led_spi/pd.py +72 -0
- package/runtime/decoders/rgb_led_ws281x/__init__.py +27 -0
- package/runtime/decoders/rgb_led_ws281x/pd.py +267 -0
- package/runtime/decoders/rtc8564/__init__.py +25 -0
- package/runtime/decoders/rtc8564/pd.py +254 -0
- package/runtime/decoders/sae_j1850_vpw/__init__.py +24 -0
- package/runtime/decoders/sae_j1850_vpw/pd.py +296 -0
- package/runtime/decoders/sbus_futaba/__init__.py +35 -0
- package/runtime/decoders/sbus_futaba/pd.py +273 -0
- package/runtime/decoders/sda2506/__init__.py +24 -0
- package/runtime/decoders/sda2506/pd.py +146 -0
- package/runtime/decoders/sdcard_sd/__init__.py +24 -0
- package/runtime/decoders/sdcard_sd/pd.py +554 -0
- package/runtime/decoders/sdcard_spi/__init__.py +68 -0
- package/runtime/decoders/sdcard_spi/pd.py +518 -0
- package/runtime/decoders/sdq/__init__.py +28 -0
- package/runtime/decoders/sdq/pd.py +131 -0
- package/runtime/decoders/seven_segment/__init__.py +24 -0
- package/runtime/decoders/seven_segment/pd.py +186 -0
- package/runtime/decoders/signature/__init__.py +25 -0
- package/runtime/decoders/signature/pd.py +142 -0
- package/runtime/decoders/sipi/__init__.py +30 -0
- package/runtime/decoders/sipi/pd.py +181 -0
- package/runtime/decoders/sle44xx/__init__.py +26 -0
- package/runtime/decoders/sle44xx/pd.py +541 -0
- package/runtime/decoders/smart_qspi/PORTING.md +22 -0
- package/runtime/decoders/smart_qspi/__init__.py +1 -0
- package/runtime/decoders/smart_qspi/pd.py +826 -0
- package/runtime/decoders/spdif/__init__.py +25 -0
- package/runtime/decoders/spdif/pd.py +295 -0
- package/runtime/decoders/spi/__init__.py +32 -0
- package/runtime/decoders/spi/pd.py +347 -0
- package/runtime/decoders/spiflash/__init__.py +30 -0
- package/runtime/decoders/spiflash/lists.py +178 -0
- package/runtime/decoders/spiflash/pd.py +537 -0
- package/runtime/decoders/ssi32/__init__.py +28 -0
- package/runtime/decoders/ssi32/pd.py +127 -0
- package/runtime/decoders/st25r39xx_spi/__init__.py +31 -0
- package/runtime/decoders/st25r39xx_spi/lists.py +231 -0
- package/runtime/decoders/st25r39xx_spi/pd.py +360 -0
- package/runtime/decoders/st7735/__init__.py +27 -0
- package/runtime/decoders/st7735/pd.py +173 -0
- package/runtime/decoders/stepper_motor/__init__.py +25 -0
- package/runtime/decoders/stepper_motor/pd.py +95 -0
- package/runtime/decoders/swd/__init__.py +34 -0
- package/runtime/decoders/swd/pd.py +350 -0
- package/runtime/decoders/swim/__init__.py +28 -0
- package/runtime/decoders/swim/pd.py +303 -0
- package/runtime/decoders/t55xx/__init__.py +25 -0
- package/runtime/decoders/t55xx/pd.py +326 -0
- package/runtime/decoders/tca6408a/__init__.py +25 -0
- package/runtime/decoders/tca6408a/pd.py +157 -0
- package/runtime/decoders/tdm_audio/__init__.py +25 -0
- package/runtime/decoders/tdm_audio/pd.py +116 -0
- package/runtime/decoders/timing/__init__.py +24 -0
- package/runtime/decoders/timing/pd.py +194 -0
- package/runtime/decoders/tlc5620/__init__.py +24 -0
- package/runtime/decoders/tlc5620/pd.py +212 -0
- package/runtime/decoders/uart/__init__.py +40 -0
- package/runtime/decoders/uart/pd.py +635 -0
- package/runtime/decoders/usb_packet/__init__.py +43 -0
- package/runtime/decoders/usb_packet/pd.py +401 -0
- package/runtime/decoders/usb_power_delivery/__init__.py +24 -0
- package/runtime/decoders/usb_power_delivery/pd.py +642 -0
- package/runtime/decoders/usb_request/__init__.py +49 -0
- package/runtime/decoders/usb_request/pd.py +386 -0
- package/runtime/decoders/usb_signalling/__init__.py +50 -0
- package/runtime/decoders/usb_signalling/pd.py +348 -0
- package/runtime/decoders/wiegand/__init__.py +28 -0
- package/runtime/decoders/wiegand/pd.py +148 -0
- package/runtime/decoders/x2444m/__init__.py +25 -0
- package/runtime/decoders/x2444m/pd.py +111 -0
- package/runtime/decoders/xfp/__init__.py +38 -0
- package/runtime/decoders/xfp/pd.py +486 -0
- package/runtime/decoders/xy2-100/__init__.py +28 -0
- package/runtime/decoders/xy2-100/pd.py +242 -0
- package/runtime/decoders/z80/__init__.py +36 -0
- package/runtime/decoders/z80/pd.py +358 -0
- package/runtime/decoders/z80/tables.py +1083 -0
- package/runtime/dslab.cmd +5 -0
- package/runtime/licenses/DreamSourceLab-res-MIT.txt +20 -0
- package/runtime/licenses/dslab-GPL-3.0.txt +674 -0
- package/runtime/licenses/logic-agent-MIT.txt +31 -0
- package/runtime/licenses/python-PSF.txt +645 -0
- package/runtime/licenses/sigrok-cli-GPL-3.0.txt +674 -0
- package/runtime/licenses/smart_qspi-PORTING.md +22 -0
- package/runtime/licenses/source/patches/dsview-v1.3.2-dslab.patch +124 -0
- package/runtime/logic-agent-mcp.cmd +9 -0
- package/runtime/logic-agent.cmd +9 -0
- package/runtime/python/LICENSE.txt +645 -0
- package/runtime/python/_asyncio.pyd +0 -0
- package/runtime/python/_bz2.pyd +0 -0
- package/runtime/python/_ctypes.pyd +0 -0
- package/runtime/python/_decimal.pyd +0 -0
- package/runtime/python/_elementtree.pyd +0 -0
- package/runtime/python/_hashlib.pyd +0 -0
- package/runtime/python/_lzma.pyd +0 -0
- package/runtime/python/_multiprocessing.pyd +0 -0
- package/runtime/python/_overlapped.pyd +0 -0
- package/runtime/python/_queue.pyd +0 -0
- package/runtime/python/_socket.pyd +0 -0
- package/runtime/python/_sqlite3.pyd +0 -0
- package/runtime/python/_ssl.pyd +0 -0
- package/runtime/python/_uuid.pyd +0 -0
- package/runtime/python/_wmi.pyd +0 -0
- package/runtime/python/_zoneinfo.pyd +0 -0
- package/runtime/python/libcrypto-3.dll +0 -0
- package/runtime/python/libffi-8.dll +0 -0
- package/runtime/python/libssl-3.dll +0 -0
- package/runtime/python/pyexpat.pyd +0 -0
- package/runtime/python/python.cat +0 -0
- package/runtime/python/python.exe +0 -0
- package/runtime/python/python3.dll +0 -0
- package/runtime/python/python313._pth +3 -0
- package/runtime/python/python313.dll +0 -0
- package/runtime/python/python313.zip +0 -0
- package/runtime/python/pythonw.exe +0 -0
- package/runtime/python/select.pyd +0 -0
- package/runtime/python/sqlite3.dll +0 -0
- package/runtime/python/unicodedata.pyd +0 -0
- package/runtime/python/vcruntime140.dll +0 -0
- package/runtime/python/vcruntime140_1.dll +0 -0
- package/runtime/python/winsound.pyd +0 -0
- package/runtime/scripts/deploy-check.ps1 +171 -0
- package/scripts/check.ps1 +14 -0
- package/scripts/firmware-recover.ps1 +27 -0
- package/scripts/install-driver.ps1 +30 -0
- package/scripts/self-test.ps1 +14 -0
- package/scripts/verify-files.py +39 -0
|
@@ -0,0 +1,826 @@
|
|
|
1
|
+
##
|
|
2
|
+
## This file is part of the libsigrokdecode project.
|
|
3
|
+
##
|
|
4
|
+
## Copyright (C) 2011 Gareth McMullin <gareth@blacksphere.co.nz>
|
|
5
|
+
## Copyright (C) 2012-2014 Uwe Hermann <uwe@hermann-uwe.de>
|
|
6
|
+
## Copyright (C) 2024 DreamSourceLab <support@dreamsourcelab.com>
|
|
7
|
+
##
|
|
8
|
+
## This program is free software; you can redistribute it and/or modify
|
|
9
|
+
## it under the terms of the GNU General Public License as published by
|
|
10
|
+
## the Free Software Foundation; either version 2 of the License, or
|
|
11
|
+
## (at your option) any later version.
|
|
12
|
+
##
|
|
13
|
+
## This program is distributed in the hope that it will be useful,
|
|
14
|
+
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
## GNU General Public License for more details.
|
|
17
|
+
##
|
|
18
|
+
## You should have received a copy of the GNU General Public License
|
|
19
|
+
## along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
##
|
|
21
|
+
|
|
22
|
+
import sigrokdecode as srd
|
|
23
|
+
from collections import namedtuple
|
|
24
|
+
from math import floor, ceil
|
|
25
|
+
from enum import Enum
|
|
26
|
+
Data = namedtuple('Data', ['ss', 'es', 'val'])
|
|
27
|
+
|
|
28
|
+
##
|
|
29
|
+
## 2023/4/8 DreamSourceLab : add flash module
|
|
30
|
+
##
|
|
31
|
+
|
|
32
|
+
# Key: (CPOL, CPHA). Value: SPI mode.
|
|
33
|
+
# Clock polarity (CPOL) = 0/1: Clock is low/high when inactive.
|
|
34
|
+
# Clock phase (CPHA) = 0/1: Data is valid on the leading/trailing clock edge.
|
|
35
|
+
spi_mode = {
|
|
36
|
+
(0, 0): 0, # Mode 0
|
|
37
|
+
(0, 1): 1, # Mode 1
|
|
38
|
+
(1, 0): 2, # Mode 2
|
|
39
|
+
(1, 1): 3, # Mode 3
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
class process_enum(Enum):
|
|
43
|
+
COMMAND = 0
|
|
44
|
+
WRITE_BYTE = 1
|
|
45
|
+
READ_BYTE = 2
|
|
46
|
+
READ_BYTE_CONTINUOUS = 3
|
|
47
|
+
CONTINUOUS_READ_MODE_BITS = 4
|
|
48
|
+
ADDRESS_BY_MODE = 5
|
|
49
|
+
ADDRESS_24BIT = 6
|
|
50
|
+
ADDRESS_32BIT = 7
|
|
51
|
+
DUMMY_BY_MODE = 8
|
|
52
|
+
DUMMY_8BIT = 9
|
|
53
|
+
DUMMY_32BIT = 10
|
|
54
|
+
DUMMY_40BIT = 11
|
|
55
|
+
|
|
56
|
+
process_text = {
|
|
57
|
+
process_enum.COMMAND : ['Command' , 'CMD'] ,
|
|
58
|
+
process_enum.WRITE_BYTE : ['Write Data' , 'WD'] ,
|
|
59
|
+
process_enum.READ_BYTE : ['Read Data' , 'RD'] ,
|
|
60
|
+
process_enum.READ_BYTE_CONTINUOUS : ['Read Data' , 'RD'] ,
|
|
61
|
+
process_enum.ADDRESS_24BIT : ['24-Bit Address' , 'AD'] ,
|
|
62
|
+
process_enum.ADDRESS_32BIT : ['32-Bit Address' , 'AD'] ,
|
|
63
|
+
process_enum.CONTINUOUS_READ_MODE_BITS : ['Continuous Read Mode bits' , 'M'] ,
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
class process_mode(Enum):
|
|
67
|
+
SINGLE = 0
|
|
68
|
+
DUAL = 1
|
|
69
|
+
QUAD = 2
|
|
70
|
+
|
|
71
|
+
class process_info:
|
|
72
|
+
def __init__(self, enum, mode):
|
|
73
|
+
self.enum = enum
|
|
74
|
+
self.mode = mode
|
|
75
|
+
|
|
76
|
+
def __eq__(self, other):
|
|
77
|
+
if isinstance(other, self.__class__):
|
|
78
|
+
return self.enum == other.enum and self.mode == other.mode
|
|
79
|
+
return False
|
|
80
|
+
|
|
81
|
+
#read adress(address mode, 24BIT, 32BIT)
|
|
82
|
+
READ_ADDRESS = process_info(process_enum.ADDRESS_BY_MODE , process_mode.SINGLE)
|
|
83
|
+
READ_3B_ADDRESS = process_info(process_enum.ADDRESS_24BIT , process_mode.SINGLE)
|
|
84
|
+
READ_4B_ADDRESS = process_info(process_enum.ADDRESS_32BIT , process_mode.SINGLE)
|
|
85
|
+
|
|
86
|
+
#read DUAL Adress
|
|
87
|
+
READ_ADDRESS_DUAL = process_info(process_enum.ADDRESS_BY_MODE , process_mode.DUAL)
|
|
88
|
+
READ_3B_ADDRESS_DUAL = process_info(process_enum.ADDRESS_24BIT , process_mode.DUAL)
|
|
89
|
+
READ_4B_ADDRESS_DUAL = process_info(process_enum.ADDRESS_32BIT , process_mode.DUAL)
|
|
90
|
+
|
|
91
|
+
#read QUAD Adress
|
|
92
|
+
READ_ADDRESS_QUAD = process_info(process_enum.ADDRESS_BY_MODE , process_mode.QUAD)
|
|
93
|
+
READ_3B_ADDRESS_QUAD = process_info(process_enum.ADDRESS_24BIT , process_mode.QUAD)
|
|
94
|
+
READ_4B_ADDRESS_QUAD = process_info(process_enum.ADDRESS_32BIT , process_mode.QUAD)
|
|
95
|
+
|
|
96
|
+
#Read Byte(IO1, DUAL, QUAD)
|
|
97
|
+
READ_BYTE_SINGLE = process_info(process_enum.READ_BYTE , process_mode.SINGLE)
|
|
98
|
+
READ_BYTE_DUAL = process_info(process_enum.READ_BYTE , process_mode.DUAL)
|
|
99
|
+
READ_BYTE_QUAD = process_info(process_enum.READ_BYTE , process_mode.QUAD)
|
|
100
|
+
|
|
101
|
+
READ_BYTE_SINGLE_CONTINUOUS = process_info(process_enum.READ_BYTE_CONTINUOUS , process_mode.SINGLE)
|
|
102
|
+
READ_BYTE_DUAL_CONTINUOUS = process_info(process_enum.READ_BYTE_CONTINUOUS , process_mode.DUAL)
|
|
103
|
+
READ_BYTE_QUAD_CONTINUOUS = process_info(process_enum.READ_BYTE_CONTINUOUS , process_mode.QUAD)
|
|
104
|
+
|
|
105
|
+
#read m7-m0(DUAL,QUAD)
|
|
106
|
+
READ_MODE_BITS_DUAL = process_info(process_enum.CONTINUOUS_READ_MODE_BITS , process_mode.DUAL)
|
|
107
|
+
READ_MODE_BITS_QUAD = process_info(process_enum.CONTINUOUS_READ_MODE_BITS , process_mode.QUAD)
|
|
108
|
+
|
|
109
|
+
#write (io0)
|
|
110
|
+
WRITE_BYTE_SINGLE = process_info(process_enum.WRITE_BYTE , process_mode.SINGLE)
|
|
111
|
+
|
|
112
|
+
#DUMMY
|
|
113
|
+
DUMMY_CYCLE = process_info(process_enum.DUMMY_BY_MODE , process_mode.SINGLE)
|
|
114
|
+
DUMMY_CYCLE_8BIT = process_info(process_enum.DUMMY_8BIT , process_mode.SINGLE)
|
|
115
|
+
DUMMY_CYCLE_8BIT_QUAD = process_info(process_enum.DUMMY_8BIT , process_mode.QUAD)
|
|
116
|
+
|
|
117
|
+
#Command list(command, name, abb, data after command)
|
|
118
|
+
command = {
|
|
119
|
+
0x06 : ['Write Enable' , 'WREN' , []],
|
|
120
|
+
0x04 : ['Write Disable' , 'WRDI' , []],
|
|
121
|
+
0x50 : ['Write Enable for Volatile Status Register' , 'WRENFVSR' , []],
|
|
122
|
+
0x05 : ['Read Status Register' , 'RDSR' , [READ_BYTE_SINGLE]],
|
|
123
|
+
0x35 : ['Read Status Register' , 'RDSR' , [READ_BYTE_SINGLE]],
|
|
124
|
+
0x15 : ['Read Status Register' , 'RDSR' , [READ_BYTE_SINGLE]],
|
|
125
|
+
0x01 : ['Write Status Register' , 'WRSR' , [WRITE_BYTE_SINGLE]],
|
|
126
|
+
0x31 : ['Write Status Register' , 'WRSR' , [WRITE_BYTE_SINGLE]],
|
|
127
|
+
0x11 : ['Write Status Register' , 'WRSR' , [WRITE_BYTE_SINGLE]],
|
|
128
|
+
0xC8 : ['Read Extended Register' , 'RER' , [READ_BYTE_SINGLE]],
|
|
129
|
+
0xC5 : ['Write Extended Register' , 'WER' , [WRITE_BYTE_SINGLE]],
|
|
130
|
+
0x03 : ['Read Data Bytes' , 'READ' , [READ_ADDRESS , READ_BYTE_SINGLE_CONTINUOUS]],
|
|
131
|
+
0x13 : ['Read Data Bytes' , '4READ' , [READ_4B_ADDRESS , READ_BYTE_SINGLE_CONTINUOUS]],
|
|
132
|
+
0x0B : ['Read Data Bytes at Higher Speed' , 'Fast Read' , [READ_ADDRESS , DUMMY_CYCLE_8BIT , READ_BYTE_SINGLE_CONTINUOUS]],
|
|
133
|
+
0x0C : ['Read Data Bytes at Higher Speed' , '4Fast Read', [READ_4B_ADDRESS , DUMMY_CYCLE_8BIT , READ_BYTE_SINGLE_CONTINUOUS]],
|
|
134
|
+
0x3B : ['Dual Output Fast Read' , 'DOFR' , [READ_ADDRESS ,DUMMY_CYCLE_8BIT , READ_BYTE_DUAL_CONTINUOUS]],
|
|
135
|
+
0x3C : ['Dual Output Fast Read' , '4DOFR' , [READ_4B_ADDRESS ,DUMMY_CYCLE_8BIT , READ_BYTE_DUAL_CONTINUOUS]],
|
|
136
|
+
0x6B : ['Quad Output Fast Read' , 'QOFR' , [READ_ADDRESS ,DUMMY_CYCLE_8BIT , READ_BYTE_QUAD_CONTINUOUS]],
|
|
137
|
+
0x6C : ['Quad Output Fast Read' , '4QOFR' , [READ_4B_ADDRESS ,DUMMY_CYCLE_8BIT , READ_BYTE_QUAD_CONTINUOUS]],
|
|
138
|
+
0xBB : ['Dual I/O Fast Read' , 'DIOFR' , [READ_ADDRESS_DUAL ,READ_MODE_BITS_DUAL , READ_BYTE_DUAL_CONTINUOUS]],
|
|
139
|
+
0xBC : ['Dual I/O Fast Read' , '4DIOFR' , [READ_4B_ADDRESS_DUAL , READ_MODE_BITS_DUAL , READ_BYTE_DUAL_CONTINUOUS]],
|
|
140
|
+
0xE7 : ['4X I/O Word Read' , 'QIOWR' , [READ_3B_ADDRESS_QUAD , READ_MODE_BITS_QUAD , DUMMY_CYCLE_8BIT_QUAD , READ_BYTE_QUAD_CONTINUOUS]],
|
|
141
|
+
0xEB : ['Quad I/O Fast Read' , 'QIOFR' , [READ_ADDRESS_QUAD , READ_MODE_BITS_QUAD , DUMMY_CYCLE_8BIT_QUAD , DUMMY_CYCLE_8BIT_QUAD , READ_BYTE_QUAD_CONTINUOUS]],
|
|
142
|
+
0xEC : ['Quad I/O Fast Read' , '4QIOFR' , [READ_4B_ADDRESS_QUAD , READ_MODE_BITS_QUAD , DUMMY_CYCLE_8BIT_QUAD , DUMMY_CYCLE_8BIT_QUAD , READ_BYTE_QUAD_CONTINUOUS]],
|
|
143
|
+
0x77 : ['Set Burst with Wrap' , 'SBWW' , [DUMMY_CYCLE_8BIT , DUMMY_CYCLE_8BIT , DUMMY_CYCLE_8BIT , WRITE_BYTE_SINGLE]],
|
|
144
|
+
0x02 : ['Page Program' , 'PP' , [READ_ADDRESS] + [WRITE_BYTE_SINGLE] * 256],
|
|
145
|
+
0x12 : ['Page Program' , '4PP' , [READ_4B_ADDRESS] + [WRITE_BYTE_SINGLE] * 256],
|
|
146
|
+
0x32 : ['Quad Page Program' , 'QPP' , [READ_ADDRESS] + [READ_BYTE_QUAD_CONTINUOUS]],
|
|
147
|
+
0x34 : ['Quad Page Program' , '4QPP' , [READ_4B_ADDRESS] + [READ_BYTE_QUAD_CONTINUOUS]],
|
|
148
|
+
0x20 : ['Sector Erase' , 'SE' , [READ_ADDRESS]],
|
|
149
|
+
0x21 : ['Sector Erase' , '4SE', [READ_4B_ADDRESS]],
|
|
150
|
+
0x52 : ['32KB Block Erase' , 'BE32' , [READ_ADDRESS]],
|
|
151
|
+
0x5C : ['32KB Block Erase' , '4BE32' , [READ_4B_ADDRESS]],
|
|
152
|
+
0xD8 : ['64KB Block Erase' , 'BE64', [READ_ADDRESS]],
|
|
153
|
+
0xDC : ['64KB Block Erase' , '4BE64', [READ_4B_ADDRESS]],
|
|
154
|
+
0x60 : ['Chip Erase' , 'CE' , []],
|
|
155
|
+
0xC7 : ['Chip Erase' , 'CE' , []],
|
|
156
|
+
0xB9 : ['Deep Power-Down' , 'DP' , []],
|
|
157
|
+
0x4B : ['Read Unique ID' , 'RUID', [DUMMY_CYCLE , READ_BYTE_SINGLE_CONTINUOUS]],
|
|
158
|
+
0xB7 : ['Enter 4-Byte Address Mode' , 'EN4BADM' , []],
|
|
159
|
+
0xE9 : ['Exit 4-Byte Address Mode' , 'EX4BADM' , []],
|
|
160
|
+
0x30 : ['Clear SR Flags' , 'CLSRF' , []],
|
|
161
|
+
0xAB : ['Release from Deep Power-Down and Read Device ID' , 'RDI' , []],
|
|
162
|
+
0x90 : ['Read Manufacture ID/ Device ID' , 'REMS' , [READ_3B_ADDRESS , READ_BYTE_SINGLE , READ_BYTE_SINGLE]],
|
|
163
|
+
0x92 : ['Read Manufacture ID/ Device ID Dual I/O' , 'REMS' , [READ_3B_ADDRESS_DUAL , READ_MODE_BITS_DUAL ,READ_BYTE_DUAL_CONTINUOUS]],
|
|
164
|
+
0x94 : ['Read Manufacture ID/ Device ID Quad I/O' , 'REMS' , [READ_3B_ADDRESS_QUAD , READ_MODE_BITS_QUAD , DUMMY_CYCLE_8BIT_QUAD , DUMMY_CYCLE_8BIT_QUAD , READ_BYTE_QUAD_CONTINUOUS]],
|
|
165
|
+
0x9F : ['Read Identification' , 'RDID', [READ_BYTE_SINGLE_CONTINUOUS]],
|
|
166
|
+
0x75 : ['Program/Erase Suspend' , 'PES' , []],
|
|
167
|
+
0x7A : ['Program/Erase Resume' , 'PER' , []],
|
|
168
|
+
0x44 : ['Erase Security Registers' , 'ESR' , [READ_ADDRESS]],
|
|
169
|
+
0x42 : ['Program Security Registers' , 'PSR' , [READ_ADDRESS] + [WRITE_BYTE_SINGLE] * 256],
|
|
170
|
+
0x48 : ['Read Security Registers' , 'RSR' , [READ_ADDRESS , DUMMY_CYCLE_8BIT , READ_BYTE_SINGLE_CONTINUOUS]],
|
|
171
|
+
0x66 : ['Enable Reset' , 'ENRE' , []],
|
|
172
|
+
0x99 : ['Reset' , 'RE' , []],
|
|
173
|
+
0xFF : ['Release Read Enhanced' , 'RRE' , []],
|
|
174
|
+
0x5A : ['Read Serial Flash Discoverable Parameter' , 'RSFDP', [READ_3B_ADDRESS , DUMMY_CYCLE_8BIT , READ_BYTE_SINGLE_CONTINUOUS]],
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
class ChannelError(Exception):
|
|
178
|
+
pass
|
|
179
|
+
|
|
180
|
+
class Decoder(srd.Decoder):
|
|
181
|
+
api_version = 3
|
|
182
|
+
id = 'smart_qspi'
|
|
183
|
+
name = 'Smart QSPI'
|
|
184
|
+
longname = 'Quad Serial Peripheral Interface'
|
|
185
|
+
desc = 'Full-duplex, synchronous, serial bus.compatible with Dual SPI and Quad SPI interfaces.'
|
|
186
|
+
license = 'gplv2+'
|
|
187
|
+
inputs = ['logic']
|
|
188
|
+
outputs = ['spi']
|
|
189
|
+
tags = ['Embedded/industrial']
|
|
190
|
+
channels = (
|
|
191
|
+
{'id': 'clk', 'type': 0, 'name': 'CLK', 'desc': 'Clock', 'idn':'dec_qspi_chan_clk'},
|
|
192
|
+
{'id': 'io0', 'type': 109, 'name': 'IO0', 'desc': 'Data i/o 0', 'idn':'dec_qspi_chan_io0'},
|
|
193
|
+
)
|
|
194
|
+
optional_channels = (
|
|
195
|
+
{'id': 'io1', 'type': 107, 'name': 'IO1', 'desc': 'Data i/o 1', 'idn':'dec_qspi_opt_chan_io1'},
|
|
196
|
+
{'id': 'io2', 'type': 107, 'name': 'IO2', 'desc': 'Data i/o 2', 'idn':'dec_qspi_opt_chan_io2'},
|
|
197
|
+
{'id': 'io3', 'type': 107, 'name': 'IO3', 'desc': 'Data i/o 3', 'idn':'dec_qspi_opt_chan_io3'},
|
|
198
|
+
{'id': 'cs', 'type': -1, 'name': 'CS#', 'desc': 'Chip-select', 'idn':'dec_qspi_opt_chan_cs'},
|
|
199
|
+
)
|
|
200
|
+
options = (
|
|
201
|
+
{'id': 'cs_polarity', 'desc': 'CS# polarity', 'default': 'active-low',
|
|
202
|
+
'values': ('active-low', 'active-high'), 'idn':'dec_qspi_opt_cs_polarity'},
|
|
203
|
+
{'id': 'cpol', 'desc': 'Clock polarity (CPOL)', 'default': 0,
|
|
204
|
+
'values': (0, 1), 'idn':'dec_qspi_opt_cpol'},
|
|
205
|
+
{'id': 'cpha', 'desc': 'Clock phase (CPHA)', 'default': 0,
|
|
206
|
+
'values': (0, 1), 'idn':'dec_qspi_opt_cpha'},
|
|
207
|
+
{'id': 'bitorder', 'desc': 'Bit order',
|
|
208
|
+
'default': 'msb-first', 'values': ('msb-first', 'lsb-first'), 'idn':'dec_qspi_opt_bitorder'},
|
|
209
|
+
{'id': 'ads', 'desc': 'Adress Mode', 'default': '24-Bit Address',
|
|
210
|
+
'values': ('32-Bit Address', '24-Bit Address'), 'idn':'dec_qspi_adress_mode'},
|
|
211
|
+
{'id': 'frame', 'desc': 'Frame Decoder', 'default': 'no',
|
|
212
|
+
'values': ('yes', 'no'), 'idn':'dec_qspi_opt_frame'},
|
|
213
|
+
{'id': 'twolinesmode', 'desc': 'TwoLinesMode', 'default':'spi',
|
|
214
|
+
'values':('spi','dspi','qspi'), 'idn':'dec_qspi_two_lines_mode'},
|
|
215
|
+
{'id': 'invalidlevel', 'desc': 'Keep high or low as invalid', 'default':'both',
|
|
216
|
+
'values':('both','low','high'), 'idn':'dec_qspi_invalidlevel'},
|
|
217
|
+
|
|
218
|
+
)
|
|
219
|
+
annotations = (
|
|
220
|
+
('data-transfer', 'data transfer'),
|
|
221
|
+
('QuadData', 'Q-Data'),
|
|
222
|
+
('DualData', 'D-Data'),
|
|
223
|
+
('io0data', 'IO0 data'),
|
|
224
|
+
('io1data', 'IO1 data'),
|
|
225
|
+
('io2data', 'IO2 data'),
|
|
226
|
+
('io3data', 'IO3 data'),
|
|
227
|
+
('other', 'Human-readable warnings'),
|
|
228
|
+
)
|
|
229
|
+
annotation_rows = (
|
|
230
|
+
('T', 'data transfer', (0,)),
|
|
231
|
+
('Q', 'Q-Data', (1,)),
|
|
232
|
+
('D', 'D-Data', (2,)),
|
|
233
|
+
('d0', 'D0', (3,)),
|
|
234
|
+
('d1', 'D1', (4,)),
|
|
235
|
+
('d2', 'D2', (5,)),
|
|
236
|
+
('d3', 'D3', (6,)),
|
|
237
|
+
('O', 'Other',(7,)),
|
|
238
|
+
)
|
|
239
|
+
|
|
240
|
+
def __init__(self):
|
|
241
|
+
self.reset()
|
|
242
|
+
|
|
243
|
+
def reset(self):
|
|
244
|
+
self.samplerate = None
|
|
245
|
+
self.bitcount = 0
|
|
246
|
+
self.data = 0
|
|
247
|
+
self.bits = []
|
|
248
|
+
self.io0bits=[]
|
|
249
|
+
self.io1bits=[]
|
|
250
|
+
self.io2bits=[]
|
|
251
|
+
self.io3bits=[]
|
|
252
|
+
self.io0bytes=[]
|
|
253
|
+
self.io1bytes=[]
|
|
254
|
+
self.io2bytes=[]
|
|
255
|
+
self.io3bytes=[]
|
|
256
|
+
self.io0data=0
|
|
257
|
+
self.io1data=0
|
|
258
|
+
self.io2data=0
|
|
259
|
+
self.io3data=0
|
|
260
|
+
|
|
261
|
+
self.command = 0
|
|
262
|
+
|
|
263
|
+
self.state_count = 0
|
|
264
|
+
self.ads = False
|
|
265
|
+
self.diagram = []
|
|
266
|
+
|
|
267
|
+
self.ss = 0
|
|
268
|
+
self.count = 0
|
|
269
|
+
self.bits_data = 0
|
|
270
|
+
|
|
271
|
+
self.ss_block = -1
|
|
272
|
+
self.samplenum = -1
|
|
273
|
+
self.ss_transfer = -1
|
|
274
|
+
self.cs_was_deasserted = False
|
|
275
|
+
self.have_cs = self.have_io1 = self.have_io3 = None
|
|
276
|
+
self._last_clk = None
|
|
277
|
+
self._last_cs = None
|
|
278
|
+
|
|
279
|
+
self.read_data = []
|
|
280
|
+
self.ss_read_data = -1
|
|
281
|
+
self.es_read_data = -1
|
|
282
|
+
self.e7_continuous = False
|
|
283
|
+
self.e7_frame_can_continue = False
|
|
284
|
+
self.read_address = None
|
|
285
|
+
self.wrap_enabled = False
|
|
286
|
+
self.wrap_length = None
|
|
287
|
+
self.wrap_base = None
|
|
288
|
+
self.wrap_end = None
|
|
289
|
+
|
|
290
|
+
def start(self):
|
|
291
|
+
self.out_python = self.register(srd.OUTPUT_PYTHON)
|
|
292
|
+
self.out_ann = self.register(srd.OUTPUT_ANN)
|
|
293
|
+
self.out_binary = self.register(srd.OUTPUT_BINARY)
|
|
294
|
+
self.out_bitrate = self.register(srd.OUTPUT_META,
|
|
295
|
+
meta=(int, 'Bitrate', 'Bitrate during transfers'))
|
|
296
|
+
self.bw = (8 + 7) // 8
|
|
297
|
+
self.spiModeSet=self.options['twolinesmode'].lower()
|
|
298
|
+
self.invalidlevelSet = 0XFF if self.options['invalidlevel'] == 'high' else 0
|
|
299
|
+
|
|
300
|
+
self.ads = False if self.options['ads'] == '24-Bit Address' else True
|
|
301
|
+
|
|
302
|
+
def metadata(self, key, value):
|
|
303
|
+
if key == srd.SRD_CONF_SAMPLERATE:
|
|
304
|
+
self.samplerate = value
|
|
305
|
+
self.bit_width = float(self.samplerate) / float(115200)
|
|
306
|
+
|
|
307
|
+
def putw(self, data):
|
|
308
|
+
self.put(self.ss_block, self.samplenum, self.out_ann, data)
|
|
309
|
+
|
|
310
|
+
def putgse(self, ss, es, data):
|
|
311
|
+
self.put(ss, es, self.out_ann, data)
|
|
312
|
+
|
|
313
|
+
def putg(self, data):
|
|
314
|
+
s, halfbit = self.samplenum, self.bit_width / 2.0
|
|
315
|
+
self.put(s - floor(halfbit), s + ceil(halfbit), self.out_ann, data)
|
|
316
|
+
|
|
317
|
+
def puttext(self, ss, es, state, data):
|
|
318
|
+
self.put(ss, es, self.out_ann, [0, ['%s : 0x%02x' % (process_text[state][0] , data),
|
|
319
|
+
'%s : 0x%02x' % (process_text[state][1] , data),
|
|
320
|
+
'0x%02X' % data]])
|
|
321
|
+
|
|
322
|
+
def putdummy(self, ss, es):
|
|
323
|
+
self.put(ss, es, self.out_ann, [0, ['Dummy Cycles','Dummy','D']])
|
|
324
|
+
|
|
325
|
+
def putcmd(self, ss, es):
|
|
326
|
+
self.put(ss, es, self.out_ann, [0, ['%s : %s' % (process_text[process_enum.COMMAND][0] , command[self.io0data][0]),
|
|
327
|
+
'%s : %s' % (process_text[process_enum.COMMAND][1] , command[self.io0data][1]),
|
|
328
|
+
'%s' % command[self.io0data][1]]])
|
|
329
|
+
|
|
330
|
+
def putinfo(self, ss, es, text):
|
|
331
|
+
self.put(ss, es, self.out_ann, [7, [text]])
|
|
332
|
+
|
|
333
|
+
def clear_read_tracking(self):
|
|
334
|
+
self.read_address = None
|
|
335
|
+
self.wrap_base = None
|
|
336
|
+
self.wrap_end = None
|
|
337
|
+
|
|
338
|
+
def clear_e7_continuous(self):
|
|
339
|
+
self.e7_continuous = False
|
|
340
|
+
self.e7_frame_can_continue = False
|
|
341
|
+
|
|
342
|
+
def update_wrap_setting(self, ss, es, wrap_bits):
|
|
343
|
+
w6 = (wrap_bits >> 6) & 0x1
|
|
344
|
+
w5 = (wrap_bits >> 5) & 0x1
|
|
345
|
+
w4 = (wrap_bits >> 4) & 0x1
|
|
346
|
+
|
|
347
|
+
if w4 == 0:
|
|
348
|
+
self.wrap_enabled = True
|
|
349
|
+
self.wrap_length = 1 << (w6 * 2 + w5 + 3)
|
|
350
|
+
self.putinfo(ss, es, 'Wrap enabled: %d-byte window (W6-W4=%d%d%d)' %
|
|
351
|
+
(self.wrap_length, w6, w5, w4))
|
|
352
|
+
else:
|
|
353
|
+
self.wrap_enabled = False
|
|
354
|
+
self.wrap_length = None
|
|
355
|
+
self.wrap_base = None
|
|
356
|
+
self.wrap_end = None
|
|
357
|
+
self.putinfo(ss, es, 'Wrap disabled (W6-W4=%d%d%d)' % (w6, w5, w4))
|
|
358
|
+
|
|
359
|
+
def update_e7_mode(self, ss, es, mode_bits):
|
|
360
|
+
m54 = (mode_bits >> 4) & 0x3
|
|
361
|
+
self.e7_continuous = (m54 == 0x2)
|
|
362
|
+
if self.e7_continuous:
|
|
363
|
+
self.putinfo(ss, es, 'E7 continuous read enabled (M5-M4=10)')
|
|
364
|
+
else:
|
|
365
|
+
self.putinfo(ss, es, 'E7 continuous read disabled (M5-M4=%s)' % format(m54, '02b'))
|
|
366
|
+
|
|
367
|
+
def configure_read_window(self, ss, es, address):
|
|
368
|
+
self.read_address = address
|
|
369
|
+
if self.command != 0xE7 or not self.wrap_enabled or not self.wrap_length:
|
|
370
|
+
self.wrap_base = None
|
|
371
|
+
self.wrap_end = None
|
|
372
|
+
return
|
|
373
|
+
|
|
374
|
+
page_base = address & ~0xFF
|
|
375
|
+
wrap_mask = self.wrap_length - 1
|
|
376
|
+
self.wrap_base = page_base | (address & 0xFF & ~wrap_mask)
|
|
377
|
+
self.wrap_end = self.wrap_base + self.wrap_length - 1
|
|
378
|
+
self.putinfo(ss, es, 'E7 wrap window: 0x%06X-0x%06X (%dB)' %
|
|
379
|
+
(self.wrap_base, self.wrap_end, self.wrap_length))
|
|
380
|
+
|
|
381
|
+
def annotate_read_address(self, ss, es):
|
|
382
|
+
if self.read_address is None:
|
|
383
|
+
return
|
|
384
|
+
if self.wrap_base is not None and self.wrap_end is not None:
|
|
385
|
+
self.putinfo(ss, es, 'Addr: 0x%06X (wrap 0x%06X-0x%06X)' %
|
|
386
|
+
(self.read_address, self.wrap_base, self.wrap_end))
|
|
387
|
+
else:
|
|
388
|
+
self.putinfo(ss, es, 'Addr: 0x%06X' % self.read_address)
|
|
389
|
+
|
|
390
|
+
def advance_read_address(self):
|
|
391
|
+
if self.read_address is None:
|
|
392
|
+
return
|
|
393
|
+
if self.wrap_base is not None and self.wrap_end is not None:
|
|
394
|
+
self.read_address = self.wrap_base if self.read_address >= self.wrap_end else self.read_address + 1
|
|
395
|
+
else:
|
|
396
|
+
self.read_address += 1
|
|
397
|
+
|
|
398
|
+
def checkinvalidlevel(self,data): # if data line is keep high or keep low,data is invalid then return true
|
|
399
|
+
if self.options['invalidlevel']=='both' :
|
|
400
|
+
return data==0xff or data ==0
|
|
401
|
+
elif self.options['invalidlevel']=='high':
|
|
402
|
+
return data==0xff
|
|
403
|
+
else :
|
|
404
|
+
return data==0
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
def putdata(self, frame):
|
|
408
|
+
data0 = self.io0data
|
|
409
|
+
data1 = self.io1data
|
|
410
|
+
data2 = self.io2data if self.have_io3 else None
|
|
411
|
+
data3 = self.io3data if self.have_io3 else None
|
|
412
|
+
|
|
413
|
+
ss,es = self.io0bits[-1][1], self.io0bits[0][2]
|
|
414
|
+
if frame:
|
|
415
|
+
if self.have_io3:
|
|
416
|
+
self.io2bytes.append(Data(ss = ss, es = es, val = data2))
|
|
417
|
+
self.io3bytes.append(Data(ss = ss, es = es, val = data3))
|
|
418
|
+
if self.have_io1:
|
|
419
|
+
self.io1bytes.append(Data(ss = ss, es = es, val = data1))
|
|
420
|
+
self.io0bytes.append(Data(ss = ss, es = es, val = data0))
|
|
421
|
+
|
|
422
|
+
bo = self.options['bitorder']
|
|
423
|
+
|
|
424
|
+
if(((self.checkinvalidlevel(data2) or self.checkinvalidlevel(data3)) and self.have_io3) or (self.checkinvalidlevel(data1) and self.have_io1)):
|
|
425
|
+
spiMode = self.spiModeSet
|
|
426
|
+
elif self.have_io3:
|
|
427
|
+
spiMode='qspi'
|
|
428
|
+
else :
|
|
429
|
+
spiMode='spi'
|
|
430
|
+
|
|
431
|
+
# If a QSPI/DSPI command is already active, or if an E7 continuous-read
|
|
432
|
+
# resume is pending, the subsequent data bytes must be decoded with the
|
|
433
|
+
# expected bus width even when some IO lines carry 0x00/0xFF and would
|
|
434
|
+
# otherwise be misclassified as single-wire SPI.
|
|
435
|
+
if self.command != 0 and self.state_count < len(self.diagram):
|
|
436
|
+
active_mode = self.diagram[self.state_count].mode
|
|
437
|
+
if active_mode == process_mode.QUAD and spiMode == 'spi':
|
|
438
|
+
spiMode = 'qspi'
|
|
439
|
+
elif active_mode == process_mode.DUAL and spiMode == 'spi':
|
|
440
|
+
spiMode = 'dspi'
|
|
441
|
+
elif self.command == 0 and self.e7_frame_can_continue and spiMode == 'spi':
|
|
442
|
+
spiMode = 'qspi'
|
|
443
|
+
|
|
444
|
+
self.putgse(ss,es,[7, ['%s' %spiMode.upper()]])
|
|
445
|
+
self.put(ss, es, self.out_ann, [3, ['@%02X' % self.io0data]])
|
|
446
|
+
if self.have_io1:
|
|
447
|
+
self.put(ss, es, self.out_ann, [4, ['@%02X' % self.io1data]])
|
|
448
|
+
if self.have_io3:
|
|
449
|
+
self.put(ss, es, self.out_ann, [5, ['@%02X' % self.io2data]])
|
|
450
|
+
self.put(ss, es, self.out_ann, [6, ['@%02X' % self.io3data]])
|
|
451
|
+
|
|
452
|
+
if spiMode == 'qspi' or spiMode == 'dspi' or self.command != 0:
|
|
453
|
+
|
|
454
|
+
qdata = []
|
|
455
|
+
ddata = []
|
|
456
|
+
if self.have_io1 and self.have_io3:
|
|
457
|
+
for i in range(4):
|
|
458
|
+
self.data = 0
|
|
459
|
+
for j in range(2):
|
|
460
|
+
self.data |= self.io3bits[-1 - i * 2 - j][0]
|
|
461
|
+
self.data = self.data << 1
|
|
462
|
+
self.data |= self.io2bits[-1 - i * 2 - j][0]
|
|
463
|
+
self.data = self.data << 1
|
|
464
|
+
self.data |= self.io1bits[-1 - i * 2 - j][0]
|
|
465
|
+
self.data = self.data << 1
|
|
466
|
+
self.data |= self.io0bits[-1 - i * 2 - j][0]
|
|
467
|
+
if j < 1:
|
|
468
|
+
self.data = self.data << 1
|
|
469
|
+
|
|
470
|
+
qss,qes = self.io0bits[-1 - i * 2][1], self.io0bits[-2 - i * 2][2]
|
|
471
|
+
|
|
472
|
+
if not bo == 'msb-first':
|
|
473
|
+
dataTemp = (0xF0 & self.data) >> 4|(0x0f & self.data) << 4
|
|
474
|
+
self.data = dataTemp
|
|
475
|
+
|
|
476
|
+
qdata.append([self.data, qss, qes])
|
|
477
|
+
self.put(qss, qes, self.out_ann, [1, ['@%02X' % self.data]])
|
|
478
|
+
if self.have_io1:
|
|
479
|
+
for i in range(2):
|
|
480
|
+
self.data = 0
|
|
481
|
+
for j in range(4):
|
|
482
|
+
self.data |= self.io1bits[-1 - i * 4 - j][0]
|
|
483
|
+
self.data = self.data << 1
|
|
484
|
+
self.data |= self.io0bits[-1 - i * 4 - j][0]
|
|
485
|
+
if j < 3:
|
|
486
|
+
self.data = self.data << 1
|
|
487
|
+
dss,des = self.io0bits[-1 - i * 4][1], self.io0bits[-4 - i * 4][2]
|
|
488
|
+
if not bo == 'msb-first':
|
|
489
|
+
dataTemp = (0xF0 & self.data) >> 4|(0x0f & self.data) << 4
|
|
490
|
+
self.data = dataTemp
|
|
491
|
+
|
|
492
|
+
ddata.append([self.data, dss, des])
|
|
493
|
+
self.put(dss, des, self.out_ann, [2, ['@%02X' % self.data]])
|
|
494
|
+
|
|
495
|
+
if self.command == 0 and self.e7_frame_can_continue and spiMode == 'qspi':
|
|
496
|
+
self.command = 0xE7
|
|
497
|
+
self.diagram = list(command[self.command][2])
|
|
498
|
+
self.e7_frame_can_continue = False
|
|
499
|
+
|
|
500
|
+
elif self.command == 0 and self.e7_frame_can_continue:
|
|
501
|
+
self.e7_frame_can_continue = False
|
|
502
|
+
|
|
503
|
+
if self.command == 0 and self.io0data in command:
|
|
504
|
+
self.putcmd(ss, es)
|
|
505
|
+
#update adress mode
|
|
506
|
+
if self.io0data == 0xB7:
|
|
507
|
+
self.ads = True
|
|
508
|
+
elif self.io0data == 0xE9:
|
|
509
|
+
self.ads = False
|
|
510
|
+
elif self.io0data == 0xFF:
|
|
511
|
+
self.clear_e7_continuous()
|
|
512
|
+
|
|
513
|
+
if len(command[self.io0data][2]) != 0:
|
|
514
|
+
self.command = self.io0data
|
|
515
|
+
self.diagram = list(command[self.command][2])
|
|
516
|
+
|
|
517
|
+
elif self.command != 0:
|
|
518
|
+
cur_state = self.diagram[self.state_count]
|
|
519
|
+
|
|
520
|
+
i, size = 0, 1
|
|
521
|
+
if cur_state.mode == process_mode.DUAL:
|
|
522
|
+
size = 2
|
|
523
|
+
elif cur_state.mode == process_mode.QUAD:
|
|
524
|
+
size = 4
|
|
525
|
+
|
|
526
|
+
while i < size:
|
|
527
|
+
if size == 1:
|
|
528
|
+
if cur_state.enum in (process_enum.READ_BYTE, process_enum.READ_BYTE_CONTINUOUS) and self.have_io1:
|
|
529
|
+
origin_data = [self.io1data & 0xFF , ss, es]
|
|
530
|
+
else:
|
|
531
|
+
origin_data = [self.io0data & 0xFF , ss, es]
|
|
532
|
+
elif size == 2:
|
|
533
|
+
origin_data = ddata[i]
|
|
534
|
+
origin_data[0] = origin_data[0] & 0xFF
|
|
535
|
+
elif size == 4:
|
|
536
|
+
origin_data = qdata[i]
|
|
537
|
+
origin_data[0] = origin_data[0] & 0xFF
|
|
538
|
+
i = i + 1
|
|
539
|
+
|
|
540
|
+
state_enum = cur_state.enum
|
|
541
|
+
if state_enum == process_enum.ADDRESS_BY_MODE or \
|
|
542
|
+
state_enum == process_enum.ADDRESS_24BIT or \
|
|
543
|
+
state_enum == process_enum.ADDRESS_32BIT or \
|
|
544
|
+
state_enum == process_enum.DUMMY_BY_MODE or \
|
|
545
|
+
state_enum == process_enum.DUMMY_8BIT:
|
|
546
|
+
|
|
547
|
+
if state_enum == process_enum.ADDRESS_BY_MODE:
|
|
548
|
+
state_enum = process_enum.ADDRESS_24BIT if self.ads == False else process_enum.ADDRESS_32BIT
|
|
549
|
+
elif state_enum == process_enum.DUMMY_BY_MODE:
|
|
550
|
+
state_enum = process_enum.DUMMY_32BIT if self.ads == False else process_enum.DUMMY_40BIT
|
|
551
|
+
|
|
552
|
+
if self.count == 0:
|
|
553
|
+
self.ss = ss
|
|
554
|
+
self.bits_data |= origin_data[0]
|
|
555
|
+
self.count = self.count + 1
|
|
556
|
+
|
|
557
|
+
if (state_enum == process_enum.ADDRESS_24BIT and self.count == 3) or \
|
|
558
|
+
(state_enum == process_enum.ADDRESS_32BIT and self.count == 4) or \
|
|
559
|
+
(state_enum == process_enum.DUMMY_8BIT and self.count == 1) or \
|
|
560
|
+
(state_enum == process_enum.DUMMY_32BIT and self.count == 4) or \
|
|
561
|
+
(state_enum == process_enum.DUMMY_40BIT and self.count == 5):
|
|
562
|
+
|
|
563
|
+
if state_enum == process_enum.ADDRESS_24BIT or \
|
|
564
|
+
state_enum == process_enum.ADDRESS_32BIT:
|
|
565
|
+
self.puttext(self.ss , origin_data[2] , state_enum , self.bits_data)
|
|
566
|
+
# E7 word-read uses even-byte addressing (A0 must be 0).
|
|
567
|
+
if self.command == 0xE7 and (self.bits_data & 0x1):
|
|
568
|
+
self.put(self.ss, origin_data[2], self.out_ann,
|
|
569
|
+
[7, ['E7 address A0 must be 0 (word aligned)']])
|
|
570
|
+
self.configure_read_window(self.ss, origin_data[2], self.bits_data)
|
|
571
|
+
else:
|
|
572
|
+
self.putdummy(self.ss, origin_data[2])
|
|
573
|
+
|
|
574
|
+
self.ss = 0
|
|
575
|
+
self.count = 0
|
|
576
|
+
self.bits_data = 0
|
|
577
|
+
self.state_count += 1
|
|
578
|
+
|
|
579
|
+
if self.state_count < len(self.diagram):
|
|
580
|
+
cur_state = self.diagram[self.state_count]
|
|
581
|
+
else:
|
|
582
|
+
self.bits_data = self.bits_data << 8
|
|
583
|
+
|
|
584
|
+
elif state_enum == process_enum.WRITE_BYTE or \
|
|
585
|
+
state_enum == process_enum.READ_BYTE or \
|
|
586
|
+
state_enum == process_enum.READ_BYTE_CONTINUOUS or \
|
|
587
|
+
state_enum == process_enum.CONTINUOUS_READ_MODE_BITS:
|
|
588
|
+
|
|
589
|
+
self.puttext(origin_data[1] , origin_data[2] , state_enum , origin_data[0])
|
|
590
|
+
|
|
591
|
+
if self.command == 0x77 and state_enum == process_enum.WRITE_BYTE:
|
|
592
|
+
self.update_wrap_setting(origin_data[1], origin_data[2], origin_data[0])
|
|
593
|
+
|
|
594
|
+
if self.command == 0xE7 and state_enum == process_enum.CONTINUOUS_READ_MODE_BITS:
|
|
595
|
+
self.update_e7_mode(origin_data[1], origin_data[2], origin_data[0])
|
|
596
|
+
|
|
597
|
+
if self.command == 0xE7 and state_enum == process_enum.READ_BYTE_CONTINUOUS:
|
|
598
|
+
self.annotate_read_address(origin_data[1], origin_data[2])
|
|
599
|
+
|
|
600
|
+
if state_enum == process_enum.READ_BYTE_CONTINUOUS:
|
|
601
|
+
if self.ss_read_data == -1:
|
|
602
|
+
self.ss_read_data = origin_data[1]
|
|
603
|
+
self.es_read_data = origin_data[2]
|
|
604
|
+
self.read_data.append(origin_data[0])
|
|
605
|
+
if self.command == 0xE7:
|
|
606
|
+
self.advance_read_address()
|
|
607
|
+
|
|
608
|
+
if state_enum != process_enum.READ_BYTE_CONTINUOUS:
|
|
609
|
+
self.state_count += 1
|
|
610
|
+
|
|
611
|
+
if self.state_count < len(self.diagram):
|
|
612
|
+
cur_state = self.diagram[self.state_count]
|
|
613
|
+
|
|
614
|
+
if self.state_count >= len(self.diagram):
|
|
615
|
+
self.command = 0
|
|
616
|
+
self.diagram = []
|
|
617
|
+
self.state_count = 0
|
|
618
|
+
break
|
|
619
|
+
else:
|
|
620
|
+
# Single-wire SPI mode: detect command byte so state machine
|
|
621
|
+
# can process subsequent QSPI/DSPI address/data bytes correctly.
|
|
622
|
+
if self.command == 0 and self.io0data in command:
|
|
623
|
+
self.putcmd(ss, es)
|
|
624
|
+
if self.io0data == 0xB7:
|
|
625
|
+
self.ads = True
|
|
626
|
+
elif self.io0data == 0xE9:
|
|
627
|
+
self.ads = False
|
|
628
|
+
elif self.io0data == 0xFF:
|
|
629
|
+
self.clear_e7_continuous()
|
|
630
|
+
if len(command[self.io0data][2]) != 0:
|
|
631
|
+
self.command = self.io0data
|
|
632
|
+
self.diagram = list(command[self.command][2])
|
|
633
|
+
|
|
634
|
+
def reset_decoder_state(self):
|
|
635
|
+
|
|
636
|
+
self.io0data = 0
|
|
637
|
+
self.io1data = 0 if self.have_io1 else None
|
|
638
|
+
self.io2data=0 if self.have_io3 else None
|
|
639
|
+
self.io3data=0 if self.have_io3 else None
|
|
640
|
+
|
|
641
|
+
self.io0bits=[]
|
|
642
|
+
self.io1bits=[] if self.have_io1 else None
|
|
643
|
+
self.io2bits=[] if self.have_io3 else None
|
|
644
|
+
self.io3bits=[] if self.have_io3 else None
|
|
645
|
+
self.bitcount = 0
|
|
646
|
+
|
|
647
|
+
def cs_asserted(self, cs):
|
|
648
|
+
active_low = (self.options['cs_polarity'] == 'active-low')
|
|
649
|
+
return (cs == 0) if active_low else (cs == 1)
|
|
650
|
+
|
|
651
|
+
def handle_bit(self, datapins, clk, cs, frame):
|
|
652
|
+
# If this is the first bit of a dataword, save its sample number.
|
|
653
|
+
if self.bitcount == 0:
|
|
654
|
+
self.ss_block = self.samplenum
|
|
655
|
+
self.cs_was_deasserted = \
|
|
656
|
+
not self.cs_asserted(cs) if self.have_cs else False
|
|
657
|
+
|
|
658
|
+
ws = 8
|
|
659
|
+
bo = self.options['bitorder']
|
|
660
|
+
|
|
661
|
+
if bo == 'msb-first':
|
|
662
|
+
self.io0data |= datapins[3] << (ws - 1 - self.bitcount)
|
|
663
|
+
else:
|
|
664
|
+
self.io0data |= datapins[3] << self.bitcount
|
|
665
|
+
if self.have_io1:
|
|
666
|
+
if bo == 'msb-first':
|
|
667
|
+
self.io1data |= datapins[2] << (ws - 1 - self.bitcount)
|
|
668
|
+
else:
|
|
669
|
+
self.io1data |= datapins[2] << self.bitcount
|
|
670
|
+
|
|
671
|
+
if self.have_io3:
|
|
672
|
+
if bo == 'msb-first':
|
|
673
|
+
self.io2data |= datapins[1] << (ws - 1 - self.bitcount)
|
|
674
|
+
self.io3data |= datapins[0] << (ws - 1 - self.bitcount)
|
|
675
|
+
else:
|
|
676
|
+
self.io2data |= datapins[1] << self.bitcount
|
|
677
|
+
self.io3data |= datapins[0] << self.bitcount
|
|
678
|
+
|
|
679
|
+
# Guesstimate the endsample for this bit (can be overridden below).
|
|
680
|
+
es = self.samplenum
|
|
681
|
+
if self.bitcount > 0:
|
|
682
|
+
es += self.samplenum - self.io0bits[0][1]
|
|
683
|
+
|
|
684
|
+
self.io0bits.insert(0, [datapins[3], self.samplenum, es])
|
|
685
|
+
if self.have_io1:
|
|
686
|
+
self.io1bits.insert(0, [datapins[2], self.samplenum, es])
|
|
687
|
+
if self.have_io3:
|
|
688
|
+
self.io2bits.insert(0, [datapins[1], self.samplenum, es])
|
|
689
|
+
self.io3bits.insert(0, [datapins[0], self.samplenum, es])
|
|
690
|
+
|
|
691
|
+
if self.bitcount > 0:
|
|
692
|
+
self.io0bits[1][2] = self.samplenum
|
|
693
|
+
if self.have_io1:
|
|
694
|
+
self.io1bits[1][2] = self.samplenum
|
|
695
|
+
if self.have_io3:
|
|
696
|
+
self.io2bits[1][2] = self.samplenum
|
|
697
|
+
self.io3bits[1][2] = self.samplenum
|
|
698
|
+
|
|
699
|
+
self.bitcount += 1
|
|
700
|
+
|
|
701
|
+
# Continue to receive if not enough bits were received, yet.
|
|
702
|
+
if self.bitcount != ws:
|
|
703
|
+
return
|
|
704
|
+
|
|
705
|
+
self.putdata(frame)
|
|
706
|
+
if self.samplerate:
|
|
707
|
+
elapsed = 1 / float(self.samplerate)
|
|
708
|
+
elapsed *= (self.samplenum - self.ss_block + 1)
|
|
709
|
+
bitrate = int(1 / elapsed * ws)
|
|
710
|
+
self.put(self.ss_block, self.samplenum, self.out_bitrate, bitrate)
|
|
711
|
+
|
|
712
|
+
if self.have_cs and self.cs_was_deasserted:
|
|
713
|
+
self.putw([6, ['CS# was deasserted during this data word!']])
|
|
714
|
+
|
|
715
|
+
self.reset_decoder_state()
|
|
716
|
+
|
|
717
|
+
def find_clk_edge(self, datapins, clk, cs, first,frame):
|
|
718
|
+
|
|
719
|
+
clk_changed = first or self._last_clk is None or clk != self._last_clk
|
|
720
|
+
cs_changed = first or self._last_cs is None or cs != self._last_cs
|
|
721
|
+
self._last_clk, self._last_cs = clk, cs
|
|
722
|
+
if self.have_cs and cs_changed:
|
|
723
|
+
# CS# transitions reset the bit accumulator at transaction
|
|
724
|
+
# boundaries. A clock edge in the same sample is intentionally
|
|
725
|
+
# not consumed as a data bit.
|
|
726
|
+
# Send all CS# pin value changes.
|
|
727
|
+
oldcs = None if first else 1 - cs
|
|
728
|
+
self.put(self.samplenum, self.samplenum, self.out_python,
|
|
729
|
+
['CS-CHANGE', oldcs, cs])
|
|
730
|
+
cs_is_asserted = self.cs_asserted(cs)
|
|
731
|
+
|
|
732
|
+
if cs_is_asserted:
|
|
733
|
+
self.e7_frame_can_continue = self.e7_continuous
|
|
734
|
+
|
|
735
|
+
if frame:
|
|
736
|
+
if cs_is_asserted:
|
|
737
|
+
self.ss_transfer = self.samplenum
|
|
738
|
+
self.io0bytes = []
|
|
739
|
+
self.io1bytes = []
|
|
740
|
+
self.io2bytes = []
|
|
741
|
+
self.io3bytes = []
|
|
742
|
+
|
|
743
|
+
elif self.ss_transfer != -1:
|
|
744
|
+
self.put(self.ss_transfer, self.samplenum, self.out_python,
|
|
745
|
+
['TRANSFER', self.io0bytes, self.io1bytes, self.io2bytes,self.io3bytes])
|
|
746
|
+
# Emit read data summary annotation when CS# de-asserts.
|
|
747
|
+
if not cs_is_asserted and self.read_data:
|
|
748
|
+
s = ' '.join(['%02x' % b for b in self.read_data])
|
|
749
|
+
self.put(self.ss_read_data, self.samplenum, self.out_ann,
|
|
750
|
+
[0, ['Read Data (%d bytes): %s' % (len(self.read_data), s),
|
|
751
|
+
'RD (%d bytes)' % len(self.read_data),
|
|
752
|
+
'%d B' % len(self.read_data)]])
|
|
753
|
+
self.read_data = []
|
|
754
|
+
self.ss_read_data = -1
|
|
755
|
+
self.es_read_data = -1
|
|
756
|
+
|
|
757
|
+
# Reset protocol state when a transaction ends, but keep any
|
|
758
|
+
# continuous-read context for the next CS# assert.
|
|
759
|
+
if not cs_is_asserted:
|
|
760
|
+
self.command = 0
|
|
761
|
+
self.diagram = []
|
|
762
|
+
self.state_count = 0
|
|
763
|
+
self.e7_frame_can_continue = False
|
|
764
|
+
|
|
765
|
+
self.ss = 0
|
|
766
|
+
self.count = 0
|
|
767
|
+
self.bits_data = 0
|
|
768
|
+
self.clear_read_tracking()
|
|
769
|
+
|
|
770
|
+
self.reset_decoder_state()
|
|
771
|
+
|
|
772
|
+
# We only care about samples if CS# is asserted.
|
|
773
|
+
if self.have_cs and not self.cs_asserted(cs):
|
|
774
|
+
return
|
|
775
|
+
|
|
776
|
+
# Ignore samples that are not the configured clock edge. The
|
|
777
|
+
# decoder samples on rising clock for SPI modes 0/3 and on falling
|
|
778
|
+
# clock for modes 1/2.
|
|
779
|
+
if not clk_changed:
|
|
780
|
+
return
|
|
781
|
+
mode = spi_mode[self.options['cpol'], self.options['cpha']]
|
|
782
|
+
sample_rising = mode in (0, 3)
|
|
783
|
+
if sample_rising and clk != 1:
|
|
784
|
+
return
|
|
785
|
+
if not sample_rising and clk != 0:
|
|
786
|
+
return
|
|
787
|
+
|
|
788
|
+
# Found the correct clock edge, now get the SPI bit(s).
|
|
789
|
+
self.handle_bit(datapins, clk, cs,frame)
|
|
790
|
+
|
|
791
|
+
def decode(self):
|
|
792
|
+
# The CLK & IO0 input is mandatory. Other signals are (individually)
|
|
793
|
+
# optional. Tell stacked decoders when we don't have a CS# signal.
|
|
794
|
+
if not self.has_channel(0):
|
|
795
|
+
raise ChannelError('CLK pin required.')
|
|
796
|
+
if not self.has_channel(1):
|
|
797
|
+
raise ChannelError('io0 pin required.')
|
|
798
|
+
|
|
799
|
+
self.have_io1 = self.has_channel(2)
|
|
800
|
+
self.have_io3 = self.has_channel(3) & self.has_channel(4)
|
|
801
|
+
self.have_cs = self.has_channel(5)
|
|
802
|
+
|
|
803
|
+
if not self.have_cs:
|
|
804
|
+
self.put(0, 0, self.out_python, ['CS-CHANGE', None, None])
|
|
805
|
+
|
|
806
|
+
frame = self.options['frame'] == 'yes'
|
|
807
|
+
|
|
808
|
+
# Wait for any change on the clock or chip-select lines. Edge
|
|
809
|
+
# qualification is done explicitly below. This avoids relying on
|
|
810
|
+
# version-specific edge matching behaviour in libsigrokdecode and
|
|
811
|
+
# keeps the decoder working with both DSView and sigrok-cli.
|
|
812
|
+
if self.have_cs:
|
|
813
|
+
wait_cond = [{0: 'e'}, {5: 'e'}]
|
|
814
|
+
else:
|
|
815
|
+
wait_cond = [{0: 'e'}]
|
|
816
|
+
|
|
817
|
+
(clk, d0, d1, d2, d3, cs) = self.wait(wait_cond)
|
|
818
|
+
d = (d3, d2, d1, d0)
|
|
819
|
+
self.find_clk_edge(d, clk, cs, True, frame)
|
|
820
|
+
|
|
821
|
+
while True:
|
|
822
|
+
(clk, d0, d1, d2, d3, cs) = self.wait(wait_cond)
|
|
823
|
+
d = (d3, d2, d1, d0)
|
|
824
|
+
self.find_clk_edge(d, clk, cs, False, frame)
|
|
825
|
+
|
|
826
|
+
|