Statistics
| Branch: | Tag: | Revision:

root / host / include / uhd / usrp / subdev_spec.hpp @ f5c62a46

History | View | Annotate | Download (3 kB)

1
//
2
// Copyright 2010 Ettus Research LLC
3
//
4
// This program is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
//
17

    
18
#ifndef INCLUDED_UHD_USRP_SUBDEV_SPEC_HPP
19
#define INCLUDED_UHD_USRP_SUBDEV_SPEC_HPP
20

    
21
#include <uhd/config.hpp>
22
#include <vector>
23
#include <string>
24

    
25
namespace uhd{ namespace usrp{
26

    
27
    /*!
28
     * A subdevice specification (daughterboard, subdevice) name pairing.
29
     */
30
    struct UHD_API subdev_spec_pair_t{
31
        //! The daughterboard name
32
        std::string db_name;
33

    
34
        //! The subdevice name
35
        std::string sd_name;
36

    
37
        /*!
38
         * Create a new subdevice specification pair from dboard and subdev names.
39
         * \param db_name the name of a daughterboard slot
40
         * \param sd_name the name of a subdevice on that daughterboard
41
         */
42
        subdev_spec_pair_t(
43
            const std::string &db_name = "",
44
            const std::string &sd_name = ""
45
        );
46
    };
47

    
48
    /*!
49
     * A list of (daughterboard name, subdevice name) pairs:
50
     *
51
     * A subdevice specification represents a list of subdevices on a motherboard.
52
     * The subdevices specified may span across multiple daughterboards;
53
     * Hence the need for a subdevice specification over a simple list of strings.
54
     * Typically, the user will pass a RX or TX subdevice specification into the API,
55
     * and the implementation will infer the channel configuration from the specification.
56
     *
57
     * The subdevice specification can be represented as a markup-string.
58
     * The markup-string is a whitespace separated list of dboard:subdev pairs.
59
     * The first pair represents the subdevice for channel zero,
60
     * the second pair represents the subdevice for channel one, and so on.
61
     */
62
    class UHD_API subdev_spec_t : public std::vector<subdev_spec_pair_t>{
63
    public:
64

    
65
        /*!
66
         * Create a subdev specification from a markup string.
67
         * \param markup the markup string
68
         */
69
        subdev_spec_t(const std::string &markup = "");
70

    
71
        /*!
72
         * Convert a subdev specification into a pretty print string.
73
         * \return a printable string representing the subdev specification
74
         */
75
        std::string to_pp_string(void) const;
76

    
77
        /*!
78
         * Convert the subdevice specification into a markup string.
79
         * The markup string contains the delimiter symbols.
80
         * \return a string with delimiter markup
81
         */
82
        std::string to_string(void) const;
83
    };
84

    
85
}}
86

    
87
#endif /* INCLUDED_UHD_USRP_SUBDEV_SPEC_HPP */