Revision ca641773

b/host/docs/CMakeLists.txt
23 23
    build.rst
24 24
    coding.rst
25 25
    dboards.rst
26
    general.rst
26 27
    usrp2.rst
27 28
)
28 29

  
b/host/docs/general.rst
1
========================================================================
2
UHD - General Application Notes
3
========================================================================
4

  
5
.. contents:: Table of Contents
6

  
7
------------------------------------------------------------------------
8
Finding devices
9
------------------------------------------------------------------------
10

  
11
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
12
Device addressing
13
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14
Deviced are addressed through key/value string pairs.
15
These string pairs can be used to narrow down the search for a specific device or group of devices.
16
Most UHD utility applications and examples have a --args parameter that takes a device address;
17
where the device address is expressed as a delimited string.
18

  
19
* See the documentation in types/device_addr.hpp for reference.
20
* See device-specific application notes for usage.
21

  
22
**Example:**
23
::
24

  
25
    serial=0x1234, type=usrpx
26

  
27
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
28
Device discovery
29
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30
Devices attached to your system can be discovered using the "uhd_find_devices" program.
31
The find devices program scans your system for supported devices and prints
32
out an enumerated list of discovered devices and their addresses.
33
The list of discovered devices can be narrowed down by specifying device address args.
34

  
35
**Usage:**
36
::
37

  
38
    uhd_find_devices
39

  
40
    -- OR --
41

  
42
    uhd_find_devices --args <device-specific-address-args>
43

  
44
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
45
Device properties
46
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47
Properties of devices attached to your system can be probed with the "uhd_usrp_probe" program.
48
The usrp probe program contructs an instance of the device and prints out its properties;
49
properties such as detected daughter-boards, frequency range, gain ranges, etc...
50

  
51
**Usage:**
52
::
53

  
54
    uhd_usrp_probe --args <device-specific-address-args>
55

  
56
------------------------------------------------------------------------
57
Misc notes
58
------------------------------------------------------------------------
59

  
60
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
61
Process scheduling
62
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
63

  
64
The UHD will try to automatically boost the process's scheduling priority.
65
Currently, this is only supported on platforms with *sched.h*.
66

  
67
When setting the priority fails, the UHD prints out an error.
68
This error is harmless, it simply means that your process will have a normal scheduling priority.
69

  
70
**Linux Notes:**
71

  
72
Non-privileged users need special permission to change the scheduling priority.
73
Add the following line to */etc/security/limits.conf*:
74
::
75

  
76
    @<my_group>    -    rtprio    99
77

  
78
Replace <my_group> with a group to which your user belongs.
79
Settings will not take effect until the user has logged in and out.
b/host/docs/index.rst
18 18
* `Build Guide <./build.html>`_
19 19

  
20 20
^^^^^^^^^^^^^^^^^^^^^
21
Supported Devices
21
Application Notes
22 22
^^^^^^^^^^^^^^^^^^^^^
23
* `General App Notes <./general.html>`_
23 24
* `USRP2 App Notes <./usrp2.html>`_
24 25
* `Daughterboard App Notes <./dboards.html>`_
25 26

  
b/host/lib/CMakeLists.txt
74 74
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/usrp/usrp2/CMakeLists.txt)
75 75

  
76 76
########################################################################
77
# Setup defines for process scheduling
78
########################################################################
79
MESSAGE(STATUS "Configuring process scheduling...")
80

  
81
INCLUDE(CheckIncludeFileCXX)
82
CHECK_INCLUDE_FILE_CXX(sched.h HAVE_SCHED_H)
83

  
84
IF(HAVE_SCHED_H)
85
    MESSAGE(STATUS "  Process scheduling supported through sched_setscheduler.")
86
    ADD_DEFINITIONS(-DHAVE_SCHED_H)
87
ELSE(HAVE_SCHED_H)
88
    MESSAGE(STATUS "  Process scheduling not supported.")
89
ENDIF(HAVE_SCHED_H)
90

  
91
########################################################################
77 92
# Setup defines for module loading
78 93
########################################################################
79 94
MESSAGE(STATUS "Configuring module loading...")
......
99 114
    ${CMAKE_CURRENT_SOURCE_DIR}/device.cpp
100 115
    ${CMAKE_CURRENT_SOURCE_DIR}/gain_handler.cpp
101 116
    ${CMAKE_CURRENT_SOURCE_DIR}/load_modules.cpp
117
    ${CMAKE_CURRENT_SOURCE_DIR}/sched.cpp
102 118
    ${CMAKE_CURRENT_SOURCE_DIR}/types.cpp
103 119
    ${CMAKE_CURRENT_SOURCE_DIR}/utils.cpp
104 120
    ${CMAKE_CURRENT_SOURCE_DIR}/wax.cpp
b/host/lib/sched.cpp
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
#include <uhd/utils/static.hpp>
19
#include <stdexcept>
20
#include <iostream>
21

  
22
#ifdef HAVE_SCHED_H
23
#include <sched.h>
24

  
25
/*
26
 * # /etc/security/limits.conf
27
#
28
@usrp   -       rtprio  99
29
*/
30

  
31
UHD_STATIC_BLOCK(setup_process_sched){
32
    try{
33
        int policy = SCHED_RR;
34
        int max_pri = sched_get_priority_max(policy);
35
        if (max_pri == -1) throw std::runtime_error("sched_get_priority_max with SCHED_RR failed");
36
        sched_param sp; sp.sched_priority = max_pri;
37
        int ss_ret = sched_setscheduler(0, policy, &sp);
38
        if (ss_ret == -1) throw std::runtime_error("sched_setscheduler with SCHED_RR failed");
39
    }
40
    catch(const std::exception &e){
41
        std::cerr << "Process scheduling error: " << e.what() << std::endl;
42
    }
43
}
44

  
45
#endif /* HAVE_SCHED_H */

Also available in: Unified diff