F´ Flight Software - C/C++ Documentation
devel
A framework for building embedded system applications to NASA flight quality standards.
Toggle main menu visibility
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
z
Functions
a
b
c
d
g
h
i
m
o
p
r
s
t
v
w
Variables
Typedefs
a
b
c
d
e
f
g
h
l
o
p
r
s
t
u
w
Enumerations
Enumerator
a
b
c
f
h
i
n
o
p
s
v
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
~
Functions
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
~
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
w
Typedefs
c
e
s
t
u
w
Enumerations
b
c
d
g
h
m
o
q
s
t
u
w
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
Related Symbols
a
b
c
d
f
g
h
l
p
r
s
t
u
Files
File List
File Members
All
_
a
b
c
d
f
g
h
i
l
m
n
p
r
s
t
u
v
Functions
c
i
m
p
s
u
Variables
_
b
c
f
i
l
p
r
s
Typedefs
b
c
f
i
n
p
s
u
Enumerations
Enumerator
a
b
c
d
f
g
h
p
r
s
t
Macros
_
a
c
d
f
g
h
i
l
m
p
r
s
t
u
v
►
F´ Flight Software - C/C++ Documentation
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
Loading...
Searching...
No Matches
TaskRunner.cpp
Go to the documentation of this file.
1
/*
2
* TaskRunner.cpp
3
*
4
* Created on: Feb 28, 2019
5
* Author: lestarch
6
*/
7
#include <
Fw/Types/Assert.hpp
>
8
#include <
FpConfig.hpp
>
9
#include <
Os/Baremetal/TaskRunner/TaskRunner.hpp
>
10
#include <
Os/Baremetal/TaskRunner/BareTaskHandle.hpp
>
11
namespace
Os
{
12
13
TaskRunner::TaskRunner
() :
14
m_index(0),
15
m_cont(true)
16
{
17
for
(U32 i = 0; i <
TASK_REGISTRY_CAP
; i++) {
18
this->m_task_table[i] = 0;
19
}
20
Task::registerTaskRegistry
(
this
);
21
}
13
TaskRunner::TaskRunner
() : {
…
}
22
TaskRunner::~TaskRunner
() {}
23
24
void
TaskRunner::addTask
(
Task
* task) {
25
FW_ASSERT
(m_index <
TASK_REGISTRY_CAP
);
26
this->m_task_table[m_index] = task;
27
m_index++;
28
}
24
void
TaskRunner::addTask
(
Task
* task) {
…
}
29
30
void
TaskRunner::removeTask
(
Task
* task) {
31
bool
found =
false
;
32
//Squash that existing task
33
for
(U32 i = 0; i <
TASK_REGISTRY_CAP
; i++) {
34
found = found | (task == this->m_task_table[i]);
35
//If not found, keep looking
36
if
(!found) {
37
continue
;
38
}
39
//If we are less than the end of the array, shift variables over
40
else
if
(i <
TASK_REGISTRY_CAP
- 1) {
41
this->m_task_table[i] = this->m_task_table[i+1];
42
}
43
//If the last element, mark NULL
44
else
{
45
this->m_task_table[i] =
nullptr
;
46
}
47
}
48
}
30
void
TaskRunner::removeTask
(
Task
* task) {
…
}
49
50
void
TaskRunner::stop
() {
51
m_cont =
false
;
52
}
50
void
TaskRunner::stop
() {
…
}
53
54
void
TaskRunner::run
() {
55
U32 i = 0;
56
if
(!m_cont) {
57
return
;
58
}
59
//Loop through full table
60
for
(i = 0; i <
TASK_REGISTRY_CAP
; i++) {
61
//Break at end of table
62
if
(m_task_table[i] ==
nullptr
) {
63
break
;
64
}
65
//Get bare task or break
66
BareTaskHandle
* handle =
reinterpret_cast<
BareTaskHandle
*
>
(m_task_table[i]->
getRawHandle
());
67
if
(handle ==
nullptr
|| handle->
m_routine
==
nullptr
|| !handle->
m_enabled
) {
68
continue
;
69
}
70
//Run-it!
71
handle->
m_routine
(handle->
m_argument
);
72
//Disable tasks that have "exited" or stopped
73
handle->
m_enabled
= m_task_table[i]->
isStarted
();
74
}
75
//Check if no tasks, and stop
76
if
(i == 0) {
77
m_cont =
false
;
78
}
79
}
54
void
TaskRunner::run
() {
…
}
80
}
Assert.hpp
FW_ASSERT
#define FW_ASSERT(...)
Definition
Assert.hpp:14
BareTaskHandle.hpp
FpConfig.hpp
C++-compatible configuration header for fprime configuration.
TaskRunner.hpp
TASK_REGISTRY_CAP
#define TASK_REGISTRY_CAP
Definition
TaskRunner.hpp:13
Os::BareTaskHandle
Definition
BareTaskHandle.hpp:14
Os::BareTaskHandle::m_argument
void * m_argument
Definition
BareTaskHandle.hpp:25
Os::BareTaskHandle::m_enabled
bool m_enabled
Save the priority.
Definition
BareTaskHandle.hpp:19
Os::BareTaskHandle::m_routine
Task::taskRoutine m_routine
Argument input pointer.
Definition
BareTaskHandle.hpp:23
Os::Task
forward declaration
Definition
Task.hpp:15
Os::Task::isStarted
bool isStarted()
check to see if task is started
Definition
TaskCommon.cpp:21
Os::Task::registerTaskRegistry
static void registerTaskRegistry(TaskRegistry *registry)
Definition
TaskCommon.cpp:37
Os::Task::getRawHandle
POINTER_CAST getRawHandle()
Definition
TaskCommon.cpp:33
Os::TaskRunner::removeTask
void removeTask(Task *task)
Definition
TaskRunner.cpp:30
Os::TaskRunner::stop
void stop()
Definition
TaskRunner.cpp:50
Os::TaskRunner::run
void run()
Definition
TaskRunner.cpp:54
Os::TaskRunner::TaskRunner
TaskRunner()
< Nothing constructor
Definition
TaskRunner.cpp:13
Os::TaskRunner::~TaskRunner
~TaskRunner()
Definition
TaskRunner.cpp:22
Os::TaskRunner::addTask
void addTask(Task *task)
Definition
TaskRunner.cpp:24
Os
Definition
File.cpp:6
Os
Baremetal
TaskRunner
TaskRunner.cpp
Generated by
1.10.0