logic pro compatible fpga based logic analyzer
1"""Unit tests for EP1 command handler."""
2
3import pytest
4
5
6def test_ep1_handler_import():
7 """Verify the module imports cleanly."""
8 from gateware.ep1_handler import EP1Handler
9 handler = EP1Handler()
10 assert handler.rx_data is not None
11 assert handler.tx_data is not None
12 assert handler.capture_active is not None
13 assert handler.fpga_programmed is not None
14
15
16def test_ep1_opcode_constants():
17 """Verify opcode constants match saleae_logic_reversed."""
18 from gateware.ep1_handler import (
19 CMD_START_READ, CMD_STOP_STREAM, CMD_PING,
20 CMD_RESET_FPGA, CMD_WRITE_CONFIG_DATA,
21 CMD_WRITE_REGISTERS, CMD_READ_REGISTERS,
22 CMD_STOP_DATA_PATH, CMD_GET_DEVICE_INFO,
23 )
24 assert CMD_START_READ == 0x01
25 assert CMD_STOP_STREAM == 0x02
26 assert CMD_PING == 0x7D
27 assert CMD_RESET_FPGA == 0x7E
28 assert CMD_WRITE_CONFIG_DATA == 0x7F
29 assert CMD_WRITE_REGISTERS == 0x80
30 assert CMD_READ_REGISTERS == 0x81
31 assert CMD_STOP_DATA_PATH == 0x86
32 assert CMD_GET_DEVICE_INFO == 0x8B