Commit graph

58 commits

Author SHA1 Message Date
Samuel O'Brien
00c306d5c4 sim: Integrate simulator into UHD
This commit adds a device::register_device which allows uhd to start up
a simulator when uhd is called with the arguments type=sim. Creating the
device object creates a subprocess using pybind and an embedded
interpreter, and destroying the object cleans up those subprocesses.

Signed-off-by: Samuel O'Brien <sam.obrien@ni.com>
2020-10-28 15:25:48 -05:00
Aaron Rossetto
ad707ab22d mpm, mpmd: Bump MPM compat number 2020-07-24 15:24:14 -05:00
Lane Kolbly
843527d303 uhd: mpm: Query prefs per-device for multi-device queries
If a user specifies a multi-device query, such as "serial0=1234,serial1=4321",
we have to look up the preferences for each device. To minimize the
impact to non-x400 devices, I simply push the get_usrp_args call down
into mpmd_impl and mpmd_find.
2020-04-08 15:32:50 -05:00
Martin Braun
876d4150aa uhd: Apply clang-format against all .cpp and .hpp files in host/
Note: template_lvbitx.{cpp,hpp} need to be excluded from the list of
files that clang-format gets applied against.
2020-03-03 08:51:32 -06:00
Martin Braun
1fe98e8701 uhd: Replace usage of boost smart pointers with C++11 counterparts
This removes the following Boost constructs:
- boost::shared_ptr, boost::weak_ptr
- boost::enable_shared_from_this
- boost::static_pointer_cast, boost::dynamic_pointer_cast

The appropriate includes were also removed. All C++11 versions of these
require #include <memory>.
Note that the stdlib and Boost versions have the exact same syntax, they
only differ in the namespace (boost vs. std). The modifications were all
done using sed, with the exception of boost::scoped_ptr, which was
replaced by std::unique_ptr.

References to boost::smart_ptr were also removed.

boost::intrusive_ptr is not removed in this commit, since it does not
have a 1:1 mapping to a C++11 construct.
2019-11-26 12:21:32 -08:00
Martin Braun
7d69dcdcc3 Remove proto-RFNoC files
This commit removes all files and parts of files that are used by
proto-RFNoC only.

uhd: Fix include CMakeLists.txt, add missing files
2019-11-26 12:16:25 -08:00
Martin Braun
c256b9df65 x300/mpmd: Port all RFNoC devices to the new RFNoC framework
Co-Authored-By: Alex Williams <alex.williams@ni.com>
Co-Authored-By: Sugandha Gupta <sugandha.gupta@ettus.com>
Co-Authored-By: Brent Stapleton <brent.stapleton@ettus.com>
Co-Authored-By: Ciro Nishiguchi <ciro.nishiguchi@ni.com>
2019-11-26 12:16:25 -08:00
Virendra Kakade
2001ac61e0 mpmd: Release resources on destruction
This will clear the property tree, block registry, transport managers,
and motherboard list on destruction of mpmd_impl.
2019-05-01 15:17:23 -07:00
Sugandha Gupta
fe3fa1dd31 device3: Constraint send/recv_frame_size based on down/upstream MTU
We need to properly contraint the send/recv_frame_size based on the
minimum MTU of all the down/upstream blocks. This fixes the issue with
E310 tx/rx streaming as it has smaller MTU sizes than the other usrps.
2019-05-01 15:17:23 -07:00
Brent Stapleton
967be2a4e8 uhd: mpm: apply clang-format to all files
Applying formatting changes to all .cpp and .hpp files in the following
directories:
```
find host/examples/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/tests/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/lib/usrp/dboard/neon/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/lib/usrp/dboard/magnesium/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/lib/usrp/device3/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/lib/usrp/mpmd/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/lib/usrp/x300/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find host/utils/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
find mpm/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
```

Also formatted host/include/, except Cpp03 was used as a the language
standard instead of Cpp11.
```
sed -i 's/ Cpp11/ Cpp03/g' .clang-format
find host/include/ -iname *.hpp -o -iname *.cpp | \
    xargs clang-format -i -style=file
```

Formatting style was designated by the .clang-format file.
2019-01-16 11:40:23 -08:00
Martin Braun
1be93abaef mpmd: Improve error message for compat number mismatches 2018-11-16 12:00:02 -08:00
Trung Tran
6013a51137 mpmd: add option to enum rfnoc blocks from args 2018-08-31 17:30:56 -07:00
Martin Braun
6652eb4a03 uhd: Move internal headers to uhdlib/
To avoid the proliferation of additional include directories and
multiple ways of including project-local headers, we now default to
moving all headers that are used across UHD into the uhdlib/
subdirectory.

Some #include statements were also reordered as they were modified for
closer compliance with the coding guidelines.

Internal cpp source files should now include files like this:

    #include <uhdlib/rfnoc/ctrl_iface.hpp>

Reviewed-by: Ashish Chaudhari <ashish.chaudhari@ettus.com>
2018-03-14 15:17:44 -07:00
Brent Stapleton
bd2a518555 mpmd: add getter for components in property tree
Adding a publisher for updateable components listed in the property
tree. This calls MPM.get_component_info for the desired component, and
returns a dictionary containing that metadata.
2018-02-19 16:58:52 -08:00
Martin Braun
ae5211d71d uhd: Update license headers
All copyright is now attributed to "Ettus Research, a National
Instruments company".

SPDX headers were also updated to latest version 3.0.
2018-02-19 16:54:52 -08:00
Brent Stapleton
ca81898889 fixup! mpmd: Factor find and prop tree init code out of mpmd_impl.cpp 2018-02-09 01:41:32 +01:00
Martin Braun
3df3b6cc62 mpmd: Factor find and prop tree init code out of mpmd_impl.cpp
No functional changes.
2018-02-07 17:01:06 -08:00
Martin Braun
14babab1bd mpmd: Let 'find' via broadcast check for reachability
In particular, when running uhd_find_devices, this will limit the
devices to ones that can actually be reached via CHDR. There is a new
key, find_all, which allows finding all devices even those not
reachable from UHD.

Reviewed-by: Brent Stapleton <brent.stapleton@ettus.com>
2018-02-07 15:46:43 -08:00
Brent Stapleton
dca3914516 mpmd: image loader: increased timeout
-Increased timeout from 10s to 20s. This time is also per component file
being updated. For example, when updating the FPGA with new .bit and
.dts files, the timeout will be 40s.
-Also added log message to let user know their device is updating, not
frozen.
2018-01-29 15:42:13 -08:00
Martin Braun
ec4caf86f2 fixup! mpmd: Add API to read back logs from device and send to native logging 2018-01-11 17:11:56 -08:00
Martin Braun
20a4e2370a mpmd: Factor out compat number check 2018-01-08 17:46:00 -08:00
Martin Braun
33ddbbb257 mpmd: Refactor device initialization for better parallelizability
Note: This doesn't add any concurrency, rather, it changes the
structure of the code to allow that. Notable changes:
- All prop tree inits in one place
- No access to containers in methods that might be run in parallel
- Split initialization and claiming in mpmd_mboard_impl, calling ctor
  will no longer run the full initialization.
- Added comments to identify parallelizable spots
2018-01-08 17:38:29 -08:00
Brent Stapleton
acd1f6d91e mpm: Increase RPC timeout during update_component
Increases the host's timeout during update_component times, then resets
it to the default RPC timeout after the call is complete.

Reviewed-by: Martin Braun <martin.braun@ettus.com>
2018-01-05 16:10:47 -08:00
Martin Braun
83dd47dc88 mpmd: Allow user-overrides for MPM ports
Adds two device args: discovery_port and rpc_port. Both are integers
which override the respective constants.

Reviewed-by: Ashish Chaudhari <ashish.chaudhari@ettus.com>
2018-01-04 14:17:09 -08:00
Ashish Chaudhari
fd7cfb676b mpmd: Fix fake results returned by mpmd_find
- For non-MPM Ethernet devices, mpmd_find would return a fake
  malformed discovery result which would accidentally trigger
  an mpmd_impl::make resulting in unexpected errors
- Fixed mpmd_find to return an empty device_addrs_t object if
  no MPM devices are found
2017-12-28 10:41:39 -08:00
Martin Braun
af0fe0f8dc mpmd: Optionally parallelize all calls to setup_rpc_blocks
Default is to not serialize inits.
2017-12-22 15:06:11 -08:00
Martin Braun
3b32e3b0de mpmd: Temporarily disable setting of clock and time source
Currently, calling these APIs could potentially put the device into bad
state. This will disable the APIs from UHD side and replace them with a
warning if the user's setting did not take effect.
2017-12-22 15:06:11 -08:00
Martin Braun
a2d0b50bc6 mpmd: Expose get_mtu() API to mpmd_mboard_impl and to prop tree 2017-12-22 15:06:11 -08:00
Martin Braun
27f2aa86ac n310: Move SID framing all the way to n310.py
MPM will now no longer keep a SID framer variable.

Reviewed-by: Trung Tran <trung.tran@ettus.com>
Reviewed-by: Brent Stapleton <brent.stapleton@ettus.com>
2017-12-22 15:06:03 -08:00
Ashish Chaudhari
6af41376c1 mpmd: Device discovery fixes and cleanup
- Fixed issue where the "addr" device args was not honored
- Results returned by find only enumerate mgmt_addrs
- Explicitly require addr to be specified for RFNoC comms
- Cleaned up constants for mgmt_addr, addr and second_addr

Reviewed-by: Martin Braun <martin.braun@ettus.com>
2017-12-22 15:06:03 -08:00
Martin Braun
87dbcd9f1a mpmd: Refactor MPM transport architecture, use managers
This splits up the transport code in mpmd_impl across multiple classes
to properly leverage the request_xport/commit_xport API in MPM.
Different types of transport (UDP, liberio) use their own distinct
classes, which are generated dynamically on request.

This is a true refactoring despite the large amount of changes; there
are no functional differences.

Reviewed-By: Brent Stapleton <brent.stapleton@ettus.com>
Reviewed-By: Trung Tran <trung.tran@ettus.com>
Reviewed-By: Ashish Chaudhari <ashish.chaudhari@ettus.com>
2017-12-22 15:05:58 -08:00
Brent Stapleton
a927a364c5 mpm: mpmd: Add MPM compat number check
Reviewed-by: Martin Braun <martin.braun@ettus.com>
2017-12-22 15:05:58 -08:00
Martin Braun
124b0ef3e9 mpmd: Allow to connect via addr or mgmt_addr
Reviewed-By: Brent Stapleton <brent.stapleton@ettus.com>
2017-12-22 15:05:58 -08:00
Martin Braun
a568e1d58c types: Change eeprom_map_to to uint8_t vectors
mpmd_impl was already using this type, fixed conversion from
std::string to std::vector<uint8_t> there too.

Reviewed-By: Brent Stapleton <brent.stapleton@ettus.com>
2017-12-22 15:05:58 -08:00
Brent Stapleton
a2029b0439 fpga load: Atomic updating of multiple components
- The MPM function update_component now accepts multiple components to
  be updated in one RPC call.
- Updated the property tree and image loader to match this change.
- Also added DTS loading to the image loader.
2017-12-22 15:05:43 -08:00
Brent Stapleton
5e5f409239 mpm: added additional filtering to mpm find routine
mpm_find now filters discovered devices using (if provided in args)
name, serial, type, and product. This method follows the same logic as
the x300 find routine.
2017-12-22 15:05:06 -08:00
Martin Braun
b12b9465ed mpm/mpmd: Move to request_xport()/commit_xport() architecture
This commit combines code from various branches to finally enable both
UDP and Liberio transports.
2017-12-22 15:05:06 -08:00
Brent Stapleton
24699d016b fpga load: mpmd property tree now uses the MPM list_updateable_components
Dynamically generates property tree by querying MPM device for a list of updateable components.
2017-12-22 15:05:06 -08:00
Brent Stapleton
7cab06dd39 fpga load: adding updateable components to mpmd property tree
The FPGA image, and other components, can now be set from the property tree. The registered function expects a component_file_t, which combines the data file and metadata dictionary.
2017-12-22 15:05:05 -08:00
Brent Stapleton
d884d7af8e mpmd: added support for the skip_init key in the device args
Adding skip_init to the device args makes it so rfnoc blocks, etc. are not initialized.
2017-12-22 15:05:05 -08:00
Martin Braun
cea45dda8f mpm: Add mboard EEPROM support
MPMD binds a property for the mboard EEPROM to the appropriate RPC
calls. PeriphManager now provides default implementations for an mboard
EEPROM.
2017-12-22 15:04:02 -08:00
Martin Braun
5c489c2597 mpm/n310: Moved the mboard ref_locked sensor into MPM
An N310 device will query all its dboards for ref lock status and
return a Boolean combination as a motherboard sensors (note: the N310
does not actually have a ref_locked sensor on the motherboard, this is
mostly for backwards-compat with UHD applications that expect a
motherboard ref lock sensor).
2017-12-22 15:04:02 -08:00
Martin Braun
e2f8f8e0bd mpm: Added sensor API
- Motherboard sensors are automatically populated into the property
  tree, they can be automatically enumerated and queried
- Daughterboard sensors have an API for querying and enumerating
  sensors, but this commit does not automatically add them to the
  property tree
2017-12-22 15:04:02 -08:00
Mark Meserve
309a2f04e3 mg: General fixes
- Make DB probe-able
- Add RPC client
2017-12-22 15:04:00 -08:00
Martin Braun
c2bd35ef11 mpmd: Added time_sync procedure 2017-12-22 15:04:00 -08:00
Martin Braun
db52a26d3a mpm: Increased find timeout 2017-12-22 15:03:59 -08:00
sugandhagupta
c4c3b8d6b7 mpmd: property tree fixes for multi_usrp, set_freq fixes 2017-12-22 15:03:59 -08:00
Martin Braun
8e5f18dc8d mpmd: Fixed prop tree typo (mboard vs mboards) 2017-12-22 15:03:59 -08:00
Martin Braun
eb4a0cb6eb mpmd/mpm/n310: Added clock and time source APIs 2017-12-22 15:03:59 -08:00
Martin Braun
039de2841b mpm/mpmd: Allow SID increment; more fixes for multi-usrp operation 2017-12-22 15:03:59 -08:00