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 KeSetCurTime(Time_t);
void KeEnablePIT(void); void KeEnablePIT(void);
void KeSleep(uint volatile); void KeSleep(uint);
Timer_t *KeSetTimer(uint volatile delay); Timer_t *KeSetTimer(uint delay);
int KeGetTimer(Timer_t volatile *); int KeGetTimer(Timer_t*);
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//

View File

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