No more optimization (for instance) for PIT ISR

This commit is contained in:
Adrien Bourmault 2019-12-21 12:45:54 +01:00
parent b21f82cbdb
commit 7b35afb291
2 changed files with 21 additions and 11 deletions

View File

@ -61,9 +61,9 @@ char *KeFormatCurTime(void);
void KeSetCurTime(Time_t);
void KeEnablePIT(void);
void KeSleep(uint volatile);
Timer_t *KeSetTimer(uint volatile delay);
int KeGetTimer(Timer_t volatile *);
void KeSleep(uint);
Timer_t *KeSetTimer(uint delay);
int KeGetTimer(Timer_t*);
//----------------------------------------------------------------------------//

View File

@ -29,14 +29,17 @@
#define COUNTDONE 1
#define PIT_FREQUENCY 1000 // Hz = 1ms
static Timer_t volatile Timer[20]; //20 concurrent sleep max
static ulong volatile Ticks = 0;
static Time_t volatile CurTime;
static char volatile TimeFmtBuf[22] = { 0 };
static Timer_t Timer[20]; //20 concurrent sleep max
static ulong Ticks = 0;
static Time_t CurTime;
static char TimeFmtBuf[22] = { 0 };
//
// ISR handler for the Programmable Interval Timer
//
#pragma GCC push_options
#pragma GCC optimize ("O0")
static void HandlePIT(ISRFrame_t *regs)
{
Ticks++;
@ -52,6 +55,7 @@ static void HandlePIT(ISRFrame_t *regs)
KeSendEOItoPIC(0x28);
}
}
#pragma GCC pop_options
static Timer_t* KeFindTimerBlock(void)
{
@ -63,6 +67,8 @@ static Timer_t* KeFindTimerBlock(void)
return NULL;
}
#pragma GCC push_options
#pragma GCC optimize ("O0")
void KeSleep(uint delay)
{
Timer_t *timerBlock;
@ -77,20 +83,24 @@ void KeSleep(uint delay)
}
timerBlock->sema = 0;
}
#pragma GCC pop_options
Timer_t *KeSetTimer(uint volatile delay)
#pragma GCC push_options
#pragma GCC optimize ("O0")
Timer_t *KeSetTimer(uint delay)
{
Timer_t volatile *timerBlock;
Timer_t *timerBlock;
if ((timerBlock = (Timer_t volatile*)KeFindTimerBlock()) == NULL)
if ((timerBlock = (Timer_t*)KeFindTimerBlock()) == NULL)
return NULL;
timerBlock->countDown = delay * PIT_FREQUENCY / 1000;
return timerBlock;
}
#pragma GCC pop_options
int KeGetTimer(Timer_t volatile *timerBlock)
int KeGetTimer(Timer_t *timerBlock)
{
if (!(timerBlock->sema)) {
return 0;