Revision f5c62a46

b/host/docs/usrp1.rst
22 22
TODO
23 23

  
24 24
------------------------------------------------------------------------
25
Specifying the subdevice to use
26
------------------------------------------------------------------------
27
The USRP1 has multiple daughterboard slots, known as slot A and slot B.
28
The subdevice specification can be used to select
29
the daughterboard and subdevice for each channel.
30
For daughterboards with one one subdevice,
31
the subdevice name may be left blank for automatic selection.
32

  
33
Ex: The subdev spec markup string to select a WBX on slot B.
34
Notice the use of the blank subdevice name for automatic selection.
35

  
36
::
37

  
38
    B:
39

  
40
    -- OR --
41

  
42
    B:0
43

  
44
Ex: The subdev spec markup string to select a BasicRX on slot B.
45
Notice that the subdevice name is always specified in the 3 possible cases.
46

  
47
::
48

  
49
    B:AB
50

  
51
    -- OR --
52

  
53
    B:A
54

  
55
    -- OR --
56

  
57
    B:B
58

  
59
------------------------------------------------------------------------
25 60
OS Specific Notes
26 61
------------------------------------------------------------------------
27 62

  
b/host/include/uhd/usrp/subdev_spec.hpp
56 56
     *
57 57
     * The subdevice specification can be represented as a markup-string.
58 58
     * The markup-string is a whitespace separated list of dboard:subdev pairs.
59
     * The "dboard:" part is optional on boards with only one daughterboard slot.
60 59
     * The first pair represents the subdevice for channel zero,
61 60
     * the second pair represents the subdevice for channel one, and so on.
62
     *
63
     * Examples:
64
     * - Use subdevice AB on daughterboard A (USRP1): "A:AB"
65
     * - Use subdevice A on daughterboard A for channel zero and subdevice A on daughterboard B for channel one (USRP1): "A:A B:A"
66
     * - Use subdevice AB (USRP2): "AB" or ":AB"
67
     *
68
     * An empty subdevice specification can be used to automatically
69
     * select the first subdevice on the first present daughterboard.
70 61
     */
71 62
    class UHD_API subdev_spec_t : public std::vector<subdev_spec_pair_t>{
72 63
    public:
b/host/lib/usrp/misc_utils.cpp
164 164
            //empty db name means select dboard automatically
165 165
            if (pair.db_name.empty()){
166 166
                if (dboard_names.size() != 1) throw std::runtime_error(
167
                    "A daughterboard name must be provided for multi-slot boards: " + subdev_spec.to_string()
167
                    "A daughterboard name must be provided for multi-slot motherboards: " + subdev_spec.to_string()
168 168
                );
169 169
                pair.db_name == dboard_names.front();
170 170
            }
171 171
            uhd::assert_has(dboard_names, pair.db_name, xx_type + " dboard name");
172 172
            wax::obj dboard = mboard[named_prop_t(dboard_prop, pair.db_name)];
173
            uhd::assert_has(dboard[DBOARD_PROP_SUBDEV_NAMES].as<prop_names_t>(), pair.sd_name, xx_type + " subdev name");
173
            prop_names_t subdev_names = dboard[DBOARD_PROP_SUBDEV_NAMES].as<prop_names_t>();
174

  
175
            //empty sd name means select the subdev automatically
176
            if (pair.sd_name.empty()){
177
                if (subdev_names.size() != 1) throw std::runtime_error(
178
                    "A subdevice name must be provided for multi-subdev daughterboards: " + subdev_spec.to_string()
179
                );
180
                pair.sd_name == subdev_names.front();
181
            }
182
            uhd::assert_has(subdev_names, pair.sd_name, xx_type + " subdev name");
174 183
        }
175 184
    }catch(const std::exception &e){
176 185
        throw std::runtime_error(str(boost::format(

Also available in: Unified diff