Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions sched/sched/sched_setparam.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@
#ifdef CONFIG_SCHED_SPORADIC
static inline_function
int set_sporadic_param(FAR const struct sched_param *param,
FAR struct tcb_s *rtcb, FAR struct tcb_s *tcb)
FAR struct tcb_s *tcb)
{
irqstate_t flags;
int ret = OK;

/* Update parameters associated with SCHED_SPORADIC */

if ((rtcb->flags & TCB_FLAG_POLICY_MASK) == TCB_FLAG_SCHED_SPORADIC)
if ((tcb->flags & TCB_FLAG_POLICY_MASK) == TCB_FLAG_SCHED_SPORADIC)
{
FAR struct sporadic_s *sporadic;
clock_t repl_ticks;
Expand Down Expand Up @@ -104,7 +104,7 @@ int set_sporadic_param(FAR const struct sched_param *param,

tcb->timeslice = budget_ticks;

sporadic = rtcb->sporadic;
sporadic = tcb->sporadic;
DEBUGASSERT(sporadic != NULL);

sporadic->hi_priority = param->sched_priority;
Expand Down Expand Up @@ -136,7 +136,7 @@ int set_sporadic_param(FAR const struct sched_param *param,
return ret;
}
#else
# define set_sporadic_param(p, r, t) OK
# define set_sporadic_param(p, t) OK
#endif

/****************************************************************************
Expand Down Expand Up @@ -216,7 +216,7 @@ int nxsched_set_param(pid_t pid, FAR const struct sched_param *param)

if (ret >= 0)
{
ret = set_sporadic_param(param, rtcb, tcb);
ret = set_sporadic_param(param, tcb);
}

/* Then perform the reprioritization */
Expand Down Expand Up @@ -271,6 +271,7 @@ int nxsched_set_param(pid_t pid, FAR const struct sched_param *param)
int sched_setparam(pid_t pid, FAR const struct sched_param *param)
{
int ret = nxsched_set_param(pid, param);

if (ret < 0)
{
set_errno(-ret);
Expand Down
7 changes: 5 additions & 2 deletions sched/sched/sched_setscheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int process_sporadic(FAR struct tcb_s *tcb,
if (repl_ticks < budget_ticks)
#endif
{
/* Initialize/reset current sporadic scheduling */
/* Initialize or reset current sporadic scheduling */

if ((tcb->flags & TCB_FLAG_POLICY_MASK) ==
TCB_FLAG_SCHED_SPORADIC)
Expand All @@ -103,6 +103,7 @@ int process_sporadic(FAR struct tcb_s *tcb,

if (ret >= 0)
{
tcb->flags &= ~TCB_FLAG_POLICY_MASK;
tcb->flags |= TCB_FLAG_SCHED_SPORADIC;
tcb->timeslice = budget_ticks;

Expand Down Expand Up @@ -212,7 +213,6 @@ int nxsched_set_scheduler(pid_t pid, int policy,
*/

flags = enter_critical_section();
tcb->flags &= ~TCB_FLAG_POLICY_MASK;

switch (policy)
{
Expand All @@ -229,6 +229,7 @@ int nxsched_set_scheduler(pid_t pid, int policy,

/* Save the FIFO scheduling parameters */

tcb->flags &= ~TCB_FLAG_POLICY_MASK;
tcb->flags |= TCB_FLAG_SCHED_FIFO;
#if CONFIG_RR_INTERVAL > 0 || defined(CONFIG_SCHED_SPORADIC)
tcb->timeslice = 0;
Expand All @@ -250,6 +251,7 @@ int nxsched_set_scheduler(pid_t pid, int policy,

/* Save the round robin scheduling parameters */

tcb->flags &= ~TCB_FLAG_POLICY_MASK;
tcb->flags |= TCB_FLAG_SCHED_RR;
tcb->timeslice = MSEC2TICK(CONFIG_RR_INTERVAL);
break;
Expand Down Expand Up @@ -314,6 +316,7 @@ int sched_setscheduler(pid_t pid, int policy,
FAR const struct sched_param *param)
{
int ret = nxsched_set_scheduler(pid, policy, param);

if (ret < 0)
{
set_errno(-ret);
Expand Down
Loading