### Build and Install Commands Source: https://context7.com/analogdevicesinc/sigma-tcp/llms.txt Standard Makefile commands for building, installing, and cleaning the project. Use 'sudo make install' for default installation. ```bash # Build with default settings make ``` ```bash # Build with custom compiler flags CFLAGS="-g -DDEBUG" make ``` ```bash # Install to default location (/usr/local/bin) sudo make install ``` ```bash # Install to custom location sudo make DESTDIR=/opt/sigmatcp install ``` ```bash # Clean build artifacts make clean ``` -------------------------------- ### Starting SigmaTCP Server Source: https://context7.com/analogdevicesinc/sigma-tcp/llms.txt Instructions on how to build and start the SigmaTCP server with different backend configurations. ```APIDOC ## Building the Application ```bash make ``` ## Starting with Debug Backend This backend provides an in-memory register space for testing. ```bash ./sigma_tcp debug ``` ## Starting with I2C Backend Requires I2C device file and target device address. ```bash # Arguments: ./sigma_tcp i2c /dev/i2c-0 0x38 ./sigma_tcp i2c /dev/i2c-1 0x34 ``` ## Starting with Regmap Backend Reads register values from a text file. ```bash # Create a regmap file (e.g., registers.txt) cat > registers.txt << 'EOF' 4000: 01 4001: 02 4002: ff 4003: a5 EOF # Start server with regmap backend ./sigma_tcp regmap registers.txt ``` ``` -------------------------------- ### Start Server with Debug Backend Source: https://context7.com/analogdevicesinc/sigma-tcp/llms.txt The debug backend simulates a 256-byte register space for testing purposes without requiring physical hardware. ```bash # Build the application make # Start server with debug backend (default, no hardware required) ./sigma_tcp debug # Expected output: # Using debug backend # Waiting for connections... # IP addresses: # eth0: 192.168.1.100 ``` -------------------------------- ### Start Server with Regmap Backend Source: https://context7.com/analogdevicesinc/sigma-tcp/llms.txt The regmap backend reads register values from a text file containing address-value pairs. ```bash # Create a regmap file with address: value pairs cat > registers.txt << 'EOF' 4000: 01 4001: 02 4002: ff 4003: a5 EOF # Start server with regmap backend ./sigma_tcp regmap registers.txt # Expected output: # Using regmap backend # Waiting for connections... # IP addresses: # eth0: 192.168.1.100 ``` -------------------------------- ### Start Server with I2C Backend Source: https://context7.com/analogdevicesinc/sigma-tcp/llms.txt The I2C backend enables direct communication with hardware devices over an I2C bus by specifying the device file and address. ```bash # Start server with I2C backend # Arguments: ./sigma_tcp i2c /dev/i2c-0 0x38 # Expected output: # Using i2c backend # i2c: Initalized for device /dev/i2c-0-38 # Waiting for connections... # IP addresses: # eth0: 192.168.1.100 # For a different I2C bus and address (e.g., ADAU1701 DSP) ./sigma_tcp i2c /dev/i2c-1 0x34 ``` -------------------------------- ### Execute TCP Write Command Source: https://context7.com/analogdevicesinc/sigma-tcp/llms.txt The write command (0x0b) sends data to be written to the device registers at a specified address. ```bash # Write command packet structure: # Byte 0: Command (0x0b = write) # Bytes 1-2: Total length (big-endian) # Byte 3: Reserved # Bytes 4-5: Data length (big-endian) # Bytes 6-7: Register address (big-endian) # Bytes 8+: Data to write # Example: Write bytes [0xAB, 0xCD] to address 0x4000 # Command: 0b 00 06 00 00 02 40 00 ab cd # Using netcat to send a write request printf '\x0b\x00\x06\x00\x00\x02\x40\x00\xab\xcd' | nc 192.168.1.100 8086 ``` -------------------------------- ### Execute TCP Read Command Source: https://context7.com/analogdevicesinc/sigma-tcp/llms.txt The read command (0x0a) requests register data from the server, which responds with a write command (0x0b). ```bash # Read command packet structure: # Byte 0: Command (0x0a = read) # Bytes 1-2: Total length (big-endian) # Byte 3: Reserved # Bytes 4-5: Data length to read (big-endian) # Bytes 6-7: Register address (big-endian) # Example: Read 4 bytes starting at address 0x4000 # Command: 0a 00 04 00 00 04 40 00 # Using netcat to send a read request (hex bytes) printf '\x0a\x00\x04\x00\x00\x04\x40\x00' | nc 192.168.1.100 8086 | xxd # Expected response format: # Byte 0: Command (0x0b = write/response) # Bytes 1-2: Total length (0x0008 for 4 data bytes + 4 header) # Byte 3: Status (0 = success) # Bytes 4+: Data bytes ``` -------------------------------- ### TCP Protocol - Write Command Source: https://context7.com/analogdevicesinc/sigma-tcp/llms.txt Details on how to send a write command to the SigmaTCP server to write data to device registers. ```APIDOC ## TCP Protocol - Write Command Clients send a write command (0x0b) to write data to specific register addresses. ### Command Structure - Byte 0: Command (0x0b = write) - Bytes 1-2: Total length (big-endian) - Byte 3: Reserved - Bytes 4-5: Data length (big-endian) - Bytes 6-7: Register address (big-endian) - Bytes 8+: Data to write ### Request Example Write bytes [0xAB, 0xCD] to address 0x4000: ```bash # Command: 0b 00 06 00 00 02 40 00 ab cd printf '\x0b\x00\x06\x00\x00\x02\x40\x00\xab\xcd' | nc 192.168.1.100 8086 ``` ``` -------------------------------- ### TCP Protocol - Read Command Source: https://context7.com/analogdevicesinc/sigma-tcp/llms.txt Details on how to send a read command to the SigmaTCP server to retrieve register data. ```APIDOC ## TCP Protocol - Read Command Clients send a read command (0x0a) to request data from specific register addresses. ### Command Structure - Byte 0: Command (0x0a = read) - Bytes 1-2: Total length (big-endian) - Byte 3: Reserved - Bytes 4-5: Data length to read (big-endian) - Bytes 6-7: Register address (big-endian) ### Request Example Read 4 bytes starting at address 0x4000: ```bash # Command: 0a 00 04 00 00 04 40 00 printf '\x0a\x00\x04\x00\x00\x04\x40\x00' | nc 192.168.1.100 8086 | xxd ``` ### Response Format - Byte 0: Command (0x0b = write/response) - Bytes 1-2: Total length (e.g., 0x0008 for 4 data bytes + 4 header) - Byte 3: Status (0 = success) - Bytes 4+ : Data bytes ``` -------------------------------- ### Define Backend Operations Interface Source: https://context7.com/analogdevicesinc/sigma-tcp/llms.txt The backend_ops structure defines the required interface for hardware backends, including open, read, and write operations. ```c #include "sigma_tcp.h" // Backend operations interface definition struct backend_ops { int (*open)(int argc, char *argv[]); int (*read)(unsigned int addr, unsigned int len, uint8_t *data); int (*write)(unsigned int addr, unsigned int len, const uint8_t *data); }; // Available backend implementations extern const struct backend_ops i2c_backend_ops; extern const struct backend_ops regmap_backend_ops; ``` -------------------------------- ### I2C Write Operation Source: https://context7.com/analogdevicesinc/sigma-tcp/llms.txt Implements an I2C write operation with 16-bit register addressing. Requires the I2C device address and file descriptor to be set. ```c static int i2c_write(unsigned int addr, unsigned int len, const uint8_t *data) { uint8_t msg_buf[2 + len]; struct i2c_msg msg[1]; struct i2c_rdwr_ioctl_data xfer = { .msgs = msg, .nmsgs = 1, }; // Prepend 16-bit register address to data msg_buf[0] = addr >> 8; msg_buf[1] = addr & 0xff; memcpy(msg_buf + 2, data, len); msg[0].addr = i2c_dev_addr; msg[0].flags = 0; msg[0].buf = msg_buf; msg[0].len = len + 2; return ioctl(i2c_fd, I2C_RDWR, &xfer); } ``` -------------------------------- ### I2C Read Operation Source: https://context7.com/analogdevicesinc/sigma-tcp/llms.txt Implements an I2C read operation with 16-bit register addressing. Requires the I2C device address and file descriptor to be set. ```c static int i2c_read(unsigned int addr, unsigned int len, uint8_t *data) { uint8_t addr_buf[2]; struct i2c_msg msg[2]; struct i2c_rdwr_ioctl_data xfer = { .msgs = msg, .nmsgs = 2, }; // Set 16-bit register address (big-endian) addr_buf[0] = (addr >> 8) & 0xff; addr_buf[1] = addr & 0xff; // First message: write register address msg[0].addr = i2c_dev_addr; msg[0].flags = 0; msg[0].buf = addr_buf; msg[0].len = 2; // Second message: read data msg[1].addr = i2c_dev_addr; msg[1].flags = I2C_M_RD; msg[1].buf = data; msg[1].len = len; return ioctl(i2c_fd, I2C_RDWR, &xfer); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.