Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Toggle main menu visibility
Main Page
Related Pages
Topics
Data Structures
Data Structures
Data Structure Index
Data Fields
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
m
n
p
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
v
w
z
Enumerator
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
Loading...
Searching...
No Matches
rt_priority.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2015 Felix Ruess <felix.ruess@gmail.com>
3
*
4
* This file is part of paparazzi.
5
*
6
* paparazzi is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2, or (at your option)
9
* any later version.
10
*
11
* paparazzi is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with paparazzi; see the file COPYING. If not, see
18
* <http://www.gnu.org/licenses/>.
19
*/
20
26
#ifndef RT_PRIORITY_H
27
#define RT_PRIORITY_H
28
29
#include <pthread.h>
30
#include <stdio.h>
31
32
static
inline
int
get_rt_prio
(
int
prio
)
33
{
34
struct
sched_param
param;
35
int
policy
;
36
pthread_getschedparam
(
pthread_self
(), &
policy
, ¶m);
37
printf
(
"Current schedparam: policy %d, prio %d\n"
,
policy
, param.sched_priority);
38
39
//SCHED_RR, SCHED_FIFO, SCHED_OTHER (POSIX scheduling policies)
40
int
sched
=
SCHED_FIFO
;
41
int
min =
sched_get_priority_min
(
sched
);
42
int
max =
sched_get_priority_max
(
sched
);
43
param.sched_priority =
prio
;
44
if
(
prio
> max ||
prio
< min) {
45
printf
(
"Requested prio %d outside current min/max prios: %d/%d\n"
,
prio
, min, max);
46
if
(
prio
> max) {
47
param.sched_priority = max;
48
}
else
{
49
param.sched_priority = min;
50
}
51
}
52
53
if
(
pthread_setschedparam
(
pthread_self
(),
sched
, ¶m)) {
54
perror
(
"setschedparam failed!"
);
55
return
-1;
56
}
57
else
{
58
pthread_getschedparam
(
pthread_self
(), &
policy
, ¶m);
59
printf
(
"New schedparam: policy %d, prio %d\n"
,
policy
, param.sched_priority);
60
}
61
62
return
0;
63
}
32
static
inline
int
get_rt_prio
(
int
prio
) {
…
}
64
65
#include <sys/resource.h>
66
#include <unistd.h>
67
#include <sys/syscall.h>
68
69
static
inline
int
set_nice_level
(
int
level
)
70
{
71
pid_t
tid
;
72
tid
=
syscall
(
SYS_gettid
);
73
74
return
setpriority
(
PRIO_PROCESS
,
tid
,
level
);
75
}
69
static
inline
int
set_nice_level
(
int
level
) {
…
}
76
77
#endif
/* RT_PRIORITY_H */
foo
uint16_t foo
Definition
main_demo5.c:58
get_rt_prio
static int get_rt_prio(int prio)
Definition
rt_priority.h:32
set_nice_level
static int set_nice_level(int level)
Definition
rt_priority.h:69
sw
airborne
arch
linux
rt_priority.h
Generated on Fri Apr 4 2025 14:56:49 for Paparazzi UAS by
1.9.8