Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NuttX RTOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
f4grx
NuttX RTOS
Commits
26fd7a7c
Commit
26fd7a7c
authored
9 years ago
by
Gregory Nutt
Browse files
Options
Downloads
Patches
Plain Diff
The redesigned sporadic scheduler now seems to be functional
parent
27e21710
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sched/sched/sched_sporadic.c
+18
-7
18 additions, 7 deletions
sched/sched/sched_sporadic.c
with
18 additions
and
7 deletions
sched/sched/sched_sporadic.c
+
18
−
7
View file @
26fd7a7c
...
...
@@ -113,7 +113,7 @@ static int sporadic_budget_start(FAR struct tcb_s *tcb,
tcb
->
timeslice
=
budget
;
ret
=
wd_start
(
&
repl
->
timer
,
sporadic
->
budget
,
sporadic_budget_expire
,
1
,
(
wdentry_t
)
sporadic
);
1
,
(
wdentry_t
)
repl
);
#ifdef CONFIG_PRIORITY_INHERITANCE
/* If the priority was boosted above the higher priority, than just
...
...
@@ -147,7 +147,9 @@ static int sporadic_budget_start(FAR struct tcb_s *tcb,
ret
=
sched_reprioritize
(
tcb
,
sporadic
->
hi_priority
);
if
(
ret
<
0
)
{
return
-
get_errno
();
int
errcode
=
get_errno
();
slldbg
(
"ERROR: sched_reprioritize failed: %d
\n
"
,
errcode
);
return
-
errcode
;
}
return
OK
;
...
...
@@ -269,7 +271,9 @@ static int sporadic_set_lowpriority(FAR struct tcb_s *tcb)
ret
=
sched_reprioritize
(
tcb
,
sporadic
->
low_priority
);
if
(
ret
<
0
)
{
return
-
get_errno
();
int
errcode
=
get_errno
();
slldbg
(
"ERROR: sched_reprioritize failed: %d
\n
"
,
errcode
);
return
-
errcode
;
}
return
OK
;
...
...
@@ -485,7 +489,8 @@ static void sporadic_timer_cancel(FAR struct tcb_s *tcb)
* sporadic - The task's sporadic scheduling state.
*
* Returned Value:
* The allocated replenishment timer structure; NULL is returned on a failure
* The allocated replenishment timer structure; NULL is returned on a
* failure
*
****************************************************************************/
...
...
@@ -522,7 +527,6 @@ FAR struct replenishment_s *
return
repl
;
}
/****************************************************************************
* Public Functions
****************************************************************************/
...
...
@@ -555,6 +559,7 @@ int sched_sporadic_initialize(FAR struct tcb_s *tcb)
sporadic
=
(
FAR
struct
sporadic_s
*
)
kmm_zalloc
(
sizeof
(
struct
sporadic_s
));
if
(
sporadic
==
NULL
)
{
slldbg
(
"ERROR: Failed to alloate sporadic data structure
\n
"
);
return
-
ENOMEM
;
}
...
...
@@ -768,13 +773,19 @@ int sched_sporadic_resume(FAR struct tcb_s *tcb)
/* Allocate a new replenishment timer */
repl
=
sporadic_alloc_repl
(
sporadic
);
if
(
repl
)
if
(
repl
!=
NULL
)
{
budget
=
tcb
->
timeslice
;
return
sporadic_budget_start
(
tcb
,
repl
,
budget
);
}
return
-
ENOMEM
;
/* We need to return success even on a failure to allocate. Doing
* nothing is our fall-back behavior and that is not a failure from
* the standpoint of higher level logic.
*/
slldbg
(
"ERROR failed to allocate timer, nrepls=%d
\n
"
,
sporadic
->
nrepls
);
}
return
OK
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment