F´ Flight Software - C/C++ Documentation
NASA-v1.5.0
A framework for building embedded system applications to NASA flight quality standards.
Main Page
Related Pages
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
w
Functions
a
b
c
d
g
h
i
m
r
s
t
v
w
Variables
Typedefs
Enumerations
Enumerator
a
b
c
f
h
i
l
m
n
o
p
s
t
v
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
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
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
Typedefs
c
t
u
w
Enumerations
b
c
d
e
f
g
h
i
m
o
p
q
s
t
w
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
w
Related Functions
a
b
c
f
g
h
l
p
r
s
t
Files
File List
File Members
All
_
a
b
c
d
f
g
h
i
k
l
m
n
p
r
s
t
u
v
w
Functions
f
i
m
s
u
Variables
_
c
f
i
l
p
t
Typedefs
Enumerations
Enumerator
a
c
d
f
i
m
p
r
s
t
w
Macros
a
c
d
f
g
h
i
k
l
m
n
p
r
s
t
u
v
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
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 <
Fw/Types/BasicTypes.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
}
22
TaskRunner::~TaskRunner
() {}
28
void
TaskRunner::addTask
(
Task
* task) {
29
FW_ASSERT
(m_index <
TASK_REGISTRY_CAP
);
30
this->m_task_table[m_index] = task;
31
m_index++;
32
}
37
void
TaskRunner::removeTask
(
Task
* task) {
38
bool
found =
false
;
39
//Squash that existing task
40
for
(U32 i = 0; i <
TASK_REGISTRY_CAP
; i++) {
41
found = found | (task == this->m_task_table[i]);
42
//If not found, keep looking
43
if
(!found) {
44
continue
;
45
}
46
//If we are less than the end of the array, shift variables over
47
else
if
(i <
TASK_REGISTRY_CAP
- 1) {
48
this->m_task_table[i] = this->m_task_table[i+1];
49
}
50
//If the last element, mark NULL
51
else
{
52
this->m_task_table[i] =
NULL
;
53
}
54
}
55
}
59
void
TaskRunner::stop
() {
60
m_cont =
false
;
61
}
65
void
TaskRunner::run
() {
66
U32 i = 0;
67
if
(!m_cont) {
68
return
;
69
}
70
//Loop through full table
71
for
(i = 0; i <
TASK_REGISTRY_CAP
; i++) {
72
//Break at end of table
73
if
(m_task_table[i] ==
NULL
) {
74
break
;
75
}
76
//Get bare task or break
77
BareTaskHandle
* handle =
reinterpret_cast<
BareTaskHandle
*
>
(m_task_table[i]->
getRawHandle
());
78
if
(handle ==
NULL
|| handle->
m_routine
==
NULL
|| !handle->
m_enabled
) {
79
continue
;
80
}
81
//Run-it!
82
handle->
m_routine
(handle->
m_argument
);
83
//Disable tasks that have "exited" or stopped
84
handle->
m_enabled
= m_task_table[i]->
isStarted
();
85
}
86
//Check if no tasks, and stop
87
if
(i == 0) {
88
m_cont =
false
;
89
}
90
}
91
}
Os
Definition:
File.cpp:7
Os::TaskRunner::addTask
void addTask(Task *task)
Definition:
TaskRunner.cpp:28
Os::BareTaskHandle::m_enabled
bool m_enabled
Save the priority.
Definition:
BareTaskHandle.hpp:19
Os::BareTaskHandle::m_argument
void * m_argument
Definition:
BareTaskHandle.hpp:25
Os::BareTaskHandle::m_routine
Task::taskRoutine m_routine
Argument input pointer.
Definition:
BareTaskHandle.hpp:23
Os::Task::registerTaskRegistry
static void registerTaskRegistry(TaskRegistry *registry)
Definition:
TaskCommon.cpp:35
Assert.hpp
Os::TaskRunner::stop
void stop()
Definition:
TaskRunner.cpp:59
Os::TaskRunner::~TaskRunner
~TaskRunner()
Definition:
TaskRunner.cpp:22
FW_ASSERT
#define FW_ASSERT(...)
Definition:
Assert.hpp:9
Os::Task::isStarted
bool isStarted(void)
check to see if task is started
Definition:
TaskCommon.cpp:19
Os::TaskRunner::run
void run()
Definition:
TaskRunner.cpp:65
Os::Task::getRawHandle
POINTER_CAST getRawHandle()
Definition:
TaskCommon.cpp:31
Os::Task
forward declaration
Definition:
Task.hpp:15
Os::BareTaskHandle
Definition:
BareTaskHandle.hpp:14
Os::TaskRunner::removeTask
void removeTask(Task *task)
Definition:
TaskRunner.cpp:37
Os::TaskRunner::TaskRunner
TaskRunner()
< Nothing constructor
Definition:
TaskRunner.cpp:13
TaskRunner.hpp
TASK_REGISTRY_CAP
#define TASK_REGISTRY_CAP
Definition:
TaskRunner.hpp:13
BasicTypes.hpp
Declares ISF basic types.
BareTaskHandle.hpp
NULL
#define NULL
NULL.
Definition:
BasicTypes.hpp:100
Os
Baremetal
TaskRunner
TaskRunner.cpp
Generated by
1.8.19