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

Removed redundant call to ISR_preempt in the call graph of the timer interrupt

parent 98e5e76c
Branches
No related tags found
2 merge requests!40Update to Miosix 2.7,!17Draft: Improved miosix build system and fixed cmake scripts
......@@ -3,6 +3,7 @@
#include "interfaces/portability.h"
#include "kernel/kernel.h"
#include "kernel/logging.h"
#include "kernel/scheduler/tick_interrupt.h"
#include <cstdlib>
using namespace miosix;
......@@ -12,10 +13,6 @@ void IRQaddToSleepingList(SleepData *x);
extern SleepData *sleeping_list;
}
namespace miosix_private {
void ISR_preempt();
}
//TODO: comment me
static const uint32_t threshold = 0xffffffff/4*3;
static long long ms32time = 0; //most significant 32 bits of counter
......@@ -83,7 +80,7 @@ void __attribute__((used)) cstirqhnd()
csRecord.wakeup_time += CST_QUANTUM;
IRQaddToSleepingList(&csRecord); //It would also set the next timer interrupt
}
miosix_private::ISR_preempt();
IRQtickInterrupt();
}
}
......@@ -127,6 +124,9 @@ long long ContextSwitchTimer::getNextInterrupt() const
long long ContextSwitchTimer::getCurrentTick() const
{
bool interrupts=areInterruptsEnabled();
//TODO: optimization opportunity, if we can guarantee that no call to this
//function occurs before kernel is started, then we can use
//fastInterruptDisable())
if(interrupts) disableInterrupts();
long long result=IRQgetTick();
if(interrupts) enableInterrupts();
......
......@@ -95,6 +95,7 @@ void TIM3_IRQHandler()
namespace miosix_private {
#ifndef USE_CSTIMER
/**
* \internal
* Called by the timer interrupt, preempt to next thread
......@@ -108,6 +109,7 @@ void ISR_preempt()
IRQstackOverflowCheck();
miosix::IRQtickInterrupt();
}
#endif //USE_CSTIMER
/**
* \internal
......
......@@ -3,7 +3,7 @@
namespace miosix {
#define CST_QUANTUM 42000//84000 ///FIXME: remove
#define CST_QUANTUM 84000 ///FIXME: remove
/**
* This class is a low level interface to a hardware timer, that is used as
......
......@@ -29,6 +29,7 @@
#define TICK_INTERRUPT_H
#include "config/miosix_settings.h"
#include "interfaces/portability.h"
#include "scheduler.h"
namespace miosix {
......@@ -43,6 +44,9 @@ extern bool IRQwakeThreads();///\internal Do not use outside the kernel
inline void IRQtickInterrupt()
{
#ifdef USE_CSTIMER
miosix_private::IRQstackOverflowCheck();
#endif //USE_CSTIMER
bool woken=IRQwakeThreads();//Increment tick and wake threads,if any
(void)woken; //Avoid unused variable warning.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment