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,146 @@
|
|
|
1
|
+
##
|
|
2
|
+
## This file is part of the libsigrokdecode project.
|
|
3
|
+
##
|
|
4
|
+
## Copyright (C) 2020 Tomas Mudrunka <harvie@github>
|
|
5
|
+
##
|
|
6
|
+
## Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
## of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
## in the Software without restriction, including without limitation the rights
|
|
9
|
+
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
## copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
## furnished to do so, subject to the following conditions:
|
|
12
|
+
##
|
|
13
|
+
## The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
## copies or substantial portions of the Software.
|
|
15
|
+
##
|
|
16
|
+
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
## SOFTWARE.
|
|
23
|
+
|
|
24
|
+
import sigrokdecode as srd
|
|
25
|
+
from common.srdhelper import bitpack
|
|
26
|
+
|
|
27
|
+
# Millimeters per inch.
|
|
28
|
+
mm_per_inch = 25.4
|
|
29
|
+
|
|
30
|
+
class Decoder(srd.Decoder):
|
|
31
|
+
api_version = 3
|
|
32
|
+
id = 'caliper'
|
|
33
|
+
name = 'Caliper'
|
|
34
|
+
longname = 'Digital calipers'
|
|
35
|
+
desc = 'Protocol of cheap generic digital calipers.'
|
|
36
|
+
license = 'mit'
|
|
37
|
+
inputs = ['logic']
|
|
38
|
+
outputs = []
|
|
39
|
+
channels = (
|
|
40
|
+
{'id': 'clk', 'name': 'CLK', 'desc': 'Serial clock line'},
|
|
41
|
+
{'id': 'data', 'name': 'DATA', 'desc': 'Serial data line'},
|
|
42
|
+
)
|
|
43
|
+
options = (
|
|
44
|
+
{'id': 'timeout_ms', 'desc': 'Packet timeout in ms, 0 to disable',
|
|
45
|
+
'default': 10},
|
|
46
|
+
{'id': 'unit', 'desc': 'Convert units', 'default': 'keep',
|
|
47
|
+
'values': ('keep', 'mm', 'inch')},
|
|
48
|
+
{'id': 'changes', 'desc': 'Changes only', 'default': 'no',
|
|
49
|
+
'values': ('no', 'yes')},
|
|
50
|
+
)
|
|
51
|
+
tags = ['Analog/digital', 'Sensor']
|
|
52
|
+
annotations = (
|
|
53
|
+
('measurement', 'Measurement'),
|
|
54
|
+
('warning', 'Warning'),
|
|
55
|
+
)
|
|
56
|
+
annotation_rows = (
|
|
57
|
+
('measurements', 'Measurements', (0,)),
|
|
58
|
+
('warnings', 'Warnings', (1,)),
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
def metadata(self, key, value):
|
|
62
|
+
if key == srd.SRD_CONF_SAMPLERATE:
|
|
63
|
+
self.samplerate = value
|
|
64
|
+
|
|
65
|
+
def __init__(self):
|
|
66
|
+
self.reset()
|
|
67
|
+
|
|
68
|
+
def reset(self):
|
|
69
|
+
self.ss, self.es = 0, 0
|
|
70
|
+
self.number_bits = []
|
|
71
|
+
self.flags_bits = []
|
|
72
|
+
|
|
73
|
+
def start(self):
|
|
74
|
+
self.out_ann = self.register(srd.OUTPUT_ANN)
|
|
75
|
+
|
|
76
|
+
def putg(self, ss, es, cls, data):
|
|
77
|
+
self.put(ss, es, self.out_ann, [cls, data])
|
|
78
|
+
|
|
79
|
+
def decode(self):
|
|
80
|
+
last_sent = None
|
|
81
|
+
timeout_ms = self.options['timeout_ms']
|
|
82
|
+
want_unit = self.options['unit']
|
|
83
|
+
show_all = self.options['changes'] == 'no'
|
|
84
|
+
wait_cond = [{0: 'r'}]
|
|
85
|
+
if timeout_ms:
|
|
86
|
+
snum_per_ms = self.samplerate / 1000
|
|
87
|
+
timeout_snum = timeout_ms * snum_per_ms
|
|
88
|
+
wait_cond.append({'skip': round(timeout_snum)})
|
|
89
|
+
while True:
|
|
90
|
+
# Sample data at the rising clock edge. Optionally timeout
|
|
91
|
+
# after inactivity for a user specified period. Present the
|
|
92
|
+
# number of unprocessed bits to the user for diagnostics.
|
|
93
|
+
clk, data = self.wait(wait_cond)
|
|
94
|
+
if timeout_ms and not self.matched[0]:
|
|
95
|
+
if self.number_bits or self.flags_bits:
|
|
96
|
+
count = len(self.number_bits) + len(self.flags_bits)
|
|
97
|
+
self.putg(self.ss, self.samplenum, 1, [
|
|
98
|
+
'timeout with {} bits in buffer'.format(count),
|
|
99
|
+
'timeout ({} bits)'.format(count),
|
|
100
|
+
'timeout',
|
|
101
|
+
])
|
|
102
|
+
self.reset()
|
|
103
|
+
continue
|
|
104
|
+
|
|
105
|
+
# Store position of first bit and last activity.
|
|
106
|
+
# Shift in measured number and flag bits.
|
|
107
|
+
if not self.ss:
|
|
108
|
+
self.ss = self.samplenum
|
|
109
|
+
self.es = self.samplenum
|
|
110
|
+
if len(self.number_bits) < 16:
|
|
111
|
+
self.number_bits.append(data)
|
|
112
|
+
continue
|
|
113
|
+
if len(self.flags_bits) < 8:
|
|
114
|
+
self.flags_bits.append(data)
|
|
115
|
+
if len(self.flags_bits) < 8:
|
|
116
|
+
continue
|
|
117
|
+
|
|
118
|
+
# Get raw values from received data bits. Run the number
|
|
119
|
+
# conversion, controlled by flags and/or user specs.
|
|
120
|
+
negative = bool(self.flags_bits[4])
|
|
121
|
+
is_inch = bool(self.flags_bits[7])
|
|
122
|
+
number = bitpack(self.number_bits)
|
|
123
|
+
if negative:
|
|
124
|
+
number = -number
|
|
125
|
+
if is_inch:
|
|
126
|
+
number /= 2000
|
|
127
|
+
if want_unit == 'mm':
|
|
128
|
+
number *= mm_per_inch
|
|
129
|
+
is_inch = False
|
|
130
|
+
else:
|
|
131
|
+
number /= 100
|
|
132
|
+
if want_unit == 'inch':
|
|
133
|
+
number = round(number / mm_per_inch, 4)
|
|
134
|
+
is_inch = True
|
|
135
|
+
unit = 'in' if is_inch else 'mm'
|
|
136
|
+
|
|
137
|
+
# Construct and emit an annotation.
|
|
138
|
+
if show_all or (number, unit) != last_sent:
|
|
139
|
+
self.putg(self.ss, self.es, 0, [
|
|
140
|
+
'{number}{unit}'.format(**locals()),
|
|
141
|
+
'{number}'.format(**locals()),
|
|
142
|
+
])
|
|
143
|
+
last_sent = (number, unit)
|
|
144
|
+
|
|
145
|
+
# Reset internal state for the start of the next packet.
|
|
146
|
+
self.reset()
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
CAN (Controller Area Network) is a field bus protocol for distributed
|
|
22
|
+
real-time control.
|
|
23
|
+
|
|
24
|
+
This decoder assumes that a single CAN_RX line is sampled (e.g. on
|
|
25
|
+
the digital output side of a CAN transceiver IC such as the Microchip
|
|
26
|
+
MCP-2515DM-BM).
|
|
27
|
+
|
|
28
|
+
It also has support for CAN-FD.
|
|
29
|
+
'''
|
|
30
|
+
|
|
31
|
+
from .pd import Decoder
|
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
##
|
|
2
|
+
## This file is part of the libsigrokdecode project.
|
|
3
|
+
##
|
|
4
|
+
## Copyright (C) 2012-2013 Uwe Hermann <uwe@hermann-uwe.de>
|
|
5
|
+
## Copyright (C) 2019 Stephan Thiele <stephan.thiele@mailbox.org>
|
|
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
|
+
from common.srdhelper import bitpack_msb
|
|
22
|
+
import sigrokdecode as srd
|
|
23
|
+
|
|
24
|
+
class SamplerateError(Exception):
|
|
25
|
+
pass
|
|
26
|
+
|
|
27
|
+
def dlc2len(dlc):
|
|
28
|
+
return [0, 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 20, 24, 32, 48, 64][dlc]
|
|
29
|
+
|
|
30
|
+
class Decoder(srd.Decoder):
|
|
31
|
+
api_version = 3
|
|
32
|
+
id = 'can'
|
|
33
|
+
name = 'CAN'
|
|
34
|
+
longname = 'Controller Area Network'
|
|
35
|
+
desc = 'Field bus protocol for distributed realtime control.'
|
|
36
|
+
license = 'gplv2+'
|
|
37
|
+
inputs = ['logic']
|
|
38
|
+
outputs = ['can']
|
|
39
|
+
tags = ['Automotive']
|
|
40
|
+
channels = (
|
|
41
|
+
{'id': 'can_rx', 'name': 'CAN RX', 'desc': 'CAN bus line'},
|
|
42
|
+
)
|
|
43
|
+
options = (
|
|
44
|
+
{'id': 'nominal_bitrate', 'desc': 'Nominal bitrate (bits/s)', 'default': 1000000},
|
|
45
|
+
{'id': 'fast_bitrate', 'desc': 'Fast bitrate (bits/s)', 'default': 2000000},
|
|
46
|
+
{'id': 'sample_point', 'desc': 'Sample point (%)', 'default': 70.0},
|
|
47
|
+
)
|
|
48
|
+
annotations = (
|
|
49
|
+
('data', 'Payload data'),
|
|
50
|
+
('sof', 'Start of frame'),
|
|
51
|
+
('eof', 'End of frame'),
|
|
52
|
+
('id', 'Identifier'),
|
|
53
|
+
('ext-id', 'Extended identifier'),
|
|
54
|
+
('full-id', 'Full identifier'),
|
|
55
|
+
('ide', 'Identifier extension bit'),
|
|
56
|
+
('reserved-bit', 'Reserved bit 0 and 1'),
|
|
57
|
+
('rtr', 'Remote transmission request'),
|
|
58
|
+
('srr', 'Substitute remote request'),
|
|
59
|
+
('dlc', 'Data length count'),
|
|
60
|
+
('crc-sequence', 'CRC sequence'),
|
|
61
|
+
('crc-delimiter', 'CRC delimiter'),
|
|
62
|
+
('ack-slot', 'ACK slot'),
|
|
63
|
+
('ack-delimiter', 'ACK delimiter'),
|
|
64
|
+
('stuff-bit', 'Stuff bit'),
|
|
65
|
+
('warning', 'Warning'),
|
|
66
|
+
('bit', 'Bit'),
|
|
67
|
+
)
|
|
68
|
+
annotation_rows = (
|
|
69
|
+
('bits', 'Bits', (15, 17)),
|
|
70
|
+
('fields', 'Fields', tuple(range(15))),
|
|
71
|
+
('warnings', 'Warnings', (16,)),
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
def __init__(self):
|
|
75
|
+
self.reset()
|
|
76
|
+
|
|
77
|
+
def reset(self):
|
|
78
|
+
self.samplerate = None
|
|
79
|
+
self.reset_variables()
|
|
80
|
+
|
|
81
|
+
def start(self):
|
|
82
|
+
self.out_ann = self.register(srd.OUTPUT_ANN)
|
|
83
|
+
self.out_python = self.register(srd.OUTPUT_PYTHON)
|
|
84
|
+
|
|
85
|
+
def set_bit_rate(self, bitrate):
|
|
86
|
+
self.bit_width = float(self.samplerate) / float(bitrate)
|
|
87
|
+
self.sample_point = (self.bit_width / 100.0) * self.options['sample_point']
|
|
88
|
+
|
|
89
|
+
def set_nominal_bitrate(self):
|
|
90
|
+
self.set_bit_rate(self.options['nominal_bitrate'])
|
|
91
|
+
|
|
92
|
+
def set_fast_bitrate(self):
|
|
93
|
+
self.set_bit_rate(self.options['fast_bitrate'])
|
|
94
|
+
|
|
95
|
+
def metadata(self, key, value):
|
|
96
|
+
if key == srd.SRD_CONF_SAMPLERATE:
|
|
97
|
+
self.samplerate = value
|
|
98
|
+
self.bit_width = float(self.samplerate) / float(self.options['nominal_bitrate'])
|
|
99
|
+
self.sample_point = (self.bit_width / 100.0) * self.options['sample_point']
|
|
100
|
+
|
|
101
|
+
# Generic helper for CAN bit annotations.
|
|
102
|
+
def putg(self, ss, es, data):
|
|
103
|
+
left, right = int(self.sample_point), int(self.bit_width - self.sample_point)
|
|
104
|
+
self.put(ss - left, es + right, self.out_ann, data)
|
|
105
|
+
|
|
106
|
+
# Single-CAN-bit annotation using the current samplenum.
|
|
107
|
+
def putx(self, data):
|
|
108
|
+
self.putg(self.samplenum, self.samplenum, data)
|
|
109
|
+
|
|
110
|
+
# Single-CAN-bit annotation using the samplenum of CAN bit 12.
|
|
111
|
+
def put12(self, data):
|
|
112
|
+
self.putg(self.ss_bit12, self.ss_bit12, data)
|
|
113
|
+
|
|
114
|
+
# Single-CAN-bit annotation using the samplenum of CAN bit 32.
|
|
115
|
+
def put32(self, data):
|
|
116
|
+
self.putg(self.ss_bit32, self.ss_bit32, data)
|
|
117
|
+
|
|
118
|
+
# Multi-CAN-bit annotation from self.ss_block to current samplenum.
|
|
119
|
+
def putb(self, data):
|
|
120
|
+
self.putg(self.ss_block, self.samplenum, data)
|
|
121
|
+
|
|
122
|
+
def putpy(self, data):
|
|
123
|
+
self.put(self.ss_packet, self.es_packet, self.out_python, data)
|
|
124
|
+
|
|
125
|
+
def reset_variables(self):
|
|
126
|
+
self.state = 'IDLE'
|
|
127
|
+
self.sof = self.frame_type = self.dlc = None
|
|
128
|
+
self.rawbits = [] # All bits, including stuff bits
|
|
129
|
+
self.bits = [] # Only actual CAN frame bits (no stuff bits)
|
|
130
|
+
self.curbit = 0 # Current bit of CAN frame (bit 0 == SOF)
|
|
131
|
+
self.last_databit = 999 # Positive value that bitnum+x will never match
|
|
132
|
+
self.ss_block = None
|
|
133
|
+
self.ss_bit12 = None
|
|
134
|
+
self.ss_bit32 = None
|
|
135
|
+
self.ss_databytebits = []
|
|
136
|
+
self.frame_bytes = []
|
|
137
|
+
self.rtr_type = None
|
|
138
|
+
self.fd = False
|
|
139
|
+
self.rtr = None
|
|
140
|
+
|
|
141
|
+
# Poor man's clock synchronization. Use signal edges which change to
|
|
142
|
+
# dominant state in rather simple ways. This naive approach is neither
|
|
143
|
+
# aware of the SYNC phase's width nor the specific location of the edge,
|
|
144
|
+
# but improves the decoder's reliability when the input signal's bitrate
|
|
145
|
+
# does not exactly match the nominal rate.
|
|
146
|
+
def dom_edge_seen(self, force = False):
|
|
147
|
+
self.dom_edge_snum = self.samplenum
|
|
148
|
+
self.dom_edge_bcount = self.curbit
|
|
149
|
+
|
|
150
|
+
# Determine the position of the next desired bit's sample point.
|
|
151
|
+
def get_sample_point(self, bitnum):
|
|
152
|
+
samplenum = self.dom_edge_snum
|
|
153
|
+
samplenum += self.bit_width * (bitnum - self.dom_edge_bcount)
|
|
154
|
+
samplenum += self.sample_point
|
|
155
|
+
return int(samplenum)
|
|
156
|
+
|
|
157
|
+
def is_stuff_bit(self):
|
|
158
|
+
# CAN uses NRZ encoding and bit stuffing.
|
|
159
|
+
# After 5 identical bits, a stuff bit of opposite value is added.
|
|
160
|
+
# But not in the CRC delimiter, ACK, and end of frame fields.
|
|
161
|
+
if len(self.bits) > self.last_databit + 17:
|
|
162
|
+
return False
|
|
163
|
+
last_6_bits = self.rawbits[-6:]
|
|
164
|
+
if last_6_bits not in ([0, 0, 0, 0, 0, 1], [1, 1, 1, 1, 1, 0]):
|
|
165
|
+
return False
|
|
166
|
+
|
|
167
|
+
# Stuff bit. Keep it in self.rawbits, but drop it from self.bits.
|
|
168
|
+
self.bits.pop() # Drop last bit.
|
|
169
|
+
return True
|
|
170
|
+
|
|
171
|
+
def is_valid_crc(self, crc_bits):
|
|
172
|
+
return True # TODO
|
|
173
|
+
|
|
174
|
+
def decode_error_frame(self, bits):
|
|
175
|
+
pass # TODO
|
|
176
|
+
|
|
177
|
+
def decode_overload_frame(self, bits):
|
|
178
|
+
pass # TODO
|
|
179
|
+
|
|
180
|
+
# Both standard and extended frames end with CRC, CRC delimiter, ACK,
|
|
181
|
+
# ACK delimiter, and EOF fields. Handle them in a common function.
|
|
182
|
+
# Returns True if the frame ended (EOF), False otherwise.
|
|
183
|
+
def decode_frame_end(self, can_rx, bitnum):
|
|
184
|
+
|
|
185
|
+
# Remember start of CRC sequence (see below).
|
|
186
|
+
if bitnum == (self.last_databit + 1):
|
|
187
|
+
self.ss_block = self.samplenum
|
|
188
|
+
if self.fd:
|
|
189
|
+
if dlc2len(self.dlc) < 16:
|
|
190
|
+
self.crc_len = 27 # 17 + SBC + stuff bits
|
|
191
|
+
else:
|
|
192
|
+
self.crc_len = 32 # 21 + SBC + stuff bits
|
|
193
|
+
else:
|
|
194
|
+
self.crc_len = 15
|
|
195
|
+
|
|
196
|
+
# CRC sequence (15 bits, 17 bits or 21 bits)
|
|
197
|
+
elif bitnum == (self.last_databit + self.crc_len):
|
|
198
|
+
if self.fd:
|
|
199
|
+
if dlc2len(self.dlc) < 16:
|
|
200
|
+
crc_type = "CRC-17"
|
|
201
|
+
else:
|
|
202
|
+
crc_type = "CRC-21"
|
|
203
|
+
else:
|
|
204
|
+
crc_type = "CRC-15"
|
|
205
|
+
|
|
206
|
+
x = self.last_databit + 1
|
|
207
|
+
crc_bits = self.bits[x:x + self.crc_len + 1]
|
|
208
|
+
self.crc = bitpack_msb(crc_bits)
|
|
209
|
+
self.putb([11, ['%s sequence: 0x%04x' % (crc_type, self.crc),
|
|
210
|
+
'%s: 0x%04x' % (crc_type, self.crc), '%s' % crc_type]])
|
|
211
|
+
if not self.is_valid_crc(crc_bits):
|
|
212
|
+
self.putb([16, ['CRC is invalid']])
|
|
213
|
+
|
|
214
|
+
# CRC delimiter bit (recessive)
|
|
215
|
+
elif bitnum == (self.last_databit + self.crc_len + 1):
|
|
216
|
+
self.putx([12, ['CRC delimiter: %d' % can_rx,
|
|
217
|
+
'CRC d: %d' % can_rx, 'CRC d']])
|
|
218
|
+
if can_rx != 1:
|
|
219
|
+
self.putx([16, ['CRC delimiter must be a recessive bit']])
|
|
220
|
+
|
|
221
|
+
if self.fd:
|
|
222
|
+
self.set_nominal_bitrate()
|
|
223
|
+
|
|
224
|
+
# ACK slot bit (dominant: ACK, recessive: NACK)
|
|
225
|
+
elif bitnum == (self.last_databit + self.crc_len + 2):
|
|
226
|
+
ack = 'ACK' if can_rx == 0 else 'NACK'
|
|
227
|
+
self.putx([13, ['ACK slot: %s' % ack, 'ACK s: %s' % ack, 'ACK s']])
|
|
228
|
+
|
|
229
|
+
# ACK delimiter bit (recessive)
|
|
230
|
+
elif bitnum == (self.last_databit + self.crc_len + 3):
|
|
231
|
+
self.putx([14, ['ACK delimiter: %d' % can_rx,
|
|
232
|
+
'ACK d: %d' % can_rx, 'ACK d']])
|
|
233
|
+
if can_rx != 1:
|
|
234
|
+
self.putx([16, ['ACK delimiter must be a recessive bit']])
|
|
235
|
+
|
|
236
|
+
# Remember start of EOF (see below).
|
|
237
|
+
elif bitnum == (self.last_databit + self.crc_len + 4):
|
|
238
|
+
self.ss_block = self.samplenum
|
|
239
|
+
|
|
240
|
+
# End of frame (EOF), 7 recessive bits
|
|
241
|
+
elif bitnum == (self.last_databit + self.crc_len + 10):
|
|
242
|
+
self.putb([2, ['End of frame', 'EOF', 'E']])
|
|
243
|
+
if self.rawbits[-7:] != [1, 1, 1, 1, 1, 1, 1]:
|
|
244
|
+
self.putb([16, ['End of frame (EOF) must be 7 recessive bits']])
|
|
245
|
+
self.es_packet = self.samplenum
|
|
246
|
+
py_data = tuple([self.frame_type, self.fullid, self.rtr_type,
|
|
247
|
+
self.dlc, self.frame_bytes])
|
|
248
|
+
self.putpy(py_data)
|
|
249
|
+
self.reset_variables()
|
|
250
|
+
return True
|
|
251
|
+
|
|
252
|
+
return False
|
|
253
|
+
|
|
254
|
+
# Returns True if the frame ended (EOF), False otherwise.
|
|
255
|
+
def decode_standard_frame(self, can_rx, bitnum):
|
|
256
|
+
|
|
257
|
+
# Bit 14: FDF (Flexible data format)
|
|
258
|
+
# Has to be sent dominant when FD frame, has to be sent recessive
|
|
259
|
+
# when classic CAN frame.
|
|
260
|
+
if bitnum == 14:
|
|
261
|
+
self.fd = True if can_rx else False
|
|
262
|
+
if self.fd:
|
|
263
|
+
self.putx([7, ['Flexible data format: %d' % can_rx,
|
|
264
|
+
'FDF: %d' % can_rx, 'FDF']])
|
|
265
|
+
else:
|
|
266
|
+
self.putx([7, ['Reserved bit 0: %d' % can_rx,
|
|
267
|
+
'RB0: %d' % can_rx, 'RB0']])
|
|
268
|
+
|
|
269
|
+
if self.fd:
|
|
270
|
+
# Bit 12: Substitute remote request (SRR) bit
|
|
271
|
+
self.put12([8, ['Substitute remote request', 'SRR']])
|
|
272
|
+
self.dlc_start = 18
|
|
273
|
+
else:
|
|
274
|
+
# Bit 12: Remote transmission request (RTR) bit
|
|
275
|
+
# Data frame: dominant, remote frame: recessive
|
|
276
|
+
# Remote frames do not contain a data field.
|
|
277
|
+
rtr = 'remote' if self.bits[12] == 1 else 'data'
|
|
278
|
+
self.put12([8, ['Remote transmission request: %s frame' % rtr,
|
|
279
|
+
'RTR: %s frame' % rtr, 'RTR']])
|
|
280
|
+
self.rtr_type = rtr
|
|
281
|
+
self.dlc_start = 15
|
|
282
|
+
|
|
283
|
+
if bitnum == 15 and self.fd:
|
|
284
|
+
self.putx([7, ['Reserved: %d' % can_rx, 'R0: %d' % can_rx, 'R0']])
|
|
285
|
+
|
|
286
|
+
if bitnum == 16 and self.fd:
|
|
287
|
+
self.putx([7, ['Bit rate switch: %d' % can_rx, 'BRS: %d' % can_rx, 'BRS']])
|
|
288
|
+
|
|
289
|
+
if bitnum == 17 and self.fd:
|
|
290
|
+
self.putx([7, ['Error state indicator: %d' % can_rx, 'ESI: %d' % can_rx, 'ESI']])
|
|
291
|
+
|
|
292
|
+
# Remember start of DLC (see below).
|
|
293
|
+
elif bitnum == self.dlc_start:
|
|
294
|
+
self.ss_block = self.samplenum
|
|
295
|
+
|
|
296
|
+
# Bits 15-18: Data length code (DLC), in number of bytes (0-8).
|
|
297
|
+
elif bitnum == self.dlc_start + 3:
|
|
298
|
+
self.dlc = bitpack_msb(self.bits[self.dlc_start:self.dlc_start + 4])
|
|
299
|
+
self.putb([10, ['Data length code: %d' % self.dlc,
|
|
300
|
+
'DLC: %d' % self.dlc, 'DLC']])
|
|
301
|
+
self.last_databit = self.dlc_start + 3 + (dlc2len(self.dlc) * 8)
|
|
302
|
+
if self.dlc > 8 and not self.fd:
|
|
303
|
+
self.putb([16, ['Data length code (DLC) > 8 is not allowed']])
|
|
304
|
+
|
|
305
|
+
# Remember all databyte bits, except the very last one.
|
|
306
|
+
elif bitnum in range(self.dlc_start + 4, self.last_databit):
|
|
307
|
+
self.ss_databytebits.append(self.samplenum)
|
|
308
|
+
|
|
309
|
+
# Bits 19-X: Data field (0-8 bytes, depending on DLC)
|
|
310
|
+
# The bits within a data byte are transferred MSB-first.
|
|
311
|
+
elif bitnum == self.last_databit:
|
|
312
|
+
self.ss_databytebits.append(self.samplenum) # Last databyte bit.
|
|
313
|
+
for i in range(dlc2len(self.dlc)):
|
|
314
|
+
x = self.dlc_start + 4 + (8 * i)
|
|
315
|
+
b = bitpack_msb(self.bits[x:x + 8])
|
|
316
|
+
self.frame_bytes.append(b)
|
|
317
|
+
ss = self.ss_databytebits[i * 8]
|
|
318
|
+
es = self.ss_databytebits[((i + 1) * 8) - 1]
|
|
319
|
+
self.putg(ss, es, [0, ['Data byte %d: 0x%02x' % (i, b),
|
|
320
|
+
'DB %d: 0x%02x' % (i, b), 'DB']])
|
|
321
|
+
self.ss_databytebits = []
|
|
322
|
+
|
|
323
|
+
elif bitnum > self.last_databit:
|
|
324
|
+
return self.decode_frame_end(can_rx, bitnum)
|
|
325
|
+
|
|
326
|
+
return False
|
|
327
|
+
|
|
328
|
+
# Returns True if the frame ended (EOF), False otherwise.
|
|
329
|
+
def decode_extended_frame(self, can_rx, bitnum):
|
|
330
|
+
|
|
331
|
+
# Remember start of EID (see below).
|
|
332
|
+
if bitnum == 14:
|
|
333
|
+
self.ss_block = self.samplenum
|
|
334
|
+
self.fd = False
|
|
335
|
+
self.dlc_start = 35
|
|
336
|
+
|
|
337
|
+
# Bits 14-31: Extended identifier (EID[17..0])
|
|
338
|
+
elif bitnum == 31:
|
|
339
|
+
self.eid = bitpack_msb(self.bits[14:])
|
|
340
|
+
s = '%d (0x%x)' % (self.eid, self.eid)
|
|
341
|
+
self.putb([4, ['Extended Identifier: %s' % s,
|
|
342
|
+
'Extended ID: %s' % s, 'Extended ID', 'EID']])
|
|
343
|
+
|
|
344
|
+
self.fullid = self.ident << 18 | self.eid
|
|
345
|
+
s = '%d (0x%x)' % (self.fullid, self.fullid)
|
|
346
|
+
self.putb([5, ['Full Identifier: %s' % s, 'Full ID: %s' % s,
|
|
347
|
+
'Full ID', 'FID']])
|
|
348
|
+
|
|
349
|
+
# Bit 12: Substitute remote request (SRR) bit
|
|
350
|
+
self.put12([9, ['Substitute remote request: %d' % self.bits[12],
|
|
351
|
+
'SRR: %d' % self.bits[12], 'SRR']])
|
|
352
|
+
|
|
353
|
+
# Bit 32: Remote transmission request (RTR) bit
|
|
354
|
+
# Data frame: dominant, remote frame: recessive
|
|
355
|
+
# Remote frames do not contain a data field.
|
|
356
|
+
|
|
357
|
+
# Remember start of RTR (see below).
|
|
358
|
+
if bitnum == 32:
|
|
359
|
+
self.ss_bit32 = self.samplenum
|
|
360
|
+
self.rtr = can_rx
|
|
361
|
+
|
|
362
|
+
if not self.fd:
|
|
363
|
+
rtr = 'remote' if can_rx == 1 else 'data'
|
|
364
|
+
self.putx([8, ['Remote transmission request: %s frame' % rtr,
|
|
365
|
+
'RTR: %s frame' % rtr, 'RTR']])
|
|
366
|
+
self.rtr_type = rtr
|
|
367
|
+
|
|
368
|
+
# Bit 33: RB1 (reserved bit)
|
|
369
|
+
elif bitnum == 33:
|
|
370
|
+
self.fd = True if can_rx else False
|
|
371
|
+
if self.fd:
|
|
372
|
+
self.dlc_start = 37
|
|
373
|
+
self.putx([7, ['Flexible data format: %d' % can_rx,
|
|
374
|
+
'FDF: %d' % can_rx, 'FDF']])
|
|
375
|
+
self.put32([7, ['Reserved bit 1: %d' % self.rtr,
|
|
376
|
+
'RB1: %d' % self.rtr, 'RB1']])
|
|
377
|
+
else:
|
|
378
|
+
self.putx([7, ['Reserved bit 1: %d' % can_rx,
|
|
379
|
+
'RB1: %d' % can_rx, 'RB1']])
|
|
380
|
+
|
|
381
|
+
# Bit 34: RB0 (reserved bit)
|
|
382
|
+
elif bitnum == 34:
|
|
383
|
+
self.putx([7, ['Reserved bit 0: %d' % can_rx,
|
|
384
|
+
'RB0: %d' % can_rx, 'RB0']])
|
|
385
|
+
|
|
386
|
+
elif bitnum == 35 and self.fd:
|
|
387
|
+
self.putx([7, ['Bit rate switch: %d' % can_rx,
|
|
388
|
+
'BRS: %d' % can_rx, 'BRS']])
|
|
389
|
+
|
|
390
|
+
elif bitnum == 36 and self.fd:
|
|
391
|
+
self.putx([7, ['Error state indicator: %d' % can_rx,
|
|
392
|
+
'ESI: %d' % can_rx, 'ESI']])
|
|
393
|
+
|
|
394
|
+
# Remember start of DLC (see below).
|
|
395
|
+
elif bitnum == self.dlc_start:
|
|
396
|
+
self.ss_block = self.samplenum
|
|
397
|
+
|
|
398
|
+
# Bits 35-38: Data length code (DLC), in number of bytes (0-8).
|
|
399
|
+
elif bitnum == self.dlc_start + 3:
|
|
400
|
+
self.dlc = bitpack_msb(self.bits[self.dlc_start:self.dlc_start + 4])
|
|
401
|
+
self.putb([10, ['Data length code: %d' % self.dlc,
|
|
402
|
+
'DLC: %d' % self.dlc, 'DLC']])
|
|
403
|
+
self.last_databit = self.dlc_start + 3 + (dlc2len(self.dlc) * 8)
|
|
404
|
+
|
|
405
|
+
# Remember all databyte bits, except the very last one.
|
|
406
|
+
elif bitnum in range(self.dlc_start + 4, self.last_databit):
|
|
407
|
+
self.ss_databytebits.append(self.samplenum)
|
|
408
|
+
|
|
409
|
+
# Bits 39-X: Data field (0-8 bytes, depending on DLC)
|
|
410
|
+
# The bits within a data byte are transferred MSB-first.
|
|
411
|
+
elif bitnum == self.last_databit:
|
|
412
|
+
self.ss_databytebits.append(self.samplenum) # Last databyte bit.
|
|
413
|
+
for i in range(dlc2len(self.dlc)):
|
|
414
|
+
x = self.dlc_start + 4 + (8 * i)
|
|
415
|
+
b = bitpack_msb(self.bits[x:x + 8])
|
|
416
|
+
self.frame_bytes.append(b)
|
|
417
|
+
ss = self.ss_databytebits[i * 8]
|
|
418
|
+
es = self.ss_databytebits[((i + 1) * 8) - 1]
|
|
419
|
+
self.putg(ss, es, [0, ['Data byte %d: 0x%02x' % (i, b),
|
|
420
|
+
'DB %d: 0x%02x' % (i, b), 'DB']])
|
|
421
|
+
self.ss_databytebits = []
|
|
422
|
+
|
|
423
|
+
elif bitnum > self.last_databit:
|
|
424
|
+
return self.decode_frame_end(can_rx, bitnum)
|
|
425
|
+
|
|
426
|
+
return False
|
|
427
|
+
|
|
428
|
+
def handle_bit(self, can_rx):
|
|
429
|
+
self.rawbits.append(can_rx)
|
|
430
|
+
self.bits.append(can_rx)
|
|
431
|
+
|
|
432
|
+
# Get the index of the current CAN frame bit (without stuff bits).
|
|
433
|
+
bitnum = len(self.bits) - 1
|
|
434
|
+
|
|
435
|
+
if self.fd and can_rx:
|
|
436
|
+
if bitnum == 16 and self.frame_type == 'standard' \
|
|
437
|
+
or bitnum == 35 and self.frame_type == 'extended':
|
|
438
|
+
self.dom_edge_seen(force=True)
|
|
439
|
+
self.set_fast_bitrate()
|
|
440
|
+
|
|
441
|
+
# If this is a stuff bit, remove it from self.bits and ignore it.
|
|
442
|
+
if self.is_stuff_bit():
|
|
443
|
+
self.putx([15, [str(can_rx)]])
|
|
444
|
+
self.curbit += 1 # Increase self.curbit (bitnum is not affected).
|
|
445
|
+
return
|
|
446
|
+
else:
|
|
447
|
+
self.putx([17, [str(can_rx)]])
|
|
448
|
+
|
|
449
|
+
# Bit 0: Start of frame (SOF) bit
|
|
450
|
+
if bitnum == 0:
|
|
451
|
+
self.ss_packet = self.samplenum
|
|
452
|
+
self.putx([1, ['Start of frame', 'SOF', 'S']])
|
|
453
|
+
if can_rx != 0:
|
|
454
|
+
self.putx([16, ['Start of frame (SOF) must be a dominant bit']])
|
|
455
|
+
|
|
456
|
+
# Remember start of ID (see below).
|
|
457
|
+
elif bitnum == 1:
|
|
458
|
+
self.ss_block = self.samplenum
|
|
459
|
+
|
|
460
|
+
# Bits 1-11: Identifier (ID[10..0])
|
|
461
|
+
# The bits ID[10..4] must NOT be all recessive.
|
|
462
|
+
elif bitnum == 11:
|
|
463
|
+
# BEWARE! Don't clobber the decoder's .id field which is
|
|
464
|
+
# part of its boiler plate!
|
|
465
|
+
self.ident = bitpack_msb(self.bits[1:])
|
|
466
|
+
self.fullid = self.ident
|
|
467
|
+
s = '%d (0x%x)' % (self.ident, self.ident),
|
|
468
|
+
self.putb([3, ['Identifier: %s' % s, 'ID: %s' % s, 'ID']])
|
|
469
|
+
if (self.ident & 0x7f0) == 0x7f0:
|
|
470
|
+
self.putb([16, ['Identifier bits 10..4 must not be all recessive']])
|
|
471
|
+
|
|
472
|
+
# RTR or SRR bit, depending on frame type (gets handled later).
|
|
473
|
+
elif bitnum == 12:
|
|
474
|
+
# self.putx([0, ['RTR/SRR: %d' % can_rx]]) # Debug only.
|
|
475
|
+
self.ss_bit12 = self.samplenum
|
|
476
|
+
|
|
477
|
+
# Bit 13: Identifier extension (IDE) bit
|
|
478
|
+
# Standard frame: dominant, extended frame: recessive
|
|
479
|
+
elif bitnum == 13:
|
|
480
|
+
ide = self.frame_type = 'standard' if can_rx == 0 else 'extended'
|
|
481
|
+
self.putx([6, ['Identifier extension bit: %s frame' % ide,
|
|
482
|
+
'IDE: %s frame' % ide, 'IDE']])
|
|
483
|
+
|
|
484
|
+
# Bits 14-X: Frame-type dependent, passed to the resp. handlers.
|
|
485
|
+
elif bitnum >= 14:
|
|
486
|
+
if self.frame_type == 'standard':
|
|
487
|
+
done = self.decode_standard_frame(can_rx, bitnum)
|
|
488
|
+
else:
|
|
489
|
+
done = self.decode_extended_frame(can_rx, bitnum)
|
|
490
|
+
|
|
491
|
+
# The handlers return True if a frame ended (EOF).
|
|
492
|
+
if done:
|
|
493
|
+
return
|
|
494
|
+
|
|
495
|
+
# After a frame there are 3 intermission bits (recessive).
|
|
496
|
+
# After these bits, the bus is considered free.
|
|
497
|
+
|
|
498
|
+
self.curbit += 1
|
|
499
|
+
|
|
500
|
+
def decode(self):
|
|
501
|
+
if not self.samplerate:
|
|
502
|
+
raise SamplerateError('Cannot decode without samplerate.')
|
|
503
|
+
|
|
504
|
+
while True:
|
|
505
|
+
# State machine.
|
|
506
|
+
if self.state == 'IDLE':
|
|
507
|
+
# Wait for a dominant state (logic 0) on the bus.
|
|
508
|
+
(can_rx,) = self.wait({0: 'l'})
|
|
509
|
+
self.sof = self.samplenum
|
|
510
|
+
self.dom_edge_seen(force = True)
|
|
511
|
+
self.state = 'GET BITS'
|
|
512
|
+
elif self.state == 'GET BITS':
|
|
513
|
+
# Wait until we're in the correct bit/sampling position.
|
|
514
|
+
pos = self.get_sample_point(self.curbit)
|
|
515
|
+
(can_rx,) = self.wait([{'skip': pos - self.samplenum}, {0: 'f'}])
|
|
516
|
+
if self.matched[1]:
|
|
517
|
+
self.dom_edge_seen()
|
|
518
|
+
if self.matched[0]:
|
|
519
|
+
self.handle_bit(can_rx)
|