include/, sched/, and libc/: Add support for sporadic scheduling parameters in struct sched_param, posix_spawnattr_t, and pthread_attr_t. Update all user interfaces to pass sporadic scheduling parameters. Feature is dependent on EXPERIMENTAL and no changes have yet been made to core scheduling logic.

This commit is contained in:
Gregory Nutt
2015-07-23 13:16:32 -06:00
parent 13e837b957
commit 9095e8eab4
22 changed files with 352 additions and 144 deletions
+9 -1
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* libc/string/lib_psa_getschedparam.c
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -70,5 +70,13 @@ int posix_spawnattr_getschedparam(FAR const posix_spawnattr_t *attr,
{
DEBUGASSERT(attr && param);
param->sched_priority = attr->priority;
#ifdef CONFIG_SCHED_SPORADIC
param->sched_ss_low_priority = (int)attr->low_priority;
param->sched_ss_max_repl = (int)attr->max_repl;
param->sched_ss_repl_period.tv_sec = attr->repl_period.tv_sec;
param->sched_ss_repl_period.tv_nsec = attr->repl_period.tv_nsec;
param->sched_ss_init_budget.tv_sec = attr->budget.tv_sec;
param->sched_ss_init_budget.tv_nsec = attr->budget.tv_nsec;
#endif
return OK;
}
+19 -6
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* libc/string/lib_psa_init.c
*
* Copyright (C) 2013-2014 Gregory Nutt. All rights reserved.
* Copyright (C) 2013-2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -88,22 +88,35 @@ int posix_spawnattr_init(posix_spawnattr_t *attr)
return errno;
}
attr->priority = param.sched_priority;
attr->priority = param.sched_priority;
/* Set the default scheduler policy to the policy of this task */
attr->policy = sched_getscheduler(0);
attr->policy = sched_getscheduler(0);
#ifndef CONFIG_DISABLE_SIGNALS
/* Empty signal masek */
/* Empty signal mask */
attr->sigmask = 0;
attr->sigmask = 0;
#endif
#ifdef CONFIG_SCHED_SPORADIC
/* Sporadic scheduling parameters */
attr->low_priority = (uint8_t)param.sched_ss_low_priority;
attr->max_repl = (uint8_t)param.sched_ss_max_repl;
attr->repl_period.tv_sec = param.sched_ss_repl_period.tv_sec;
attr->repl_period.tv_nsec = param.sched_ss_repl_period.tv_nsec;
attr->budget.tv_sec = param.sched_ss_init_budget.tv_sec;
attr->budget.tv_nsec = param.sched_ss_init_budget.tv_nsec;
#endif
#ifndef CONFIG_ARCH_ADDRENV
/* Default stack size */
attr->stacksize = CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE;
attr->stacksize = CONFIG_TASK_SPAWN_DEFAULT_STACKSIZE;
#endif
return OK;
}
+12 -2
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* libc/string/lib_psa_setschedparam.c
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -69,6 +69,16 @@ int posix_spawnattr_setschedparam(FAR posix_spawnattr_t *attr,
FAR const struct sched_param *param)
{
DEBUGASSERT(attr && param && (unsigned)param->sched_priority <= 0xff);
attr->priority = (uint8_t)param->sched_priority;
attr->priority = (uint8_t)param->sched_priority;
#ifdef CONFIG_SCHED_SPORADIC
attr->low_priority = (uint8_t)param->sched_ss_low_priority;
attr->max_repl = (uint8_t)param->sched_ss_max_repl;
attr->repl_period.tv_sec = param->sched_ss_repl_period.tv_sec;
attr->repl_period.tv_nsec = param->sched_ss_repl_period.tv_nsec;
attr->budget.tv_sec = param->sched_ss_init_budget.tv_sec;
attr->budget.tv_nsec = param->sched_ss_init_budget.tv_nsec;
#endif
return OK;
}