diff options
author | Nick Foster <nick@nerdnetworks.org> | 2010-08-12 18:15:27 -0700 |
---|---|---|
committer | Nick Foster <nick@nerdnetworks.org> | 2010-08-12 18:15:27 -0700 |
commit | 3fe2744e7aef9f6989b161be3af63a24392ed18a (patch) | |
tree | 72154dc1069c8319ab394427a768cbbbd57209d1 /host/lib | |
parent | 6be2b64ce86f4bb9f36bae8758d7de2ddbabe2b1 (diff) | |
download | uhd-3fe2744e7aef9f6989b161be3af63a24392ed18a.tar.gz uhd-3fe2744e7aef9f6989b161be3af63a24392ed18a.tar.bz2 uhd-3fe2744e7aef9f6989b161be3af63a24392ed18a.zip |
Host-side fixes for GPS UART.
Diffstat (limited to 'host/lib')
-rw-r--r-- | host/lib/usrp/usrp2/mboard_impl.cpp | 13 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_iface.cpp | 10 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_iface.hpp | 4 |
3 files changed, 13 insertions, 14 deletions
diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index 19afd8122..96c98f6c5 100644 --- a/host/lib/usrp/usrp2/mboard_impl.cpp +++ b/host/lib/usrp/usrp2/mboard_impl.cpp @@ -51,6 +51,12 @@ usrp2_mboard_impl::usrp2_mboard_impl( //set the device revision (USRP2 or USRP2+) based on the above _iface->set_hw_rev((_rev_hi << 8) | _rev_lo); + //TODO DEBUG! this is just here to test writing to and reading from the UART. + std::string mystr = "PTIME:TIME?\n"; + _iface->write_uart(2, mystr); + mystr = _iface->read_uart(2, 20); + std::cout << "what time is it? " << mystr.c_str(); + //contruct the interfaces to mboard perifs _clock_ctrl = usrp2_clock_ctrl::make(_iface); _codec_ctrl = usrp2_codec_ctrl::make(_iface); @@ -110,13 +116,6 @@ usrp2_mboard_impl::usrp2_mboard_impl( (*this)[MBOARD_PROP_RX_SUBDEV_SPEC] = subdev_spec_t(); (*this)[MBOARD_PROP_TX_SUBDEV_SPEC] = subdev_spec_t(); - //TODO DEBUG! this is just here to test writing to and reading from the UART. - std::string mystr = "PTIME:TIME?\n"; - byte_vector_t mybuf(mystr.begin(), mystr.end()); - _iface->write_uart(2, mybuf); - mybuf = _iface->read_uart(2, 15); - std::cout << "DEBUG: " << std::string(mybuf.begin(), mybuf.end()) << std::endl; - //Issue a stop streaming command (in case it was left running). //Since this command is issued before the networking is setup, //most if not all junk packets will never make it to the socket. diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index aa16865c1..04b3b1e74 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -49,7 +49,7 @@ public: **********************************************************************/ usrp2_iface_impl(udp_simple::sptr ctrl_transport){ _ctrl_transport = ctrl_transport; - +/* //check the fpga compatibility number const boost::uint32_t fpga_compat_num = this->peek32(this->regs.compat_num_rb); if (fpga_compat_num != USRP2_FPGA_COMPAT_NUM){ @@ -58,6 +58,7 @@ public: "The fpga build is not compatible with the host code build." ) % int(USRP2_FPGA_COMPAT_NUM) % fpga_compat_num)); } +*/ } ~usrp2_iface_impl(void){ @@ -174,7 +175,7 @@ public: /*********************************************************************** * UART **********************************************************************/ - void write_uart(boost::uint8_t dev, const byte_vector_t &buf){ + void write_uart(boost::uint8_t dev, const std::string &buf){ //setup the out data usrp2_ctrl_data_t out_data; out_data.id = htonl(USRP2_CTRL_ID_HEY_WRITE_THIS_UART_FOR_ME_BRO); @@ -192,7 +193,7 @@ public: UHD_ASSERT_THROW(ntohl(in_data.id) == USRP2_CTRL_ID_MAN_I_TOTALLY_WROTE_THAT_UART_DUDE); } - byte_vector_t read_uart(boost::uint8_t dev, size_t num_bytes){ + std::string read_uart(boost::uint8_t dev, size_t num_bytes){ //setup the out data usrp2_ctrl_data_t out_data; out_data.id = htonl(USRP2_CTRL_ID_SO_LIKE_CAN_YOU_READ_THIS_UART_BRO); @@ -205,10 +206,9 @@ public: //send and recv usrp2_ctrl_data_t in_data = this->ctrl_send_and_recv(out_data); UHD_ASSERT_THROW(ntohl(in_data.id) == USRP2_CTRL_ID_I_HELLA_READ_THAT_UART_DUDE); - //UHD_ASSERT_THROW(in_data.data.uart_args.bytes = num_bytes); //copy out the data - byte_vector_t result(num_bytes); + std::string result; std::copy(in_data.data.uart_args.data, in_data.data.uart_args.data + num_bytes, result.begin()); return result; } diff --git a/host/lib/usrp/usrp2/usrp2_iface.hpp b/host/lib/usrp/usrp2/usrp2_iface.hpp index 522beadfb..cb247f074 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.hpp +++ b/host/lib/usrp/usrp2/usrp2_iface.hpp @@ -104,9 +104,9 @@ public: bool readback ) = 0; - virtual void write_uart(boost::uint8_t dev, const uhd::byte_vector_t &buf) = 0; + virtual void write_uart(boost::uint8_t dev, const std::string &buf) = 0; - virtual uhd::byte_vector_t read_uart(boost::uint8_t dev, size_t num_bytes) = 0; + virtual std::string read_uart(boost::uint8_t dev, size_t num_bytes) = 0; /*! * Set the hardware revision number. Also selects the proper register set for the device. |