From b644e266dd6f5f4b6cdac126477b61debee89e26 Mon Sep 17 00:00:00 2001 From: eb Date: Wed, 5 Sep 2007 01:43:43 +0000 Subject: Merged features/inband-usb r5224:6306 into trunk. This is work-in-progress on inband signaling for the USRP1. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6307 221aa14e-8319-0410-a670-987f0aec2ac5 --- usrp/host/lib/inband/usrp_inband_usb_packet.h | 95 +++++++++++++++++++++++++-- 1 file changed, 90 insertions(+), 5 deletions(-) (limited to 'usrp/host/lib/inband/usrp_inband_usb_packet.h') diff --git a/usrp/host/lib/inband/usrp_inband_usb_packet.h b/usrp/host/lib/inband/usrp_inband_usb_packet.h index e22b567fa..9290f55ae 100644 --- a/usrp/host/lib/inband/usrp_inband_usb_packet.h +++ b/usrp/host/lib/inband/usrp_inband_usb_packet.h @@ -24,6 +24,10 @@ #include #include +#include +#include + +#include static const int USB_PKT_SIZE = 512; // bytes static const int MAX_PAYLOAD = USB_PKT_SIZE-2*sizeof(uint32_t); @@ -38,12 +42,28 @@ class usrp_inband_usb_packet { public: + enum opcodes { + OP_PING_FIXED = 0x00, + OP_PING_FIXED_REPLY = 0x01, + OP_WRITE_REG = 0x02, + OP_WRITE_REG_MASKED = 0x03, + OP_READ_REG = 0x04, + OP_READ_REG_REPLY = 0x05, + OP_I2C_WRITE = 0x06, + OP_I2C_READ = 0x07, + OP_I2C_READ_REPLY = 0x08, + OP_SPI_WRITE = 0x09, + OP_SPI_READ = 0x0a, + OP_SPI_READ_REPLY = 0x0b, + OP_DELAY = 0x0c + }; + enum flags { FL_OVERRUN = 0x80000000, FL_UNDERRUN = 0x40000000, FL_DROPPED = 0x20000000, - FL_END_OF_BURST = 0x10000000, - FL_START_OF_BURST = 0x08000000, + FL_START_OF_BURST = 0x10000000, + FL_END_OF_BURST = 0x08000000, FL_ALL_FLAGS = 0xf8000000 }; @@ -51,8 +71,8 @@ public: static const int FL_OVERRUN_SHIFT = 31; static const int FL_UNDERRUN_SHIFT = 30; static const int FL_DROPPED_SHIFT = 29; - static const int FL_END_OF_BURST_SHIFT = 28; - static const int FL_START_OF_BURST_SHIFT = 27; + static const int FL_END_OF_BURST_SHIFT = 27; + static const int FL_START_OF_BURST_SHIFT = 28; static const int RSSI_MASK = 0x3f; static const int RSSI_SHIFT = 21; @@ -66,6 +86,50 @@ public: static const int PAYLOAD_LEN_MASK = 0x1ff; static const int PAYLOAD_LEN_SHIFT = 0; + // Fixed size for opcode and length fields + static const int CS_FIXED_LEN = 2; + + static const int CS_OPCODE_MASK = 0xff; + static const int CS_OPCODE_SHIFT = 24; + + static const int CS_LEN_MASK = 0xff; + static const int CS_LEN_SHIFT = 16; + + static const int CS_RID_MASK = 0x3f; + static const int CS_RID_SHIFT = 10; + + static const int CS_PING_LEN = 2; + static const int CS_PINGVAL_MASK = 0x3ff; + static const int CS_PINGVAL_SHIFT = 0; + + static const int CS_WRITEREG_LEN = 6; + static const int CS_WRITEREGMASKED_LEN = 10; + static const int CS_READREG_LEN = 2; + static const int CS_READREGREPLY_LEN = 6; + static const int CS_REGNUM_MASK = 0x3ff; + static const int CS_REGNUM_SHIFT = 0; + + static const int CS_DELAY_LEN = 2; + static const int CS_DELAY_MASK = 0xffff; + static const int CS_DELAY_SHIFT = 0; + + static const int CS_I2CADDR_MASK = 0x7f; + static const int CS_I2CADDR_SHIFT = 0; + + static const int CS_I2CREAD_LEN = 3; + static const int CS_I2CREADBYTES_MASK = 0x7f; + static const int CS_I2CREADBYTES_SHIFT = 24; + + static const int CS_SPIOPT_MASK = 0xffff; + static const int CS_SPIOPT_SHIFT = 0; + static const int CS_SPIFORMAT_MASK = 0xff; + static const int CS_SPIFORMAT_SHIFT = 16; + static const int CS_SPIENABLES_MASK = 0xff; + static const int CS_SPIENABLES_SHIFT = 24; + static const int CS_SPIREAD_LEN = 7; + static const int CS_SPINBYTES_MASK = 0xff; + static const int CS_SPINBYTES_SHIFT = 24; + public: void set_timestamp(uint32_t timestamp){ @@ -77,7 +141,7 @@ public: word0 |= 1<