1
0
mirror of https://gitlab.os-k.eu/os-k-team/os-k.git synced 2023-08-25 14:03:10 +02:00

Some buggy stuff about optimization of PIT

This commit is contained in:
Adrien Bourmault 2019-12-21 12:40:53 +01:00
parent fcf6e745a7
commit b21f82cbdb
3 changed files with 25 additions and 11 deletions

View File

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

View File

@ -29,10 +29,10 @@
#define COUNTDONE 1
#define PIT_FREQUENCY 1000 // Hz = 1ms
static Timer_t Timer[20]; //20 concurrent sleep max
static ulong Ticks = 0;
static Time_t CurTime;
static char TimeFmtBuf[22] = { 0 };
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 };
//
// ISR handler for the Programmable Interval Timer
@ -78,11 +78,11 @@ void KeSleep(uint delay)
timerBlock->sema = 0;
}
Timer_t *KeSetTimer(uint delay)
Timer_t *KeSetTimer(uint volatile delay)
{
Timer_t *timerBlock;
Timer_t volatile *timerBlock;
if ((timerBlock = (Timer_t*)KeFindTimerBlock()) == NULL)
if ((timerBlock = (Timer_t volatile*)KeFindTimerBlock()) == NULL)
return NULL;
timerBlock->countDown = delay * PIT_FREQUENCY / 1000;
@ -90,7 +90,7 @@ Timer_t *KeSetTimer(uint delay)
return timerBlock;
}
int KeGetTimer(Timer_t *timerBlock)
int KeGetTimer(Timer_t volatile *timerBlock)
{
if (!(timerBlock->sema)) {
return 0;

View File

@ -55,6 +55,19 @@ error_t CmdArgs(int argc, char **argv, char *cmdline)
return EOK;
}
error_t CmdAtoi(int argc, char **argv, char *cmdline)
{
int i;
KernLog("cmdline: '%s'\nargc: %d\n", cmdline, argc);
for (i = 0; i < argc; i++) {
KernLog("argv[%d]: '%u'\n", i, atoi(argv[i]));
}
return EOK;
}
error_t CmdDumpATASect(int argc, char **argv, char *cmdline)
{
char sector[512] = {0};
@ -199,6 +212,7 @@ error_t CmdTimerTest(int argc, char **argv, char *cmdline)
static Command_t testcmdtable[] =
{
{ "args", CmdArgs, "Print command line" },
{ "atoi", CmdAtoi, "Print command line atoised" },
{ "dmpsec", CmdDumpATASect, "Dump an ATA sector on screen" },
{ "help", CmdHelpTest, "Show this message" },
{ "div", CmdFloatDiv, "Float div. Usage : div a b. Returns a/b"},