From 7b35afb2912e59c93e232f85b03343509bd7e6af Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Sat, 21 Dec 2019 12:45:54 +0100 Subject: [PATCH] No more optimization (for instance) for PIT ISR --- include/ke/time.h | 6 +++--- kaleid/kernel/ke/pit.c | 26 ++++++++++++++++++-------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/include/ke/time.h b/include/ke/time.h index 1d7840f..b205289 100644 --- a/include/ke/time.h +++ b/include/ke/time.h @@ -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*); //----------------------------------------------------------------------------// diff --git a/kaleid/kernel/ke/pit.c b/kaleid/kernel/ke/pit.c index c20dad7..a9d961c 100644 --- a/kaleid/kernel/ke/pit.c +++ b/kaleid/kernel/ke/pit.c @@ -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;