X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Kernel%2Farch%2Fx86%2Ftime.c;h=9b59b30b100c94f68cc184bcc2f386450e5b32e9;hb=5473bdfc429d224c40e37ff7065a8dbad119fa1e;hp=d4bda951e4270fdf04e343e4c08e3e2d171f0085;hpb=e957c67ea0f63a668303d087af7ee0c7ecff1f01;p=tpg%2Facess2.git diff --git a/Kernel/arch/x86/time.c b/Kernel/arch/x86/time.c index d4bda951..9b59b30b 100644 --- a/Kernel/arch/x86/time.c +++ b/Kernel/arch/x86/time.c @@ -7,12 +7,11 @@ // === MACROS === #define TIMER_QUANTUM 100 -// 2^(15-rate), 15: 1HZ, 5: 1024Hz, 2: 8192Hz -// (Max: 15, Min: 2) - 15 = 1Hz, 13 = 4Hz, 12 = 8Hz, 11 = 16Hz 10 = 32Hz, 2 = 8192Hz +// 2^(15-rate), 14: 2Hz, 5: 1024Hz, 2: 8192Hz +// (Max: 14, Min: 2) - 14 = 2Hz, 13 = 4Hz, 12 = 8Hz, 11 = 16Hz 10 = 32Hz, 2 = 8192Hz //#define TIMER_RATE 10 // 32 Hz //#define TIMER_RATE 12 // 8 Hz -#define TIMER_RATE 14 // 2Hz -//#define TIMER_RATE 15 // 1HZ +#define TIMER_RATE 14 // 2 Hz - Lowest #define TIMER_FREQ (0x8000>>TIMER_RATE) //Hz #define MS_PER_TICK_WHOLE (1000/(TIMER_FREQ)) #define MS_PER_TICK_FRACT ((0x80000000*(1000%TIMER_FREQ))/TIMER_FREQ) @@ -68,9 +67,9 @@ int Time_Setup(void) // Set IRQ8 firing rate outb(0x70, 0x0A); // Set the index to register A val = inb(0x71); // Get the current value of register A - outb(0x70, 0x0A); // Reset index to A val &= 0xF0; - val |= TIMER_RATE; + val |= TIMER_RATE+1; + outb(0x70, 0x0A); // Reset index to A outb(0x71, val); // Update the timer rate // Enable IRQ8 @@ -94,11 +93,9 @@ int Time_Setup(void) /** * \brief Called on the timekeeping IRQ - * \param irq IRQ number (unused) */ void Time_Interrupt(int IRQ, void *Ptr) { - //Log("RTC Tick"); Uint64 curTSC = Time_ReadTSC(); if( giTime_TSCAtLastTick ) @@ -122,25 +119,6 @@ void Time_Interrupt(int IRQ, void *Ptr) inb(0x71); // Just throw away contents. } -#if 0 -/** - * \fn void Time_TimerThread(void) - */ -void Time_TimerThread(void) -{ - Sint64 next; - Threads_SetName("TIMER"); - - next = giTimestamp + TIMER_QUANTUM; - for(;;) - { - while(giTimestamp < next) Threads_Yield(); - next = giTimestamp + TIMER_QUANTUM; - Timer_CallTimers(); - } -} -#endif - Uint64 Time_ReadTSC(void) { Uint32 a, d;