Skip to content
Snippets Groups Projects
Commit 0ad56ec0 authored by Federico's avatar Federico
Browse files

Applied a fix to the control scheduler as suggested by Sasan

parent bf956ab4
Branches
No related tags found
2 merge requests!40Update to Miosix 2.7,!17Draft: Improved miosix build system and fixed cmake scripts
......@@ -756,39 +756,37 @@ void ControlScheduler::IRQrecalculateAlfa()
if(sumPriority==0) return;
#ifndef SCHED_CONTROL_FIXED_POINT
float base=1.0f/((float)sumPriority);
//for(Thread *it=threadList;it!=0;it=it->schedData.next)
for (auto it = activeThreads.begin() ; it != activeThreads.end() ; it++)
for(Thread *it=threadList;it!=0;it=it->schedData.next)
{
#ifdef ENABLE_FEEDFORWARD
//Assign zero bursts to blocked threads
if((*it)->t->flags.isReady())
if(it->flags.isReady())
{
(*it)->t->schedData.alfa=base*((float)((*it)->t->schedData.priority.get()+1));
it->schedData.alfa=base*((float)(it->schedData.priority.get()+1));
} else {
(*it)->t->schedData.alfa=0;
it->schedData.alfa=0;
}
#else //ENABLE_FEEDFORWARD
//Assign bursts irrespective of thread blocking status
(*it)->t->schedData.alfa=base*((float)((*it)->t->schedData.priority.get()+1));
it->schedData.alfa=base*((float)(it->schedData.priority.get()+1));
#endif //ENABLE_FEEDFORWARD
}
#else //FIXED_POINT_MATH
//Sum of all alfa is maximum value for an unsigned short
unsigned int base=4096/sumPriority;
//for(Thread *it=threadList;it!=0;it=it->schedData.next)
for (auto it = activeThreads.begin() ; it != activeThreads.end() ; it++)
for(Thread *it=threadList;it!=0;it=it->schedData.next)
{
#ifdef ENABLE_FEEDFORWARD
//Assign zero bursts to blocked threads
if((*it)->t->flags.isReady())
if(it->flags.isReady())
{
(*it)->t->schedData.alfa=base*((*it)->t->schedData.priority.get()+1);
it->schedData.alfa=base*(it->schedData.priority.get()+1);
} else {
(*it)->t->schedData.alfa=0;
it->schedData.alfa=0;
}
#else //ENABLE_FEEDFORWARD
//Assign bursts irrespective of thread blocking status
(*it)->t->schedData.alfa=base*((*it)->t->schedData.priority.get()+1);
it->schedData.alfa=base*(it->schedData.priority.get()+1);
#endif //ENABLE_FEEDFORWARD
}
#endif //FIXED_POINT_MATH
......
......@@ -27,7 +27,9 @@
#ifndef CONTROL_SCHEDULER_H
#define CONTROL_SCHEDULER_H
#define SCHED_CONTROL_MULTIBURST
#include "config/miosix_settings.h"
#include "control_scheduler_types.h"
#include "parameters.h"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment