logic-agent-mcp 0.0.0-stage → 1.2.1
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 +200 -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/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/bin/zlib1.dll +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,41 @@
|
|
|
1
|
+
##
|
|
2
|
+
## This file is part of the libsigrokdecode project.
|
|
3
|
+
##
|
|
4
|
+
## Copyright (C) 2019 Comlab AG
|
|
5
|
+
## Copyright (C) 2020 Gerhard Sittig <gerhard.sittig@gmx.net>
|
|
6
|
+
##
|
|
7
|
+
## This program is free software; you can redistribute it and/or modify
|
|
8
|
+
## it under the terms of the GNU General Public License as published by
|
|
9
|
+
## the Free Software Foundation; either version 2 of the License, or
|
|
10
|
+
## (at your option) any later version.
|
|
11
|
+
##
|
|
12
|
+
## This program is distributed in the hope that it will be useful,
|
|
13
|
+
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
## GNU General Public License for more details.
|
|
16
|
+
##
|
|
17
|
+
## You should have received a copy of the GNU General Public License
|
|
18
|
+
## along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
19
|
+
##
|
|
20
|
+
|
|
21
|
+
'''
|
|
22
|
+
This protocol decoder takes a set of logic input signals, and interprets
|
|
23
|
+
their bit pattern according to user specifications as different kinds of
|
|
24
|
+
numbers, or an enumeration of e.g. machine states.
|
|
25
|
+
|
|
26
|
+
Supported formats are: signed and unsigned integers, fixed point numbers,
|
|
27
|
+
IEEE754 floating point numbers, and number to text mapping controlled by
|
|
28
|
+
external data files. (Support for half precision floats depends on the
|
|
29
|
+
Python runtime, and may not universally be available.)
|
|
30
|
+
|
|
31
|
+
User provided text mapping files can either use the JSON format:
|
|
32
|
+
{"one": 1, "two": 2, "four": 4}
|
|
33
|
+
or the Python programming language:
|
|
34
|
+
enumtext = { 1: "one", 2: "two", 3: "three", }
|
|
35
|
+
|
|
36
|
+
In addition to all enum values on one row (sequential presentation of
|
|
37
|
+
the data), a limited number of enum values also are shown in tabular
|
|
38
|
+
presentation, which can help visualize state machines or task switches.
|
|
39
|
+
'''
|
|
40
|
+
|
|
41
|
+
from .pd import Decoder
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
##
|
|
2
|
+
## This file is part of the libsigrokdecode project.
|
|
3
|
+
##
|
|
4
|
+
## Copyright (C) 2019 Comlab AG
|
|
5
|
+
## Copyright (C) 2020 Gerhard Sittig <gerhard.sittig@gmx.net>
|
|
6
|
+
##
|
|
7
|
+
## This program is free software; you can redistribute it and/or modify
|
|
8
|
+
## it under the terms of the GNU General Public License as published by
|
|
9
|
+
## the Free Software Foundation; either version 2 of the License, or
|
|
10
|
+
## (at your option) any later version.
|
|
11
|
+
##
|
|
12
|
+
## This program is distributed in the hope that it will be useful,
|
|
13
|
+
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
## GNU General Public License for more details.
|
|
16
|
+
##
|
|
17
|
+
## You should have received a copy of the GNU General Public License
|
|
18
|
+
## along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
19
|
+
##
|
|
20
|
+
|
|
21
|
+
# This implementation started as a "vector slicer", then turned into the
|
|
22
|
+
# "numbers and states" decoder, because users always had the freedom to
|
|
23
|
+
# connect any logic signal to either of the decoder inputs. That's when
|
|
24
|
+
# slicing vectors took second seat, and just was not needed any longer
|
|
25
|
+
# in the strict sense.
|
|
26
|
+
#
|
|
27
|
+
# TODO
|
|
28
|
+
# - Find an appropriate number of input channels, and maximum enum slots.
|
|
29
|
+
# - Re-check correctness of signed integers. Signed fixed point is based
|
|
30
|
+
# on integers and transparently benefits from fixes and improvements.
|
|
31
|
+
# - Local formatting in individual decoders becomes obsolete when common
|
|
32
|
+
# support for user selected formatting gets introduced.
|
|
33
|
+
# - There is overlap with the 'parallel' decoder. Ideally the numbers
|
|
34
|
+
# decoder could stack on top of parallel, but parallel currently is
|
|
35
|
+
# severely limited in its number of input channels, and dramatically
|
|
36
|
+
# widening the parallel decoder may be undesirable.
|
|
37
|
+
|
|
38
|
+
from common.srdhelper import bitpack
|
|
39
|
+
import json
|
|
40
|
+
import sigrokdecode as srd
|
|
41
|
+
import struct
|
|
42
|
+
|
|
43
|
+
'''
|
|
44
|
+
OUTPUT_PYTHON format:
|
|
45
|
+
|
|
46
|
+
Packet:
|
|
47
|
+
[<ptype>, <pdata>]
|
|
48
|
+
|
|
49
|
+
This is a list of <ptype>s and their respective <pdata> values:
|
|
50
|
+
- 'RAW': The data is a tuple of bit count and bit pattern (a number,
|
|
51
|
+
assuming unsigned integer presentation of the input data bit pattern).
|
|
52
|
+
- 'NUMBER': The data is the conversion result of the bit pattern.
|
|
53
|
+
- 'ENUM': The data is a tuple of the raw number and its mapped text.
|
|
54
|
+
'''
|
|
55
|
+
|
|
56
|
+
# TODO Better raise the number of channels to 32. This allows access to
|
|
57
|
+
# IEEE754 single precision numbers, and shall cover most busses, _and_
|
|
58
|
+
# remains within most logic analyzers' capabilities, and keeps the UI
|
|
59
|
+
# dialog somewhat managable. What's a good default for the number of
|
|
60
|
+
# enum slots (which translate to annotation rows)? Notice that 2 to the
|
|
61
|
+
# power of the channel count is way out of the question. :)
|
|
62
|
+
_max_channels = 16
|
|
63
|
+
_max_enum_slots = 32
|
|
64
|
+
|
|
65
|
+
class ChannelError(Exception):
|
|
66
|
+
pass
|
|
67
|
+
|
|
68
|
+
class Pin:
|
|
69
|
+
CLK, BIT_0 = range(2)
|
|
70
|
+
BIT_N = BIT_0 + _max_channels
|
|
71
|
+
|
|
72
|
+
class Ann:
|
|
73
|
+
RAW, NUM = range(2)
|
|
74
|
+
ENUM_0 = NUM + 1
|
|
75
|
+
ENUM_OVR = ENUM_0 + _max_enum_slots
|
|
76
|
+
ENUMS = range(ENUM_0, ENUM_OVR)
|
|
77
|
+
WARN = ENUM_OVR + 1
|
|
78
|
+
|
|
79
|
+
@staticmethod
|
|
80
|
+
def enum_indices():
|
|
81
|
+
return [i for i in range(Ann.ENUMS)]
|
|
82
|
+
|
|
83
|
+
@staticmethod
|
|
84
|
+
def get_enum_idx(code):
|
|
85
|
+
if code in range(_max_enum_slots):
|
|
86
|
+
return Ann.ENUM_0 + code
|
|
87
|
+
return Ann.ENUM_OVR
|
|
88
|
+
|
|
89
|
+
def _channel_decl(count):
|
|
90
|
+
return tuple([
|
|
91
|
+
{'id': 'bit{}'.format(i), 'name': 'Bit{}'.format(i), 'desc': 'Bit position {}'.format(i)}
|
|
92
|
+
for i in range(count)
|
|
93
|
+
])
|
|
94
|
+
|
|
95
|
+
def _enum_cls_decl(count):
|
|
96
|
+
return tuple([
|
|
97
|
+
('enum{}'.format(i), 'Enumeration slot {}'.format(i))
|
|
98
|
+
for i in range(count)
|
|
99
|
+
] + [('enumovr', 'Enumeration overflow')])
|
|
100
|
+
|
|
101
|
+
def _enum_rows_decl(count):
|
|
102
|
+
return tuple([
|
|
103
|
+
('enums{}'.format(i), 'Enumeration slots {}'.format(i), (Ann.ENUM_0 + i,))
|
|
104
|
+
for i in range(count)
|
|
105
|
+
] + [('enumsovr', 'Enumeration overflows', (Ann.ENUM_OVR,))])
|
|
106
|
+
|
|
107
|
+
class Decoder(srd.Decoder):
|
|
108
|
+
api_version = 3
|
|
109
|
+
id = 'numbers_and_state'
|
|
110
|
+
name = 'Numbers and State'
|
|
111
|
+
longname = 'Interpret bit patters as numbers or state enums'
|
|
112
|
+
desc = 'Interpret bit patterns as different kinds of numbers (integer, float, enum).'
|
|
113
|
+
license = 'gplv2+'
|
|
114
|
+
inputs = ['logic']
|
|
115
|
+
outputs = ['numbers_and_state']
|
|
116
|
+
tags = ['Encoding', 'Util']
|
|
117
|
+
optional_channels = (
|
|
118
|
+
{'id': 'clk', 'name': 'Clock', 'desc': 'Clock'},
|
|
119
|
+
) + _channel_decl(_max_channels)
|
|
120
|
+
options = (
|
|
121
|
+
{'id': 'clkedge', 'desc': 'Clock edge', 'default': 'rising',
|
|
122
|
+
'values': ('rising', 'falling', 'either')},
|
|
123
|
+
{'id': 'count', 'desc': 'Total bits count', 'default': 0},
|
|
124
|
+
{'id': 'interp', 'desc': 'Interpretation', 'default': 'unsigned',
|
|
125
|
+
'values': ('unsigned', 'signed', 'fixpoint', 'fixsigned', 'ieee754', 'enum')},
|
|
126
|
+
{'id': 'fracbits', 'desc': 'Fraction bits count', 'default': 0},
|
|
127
|
+
{'id': 'mapping', 'desc': 'Enum to text map file',
|
|
128
|
+
'default': 'enumtext.json'},
|
|
129
|
+
{'id': 'format', 'desc': 'Number format', 'default': '-',
|
|
130
|
+
'values': ('-', 'bin', 'oct', 'dec', 'hex')},
|
|
131
|
+
)
|
|
132
|
+
annotations = (
|
|
133
|
+
('raw', 'Raw pattern'),
|
|
134
|
+
('number', 'Number'),
|
|
135
|
+
) + _enum_cls_decl(_max_enum_slots) + (
|
|
136
|
+
('warning', 'Warning'),
|
|
137
|
+
)
|
|
138
|
+
annotation_rows = (
|
|
139
|
+
('raws', 'Raw bits', (Ann.RAW,)),
|
|
140
|
+
('numbers', 'Numbers', (Ann.NUM,)),
|
|
141
|
+
) + _enum_rows_decl(_max_enum_slots) + (
|
|
142
|
+
('warnings', 'Warnings', (Ann.WARN,)),
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
def __init__(self):
|
|
146
|
+
self.reset()
|
|
147
|
+
|
|
148
|
+
def reset(self):
|
|
149
|
+
pass
|
|
150
|
+
|
|
151
|
+
def start(self):
|
|
152
|
+
self.out_ann = self.register(srd.OUTPUT_ANN)
|
|
153
|
+
self.out_python = self.register(srd.OUTPUT_PYTHON)
|
|
154
|
+
|
|
155
|
+
def putg(self, ss, es, cls, data):
|
|
156
|
+
self.put(ss, es, self.out_ann, [cls, data])
|
|
157
|
+
|
|
158
|
+
def putpy(self, ss, es, ptype, pdata):
|
|
159
|
+
self.put(ss, es, self.out_python, (ptype, pdata))
|
|
160
|
+
|
|
161
|
+
def grab_pattern(self, pins):
|
|
162
|
+
'''Get a bit pattern from potentially incomplete probes' values.'''
|
|
163
|
+
|
|
164
|
+
# Pad and trim the input data, to achieve the user specified
|
|
165
|
+
# total number of bits. Map all unassigned signals to 0 (low).
|
|
166
|
+
# Return raw number (unsigned integer interpreation).
|
|
167
|
+
bits = pins + (None,) * self.bitcount
|
|
168
|
+
bits = bits[:self.bitcount]
|
|
169
|
+
bits = [b if b in (0, 1) else 0 for b in bits]
|
|
170
|
+
pattern = bitpack(bits)
|
|
171
|
+
return pattern
|
|
172
|
+
|
|
173
|
+
def handle_pattern(self, ss, es, pattern):
|
|
174
|
+
fmt = '{{:0{}b}}'.format(self.bitcount)
|
|
175
|
+
txt = fmt.format(pattern)
|
|
176
|
+
self.putg(ss, es, Ann.RAW, [txt])
|
|
177
|
+
self.putpy(ss, es, 'RAW', (self.bitcount, pattern))
|
|
178
|
+
|
|
179
|
+
try:
|
|
180
|
+
value = self.interpreter(ss, es, pattern)
|
|
181
|
+
except:
|
|
182
|
+
value = None
|
|
183
|
+
if value is None:
|
|
184
|
+
return
|
|
185
|
+
self.putpy(ss, es, 'NUMBER', value)
|
|
186
|
+
try:
|
|
187
|
+
formatted = self.formatter(ss, es, value)
|
|
188
|
+
except:
|
|
189
|
+
formatted = None
|
|
190
|
+
if formatted:
|
|
191
|
+
self.putg(ss, es, Ann.NUM, formatted)
|
|
192
|
+
if self.interpreter == self.interp_enum:
|
|
193
|
+
cls = Ann.get_enum_idx(pattern)
|
|
194
|
+
self.putg(ss, es, cls, formatted)
|
|
195
|
+
self.putpy(ss, es, 'ENUM', (value, formatted))
|
|
196
|
+
|
|
197
|
+
def interp_unsigned(self, ss, es, pattern):
|
|
198
|
+
value = pattern
|
|
199
|
+
return value
|
|
200
|
+
|
|
201
|
+
def interp_signed(self, ss, es, pattern):
|
|
202
|
+
if not 'signmask' in self.interp_state:
|
|
203
|
+
self.interp_state.update({
|
|
204
|
+
'signmask': 1 << (self.bitcount - 1),
|
|
205
|
+
'signfull': 1 << self.bitcount,
|
|
206
|
+
})
|
|
207
|
+
is_neg = pattern & self.interp_state['signmask']
|
|
208
|
+
if is_neg:
|
|
209
|
+
value = -(self.interp_state['signfull'] - pattern)
|
|
210
|
+
else:
|
|
211
|
+
value = pattern
|
|
212
|
+
return value
|
|
213
|
+
|
|
214
|
+
def interp_fixpoint(self, ss, es, pattern):
|
|
215
|
+
if not 'fixdiv' in self.interp_state:
|
|
216
|
+
self.interp_state.update({
|
|
217
|
+
'fixsign': self.options['interp'] == 'fixsigned',
|
|
218
|
+
'fixdiv': 2 ** self.options['fracbits'],
|
|
219
|
+
})
|
|
220
|
+
if self.interp_state['fixsign']:
|
|
221
|
+
value = self.interp_signed(ss, es, pattern)
|
|
222
|
+
else:
|
|
223
|
+
value = self.interp_unsigned(ss, es, pattern)
|
|
224
|
+
value /= self.interp_state['fixdiv']
|
|
225
|
+
return value
|
|
226
|
+
|
|
227
|
+
def interp_ieee754(self, ss, es, pattern):
|
|
228
|
+
if not 'ieee_has_16bit' in self.interp_state:
|
|
229
|
+
self.interp_state.update({
|
|
230
|
+
'ieee_fmt_int_16': '=H',
|
|
231
|
+
'ieee_fmt_flt_16': '=e',
|
|
232
|
+
'ieee_fmt_int_32': '=L',
|
|
233
|
+
'ieee_fmt_flt_32': '=f',
|
|
234
|
+
'ieee_fmt_int_64': '=Q',
|
|
235
|
+
'ieee_fmt_flt_64': '=d',
|
|
236
|
+
})
|
|
237
|
+
try:
|
|
238
|
+
fmt = self.interp_state.update['ieee_fmt_flt_16']
|
|
239
|
+
has_16bit_support = 8 * struct.calcsize(fmt) == 16
|
|
240
|
+
except:
|
|
241
|
+
has_16bit_support = False
|
|
242
|
+
self.interp_state['ieee_has_16bit'] = has_16bit_support
|
|
243
|
+
if self.bitcount == 16:
|
|
244
|
+
if not self.interp_state['ieee_has_16bit']:
|
|
245
|
+
return None
|
|
246
|
+
buff = struct.pack(self.interp_state['ieee_fmt_int_16'], pattern)
|
|
247
|
+
value, = struct.unpack(self.interp_state['ieee_fmt_flt_16'], buff)
|
|
248
|
+
return value
|
|
249
|
+
if self.bitcount == 32:
|
|
250
|
+
buff = struct.pack(self.interp_state['ieee_fmt_int_32'], pattern)
|
|
251
|
+
value, = struct.unpack(self.interp_state['ieee_fmt_flt_32'], buff)
|
|
252
|
+
return value
|
|
253
|
+
if self.bitcount == 64:
|
|
254
|
+
buff = struct.pack(self.interp_state['ieee_fmt_int_64'], pattern)
|
|
255
|
+
value, = struct.unpack(self.interp_state['ieee_fmt_flt_64'], buff)
|
|
256
|
+
return value
|
|
257
|
+
return None
|
|
258
|
+
|
|
259
|
+
def interp_enum(self, ss, es, pattern):
|
|
260
|
+
if not 'enum_map' in self.interp_state:
|
|
261
|
+
self.interp_state.update({
|
|
262
|
+
'enum_fn': self.options['mapping'],
|
|
263
|
+
'enum_map': {},
|
|
264
|
+
'enum_have_map': False,
|
|
265
|
+
})
|
|
266
|
+
try:
|
|
267
|
+
fn = self.interp_state['enum_fn']
|
|
268
|
+
# TODO Optionally try in several locations? Next to the
|
|
269
|
+
# decoder implementation? Where else? Expect users to
|
|
270
|
+
# enter absolute paths?
|
|
271
|
+
with open(fn, 'r') as f:
|
|
272
|
+
maptext = f.read()
|
|
273
|
+
maptable = {}
|
|
274
|
+
if fn.endswith('.js') or fn.endswith('.json'):
|
|
275
|
+
# JSON requires string literals on the LHS, so the
|
|
276
|
+
# table is written "in reverse order".
|
|
277
|
+
js_table = json.loads(maptext)
|
|
278
|
+
for k, v in js_table.items():
|
|
279
|
+
maptable[v] = k
|
|
280
|
+
elif fn.endswith('.py'):
|
|
281
|
+
# Expect a specific identifier at the Python module
|
|
282
|
+
# level, and assume that it's a dictionary.
|
|
283
|
+
py_table = {}
|
|
284
|
+
exec(maptext, py_table)
|
|
285
|
+
maptable.update(py_table['enumtext'])
|
|
286
|
+
self.interp_state['enum_map'].update(maptable)
|
|
287
|
+
self.interp_state['enum_have_map'] = True
|
|
288
|
+
except:
|
|
289
|
+
# Silently ignore failure. This happens while the user
|
|
290
|
+
# is typing the filename, and is non-fatal. If the file
|
|
291
|
+
# exists and is not readable or not valid or of unknown
|
|
292
|
+
# format, the worst thing that can happen is that the
|
|
293
|
+
# decoder implementation keeps using "anonymous" phrases
|
|
294
|
+
# until a mapping has become available. No harm is done.
|
|
295
|
+
# This decoder cannot tell intermediate from final file
|
|
296
|
+
# read attempts, so we cannot raise severity here.
|
|
297
|
+
pass
|
|
298
|
+
value = self.interp_state['enum_map'].get(pattern, None)
|
|
299
|
+
if value is None:
|
|
300
|
+
value = pattern
|
|
301
|
+
return value
|
|
302
|
+
|
|
303
|
+
def format_native(self, ss, es, value):
|
|
304
|
+
return ['{}'.format(value),]
|
|
305
|
+
|
|
306
|
+
def format_bin(self, ss, es, value):
|
|
307
|
+
if not self.format_string:
|
|
308
|
+
self.format_string = '{{:0{}b}}'.format(self.bitcount)
|
|
309
|
+
return [self.format_string.format(value)]
|
|
310
|
+
|
|
311
|
+
def format_oct(self, ss, es, value):
|
|
312
|
+
if not self.format_string:
|
|
313
|
+
self.format_string = '{{:0{}o}}'.format((self.bitcount + 3 - 1) // 3)
|
|
314
|
+
return [self.format_string.format(value)]
|
|
315
|
+
|
|
316
|
+
def format_dec(self, ss, es, value):
|
|
317
|
+
if not self.format_string:
|
|
318
|
+
self.format_string = '{:d}'
|
|
319
|
+
return [self.format_string.format(value)]
|
|
320
|
+
|
|
321
|
+
def format_hex(self, ss, es, value):
|
|
322
|
+
if not self.format_string:
|
|
323
|
+
self.format_string = '{{:0{}x}}'.format((self.bitcount + 4 - 1) // 4)
|
|
324
|
+
return [self.format_string.format(value)]
|
|
325
|
+
|
|
326
|
+
def decode(self):
|
|
327
|
+
channels = [ch for ch in range(_max_channels) if self.has_channel(ch)]
|
|
328
|
+
have_clk = Pin.CLK in channels
|
|
329
|
+
if have_clk:
|
|
330
|
+
channels.remove(Pin.CLK)
|
|
331
|
+
if not channels:
|
|
332
|
+
raise ChannelError("Need at least one bit channel.")
|
|
333
|
+
if have_clk:
|
|
334
|
+
clkedge = {
|
|
335
|
+
'rising': 'r',
|
|
336
|
+
'falling': 'f',
|
|
337
|
+
'either': 'e',
|
|
338
|
+
}.get(self.options['clkedge'])
|
|
339
|
+
wait_cond = {Pin.CLK: clkedge}
|
|
340
|
+
else:
|
|
341
|
+
wait_cond = [{ch: 'e'} for ch in channels]
|
|
342
|
+
|
|
343
|
+
bitcount = self.options['count']
|
|
344
|
+
if not bitcount:
|
|
345
|
+
bitcount = channels[-1] - Pin.BIT_0 + 1
|
|
346
|
+
self.bitcount = bitcount
|
|
347
|
+
|
|
348
|
+
self.interpreter = {
|
|
349
|
+
'unsigned': self.interp_unsigned,
|
|
350
|
+
'signed': self.interp_signed,
|
|
351
|
+
'fixpoint': self.interp_fixpoint,
|
|
352
|
+
'fixsigned': self.interp_fixpoint,
|
|
353
|
+
'ieee754': self.interp_ieee754,
|
|
354
|
+
'enum': self.interp_enum,
|
|
355
|
+
}.get(self.options['interp'])
|
|
356
|
+
self.interp_state = {}
|
|
357
|
+
self.formatter = {
|
|
358
|
+
'-': self.format_native,
|
|
359
|
+
'bin': self.format_bin,
|
|
360
|
+
'oct': self.format_oct,
|
|
361
|
+
'dec': self.format_dec,
|
|
362
|
+
'hex': self.format_hex,
|
|
363
|
+
}.get(self.options['format'])
|
|
364
|
+
self.format_string = None
|
|
365
|
+
|
|
366
|
+
pins = self.wait()
|
|
367
|
+
ss = self.samplenum
|
|
368
|
+
prev_pattern = self.grab_pattern(pins[Pin.BIT_0:])
|
|
369
|
+
while True:
|
|
370
|
+
pins = self.wait(wait_cond)
|
|
371
|
+
es = self.samplenum
|
|
372
|
+
pattern = self.grab_pattern(pins[Pin.BIT_0:])
|
|
373
|
+
if pattern == prev_pattern:
|
|
374
|
+
continue
|
|
375
|
+
self.handle_pattern(ss, es, prev_pattern)
|
|
376
|
+
ss = es
|
|
377
|
+
prev_pattern = pattern
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
##
|
|
2
|
+
## This file is part of the libsigrokdecode project.
|
|
3
|
+
##
|
|
4
|
+
## Copyright (C) 2012 Uwe Hermann <uwe@hermann-uwe.de>
|
|
5
|
+
##
|
|
6
|
+
## This program is free software; you can redistribute it and/or modify
|
|
7
|
+
## it under the terms of the GNU General Public License as published by
|
|
8
|
+
## the Free Software Foundation; either version 2 of the License, or
|
|
9
|
+
## (at your option) any later version.
|
|
10
|
+
##
|
|
11
|
+
## This program is distributed in the hope that it will be useful,
|
|
12
|
+
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
## GNU General Public License for more details.
|
|
15
|
+
##
|
|
16
|
+
## You should have received a copy of the GNU General Public License
|
|
17
|
+
## along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
##
|
|
19
|
+
|
|
20
|
+
'''
|
|
21
|
+
This decoder stacks on top of the 'i2c' PD and decodes the Nintendo Wii
|
|
22
|
+
Nunchuk controller protocol.
|
|
23
|
+
|
|
24
|
+
Details:
|
|
25
|
+
http://wiibrew.org/wiki/Wiimote/Extension_Controllers/Nunchuck
|
|
26
|
+
http://todbot.com/blog/2008/02/18/wiichuck-wii-nunchuck-adapter-available/
|
|
27
|
+
https://www.sparkfun.com/products/9281
|
|
28
|
+
'''
|
|
29
|
+
|
|
30
|
+
from .pd import Decoder
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
##
|
|
2
|
+
## This file is part of the libsigrokdecode project.
|
|
3
|
+
##
|
|
4
|
+
## Copyright (C) 2010-2014 Uwe Hermann <uwe@hermann-uwe.de>
|
|
5
|
+
##
|
|
6
|
+
## This program is free software; you can redistribute it and/or modify
|
|
7
|
+
## it under the terms of the GNU General Public License as published by
|
|
8
|
+
## the Free Software Foundation; either version 2 of the License, or
|
|
9
|
+
## (at your option) any later version.
|
|
10
|
+
##
|
|
11
|
+
## This program is distributed in the hope that it will be useful,
|
|
12
|
+
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
## GNU General Public License for more details.
|
|
15
|
+
##
|
|
16
|
+
## You should have received a copy of the GNU General Public License
|
|
17
|
+
## along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
##
|
|
19
|
+
|
|
20
|
+
import sigrokdecode as srd
|
|
21
|
+
|
|
22
|
+
class Decoder(srd.Decoder):
|
|
23
|
+
api_version = 3
|
|
24
|
+
id = 'nunchuk'
|
|
25
|
+
name = 'Nunchuk'
|
|
26
|
+
longname = 'Nintendo Wii Nunchuk'
|
|
27
|
+
desc = 'Nintendo Wii Nunchuk controller protocol.'
|
|
28
|
+
license = 'gplv2+'
|
|
29
|
+
inputs = ['i2c']
|
|
30
|
+
outputs = []
|
|
31
|
+
tags = ['Sensor']
|
|
32
|
+
annotations = \
|
|
33
|
+
tuple(('reg-0x%02X' % i, 'Register 0x%02X' % i) for i in range(6)) + (
|
|
34
|
+
('bit-bz', 'BZ bit'),
|
|
35
|
+
('bit-bc', 'BC bit'),
|
|
36
|
+
('bit-ax', 'AX bits'),
|
|
37
|
+
('bit-ay', 'AY bits'),
|
|
38
|
+
('bit-az', 'AZ bits'),
|
|
39
|
+
('nunchuk-write', 'Nunchuk write'),
|
|
40
|
+
('cmd-init', 'Init command'),
|
|
41
|
+
('summary', 'Summary'),
|
|
42
|
+
('warning', 'Warning'),
|
|
43
|
+
)
|
|
44
|
+
annotation_rows = (
|
|
45
|
+
('regs', 'Registers', tuple(range(13))),
|
|
46
|
+
('summaries', 'Summaries', (13,)),
|
|
47
|
+
('warnings', 'Warnings', (14,)),
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
def __init__(self):
|
|
51
|
+
self.reset()
|
|
52
|
+
|
|
53
|
+
def reset(self):
|
|
54
|
+
self.state = 'IDLE'
|
|
55
|
+
self.sx = self.sy = self.ax = self.ay = self.az = self.bz = self.bc = -1
|
|
56
|
+
self.databytecount = 0
|
|
57
|
+
self.reg = 0x00
|
|
58
|
+
self.ss = self.es = self.ss_block = self.es_block = 0
|
|
59
|
+
self.init_seq = []
|
|
60
|
+
|
|
61
|
+
def start(self):
|
|
62
|
+
self.out_ann = self.register(srd.OUTPUT_ANN)
|
|
63
|
+
|
|
64
|
+
def putx(self, data):
|
|
65
|
+
self.put(self.ss, self.es, self.out_ann, data)
|
|
66
|
+
|
|
67
|
+
def putb(self, data):
|
|
68
|
+
self.put(self.ss_block, self.es_block, self.out_ann, data)
|
|
69
|
+
|
|
70
|
+
def putd(self, bit1, bit2, data):
|
|
71
|
+
self.put(self.bits[bit1][1], self.bits[bit2][2], self.out_ann, data)
|
|
72
|
+
|
|
73
|
+
def handle_reg_0x00(self, databyte):
|
|
74
|
+
self.ss_block = self.ss
|
|
75
|
+
self.sx = databyte
|
|
76
|
+
self.putx([0, ['Analog stick X position: 0x%02X' % self.sx,
|
|
77
|
+
'SX: 0x%02X' % self.sx]])
|
|
78
|
+
|
|
79
|
+
def handle_reg_0x01(self, databyte):
|
|
80
|
+
self.sy = databyte
|
|
81
|
+
self.putx([1, ['Analog stick Y position: 0x%02X' % self.sy,
|
|
82
|
+
'SY: 0x%02X' % self.sy]])
|
|
83
|
+
|
|
84
|
+
def handle_reg_0x02(self, databyte):
|
|
85
|
+
self.ax = databyte << 2
|
|
86
|
+
self.putx([2, ['Accelerometer X value bits[9:2]: 0x%03X' % self.ax,
|
|
87
|
+
'AX[9:2]: 0x%03X' % self.ax]])
|
|
88
|
+
|
|
89
|
+
def handle_reg_0x03(self, databyte):
|
|
90
|
+
self.ay = databyte << 2
|
|
91
|
+
self.putx([3, ['Accelerometer Y value bits[9:2]: 0x%03X' % self.ay,
|
|
92
|
+
'AY[9:2]: 0x%03X' % self.ay]])
|
|
93
|
+
|
|
94
|
+
def handle_reg_0x04(self, databyte):
|
|
95
|
+
self.az = databyte << 2
|
|
96
|
+
self.putx([4, ['Accelerometer Z value bits[9:2]: 0x%03X' % self.az,
|
|
97
|
+
'AZ[9:2]: 0x%03X' % self.az]])
|
|
98
|
+
|
|
99
|
+
def handle_reg_0x05(self, databyte):
|
|
100
|
+
self.es_block = self.es
|
|
101
|
+
self.bz = (databyte & (1 << 0)) >> 0 # Bits[0:0]
|
|
102
|
+
self.bc = (databyte & (1 << 1)) >> 1 # Bits[1:1]
|
|
103
|
+
ax_rest = (databyte & (3 << 2)) >> 2 # Bits[3:2]
|
|
104
|
+
ay_rest = (databyte & (3 << 4)) >> 4 # Bits[5:4]
|
|
105
|
+
az_rest = (databyte & (3 << 6)) >> 6 # Bits[7:6]
|
|
106
|
+
self.ax |= ax_rest
|
|
107
|
+
self.ay |= ay_rest
|
|
108
|
+
self.az |= az_rest
|
|
109
|
+
|
|
110
|
+
# self.putx([5, ['Register 5', 'Reg 5', 'R5']])
|
|
111
|
+
|
|
112
|
+
s = '' if (self.bz == 0) else 'not '
|
|
113
|
+
self.putd(0, 0, [6, ['Z: %spressed' % s, 'BZ: %d' % self.bz]])
|
|
114
|
+
|
|
115
|
+
s = '' if (self.bc == 0) else 'not '
|
|
116
|
+
self.putd(1, 1, [7, ['C: %spressed' % s, 'BC: %d' % self.bc]])
|
|
117
|
+
|
|
118
|
+
self.putd(3, 2, [8, ['Accelerometer X value bits[1:0]: 0x%X' % ax_rest,
|
|
119
|
+
'AX[1:0]: 0x%X' % ax_rest]])
|
|
120
|
+
|
|
121
|
+
self.putd(5, 4, [9, ['Accelerometer Y value bits[1:0]: 0x%X' % ay_rest,
|
|
122
|
+
'AY[1:0]: 0x%X' % ay_rest]])
|
|
123
|
+
|
|
124
|
+
self.putd(7, 6, [10, ['Accelerometer Z value bits[1:0]: 0x%X' % az_rest,
|
|
125
|
+
'AZ[1:0]: 0x%X' % az_rest]])
|
|
126
|
+
|
|
127
|
+
self.reg = 0x00
|
|
128
|
+
|
|
129
|
+
def output_full_block_if_possible(self):
|
|
130
|
+
# For now, only output summary annotations if all values are available.
|
|
131
|
+
t = (self.sx, self.sy, self.ax, self.ay, self.az, self.bz, self.bc)
|
|
132
|
+
if -1 in t:
|
|
133
|
+
return
|
|
134
|
+
bz = 'pressed' if self.bz == 0 else 'not pressed'
|
|
135
|
+
bc = 'pressed' if self.bc == 0 else 'not pressed'
|
|
136
|
+
s = 'Analog stick: %d/%d, accelerometer: %d/%d/%d, Z: %s, C: %s' % \
|
|
137
|
+
(self.sx, self.sy, self.ax, self.ay, self.az, bz, bc)
|
|
138
|
+
self.putb([13, [s]])
|
|
139
|
+
|
|
140
|
+
def handle_reg_write(self, databyte):
|
|
141
|
+
self.putx([11, ['Nunchuk write: 0x%02X' % databyte]])
|
|
142
|
+
if len(self.init_seq) < 2:
|
|
143
|
+
self.init_seq.append(databyte)
|
|
144
|
+
|
|
145
|
+
def output_init_seq(self):
|
|
146
|
+
if len(self.init_seq) != 2:
|
|
147
|
+
self.putb([14, ['Init sequence was %d bytes long (2 expected)' % \
|
|
148
|
+
len(self.init_seq)]])
|
|
149
|
+
return
|
|
150
|
+
|
|
151
|
+
if self.init_seq != [0x40, 0x00]:
|
|
152
|
+
self.putb([14, ['Unknown init sequence (expected: 0x40 0x00)']])
|
|
153
|
+
return
|
|
154
|
+
|
|
155
|
+
# TODO: Detect Nunchuk clones (they have different init sequences).
|
|
156
|
+
|
|
157
|
+
self.putb([12, ['Initialize Nunchuk', 'Init Nunchuk', 'Init', 'I']])
|
|
158
|
+
|
|
159
|
+
def decode(self, ss, es, data):
|
|
160
|
+
cmd, databyte = data
|
|
161
|
+
|
|
162
|
+
# Collect the 'BITS' packet, then return. The next packet is
|
|
163
|
+
# guaranteed to belong to these bits we just stored.
|
|
164
|
+
if cmd == 'BITS':
|
|
165
|
+
self.bits = databyte
|
|
166
|
+
return
|
|
167
|
+
|
|
168
|
+
self.ss, self.es = ss, es
|
|
169
|
+
|
|
170
|
+
# State machine.
|
|
171
|
+
if self.state == 'IDLE':
|
|
172
|
+
# Wait for an I²C START condition.
|
|
173
|
+
if cmd != 'START':
|
|
174
|
+
return
|
|
175
|
+
self.state = 'GET SLAVE ADDR'
|
|
176
|
+
self.ss_block = ss
|
|
177
|
+
elif self.state == 'GET SLAVE ADDR':
|
|
178
|
+
# Wait for an address read/write operation.
|
|
179
|
+
if cmd == 'ADDRESS READ':
|
|
180
|
+
self.state = 'READ REGS'
|
|
181
|
+
elif cmd == 'ADDRESS WRITE':
|
|
182
|
+
self.state = 'WRITE REGS'
|
|
183
|
+
elif self.state == 'READ REGS':
|
|
184
|
+
if cmd == 'DATA READ':
|
|
185
|
+
handle_reg = getattr(self, 'handle_reg_0x%02x' % self.reg)
|
|
186
|
+
handle_reg(databyte)
|
|
187
|
+
self.reg += 1
|
|
188
|
+
elif cmd == 'STOP':
|
|
189
|
+
self.es_block = es
|
|
190
|
+
self.output_full_block_if_possible()
|
|
191
|
+
self.sx = self.sy = self.ax = self.ay = self.az = -1
|
|
192
|
+
self.bz = self.bc = -1
|
|
193
|
+
self.state = 'IDLE'
|
|
194
|
+
else:
|
|
195
|
+
# self.putx([14, ['Ignoring: %s (data=%s)' % (cmd, databyte)]])
|
|
196
|
+
pass
|
|
197
|
+
elif self.state == 'WRITE REGS':
|
|
198
|
+
if cmd == 'DATA WRITE':
|
|
199
|
+
self.handle_reg_write(databyte)
|
|
200
|
+
elif cmd == 'STOP':
|
|
201
|
+
self.es_block = es
|
|
202
|
+
self.output_init_seq()
|
|
203
|
+
self.init_seq = []
|
|
204
|
+
self.state = 'IDLE'
|
|
205
|
+
else:
|
|
206
|
+
# self.putx([14, ['Ignoring: %s (data=%s)' % (cmd, databyte)]])
|
|
207
|
+
pass
|